[add]新增处理水量和拉泥车逻辑

This commit is contained in:
chengjunwang 2025-05-07 10:26:59 +08:00
parent a71ef52c00
commit e3ecf5cafe

View File

@ -1,6 +1,7 @@
package com.jdc.jdcproject.controller;
import com.jdc.jdcproject.entity.DicekePrecipitation;
import com.jdc.jdcproject.entity.Equipment;
import com.jdc.jdcproject.entity.FangpaishuiWatertreatmentrecord;
import com.jdc.jdcproject.entity.VO.FangpaishuiWatertreatmentrecordVo;
import com.jdc.jdcproject.service.FangpaishuiWatertreatmentrecordService;
@ -8,14 +9,12 @@ import com.jdc.jdcproject.utils.LastDayOfMonth;
import com.jdc.jdcproject.utils.Result;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@ -53,4 +52,51 @@ public class FangpaishuiWatertreatmentrecordController {
return Result.successResult().data("fangpaishuiWatertreatmentrecordVo",fangpaishuiWatertreatmentrecordVo);
}
@Operation(summary = "根据时间段查询处理水量和拉泥车数详细数据")
@GetMapping("findWatertreatmentrecordDetailByMonth/{dateTime}")
public Result findWatertreatmentrecordDetailByMonth(@PathVariable String dateTime) throws ParseException {
String[] s = dateTime.split("");
List<FangpaishuiWatertreatmentrecord> fangpaishuiWatertreatmentrecords = new ArrayList<>();
if (s.length!=0&&!s[0].isEmpty()&&!s[1].isEmpty()) {
fangpaishuiWatertreatmentrecords = fangpaishuiWatertreatmentrecordService.findByDate(s[0], s[1]);
}
return Result.successResult().data("fangpaishuiWatertreatmentrecords",fangpaishuiWatertreatmentrecords);
}
@Operation(summary = "修改处理水量和拉泥车信息")
@PostMapping("updateWatertreatmentrecord")
public Result updateEquipment(@RequestBody FangpaishuiWatertreatmentrecord fangpaishuiWatertreatmentrecord) {
boolean updateflag = fangpaishuiWatertreatmentrecordService.updateById(fangpaishuiWatertreatmentrecord);
if (updateflag) {
return Result.successResult();
} else {
return Result.errorResult();
}
}
@Operation(summary = "删除处理水量和拉泥车信息")
@DeleteMapping("deleteWatertreatmentrecord/{id}")
public Result deleteEquipment(@PathVariable String id) {
boolean updateflag = fangpaishuiWatertreatmentrecordService.removeById(id);
if (updateflag) {
return Result.successResult();
} else {
return Result.errorResult();
}
}
@Operation(summary = "新增处理水量和拉泥车信息")
@PostMapping("addWatertreatmentrecord")
public Result addEquipment(@RequestBody FangpaishuiWatertreatmentrecord fangpaishuiWatertreatmentrecord) {
System.out.println(fangpaishuiWatertreatmentrecord);
boolean updateflag = fangpaishuiWatertreatmentrecordService.save(fangpaishuiWatertreatmentrecord);
if (updateflag) {
return Result.successResult();
} else {
return Result.errorResult();
}
}
}