From beca42f6f9fa7fc7b2da6f2a6300abe68a534f99 Mon Sep 17 00:00:00 2001 From: anthonywj Date: Sun, 28 May 2023 20:39:48 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=BD=E6=BA=AF=E7=9B=B8=E5=85=B3=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=EF=BC=8C=E4=BC=81=E4=B8=9A=E4=BF=A1=E6=81=AF=E7=BC=96?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/trace/UdiTraceController.java | 21 +++++++++++++++---- .../api/entity/basic/BasicUdiRelEntity.java | 10 ++++++++- .../trace/TraceProductDetailEntity.java | 21 +++++++++---------- .../api/req/basic/BasicUdiRelRequest.java | 4 +++- .../glxp/api/req/basic/UdiSelectRequest.java | 3 +++ .../mapper/trace/TraceManuOrderMapper.xml | 2 +- .../mybatis/mapper/trace/TraceOrderMapper.xml | 11 +++++----- .../mapper/trace/TraceRecordMapper.xml | 2 +- 8 files changed, 50 insertions(+), 24 deletions(-) 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 b62904f..b742710 100644 --- a/src/main/java/com/glxp/api/controller/trace/UdiTraceController.java +++ b/src/main/java/com/glxp/api/controller/trace/UdiTraceController.java @@ -85,14 +85,27 @@ public class UdiTraceController extends BaseController { traceRecordLogEntity.setFromType(traceRecordRequest.getFromType()); traceRecordLogEntity.setTraceType(traceRecordRequest.getTraceType()); - //4.创建查询详情记录,若存在相同查询记录则直接获取 + TraceProductDetailEntity traceProductDetailEntity = null; if (traceRecordRequest.getTraceType() == 1) {//按UDI码查询 - TraceProductDetailEntity traceProductDetailEntity = traceProductDetailService.findUniqueByCode(1, traceRecordRequest.getUdiCode()); + traceProductDetailEntity = traceProductDetailService.findUniqueByCode(1, traceRecordRequest.getUdiCode()); if (traceProductDetailEntity == null) { - + traceProductDetailEntity.setId(IdUtil.getSnowflakeNextId()); + traceProductDetailEntity.setTraceSource(1); + traceProductDetailEntity.setTraceType(traceRecordRequest.getTraceType()); + traceProductDetailEntity.setUdiCode(traceRecordRequest.getUdiCode()); + traceProductDetailEntity.setYlqxzcrbarmc(basicUdiRelResponse.getYlqxzcrbarmc()); + traceProductDetailEntity.setCreditNum(basicUdiRelResponse.getTyshxydm()); + traceProductDetailEntity.setCpmctymc(basicUdiRelResponse.getCpmctymc()); + traceProductDetailEntity.setGgxh(basicUdiRelResponse.getGgxh()); + traceProductDetailEntity.setNameCode(basicUdiRelResponse.getNameCode()); + traceProductDetailEntity.setBatchNo(udiEntity.getBatchNo()); + traceProductDetailEntity.setProduceDate(udiEntity.getProduceDate()); + traceProductDetailEntity.setExpireDate(udiEntity.getExpireDate()); + traceProductDetailEntity.setSerialNo(udiEntity.getSerialNo()); + traceProductDetailEntity.setStatus(1); + traceProductDetailService.save(traceProductDetailEntity); } - } else { //按批次号查询 } diff --git a/src/main/java/com/glxp/api/entity/basic/BasicUdiRelEntity.java b/src/main/java/com/glxp/api/entity/basic/BasicUdiRelEntity.java index 49f85fb..5e5ae16 100644 --- a/src/main/java/com/glxp/api/entity/basic/BasicUdiRelEntity.java +++ b/src/main/java/com/glxp/api/entity/basic/BasicUdiRelEntity.java @@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.annotation.TableName; import java.io.Serializable; import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; @Data @@ -53,10 +54,17 @@ public class BasicUdiRelEntity implements Serializable { */ @TableField(value = "companyType") private Integer companyType; - + /** + * 代理起始时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd") @TableField(value = "agengtStartDate") private Date agengtStartDate; + /** + * 代理结束时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd") @TableField(value = "agengtEndDate") private Date agengtEndDate; diff --git a/src/main/java/com/glxp/api/entity/trace/TraceProductDetailEntity.java b/src/main/java/com/glxp/api/entity/trace/TraceProductDetailEntity.java index a9ddb4b..e11116c 100644 --- a/src/main/java/com/glxp/api/entity/trace/TraceProductDetailEntity.java +++ b/src/main/java/com/glxp/api/entity/trace/TraceProductDetailEntity.java @@ -17,7 +17,6 @@ import lombok.Data; public class TraceProductDetailEntity implements Serializable { @TableId(value = "id", type = IdType.INPUT) private Long id; - /** * 查询方式(1:源头查询;2:现在检查查询) */ @@ -35,13 +34,6 @@ public class TraceProductDetailEntity implements Serializable { */ @TableField(value = "udiCode") private String udiCode; - - /** - * 社会信用号 - */ - @TableField(value = "creditNum") - private String creditNum; - /** * 注册备案人 */ @@ -49,10 +41,10 @@ public class TraceProductDetailEntity implements Serializable { private String ylqxzcrbarmc; /** - * 产品主DI标识 + * 社会信用号 */ - @TableField(value = "nameCode") - private String nameCode; + @TableField(value = "creditNum") + private String creditNum; /** * 产品通用名 @@ -66,6 +58,13 @@ public class TraceProductDetailEntity implements Serializable { @TableField(value = "ggxh") private String ggxh; + /** + * 产品主DI标识 + */ + @TableField(value = "nameCode") + private String nameCode; + + /** * 生产批次号 */ diff --git a/src/main/java/com/glxp/api/req/basic/BasicUdiRelRequest.java b/src/main/java/com/glxp/api/req/basic/BasicUdiRelRequest.java index f049531..55fce31 100644 --- a/src/main/java/com/glxp/api/req/basic/BasicUdiRelRequest.java +++ b/src/main/java/com/glxp/api/req/basic/BasicUdiRelRequest.java @@ -1,6 +1,7 @@ package com.glxp.api.req.basic; import com.baomidou.mybatisplus.annotation.TableField; +import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import java.util.Date; @@ -42,8 +43,9 @@ public class BasicUdiRelRequest { */ private Integer companyType; + @JsonFormat(pattern = "yyyy-MM-dd") private Date agengtStartDate; - + @JsonFormat(pattern = "yyyy-MM-dd") private Date agengtEndDate; diff --git a/src/main/java/com/glxp/api/req/basic/UdiSelectRequest.java b/src/main/java/com/glxp/api/req/basic/UdiSelectRequest.java index 6bd7c73..00d8979 100644 --- a/src/main/java/com/glxp/api/req/basic/UdiSelectRequest.java +++ b/src/main/java/com/glxp/api/req/basic/UdiSelectRequest.java @@ -10,5 +10,8 @@ public class UdiSelectRequest { List products; private Long companyId; + private String key; + private List keys; + } diff --git a/src/main/resources/mybatis/mapper/trace/TraceManuOrderMapper.xml b/src/main/resources/mybatis/mapper/trace/TraceManuOrderMapper.xml index 3da3c31..c30bd10 100644 --- a/src/main/resources/mybatis/mapper/trace/TraceManuOrderMapper.xml +++ b/src/main/resources/mybatis/mapper/trace/TraceManuOrderMapper.xml @@ -7,7 +7,7 @@ FROM trace_manu_order tmo LEFT JOIN user_company uc ON uc.id = tmo.companyIdFk LEFT JOIN (SELECT tr.recordCode,tr.createUser,tr.remark,trd.batchNo,trd.traceType - FROM trace_record tr + FROM trace_record_log tr LEFT JOIN trace_record_detail trd ON trd.recordIdFk = tr.id) mid ON mid.recordCode = tmo.recordCode diff --git a/src/main/resources/mybatis/mapper/trace/TraceOrderMapper.xml b/src/main/resources/mybatis/mapper/trace/TraceOrderMapper.xml index bea3e1f..692fb27 100644 --- a/src/main/resources/mybatis/mapper/trace/TraceOrderMapper.xml +++ b/src/main/resources/mybatis/mapper/trace/TraceOrderMapper.xml @@ -4,12 +4,13 @@ SELECT tr.recordCode, tr.remark, trd.*, mid.* - FROM trace_record tr + FROM trace_record_log tr LEFT JOIN trace_record_detail trd ON trd.recordIdFk = tr.id LEFT JOIN (SELECT tor.billNo, tor.fromCorp, tor.toCorp, tor.createUser, uc.companyName FROM trace_order tor