|
@@ -1,12 +1,21 @@
|
|
|
package com.aoyang.tms.controller;
|
|
package com.aoyang.tms.controller;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
|
|
+import com.aoyang.tms.common.ErrCodeEnum;
|
|
|
|
|
+import com.aoyang.tms.controller.param.TruckEscortAddParam;
|
|
|
|
|
+import com.aoyang.tms.controller.param.TruckEscortListParam;
|
|
|
|
|
+import com.aoyang.tms.entity.User;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.*;
|
|
import io.swagger.annotations.*;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
+
|
|
|
|
|
+import java.io.UnsupportedEncodingException;
|
|
|
|
|
+import java.net.URLDecoder;
|
|
|
|
|
+import java.time.LocalDateTime;
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
|
import com.aoyang.tms.service.TruckEscortService;
|
|
import com.aoyang.tms.service.TruckEscortService;
|
|
@@ -35,12 +44,36 @@ public class TruckEscortController {
|
|
|
@Resource
|
|
@Resource
|
|
|
private TruckEscortService truckEscortService;
|
|
private TruckEscortService truckEscortService;
|
|
|
|
|
|
|
|
- @ApiOperation(value = "获取truck_escort列表",notes="")
|
|
|
|
|
|
|
+ @ApiOperation(value = "获取车辆押运员分页列表",notes="")
|
|
|
@PostMapping("/list")
|
|
@PostMapping("/list")
|
|
|
- public Result list(@RequestBody PageParam<TruckEscort> pageParam) {
|
|
|
|
|
- Page<TruckEscort> page = new Page<>(pageParam.getPage(), pageParam.getSize());
|
|
|
|
|
- IPage<TruckEscort> records = truckEscortService.page(page, Wrappers.query(pageParam.getParam()));
|
|
|
|
|
- return new Result<>(records);
|
|
|
|
|
|
|
+ public Result list(@RequestBody PageParam<TruckEscortListParam> pageParam) {
|
|
|
|
|
+ log.info("获取运力部门管理分页列表,调用/tms/truck_dept/page_list,参数:{}", JSON.toJSONString(pageParam));
|
|
|
|
|
+ if (pageParam == null || pageParam.getParam() == null || pageParam.getParam().getOrgId() == null) {
|
|
|
|
|
+ return new Result<>(ErrCodeEnum.BAD_PARAM.getCode(), ErrCodeEnum.BAD_PARAM.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ return new Result<>(truckEscortService.findPage(pageParam));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @ApiOperation(value = "添加车辆押运员",notes="新增一条truck_escort")
|
|
|
|
|
+ @PostMapping("/add")
|
|
|
|
|
+ public Result add(@RequestHeader(value = "userId") Long userId,
|
|
|
|
|
+ @RequestHeader(value = "userName") String userName,
|
|
|
|
|
+ @RequestBody TruckEscortAddParam param) {
|
|
|
|
|
+ log.info("新增运力部门,调用/tms/truck_dept/add,参数:{}", JSON.toJSONString(param));
|
|
|
|
|
+ if (param == null || param.getOrgId() == null || param.getEscortName() == null || param.getMobile() == 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.setCreater(userId);
|
|
|
|
|
+ param.setCreaterName(utf8Name);
|
|
|
|
|
+ param.setCreateDate(LocalDateTime.now());
|
|
|
|
|
+
|
|
|
|
|
+ return new Result<>(truckEscortService.add(param));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@ApiOperation(value = "修改truck_escort",notes="根据id修改truck_escort")
|
|
@ApiOperation(value = "修改truck_escort",notes="根据id修改truck_escort")
|
|
@@ -50,10 +83,5 @@ public class TruckEscortController {
|
|
|
return new Result<>(flag);
|
|
return new Result<>(flag);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- @ApiOperation(value = "添加truck_escort",notes="新增一条truck_escort")
|
|
|
|
|
- @PostMapping("/add")
|
|
|
|
|
- public Result add(@RequestBody TruckEscort truckEscort) {
|
|
|
|
|
- Boolean flag = truckEscortService.save(truckEscort);
|
|
|
|
|
- return new Result<>(flag);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+
|
|
|
}
|
|
}
|