|
|
@@ -145,39 +145,50 @@ public class AppPlanServiceImpl extends ServiceImpl<AppPlanMapper, AppPlan> impl
|
|
|
for (DistributeStatusDto d :
|
|
|
dto.getOrgAndStatus()) {
|
|
|
|
|
|
- AppPlan plan = baseMapper.selectById(dto.getId());
|
|
|
- plan.setOrgId(d.getOrgId().toString());
|
|
|
- plan.setDistributeStatus("1");
|
|
|
- plan.setPlanOfOrgId(d.getOrgId());
|
|
|
- plan.setPlanOfOrgType(Long.valueOf(orgService.selectSysOrgById(d.getOrgId(), SecurityConstants.INNER).getType()));
|
|
|
- plan.setPlanStatus(d.getStatus());
|
|
|
- plan.setDistributePlanStatus(d.getStatus().toString());
|
|
|
- plan.setCreateTime(new Date());
|
|
|
- plan.setId(null);
|
|
|
-// plan.setPlanName(plan.getPlanName()+"下发"+orgService.selectOrgById(d.getOrgId(),SecurityConstants.INNER).getName());
|
|
|
- plan.setPlanName(plan.getPlanName());
|
|
|
- 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);
|
|
|
+ AppPlan tempplan = baseMapper.selectOne(new LambdaQueryWrapper<AppPlan>().eq(AppPlan::getPlanOfOrgId,d.getOrgId()).eq(AppPlan::getParentId,dto.getId()));
|
|
|
+ //如果子计划已存在
|
|
|
+ if(tempplan!=null){
|
|
|
+ tempplan.setPlanStatus(d.getStatus()>0?1:2);
|
|
|
+ tempplan.setDistributePlanStatus(d.getStatus().toString());
|
|
|
+ tempplan.setDistributeStatus("1");
|
|
|
+ baseMapper.updateById(tempplan);
|
|
|
+ }else {
|
|
|
+ AppPlan plan = baseMapper.selectById(dto.getId());
|
|
|
+ plan.setOrgId(d.getOrgId().toString());
|
|
|
+ plan.setDistributeStatus("1");
|
|
|
+ plan.setPlanOfOrgId(d.getOrgId());
|
|
|
+ plan.setPlanOfOrgType(Long.valueOf(orgService.selectSysOrgById(d.getOrgId(), SecurityConstants.INNER).getType()));
|
|
|
+ plan.setPlanStatus(d.getStatus());
|
|
|
+ plan.setDistributePlanStatus(d.getStatus().toString());
|
|
|
+ plan.setCreateTime(new Date());
|
|
|
+ plan.setId(null);
|
|
|
+// plan.setPlanName(plan.getPlanName()+"下发"+orgService.selectOrgById(d.getOrgId(),SecurityConstants.INNER).getName());
|
|
|
+ plan.setPlanName(plan.getPlanName());
|
|
|
+ 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());
|
|
|
+ item.setOfOrgId(ruleItemVo.getOfOrgId());
|
|
|
+ appPlanToItemMapper.insert(item);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -221,20 +232,8 @@ public class AppPlanServiceImpl extends ServiceImpl<AppPlanMapper, AppPlan> impl
|
|
|
@Override
|
|
|
public int distributeCheHui(Long id) {
|
|
|
AppPlan plan = baseMapper.selectById(id);
|
|
|
- //修改所有子计划
|
|
|
- List<AppPlan> appPlans = baseMapper.selectList(new LambdaQueryWrapper<AppPlan>().eq(AppPlan::getParentId, id));
|
|
|
- //如果不存在子计划直接返回
|
|
|
- if (appPlans == null || appPlans.size() == 0) {
|
|
|
- return 0;
|
|
|
- }
|
|
|
- for (AppPlan ap :
|
|
|
- appPlans) {
|
|
|
-//修改计划状态为停用
|
|
|
- ap.setPlanStatus(1);
|
|
|
- baseMapper.updateById(ap);
|
|
|
- }
|
|
|
+
|
|
|
//设置下发状态为下发
|
|
|
- plan.setDistribute("1");
|
|
|
plan.setPlanStatus(1);
|
|
|
|
|
|
baseMapper.updateById(plan);
|