|
|
@@ -1,6 +1,9 @@
|
|
|
package com.aoyang.tms.controller;
|
|
|
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.aoyang.tms.common.ErrCodeEnum;
|
|
|
+import com.aoyang.tms.entity.TmsGasFee;
|
|
|
import com.aoyang.tms.entity.TmsOtherFee;
|
|
|
import com.aoyang.tms.service.TmsOtherFeeService;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
@@ -9,7 +12,10 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.*;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
-import java.util.*;
|
|
|
+
|
|
|
+import java.io.UnsupportedEncodingException;
|
|
|
+import java.net.URLDecoder;
|
|
|
+import java.time.LocalDateTime;
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
|
import com.aoyang.common.result.Result;
|
|
|
@@ -21,10 +27,10 @@ import com.aoyang.common.param.PageParam;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
|
- * 其他费用表 控制器
|
|
|
- * </p>
|
|
|
+ * 其他费用表 控制器
|
|
|
+ * </p>
|
|
|
*
|
|
|
- * @author liujiren
|
|
|
+ * @author chengang
|
|
|
* @since 2022-04-23
|
|
|
*/
|
|
|
@RestController
|
|
|
@@ -36,25 +42,86 @@ public class TmsOtherFeeController {
|
|
|
@Resource
|
|
|
private TmsOtherFeeService tmsOtherFeeService;
|
|
|
|
|
|
- @ApiOperation(value = "获取tms_other_fee列表",notes="")
|
|
|
- @PostMapping("/list")
|
|
|
- public Result list(@RequestBody PageParam<TmsOtherFee> pageParam) {
|
|
|
+ @ApiOperation(value = "获取tms_other_fee分页列表", notes = "")
|
|
|
+ @PostMapping("/page_list")
|
|
|
+ public Result pageList(@RequestBody PageParam<TmsOtherFee> pageParam) {
|
|
|
Page<TmsOtherFee> page = new Page<>(pageParam.getPage(), pageParam.getSize());
|
|
|
IPage<TmsOtherFee> records = tmsOtherFeeService.page(page, Wrappers.query(pageParam.getParam()));
|
|
|
return new Result<>(records);
|
|
|
}
|
|
|
|
|
|
- @ApiOperation(value = "修改tms_other_fee",notes="根据id修改tms_other_fee")
|
|
|
- @PostMapping("/update")
|
|
|
- public Result update(@RequestBody TmsOtherFee tmsOtherFee) {
|
|
|
- Boolean flag = tmsOtherFeeService.updateById(tmsOtherFee);
|
|
|
- return new Result<>(flag);
|
|
|
+ @ApiOperation(value = "获取其他费用列表(供行车费用列表展示用)", notes = "必传参数:CycleId,TruckId")
|
|
|
+ @PostMapping("/list")
|
|
|
+ public Result list(@RequestBody TmsOtherFee param) {
|
|
|
+ log.info("获取其他费用列表(供行车费用列表展示用),调用/tms/tms_other_fee/list,参数:{}", JSON.toJSONString(param));
|
|
|
+ if (param == null || param.getCycleId() == null || param.getTruckId() == null) {
|
|
|
+ return new Result<>(ErrCodeEnum.BAD_PARAM.getCode(), ErrCodeEnum.BAD_PARAM.getMessage());
|
|
|
+ }
|
|
|
+ return new Result<>(tmsOtherFeeService.list(param));
|
|
|
}
|
|
|
|
|
|
- @ApiOperation(value = "添加tms_other_fee",notes="新增一条tms_other_fee")
|
|
|
+ @ApiOperation(value = "根据id获取其他费用详情", notes = "必传参数:Id")
|
|
|
+ @PostMapping("/get_one")
|
|
|
+ public Result getOne(@RequestBody TmsOtherFee param) {
|
|
|
+ log.info("根据id获取其他费用详情,调用/tms/tms_other_fee/get_one,参数:{}", JSON.toJSONString(param));
|
|
|
+ if (param == null || param.getId() == null) {
|
|
|
+ return new Result<>(ErrCodeEnum.BAD_PARAM.getCode(), ErrCodeEnum.BAD_PARAM.getMessage());
|
|
|
+ }
|
|
|
+ return new Result<>(tmsOtherFeeService.getById(param));
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "添加其他费用", notes = "必传参数:CycleId,TruckId")
|
|
|
@PostMapping("/add")
|
|
|
- public Result add(@RequestBody TmsOtherFee tmsOtherFee) {
|
|
|
- Boolean flag = tmsOtherFeeService.save(tmsOtherFee);
|
|
|
- return new Result<>(flag);
|
|
|
+ public Result add(@RequestHeader(value = "userId") Long userId,
|
|
|
+ @RequestHeader(value = "userName") String userName,
|
|
|
+ @RequestBody TmsOtherFee param) {
|
|
|
+ log.info("添加其他费用,调用/tms/tms_other_fee/add,参数:{}", JSON.toJSONString(param));
|
|
|
+ if (param == null || param.getCycleId() == 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.setCreater(userId);
|
|
|
+ param.setCreaterName(utf8Name);
|
|
|
+ param.setCreateDate(LocalDateTime.now());
|
|
|
+
|
|
|
+ return new Result<>(tmsOtherFeeService.save(param));
|
|
|
}
|
|
|
+
|
|
|
+ @ApiOperation(value = "修改其他费用", notes = "必传参数:id")
|
|
|
+ @PostMapping("/update")
|
|
|
+ public Result update(@RequestHeader(value = "userId") Long userId,
|
|
|
+ @RequestHeader(value = "userName") String userName,
|
|
|
+ @RequestBody TmsOtherFee param) {
|
|
|
+ log.info("修改其他费用,调用/tms/tms_other_fee/update,参数:{}", JSON.toJSONString(param));
|
|
|
+ if (param == null || param.getId() == 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<>(tmsOtherFeeService.updateById(param));
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "删除其他费用", notes = "必传参数:id")
|
|
|
+ @PostMapping("/delete")
|
|
|
+ public Result delete(@RequestBody TmsOtherFee param) {
|
|
|
+ log.info("删除其他费用,调用/tms/tms_other_fee/delete,参数:{}", JSON.toJSONString(param));
|
|
|
+ if (param == null || param.getId() == null) {
|
|
|
+ return new Result<>(ErrCodeEnum.BAD_PARAM.getCode(), ErrCodeEnum.BAD_PARAM.getMessage());
|
|
|
+ }
|
|
|
+ return new Result<>(tmsOtherFeeService.removeById(param));
|
|
|
+ }
|
|
|
+
|
|
|
}
|