From 578c1de03ccca71030eb77fdcc15efebe74e8f14 Mon Sep 17 00:00:00 2001 From: anthonywj Date: Thu, 15 Jun 2023 16:30:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=BF=BD=E6=BA=AF=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E8=BF=94=E5=9B=9E=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../purchase/userPersonController.java | 35 +++++++---------- .../trace/TraceManuOrderController.java | 11 ++---- .../trace/TraceOrderController.java | 16 ++------ .../trace/TraceRecordController.java | 39 ++++++++++++++++++- .../controller/trace/UdiTraceController.java | 19 +++------ .../api/req/trace/TraceRecordRequest.java | 12 +++--- .../api/res/trace/TraceSearchReponse.java | 9 ++++- 7 files changed, 79 insertions(+), 62 deletions(-) diff --git a/src/main/java/com/glxp/api/controller/purchase/userPersonController.java b/src/main/java/com/glxp/api/controller/purchase/userPersonController.java index 6d22d46..54e98db 100644 --- a/src/main/java/com/glxp/api/controller/purchase/userPersonController.java +++ b/src/main/java/com/glxp/api/controller/purchase/userPersonController.java @@ -32,17 +32,17 @@ public class userPersonController { @Resource private UserPersonService userPersonService; - @ApiOperation(value = "获取用户个人信息",response = UserPersonEntity.class) + @ApiOperation(value = "获取用户个人信息", response = UserPersonEntity.class) @PostMapping("/sup/company/person/filterList") - public BaseResponse filterCompanyCert(@RequestBody UserPersonFilterRequest userPersonFilterRequest , BindingResult bindingResult){ + public BaseResponse filterCompanyCert(@RequestBody UserPersonFilterRequest userPersonFilterRequest, BindingResult bindingResult) { if (bindingResult.hasErrors()) { return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); } QueryWrapper and; - if(StrUtil.isNotBlank(userPersonFilterRequest.getUserName())){ - and= new QueryWrapper().like("userName", userPersonFilterRequest.getUserName()).and(i -> i.eq("companyId", userPersonFilterRequest.getCompanyId())); - }else{ - and= new QueryWrapper().eq("companyId", userPersonFilterRequest.getCompanyId()); + if (StrUtil.isNotBlank(userPersonFilterRequest.getUserName())) { + and = new QueryWrapper().like("userName", userPersonFilterRequest.getUserName()).and(i -> i.eq("companyId", userPersonFilterRequest.getCompanyId())); + } else { + and = new QueryWrapper().eq("companyId", userPersonFilterRequest.getCompanyId()); } List list = userPersonService.list(and); PageInfo pageInfo; @@ -53,41 +53,34 @@ public class userPersonController { return ResultVOUtils.success(pageSimpleResponse); } - @ApiOperation(value = "跟新企业负责人信息",response = BaseResponse.class) + @ApiOperation(value = "更新企业负责人信息", response = BaseResponse.class) @PostMapping("/sup/company/person/updatePerSon") - public BaseResponse updatePerSon(@RequestBody UserPersonFilterRequest userPersonFilterRequest ,BindingResult bindingResult ){ + public BaseResponse updatePerSon(@RequestBody UserPersonFilterRequest userPersonFilterRequest, BindingResult bindingResult) { if (bindingResult.hasErrors()) { return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); } UserPersonEntity userPerson = new UserPersonEntity(); - BeanUtils.copyProperties(userPersonFilterRequest,userPerson); + BeanUtils.copyProperties(userPersonFilterRequest, userPerson); userPerson.setPassword(userPersonFilterRequest.getCheckPassword()); userPersonService.update(userPerson); - return ResultVOUtils.success(); + return ResultVOUtils.success(); } - @ApiOperation(value = "删除企业负责人信息",response = BaseResponse.class) + @ApiOperation(value = "删除企业负责人信息", response = BaseResponse.class) @PostMapping("/sup/company/person/daletePerSon") - public BaseResponse daletePerSon(@RequestBody UserPersonFilterRequest userPersonFilterRequest ,BindingResult bindingResult ){ + public BaseResponse daletePerSon(@RequestBody UserPersonFilterRequest userPersonFilterRequest, BindingResult bindingResult) { if (bindingResult.hasErrors()) { return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); } UserPersonEntity userPerson = new UserPersonEntity(); - BeanUtils.copyProperties(userPersonFilterRequest,userPerson); + BeanUtils.copyProperties(userPersonFilterRequest, userPerson); userPersonService.delete(userPerson); - return ResultVOUtils.success(); + return ResultVOUtils.success(); } - - - - - - - } diff --git a/src/main/java/com/glxp/api/controller/trace/TraceManuOrderController.java b/src/main/java/com/glxp/api/controller/trace/TraceManuOrderController.java index b991cf9..381f5cb 100644 --- a/src/main/java/com/glxp/api/controller/trace/TraceManuOrderController.java +++ b/src/main/java/com/glxp/api/controller/trace/TraceManuOrderController.java @@ -54,11 +54,9 @@ public class TraceManuOrderController { @Resource TraceManuCodeRelService traceManuCodeRelService; @Resource - TraceTaskService traceTaskService; - @Resource private final RabbitTemplate rabbitTemplate; - @ApiOperation(value = "生产信息推送接口",response = BaseResponse.class) + @ApiOperation(value = "生产信息推送接口", response = BaseResponse.class) @GetMapping("udi/trace/manu/order/sendUdi") public BaseResponse sendUdi(@RequestBody TraceManuOrderUploadRequest traceManuOrderUploadRequest) { String messageJson = JSON.toJSONString(traceManuOrderUploadRequest); @@ -68,8 +66,7 @@ public class TraceManuOrderController { } - - @ApiOperation(value = "查询追溯单据列表",response = TraceManuOrderResponse.class) + @ApiOperation(value = "查询追溯生产订单列表", response = TraceManuOrderResponse.class) @AuthRuleAnnotation("udi/trace/manu/order/filter") @GetMapping("udi/trace/manu/order/filter") public BaseResponse filterLogs(TraceManuOrderRequest traceManuOrderRequest) { @@ -82,7 +79,7 @@ public class TraceManuOrderController { return ResultVOUtils.success(pageSimpleResponse); } - @ApiOperation(value = "查询追溯单据详情列表",response = TraceManuCodeRellResponse.class) + @ApiOperation(value = "查询追溯生产订单关联关系", response = TraceManuCodeRellResponse.class) @AuthRuleAnnotation("udi/trace/manu/order/relCode") @GetMapping("udi/trace/manu/order/relCode") public BaseResponse filterDetail(TraceManuDetailRequest traceManuDetailRequest) { @@ -99,7 +96,7 @@ public class TraceManuOrderController { TraceTaskNoticeService traceTaskNoticeService; //客户端生产信息上传接口 - @ApiOperation(value = "客户端生产信息上传接口",response = BaseResponse.class) + @ApiOperation(value = "客户端生产信息上传接口", response = BaseResponse.class) @AuthRuleAnnotation("udi/trace/manu/order/upload") @PostMapping("udi/trace/manu/order/upload") public BaseResponse uploadManuOrder(@RequestBody TraceManuOrderUploadRequest traceManuOrderUploadRequest, BindingResult bindingResult) { diff --git a/src/main/java/com/glxp/api/controller/trace/TraceOrderController.java b/src/main/java/com/glxp/api/controller/trace/TraceOrderController.java index 8c6525d..3fde426 100644 --- a/src/main/java/com/glxp/api/controller/trace/TraceOrderController.java +++ b/src/main/java/com/glxp/api/controller/trace/TraceOrderController.java @@ -1,27 +1,20 @@ package com.glxp.api.controller.trace; -import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.StrUtil; -import com.alibaba.fastjson.JSON; import com.github.pagehelper.PageInfo; import com.glxp.api.annotation.AuthRuleAnnotation; import com.glxp.api.common.enums.ResultEnum; import com.glxp.api.common.res.BaseResponse; import com.glxp.api.common.util.ResultVOUtils; -import com.glxp.api.config.rabbit.TopicRabbitConfig; import com.glxp.api.controller.BaseController; import com.glxp.api.entity.basic.UdiEntity; -import com.glxp.api.entity.sup.UserCompanyEntity; -import com.glxp.api.entity.trace.TraceManuCodeRelEntity; -import com.glxp.api.entity.trace.TraceManuOrderEntity; import com.glxp.api.entity.trace.TraceOrderEntity; import com.glxp.api.entity.trace.TraceTaskNoticeEntity; -import com.glxp.api.req.auth.FilterUserComapanyRequest; -import com.glxp.api.req.trace.*; +import com.glxp.api.req.trace.TraceOrderDetailRequest; +import com.glxp.api.req.trace.TraceOrderUploadRequest; import com.glxp.api.res.PageSimpleResponse; import com.glxp.api.res.trace.TraceOrderResponse; -import com.glxp.api.res.trace.TraceProductRecordResponse; import com.glxp.api.service.trace.TraceOrderService; import com.glxp.api.service.trace.TraceTaskNoticeService; import com.glxp.api.util.udi.FilterUdiUtils; @@ -39,7 +32,6 @@ import org.springframework.web.bind.annotation.RestController; import springfox.documentation.annotations.ApiIgnore; import javax.annotation.Resource; -import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -55,7 +47,7 @@ public class TraceOrderController extends BaseController { @Resource private final RabbitTemplate rabbitTemplate; - @ApiOperation(value = "查询追溯单据列表",response = TraceOrderResponse.class) + @ApiOperation(value = "查询追溯出入库单据列表", response = TraceOrderResponse.class) @AuthRuleAnnotation("") @GetMapping("udi/trace/order/filter") public BaseResponse getTraceOrderList(TraceOrderDetailRequest traceOrderDetailRequest) { @@ -87,7 +79,7 @@ public class TraceOrderController extends BaseController { TraceTaskNoticeService traceTaskNoticeService; //客户端单据信息上传接口 - @ApiOperation(value = "客户端单据信息上传接口",response = BaseResponse.class) + @ApiOperation(value = "客户端单据信息上传接口", response = BaseResponse.class) @AuthRuleAnnotation("udi/trace/inout/order/upload") @PostMapping("udi/trace/inout/order/upload") public BaseResponse uploadInoutOrder(@RequestBody TraceOrderUploadRequest traceOrderUploadRequest, BindingResult bindingResult) { diff --git a/src/main/java/com/glxp/api/controller/trace/TraceRecordController.java b/src/main/java/com/glxp/api/controller/trace/TraceRecordController.java index 139ba90..aae97e6 100644 --- a/src/main/java/com/glxp/api/controller/trace/TraceRecordController.java +++ b/src/main/java/com/glxp/api/controller/trace/TraceRecordController.java @@ -1,18 +1,31 @@ package com.glxp.api.controller.trace; +import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson2.JSON; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.github.pagehelper.PageInfo; import com.glxp.api.annotation.AuthRuleAnnotation; import com.glxp.api.common.res.BaseResponse; import com.glxp.api.common.util.ResultVOUtils; +import com.glxp.api.config.rabbit.TopicRabbitConfig; import com.glxp.api.controller.BaseController; +import com.glxp.api.entity.trace.TraceManuOrderEntity; +import com.glxp.api.entity.trace.TraceOrderEntity; +import com.glxp.api.entity.trace.TraceRecordLogEntity; import com.glxp.api.req.trace.TraceRecordRequest; import com.glxp.api.res.PageSimpleResponse; import com.glxp.api.res.trace.TraceRecordResponse; +import com.glxp.api.res.trace.TraceSearchReponse; +import com.glxp.api.service.trace.TraceManuOrderService; +import com.glxp.api.service.trace.TraceOrderService; import com.glxp.api.service.trace.TraceRecordService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; +import org.apache.poi.ss.formula.functions.T; +import org.bouncycastle.util.encoders.UTF8; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; import springfox.documentation.annotations.ApiIgnore; @@ -27,9 +40,14 @@ public class TraceRecordController extends BaseController { @Resource TraceRecordService traceRecordService; + @Resource + TraceOrderService traceOrderService; + @Resource + TraceManuOrderService traceManuOrderService; + // 查询记录搜索 - @ApiOperation(value = "追溯查询记录搜索",response = TraceRecordResponse.class) + @ApiOperation(value = "追溯查询记录搜索", response = TraceRecordResponse.class) @AuthRuleAnnotation("udi/trace/record/filter") @GetMapping("udi/trace/record/filter") public BaseResponse filterLogs(TraceRecordRequest traceRecordRequest) { @@ -43,4 +61,23 @@ public class TraceRecordController extends BaseController { } + @ApiOperation(value = "追溯查询记录结果", response = TraceRecordResponse.class) + @AuthRuleAnnotation("udi/trace/record/result") + @GetMapping("udi/trace/record/result") + public BaseResponse getTraceResult(TraceRecordRequest traceRecordRequest) { + + if (StrUtil.isNotEmpty(traceRecordRequest.getRecordCode())) { + TraceRecordLogEntity traceRecordLogEntity = traceRecordService.getOne(new QueryWrapper().eq("recordCode", traceRecordRequest.getRecordCode())); + List traceOrderEntities = traceOrderService.findByProductIdFk(traceRecordLogEntity.getTraceProductIdFk()); + List traceManuOrderEntities = traceManuOrderService.list(new QueryWrapper().eq("traceProductIdFk", traceRecordLogEntity.getTraceProductIdFk())); + TraceSearchReponse traceSearchReponse = new TraceSearchReponse(); + traceSearchReponse.setTraceOrderEntities(traceOrderEntities); + traceSearchReponse.setTraceManuOrderEntities(traceManuOrderEntities); + traceSearchReponse.setTraceRecordLogEntity(traceRecordLogEntity); + return ResultVOUtils.success(traceSearchReponse); + } else { + return ResultVOUtils.error(500, "查询记录号不能为空!"); + } + } + } diff --git a/src/main/java/com/glxp/api/controller/trace/UdiTraceController.java b/src/main/java/com/glxp/api/controller/trace/UdiTraceController.java index 1233de9..cc931c3 100644 --- a/src/main/java/com/glxp/api/controller/trace/UdiTraceController.java +++ b/src/main/java/com/glxp/api/controller/trace/UdiTraceController.java @@ -1,7 +1,6 @@ package com.glxp.api.controller.trace; import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.lang.UUID; import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson.JSON; @@ -27,7 +26,6 @@ import com.glxp.api.service.basic.BasicUdiRelService; import com.glxp.api.service.sup.UserCompanyService; import com.glxp.api.service.system.SystemParamConfigService; import com.glxp.api.service.trace.*; -import com.glxp.api.util.DateUtil; import com.glxp.api.util.GennerOrderUtils; import com.glxp.api.util.udi.FilterUdiUtils; import io.swagger.annotations.Api; @@ -46,9 +44,7 @@ import springfox.documentation.annotations.ApiIgnore; import javax.annotation.Resource; import java.util.Date; -import java.util.HashMap; import java.util.List; -import java.util.Map; @Api(tags = "UDI追溯相关接口") @@ -59,13 +55,9 @@ import java.util.Map; public class UdiTraceController extends BaseController { - @Resource - TraceProductDetailService traceProductDetailService; @Resource BasicUdiRelService basicUdiRelService; @Resource - GennerOrderUtils gennerOrderUtils; - @Resource TraceTaskNoticeService traceTaskNoticeService; @Resource @@ -88,7 +80,7 @@ public class UdiTraceController extends BaseController { private final RabbitTemplate rabbitTemplate; @ApiIgnore - @ApiOperation(value = "消息推送接口",response = BaseResponse.class) + @ApiOperation(value = "消息推送接口", response = BaseResponse.class) @GetMapping("/udi/trace/source/sendUDI") public BaseResponse sendUdi(@RequestBody TraceRecordRequest traceRecordRequest) { String messageJson = JSON.toJSONString(traceRecordRequest); @@ -106,14 +98,13 @@ public class UdiTraceController extends BaseController { }*/ - /** * 源头追溯查询 * * @param traceRecordRequest * @return */ - @ApiOperation(value = "源头追溯查询",response = TraceOrderEntity.class) + @ApiOperation(value = "源头追溯查询", response = TraceOrderEntity.class) @AuthRuleAnnotation("udi/trace/source/search") @GetMapping("udi/trace/source/search") public BaseResponse createTrace(TraceRecordRequest traceRecordRequest) { @@ -214,7 +205,7 @@ public class UdiTraceController extends BaseController { * @param traceRecordRequest * @return */ - @ApiOperation(value = "现场检查查询",response = TraceOrderEntity.class) + @ApiOperation(value = "现场检查查询", response = TraceOrderEntity.class) @AuthRuleAnnotation("udi/trace/scene/search") @GetMapping("udi/trace/scene/search") public BaseResponse sceneTrace(TraceRecordRequest traceRecordRequest) { @@ -309,7 +300,7 @@ public class UdiTraceController extends BaseController { * @return */ @Transactional - @ApiOperation(value = "客户端根据任务上传出入库单据",response = BaseResponse.class) + @ApiOperation(value = "客户端根据任务上传出入库单据", response = BaseResponse.class) @AuthRuleAnnotation("udi/trace/order/upload") @PostMapping("udi/trace/order/upload") public BaseResponse uploadOrder(@RequestBody TraceOrderUploadRequest traceOrderUploadRequest, BindingResult bindingResult) { @@ -347,7 +338,7 @@ public class UdiTraceController extends BaseController { * @return */ @Transactional - @ApiOperation(value = "客户端根据任务上传生产关联关系信息",response = BaseResponse.class) + @ApiOperation(value = "客户端根据任务上传生产关联关系信息", response = BaseResponse.class) @AuthRuleAnnotation("udi/trace/manuOrder/upload") @PostMapping("udi/trace/manuOrder/upload") public BaseResponse uploadManuOrder(@RequestBody TraceManuOrderUploadRequest traceManuOrderUploadRequest, BindingResult bindingResult) { diff --git a/src/main/java/com/glxp/api/req/trace/TraceRecordRequest.java b/src/main/java/com/glxp/api/req/trace/TraceRecordRequest.java index e4439b6..8aa5087 100644 --- a/src/main/java/com/glxp/api/req/trace/TraceRecordRequest.java +++ b/src/main/java/com/glxp/api/req/trace/TraceRecordRequest.java @@ -8,16 +8,16 @@ import lombok.Data; import java.util.Date; @Data -@ApiModel("跟踪记录请求") +@ApiModel("追溯记录请求") public class TraceRecordRequest extends ListPageRequest { - @ApiModelProperty(hidden = true,value = "主键") + @ApiModelProperty(hidden = true, value = "主键") private Long id; /** * 查询记录号 */ - @ApiModelProperty(hidden = true,value = "查询记录号") + @ApiModelProperty(hidden = true, value = "查询记录号") private String recordCode; /** @@ -35,18 +35,18 @@ public class TraceRecordRequest extends ListPageRequest { /** * 查询记录时间 */ - @ApiModelProperty(hidden = true,value = "查询记录时间") + @ApiModelProperty(hidden = true, value = "查询记录时间") private Date createTime; /** * 更新时间 */ - @ApiModelProperty(hidden = true,value = "更新时间") + @ApiModelProperty(hidden = true, value = "更新时间") private Date updateTime; /** * 查询方式(1:源头查询;2:现在检查查询) */ - @ApiModelProperty(hidden = true,value = "查询方式(1:源头查询;2:现在检查查询)") + @ApiModelProperty(hidden = true, value = "查询方式(1:源头查询;2:现在检查查询)") private Integer traceSource; /** * 查询方案(按UDI码查询/按批次号查询) diff --git a/src/main/java/com/glxp/api/res/trace/TraceSearchReponse.java b/src/main/java/com/glxp/api/res/trace/TraceSearchReponse.java index 01a1c77..9777fd3 100644 --- a/src/main/java/com/glxp/api/res/trace/TraceSearchReponse.java +++ b/src/main/java/com/glxp/api/res/trace/TraceSearchReponse.java @@ -1,16 +1,23 @@ package com.glxp.api.res.trace; +import com.glxp.api.entity.trace.TraceManuOrderEntity; import com.glxp.api.entity.trace.TraceOrderEntity; import com.glxp.api.entity.trace.TraceRecordLogEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.util.List; @Data +@ApiModel("追溯查询结果") public class TraceSearchReponse { - + @ApiModelProperty(value = "追溯日志") TraceRecordLogEntity traceRecordLogEntity; + @ApiModelProperty(value = "追溯查询出入库单结果") List traceOrderEntities; + @ApiModelProperty(value = "追溯查询生产订单结果") + List traceManuOrderEntities; }