hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/pipeoutplan/controller/PipeOutPlanController.java
@@ -26,8 +26,8 @@ } @GetMapping("delete") BasicResult delete(String pipeNeedId){ return pipeOutPlanService.delete(pipeNeedId); BasicResult delete(@RequestParam String planOutId){ return pipeOutPlanService.delete(planOutId); } @PostMapping("update") @@ -36,8 +36,8 @@ } @GetMapping("selectInfo") BasicResult selectInfo(String pipeNeedId){ return pipeOutPlanService.selectInfo(pipeNeedId); BasicResult selectInfo(@RequestParam String planOutId){ return pipeOutPlanService.selectInfo(planOutId); } @PostMapping("findAll") hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/pipeoutplan/entity/PipeOutPlanEntity.java
@@ -22,8 +22,10 @@ private String planOutId;//计划ID private String proId;//项目ID private String proName;//项目名称 private Integer planYear;//年份 private Integer needPipeNum;//需求合计多少片 private long completePipeNum;//已完成合计 private Date createTime;//创建时间 private String createUser;//创建人 private Date updateTime;//修改时间 hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/pipeoutplan/mapper/PipeOutPlanMapper.java
@@ -78,5 +78,6 @@ * @return */ List<PipeOutPlanMothEntity> findMothListByProIdAndYear(@Param("proId") String proId, @Param("year") String year); @Param("year") String year, @Param("planOutId") String planOutId); } hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/pipeoutplan/service/impl/PipeOutPlanServiceImpl.java
@@ -16,6 +16,7 @@ import java.util.List; import java.util.Map; import java.util.stream.Stream; /** * @Author QiuYuHao @@ -32,18 +33,18 @@ @Transactional(rollbackFor = Exception.class) public BasicResult insert(PipeOutPlanEntity pipeOutPlanEntity) { PipeOutPlanEntity isExit = pipeOutPlanMapper.selectInfoByProIdAndYear(pipeOutPlanEntity.getProId(), pipeOutPlanEntity.getPlanYear()); if (isExit == null){ if (isExit != null){ return BasicResult.faild("500","同一项目、年份有且只有一个计划",null); } String planOutId = UUIDUtils.create(); pipeOutPlanEntity.setPlanOutId(planOutId); pipeOutPlanMapper.insert(pipeOutPlanEntity); List<PipeOutPlanMothEntity> monthList = pipeOutPlanEntity.getMonthList(); monthList.forEach(vo->{ for (PipeOutPlanMothEntity vo : monthList) { vo.setPipeOutPlanId(planOutId); vo.setId(UUIDUtils.create()); pipeOutPlanMapper.insertMoth(vo); }); } return BasicResult.success(); } @@ -59,18 +60,19 @@ @Transactional(rollbackFor = Exception.class) public BasicResult update(PipeOutPlanEntity pipeOutPlanEntity) { PipeOutPlanEntity isExit = pipeOutPlanMapper.selectInfoByProIdAndYear(pipeOutPlanEntity.getProId(), pipeOutPlanEntity.getPlanYear()); if (isExit == null){ if (!pipeOutPlanEntity.getPlanOutId().equals(isExit.getPlanOutId()) && isExit != null){ return BasicResult.faild("500","同一项目、年份有且只有一个计划",null); } pipeOutPlanMapper.update(pipeOutPlanEntity); String planOutId = pipeOutPlanEntity.getPlanOutId(); pipeOutPlanMapper.deleteMoth(planOutId); List<PipeOutPlanMothEntity> monthList = pipeOutPlanEntity.getMonthList(); monthList.forEach(vo->{ for (PipeOutPlanMothEntity vo : monthList) { vo.setPipeOutPlanId(planOutId); vo.setId(UUIDUtils.create()); pipeOutPlanMapper.insertMoth(vo); }); return BasicResult.success(); } return BasicResult.success(); } @Override @@ -92,7 +94,15 @@ all.forEach(obj->{ String proId = obj.getProId(); Integer planYear = obj.getPlanYear(); obj.setMonthList(pipeOutPlanMapper.findMothListByProIdAndYear(proId,planYear.toString())); String planOutId = obj.getPlanOutId(); List<PipeOutPlanMothEntity> mothListByProIdAndYear = pipeOutPlanMapper.findMothListByProIdAndYear(proId, planYear.toString(), planOutId); Integer completePlanProductNum = 0; for (PipeOutPlanMothEntity pipeOutPlanMothEntity : mothListByProIdAndYear) { Integer completePlanProduct = pipeOutPlanMothEntity.getCompletePlanProduct(); completePlanProductNum+=completePlanProduct; } obj.setMonthList(mothListByProIdAndYear); obj.setCompletePipeNum(completePlanProductNum); }); return BasicResult.success(new PageInfo<>(all)); } hd/pipe/materialsManage/src/main/resources/mapping/PipeOutPlanMapper.xml
@@ -67,6 +67,7 @@ t.update_user updateUser, sp.pro_name proName from t_pipe_out_plan t left join sys_project sp on sp.pro_id = t.pro_id where t.is_use = 1 and t.pro_id = #{proId} @@ -108,7 +109,7 @@ GROUP BY b.time ) c ON c.yearAndMoth= d.yearAndMoth ) e ON e.Moth = a.month WHERE b.pro_id = #{proId} WHERE b.pro_id = #{proId} and a.pipe_out_plan_id =#{planOutId} ORDER BY a.month </select> @@ -122,7 +123,7 @@ pipe_out_plan_id, </if> <if test="month != null"> month, `month`, </if> <if test="planProduct != null"> plan_product, @@ -130,16 +131,16 @@ </trim> <trim prefix="values (" suffix=")" suffixOverrides="," > <if test="id != null"> id = #{id,jdbcType=VARCHAR}, #{id,jdbcType=VARCHAR}, </if> <if test="pipeOutPlanId != null"> pipe_out_plan_id = #{pipeOutPlanId,jdbcType=VARCHAR}, #{pipeOutPlanId,jdbcType=VARCHAR}, </if> <if test="month != null"> `month` = #{month,jdbcType=INTEGER}, #{month,jdbcType=INTEGER}, </if> <if test="planProduct != null"> plan_product= #{planProduct,jdbcType=INTEGER}, #{planProduct,jdbcType=INTEGER}, </if> </trim> </insert> @@ -215,7 +216,7 @@ plan_year=#{planYear}, </if> <if test="needPipeNum != null"> needPipeNum = #{needPipeNum}, need_pipe_num = #{needPipeNum}, </if> <if test="createTime != null"> create_time=#{createTime}, @@ -241,7 +242,7 @@ </update> <delete id="deleteMoth"> delete from t_pipe_out_plan_moth where plan_out_id=#{planOutId} delete from t_pipe_out_plan_moth where pipe_out_plan_id=#{planOutId} </delete> hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/pipeinfo/entity/PipeDto.java
@@ -49,4 +49,6 @@ private String segmentId; private String yearMonth; private String goIn; } hd/pipe/mobile/src/main/resources/mapping/PipeInfoMapper.xml
@@ -196,7 +196,10 @@ tpi.segment_id = #{segmentId} AND </if> <if test="yearMonth!=null"> out_mod_time like CONCAT(#{yearMonth},'%') AND tpi.out_mod_time like CONCAT(#{yearMonth},'%') AND </if> <if test="goIn!=null"> tpi.go_in = 2 AND </if> </trim> </where>