You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
udi-cpt-java/src/main/java/com/glxp/api/controller/trace/UdiTraceController.java

90 lines
2.7 KiB
Java

package com.glxp.api.controller.trace;
2 years ago
import com.glxp.api.annotation.AuthRuleAnnotation;
import com.glxp.api.common.res.BaseResponse;
import com.glxp.api.common.util.ResultVOUtils;
import com.glxp.api.constant.Constant;
import com.glxp.api.controller.BaseController;
import com.glxp.api.entity.basic.UdiEntity;
import com.glxp.api.entity.sup.UserCompanyEntity;
2 years ago
import com.glxp.api.req.trace.TraceRecordRequest;
import com.glxp.api.service.basic.BasicUdiRelService;
2 years ago
import com.glxp.api.service.trace.TraceRecordService;
import com.glxp.api.util.udi.FilterUdiUtils;
import lombok.extern.slf4j.Slf4j;
2 years ago
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;
2 years ago
import javax.annotation.Resource;
@ApiIgnore
@RestController
@Slf4j
public class UdiTraceController extends BaseController {
2 years ago
2 years ago
@Resource
TraceRecordService traceRecordService;
@Resource
BasicUdiRelService basicUdiRelService;
2 years ago
/**
*
*
* @param traceRecordRequest
* @return
*/
@AuthRuleAnnotation("udi/trace/source/search")
@GetMapping("udi/trace/source/search")
public BaseResponse createTrace(TraceRecordRequest traceRecordRequest) {
if (traceRecordRequest.getTraceType() == Constant.UDI_TRACE) {
//1.校验UDI码格式
UdiEntity udiEntity = FilterUdiUtils.getUdi(traceRecordRequest.getUdiCode());
if (udiEntity == null) {
return ResultVOUtils.error(500, "UDI码格式错误");
}
//2.查询源头企业
UserCompanyEntity userCompanyEntity = basicUdiRelService.findByNameCode(udiEntity.getUdi());
if (userCompanyEntity == null) {
return ResultVOUtils.error(500, "生产企业未关联该产品信息!");
}
2 years ago
} else if (traceRecordRequest.getTraceType() == Constant.UDI_BATCHNO) {
} else {
return ResultVOUtils.error(500, "请选择查询方式!");
}
return ResultVOUtils.error(500, "查询失败");
}
/**
*
*
* @param traceRecordRequest
* @return
*/
@AuthRuleAnnotation("udi/trace/scene/search")
@GetMapping("udi/trace/scene/search")
public BaseResponse sceneTrace(TraceRecordRequest traceRecordRequest) {
if (traceRecordRequest.getTraceType() == Constant.UDI_TRACE) {
} else if (traceRecordRequest.getTraceType() == Constant.UDI_BATCHNO) {
} else {
return ResultVOUtils.error(500, "请选择查询方式!");
}
return ResultVOUtils.error(500, "查询失败");
}
2 years ago
}