法规清单列表查询 清单确认状态修改(增加了四种)。

法规清单确认,法规、认证工程师 通过、拒绝时  发送消息 - 55228bug处理。
This commit is contained in:
wangzhijiang
2022-07-01 17:28:47 +08:00
parent 77accc3efd
commit d65bac3c2b
2 changed files with 208 additions and 10 deletions
@@ -16,6 +16,11 @@ public enum InventoryAffirmStatusEnum {
LIST_TO_CONFIRM("待确认","List to confirm"),
ACCEPTED("接受","Accepted"),
REJECTED("拒绝","Rejected"),
REG_ENG_TO_CONFIRM("法规工程师待确认","To be confirmed by Reg Eng."),
HOMO_ENG_TO_CONFIRM("认证工程师待确认","To be confirmed by Homo Eng."),
REG_ENG_REJECTED("法规工程师拒绝 ","Reg Eng. rejected"),
HOMO_ENG_REJECTED("认证工程师拒绝 ","Homo Eng. rejected"),
;
@@ -1015,15 +1015,78 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
}
//清单确认状态
String inventoryAffirmStatus = projectLawsInventoryEO.getInventoryAffirmStatus();
/*String inventoryAffirmStatus = projectLawsInventoryEO.getInventoryAffirmStatus();
if(StringUtils.isNotEmpty(inventoryAffirmStatus)){
if(StringUtils.equals(cut, CutEnum.CN.getValue())){
projectLawsInventoryEO.setInventoryAffirmStatusName(InventoryAffirmStatusEnum.getTextByValue(inventoryAffirmStatus));
}else {
projectLawsInventoryEO.setInventoryAffirmStatusName(inventoryAffirmStatus);
}
}*/
/**
* 清单确认状态展示
* 待确认展示 法规工程师待确认 认证工程师待确认
* 拒绝展示 法规工程师拒绝 认证工程师拒绝
*
*/
String inventoryAffirmStatus = projectLawsInventoryEO.getInventoryAffirmStatus();
if(StringUtils.isNotEmpty(inventoryAffirmStatus)){
//如果是待确认
if(StringUtils.equals(inventoryAffirmStatus,InventoryAffirmStatusEnum.LIST_TO_CONFIRM.getValue())){
if(StringUtils.isNotEmpty(projectLawsInventoryEO.getHomologationEngineerSubmitStatus())
&& StringUtils.equals(projectLawsInventoryEO.getHomologationEngineerSubmitStatus(),OperatorResultEnum.ACCEPTED.getValue())){
//如果 认证工程师提交状态 不为空则证明认证工程师已经提交过了展示状态应该展示 法规工程师待确认
if(StringUtils.equals(cut, CutEnum.CN.getValue())){
projectLawsInventoryEO.setInventoryAffirmStatusName(InventoryAffirmStatusEnum.REG_ENG_TO_CONFIRM.getName());
}else {
projectLawsInventoryEO.setInventoryAffirmStatusName(InventoryAffirmStatusEnum.REG_ENG_TO_CONFIRM.getValue());
}
}else if(StringUtils.isNotEmpty(projectLawsInventoryEO.getRegulationOwnerSubmitStatus())
&& StringUtils.equals(projectLawsInventoryEO.getRegulationOwnerSubmitStatus(),OperatorResultEnum.ACCEPTED.getValue())){
//如果 法规工程师提交状态 不为空则证明法规工程师已经提交过了展示状态应该展示 认证工程师待确认
if(StringUtils.equals(cut, CutEnum.CN.getValue())){
projectLawsInventoryEO.setInventoryAffirmStatusName(InventoryAffirmStatusEnum.HOMO_ENG_TO_CONFIRM.getName());
}else {
projectLawsInventoryEO.setInventoryAffirmStatusName(InventoryAffirmStatusEnum.HOMO_ENG_TO_CONFIRM.getValue());
}
}else {
if(StringUtils.equals(cut, CutEnum.CN.getValue())){
projectLawsInventoryEO.setInventoryAffirmStatusName(InventoryAffirmStatusEnum.getTextByValue(inventoryAffirmStatus));
}else {
projectLawsInventoryEO.setInventoryAffirmStatusName(inventoryAffirmStatus);
}
}
//如果是拒绝
}else if(StringUtils.equals(inventoryAffirmStatus,InventoryAffirmStatusEnum.REJECTED.getValue())){
if(StringUtils.isNotEmpty(projectLawsInventoryEO.getHomologationEngineerSubmitStatus())
&& StringUtils.equals(projectLawsInventoryEO.getHomologationEngineerSubmitStatus(),OperatorResultEnum.REJECTED.getValue())){
//如果认证工程师提交状态不为空并且认证工程师提交状态为拒绝
if(StringUtils.equals(cut, CutEnum.CN.getValue())){
projectLawsInventoryEO.setInventoryAffirmStatusName(InventoryAffirmStatusEnum.HOMO_ENG_REJECTED.getName());
}else {
projectLawsInventoryEO.setInventoryAffirmStatusName(InventoryAffirmStatusEnum.HOMO_ENG_REJECTED.getValue());
}
}else if(StringUtils.isNotEmpty(projectLawsInventoryEO.getRegulationOwnerSubmitStatus())
&& StringUtils.equals(projectLawsInventoryEO.getRegulationOwnerSubmitStatus(),OperatorResultEnum.REJECTED.getValue())){
//如果 法规工程师提交状态 不为空则证明法规工程师已经提交过了展示状态应该展示 认证工程师待确认
if(StringUtils.equals(cut, CutEnum.CN.getValue())){
projectLawsInventoryEO.setInventoryAffirmStatusName(InventoryAffirmStatusEnum.REG_ENG_REJECTED.getName());
}else {
projectLawsInventoryEO.setInventoryAffirmStatusName(InventoryAffirmStatusEnum.REG_ENG_REJECTED.getValue());
}
}
}else {
if(StringUtils.equals(cut, CutEnum.CN.getValue())){
projectLawsInventoryEO.setInventoryAffirmStatusName(InventoryAffirmStatusEnum.getTextByValue(inventoryAffirmStatus));
}else {
projectLawsInventoryEO.setInventoryAffirmStatusName(inventoryAffirmStatus);
}
}
}
//任务确认状态
String taskAffirmStatus = projectLawsInventoryEO.getTaskAffirmStatus();
if(StringUtils.isNotEmpty(taskAffirmStatus)){
@@ -1208,6 +1271,16 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
}
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
try {
ProjectLibraryBase projectLibraryBase = projectLibraryBaseMapper.selectOne(new QueryWrapper<ProjectLibraryBase>()
.lambda().eq(ProjectLibraryBase::getId, projectLibraryId));
QueryWrapper<ProjectNameInfoEO> projectNameInfoEOQueryWrapper = new QueryWrapper<>();
projectNameInfoEOQueryWrapper.lambda().eq(ProjectNameInfoEO::getId,projectLibraryBase.getProjectNameId());
ProjectNameInfoEO projectNameInfoEO = projectNameInfoEOMapper.selectOne(projectNameInfoEOQueryWrapper);
QueryWrapper<ProjectYearNameInfoEO> projectYearInfoEOQueryWrapper = new QueryWrapper<>();
projectYearInfoEOQueryWrapper.lambda().eq(ProjectYearNameInfoEO::getId,projectLibraryBase.getYearNameId());
ProjectYearNameInfoEO projectYearNameInfoEO = projectYearNameInfoEOMapper.selectOne(projectYearInfoEOQueryWrapper);
//TODO 切换成枚举不要在代码里出现魔数
if(StringUtils.equals(operatorType, OperatorTypeEnum.INVENTORY_AFFIRM.getValue())){
String ids = json.getString("ids");
@@ -1224,8 +1297,7 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
}
queryWrapper.lambda().eq(ProjectLawsInventoryEO::getProjectLibraryId,projectLibraryId);
List<ProjectLawsInventoryEO> projectLawsInventoryEOS = this.baseMapper.selectList(queryWrapper);
ProjectLibraryBase projectLibraryBase = projectLibraryBaseMapper.selectOne(new QueryWrapper<ProjectLibraryBase>()
.lambda().eq(ProjectLibraryBase::getId, projectLibraryId));
List<String> userIdList = new ArrayList<>();
for (ProjectLawsInventoryEO projectLawsInventoryEO : projectLawsInventoryEOS) {
@@ -1254,13 +1326,7 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
if(CollectionUtils.isNotEmpty(userIdList)){
userIdList = userIdList.stream().distinct().collect(Collectors.toList());
QueryWrapper<ProjectNameInfoEO> projectNameInfoEOQueryWrapper = new QueryWrapper<>();
projectNameInfoEOQueryWrapper.lambda().eq(ProjectNameInfoEO::getId,projectLibraryBase.getProjectNameId());
ProjectNameInfoEO projectNameInfoEO = projectNameInfoEOMapper.selectOne(projectNameInfoEOQueryWrapper);
QueryWrapper<ProjectYearNameInfoEO> projectYearInfoEOQueryWrapper = new QueryWrapper<>();
projectYearInfoEOQueryWrapper.lambda().eq(ProjectYearNameInfoEO::getId,projectLibraryBase.getYearNameId());
ProjectYearNameInfoEO projectYearNameInfoEO = projectYearNameInfoEOMapper.selectOne(projectYearInfoEOQueryWrapper);
//消息内容
String msgContentEN = currentUser.getUsername() + " initiated the regulation list confirmation for "
@@ -1378,9 +1444,94 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
inventoryAffirmStatus = InventoryAffirmStatusEnum.ACCEPTED.getValue();
}
//如果法规工程师与认证工程师 其中一个人是拒绝 把清单确认状态设置为 拒绝
/*//如果法规工程师与认证工程师 其中一个人是拒绝 把清单确认状态设置为 拒绝
if(projectLawsInventoryEO.getRegulationOwnerSubmitStatus().equals("1") || projectLawsInventoryEO.getHomologationEngineerSubmitStatus().equals("1")){
inventoryAffirmStatus = InventoryAffirmStatusEnum.REJECTED.getValue();
}*/
}
//只要有一个人拒绝就改为拒绝
if(StringUtils.equals(operatorResult, OperatorResultEnum.REJECTED.getValue())){
inventoryAffirmStatus = InventoryAffirmStatusEnum.REJECTED.getValue();
//如果拒绝给studio发消息
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
//消息内容
String msgContentEN = "";
if(isProjectRole == Integer.parseInt(ProjectRoleEnum.REGULATI_ENGINEER.getValue()) || isProjectRole == Integer.parseInt(ProjectRoleEnum.REGULATI_AND_HOMOLOGATION_ENGINEER.getValue())){
msgContentEN = "The regulation list confirmation" +" of "+projectLawsInventoryEO.getSerialNumber() +" for "
+ projectNameInfoEO.getProjectName() +" is rejected by " +currentUser.getUsername() +". Please check and address it in a timely manner.";
// 飞书消息封装
FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
feishuMsgVo.setContent("Hello! This task is rejected by " +currentUser.getUsername()+ ". Please check and address it in a timely manner.");
feishuMsgVo.setTaskType("Regulation List Confirmation");
feishuMsgVo.setRegulationNo(projectLawsInventoryEO.getSerialNumber());
feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket());
feishuMsgVo.setInitiator(currentUser.getUsername());
feishuMsgVo.setDueDate(sdf.format(projectLawsInventoryEO.getInventoryAffirmDueDate()));
//飞书跳转链接
String hrefFeishu = backUrl
+ JumpLinkEnum.INVENTORY_AFFIRM_LINK.getLink()
+ projectLibraryId + JumpLinkEnum.INVENTORY_AFFIRM_LINK.getType()
+ "&projectName=" + projectNameInfoEO.getProjectName() + "-"
+ projectYearNameInfoEO.getYearName()
+ "&targetMarket=" + projectLibraryBase.getTargetMarket();
//系统内部跳转链接
String href = "<a href='"
+ JumpLinkEnum.INVENTORY_AFFIRM_LINK.getLink() + projectLibraryId + JumpLinkEnum.INVENTORY_AFFIRM_LINK.getType()
+ "&projectName=" + projectNameInfoEO.getProjectName() + "-"
+ projectYearNameInfoEO.getYearName()
+ "&targetMarket=" + projectLibraryBase.getTargetMarket()
+ "'>" + "Jump link" + "</a>";
String contentInfo = msgContentEN + " " + href;
Map<String,Object> sendMessageMap = new HashMap<>();
sendMessageMap.put("hrefFeishu",hrefFeishu);
sendMessageMap.put("contentInfo",contentInfo);
//发送消息
List<String> userIdList = new ArrayList<>();
userIdList.add(projectLibraryBase.getStudioEngineer());
sendMessage(msgContentEN,userIdList,projectLibraryId,sendMessageMap, feishuMsgVo, MessageTypeEnum.TASK);
}
if(isProjectRole == Integer.parseInt(ProjectRoleEnum.HOMOLOGATION_ENGINEER.getValue()) || isProjectRole == Integer.parseInt(ProjectRoleEnum.REGULATI_AND_HOMOLOGATION_ENGINEER.getValue())){
msgContentEN = "The regulation list confirmation of "+projectLawsInventoryEO.getSerialNumber() + " for "
+ projectNameInfoEO.getProjectName() +" is rejected by " + currentUser.getUsername() +". Please check and address it in a timely manner.";
// 飞书消息封装
FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
feishuMsgVo.setContent("Hello! This task is rejected by "+currentUser.getUsername()+". Please check and address it in a timely manner.");
feishuMsgVo.setTaskType("Regulation List Confirmation");
feishuMsgVo.setRegulationNo(projectLawsInventoryEO.getSerialNumber());
feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket());
feishuMsgVo.setInitiator(currentUser.getUsername());
feishuMsgVo.setDueDate(sdf.format(projectLawsInventoryEO.getInventoryAffirmDueDate()));
//飞书跳转链接
String hrefFeishu = backUrl
+ JumpLinkEnum.INVENTORY_AFFIRM_LINK.getLink()
+ projectLibraryId + JumpLinkEnum.INVENTORY_AFFIRM_LINK.getType()
+ "&projectName=" + projectNameInfoEO.getProjectName() + "-"
+ projectYearNameInfoEO.getYearName()
+ "&targetMarket=" + projectLibraryBase.getTargetMarket();
//系统内部跳转链接
String href = "<a href='"
+ JumpLinkEnum.INVENTORY_AFFIRM_LINK.getLink() + projectLibraryId + JumpLinkEnum.INVENTORY_AFFIRM_LINK.getType()
+ "&projectName=" + projectNameInfoEO.getProjectName() + "-"
+ projectYearNameInfoEO.getYearName()
+ "&targetMarket=" + projectLibraryBase.getTargetMarket()
+ "'>" + "Jump link" + "</a>";
String contentInfo = msgContentEN + " " + href;
Map<String,Object> sendMessageMap = new HashMap<>();
sendMessageMap.put("hrefFeishu",hrefFeishu);
sendMessageMap.put("contentInfo",contentInfo);
//发送消息
List<String> userIdList = new ArrayList<>();
userIdList.add(projectLibraryBase.getStudioEngineer());
sendMessage(msgContentEN,userIdList,projectLibraryId,sendMessageMap, feishuMsgVo, MessageTypeEnum.TASK);
}
}
@@ -1388,6 +1539,48 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
projectLawsInventoryEO.setInventoryAffirmStatus(inventoryAffirmStatus);
}
super.baseMapper.updateById(projectLawsInventoryEO);
//如果法规认证工程师都提交通过法规清单 清单确认状态为接受 并且给当前项目的studio发送消息
if(StringUtils.equals(inventoryAffirmStatus,InventoryAffirmStatusEnum.ACCEPTED.getValue())){
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
//消息内容
String msgContentEN = "The regulation list confirmation of "
+projectLawsInventoryEO.getSerialNumber()+" for "
+ projectNameInfoEO.getProjectName() +" is completed. Please check.";
// 飞书消息封装
FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
feishuMsgVo.setContent("Hello! This task is completed. Please check.");
feishuMsgVo.setTaskType("Regulation List Confirmation");
feishuMsgVo.setRegulationNo(projectLawsInventoryEO.getSerialNumber());
feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket());
feishuMsgVo.setInitiator(currentUser.getUsername());
feishuMsgVo.setDueDate(sdf.format(projectLawsInventoryEO.getInventoryAffirmDueDate()));
//飞书跳转链接
String hrefFeishu = backUrl
+ JumpLinkEnum.INVENTORY_AFFIRM_LINK.getLink()
+ projectLibraryId + JumpLinkEnum.INVENTORY_AFFIRM_LINK.getType()
+ "&projectName=" + projectNameInfoEO.getProjectName() + "-"
+ projectYearNameInfoEO.getYearName()
+ "&targetMarket=" + projectLibraryBase.getTargetMarket();
//系统内部跳转链接
String href = "<a href='"
+ JumpLinkEnum.INVENTORY_AFFIRM_LINK.getLink() + projectLibraryId + JumpLinkEnum.INVENTORY_AFFIRM_LINK.getType()
+ "&projectName=" + projectNameInfoEO.getProjectName() + "-"
+ projectYearNameInfoEO.getYearName()
+ "&targetMarket=" + projectLibraryBase.getTargetMarket()
+ "'>" + "Jump link" + "</a>";
String contentInfo = msgContentEN + " " + href;
Map<String,Object> sendMessageMap = new HashMap<>();
sendMessageMap.put("hrefFeishu",hrefFeishu);
sendMessageMap.put("contentInfo",contentInfo);
//发送消息
List<String> userIdList = new ArrayList<>();
userIdList.add(projectLibraryBase.getStudioEngineer());
sendMessage(msgContentEN,userIdList,projectLibraryId,sendMessageMap, feishuMsgVo, MessageTypeEnum.TASK);
}
}
}
}else {