Prechádzať zdrojové kódy

Merge remote-tracking branch 'origin/V0.0.1' into V0.0.1

jingyuanchao 2 rokov pred
rodič
commit
918a9ebe47

+ 1 - 2
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/controller/ApiPlanController.java

@@ -53,9 +53,8 @@ public class ApiPlanController {
 
     @PostMapping("/distribute")
     public AjaxResult distribute(@RequestBody DistributeDto dto) {
-        AppPlanVo info=appPlanService.findById(dto.getId());
         try {
-            appPlanService.saveOrUpdatePlan(info);
+            appPlanService.distributeToOrg(dto);
             return AjaxResult.success();
         } catch (Exception e) {
             e.printStackTrace();

+ 3 - 2
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/dto/DistributeDto.java

@@ -11,7 +11,8 @@ public class DistributeDto {
      */
     private Long id;
     /**
-     * 接收下发的机构id
+     * 下发的计划机构与状态的关联关系默认状态 0:禁用 1:启用
      */
-    private List<Long> orgIds;
+    private List<DistributeStatusDto> orgAndStatus;
+
 }

+ 9 - 0
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/dto/DistributeStatusDto.java

@@ -0,0 +1,9 @@
+package com.xunmei.core.resumption.dto;
+
+import lombok.Data;
+
+@Data
+public class DistributeStatusDto {
+    private Long orgId;
+    private Integer status;
+}

+ 32 - 25
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/service/impl/AppPlanServiceImpl.java

@@ -9,6 +9,7 @@ import com.xunmei.common.core.constant.SecurityConstants;
 import com.xunmei.common.security.utils.SecurityUtils;
 import com.xunmei.core.resumption.domain.*;
 import com.xunmei.core.resumption.dto.DistributeDto;
+import com.xunmei.core.resumption.dto.DistributeStatusDto;
 import com.xunmei.core.resumption.mapper.*;
 import com.xunmei.core.resumption.service.AppPlanService;
 import com.xunmei.core.resumption.vo.appPlan.AppPlanVo;
@@ -68,7 +69,7 @@ public class AppPlanServiceImpl extends ServiceImpl<AppPlanMapper, AppPlan> impl
     @Override
     public Page<AppPlan> selectPage(AppPlanVo info) {
         Page<AppPlan> page = new Page<>();
-        long current = info.getPageNum() ;
+        long current = info.getPageNum();
         long size = info.getPageSize();
         page.setCurrent(current);
         page.setSize(size);
@@ -88,32 +89,38 @@ public class AppPlanServiceImpl extends ServiceImpl<AppPlanMapper, AppPlan> impl
 
     @Override
     public void distributeToOrg(DistributeDto dto) {
-        AppPlan plan = baseMapper.selectById(dto.getId());
-        plan.setId(null);
-        plan.setParentId(dto.getId());
-        baseMapper.insert(plan);
-        Long id = plan.getId();
-
-        List<Long> roleList = appPlanToRoleMapper.selectList(new LambdaQueryWrapper<AppPlanToRole>().eq(AppPlanToRole::getPlanId,dto.getId())).stream().map(AppPlanToRole::getRoleId).collect(Collectors.toList());
-        AppPlanToRole atr = null;
-        for (Long roleId : roleList) {
-            atr = new AppPlanToRole();
-            atr.setRoleId(roleId);
-            atr.setPlanId(id);
-            appPlanToRoleMapper.insert(atr);
-        }
+        for (DistributeStatusDto d :
+                dto.getOrgAndStatus()) {
+
+            AppPlan plan = baseMapper.selectById(dto.getId());
+            plan.setOrgId(d.getOrgId().toString());
+            plan.setPlanStatus(d.getStatus());
+            plan.setId(null);
+            plan.setPlanName("下发-" + plan.getPlanName());
+            plan.setParentId(dto.getId());
+            baseMapper.insert(plan);
+            Long id = plan.getId();
 
-        List<AppPlanToPoint> itemList = appPlanToItemMapper.selectList(new LambdaQueryWrapper<AppPlanToPoint>().eq(AppPlanToPoint::getPlanId,dto.getId()));
-        AppPlanToPoint item = null;
-        for (AppPlanToPoint ruleItemVo : itemList) {
-            item = new AppPlanToPoint();
-            item.setPointId(ruleItemVo.getPointId());
-            item.setPlanId(id);
-            item.setPointScan(ruleItemVo.isPointScan());
-            item.setRequired(ruleItemVo.isRequired());
-            appPlanToItemMapper.insert(item);
-        }
+            List<Long> roleList = appPlanToRoleMapper.selectList(new LambdaQueryWrapper<AppPlanToRole>().eq(AppPlanToRole::getPlanId, dto.getId())).stream().map(AppPlanToRole::getRoleId).collect(Collectors.toList());
+            AppPlanToRole atr = null;
+            for (Long roleId : roleList) {
+                atr = new AppPlanToRole();
+                atr.setRoleId(roleId);
+                atr.setPlanId(id);
+                appPlanToRoleMapper.insert(atr);
+            }
 
+            List<AppPlanToPoint> itemList = appPlanToItemMapper.selectList(new LambdaQueryWrapper<AppPlanToPoint>().eq(AppPlanToPoint::getPlanId, dto.getId()));
+            AppPlanToPoint item = null;
+            for (AppPlanToPoint ruleItemVo : itemList) {
+                item = new AppPlanToPoint();
+                item.setPointId(ruleItemVo.getPointId());
+                item.setPlanId(id);
+                item.setPointScan(ruleItemVo.isPointScan());
+                item.setRequired(ruleItemVo.isRequired());
+                appPlanToItemMapper.insert(item);
+            }
+        }
     }
 
     /**