项目库-法规清单表 新增、查询修改。

This commit is contained in:
wangzhijiang
2022-04-18 11:29:11 +08:00
parent 50a716b998
commit 154e523879
4 changed files with 137 additions and 15 deletions
@@ -92,6 +92,7 @@ public class ProjectLawsInventoryEO implements Serializable {
/**实施类别*/
@Excel(name = "实施类别", width = 15)
@ApiModelProperty(value = "实施类别")
@Dict(dicCode ="implement_type")
private String implementType;
/**新车型实施日期*/
@@ -111,11 +112,13 @@ public class ProjectLawsInventoryEO implements Serializable {
/**认证类型*/
@Excel(name = "认证类型", width = 15)
@ApiModelProperty(value = "认证类型")
@Dict(dicCode ="attestation_type")
private String attestationType;
/**认证级别*/
@Excel(name = "认证级别", width = 15)
@ApiModelProperty(value = "认证级别")
@Dict(dicCode ="attestation_rank")
private String attestationRank;
/**WVTA ID*/
@@ -126,6 +129,7 @@ public class ProjectLawsInventoryEO implements Serializable {
/**责任领域*/
@Excel(name = "责任领域", width = 15)
@ApiModelProperty(value = "责任领域")
@Dict(dicCode ="duty_territory")
private String dutyTerritory;
/**法规工程师id*/
@@ -160,6 +164,7 @@ public class ProjectLawsInventoryEO implements Serializable {
/**设计符合性确认-交付物类型*/
@Excel(name = "设计符合性确认-交付物类型", width = 15)
@ApiModelProperty(value = "设计符合性确认-交付物类型")
@Dict(dicCode ="deliverable_template")
private String designDeliverableType;
/**设计符合性确认-交付物模板*/
@@ -170,11 +175,13 @@ public class ProjectLawsInventoryEO implements Serializable {
/**设计符合性确认-发起人*/
@Excel(name = "设计符合性确认-发起人", width = 15)
@ApiModelProperty(value = "设计符合性确认-发起人")
@Dict(dicCode ="fa1_qi3_ren2")
private String designInitiator;
/**设计符合性确认-责任人*/
@Excel(name = "设计符合性确认-责任人", width = 15)
@ApiModelProperty(value = "设计符合性确认-责任人")
@Dict(dicCode ="ze2_ren4_ren2")
private String designDuty;
/**设计符合性确认-截止时间*/
@@ -197,11 +204,13 @@ public class ProjectLawsInventoryEO implements Serializable {
/**prehomo确认-发起人*/
@Excel(name = "prehomo确认-发起人", width = 15)
@ApiModelProperty(value = "prehomo确认-发起人")
@Dict(dicCode ="fa1_qi3_ren2")
private String prehomoInitiator;
/**prehomo确认-责任人*/
@Excel(name = "prehomo确认-责任人", width = 15)
@ApiModelProperty(value = "prehomo确认-责任人")
@Dict(dicCode ="ze2_ren4_ren2")
private String prehomoDuty;
/**prehomo确认-截止时间*/
@@ -224,11 +233,13 @@ public class ProjectLawsInventoryEO implements Serializable {
/**验证符合性确认-发起人*/
@Excel(name = "验证符合性确认-发起人", width = 15)
@ApiModelProperty(value = "验证符合性确认-发起人")
@Dict(dicCode ="fa1_qi3_ren2")
private String verifyInitiator;
/**验证符合性确认-责任人*/
@Excel(name = "验证符合性确认-责任人", width = 15)
@ApiModelProperty(value = "验证符合性确认-责任人")
@Dict(dicCode ="ze2_ren4_ren2")
private String verifyDuty;
/**验证符合性确认-截止时间*/
@@ -271,4 +282,7 @@ public class ProjectLawsInventoryEO implements Serializable {
@ApiModelProperty(value = "认证工程师提交状态")
private String homologationEngineerSubmitStatus;
@TableField(exist = false)
@ApiModelProperty(value = "文档库id")
private String ids;//文档库id 多个之间用英文逗号拼接
}
@@ -0,0 +1,41 @@
package com.jero.modules.project.enums;
public enum OperatorResultEnum {
ACCEPTED("通过","0"),
REJECTED("拒绝","1"),
;
String name;
String value;
private OperatorResultEnum(String name, String value) {
this.name = name;
this.value = value;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public static String getTextByValue(String value) {
OperatorResultEnum[] values = values();
for (OperatorResultEnum operatorResultEnum : values) {
if (operatorResultEnum.value.equals(value)) {
return operatorResultEnum.name;
}
}
return null;
}
}
@@ -0,0 +1,44 @@
package com.jero.modules.project.enums;
/**
* 操作类型枚举类
*/
public enum OperatorTypeEnum {
INVENTORY_AFFIRM("清单确认,studio工程师发起","0"),
SUBMIT_OR_REJECTED("法规、认证工程师提交或拒绝","1"),
;
String name;
String value;
private OperatorTypeEnum(String name, String value) {
this.name = name;
this.value = value;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public static String getTextByValue(String value) {
OperatorTypeEnum[] values = values();
for (OperatorTypeEnum operatorTypeEnum : values) {
if (operatorTypeEnum.value.equals(value)) {
return operatorTypeEnum.name;
}
}
return null;
}
}
@@ -1,14 +1,15 @@
package com.jero.modules.project.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jero.common.api.vo.Result;
import com.jero.common.exception.JeroBootException;
import com.jero.common.system.vo.LoginUser;
import com.jero.modules.document.entity.BussDocumentLibraryEO;
import com.jero.modules.document.service.IBussDocumentLibraryEOService;
import com.jero.modules.project.entity.ProjectLawsInventoryEO;
import com.jero.modules.project.entity.ProjectLibraryBase;
import com.jero.modules.project.enums.ProjectRoleEnum;
import com.jero.modules.project.enums.InventoryAffirmStatusEnum;
import com.jero.modules.project.enums.TaskAffirmStatusEnum;
import com.jero.modules.project.enums.*;
import com.jero.modules.project.mapper.ProjectLawsInventoryEOMapper;
import com.jero.modules.project.mapper.ProjectLibraryBaseMapper;
import com.jero.modules.project.service.IProjectLawsInventoryEOService;
@@ -17,6 +18,7 @@ import com.jero.modules.system.mapper.SysUserMapper;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -40,6 +42,9 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
@Autowired
private SysUserMapper sysUserMapper;
@Autowired
private IBussDocumentLibraryEOService iBussDocumentLibraryEOService;
/**
* 保存
*
@@ -48,12 +53,28 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
*/
@Override
public void add(ProjectLawsInventoryEO projectLawsInventoryEO) {
Date now = new Date();
projectLawsInventoryEO.setCreateTime(now);
projectLawsInventoryEO.setUpdateTime(now);
projectLawsInventoryEO.setTaskAffirmStatus(TaskAffirmStatusEnum.NOT_STARTED.getValue());
projectLawsInventoryEO.setInventoryAffirmStatus(InventoryAffirmStatusEnum.NOT_STARTED.getValue());
save(projectLawsInventoryEO);
String ids = projectLawsInventoryEO.getIds();
if(StringUtils.isEmpty(ids)){
throw new JeroBootException("文档库id不能为空,请检查!");
}
LambdaQueryWrapper<BussDocumentLibraryEO> wrapper = new LambdaQueryWrapper<>();
wrapper.in(BussDocumentLibraryEO::getId, Arrays.asList(ids.split(",")));
List<BussDocumentLibraryEO> bussDocumentLibraryEOList = iBussDocumentLibraryEOService.list(wrapper);
List<ProjectLawsInventoryEO> list = new ArrayList<>();
for (BussDocumentLibraryEO bussDocumentLibraryEO : bussDocumentLibraryEOList) {
ProjectLawsInventoryEO projectLawsInventoryTemp = new ProjectLawsInventoryEO();
BeanUtils.copyProperties(bussDocumentLibraryEO,projectLawsInventoryTemp);
String id = UUID.randomUUID().toString().replace("-", "");
projectLawsInventoryTemp.setId(id);
projectLawsInventoryTemp.setProjectLibraryId(projectLawsInventoryEO.getProjectLibraryId());
projectLawsInventoryTemp.setCreateTime(new Date());
projectLawsInventoryTemp.setUpdateTime(new Date());
projectLawsInventoryTemp.setTaskAffirmStatus(TaskAffirmStatusEnum.NOT_STARTED.getValue());
projectLawsInventoryTemp.setInventoryAffirmStatus(InventoryAffirmStatusEnum.NOT_STARTED.getValue());
list.add(projectLawsInventoryTemp);
}
super.saveBatch(list);
}
/**
@@ -129,8 +150,10 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
//验证当前用户在该项目中是什么角色
int isProjectRole = checkUserRole(projectLibraryId, currentUser.getId(), "");
if(isProjectRole != Integer.parseInt(ProjectRoleEnum.STUDIO_ENGINEER.getValue())){
projectLawsInventoryEOQueryWrapper.lambda().eq(ProjectLawsInventoryEO::getHomologationEngineerId,currentUser.getId());
projectLawsInventoryEOQueryWrapper.lambda().or().eq(ProjectLawsInventoryEO::getRegulationOwnerId,currentUser.getId());
projectLawsInventoryEOQueryWrapper.and(queryWrapper ->{
queryWrapper.eq("regulation_owner_id",currentUser.getId()).
or().eq("homologation_engineer_id",currentUser.getId());
});
}
List<ProjectLawsInventoryEO> result = super.baseMapper.selectList(projectLawsInventoryEOQueryWrapper);
dataDispose(result,currentUser,isProjectRole);
@@ -316,7 +339,7 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
try {
//TODO 切换成枚举,不要在代码里出现魔数
if(StringUtils.equals(operatorType,"0")){
if(StringUtils.equals(operatorType, OperatorTypeEnum.INVENTORY_AFFIRM.getValue())){
QueryWrapper<ProjectLawsInventoryEO> queryWrapper = new QueryWrapper<>();
if(StringUtils.isNotEmpty(ids)){
queryWrapper.lambda().in(ProjectLawsInventoryEO::getId, Arrays.asList(ids.split(",")));
@@ -340,12 +363,12 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
}
}
result = "发起清单确认";
}else if(StringUtils.equals(operatorType,"1")){
}else if(StringUtils.equals(operatorType,OperatorTypeEnum.SUBMIT_OR_REJECTED.getValue())){
//提交结果 0通过 1拒绝
String operatorResult = (String) params.get("operatorResult");
if(StringUtils.equals(operatorResult,"0")){
if(StringUtils.equals(operatorResult, OperatorResultEnum.ACCEPTED.getValue())){
result = "提交";
}else if(StringUtils.equals(operatorResult,"1")){
}else if(StringUtils.equals(operatorResult, OperatorResultEnum.REJECTED.getValue())){
result = "拒绝";
}