From eb0760c36778d07c0d13d917c0db30dfa03aa0fd Mon Sep 17 00:00:00 2001
From: yxm <zhp1521624>
Date: Mon, 15 Jul 2024 11:45:46 +0800
Subject: [PATCH] 项目进度上报逻辑优化及工序配置v0.4
---
skjcmanager/skjcmanager-service/skjcmanager-sm/src/main/java/cn/gistack/sm/sg/service/impl/SgGxStepServiceImpl.java | 30 +++++++++++++++++++++++++-----
1 files changed, 25 insertions(+), 5 deletions(-)
diff --git a/skjcmanager/skjcmanager-service/skjcmanager-sm/src/main/java/cn/gistack/sm/sg/service/impl/SgGxStepServiceImpl.java b/skjcmanager/skjcmanager-service/skjcmanager-sm/src/main/java/cn/gistack/sm/sg/service/impl/SgGxStepServiceImpl.java
index 28665ec..91fef81 100644
--- a/skjcmanager/skjcmanager-service/skjcmanager-sm/src/main/java/cn/gistack/sm/sg/service/impl/SgGxStepServiceImpl.java
+++ b/skjcmanager/skjcmanager-service/skjcmanager-sm/src/main/java/cn/gistack/sm/sg/service/impl/SgGxStepServiceImpl.java
@@ -2,10 +2,12 @@
import cn.gistack.sm.sg.DO.SgGxRoleDO;
import cn.gistack.sm.sg.DO.SgGxStepDO;
+import cn.gistack.sm.sg.DO.SgProgressReportDO;
import cn.gistack.sm.sg.DTO.ProjectSearchDTO;
import cn.gistack.sm.sg.VO.SgGxRoleVO;
import cn.gistack.sm.sg.mapper.SgGxRoleMapper;
import cn.gistack.sm.sg.mapper.SgGxStepMapper;
+import cn.gistack.sm.sg.mapper.SgProgressReportMapper;
import cn.gistack.sm.sg.service.SgGxStepService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
@@ -18,6 +20,7 @@
import java.util.ArrayList;
import java.util.List;
+import java.util.stream.Collectors;
/**
* <p>
@@ -33,6 +36,10 @@
private SgGxStepMapper sgGxStepMapper;
@Autowired
private SgGxRoleMapper sgGxRoleMapper;
+
+ @Autowired
+ private SgProgressReportMapper sgProgressReportMapper;
+
@Override
public void add(SgGxStepDO sgGxStepDO) {
List<SgGxStepDO> list= sgGxStepMapper.selectByGxInfoId(sgGxStepDO.getGxInfoId());
@@ -97,7 +104,7 @@
SgGxRoleDO sgGxRoleDO=new SgGxRoleDO();
sgGxRoleDO.setGxDeviceType(sgGxRoleVO.getGxDeviceType());
sgGxRoleDO.setGxStepId(sgGxRoleVO.getGxStepId());
- sgGxRoleDO.setRoleId(Long.valueOf(roleIds.get(i)));
+ sgGxRoleDO.setRoleId(roleIds.get(i));
sgGxRoleDO.setSgOrder(sgGxRoleVO.getOrders().get(i));
sgGxRoles.add(sgGxRoleDO);
}
@@ -112,9 +119,17 @@
@Override
@Transactional
public void updateSgGxRole(SgGxRoleVO sgGxRoleVO){
-
-
- if (sgGxRoleVO.getGxStepId()==null){
+ String gxStepId = sgGxRoleVO.getGxStepId();
+ List<SgProgressReportDO> reportDOS = new LambdaQueryChainWrapper<>(sgProgressReportMapper).eq(SgProgressReportDO::getGxStepId, gxStepId).list();
+ List<SgGxRoleDO> list = new LambdaQueryChainWrapper<>(sgGxRoleMapper).eq(SgGxRoleDO::getGxStepId, gxStepId).orderByAsc(SgGxRoleDO::getSgOrder).list();
+ List<String> roles = list.stream().map(SgGxRoleDO::getRoleId).map(Object::toString).collect(Collectors.toList());
+ List<Integer> orders = list.stream().map(SgGxRoleDO::getSgOrder).collect(Collectors.toList());
+ if (!reportDOS.isEmpty()){
+ if (! roles.equals(sgGxRoleVO.getRoleIds()) || ! orders.equals(sgGxRoleVO.getOrders())) {
+ throw new ServiceException("此配置已有上报记录,不允许修改");
+ }
+ }
+ if (sgGxRoleVO.getGxStepId()==null){
throw new ServiceException("工序步骤参数错误");
}
if (sgGxRoleVO.getGxDeviceType()==null){
@@ -136,7 +151,7 @@
SgGxRoleDO sgGxRoleDO=new SgGxRoleDO();
sgGxRoleDO.setGxDeviceType(sgGxRoleVO.getGxDeviceType());
sgGxRoleDO.setGxStepId(sgGxRoleVO.getGxStepId());
- sgGxRoleDO.setRoleId(Long.valueOf(roleIds.get(i)));
+ sgGxRoleDO.setRoleId(roleIds.get(i));
sgGxRoleDO.setSgOrder(sgGxRoleVO.getOrders().get(i));
sgGxRoles.add(sgGxRoleDO);
}
@@ -155,4 +170,9 @@
return sgGxRoleMapper.getSgGxRoles(gxDeviceType, gxStepId);
}
+
+ @Override
+ public List<SgGxStepDO> sgGxStepList() {
+ return sgGxStepMapper.getDEviceGXtwo();
+ }
}
--
Gitblit v1.9.3