|  |  | @ -1,22 +1,26 @@ | 
			
		
	
		
		
			
				
					
					|  |  |  | package com.glxp.api.service.trace; |  |  |  | package com.glxp.api.service.trace; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import cn.hutool.core.collection.CollUtil; | 
			
		
	
		
		
			
				
					
					|  |  |  | import cn.hutool.core.util.IdUtil; |  |  |  | import cn.hutool.core.util.IdUtil; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import cn.hutool.core.util.StrUtil; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.entity.basic.UdiEntity; |  |  |  | import com.glxp.api.entity.basic.UdiEntity; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.entity.trace.MqTraceMessage; |  |  |  | import com.glxp.api.entity.sup.UserCompanyEntity; | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.entity.trace.TraceProductDetailEntity; |  |  |  | import com.glxp.api.entity.trace.*; | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.entity.trace.TraceRecordLogEntity; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.entity.trace.TraceTaskNoticeEntity; |  |  |  |  | 
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.req.basic.FilterUdiRelRequest; |  |  |  | import com.glxp.api.req.basic.FilterUdiRelRequest; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.req.trace.TraceRecordRequest; |  |  |  | import com.glxp.api.req.trace.TraceRecordRequest; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.res.basic.BasicUdiRelResponse; |  |  |  | import com.glxp.api.res.basic.BasicUdiRelResponse; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.service.basic.BasicUdiProductService; |  |  |  | import com.glxp.api.service.basic.BasicUdiProductService; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.service.basic.BasicUdiRelService; |  |  |  | import com.glxp.api.service.basic.BasicUdiRelService; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import com.glxp.api.service.sup.UserCompanyService; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.util.GennerOrderUtils; |  |  |  | import com.glxp.api.util.GennerOrderUtils; | 
			
		
	
		
		
			
				
					
					|  |  |  | import org.springframework.stereotype.Service; |  |  |  | import org.springframework.stereotype.Service; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | import javax.annotation.Resource; |  |  |  | import javax.annotation.Resource; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import java.util.ArrayList; | 
			
		
	
		
		
			
				
					
					|  |  |  | import java.util.Date; |  |  |  | import java.util.Date; | 
			
		
	
		
		
			
				
					
					|  |  |  | import java.util.List; |  |  |  | import java.util.List; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import java.util.stream.Collectors; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | @Service |  |  |  | @Service | 
			
		
	
		
		
			
				
					
					|  |  |  | public class UdiTraceService { |  |  |  | public class UdiTraceService { | 
			
		
	
	
		
		
			
				
					|  |  | @ -38,6 +42,8 @@ public class UdiTraceService { | 
			
		
	
		
		
			
				
					
					|  |  |  |     TraceTaskNoticeService traceTaskNoticeService; |  |  |  |     TraceTaskNoticeService traceTaskNoticeService; | 
			
		
	
		
		
			
				
					
					|  |  |  |     @Resource |  |  |  |     @Resource | 
			
		
	
		
		
			
				
					
					|  |  |  |     RabbitPushService rabbitPushService; |  |  |  |     RabbitPushService rabbitPushService; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     @Resource | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     TraceManuOrderService traceManuOrderService; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     //创建查询日志
 |  |  |  |     //创建查询日志
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     public TraceRecordLogEntity createRecordLog(String userId, Integer fromType, Integer traceType) { |  |  |  |     public TraceRecordLogEntity createRecordLog(String userId, Integer fromType, Integer traceType) { | 
			
		
	
	
		
		
			
				
					|  |  | @ -59,8 +65,12 @@ public class UdiTraceService { | 
			
		
	
		
		
			
				
					
					|  |  |  |         TraceProductDetailEntity traceProductDetailEntity = null; |  |  |  |         TraceProductDetailEntity traceProductDetailEntity = null; | 
			
		
	
		
		
			
				
					
					|  |  |  |         traceProductDetailEntity = traceProductDetailService.findUniqueByCode(1, udiCode); |  |  |  |         traceProductDetailEntity = traceProductDetailService.findUniqueByCode(1, udiCode); | 
			
		
	
		
		
			
				
					
					|  |  |  |         if (traceProductDetailEntity == null) { |  |  |  |         if (traceProductDetailEntity == null) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             traceProductDetailEntity = new TraceProductDetailEntity(); | 
			
		
	
		
		
			
				
					
					|  |  |  |             traceProductDetailEntity.setId(IdUtil.getSnowflakeNextId()); |  |  |  |             traceProductDetailEntity.setId(IdUtil.getSnowflakeNextId()); | 
			
		
	
		
		
			
				
					
					|  |  |  |             traceProductDetailEntity.setTraceSource(traceSource); |  |  |  |             traceProductDetailEntity.setTraceSource(traceSource); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             if (traceSource == 1) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 traceProductDetailEntity.setManuStatus(1); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |             traceProductDetailEntity.setTraceType(traceType); |  |  |  |             traceProductDetailEntity.setTraceType(traceType); | 
			
		
	
		
		
			
				
					
					|  |  |  |             traceProductDetailEntity.setUdiCode(udiCode); |  |  |  |             traceProductDetailEntity.setUdiCode(udiCode); | 
			
		
	
		
		
			
				
					
					|  |  |  |             traceProductDetailEntity.setYlqxzcrbarmc(basicUdiRelResponse.getYlqxzcrbarmc()); |  |  |  |             traceProductDetailEntity.setYlqxzcrbarmc(basicUdiRelResponse.getYlqxzcrbarmc()); | 
			
		
	
	
		
		
			
				
					|  |  | @ -72,6 +82,7 @@ public class UdiTraceService { | 
			
		
	
		
		
			
				
					
					|  |  |  |             traceProductDetailEntity.setProduceDate(udiEntity.getProduceDate()); |  |  |  |             traceProductDetailEntity.setProduceDate(udiEntity.getProduceDate()); | 
			
		
	
		
		
			
				
					
					|  |  |  |             traceProductDetailEntity.setExpireDate(udiEntity.getExpireDate()); |  |  |  |             traceProductDetailEntity.setExpireDate(udiEntity.getExpireDate()); | 
			
		
	
		
		
			
				
					
					|  |  |  |             traceProductDetailEntity.setSerialNo(udiEntity.getSerialNo()); |  |  |  |             traceProductDetailEntity.setSerialNo(udiEntity.getSerialNo()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |             traceProductDetailEntity.setStatus(1); |  |  |  |             traceProductDetailEntity.setStatus(1); | 
			
		
	
		
		
			
				
					
					|  |  |  |             traceProductDetailService.save(traceProductDetailEntity); |  |  |  |             traceProductDetailService.save(traceProductDetailEntity); | 
			
		
	
		
		
			
				
					
					|  |  |  |             return traceProductDetailEntity; |  |  |  |             return traceProductDetailEntity; | 
			
		
	
	
		
		
			
				
					|  |  | @ -89,6 +100,9 @@ public class UdiTraceService { | 
			
		
	
		
		
			
				
					
					|  |  |  |         if (traceProductDetailEntity == null) { |  |  |  |         if (traceProductDetailEntity == null) { | 
			
		
	
		
		
			
				
					
					|  |  |  |             traceProductDetailEntity.setId(IdUtil.getSnowflakeNextId()); |  |  |  |             traceProductDetailEntity.setId(IdUtil.getSnowflakeNextId()); | 
			
		
	
		
		
			
				
					
					|  |  |  |             traceProductDetailEntity.setTraceSource(traceSource); |  |  |  |             traceProductDetailEntity.setTraceSource(traceSource); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             if (traceSource == 1) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 traceProductDetailEntity.setManuStatus(1); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |             traceProductDetailEntity.setTraceType(traceType); |  |  |  |             traceProductDetailEntity.setTraceType(traceType); | 
			
		
	
		
		
			
				
					
					|  |  |  |             traceProductDetailEntity.setYlqxzcrbarmc(basicUdiRelResponse.getYlqxzcrbarmc()); |  |  |  |             traceProductDetailEntity.setYlqxzcrbarmc(basicUdiRelResponse.getYlqxzcrbarmc()); | 
			
		
	
		
		
			
				
					
					|  |  |  |             traceProductDetailEntity.setCreditNum(basicUdiRelResponse.getTyshxydm()); |  |  |  |             traceProductDetailEntity.setCreditNum(basicUdiRelResponse.getTyshxydm()); | 
			
		
	
	
		
		
			
				
					|  |  | @ -103,42 +117,89 @@ public class UdiTraceService { | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     @Resource |  |  |  |     @Resource | 
			
		
	
		
		
			
				
					
					|  |  |  |     TraceManuOrderService traceManuOrderService; |  |  |  |     UserCompanyService userCompanyService; | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     //创建任务列表
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     public void createTraceTask(TraceProductDetailEntity traceProductDetailEntity, Long companyId) { |  |  |  |  | 
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     //创建源头查询任务
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     public void createSourceTraceTask(TraceProductDetailEntity traceProductDetailEntity, Long companyId) { | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         //1.查询生产订单信息是否已上传
 |  |  |  |         //1.查询生产订单信息是否已上传
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         //生产订单关联关系
 |  |  |  |         //生产订单关联关系
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         if (traceProductDetailEntity.getManuStatus() == 1) {        //生产订单未处理
 |  |  |  |         TraceTaskNoticeEntity manuTaskNotity = traceTaskNoticeService.findTask(1, traceProductDetailEntity.getId(), companyId); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         if (manuTaskNotity == null) { | 
			
		
	
		
		
			
				
					
					|  |  |  |             createTraceNotice(1, traceProductDetailEntity, companyId); |  |  |  |             createTraceNotice(1, traceProductDetailEntity, companyId); | 
			
		
	
		
		
			
				
					
					|  |  |  |             pushMq(traceProductDetailEntity, companyId); |  |  |  |             pushMq(traceProductDetailEntity, companyId); | 
			
		
	
		
		
			
				
					
					|  |  |  |         } else if (traceProductDetailEntity.getManuStatus() == 2) {    //生产订单处理未完成
 |  |  |  |         } else if (manuTaskNotity.getStatus() == 4) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |             TraceTaskNoticeEntity taskNoticeEntity = traceTaskNoticeService.findTask(1, traceProductDetailEntity.getId()); |  |  |  |             //任务超时未处理,重新推送消息
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |             if (taskNoticeEntity == null) { |  |  |  |             pushMq(traceProductDetailEntity, companyId); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 createTraceNotice(1, traceProductDetailEntity, companyId); |  |  |  |         } | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 pushMq(traceProductDetailEntity, companyId); |  |  |  | 
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |             } else if (taskNoticeEntity.getStatus() == 4) { |  |  |  | 
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 //任务超时未处理,重新推送消息
 |  |  |  |         //列出需要查询推送企业
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 pushMq(traceProductDetailEntity, companyId); |  |  |  |         List<TraceOrderEntity> traceOrderEntities = traceOrderService.findByProductIdFk(traceProductDetailEntity.getId()); | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         if (CollUtil.isNotEmpty(traceOrderEntities)) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             List<String> toCorpCreditNums = new ArrayList<>(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             for (TraceOrderEntity traceOrderEntity : traceOrderEntities) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 if (StrUtil.isNotEmpty(traceOrderEntity.getToCorpCreditNum())) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     toCorpCreditNums.add(traceOrderEntity.getToCorpCreditNum()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             List<String> certNums = toCorpCreditNums.stream().distinct().collect(Collectors.toList()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             for (String certNum : certNums) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 UserCompanyEntity userCompanyEntity = userCompanyService.getOne(new QueryWrapper<UserCompanyEntity>().eq("creditNum", certNum)); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 TraceTaskNoticeEntity taskNoticeEntity = traceTaskNoticeService.findTask(1, traceProductDetailEntity.getId(), userCompanyEntity.getId()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 if (taskNoticeEntity == null) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     createTraceNotice(1, traceProductDetailEntity, companyId); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     pushMq(traceProductDetailEntity, companyId); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 } else if (taskNoticeEntity.getStatus() == 4) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     //任务超时未处理,重新推送消息
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     pushMq(traceProductDetailEntity, companyId); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     //    创建现场检查询任务
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     public void createCheckTraceTask(TraceProductDetailEntity traceProductDetailEntity, Long companyId) { | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         //2.查询出入库单消息是否已经上传
 |  |  |  |         //1.查询出入库单消息是否已经上传
 | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |         if (traceProductDetailEntity.getStatus() == 1) {        //出入库订单未处理
 |  |  |  |         if (traceProductDetailEntity.getStatus() == 1) {        //出入库订单未处理
 | 
			
		
	
		
		
			
				
					
					|  |  |  |             createTraceNotice(2, traceProductDetailEntity, companyId); |  |  |  |             createTraceNotice(2, traceProductDetailEntity, companyId); | 
			
		
	
		
		
			
				
					
					|  |  |  |             pushMq(traceProductDetailEntity, companyId); |  |  |  |             pushMq(traceProductDetailEntity, companyId); | 
			
		
	
		
		
			
				
					
					|  |  |  |         } else if (traceProductDetailEntity.getStatus() == 2) { //出入库订单未处理完成
 |  |  |  |         } else if (traceProductDetailEntity.getStatus() == 2) { //出入库订单未处理完成
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |             //列出需要查询推送企业
 | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             List<TraceOrderEntity> traceOrderEntities = traceOrderService.findByProductIdFk(traceProductDetailEntity.getId()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             if (CollUtil.isNotEmpty(traceOrderEntities)) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 List<String> toCorpCreditNums = new ArrayList<>(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 for (TraceOrderEntity traceOrderEntity : traceOrderEntities) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     if (StrUtil.isNotEmpty(traceOrderEntity.getToCorpCreditNum())) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         toCorpCreditNums.add(traceOrderEntity.getToCorpCreditNum()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     if (StrUtil.isNotEmpty(traceOrderEntity.getFromCorpCreditNum())) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         toCorpCreditNums.add(traceOrderEntity.getFromCorpCreditNum()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 List<String> certNums = toCorpCreditNums.stream().distinct().collect(Collectors.toList()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 for (String certNum : certNums) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     UserCompanyEntity userCompanyEntity = userCompanyService.getOne(new QueryWrapper<UserCompanyEntity>().eq("creditNum", certNum)); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     TraceTaskNoticeEntity taskNoticeEntity = traceTaskNoticeService.findTask(1, traceProductDetailEntity.getId(), userCompanyEntity.getId()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     if (taskNoticeEntity == null) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         createTraceNotice(1, traceProductDetailEntity, companyId); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         pushMq(traceProductDetailEntity, companyId); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     } else if (taskNoticeEntity.getStatus() == 4) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         //任务超时未处理,重新推送消息
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         pushMq(traceProductDetailEntity, companyId); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     //创建任务列表
 |  |  |  |     //创建任务列表
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     public TraceTaskNoticeEntity createTraceNotice(Integer taskType, TraceProductDetailEntity traceProductDetailEntity, Long companyId) { |  |  |  |     public TraceTaskNoticeEntity createTraceNotice(Integer taskType, TraceProductDetailEntity traceProductDetailEntity, Long companyId) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         TraceTaskNoticeEntity traceTaskNoticeEntity = new TraceTaskNoticeEntity(); |  |  |  |         TraceTaskNoticeEntity traceTaskNoticeEntity = new TraceTaskNoticeEntity(); | 
			
		
	
		
		
			
				
					
					|  |  |  |         traceTaskNoticeEntity.setId(IdUtil.getSnowflakeNextId()); |  |  |  |         traceTaskNoticeEntity.setId(IdUtil.getSnowflakeNextId()); | 
			
		
	
		
		
			
				
					
					|  |  |  |         traceTaskNoticeEntity.setProdudctRecordIdFk(traceProductDetailEntity.getId()); |  |  |  |         traceTaskNoticeEntity.setProdudctRecordIdFk(traceProductDetailEntity.getId()); | 
			
		
	
	
		
		
			
				
					|  |  | @ -155,6 +216,10 @@ public class UdiTraceService { | 
			
		
	
		
		
			
				
					
					|  |  |  |         traceTaskNoticeEntity.setSerialNo(traceProductDetailEntity.getSerialNo()); |  |  |  |         traceTaskNoticeEntity.setSerialNo(traceProductDetailEntity.getSerialNo()); | 
			
		
	
		
		
			
				
					
					|  |  |  |         traceTaskNoticeEntity.setCreateTime(new Date()); |  |  |  |         traceTaskNoticeEntity.setCreateTime(new Date()); | 
			
		
	
		
		
			
				
					
					|  |  |  |         FilterUdiRelRequest filterUdiRelRequest = new FilterUdiRelRequest(); |  |  |  |         FilterUdiRelRequest filterUdiRelRequest = new FilterUdiRelRequest(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         filterUdiRelRequest.setYlqxzcrbarmc(traceProductDetailEntity.getYlqxzcrbarmc()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         filterUdiRelRequest.setCpmctymc(traceProductDetailEntity.getCpmctymc()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         filterUdiRelRequest.setGgxh(traceProductDetailEntity.getGgxh()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         filterUdiRelRequest.setNameCode(traceProductDetailEntity.getNameCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |         List<String> diList = basicUdiRelService.findDiListByProduct(filterUdiRelRequest); |  |  |  |         List<String> diList = basicUdiRelService.findDiListByProduct(filterUdiRelRequest); | 
			
		
	
		
		
			
				
					
					|  |  |  |         traceTaskNoticeEntity.setDiList(diList); |  |  |  |         traceTaskNoticeEntity.setDiList(diList); | 
			
		
	
		
		
			
				
					
					|  |  |  |         traceTaskNoticeService.save(traceTaskNoticeEntity); |  |  |  |         traceTaskNoticeService.save(traceTaskNoticeEntity); | 
			
		
	
	
		
		
			
				
					|  |  | 
 |