新增当前企业判断

cert
anthonywj 2 years ago
parent b94067697e
commit 2f041270fd

@ -10,8 +10,10 @@ 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.sup.UserCompanyEntity;
import com.glxp.api.entity.trace.TraceManuOrderEntity;
import com.glxp.api.entity.trace.TraceOrderEntity;
import com.glxp.api.entity.trace.TraceProductDetailEntity;
import com.glxp.api.entity.trace.TraceRecordLogEntity;
import com.glxp.api.req.trace.TraceManuOrderRequest;
import com.glxp.api.req.trace.TraceOrderDetailRequest;
@ -21,8 +23,10 @@ import com.glxp.api.res.trace.TraceManuOrderResponse;
import com.glxp.api.res.trace.TraceOrderResponse;
import com.glxp.api.res.trace.TraceRecordResponse;
import com.glxp.api.res.trace.TraceSearchReponse;
import com.glxp.api.service.sup.UserCompanyService;
import com.glxp.api.service.trace.TraceManuOrderService;
import com.glxp.api.service.trace.TraceOrderService;
import com.glxp.api.service.trace.TraceProductDetailService;
import com.glxp.api.service.trace.TraceRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -50,6 +54,8 @@ public class TraceRecordController extends BaseController {
TraceOrderService traceOrderService;
@Resource
TraceManuOrderService traceManuOrderService;
@Resource
TraceProductDetailService traceProductDetailService;
// 查询记录搜索
@ -67,6 +73,9 @@ public class TraceRecordController extends BaseController {
}
@Resource
UserCompanyService userCompanyService;
@ApiOperation(value = "追溯查询记录结果", response = TraceRecordResponse.class)
@AuthRuleAnnotation("udi/trace/record/result")
@GetMapping("udi/trace/record/result")
@ -74,16 +83,31 @@ public class TraceRecordController extends BaseController {
if (StrUtil.isNotEmpty(traceRecordRequest.getRecordCode())) {
TraceRecordLogEntity traceRecordLogEntity = traceRecordService.getOne(new QueryWrapper<TraceRecordLogEntity>().eq("recordCode", traceRecordRequest.getRecordCode()));
if (traceRecordLogEntity == null) {
return ResultVOUtils.error(500, "查询记录不存在!");
}
TraceProductDetailEntity traceProductDetailEntity = traceProductDetailService.getById(traceRecordLogEntity.getTraceProductIdFk());
UserCompanyEntity userCompanyEntity = null;
if (StrUtil.isNotEmpty(traceProductDetailEntity.getCompanyIdFk())) {
userCompanyEntity = userCompanyService.getById(traceProductDetailEntity.getCompanyIdFk());
}
TraceOrderDetailRequest traceOrderDetailRequest = new TraceOrderDetailRequest();
traceOrderDetailRequest.setTraceProductIdFk(traceRecordLogEntity.getTraceProductIdFk());
List<TraceOrderResponse> traceOrderEntities = traceOrderService.filterJoin(traceOrderDetailRequest);
if (CollUtil.isNotEmpty(traceOrderEntities)) {
for (TraceOrderResponse traceOrderResponse : traceOrderEntities) {
if (userCompanyEntity != null && userCompanyEntity.getCreditNum().equals(traceOrderResponse.getCompanyCertNum())) {
traceOrderResponse.setIsCurrent(true);
}
}
}
TraceManuOrderRequest traceManuOrderRequest = new TraceManuOrderRequest();
traceManuOrderRequest.setTraceProductIdFk(traceRecordLogEntity.getTraceProductIdFk());
List<TraceManuOrderResponse> traceManuOrderEntities = traceManuOrderService.filterTraces(traceManuOrderRequest);
TraceSearchReponse traceSearchReponse = new TraceSearchReponse();
traceSearchReponse.setTraceOrderEntities(traceOrderEntities);
traceSearchReponse.setTraceManuOrderEntities(traceManuOrderEntities);

@ -69,7 +69,8 @@ public class UdiTraceController extends BaseController {
@Resource
TraceManuCodeRelService traceManuCodeRelService;
@Resource
TraceRecordService traceRecordService; @Resource
TraceRecordService traceRecordService;
@Resource
UdiTraceService udiTraceService;
@Resource
@ -141,7 +142,7 @@ public class UdiTraceController extends BaseController {
//5.创建查询详情记录,若存在相同查询记录则直接获取
traceProductDetailEntity = udiTraceService.createTracerProductByUdiCode(traceRecordRequest.getUdiCode(), 1, 1, basicUdiRelResponse, udiEntity);
traceProductDetailEntity = udiTraceService.createTracerProductByUdiCode(traceRecordRequest.getUdiCode(), 1, 1, basicUdiRelResponse, udiEntity, null);
traceRecordLogEntity.setTraceProductIdFk(traceProductDetailEntity.getId());
traceRecordService.updateById(traceRecordLogEntity);
for (UserCompanyResponse userCompanyResponse : userCompanyResponses) {
@ -187,7 +188,7 @@ public class UdiTraceController extends BaseController {
traceRecordLogEntity = udiTraceService.createRecordLog(userId, traceRecordRequest.getFromType(), traceRecordRequest.getTraceType());
//5.创建查询详情记录,若存在相同查询记录则直接获取
traceProductDetailEntity = udiTraceService.createTracerProductByBatchNo(traceRecordRequest, 1, 2, basicUdiRelResponse);
traceProductDetailEntity = udiTraceService.createTracerProductByBatchNo(traceRecordRequest, 1, 2, basicUdiRelResponse, null);
traceRecordLogEntity.setTraceProductIdFk(traceProductDetailEntity.getId());
traceRecordService.updateById(traceRecordLogEntity);
for (UserCompanyResponse userCompanyResponse : userCompanyResponses) {
@ -248,7 +249,7 @@ public class UdiTraceController extends BaseController {
//5.创建查询详情记录,若存在相同查询记录则直接获取
traceProductDetailEntity = udiTraceService.createTracerProductByUdiCode(traceRecordRequest.getUdiCode(), 2, 1, basicUdiRelResponse, udiEntity);
traceProductDetailEntity = udiTraceService.createTracerProductByUdiCode(traceRecordRequest.getUdiCode(), 2, 1, basicUdiRelResponse, udiEntity, traceRecordRequest.getCompanyId() + "");
traceRecordLogEntity.setTraceProductIdFk(traceProductDetailEntity.getId());
traceRecordService.updateById(traceRecordLogEntity);
udiTraceService.createCheckTraceTask(traceProductDetailEntity, userCompanyEntity.getId());
@ -286,7 +287,7 @@ public class UdiTraceController extends BaseController {
traceRecordLogEntity = udiTraceService.createRecordLog(userId, traceRecordRequest.getFromType(), traceRecordRequest.getTraceType());
//5.创建查询详情记录,若存在相同查询记录则直接获取
traceProductDetailEntity = udiTraceService.createTracerProductByBatchNo(traceRecordRequest, 2, 2, basicUdiRelResponse);
traceProductDetailEntity = udiTraceService.createTracerProductByBatchNo(traceRecordRequest, 2, 2, basicUdiRelResponse, traceRecordRequest.getCompanyId() + "");
udiTraceService.createCheckTraceTask(traceProductDetailEntity, userCompanyEntity.getId());
}
// List<TraceOrderEntity> traceOrderEntities = traceOrderService.findByProductIdFk(traceRecordLogEntity.getTraceProductIdFk());

@ -108,5 +108,11 @@ public class TraceProductDetailEntity implements Serializable {
*/
@TableField(value = "zczbhhzbapzbh")
private String zczbhhzbapzbh;
/**
* ID
*/
@TableField(value = "companyIdFk")
private String companyIdFk;
private static final long serialVersionUID = 1L;
}

@ -179,6 +179,9 @@ public class TraceOrderResponse {
private Integer invCount;
private Boolean isCurrent;
//获取往来信息
@ApiModelProperty(value = "往来单位信息")
private String fromToCorp;

@ -64,7 +64,7 @@ public class UdiTraceService {
}
//创建追溯产品详情
public TraceProductDetailEntity createTracerProductByUdiCode(String udiCode, Integer traceSource, Integer traceType, BasicUdiRelResponse basicUdiRelResponse, UdiEntity udiEntity) {
public TraceProductDetailEntity createTracerProductByUdiCode(String udiCode, Integer traceSource, Integer traceType, BasicUdiRelResponse basicUdiRelResponse, UdiEntity udiEntity, String companyIdFk) {
TraceProductDetailEntity traceProductDetailEntity = null;
traceProductDetailEntity = traceProductDetailService.findUniqueByCode(1, udiCode);
if (traceProductDetailEntity == null) {
@ -86,6 +86,7 @@ public class UdiTraceService {
traceProductDetailEntity.setExpireDate(udiEntity.getExpireDate());
traceProductDetailEntity.setSerialNo(udiEntity.getSerialNo());
traceProductDetailEntity.setZczbhhzbapzbh(basicUdiRelResponse.getZczbhhzbapzbh());
traceProductDetailEntity.setCompanyIdFk(companyIdFk);
traceProductDetailEntity.setStatus(1);
traceProductDetailService.save(traceProductDetailEntity);
return traceProductDetailEntity;
@ -95,7 +96,7 @@ public class UdiTraceService {
//创建追溯产品详情
public TraceProductDetailEntity createTracerProductByBatchNo(TraceRecordRequest traceRecordRequest, Integer traceSource, Integer traceType, BasicUdiRelResponse basicUdiRelResponse) {
public TraceProductDetailEntity createTracerProductByBatchNo(TraceRecordRequest traceRecordRequest, Integer traceSource, Integer traceType, BasicUdiRelResponse basicUdiRelResponse, String companyIdFk) {
TraceProductDetailEntity traceProductDetailEntity = null;
traceProductDetailEntity = traceProductDetailService.findUniqueByData(1, traceRecordRequest.getYlqxzcrbarmc(),
@ -114,6 +115,7 @@ public class UdiTraceService {
traceProductDetailEntity.setGgxh(basicUdiRelResponse.getGgxh());
traceProductDetailEntity.setNameCode(basicUdiRelResponse.getNameCode());
traceProductDetailEntity.setBatchNo(traceRecordRequest.getBatchNo());
traceProductDetailEntity.setCompanyIdFk(companyIdFk);
traceProductDetailEntity.setStatus(1);
traceProductDetailService.save(traceProductDetailEntity);
}

@ -51,6 +51,7 @@
trace_product_record.zczbhhzbapzbh,
trace_product_record.traceSource,
trace_order.*,
uc.creditNum companyCertNum,
uc.companyName
FROM trace_order
left join trace_product_record

@ -14,6 +14,9 @@ CALL Pro_Temp_ColumnWork('trace_order', 'recordCode', 'varchar(255)', 1);
CALL Pro_Temp_ColumnWork('trace_order', 'count', 'int', 1);
CALL Pro_Temp_ColumnWork('trace_order', 'invCount', 'int', 1);
CALL Pro_Temp_ColumnWork('trace_product_record', 'companyIdFk', 'varchar(255)', 1);

Loading…
Cancel
Save