Merge remote-tracking branch 'origin/master'

# Conflicts:
#	src/main/java/com/glxp/api/service/trace/TraceOrderService.java
cert
schry 2 years ago
commit c582a3f87e

@ -11,16 +11,15 @@ import com.glxp.api.entity.purchase.SupCertRemindMsgEntity;
import com.glxp.api.entity.sup.UserCertEntity;
import com.glxp.api.entity.trace.TraceManuCodeRelEntity;
import com.glxp.api.entity.trace.TraceManuOrderEntity;
import com.glxp.api.req.trace.TraceManuDetailRequest;
import com.glxp.api.req.trace.TraceManuOrderRequest;
import com.glxp.api.req.trace.TraceManuOrderUploadRequest;
import com.glxp.api.req.trace.TraceRecordRequest;
import com.glxp.api.req.trace.*;
import com.glxp.api.res.PageSimpleResponse;
import com.glxp.api.res.trace.TraceManuCodeRellResponse;
import com.glxp.api.res.trace.TraceManuOrderResponse;
import com.glxp.api.res.trace.TraceRecordResponse;
import com.glxp.api.res.trace.TraceTaskDlResponse;
import com.glxp.api.service.trace.TraceManuCodeRelService;
import com.glxp.api.service.trace.TraceManuOrderService;
import com.glxp.api.service.trace.TraceTaskService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.validation.BindingResult;
@ -48,6 +47,8 @@ public class TraceManuOrderController {
TraceManuOrderService traceManuOrderService;
@Resource
TraceManuCodeRelService traceManuCodeRelService;
@Resource
TraceTaskService traceTaskService;
@AuthRuleAnnotation("udi/trace/manu/order/filter")
@GetMapping("udi/trace/manu/order/filter")
@ -106,5 +107,26 @@ public class TraceManuOrderController {
return ResultVOUtils.success("成功");
}
//任务列表
@AuthRuleAnnotation("udi/trace/task/filter")
@GetMapping("udi/trace/task/filter")
public BaseResponse filterTask(TraceTaskDetailRequest traceTaskDetailRequest) {
List<TraceTaskDlResponse> traceTaskDlResponses = traceTaskService.queryTraceTaskList(traceTaskDetailRequest);
PageInfo<TraceTaskDlResponse> pageInfo = new PageInfo<>(traceTaskDlResponses);
PageSimpleResponse<TraceTaskDlResponse> pageSimpleResponse = new PageSimpleResponse<>();
pageSimpleResponse.setTotal(pageInfo.getTotal());
pageSimpleResponse.setList(traceTaskDlResponses);
return ResultVOUtils.success(pageSimpleResponse);
}
}

@ -16,7 +16,9 @@ import com.glxp.api.req.basic.FilterUdiRelRequest;
import com.glxp.api.req.trace.TraceOrderUploadRequest;
import com.glxp.api.req.trace.TraceRecordRequest;
import com.glxp.api.res.basic.BasicUdiRelResponse;
import com.glxp.api.res.trace.TraceSearchReponse;
import com.glxp.api.service.basic.BasicUdiRelService;
import com.glxp.api.service.sup.UserCompanyService;
import com.glxp.api.service.trace.*;
import com.glxp.api.util.GennerOrderUtils;
import com.glxp.api.util.udi.FilterUdiUtils;
@ -54,6 +56,8 @@ public class UdiTraceController extends BaseController {
TraceRecordService traceRecordService;
@Resource
UdiTraceService udiTraceService;
@Resource
UserCompanyService userCompanyService;
/**
@ -65,13 +69,17 @@ public class UdiTraceController extends BaseController {
@AuthRuleAnnotation("udi/trace/source/search")
@GetMapping("udi/trace/source/search")
public BaseResponse createTrace(TraceRecordRequest traceRecordRequest) {
TraceRecordLogEntity traceRecordLogEntity = null;
TraceRecordLogEntity traceRecordLogEntity;
TraceProductDetailEntity traceProductDetailEntity = null;
BasicUdiRelResponse basicUdiRelResponse = null;
UdiEntity udiEntity = null;
UserCompanyEntity userCompanyEntity = null;
if (traceRecordRequest.getTraceType() == Constant.UDI_TRACE) {
if (StrUtil.isNotEmpty(traceRecordRequest.getUdiCode())) {
traceRecordRequest.setTraceType(Constant.UDI_TRACE);
}
if (traceRecordRequest.getTraceType() == Constant.UDI_TRACE) {
//1.校验UDI码格式
udiEntity = FilterUdiUtils.getUdi(traceRecordRequest.getUdiCode());
if (udiEntity == null) {
@ -90,28 +98,18 @@ public class UdiTraceController extends BaseController {
return ResultVOUtils.error(500, "未查询到产品信息");
}
//4.生成查询记录
String userId = getUserId() + "";
traceRecordLogEntity = traceRecordService.getById(traceRecordRequest.getRecordCode());
if (traceRecordLogEntity == null)
traceRecordLogEntity = udiTraceService.createRecordLog(userId, traceRecordRequest.getFromType(), traceRecordRequest.getTraceType());
traceRecordLogEntity = udiTraceService.createRecordLog(userId, traceRecordRequest.getFromType(), traceRecordRequest.getTraceType());
//5.创建查询详情记录,若存在相同查询记录则直接获取
if (traceRecordLogEntity.getTraceProductIdFk() != null) {
traceProductDetailEntity = traceProductDetailService.getById(traceRecordLogEntity.getTraceProductIdFk());
if (traceProductDetailEntity == null) {
traceProductDetailEntity = udiTraceService.createTracerProductByUdiCode(traceRecordRequest.getUdiCode(), 1, 1, basicUdiRelResponse, udiEntity);
traceRecordLogEntity.setTraceProductIdFk(traceProductDetailEntity.getId());
traceRecordService.updateById(traceRecordLogEntity);
}
} else {
traceProductDetailEntity = udiTraceService.createTracerProductByUdiCode(traceRecordRequest.getUdiCode(), 1, 1, basicUdiRelResponse, udiEntity);
}
traceProductDetailEntity = udiTraceService.createTracerProductByUdiCode(traceRecordRequest.getUdiCode(), 1, 1, basicUdiRelResponse, udiEntity);
traceRecordLogEntity.setTraceProductIdFk(traceProductDetailEntity.getId());
traceRecordService.updateById(traceRecordLogEntity);
udiTraceService.createSourceTraceTask(traceProductDetailEntity, userCompanyEntity.getId());
} else {
//1:校验参数是否正确
if (StrUtil.isEmpty(traceRecordRequest.getYlqxzcrbarmc())) {
return ResultVOUtils.error(500, "医疗器械注册人不能为空!");
@ -123,7 +121,6 @@ public class UdiTraceController extends BaseController {
return ResultVOUtils.error(500, "规格型号不能为空!");
}
//2.查询源头企业
FilterUdiRelRequest filterUdiRelRequest = new FilterUdiRelRequest();
filterUdiRelRequest.setYlqxzcrbarmc(traceRecordRequest.getYlqxzcrbarmc());
@ -146,12 +143,13 @@ public class UdiTraceController extends BaseController {
//5.创建查询详情记录,若存在相同查询记录则直接获取
traceProductDetailEntity = udiTraceService.createTracerProductByBatchNo(traceRecordRequest, 1, 2, basicUdiRelResponse);
traceRecordLogEntity.setTraceProductIdFk(traceProductDetailEntity.getId());
traceRecordService.updateById(traceRecordLogEntity);
udiTraceService.createSourceTraceTask(traceProductDetailEntity, userCompanyEntity.getId());
}
return ResultVOUtils.success(traceRecordLogEntity);
List<TraceOrderEntity> traceOrderEntities = traceOrderService.findByProductIdFk(traceRecordLogEntity.getTraceProductIdFk());
return ResultVOUtils.success(traceOrderEntities);
}
/**
@ -164,14 +162,97 @@ public class UdiTraceController extends BaseController {
@GetMapping("udi/trace/scene/search")
public BaseResponse sceneTrace(TraceRecordRequest traceRecordRequest) {
TraceSearchReponse traceSearchReponse = new TraceSearchReponse();
TraceRecordLogEntity traceRecordLogEntity = traceRecordService.getById(traceRecordRequest.getRecordCode());
if (traceRecordLogEntity != null) {
List<TraceOrderEntity> traceOrderEntities = traceOrderService.findByProductIdFk(traceRecordLogEntity.getTraceProductIdFk());
traceSearchReponse.setTraceRecordLogEntity(traceRecordLogEntity);
traceSearchReponse.setTraceOrderEntities(traceOrderEntities);
return ResultVOUtils.success(traceSearchReponse);
}
TraceProductDetailEntity traceProductDetailEntity = null;
BasicUdiRelResponse basicUdiRelResponse = null;
UdiEntity udiEntity = null;
UserCompanyEntity userCompanyEntity = null;
if (traceRecordRequest.getTraceType() == Constant.UDI_TRACE) {
} else if (traceRecordRequest.getTraceType() == Constant.UDI_BATCHNO) {
//1.校验UDI码格式
udiEntity = FilterUdiUtils.getUdi(traceRecordRequest.getUdiCode());
if (udiEntity == null) {
return ResultVOUtils.error(500, "UDI码格式错误");
}
//2.查询报备企业
userCompanyEntity = userCompanyService.getById(traceRecordRequest.getCompanyId());
if (userCompanyEntity == null) {
return ResultVOUtils.error(500, "未查询到该报备企业信息!");
}
//3.查询产品信息
basicUdiRelResponse = basicUdiRelService.findByProductNameCode(udiEntity.getUdi());
if (basicUdiRelResponse == null) {
return ResultVOUtils.error(500, "未查询到产品信息");
}
//4.生成查询记录
String userId = getUserId() + "";
if (traceRecordLogEntity == null)
traceRecordLogEntity = udiTraceService.createRecordLog(userId, traceRecordRequest.getFromType(), traceRecordRequest.getTraceType());
//5.创建查询详情记录,若存在相同查询记录则直接获取
if (traceRecordLogEntity.getTraceProductIdFk() != null) {
traceProductDetailEntity = traceProductDetailService.getById(traceRecordLogEntity.getTraceProductIdFk());
if (traceProductDetailEntity == null) {
traceProductDetailEntity = udiTraceService.createTracerProductByUdiCode(traceRecordRequest.getUdiCode(), 2, 1, basicUdiRelResponse, udiEntity);
traceRecordLogEntity.setTraceProductIdFk(traceProductDetailEntity.getId());
traceRecordService.updateById(traceRecordLogEntity);
}
} else {
traceProductDetailEntity = udiTraceService.createTracerProductByUdiCode(traceRecordRequest.getUdiCode(), 2, 1, basicUdiRelResponse, udiEntity);
}
udiTraceService.createCheckTraceTask(traceProductDetailEntity, userCompanyEntity.getId());
} else {
return ResultVOUtils.error(500, "请选择查询方式!");
//1:校验参数是否正确
if (StrUtil.isEmpty(traceRecordRequest.getYlqxzcrbarmc())) {
return ResultVOUtils.error(500, "医疗器械注册人不能为空!");
}
if (StrUtil.isEmpty(traceRecordRequest.getCpmctymc())) {
return ResultVOUtils.error(500, "产品通用名称不能为空!");
}
if (StrUtil.isEmpty(traceRecordRequest.getGgxh())) {
return ResultVOUtils.error(500, "规格型号不能为空!");
}
//2.查询源头企业
FilterUdiRelRequest filterUdiRelRequest = new FilterUdiRelRequest();
filterUdiRelRequest.setYlqxzcrbarmc(traceRecordRequest.getYlqxzcrbarmc());
filterUdiRelRequest.setCpmctymc(traceRecordRequest.getCpmctymc());
filterUdiRelRequest.setGgxh(traceRecordRequest.getGgxh());
userCompanyEntity = userCompanyService.getById(traceRecordRequest.getCompanyId());
if (userCompanyEntity == null) {
return ResultVOUtils.error(500, "未查询到该报备企业信息!");
}
//3.查询产品信息
basicUdiRelResponse = basicUdiRelService.findByProductName(filterUdiRelRequest);
if (basicUdiRelResponse == null) {
return ResultVOUtils.error(500, "未查询到产品信息");
}
//4.生成查询记录
String userId = getUserId() + "";
traceRecordLogEntity = udiTraceService.createRecordLog(userId, traceRecordRequest.getFromType(), traceRecordRequest.getTraceType());
//5.创建查询详情记录,若存在相同查询记录则直接获取
traceProductDetailEntity = udiTraceService.createTracerProductByBatchNo(traceRecordRequest, 2, 2, basicUdiRelResponse);
udiTraceService.createCheckTraceTask(traceProductDetailEntity, userCompanyEntity.getId());
}
return ResultVOUtils.error(500, "查询失败");
traceSearchReponse.setTraceRecordLogEntity(traceRecordLogEntity);
return ResultVOUtils.success(traceSearchReponse);
}

@ -2,8 +2,15 @@ package com.glxp.api.dao.trace;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.glxp.api.entity.trace.TraceTaskNoticeEntity;
import com.glxp.api.req.trace.TraceTaskDetailRequest;
import com.glxp.api.res.trace.TraceTaskDlResponse;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface TraceTaskNoticeMapper extends BaseMapper<TraceTaskNoticeEntity> {
List<TraceTaskDlResponse> queryTraceTaskList(TraceTaskDetailRequest traceTaskDetailRequest);
}

@ -2,10 +2,11 @@ package com.glxp.api.entity.trace;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
@Data
public class MqTraceMessage {
public class MqTraceMessage implements Serializable {
/**
*

@ -9,6 +9,7 @@ import java.io.Serializable;
import java.util.Date;
import java.util.List;
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
import lombok.Data;
/**
@ -109,7 +110,7 @@ public class TraceTaskNoticeEntity implements Serializable {
@TableField(value = "updateTime")
private Date updateTime;
@TableField(value = "diList")
@TableField(value = "diList",typeHandler = FastjsonTypeHandler.class)
private List<String> diList;

@ -76,5 +76,7 @@ public class TraceRecordRequest extends ListPageRequest {
*/
private String batchNo;
private Long companyId;
}

@ -0,0 +1,80 @@
package com.glxp.api.req.trace;
import com.glxp.api.util.page.ListPageRequest;
import lombok.Data;
import java.util.Date;
import java.util.List;
@Data
public class TraceTaskDetailRequest extends ListPageRequest {
private Long id;
/**
* UDI
*/
private String udiCode;
/**
* ID
*/
private Long recordCode;
/**
* //
*
*/
private Integer status;
/**
* 1nte3
*/
private Integer taskType;
/**
* DIDI
*/
private List<String> diList;
/**
* ID
*/
private Long companyIdFk;
/**
*
*/
private String ylqxzcrbarmc;
/**
*
*/
private String creditNum;
/**
*
*/
private String cpmctymc;
/**
*
*/
private String ggxh;
/**
*
*/
private String batchNo;
/**
*
*/
private String expireDate;
/**
*
*/
private String serialNo;
/**
*
*/
private Date createTime;
}

@ -0,0 +1,16 @@
package com.glxp.api.res.trace;
import com.glxp.api.entity.trace.TraceOrderEntity;
import com.glxp.api.entity.trace.TraceRecordLogEntity;
import lombok.Data;
import java.util.List;
@Data
public class TraceSearchReponse {
TraceRecordLogEntity traceRecordLogEntity;
List<TraceOrderEntity> traceOrderEntities;
}

@ -10,7 +10,7 @@ import java.util.List;
*/
@Data
public class TraceTaskDlResponse {
private Long id;
/**
* UDI
*/
@ -22,11 +22,17 @@ public class TraceTaskDlResponse {
private Long recordCode;
/**
* 1nte3
* 123
*/
private Integer taskType;
/**
* //
*
*/
private Integer status;
/**
* DIDI
* DI
*/
private List<String> diList;
@ -59,7 +65,10 @@ public class TraceTaskDlResponse {
*
*/
private String batchNo;
/**
*
*/
private String produceDate;
/**
*
*/
@ -71,8 +80,13 @@ public class TraceTaskDlResponse {
private String serialNo;
/**
*
*
*/
private Date createTime;
/**
*
*/
private Date updateTime;
}

@ -9,8 +9,10 @@ import com.glxp.api.req.basic.ProductInfoFilterRequest;
import java.util.List;
public interface UserCompanyService extends IService<UserCompanyEntity>{
public interface UserCompanyService extends IService<UserCompanyEntity> {
int insert(UserCompanyEntity userCompany);
boolean update(UserCompanyEntity userCompany);
List<UserCompanyEntity> filterCompanyName(FilterUserComapanyRequest filterUserComapanyRequest);

@ -1,22 +1,48 @@
package com.glxp.api.service.trace;
import com.glxp.api.entity.sup.UserCompanyEntity;
import com.glxp.api.entity.trace.TraceOrderEntity;
import com.baomidou.mybatisplus.extension.service.IService;
import com.glxp.api.req.auth.FilterUserComapanyRequest;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
import com.glxp.api.entity.trace.TraceRecordLogEntity;
import com.glxp.api.req.trace.TraceOrderDetailRequest;
import com.glxp.api.req.trace.TraceOrderRequest;
import com.glxp.api.req.trace.TraceProductRecordRequest;
import com.glxp.api.res.trace.TraceOrderResponse;
import com.glxp.api.res.trace.TraceProductRecordResponse;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.glxp.api.dao.trace.TraceOrderMapper;
import com.glxp.api.entity.trace.TraceOrderEntity;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;
public interface TraceOrderService extends IService<TraceOrderEntity>{
@Service
public class TraceOrderService extends ServiceImpl<TraceOrderMapper, TraceOrderEntity> {
@Resource
TraceOrderMapper traceOrderMapper;
@Resource
TraceRecordService traceRecordService;
public List<TraceOrderResponse> queryTraceOrderList(TraceOrderDetailRequest traceOrderDetailRequest) {
if (traceOrderDetailRequest == null) {
return Collections.emptyList();
}
if (traceOrderDetailRequest.getPage() != null) {
int offset = (traceOrderDetailRequest.getPage() - 1) * traceOrderDetailRequest.getLimit();
PageHelper.offsetPage(offset, traceOrderDetailRequest.getLimit());
}
return traceOrderMapper.queryTraceOrderList(traceOrderDetailRequest);
}
List<TraceOrderResponse> queryTraceOrderList(TraceOrderDetailRequest traceOrderDetailRequest);
public List<TraceOrderEntity> findByProductIdFk(Long traceProductIdFk) {
return traceOrderMapper.selectList(new QueryWrapper<TraceOrderEntity>().eq("traceProductIdFk", traceProductIdFk));
}
List<TraceProductRecordResponse> filterBatchNo(TraceProductRecordRequest traceProductRecordRequest);
public List<TraceOrderEntity> findByRecordId(Long recordId) {
TraceRecordLogEntity traceRecordLogEntity = traceRecordService.getById(recordId);
if (traceRecordLogEntity == null)
return null;
return traceOrderMapper.selectList(new QueryWrapper<TraceOrderEntity>().eq("traceProductIdFk", traceRecordLogEntity.getTraceProductIdFk()));
}
}

@ -16,9 +16,11 @@ public class TraceTaskNoticeService extends ServiceImpl<TraceTaskNoticeMapper, T
@Resource
TraceTaskNoticeMapper traceTaskNoticeMapper;
public TraceTaskNoticeEntity findTask(Integer taskType, Long produdctRecordIdFk) {
public TraceTaskNoticeEntity findTask(Integer taskType, Long produdctRecordIdFk, Long companyIdFk) {
List<TraceTaskNoticeEntity> taskNoticeEntities = traceTaskNoticeMapper.
selectList(new QueryWrapper<TraceTaskNoticeEntity>().eq("taskType", taskType).eq("produdctRecordIdFk", produdctRecordIdFk).last("limit 1"));
selectList(new QueryWrapper<TraceTaskNoticeEntity>().eq("taskType", taskType).eq("produdctRecordIdFk", produdctRecordIdFk)
.eq("companyIdFk", companyIdFk)
.last("limit 1"));
if (CollUtil.isNotEmpty(taskNoticeEntities)) {
return taskNoticeEntities.get(0);
} else

@ -0,0 +1,20 @@
package com.glxp.api.service.trace;
import com.baomidou.mybatisplus.extension.service.IService;
import com.glxp.api.entity.trace.TraceManuOrderEntity;
import com.glxp.api.entity.trace.TraceTaskNoticeEntity;
import com.glxp.api.req.trace.TraceManuOrderRequest;
import com.glxp.api.req.trace.TraceTaskDetailRequest;
import com.glxp.api.res.trace.TraceManuOrderResponse;
import com.glxp.api.res.trace.TraceTaskDlResponse;
import java.util.List;
public interface TraceTaskService extends IService<TraceTaskNoticeEntity> {
List<TraceTaskDlResponse> queryTraceTaskList(TraceTaskDetailRequest traceTaskDetailRequest);
}

@ -1,22 +1,26 @@
package com.glxp.api.service.trace;
import cn.hutool.core.collection.CollUtil;
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.trace.MqTraceMessage;
import com.glxp.api.entity.trace.TraceProductDetailEntity;
import com.glxp.api.entity.trace.TraceRecordLogEntity;
import com.glxp.api.entity.trace.TraceTaskNoticeEntity;
import com.glxp.api.entity.sup.UserCompanyEntity;
import com.glxp.api.entity.trace.*;
import com.glxp.api.req.basic.FilterUdiRelRequest;
import com.glxp.api.req.trace.TraceRecordRequest;
import com.glxp.api.res.basic.BasicUdiRelResponse;
import com.glxp.api.service.basic.BasicUdiProductService;
import com.glxp.api.service.basic.BasicUdiRelService;
import com.glxp.api.service.sup.UserCompanyService;
import com.glxp.api.util.GennerOrderUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
@Service
public class UdiTraceService {
@ -38,6 +42,8 @@ public class UdiTraceService {
TraceTaskNoticeService traceTaskNoticeService;
@Resource
RabbitPushService rabbitPushService;
@Resource
TraceManuOrderService traceManuOrderService;
//创建查询日志
public TraceRecordLogEntity createRecordLog(String userId, Integer fromType, Integer traceType) {
@ -59,8 +65,12 @@ public class UdiTraceService {
TraceProductDetailEntity traceProductDetailEntity = null;
traceProductDetailEntity = traceProductDetailService.findUniqueByCode(1, udiCode);
if (traceProductDetailEntity == null) {
traceProductDetailEntity = new TraceProductDetailEntity();
traceProductDetailEntity.setId(IdUtil.getSnowflakeNextId());
traceProductDetailEntity.setTraceSource(traceSource);
if (traceSource == 1) {
traceProductDetailEntity.setManuStatus(1);
}
traceProductDetailEntity.setTraceType(traceType);
traceProductDetailEntity.setUdiCode(udiCode);
traceProductDetailEntity.setYlqxzcrbarmc(basicUdiRelResponse.getYlqxzcrbarmc());
@ -72,6 +82,7 @@ public class UdiTraceService {
traceProductDetailEntity.setProduceDate(udiEntity.getProduceDate());
traceProductDetailEntity.setExpireDate(udiEntity.getExpireDate());
traceProductDetailEntity.setSerialNo(udiEntity.getSerialNo());
traceProductDetailEntity.setStatus(1);
traceProductDetailService.save(traceProductDetailEntity);
return traceProductDetailEntity;
@ -89,6 +100,9 @@ public class UdiTraceService {
if (traceProductDetailEntity == null) {
traceProductDetailEntity.setId(IdUtil.getSnowflakeNextId());
traceProductDetailEntity.setTraceSource(traceSource);
if (traceSource == 1) {
traceProductDetailEntity.setManuStatus(1);
}
traceProductDetailEntity.setTraceType(traceType);
traceProductDetailEntity.setYlqxzcrbarmc(basicUdiRelResponse.getYlqxzcrbarmc());
traceProductDetailEntity.setCreditNum(basicUdiRelResponse.getTyshxydm());
@ -103,42 +117,89 @@ public class UdiTraceService {
}
@Resource
TraceManuOrderService traceManuOrderService;
//创建任务列表
public void createTraceTask(TraceProductDetailEntity traceProductDetailEntity, Long companyId) {
UserCompanyService userCompanyService;
//创建源头查询任务
public void createSourceTraceTask(TraceProductDetailEntity traceProductDetailEntity, Long companyId) {
//1.查询生产订单信息是否已上传
//生产订单关联关系
if (traceProductDetailEntity.getManuStatus() == 1) { //生产订单未处理
TraceTaskNoticeEntity manuTaskNotity = traceTaskNoticeService.findTask(1, traceProductDetailEntity.getId(), companyId);
if (manuTaskNotity == null) {
createTraceNotice(1, traceProductDetailEntity, companyId);
pushMq(traceProductDetailEntity, companyId);
} else if (traceProductDetailEntity.getManuStatus() == 2) { //生产订单处理未完成
TraceTaskNoticeEntity taskNoticeEntity = traceTaskNoticeService.findTask(1, traceProductDetailEntity.getId());
if (taskNoticeEntity == null) {
createTraceNotice(1, traceProductDetailEntity, companyId);
pushMq(traceProductDetailEntity, companyId);
} else if (taskNoticeEntity.getStatus() == 4) {
//任务超时未处理,重新推送消息
pushMq(traceProductDetailEntity, companyId);
} else if (manuTaskNotity.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) { //出入库订单未处理
createTraceNotice(2, traceProductDetailEntity, companyId);
pushMq(traceProductDetailEntity, companyId);
} 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) {
TraceTaskNoticeEntity traceTaskNoticeEntity = new TraceTaskNoticeEntity();
traceTaskNoticeEntity.setId(IdUtil.getSnowflakeNextId());
traceTaskNoticeEntity.setProdudctRecordIdFk(traceProductDetailEntity.getId());
@ -155,6 +216,10 @@ public class UdiTraceService {
traceTaskNoticeEntity.setSerialNo(traceProductDetailEntity.getSerialNo());
traceTaskNoticeEntity.setCreateTime(new Date());
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);
traceTaskNoticeEntity.setDiList(diList);
traceTaskNoticeService.save(traceTaskNoticeEntity);

@ -0,0 +1,35 @@
package com.glxp.api.service.trace.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.glxp.api.dao.trace.TraceOrderMapper;
import com.glxp.api.dao.trace.TraceTaskNoticeMapper;
import com.glxp.api.entity.trace.TraceTaskNoticeEntity;
import com.glxp.api.req.trace.TraceTaskDetailRequest;
import com.glxp.api.res.trace.TraceTaskDlResponse;
import com.glxp.api.service.trace.TraceTaskService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;
@Service
public class TraceTaskServiceImpl extends ServiceImpl<TraceTaskNoticeMapper, TraceTaskNoticeEntity> implements TraceTaskService {
@Resource
TraceTaskNoticeMapper traceTaskNoticeMapper;
@Override
public List<TraceTaskDlResponse> queryTraceTaskList(TraceTaskDetailRequest traceTaskDetailRequest) {
if (traceTaskDetailRequest == null) {
return Collections.emptyList();
}
if (traceTaskDetailRequest.getPage() != null) {
int offset = (traceTaskDetailRequest.getPage() - 1) * traceTaskDetailRequest.getLimit();
PageHelper.offsetPage(offset, traceTaskDetailRequest.getLimit());
}
return traceTaskNoticeMapper.queryTraceTaskList(traceTaskDetailRequest);
}
}

@ -0,0 +1,21 @@
package com.glxp.api.task.mq;
import com.glxp.api.entity.trace.MqTraceMessage;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;
@Component
public class TraceSearchReceiver {
@RabbitHandler
@RabbitListener(queues = "topic.trace")
public void traceReceiver(MqTraceMessage mqTraceMessage) {
System.out.println("topic.trace消费者收到消息 : " + mqTraceMessage.toString());
}
}

@ -14,7 +14,7 @@ spring:
redis:
database: 8
database: 14
host: 127.0.0.1
port: 6379
# password: 123456
@ -34,10 +34,10 @@ spring:
max-request-size: 500MB
rabbitmq:
host: 192.168.0.66
host: 127.0.0.1
port: 5672
username: glxp
password: glxp1234
username: cpt
password: 123456
virtual-host: /
publisher-confirms: false
connection-timeout: 15000

@ -29,6 +29,14 @@ spring:
multipart:
max-file-size: 500MB
max-request-size: 500MB
rabbitmq:
host: 192.168.0.66
port: 5672
username: glxp
password: glxp1234
virtual-host: /
publisher-confirms: false
connection-timeout: 15000
ok:
http:
@ -43,7 +51,7 @@ logging:
level:
com.glxp.api.dao: debug
file_path: /udi/udiwms/udiwmsfile/
file_path: /udi/udiwms/udiwmsfile/
back_file_path: /share/udisps/back/
UDI_KEY: 6b137c66-6286-46c6-8efa-c2f5dd9237df
UDI_SERVER_URL: https://www.udims.com/UDI_DL_Server_test

@ -1,6 +1,6 @@
spring:
profiles:
active: pro
active: dev
jmx:
enabled: false
servlet:

@ -2,4 +2,34 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.glxp.api.dao.trace.TraceTaskNoticeMapper">
<select id="queryTraceTaskList" parameterType="com.glxp.api.req.trace.TraceTaskDetailRequest"
resultType="com.glxp.api.res.trace.TraceTaskDlResponse">
SELECT *
FROM trace_task_notice
<where>
<if test="taskType != '' and taskType != null">
and taskType = #{taskType}
</if>
<if test="status != '' and status != null">
and status = #{status}
</if>
<if test="cpmctymc != '' and cpmctymc != null">
and cpmctymc LIKE CONCAT('%', #{cpmctymc}, '%')
</if>
<if test="ggxh != '' and ggxh != null">
and ggxh = #{ggxh}
</if>
<if test="ylqxzcrbarmc != '' and ylqxzcrbarmc != null">
and ylqxzcrbarmc = #{ylqxzcrbarmc}
</if>
<if test="batchNo != '' and batchNo != null">
and batchNo = #{batchNo}
</if>
</where>
</select>
</mapper>

Loading…
Cancel
Save