|
|
|
@ -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);
|
|
|
|
|