Commit 01f42db2 authored by unset's avatar unset

订单核销接口修改

parent ad067d0a
......@@ -38,6 +38,7 @@ public class OrderViolationController extends BaseController<OrderViolationBiz,
private UserFeign userFeign;
@Autowired
OrderDepositRefundRecordBiz orderDepositRefundRecordBiz;
@Override
public UserFeign getUserFeign() {
return userFeign;
......@@ -45,7 +46,7 @@ public class OrderViolationController extends BaseController<OrderViolationBiz,
private Long MAX_DRIVING_LICENSE_SIZE = 1024 * 1024 * 50L;
private final String FILE_TYPE="JPG";
private final String FILE_TYPE = "JPG";
/**
* 保存违章记录
......@@ -57,15 +58,15 @@ public class OrderViolationController extends BaseController<OrderViolationBiz,
@PostMapping("/saveOrderViolation")
public ObjectRestResponse saveOrderViolation(@RequestBody OrderViolation orderViolation, HttpServletRequest request) {
log.info("保存违章记录:orderViolation = {}", orderViolation.toString());
UserDTO userDTOD = getAdminUserInfo();
if (orderViolation.getId()==null) {
UserDTO userDTOD = getBusinessUserByAppUser();
if (orderViolation.getId() == null) {
orderViolation.setIsDel(0);
orderViolation.setCrtHost(request.getRemoteHost());
orderViolation.setCrtName(userDTOD.getName());
orderViolation.setCrtUserId(userDTOD.getId());
orderViolation.setCrtTime(new BigInteger(String.valueOf(System.currentTimeMillis())));
getBaseBiz().insertOrderViolation(orderViolation);
}else {
} else {
orderViolation.setUpdHost(request.getRemoteHost());
orderViolation.setUpdName(userDTOD.getName());
orderViolation.setUpdUserId(userDTOD.getId());
......@@ -91,24 +92,23 @@ public class OrderViolationController extends BaseController<OrderViolationBiz,
if (orderViolations.size() > 1) {
throw new BaseException("The database has multiple records");
}
OrderViolation orderViolation= new OrderViolation();
orderViolation=(orderViolations.size()==0)? null:orderViolations.get(0);
OrderViolation orderViolation = new OrderViolation();
orderViolation = (orderViolations.size() == 0) ? null : orderViolations.get(0);
return ObjectRestResponse.succ(orderViolation);
}
@PostMapping(value = "/upload/violation")
public ObjectRestResponse uploadViolation(@RequestParam("file") MultipartFile file)
throws Exception {
Assert.notNull(file);
//文件类型
String contentType = file.getContentType();
if (!FILE_TYPE.equalsIgnoreCase(contentType)||"png".equalsIgnoreCase(contentType)) {
return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE,"Picture format error");
if (!FILE_TYPE.equalsIgnoreCase(contentType) || "png".equalsIgnoreCase(contentType)) {
return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE, "Picture format error");
}
if (file.getSize() > MAX_DRIVING_LICENSE_SIZE) {
return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE,"Picture is too large");
return ObjectRestResponse.createFailedResult(ResultCode.FAILED_CODE, "Picture is too large");
}
return baseBiz.uploadViolation(file);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment