|
|
@@ -75,6 +75,47 @@ public class TruckEscortController {
|
|
|
return new Result<>(truckEscortService.list(param));
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation(value = "车辆绑定押运员", notes = "必传参数:truckId")
|
|
|
+ @PostMapping("/bind_truck")
|
|
|
+ public Result bind(@RequestHeader(value = "userId") Long userId,
|
|
|
+ @RequestHeader(value = "userName") String userName, @RequestHeader(value = "orgId") Long orgId,
|
|
|
+ @RequestBody TruckEscort param) {
|
|
|
+ log.info("修改车辆押运员,调用/tms/truck_escort/update,参数:{}", JSON.toJSONString(param));
|
|
|
+ if (param == null || param.getTruckId() == null) {
|
|
|
+ return new Result<>(ErrCodeEnum.BAD_PARAM.getCode(), ErrCodeEnum.BAD_PARAM.getMessage());
|
|
|
+ }
|
|
|
+ String utf8Name = userName;
|
|
|
+ try {
|
|
|
+ utf8Name = URLDecoder.decode(userName, "UTF-8");
|
|
|
+ } catch (UnsupportedEncodingException ignored) {
|
|
|
+ }
|
|
|
+
|
|
|
+ param.setOrgId(orgId);
|
|
|
+ Org org = commonService.findOrg(orgId);
|
|
|
+ if (org != null) {
|
|
|
+ param.setOrgName(org.getOrgName());
|
|
|
+ }
|
|
|
+ param.setCreater(userId);
|
|
|
+ param.setCreaterName(utf8Name);
|
|
|
+ param.setCreateDate(LocalDateTime.now());
|
|
|
+ param.setUpdater(userId);
|
|
|
+ param.setUpdaterName(utf8Name);
|
|
|
+ param.setUpdateDate(LocalDateTime.now());
|
|
|
+
|
|
|
+ if (param.getTruckId() != null) {
|
|
|
+ TruckEscort truckEscortParam = new TruckEscort();
|
|
|
+ truckEscortParam.setTruckId(param.getTruckId());
|
|
|
+ TruckEscort truckEscort = truckEscortService.findTruckEscort(truckEscortParam);
|
|
|
+ log.info("修改车辆押运员,调用/tms/truck_escort/update,truckEscortParam:{},结果truckEscort:{}", JSON.toJSONString(truckEscortParam), JSON.toJSONString(truckEscort));
|
|
|
+
|
|
|
+ if (truckEscort != null && !truckEscort.getEscortId().equals(param.getEscortId())) {
|
|
|
+ return new Result<>(ErrCodeEnum.ONLY_ONE_ESCORT.getCode(), ErrCodeEnum.ONLY_ONE_ESCORT.getMessage());
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return new Result<>(truckEscortService.edit(param));
|
|
|
+ }
|
|
|
+
|
|
|
@ApiOperation(value = "添加车辆押运员", notes = "必传参数:orgId,escortName,mobile")
|
|
|
@PostMapping("/add")
|
|
|
public Result add(@RequestHeader(value = "userId") Long userId,
|