|
@@ -1,16 +1,24 @@
|
|
|
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.entity.TruckDept;
|
|
|
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.WorkSpotService;
|
|
|
|
|
-import com.aoyang.tms.entity.WorkSpot;
|
|
|
|
|
|
|
+
|
|
|
|
|
+import com.aoyang.tms.service.WorkSpotService;
|
|
|
|
|
+import com.aoyang.tms.entity.WorkSpot;
|
|
|
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;
|
|
@@ -20,8 +28,8 @@ import com.aoyang.common.param.PageParam;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* <p>
|
|
* <p>
|
|
|
- * 运单地点管理表 控制器
|
|
|
|
|
- * </p>
|
|
|
|
|
|
|
+ * 运单地点管理表 控制器
|
|
|
|
|
+ * </p>
|
|
|
*
|
|
*
|
|
|
* @author guoyong
|
|
* @author guoyong
|
|
|
* @since 2022-04-20
|
|
* @since 2022-04-20
|
|
@@ -35,25 +43,71 @@ public class WorkSpotController {
|
|
|
@Resource
|
|
@Resource
|
|
|
private WorkSpotService workSpotService;
|
|
private WorkSpotService workSpotService;
|
|
|
|
|
|
|
|
- @ApiOperation(value = "获取work_spot列表",notes="")
|
|
|
|
|
- @PostMapping("/list")
|
|
|
|
|
|
|
+ @ApiOperation(value = "获取作业点分页列表", notes = "")
|
|
|
|
|
+ @PostMapping("/page_list")
|
|
|
public Result list(@RequestBody PageParam<WorkSpot> pageParam) {
|
|
public Result list(@RequestBody PageParam<WorkSpot> pageParam) {
|
|
|
- Page<WorkSpot> page = new Page<>(pageParam.getPage(), pageParam.getSize());
|
|
|
|
|
- IPage<WorkSpot> records = workSpotService.page(page, Wrappers.query(pageParam.getParam()));
|
|
|
|
|
- return new Result<>(records);
|
|
|
|
|
|
|
+ log.info("获取运力部门管理分页列表,调用/tms/work_spot/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<>(workSpotService.findPage(pageParam));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- @ApiOperation(value = "修改work_spot",notes="根据id修改work_spot")
|
|
|
|
|
|
|
+ @ApiOperation(value = "修改作业点", notes = "根据id修改work_spot")
|
|
|
@PostMapping("/update")
|
|
@PostMapping("/update")
|
|
|
- public Result update(@RequestBody WorkSpot workSpot) {
|
|
|
|
|
- Boolean flag = workSpotService.updateById(workSpot);
|
|
|
|
|
- return new Result<>(flag);
|
|
|
|
|
|
|
+ public Result update(@RequestHeader(value = "userId") Long userId,
|
|
|
|
|
+ @RequestHeader(value = "userName") String userName,
|
|
|
|
|
+ @RequestBody WorkSpot param) {
|
|
|
|
|
+
|
|
|
|
|
+ log.info("修改作业点,调用/tms/work_spot/update,参数:{}", JSON.toJSONString(param));
|
|
|
|
|
+ if (param == null || param.getSpotId() == 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<>(workSpotService.updateById(param));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- @ApiOperation(value = "添加work_spot",notes="新增一条work_spot")
|
|
|
|
|
|
|
+ @ApiOperation(value = "添加作业点", notes = "新增一条work_spot")
|
|
|
@PostMapping("/add")
|
|
@PostMapping("/add")
|
|
|
- public Result add(@RequestBody WorkSpot workSpot) {
|
|
|
|
|
- Boolean flag = workSpotService.save(workSpot);
|
|
|
|
|
- return new Result<>(flag);
|
|
|
|
|
|
|
+ public Result add(@RequestHeader(value = "userId") Long userId,
|
|
|
|
|
+ @RequestHeader(value = "userName") String userName,
|
|
|
|
|
+ @RequestBody WorkSpot param) {
|
|
|
|
|
+
|
|
|
|
|
+ log.info("添加作业点,调用/tms/work_spot/add,参数:{}", JSON.toJSONString(param));
|
|
|
|
|
+ if (param == null || param.getOrgId() == null || param.getType() == null || param.getOrgName() == null
|
|
|
|
|
+ || param.getOrgShortName() == null || param.getSpotName() == 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());
|
|
|
|
|
+ param.setUpdater(userId);
|
|
|
|
|
+ param.setUpdaterName(utf8Name);
|
|
|
|
|
+ param.setUpdateDate(LocalDateTime.now());
|
|
|
|
|
+
|
|
|
|
|
+ return new Result<>(workSpotService.save(param));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @ApiOperation(value = "删除作业点", notes = "根据id删除作业点,参数:id")
|
|
|
|
|
+ @PostMapping("/delete")
|
|
|
|
|
+ public Result delete(@RequestBody WorkSpot param) {
|
|
|
|
|
+ log.info("删除作业点,调用/tms/work_spot/delete,参数:{}", JSON.toJSONString(param));
|
|
|
|
|
+ if (param == null || param.getSpotId() == null) {
|
|
|
|
|
+ return new Result<>(ErrCodeEnum.BAD_PARAM.getCode(), ErrCodeEnum.BAD_PARAM.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ return new Result<>(workSpotService.removeById(param));
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|