From 2896d6fa447cf6a678ba27ba2e19224379f14dd4 Mon Sep 17 00:00:00 2001 From: 邱宇豪 <qyh123230312> Date: 星期五, 03 十一月 2023 16:48:43 +0800 Subject: [PATCH] 20231103_qiuyh_发运计划 --- hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/pipeinfo/entity/PipeDto.java | 2 + hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/pipeoutplan/entity/PipeOutPlanEntity.java | 2 + hd/pipe/materialsManage/src/main/resources/mapping/PipeOutPlanMapper.xml | 17 ++++---- hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/pipeoutplan/service/impl/PipeOutPlanServiceImpl.java | 24 ++++++++--- hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/pipeoutplan/mapper/PipeOutPlanMapper.java | 3 + hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/pipeoutplan/controller/PipeOutPlanController.java | 8 ++-- hd/pipe/mobile/src/main/resources/mapping/PipeInfoMapper.xml | 5 ++ 7 files changed, 40 insertions(+), 21 deletions(-) diff --git a/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/pipeoutplan/controller/PipeOutPlanController.java b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/pipeoutplan/controller/PipeOutPlanController.java index af3be72..e7abcc2 100644 --- a/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/pipeoutplan/controller/PipeOutPlanController.java +++ b/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") diff --git a/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/pipeoutplan/entity/PipeOutPlanEntity.java b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/pipeoutplan/entity/PipeOutPlanEntity.java index 7299577..b5b59ff 100644 --- a/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/pipeoutplan/entity/PipeOutPlanEntity.java +++ b/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;//修改时间 diff --git a/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/pipeoutplan/mapper/PipeOutPlanMapper.java b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/pipeoutplan/mapper/PipeOutPlanMapper.java index b215f4d..c6d8ae4 100644 --- a/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/pipeoutplan/mapper/PipeOutPlanMapper.java +++ b/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); } diff --git a/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/pipeoutplan/service/impl/PipeOutPlanServiceImpl.java b/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/pipeoutplan/service/impl/PipeOutPlanServiceImpl.java index 1348787..0f80f09 100644 --- a/hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/pipeoutplan/service/impl/PipeOutPlanServiceImpl.java +++ b/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)); } diff --git a/hd/pipe/materialsManage/src/main/resources/mapping/PipeOutPlanMapper.xml b/hd/pipe/materialsManage/src/main/resources/mapping/PipeOutPlanMapper.xml index 9ec9b23..b5081a1 100644 --- a/hd/pipe/materialsManage/src/main/resources/mapping/PipeOutPlanMapper.xml +++ b/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> diff --git a/hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/pipeinfo/entity/PipeDto.java b/hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/pipeinfo/entity/PipeDto.java index 76a9e0c..9b7ee8d 100644 --- a/hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/pipeinfo/entity/PipeDto.java +++ b/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; } diff --git a/hd/pipe/mobile/src/main/resources/mapping/PipeInfoMapper.xml b/hd/pipe/mobile/src/main/resources/mapping/PipeInfoMapper.xml index 46ff19f..927af88 100644 --- a/hd/pipe/mobile/src/main/resources/mapping/PipeInfoMapper.xml +++ b/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> -- Gitblit v1.9.3