diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml index 6560a98..de4cd0b 100644 --- a/.idea/inspectionProfiles/Project_Default.xml +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -1,6 +1,62 @@ \ No newline at end of file diff --git a/src/main/java/com/bonus/gzgqj/business/plan/controller/PlanOutController.java b/src/main/java/com/bonus/gzgqj/business/plan/controller/PlanOutController.java index e0b809b..85fac72 100644 --- a/src/main/java/com/bonus/gzgqj/business/plan/controller/PlanOutController.java +++ b/src/main/java/com/bonus/gzgqj/business/plan/controller/PlanOutController.java @@ -67,6 +67,18 @@ public class PlanOutController { PageInfo pageInfo = service.getPorInfoDetail(dto.getData());; return pageInfo; } + /** + * X详情接口 + * @param dto + * @return + */ + @GetMapping("getPorInfoDetail2") + @DecryptAndVerify(decryptedClass = ProNeedInfo.class) + public PageInfo getPorInfoDetail2(EncryptedReq dto) { + PageHelper.startPage(dto.getPageNum(),dto.getPageSize()); + PageInfo pageInfo = service.getPorInfoDetail2(dto.getData());; + return pageInfo; + } /** @@ -90,9 +102,6 @@ public class PlanOutController { return service.insertProOutPutInfo(request,files); } - - - /** * 查询批次数量 * @return @@ -115,5 +124,19 @@ public class PlanOutController { } + /** + * X详情接口 + * @param dto + * @return + */ + @GetMapping("getOutDetailList") + @DecryptAndVerify(decryptedClass = ProNeedInfo.class) + public PageInfo getOutDetailList(EncryptedReq dto) { + PageHelper.startPage(dto.getPageNum(),dto.getPageSize()); + PageInfo pageInfo = service.getOutDetailList(dto.getData());; + return pageInfo; + } + + } diff --git a/src/main/java/com/bonus/gzgqj/business/plan/entity/OutDetailInfoVo.java b/src/main/java/com/bonus/gzgqj/business/plan/entity/OutDetailInfoVo.java index 9e07220..62d1289 100644 --- a/src/main/java/com/bonus/gzgqj/business/plan/entity/OutDetailInfoVo.java +++ b/src/main/java/com/bonus/gzgqj/business/plan/entity/OutDetailInfoVo.java @@ -2,12 +2,44 @@ package com.bonus.gzgqj.business.plan.entity; import lombok.Data; +import java.util.List; + /** * 出货详情查询 + * @author 黑子 */ @Data public class OutDetailInfoVo { - private String userName; + private String id; + /** + * 发货人 + */ + private String userName; + + /** + * 发货 日期 + */ + private String createDay; + + /** + * 备注 + */ + private String remarks; + + /** + * 备注 + */ + private String proId; + + + /** + * 概述 + */ + private String details; + /** + * 文件上传 集合 + */ + private List fileList; } diff --git a/src/main/java/com/bonus/gzgqj/business/plan/entity/ProNeedInfo.java b/src/main/java/com/bonus/gzgqj/business/plan/entity/ProNeedInfo.java index 0277e71..1662c04 100644 --- a/src/main/java/com/bonus/gzgqj/business/plan/entity/ProNeedInfo.java +++ b/src/main/java/com/bonus/gzgqj/business/plan/entity/ProNeedInfo.java @@ -1,10 +1,13 @@ package com.bonus.gzgqj.business.plan.entity; import lombok.Data; +import lombok.EqualsAndHashCode; /** * 工程需要数据 + * @author 黑子 */ +@EqualsAndHashCode(callSuper = true) @Data public class ProNeedInfo extends PageInfo { /** @@ -87,4 +90,7 @@ public class ProNeedInfo extends PageInfo { private String progress; + + + } diff --git a/src/main/java/com/bonus/gzgqj/business/plan/mapper/FileUploadMapper.java b/src/main/java/com/bonus/gzgqj/business/plan/mapper/FileUploadMapper.java index 7e81280..acce713 100644 --- a/src/main/java/com/bonus/gzgqj/business/plan/mapper/FileUploadMapper.java +++ b/src/main/java/com/bonus/gzgqj/business/plan/mapper/FileUploadMapper.java @@ -3,6 +3,11 @@ package com.bonus.gzgqj.business.plan.mapper; import com.bonus.gzgqj.business.plan.entity.FileUploadVo; import org.springframework.stereotype.Repository; +import java.util.List; + +/** + * @author 黑子 + */ @Repository public interface FileUploadMapper { /** @@ -10,4 +15,11 @@ public interface FileUploadMapper { * @param vo */ void insertFileUpload(FileUploadVo vo); + + /** + * 查询数据结合 + * @param vo + * @return + */ + List getFileList(FileUploadVo vo); } diff --git a/src/main/java/com/bonus/gzgqj/business/plan/mapper/PlanOutMapper.java b/src/main/java/com/bonus/gzgqj/business/plan/mapper/PlanOutMapper.java index af820b5..5bb308d 100644 --- a/src/main/java/com/bonus/gzgqj/business/plan/mapper/PlanOutMapper.java +++ b/src/main/java/com/bonus/gzgqj/business/plan/mapper/PlanOutMapper.java @@ -22,6 +22,13 @@ public interface PlanOutMapper { */ List getPorInfoDetail(ProNeedInfo data); + /** + * 分页查询工程 发货详情 + * @param data + * @return + */ + List getPorInfoDetail2(ProNeedInfo data); + /** * 下拉选 * @param data @@ -99,17 +106,30 @@ public interface PlanOutMapper { */ StatisticsVo getOverNum(); - /** - * 查询分页详情 - * @param data - * @return - */ - List getOutDetails(ProNeedInfo data); + /** * 获取 发货批次 * @param data * @return */ - List getOutTimes(ProNeedInfo data); + List getOutTimes(ProNeedInfo data); + + /** + * 查询详情1 + * @param data + * @return + */ + OutDetailInfoVo getOutDetails(ProNeedInfo data); + + ProNeedInfo getHisAddData(ProNeedInfo insertObj); + + List getOutDetailsInfo(ProNeedInfo data); + + /** + * 发货批次详情 + * @param data + * @return + */ + List getOutDetailList(ProNeedInfo data); } diff --git a/src/main/java/com/bonus/gzgqj/business/plan/service/PlanOutService.java b/src/main/java/com/bonus/gzgqj/business/plan/service/PlanOutService.java index f97af83..2bb1146 100644 --- a/src/main/java/com/bonus/gzgqj/business/plan/service/PlanOutService.java +++ b/src/main/java/com/bonus/gzgqj/business/plan/service/PlanOutService.java @@ -59,4 +59,18 @@ public interface PlanOutService { * @return */ ServerResponse getOutDetails(ProNeedInfo data); + + /** + * 详情接口 + * @param data + * @return + */ + PageInfo getPorInfoDetail2(ProNeedInfo data); + + /** + * 批次详情查询 + * @param data + * @return + */ + PageInfo getOutDetailList(ProNeedInfo data); } diff --git a/src/main/java/com/bonus/gzgqj/business/plan/service/PlanOutServiceImpl.java b/src/main/java/com/bonus/gzgqj/business/plan/service/PlanOutServiceImpl.java index 36a74aa..3e33a43 100644 --- a/src/main/java/com/bonus/gzgqj/business/plan/service/PlanOutServiceImpl.java +++ b/src/main/java/com/bonus/gzgqj/business/plan/service/PlanOutServiceImpl.java @@ -26,8 +26,10 @@ import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletRequest; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; @Service @@ -72,6 +74,40 @@ public class PlanOutServiceImpl implements PlanOutService{ PageInfo pageInfo = new PageInfo<>(list); return pageInfo; } + /** + * 分页查询 工程 发货详情 + * @param data + * @return + */ + @Override + public PageInfo getPorInfoDetail2(ProNeedInfo data) { + List list = new ArrayList<>(); + try { + list = mapper.getPorInfoDetail2(data); + } catch (Exception e) { + log.error(e.toString(),e); + } + PageInfo pageInfo = new PageInfo<>(list); + return pageInfo; + } + + /** + * 批次详情查询 + * @param data + * @return + */ + @Override + public PageInfo getOutDetailList(ProNeedInfo data) { + List list = new ArrayList<>(); + try { + list = mapper.getOutDetailList(data); + } catch (Exception e) { + log.error(e.toString(),e); + } + PageInfo pageInfo = new PageInfo<>(list); + return pageInfo; + } + /** * 拆线呢 工程设备下拉选 @@ -132,24 +168,23 @@ public class PlanOutServiceImpl implements PlanOutService{ } if(num>0){ //计算 本次全部发货数量及整改数量 最后同步到 工程 -计划-发货统计表中 - int allFhNum=0; - //非计划发货数量 - int allFhNum2=0; - //非计划发货次数 - int count=0; - int allTzNum=0; + Map numMap=new HashMap<>(); + numMap.put("allFhNum",0); + numMap.put("allFhNum2",0); + numMap.put("count",0); + numMap.put("allTzNum",0); //处理 发货单 - boolean a= planOutInfo(list,vo,allFhNum,allTzNum); + boolean a= planOutInfo(list,vo,numMap); if(!a){ return ServerResponse.createErroe("发货失败"); } //处理新增发货单 - boolean b=addOutPlanInfo(addList,vo,allFhNum2,count); + boolean b=addOutPlanInfo(addList,vo,numMap); if(!b){ return ServerResponse.createErroe("发货失败"); } //处理 发货后 统计及 详情数据 - boolean c= updateProPlan(vo,allFhNum,allTzNum,allFhNum2,count); + boolean c= updateProPlan(vo,numMap); if(!c){ return ServerResponse.createErroe("发货失败"); } @@ -195,7 +230,7 @@ public class PlanOutServiceImpl implements PlanOutService{ */ @Override public ServerResponse getOutTimes(ProNeedInfo data) { - List list=new ArrayList<>(); + List list=new ArrayList<>(); try{ list=mapper.getOutTimes(data); }catch (Exception e){ @@ -210,15 +245,30 @@ public class PlanOutServiceImpl implements PlanOutService{ @Override public ServerResponse getOutDetails(ProNeedInfo data) { - return null; + try{ + OutDetailInfoVo vo=mapper.getOutDetails(data); + List flieList=uploadService.getFileList(data.getId(),"t_plan_out"); + List msg=mapper.getOutDetailsInfo(data); + String result = String.join(",", msg); // 结果为 "apple, banana, orange" + vo.setDetails(result); + vo.setFileList(flieList); + return ServerResponse.createSuccess(vo); + }catch (Exception e){ + log.error(e.toString(),e); + } + return ServerResponse.createErroe("接口异常"); } - public boolean planOutInfo(List list,ProOutInfoVo vo,int allFhNum, int allTzNum){ + public boolean planOutInfo(List list,ProOutInfoVo vo, Map map){ try { for (ProOutDetail details:list){ + int allFhNum=map.get("allFhNum"); + int allTzNum=map.get("allTzNum"); allFhNum=allFhNum+details.getNum(); allTzNum=allTzNum+details.getTzNum(); + map.put("allFhNum",allFhNum); + map.put("allTzNum",allTzNum); //获取 计划数据 ProNeedInfo data=mapper.getProNeedInfo(details); if(data==null){ @@ -227,7 +277,7 @@ public class PlanOutServiceImpl implements PlanOutService{ }else{ //需要的数量 ProNeedInfo insertObj=new ProNeedInfo(); - BeanUtils.copyProperties(insertObj,data); + BeanUtils.copyProperties(data,insertObj); insertObj.setOutId(vo.getId()); insertObj.setDataType("1"); insertObj.setFhNum(details.getNum()); @@ -243,14 +293,13 @@ public class PlanOutServiceImpl implements PlanOutService{ int tzNum2=details.getTzNum(); data.setFhNum(fhNum+fhNum2); data.setTzNum(tzNum+tzNum2); - mapper.updateNeedInfo(data); - return true; }else { return false; } } } + return true; }catch (Exception e){ log.error(e.toString(),e); } @@ -260,19 +309,23 @@ public class PlanOutServiceImpl implements PlanOutService{ /** * 更新工程 -统计数据 - * @param allTzNum 全部调整数量 - * @param vo - * @param allFhNum 全部发货数量 - * @param allFhNum 超出需求数量 - * @return + * @param map 全部调整数量 + * @param vo 实体 + */ - public Boolean updateProPlan( ProOutInfoVo vo,int allFhNum, int allTzNum ,int allFhNum2,int count ){ + public Boolean updateProPlan(ProOutInfoVo vo, Map map ){ try { + int allFhNum=map.get("allFhNum"); + int allTzNum=map.get("allTzNum"); + int count=map.get("count"); + int allFhNum2=map.get("allFhNum2"); //更新工程 总数据信息 ProPlanInfoVo data= mapper.getProPlanInfo(vo); int recordNum=data.getRecordNum(); int outNum= data.getOutNum(); int needNum= data.getNeedNum(); + int num=data.getRecordNum2(); + int outNum2=data.getOutNum2(); recordNum=recordNum+1; outNum=outNum+allFhNum; data.setRecordNum(recordNum); @@ -288,9 +341,9 @@ public class PlanOutServiceImpl implements PlanOutService{ } data.setLastDay(vo.getCreateDay()); //非计划发货数量 - data.setOutNum2(allFhNum2); + data.setOutNum2(allFhNum2+outNum2); //非计划发货次数 . - data.setRecordNum2(count); + data.setRecordNum2(count+num); //更新 工程-计划 -统计表 mapper.updatePriPlanInfo(data); return true; @@ -304,15 +357,18 @@ public class PlanOutServiceImpl implements PlanOutService{ * 传入 * 新增集合、发货单、发货数量 */ - public Boolean addOutPlanInfo(List addList, ProOutInfoVo vo,int allFhNum,int count){ + public Boolean addOutPlanInfo(List addList, ProOutInfoVo vo, Map map){ try { //是否有 新增 if(StringUtils.isNotEmpty(addList)){ + int count=map.get("count"); count=count+1; + map.put("count",count); //全部新增发货清单 for (ProAddInfoDetails details:addList){ - + int allFhNum=map.get("allFhNum2"); allFhNum=allFhNum+details.getFhNum(); + map.put("allFhNum2",allFhNum); ProNeedInfo insertObj=new ProNeedInfo(); insertObj.setOutId(vo.getId()); insertObj.setDataType("1"); @@ -325,18 +381,27 @@ public class PlanOutServiceImpl implements PlanOutService{ insertObj.setUnit(details.getUnit()); insertObj.setRemarks(details.getRemark()); insertObj.setDataType("2"); + insertObj.setNeedType("2"); insertObj.setProId(vo.getProId()); //添加 记录清单 int num2=mapper.insertProNeedDetails(insertObj); if(num2>=0){ - //新增 工程-计划-发货 清单表 - mapper.addNeedInfo(insertObj); - return true; + ProNeedInfo data=mapper.getHisAddData(insertObj); + if (data!=null && data.getId()!=null){ + insertObj.setFhNum(data.getFhNum()+details.getFhNum()); + mapper.updateNeedInfo(insertObj); + }else { + //新增 工程-计划-发货 清单表 + mapper.addNeedInfo(insertObj); + } + }else { return false; } } } + + return true; }catch (Exception e){ log.error(e.toString(),e); } diff --git a/src/main/java/com/bonus/gzgqj/business/utils/FileUploadService.java b/src/main/java/com/bonus/gzgqj/business/utils/FileUploadService.java index 7e44167..fdcd8fb 100644 --- a/src/main/java/com/bonus/gzgqj/business/utils/FileUploadService.java +++ b/src/main/java/com/bonus/gzgqj/business/utils/FileUploadService.java @@ -38,7 +38,8 @@ public class FileUploadService { for (MultipartFile file : files) { String fileName = file.getOriginalFilename(); String suffix=IDUtils.getSuffix(fileName); - String newPath= SystemUtils.getUploadPath()+ DateTimeHelper.getNowYMD()+"/"+ IDUtils.createID()+suffix; + String path= DateTimeHelper.getNowYMD()+"/"+ IDUtils.createID()+suffix; + String newPath= SystemUtils.getUploadPath()+path; File uploadFile = new File(newPath); //生成文件夹 if (!uploadFile.getParentFile().exists()) { @@ -49,7 +50,7 @@ public class FileUploadService { file.transferTo(uploadFile); FileUploadVo vo=new FileUploadVo(); vo.setFileName(fileName); - vo.setFileUrl(newPath); + vo.setFileUrl(path); vo.setOwnId(outId); vo.setModelTable(table); vo.setSuffix(suffix); @@ -68,7 +69,20 @@ public class FileUploadService { } + public List getFileList( String outId, String table){ + List list=new ArrayList<>(); + try { + FileUploadVo vo=new FileUploadVo(); + vo.setOwnId(outId); + vo.setModelTable(table); + list=mapper.getFileList(vo); + }catch (Exception e){ + log.error(e.toString(),e); + } + return list; + } + } diff --git a/src/main/java/com/bonus/gzgqj/manager/webResult/ServerResponse.java b/src/main/java/com/bonus/gzgqj/manager/webResult/ServerResponse.java index 8ea7d9a..695291f 100644 --- a/src/main/java/com/bonus/gzgqj/manager/webResult/ServerResponse.java +++ b/src/main/java/com/bonus/gzgqj/manager/webResult/ServerResponse.java @@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; import com.github.pagehelper.PageInfo; import lombok.Data; +import lombok.Getter; import java.io.Serializable; @@ -17,6 +18,7 @@ public class ServerResponse implements Serializable { private String msg; + @Getter private T data; private Long count; @@ -69,17 +71,7 @@ public class ServerResponse implements Serializable { return this.status==ResponseCode.SUCCESS.getCode(); } - public int getStatus() { - return status; - } - public String getMsg() { - return msg; - } - - public T getData() { - return data; - } /** * 分页返回数据封装 @@ -91,8 +83,8 @@ public class ServerResponse implements Serializable { } /** - * @param curr - * @param limit + * @param curr 史 + * @param limit 长度 * @param * @return */ diff --git a/src/main/resources/mappers/plan/FileUploadMapper.xml b/src/main/resources/mappers/plan/FileUploadMapper.xml index 6301c6c..f344c3b 100644 --- a/src/main/resources/mappers/plan/FileUploadMapper.xml +++ b/src/main/resources/mappers/plan/FileUploadMapper.xml @@ -17,4 +17,17 @@ )values(#{fileName},#{fileUrl},now(),#{creator},#{modelTable},#{ownId},#{suffix},#{fileType}) + \ No newline at end of file diff --git a/src/main/resources/mappers/plan/PlanOutMapper.xml b/src/main/resources/mappers/plan/PlanOutMapper.xml index c33e856..e511030 100644 --- a/src/main/resources/mappers/plan/PlanOutMapper.xml +++ b/src/main/resources/mappers/plan/PlanOutMapper.xml @@ -34,7 +34,7 @@ select ppi.pro_id proId, ppi.need_num needNum,pro.`NAME` proName,tz_num, ppi.plan_num planNum,ppi.record_num recordNum, - ppi.out_num outNum, ppi.status,IFNULL((out_num+tz_num)*100/need_num ,0) progress, + ppi.out_num outNum, ppi.status, IFNULL(ROUND((ppi.out_num+ppi.tz_num)*100/ppi.need_num,0),0) progress, ppi.last_day lastDay from t_pro_plan_info ppi LEFT JOIN bm_project pro on ppi.pro_id=pro.id @@ -50,12 +50,18 @@ + + + - + select id, create_day createDay,create_time + from t_plan_out + where pro_id=#{proId} + order by create_time desc - + select consignor userName,create_day createDay,remarks,pro_id proId from t_plan_out - where pro_id=#{proId} + where id=#{id} + + + + + + + \ No newline at end of file