Bläddra i källkod

履职任务的planid使用父计划id

jiawuxian 2 år sedan
förälder
incheckning
5fdeae1c71

+ 1 - 0
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/service/impl/ProtectionServiceImpl.java

@@ -90,6 +90,7 @@ public class ProtectionServiceImpl extends ServiceImpl<ProtectionMapper, Protect
             updateById(protection);
         } else {
             BeanUtil.copyProperties(dto, protection);
+            protection.setStatus("2");
             save(protection);
         }
 

+ 21 - 14
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/service/impl/SysResumptionServiceImpl.java

@@ -7,6 +7,7 @@ import java.util.stream.Collectors;
 import cn.hutool.core.date.DateField;
 import cn.hutool.core.date.DateTime;
 import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.util.ObjectUtil;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.xunmei.common.core.constant.SecurityConstants;
 import com.xunmei.common.core.utils.DateUtils;
@@ -62,11 +63,11 @@ public class SysResumptionServiceImpl extends ServiceImpl<SysResumptionMapper, S
         QueryWrapper<SysResumption> query = new QueryWrapper<>(sysResumption);
         //下穿
         if (sysResumption.getCheckSub()) {
-            List<Long> ids = orgService.selectCheckSubOrgIdList(sysResumption.getOrgId(),SecurityConstants.INNER);
+            List<Long> ids = orgService.selectCheckSubOrgIdList(sysResumption.getOrgId(), SecurityConstants.INNER);
 //            if(checkSubOrgIdList.getCode()!=200){
 ////                return checkSubOrgIdList.getMsg();
 //            }
-          //  List<Long> ids = checkSubOrgIdList.getData();
+            //  List<Long> ids = checkSubOrgIdList.getData();
             //清空前端传递的org_id
             sysResumption.setOrgId(null);
             //添加in条件
@@ -100,16 +101,18 @@ public class SysResumptionServiceImpl extends ServiceImpl<SysResumptionMapper, S
     public SysResumption selectSysResumptionById(String id) {
         return sysResumptionMapper.selectById(id);
     }
+
     @Override
-    public void deleteResumption(List<String> ids,Integer year, Integer quarter){
-        sysResumptionMapper.deleteResumption(ids,year,quarter);
+    public void deleteResumption(List<String> ids, Integer year, Integer quarter) {
+        sysResumptionMapper.deleteResumption(ids, year, quarter);
     }
+
     @Override
-    @Transactional(readOnly= false, rollbackFor = {Exception.class, RuntimeException.class},propagation = Propagation.REQUIRES_NEW)
-    public void saveResumption(List<SysResumption> listResumption, List<AppPlan> appPlanList,List<Map<String,Long>> planIdAndOrgs){
+    @Transactional(readOnly = false, rollbackFor = {Exception.class, RuntimeException.class}, propagation = Propagation.REQUIRES_NEW)
+    public void saveResumption(List<SysResumption> listResumption, List<AppPlan> appPlanList, List<Map<String, Long>> planIdAndOrgs) {
         //筛选出listResumption每个对象的 planId和orgId 同时在planIdAndOrgs中的数据
         List<SysResumption> resumptionList = new ArrayList<>();
-        if(CollectionUtils.isNotEmpty(planIdAndOrgs)&&CollectionUtils.isNotEmpty(listResumption)){
+        if (CollectionUtils.isNotEmpty(planIdAndOrgs) && CollectionUtils.isNotEmpty(listResumption)) {
             for (SysResumption re : listResumption) {
                 for (Map<String, Long> map : planIdAndOrgs) {
                     if (!(re.getPlanId().equals(map.get("planId")) && re.getOrgId().equals(map.get("orgId")))) {
@@ -117,7 +120,7 @@ public class SysResumptionServiceImpl extends ServiceImpl<SysResumptionMapper, S
                     }
                 }
             }
-        }else{
+        } else {
             resumptionList = listResumption;
         }
         //this.save(resumptionList);
@@ -127,6 +130,7 @@ public class SysResumptionServiceImpl extends ServiceImpl<SysResumptionMapper, S
             this.daiban(resumption, resumption.getRoleId(), appPlan, resumption.getOrgId(), Math.toIntExact(resumption.getType()));
         }
     }
+
     /**
      * 查询【请填写功能名称】列表
      *
@@ -137,13 +141,14 @@ public class SysResumptionServiceImpl extends ServiceImpl<SysResumptionMapper, S
     public List<SysResumption> selectSysResumptionList(SysResumption sysResumption) {
         return sysResumptionMapper.selectList(new QueryWrapper<>(sysResumption));
     }
+
     @Override
-    public List<WorkChangeResumptionVo> findResumptionList(List<Long> orgIds,Date date,Integer type,Integer status, Integer year,Integer quarter) {
-        return sysResumptionMapper.findResumptionList(orgIds,date,type,status,year,quarter);
+    public List<WorkChangeResumptionVo> findResumptionList(List<Long> orgIds, Date date, Integer type, Integer status, Integer year, Integer quarter) {
+        return sysResumptionMapper.findResumptionList(orgIds, date, type, status, year, quarter);
     }
 
     @Override
-    @Transactional(readOnly= false, rollbackFor = {Exception.class, RuntimeException.class},propagation = Propagation.REQUIRES_NEW)
+    @Transactional(readOnly = false, rollbackFor = {Exception.class, RuntimeException.class}, propagation = Propagation.REQUIRES_NEW)
     public void newbuild(Long orgId, ResumptionType type, final Date dateTime, final Boolean isWork, AppPlan appPlan, List<Object> nfcList, List<AppRulePointTaskVo> pointList, List<Long> roleIds, DateTime planstartTime, DateTime planendTime) {
         Ymd ymd = Ymd.of(dateTime);
         //id使用uuid
@@ -156,11 +161,11 @@ public class SysResumptionServiceImpl extends ServiceImpl<SysResumptionMapper, S
 
         for (Long roleId : roleIds) {
             //结束时间 23:59:59变00:00:00的问题(周,月,季,半年,年)
-            if (type.getValue() != 1 && type.getValue() !=2) {
+            if (type.getValue() != 1 && type.getValue() != 2) {
                 planendTime = DateUtil.endOfDay(planendTime).offset(DateField.MILLISECOND, -999);
             }
 //            String id = UUID.randomUUID().toString().replaceAll("-", "");
-            SysResumption resumption =new SysResumption();
+            SysResumption resumption = new SysResumption();
             //resumption.changeWork(isWork);
             resumption.setStatus((long) 1);
             resumption.setYmd(ymd);
@@ -173,7 +178,7 @@ public class SysResumptionServiceImpl extends ServiceImpl<SysResumptionMapper, S
             resumption.setYmdHour(Long.valueOf(ymd.getHour()));
             resumption.setYmdQuarter(Long.valueOf(ymd.getQuarter()));
             resumption.setYmdHalfyear(Long.valueOf(ymd.getHalfyear()));
-            resumption.setPlanId(appPlan.getId());
+            resumption.setPlanId((ObjectUtil.equal(appPlan.getParentId(), -1L) || ObjectUtil.isNull(appPlan.getParentId())) ? appPlan.getId() : appPlan.getParentId());
             resumption.setOrgId(orgId);
 //            resumption.setId(id);
             resumption.setType(type.getValue());
@@ -197,6 +202,7 @@ public class SysResumptionServiceImpl extends ServiceImpl<SysResumptionMapper, S
 //        }
 
     }
+
     public void daiban(SysResumption resumption, Long roleId, AppPlan appPlan, Long orgId, int type) {
         Todo todo = new Todo();
         Long appId = 0L; //this.appService.findByNameForApp(IApp.SAFECHECK).getId();
@@ -281,6 +287,7 @@ public class SysResumptionServiceImpl extends ServiceImpl<SysResumptionMapper, S
         todo.getRoles().add(todoRole);
 //        iTodoService.saveTodoAndRoles(todo);
     }
+
     /**
      * 新增【请填写功能名称】
      *