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 d98b370..dcab232 100644 --- a/src/main/java/com/glxp/api/controller/trace/TraceOrderController.java +++ b/src/main/java/com/glxp/api/controller/trace/TraceOrderController.java @@ -102,6 +102,9 @@ public class TraceOrderController extends BaseController { return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL, bindingResult.getFieldError().getDefaultMessage()); } TraceTaskNoticeEntity taskNoticeEntity = traceTaskNoticeService.getById(traceOrderUploadRequest.getTaskId()); + if (taskNoticeEntity == null) { + return ResultVOUtils.error(500, "任务已过期!"); + } TraceOrderEntity traceOrderEntity = new TraceOrderEntity(); BeanUtils.copyProperties(traceOrderUploadRequest, traceOrderEntity); traceOrderEntity.setCompanyIdFk(taskNoticeEntity.getCompanyIdFk()); @@ -119,16 +122,21 @@ public class TraceOrderController extends BaseController { if (StrUtil.isNotEmpty(traceOrderEntity.getToCorpCreditNum()) && !traceOrderEntity.getToCorpCreditNum().equals(userCompanyEntity.getCreditNum())) { UserCompanyEntity toUserCompanyEntity = userCompanyService.getOne(new QueryWrapper().eq("creditNum", traceOrderEntity.getToCorpCreditNum()), false); - TraceTaskNoticeEntity nextNotity = traceTaskNoticeService.findTask(2, traceOrderEntity.getTraceProductIdFk(), toUserCompanyEntity.getId()); - if (nextNotity == null) { - TraceProductDetailEntity traceProductDetailEntity = traceProductDetailService.getById(traceOrderEntity.getTraceProductIdFk()); - nextNotity = udiTraceService.createTraceNotice(2, traceProductDetailEntity, toUserCompanyEntity.getId()); - udiTraceService.pushDelayExpireTask(nextNotity); - udiTraceService.pushMq(nextNotity, toUserCompanyEntity.getId()); - } else if (nextNotity.getStatus() == 4) { - //任务超时未处理,重新推送消息 - udiTraceService.pushMq(nextNotity, toUserCompanyEntity.getId()); + if (toUserCompanyEntity != null) { + TraceTaskNoticeEntity nextNotity = traceTaskNoticeService.findTask(2, traceOrderEntity.getTraceProductIdFk(), toUserCompanyEntity.getId()); + if (nextNotity == null) { + TraceProductDetailEntity traceProductDetailEntity = traceProductDetailService.getById(traceOrderEntity.getTraceProductIdFk()); + nextNotity = udiTraceService.createTraceNotice(2, traceProductDetailEntity, toUserCompanyEntity.getId()); + udiTraceService.pushDelayExpireTask(nextNotity); + udiTraceService.pushMq(nextNotity, toUserCompanyEntity.getId()); + } else if (nextNotity.getStatus() == 4) { + //任务超时未处理,重新推送消息 + udiTraceService.pushMq(nextNotity, toUserCompanyEntity.getId()); + } + } else { + log.error("未找到下一家企业"); } + } diff --git a/src/main/java/com/glxp/api/entity/trace/TraceTaskNoticeEntity.java b/src/main/java/com/glxp/api/entity/trace/TraceTaskNoticeEntity.java index 01bd866..8b4cdab 100644 --- a/src/main/java/com/glxp/api/entity/trace/TraceTaskNoticeEntity.java +++ b/src/main/java/com/glxp/api/entity/trace/TraceTaskNoticeEntity.java @@ -19,7 +19,7 @@ import lombok.Data; */ @Data @ApiModel("任务公告表") -@TableName(value = "trace_task_notice") +@TableName(value = "trace_task_notice", autoResultMap = true) public class TraceTaskNoticeEntity implements Serializable { @ApiModelProperty(value = "主键") @TableId(value = "id", type = IdType.INPUT) @@ -53,20 +53,20 @@ public class TraceTaskNoticeEntity implements Serializable { @TableField(value = "companyIdFk") private Long companyIdFk; + /** + * 注册企业统一社会信用号 + */ + @ApiModelProperty(value = "注册企业统一社会信用号") + @TableField(value = "creditNum") + private String creditNum; + /** * 医疗器械注册人 - * */ @ApiModelProperty(value = "医疗器械注册人") @TableField(value = "ylqxzcrbarmc") private String ylqxzcrbarmc; - /** - * 医疗器械注册人统一社会信用号 - */ - @ApiModelProperty(value = "医疗器械注册人统一社会信用号") - @TableField(value = "creditNum") - private String creditNum; /** * 产品名称 diff --git a/src/main/java/com/glxp/api/service/trace/UdiTraceService.java b/src/main/java/com/glxp/api/service/trace/UdiTraceService.java index 6c49a9c..5a8bcd5 100644 --- a/src/main/java/com/glxp/api/service/trace/UdiTraceService.java +++ b/src/main/java/com/glxp/api/service/trace/UdiTraceService.java @@ -223,6 +223,7 @@ public class UdiTraceService { //创建任务列表 public TraceTaskNoticeEntity createTraceNotice(Integer taskType, TraceProductDetailEntity traceProductDetailEntity, Long companyId) { + UserCompanyEntity userCompanyEntity = userCompanyService.getById(companyId); TraceTaskNoticeEntity traceTaskNoticeEntity = new TraceTaskNoticeEntity(); traceTaskNoticeEntity.setId(IdUtil.getSnowflakeNextId()); traceTaskNoticeEntity.setProdudctRecordIdFk(traceProductDetailEntity.getId()); @@ -230,7 +231,7 @@ public class UdiTraceService { traceTaskNoticeEntity.setStatus(1); traceTaskNoticeEntity.setCompanyIdFk(companyId); traceTaskNoticeEntity.setYlqxzcrbarmc(traceProductDetailEntity.getYlqxzcrbarmc()); - traceTaskNoticeEntity.setCreditNum(traceProductDetailEntity.getCreditNum()); + traceTaskNoticeEntity.setCreditNum(userCompanyEntity.getCreditNum()); traceTaskNoticeEntity.setCpmctymc(traceProductDetailEntity.getCpmctymc()); traceTaskNoticeEntity.setGgxh(traceProductDetailEntity.getGgxh()); traceTaskNoticeEntity.setBatchNo(traceProductDetailEntity.getBatchNo()); diff --git a/src/main/resources/mybatis/mapper/trace/TraceTaskNoticeMapper.xml b/src/main/resources/mybatis/mapper/trace/TraceTaskNoticeMapper.xml index c2d9480..66103ce 100644 --- a/src/main/resources/mybatis/mapper/trace/TraceTaskNoticeMapper.xml +++ b/src/main/resources/mybatis/mapper/trace/TraceTaskNoticeMapper.xml @@ -1,9 +1,14 @@ + + + +