luojun 2 лет назад
Родитель
Сommit
a32c2f5575

+ 31 - 11
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/controller/ApiPlanController.java

@@ -5,6 +5,7 @@ import com.xunmei.common.core.constant.SecurityConstants;
 import com.xunmei.common.core.domain.R;
 import com.xunmei.common.core.web.domain.AjaxResult;
 import com.xunmei.core.resumption.domain.AppPlan;
+import com.xunmei.core.resumption.dto.DistributeDto;
 import com.xunmei.core.resumption.service.AppPlanService;
 import com.xunmei.core.resumption.vo.appPlan.AppPlanVo;
 import com.xunmei.core.resumption.vo.appPlan.RuleItemVo;
@@ -39,20 +40,34 @@ public class ApiPlanController {
 
     /**
      * 计划分页查询
+     *
      * @param info
      * @return
      */
     @PostMapping("/find")
-    public AjaxResult hostList(@RequestBody AppPlanVo info){
+    public AjaxResult hostList(@RequestBody AppPlanVo info) {
 
         Page<AppPlan> result = appPlanService.selectPage(info);
         return AjaxResult.success(result);
     }
+
+    @PostMapping("/distribute")
+    public AjaxResult distribute(@RequestBody DistributeDto dto) {
+        AppPlanVo info=appPlanService.findById(dto.getId());
+        try {
+            appPlanService.saveOrUpdatePlan(info);
+            return AjaxResult.success();
+        } catch (Exception e) {
+            e.printStackTrace();
+            return AjaxResult.error("数据处理错误:" + e.getMessage());
+        }
+    }
+
     @RequestMapping("/test")
-    public AjaxResult test(Integer type){
+    public AjaxResult test(Integer type) {
         R<List<Long>> res = remoteOrgService.findListByOrgType(type, SecurityConstants.INNER);
-        List<Long> list=null;
-        if (res.getCode()==200) {
+        List<Long> list = null;
+        if (res.getCode() == 200) {
             list = res.getData();
         }
         return AjaxResult.success(list);
@@ -60,50 +75,54 @@ public class ApiPlanController {
 
     /**
      * 检查要点分页查询
+     *
      * @return Message
      * @author 高雄
      * @time 2022/5/5 14:39
      */
     @RequestMapping("/item/find")
-    public AjaxResult itemList(@RequestBody RuleItemVo info){
+    public AjaxResult itemList(@RequestBody RuleItemVo info) {
         Page<RuleItemVo> result = appPlanService.selectItemPage(info);
         return AjaxResult.success(result);
     }
 
     /**
      * 获取机构或者机构类型对应的检查规范
+     *
      * @param info
      * @return Message
      * @author 高雄
      * @time 2022/5/5 15:05
      */
     @RequestMapping("/find/rule")
-    public AjaxResult findRule(@RequestBody RuleRequestVo info){
+    public AjaxResult findRule(@RequestBody RuleRequestVo info) {
         List<Map<String, Object>> list = appPlanService.findByOrg(info);
         return AjaxResult.success(list);
     }
 
     /**
      * 新增 修改履职计划
+     *
      * @param info
      * @return Message
      * @author 高雄
      * @time 2022/5/5 16:37
      */
     @RequestMapping("/edit")
-    public AjaxResult edit(@RequestBody AppPlanVo info){
+    public AjaxResult edit(@RequestBody AppPlanVo info) {
         try {
             appPlanService.saveOrUpdatePlan(info);
             return AjaxResult.success();
         } catch (Exception e) {
             e.printStackTrace();
-            return AjaxResult.error("数据处理错误:"+ e.getMessage());
+            return AjaxResult.error("数据处理错误:" + e.getMessage());
         }
     }
 
 
     /**
      * 获取详情数据
+     *
      * @param id
      * @return Message
      * @author 高雄
@@ -111,19 +130,20 @@ public class ApiPlanController {
      */
     @ApiOperation(value = "获取详情")
     @GetMapping(value = "/find/{id}")
-    public AjaxResult findById(@PathVariable  Long id){
+    public AjaxResult findById(@PathVariable Long id) {
         AppPlanVo app = appPlanService.findById(id);
         return AjaxResult.success(app);
     }
 
     @ApiOperation(value = "获取详情")
     @GetMapping(value = "/getPointIds/{id}")
-    public AjaxResult getPointIds(@PathVariable  Long id){
+    public AjaxResult getPointIds(@PathVariable Long id) {
         return AjaxResult.success(appPlanService.selectItemIdsByPlanId(id));
     }
 
     /**
      * 获取详情数据
+     *
      * @param id
      * @return Message
      * @author 高雄
@@ -131,7 +151,7 @@ public class ApiPlanController {
      */
     @ApiOperation(value = "删除计划")
     @GetMapping(value = "/delete/{id}")
-    public AjaxResult deleted(@PathVariable  Long id){
+    public AjaxResult deleted(@PathVariable Long id) {
         try {
             appPlanService.deleted(id);
             return AjaxResult.success("数据处理成功");

+ 1 - 1
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/domain/AppPlan.java

@@ -87,7 +87,7 @@ public class AppPlan extends Model<AppPlan> implements Serializable {
     private String planOfOrgId;
     private String count;
     private String distributeStatus;
-    private String parentId;
+    private Long parentId;
 
 
     /**

+ 17 - 0
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/dto/DistributeDto.java

@@ -0,0 +1,17 @@
+package com.xunmei.core.resumption.dto;
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class DistributeDto {
+    /**
+     * 准备下发的计划id
+     */
+    private Long id;
+    /**
+     * 接收下发的机构id
+     */
+    private List<Long> orgIds;
+}

+ 1 - 1
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/dto/TaskDetailsDto.java

@@ -17,7 +17,7 @@ import java.util.Date;
 @ApiModel(description = "履职任务列表")
 public class TaskDetailsDto {
     @ApiModelProperty(value = "任务id")
-    @NotBlank(message = "请填写任务id")
+    @NotNull (message = "请填写任务id")
     private Long taskId;
     private int type;
     @ApiModelProperty(value = "日期")

+ 3 - 0
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/service/AppPlanService.java

@@ -3,6 +3,7 @@ package com.xunmei.core.resumption.service;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.xunmei.core.resumption.domain.AppPlan;
+import com.xunmei.core.resumption.dto.DistributeDto;
 import com.xunmei.core.resumption.vo.appPlan.AppPlanVo;
 import com.xunmei.core.resumption.vo.appPlan.RuleItemVo;
 import com.xunmei.core.resumption.vo.appPlan.RuleRequestVo;
@@ -77,4 +78,6 @@ public interface AppPlanService extends IService<AppPlan> {
      * @return
      */
     List<Long> findRoleByPlan(Long id);
+
+    void distributeToOrg(DistributeDto dto);
 }

+ 19 - 8
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/service/ResumptionBusiness.java

@@ -45,6 +45,8 @@ public class ResumptionBusiness {
     private IAppRulePointService appRulePointService;
     @Autowired
     private AppResumptionDataService appResumptionDataService;
+    @Autowired
+    private IProtectionService protectionService;
 
     public Map<String, Object> tasktotal(ResumptionTaskDto request) throws ParseException {
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
@@ -177,13 +179,15 @@ public class ResumptionBusiness {
         }
         return tasktotal;
     }
-public Date LocalDateTimeToDate(LocalDateTime localDateTime){
+
+    public Date LocalDateTimeToDate(LocalDateTime localDateTime) {
 //    LocalDateTime localDateTime = LocalDateTime.now();
-    ZoneId zoneId = ZoneId.systemDefault();
-    ZonedDateTime zdt = localDateTime.atZone(zoneId);
-    Date date = Date.from(zdt.toInstant());
-    return date;
-}
+        ZoneId zoneId = ZoneId.systemDefault();
+        ZonedDateTime zdt = localDateTime.atZone(zoneId);
+        Date date = Date.from(zdt.toInstant());
+        return date;
+    }
+
     public List<ResumptionTaskListVo> taskListVo(List<Map<String, Object>> list, int type) throws ParseException {
         List<ResumptionTaskListVo> listVos = new ArrayList<>();
         List<Map<String, Object>> taskarealist = new ArrayList<>();
@@ -212,11 +216,11 @@ public Date LocalDateTimeToDate(LocalDateTime localDateTime){
                 ResumptionTaskListVo vo = new ResumptionTaskListVo();
                 vo.setId(map.get("id").toString());
                 vo.setPlanstarttime(map.get("planstarttime") == null ? "" : sdft.format(LocalDateTimeToDate((LocalDateTime) map.get("planstarttime"))));
-                vo.setPlanendtime(map.get("planendtime") == null ? "" : sdft.format(LocalDateTimeToDate((LocalDateTime)  map.get("planendtime"))));
+                vo.setPlanendtime(map.get("planendtime") == null ? "" : sdft.format(LocalDateTimeToDate((LocalDateTime) map.get("planendtime"))));
                 vo.setTitle(map.get("title").toString());
                 vo.setStatus((int) map.get("status"));
                 vo.setSubmitBy(map.get("submitBy") == null ? "" : map.get("submitBy").toString());
-                vo.setSubmitTime(map.get("submitTime") == null ? "" : sdftb.format(LocalDateTimeToDate((LocalDateTime)   map.get("submitTime"))));
+                vo.setSubmitTime(map.get("submitTime") == null ? "" : sdftb.format(LocalDateTimeToDate((LocalDateTime) map.get("submitTime"))));
                 listVos.add(vo);
             }
 
@@ -549,6 +553,13 @@ public Date LocalDateTimeToDate(LocalDateTime localDateTime){
                 List<ResumptionPointVo> checkitemlist = pointsListMapItem.get(keya);
                 if (checkitemlist == null || checkitemlist.size() == 0) {
                     continue;
+                } else {
+                    for (ResumptionPointVo r :
+                            checkitemlist) {
+                        if (r.getBusinessType() == 1) {
+                            r.setProtectionVo(protectionService.findNotAllHour(resumption.getOrgId()));
+                        }
+                    }
                 }
                 Map<String, Object> item = new HashMap<>();
                 item.put("itemid", keya);

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

@@ -1,12 +1,14 @@
 package com.xunmei.core.resumption.service.impl;
 
 import cn.hutool.core.util.ObjectUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 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.mapper.*;
 import com.xunmei.core.resumption.service.AppPlanService;
 import com.xunmei.core.resumption.vo.appPlan.AppPlanVo;
@@ -20,6 +22,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * @author : 高雄
@@ -65,7 +68,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() + 1;
+        long current = info.getPageNum() ;
         long size = info.getPageSize();
         page.setCurrent(current);
         page.setSize(size);
@@ -83,6 +86,36 @@ public class AppPlanServiceImpl extends ServiceImpl<AppPlanMapper, AppPlan> impl
         return baseMapper.findRoleByPlan(plan_id);
     }
 
+    @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);
+        }
+
+        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);
+        }
+
+    }
+
     /**
      * 获取检查要点分页
      *

+ 13 - 0
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/vo/ProtectionVo.java

@@ -0,0 +1,13 @@
+package com.xunmei.core.resumption.vo;
+
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+public class ProtectionVo {
+    private Long id;
+    private String name;
+    private String status;
+    private Date time;
+}

+ 3 - 0
soc-modules/soc-modules-core/src/main/java/com/xunmei/core/resumption/vo/ResumptionPointVo.java

@@ -2,6 +2,7 @@ package com.xunmei.core.resumption.vo;
 
 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import com.xunmei.core.resumption.domain.Protection;
 import lombok.AllArgsConstructor;
 import lombok.Builder;
 import lombok.Data;
@@ -29,6 +30,8 @@ public class ResumptionPointVo {
     private int pointnum;
     private int pointScan;
 
+    private List<Protection> protectionVo;
+
     private  int required;
     private Long planId;
     @JsonSerialize(using = ToStringSerializer.class)