hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/pipeoutplan/controller/PipeOutPlanController.java
对比新文件 @@ -0,0 +1,47 @@ package com.thhy.materials.modules.biz.pipeoutplan.controller; import com.thhy.general.common.BasicResult; import com.thhy.materials.modules.biz.pipeoutplan.entity.PipeOutPlanEntity; import com.thhy.materials.modules.biz.pipeoutplan.service.PipeOutPlanService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.Map; /** * @Author QiuYuHao * @CreateDate 2023-11-03 9:38:16 * 发运计划 */ @RestController @RequestMapping(value = "pipeoutplan") public class PipeOutPlanController { @Autowired private PipeOutPlanService pipeOutPlanService; @PostMapping("insert") BasicResult insert(@RequestBody PipeOutPlanEntity pipeOutPlanEntity){ return pipeOutPlanService.insert(pipeOutPlanEntity); } @GetMapping("delete") BasicResult delete(String pipeNeedId){ return pipeOutPlanService.delete(pipeNeedId); } @PostMapping("update") BasicResult update(@RequestBody PipeOutPlanEntity pipeOutPlanEntity){ return pipeOutPlanService.update(pipeOutPlanEntity); } @GetMapping("selectInfo") BasicResult selectInfo(String pipeNeedId){ return pipeOutPlanService.selectInfo(pipeNeedId); } @PostMapping("findAll") BasicResult findAll(@RequestBody Map<String,Object> map){ return pipeOutPlanService.findAll(map); } } hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/pipeoutplan/entity/PipeOutPlanEntity.java
对比新文件 @@ -0,0 +1,34 @@ package com.thhy.materials.modules.biz.pipeoutplan.entity; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import org.omg.CORBA.PRIVATE_MEMBER; import java.util.Date; import java.util.List; /** * @Author QiuYuHao * @CreateDate 2023-11-03 9:40:41 * 发运计划实体 */ @Data @AllArgsConstructor @NoArgsConstructor @Builder public class PipeOutPlanEntity { private String planOutId;//计划ID private String proId;//项目ID private Integer planYear;//年份 private Integer needPipeNum;//需求合计多少片 private Date createTime;//创建时间 private String createUser;//创建人 private Date updateTime;//修改时间 private String updateUser;//修改人 private Integer isUse;//1Y0N private List<PipeOutPlanMothEntity> monthList; } hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/pipeoutplan/entity/PipeOutPlanMothEntity.java
对比新文件 @@ -0,0 +1,33 @@ package com.thhy.materials.modules.biz.pipeoutplan.entity; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; /** * @Author QiuYuHao * @CreateDate 2023-11-03 10:52:23 * 发运计划月份实体 */ @Data @AllArgsConstructor @NoArgsConstructor @Builder public class PipeOutPlanMothEntity { private String id; private String pipeOutPlanId; private Integer month; /** * 管片需求数量 */ private Integer planProduct; private String proId; /** * 已发运管片数量 */ private Integer completePlanProduct; } hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/pipeoutplan/mapper/PipeOutPlanMapper.java
对比新文件 @@ -0,0 +1,82 @@ package com.thhy.materials.modules.biz.pipeoutplan.mapper; import com.thhy.materials.modules.biz.pipeoutplan.entity.PipeOutPlanEntity; import com.thhy.materials.modules.biz.pipeoutplan.entity.PipeOutPlanMothEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import java.util.List; import java.util.Map; /** * @Author QiuYuHao * @CreateDate 2023-11-03 9:41:37 * 发运计划mapper */ @Mapper public interface PipeOutPlanMapper { /** * 新增发运计划表 * @param pipeOutPlanEntity */ void insert(PipeOutPlanEntity pipeOutPlanEntity); /** * 新增发运计划月数表 * @param pipeOutPlanMothEntity */ void insertMoth(PipeOutPlanMothEntity pipeOutPlanMothEntity); /** * 删除发运计划表 * @param pipeNeedId */ void delete(String pipeNeedId); /** * 删除发运计划月数表 * @param pipeNeedId */ void deleteMoth(String pipeNeedId); /** * 更新发运计划表 * @param pipeOutPlanEntity */ void update(PipeOutPlanEntity pipeOutPlanEntity); /** * 查询单条发运计划表 * @param pipeNeedId * @return */ PipeOutPlanEntity selectInfo(String pipeNeedId); PipeOutPlanEntity selectInfoByProIdAndYear( @Param("proId") String proId, @Param("planYear") Integer year); /** * 查询发运计划列表 * @param map * @return */ List<PipeOutPlanEntity> findAll(Map<String,Object> map); /** * 查询发运计划月数表 * @param pipeNeedId * @return */ List<PipeOutPlanMothEntity> findMothList(String pipeNeedId); /** * 查询每月数量 * @param proId * @param year * @return */ List<PipeOutPlanMothEntity> findMothListByProIdAndYear(@Param("proId") String proId, @Param("year") String year); } hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/pipeoutplan/service/PipeOutPlanService.java
对比新文件 @@ -0,0 +1,24 @@ package com.thhy.materials.modules.biz.pipeoutplan.service; import com.thhy.general.common.BasicResult; import com.thhy.materials.modules.biz.pipeoutplan.entity.PipeOutPlanEntity; import java.util.Map; /** * @Author QiuYuHao * @CreateDate 2023-11-03 9:42:10 * 发运计划逻辑接口 */ public interface PipeOutPlanService { BasicResult insert(PipeOutPlanEntity pipeOutPlanEntity); BasicResult delete(String pipeNeedId); BasicResult update(PipeOutPlanEntity pipeOutPlanEntity); BasicResult selectInfo(String pipeNeedId); BasicResult findAll(Map<String,Object> map); } hd/pipe/materialsManage/src/main/java/com/thhy/materials/modules/biz/pipeoutplan/service/impl/PipeOutPlanServiceImpl.java
对比新文件 @@ -0,0 +1,100 @@ package com.thhy.materials.modules.biz.pipeoutplan.service.impl; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import com.thhy.general.common.BasicResult; import com.thhy.general.config.SysUserInfo; import com.thhy.general.utils.UUIDUtils; import com.thhy.general.utils.UserInfoUtils; import com.thhy.materials.modules.biz.pipeoutplan.entity.PipeOutPlanEntity; import com.thhy.materials.modules.biz.pipeoutplan.entity.PipeOutPlanMothEntity; import com.thhy.materials.modules.biz.pipeoutplan.mapper.PipeOutPlanMapper; import com.thhy.materials.modules.biz.pipeoutplan.service.PipeOutPlanService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.List; import java.util.Map; /** * @Author QiuYuHao * @CreateDate 2023-11-03 9:42:41 * 发运管理逻辑实现层 */ @Service public class PipeOutPlanServiceImpl implements PipeOutPlanService { @Autowired private PipeOutPlanMapper pipeOutPlanMapper; @Override @Transactional(rollbackFor = Exception.class) public BasicResult insert(PipeOutPlanEntity pipeOutPlanEntity) { PipeOutPlanEntity isExit = pipeOutPlanMapper.selectInfoByProIdAndYear(pipeOutPlanEntity.getProId(), pipeOutPlanEntity.getPlanYear()); 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->{ vo.setPipeOutPlanId(planOutId); pipeOutPlanMapper.insertMoth(vo); }); return BasicResult.success(); } @Override @Transactional(rollbackFor = Exception.class) public BasicResult delete(String pipeNeedId) { pipeOutPlanMapper.delete(pipeNeedId); pipeOutPlanMapper.deleteMoth(pipeNeedId); return BasicResult.success(); } @Override @Transactional(rollbackFor = Exception.class) public BasicResult update(PipeOutPlanEntity pipeOutPlanEntity) { PipeOutPlanEntity isExit = pipeOutPlanMapper.selectInfoByProIdAndYear(pipeOutPlanEntity.getProId(), pipeOutPlanEntity.getPlanYear()); if (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->{ vo.setPipeOutPlanId(planOutId); pipeOutPlanMapper.insertMoth(vo); }); return BasicResult.success(); } @Override public BasicResult selectInfo(String pipeNeedId) { PipeOutPlanEntity pipeOutPlanEntity = pipeOutPlanMapper.selectInfo(pipeNeedId); List<PipeOutPlanMothEntity> mothList = pipeOutPlanMapper.findMothList(pipeNeedId); pipeOutPlanEntity.setMonthList(mothList); return BasicResult.success(pipeOutPlanEntity); } @Override public BasicResult findAll(Map<String, Object> map) { Integer pageNum = (Integer) map.get("pageNum"); Integer pageSize = (Integer) map.get("pageSize"); PageHelper.startPage(pageNum,pageSize); SysUserInfo userInfo = UserInfoUtils.getInstance().getUserInfo(); map.put("companyId",userInfo.getCompanyId()); List<PipeOutPlanEntity> all = pipeOutPlanMapper.findAll(map); all.forEach(obj->{ String proId = obj.getProId(); Integer planYear = obj.getPlanYear(); obj.setMonthList(pipeOutPlanMapper.findMothListByProIdAndYear(proId,planYear.toString())); }); return BasicResult.success(new PageInfo<>(all)); } } hd/pipe/mobile/src/main/java/com/thhy/mobile/modules/biz/pipeinfo/entity/PipeDto.java
@@ -47,4 +47,6 @@ private String num; private String segmentId; private String yearMonth; } hd/pipe/mobile/src/main/resources/mapping/PipeInfoMapper.xml
@@ -195,8 +195,11 @@ <if test="segmentId!=null"> tpi.segment_id = #{segmentId} AND </if> </trim> </where> <if test="yearMonth!=null"> out_mod_time like CONCAT(#{yearMonth},'%') AND </if> </trim> </where> order by tpi.check_time desc ) a <if test="groupId != null and groupId !=''">