|
@@ -6,6 +6,8 @@ import com.aoyang.tms.common.ErrCodeEnum;
|
|
|
import com.aoyang.tms.controller.param.TruckEscortAddParam;
|
|
import com.aoyang.tms.controller.param.TruckEscortAddParam;
|
|
|
import com.aoyang.tms.controller.param.TruckEscortListParam;
|
|
import com.aoyang.tms.controller.param.TruckEscortListParam;
|
|
|
import com.aoyang.tms.entity.User;
|
|
import com.aoyang.tms.entity.User;
|
|
|
|
|
+import com.aoyang.tms.entity.WorkSpot;
|
|
|
|
|
+import com.aoyang.tms.service.CommonService;
|
|
|
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;
|
|
@@ -18,8 +20,9 @@ import java.net.URLDecoder;
|
|
|
import java.time.LocalDateTime;
|
|
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.entity.TruckEscort;
|
|
|
|
|
|
|
+
|
|
|
|
|
+import com.aoyang.tms.service.TruckEscortService;
|
|
|
|
|
+import com.aoyang.tms.entity.TruckEscort;
|
|
|
import com.aoyang.common.result.Result;
|
|
import com.aoyang.common.result.Result;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
@@ -29,8 +32,8 @@ import com.aoyang.common.param.PageParam;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* <p>
|
|
* <p>
|
|
|
- * 车辆押运员表 控制器
|
|
|
|
|
- * </p>
|
|
|
|
|
|
|
+ * 车辆押运员表 控制器
|
|
|
|
|
+ * </p>
|
|
|
*
|
|
*
|
|
|
* @author guoyong
|
|
* @author guoyong
|
|
|
* @since 2022-04-20
|
|
* @since 2022-04-20
|
|
@@ -43,23 +46,36 @@ public class TruckEscortController {
|
|
|
|
|
|
|
|
@Resource
|
|
@Resource
|
|
|
private TruckEscortService truckEscortService;
|
|
private TruckEscortService truckEscortService;
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ private CommonService commonService;
|
|
|
|
|
|
|
|
- @ApiOperation(value = "获取车辆押运员分页列表",notes="")
|
|
|
|
|
- @PostMapping("/list")
|
|
|
|
|
|
|
+
|
|
|
|
|
+ @ApiOperation(value = "获取车辆押运员分页列表", notes = "必传参数:orgId选填参数:keyWord(查escortName,mobile)")
|
|
|
|
|
+ @PostMapping("/page_list")
|
|
|
public Result list(@RequestBody PageParam<TruckEscortListParam> pageParam) {
|
|
public Result list(@RequestBody PageParam<TruckEscortListParam> pageParam) {
|
|
|
- log.info("获取运力部门管理分页列表,调用/tms/truck_dept/page_list,参数:{}", JSON.toJSONString(pageParam));
|
|
|
|
|
|
|
+ log.info("获取车辆押运员分页列表,调用/tms/truck_escort/page_list,参数:{}", JSON.toJSONString(pageParam));
|
|
|
if (pageParam == null || pageParam.getParam() == null || pageParam.getParam().getOrgId() == null) {
|
|
if (pageParam == null || pageParam.getParam() == null || pageParam.getParam().getOrgId() == null) {
|
|
|
return new Result<>(ErrCodeEnum.BAD_PARAM.getCode(), ErrCodeEnum.BAD_PARAM.getMessage());
|
|
return new Result<>(ErrCodeEnum.BAD_PARAM.getCode(), ErrCodeEnum.BAD_PARAM.getMessage());
|
|
|
}
|
|
}
|
|
|
return new Result<>(truckEscortService.findPage(pageParam));
|
|
return new Result<>(truckEscortService.findPage(pageParam));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- @ApiOperation(value = "添加车辆押运员",notes="新增一条truck_escort")
|
|
|
|
|
|
|
+ @ApiOperation(value = "根据条件获取车辆押运员列表", notes = "必传参数:orgId;选填参数:truckId,carNumber,keyWord(查escortName,mobile)")
|
|
|
|
|
+ @PostMapping("/list")
|
|
|
|
|
+ public Result list(@RequestBody TruckEscortListParam param) {
|
|
|
|
|
+ log.info("根据条件获取车辆押运员列表,调用/tms/truck_escort/list,参数:{}", JSON.toJSONString(param));
|
|
|
|
|
+ if (param == null || param.getOrgId() == null) {
|
|
|
|
|
+ return new Result<>(ErrCodeEnum.BAD_PARAM.getCode(), ErrCodeEnum.BAD_PARAM.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ return new Result<>(truckEscortService.list(param));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @ApiOperation(value = "添加车辆押运员", notes = "必传参数:orgId,escortName,mobile")
|
|
|
@PostMapping("/add")
|
|
@PostMapping("/add")
|
|
|
public Result add(@RequestHeader(value = "userId") Long userId,
|
|
public Result add(@RequestHeader(value = "userId") Long userId,
|
|
|
@RequestHeader(value = "userName") String userName,
|
|
@RequestHeader(value = "userName") String userName,
|
|
|
@RequestBody TruckEscortAddParam param) {
|
|
@RequestBody TruckEscortAddParam param) {
|
|
|
- log.info("新增运力部门,调用/tms/truck_dept/add,参数:{}", JSON.toJSONString(param));
|
|
|
|
|
|
|
+ log.info("添加车辆押运员,调用/tms/truck_escort/add,参数:{}", JSON.toJSONString(param));
|
|
|
if (param == null || param.getOrgId() == null || param.getEscortName() == null || param.getMobile() == null) {
|
|
if (param == null || param.getOrgId() == null || param.getEscortName() == null || param.getMobile() == null) {
|
|
|
return new Result<>(ErrCodeEnum.BAD_PARAM.getCode(), ErrCodeEnum.BAD_PARAM.getMessage());
|
|
return new Result<>(ErrCodeEnum.BAD_PARAM.getCode(), ErrCodeEnum.BAD_PARAM.getMessage());
|
|
|
}
|
|
}
|
|
@@ -76,12 +92,46 @@ public class TruckEscortController {
|
|
|
return new Result<>(truckEscortService.add(param));
|
|
return new Result<>(truckEscortService.add(param));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- @ApiOperation(value = "修改truck_escort",notes="根据id修改truck_escort")
|
|
|
|
|
|
|
+ @ApiOperation(value = "修改车辆押运员", notes = "必传参数:userId")
|
|
|
@PostMapping("/update")
|
|
@PostMapping("/update")
|
|
|
- public Result update(@RequestBody TruckEscort truckEscort) {
|
|
|
|
|
- Boolean flag = truckEscortService.updateById(truckEscort);
|
|
|
|
|
- return new Result<>(flag);
|
|
|
|
|
|
|
+ public Result update(@RequestHeader(value = "userId") Long userId,
|
|
|
|
|
+ @RequestHeader(value = "userName") String userName,
|
|
|
|
|
+ @RequestBody TruckEscort param) {
|
|
|
|
|
+ log.info("修改作业点,调用/tms/truck_escort/update,参数:{}", JSON.toJSONString(param));
|
|
|
|
|
+ if (param == null || param.getEscortId() == 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.setUpdater(userId);
|
|
|
|
|
+ param.setUpdaterName(utf8Name);
|
|
|
|
|
+ param.setUpdateDate(LocalDateTime.now());
|
|
|
|
|
+
|
|
|
|
|
+ return new Result<>(truckEscortService.edit(param));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @ApiOperation(value = "删除车辆押运员", notes = "必传参数:userId")
|
|
|
|
|
+ @PostMapping("/delete")
|
|
|
|
|
+ public Result delete(@RequestBody TruckEscort param) {
|
|
|
|
|
+ log.info("删除车辆押运员,调用/tms/truck_escort/delete,参数:{}", JSON.toJSONString(param));
|
|
|
|
|
+ if (param == null || param.getEscortId() == null) {
|
|
|
|
|
+ return new Result<>(ErrCodeEnum.BAD_PARAM.getCode(), ErrCodeEnum.BAD_PARAM.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ commonService.deleteUser(param.getEscortId());
|
|
|
|
|
+ return new Result<>(truckEscortService.removeById(param));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @ApiOperation(value = "获取单个车辆押运员详情", notes = "必传参数:userId")
|
|
|
|
|
+ @PostMapping("/get_one")
|
|
|
|
|
+ public Result getOne(@RequestBody TruckEscort param) {
|
|
|
|
|
+ log.info("删除车辆押运员,调用/tms/truck_escort/get_one,参数:{}", JSON.toJSONString(param));
|
|
|
|
|
+ if (param == null || param.getEscortId() == null) {
|
|
|
|
|
+ return new Result<>(ErrCodeEnum.BAD_PARAM.getCode(), ErrCodeEnum.BAD_PARAM.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ return new Result<>(truckEscortService.getById(param));
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
}
|
|
}
|