|
@@ -97,6 +97,8 @@ public class PlanServiceImpl extends ServiceImpl<PlanMapper, Plan> implements Pl
|
|
private ReportMapper reportMapper;
|
|
private ReportMapper reportMapper;
|
|
@Resource
|
|
@Resource
|
|
private SysFunctionService sysFunctionService;
|
|
private SysFunctionService sysFunctionService;
|
|
|
|
+ @Resource
|
|
|
|
+ private ReportService reportService;
|
|
|
|
|
|
@Value(value = "${upload.path}")
|
|
@Value(value = "${upload.path}")
|
|
private String path;
|
|
private String path;
|
|
@@ -1318,4 +1320,25 @@ public class PlanServiceImpl extends ServiceImpl<PlanMapper, Plan> implements Pl
|
|
msg.setData(plans);
|
|
msg.setData(plans);
|
|
return msg;
|
|
return msg;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public HttpRespMsg deletePlan(Integer id) {
|
|
|
|
+ HttpRespMsg msg=new HttpRespMsg();
|
|
|
|
+ Report one = reportService.getOne(new LambdaQueryWrapper<Report>().eq(id!=null,Report::getPlanId, id).last("LIMIT 1"));
|
|
|
|
+ if(one==null){
|
|
|
|
+ //删除计划
|
|
|
|
+ removeById(id);
|
|
|
|
+ //删除计划下面相关数据
|
|
|
|
+ planSteelStampNumberService.remove(new LambdaQueryWrapper<PlanSteelStampNumber>().eq(PlanSteelStampNumber::getPlanId,id));
|
|
|
|
+ List<PlanProcedureTotal> list = planProcedureTotalService.list(new LambdaQueryWrapper<PlanProcedureTotal>().eq(PlanProcedureTotal::getPlanId, id));
|
|
|
|
+ List<Integer> ids = list.stream().map(PlanProcedureTotal::getId).collect(Collectors.toList());
|
|
|
|
+ if(ids!=null&&ids.size()>0){
|
|
|
|
+ prodProcedureTeamService.remove(new LambdaQueryWrapper<ProdProcedureTeam>().in(ProdProcedureTeam::getPlanProcedureId,ids));
|
|
|
|
+ planProcedureTotalService.removeByIds(ids);
|
|
|
|
+ }
|
|
|
|
+ return msg;
|
|
|
|
+ }
|
|
|
|
+ msg.setError("‘已有员工报工,删除失败");
|
|
|
|
+ return msg;
|
|
|
|
+ }
|
|
}
|
|
}
|