Pārlūkot izejas kodu

添加行车周期天气

guoyong 4 gadi atpakaļ
vecāks
revīzija
bf2f8eb2d2

+ 14 - 0
src/main/java/com/aoyang/tms/controller/WorkCycleController.java

@@ -3,6 +3,7 @@ package com.aoyang.tms.controller;
 
 import com.alibaba.fastjson.JSON;
 import com.aoyang.tms.common.ErrCodeEnum;
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import org.springframework.web.bind.annotation.*;
 
 import org.springframework.web.bind.annotation.RestController;
@@ -50,6 +51,19 @@ public class WorkCycleController {
         return new Result<>(workCycle);
     }
 
+    @ApiOperation(value = "更新前行程周期天气", notes = "必传参数:id")
+    @PostMapping("/update_weather")
+    public Result updateWeather(@RequestBody WorkCycle workCycleParam) {
+        log.info("前行程周期,/tms/work_cycle/update,参数:{}", JSON.toJSONString(workCycleParam));
+        if (workCycleParam == null || workCycleParam.getId() == null || StringUtils.isBlank(workCycleParam.getWeather())) {
+            return new Result(ErrCodeEnum.BAD_PARAM.getCode(), ErrCodeEnum.BAD_PARAM.getMessage());
+        }
+        WorkCycle workCycle = workCycleService.getById(workCycleParam.getId());
+        workCycle.setWeather(workCycleParam.getWeather());
+        Boolean flag = workCycleService.updateById(workCycle);
+        return new Result<>(flag);
+    }
+
     @ApiOperation(value = "获取历史行车列表", notes = "")
     @PostMapping("/list")
     public Result list(@RequestBody PageParam<WorkCycle> pageParam) {

+ 4 - 0
src/main/java/com/aoyang/tms/entity/WorkCycle.java

@@ -101,6 +101,10 @@ public class WorkCycle implements Serializable {
     @TableField("shipper_name")
     private String shipperName;
 
+    @ApiModelProperty(value = "周期开始时天气")
+    @TableField("weather")
+    private String weather;
+
     @ApiModelProperty(value = "周期开始时间")
     @TableField("start_time")
     private LocalDateTime startTime;

+ 2 - 0
src/main/resources/mapper/WorkCycleMapper.xml

@@ -20,6 +20,7 @@
         <result column="trailer_number" property="trailerNumber"/>
         <result column="shipper_id" property="shipperId"/>
         <result column="shipper_name" property="shipperName"/>
+        <result column="weather" property="weather"/>
         <result column="start_time" property="startTime"/>
         <result column="end_time" property="endTime"/>
         <result column="driver_one_sign_url" property="driverOneSignUrl"/>
@@ -51,6 +52,7 @@
         car_number,
         trailer_number,
         shipper_id,
+        weather,
         shipper_name,
         start_time,
         end_time,