This commit is contained in:
wangwenhua 2025-09-25 16:56:41 +08:00
parent 5d0a37b49a
commit 2e9a0761d3
2 changed files with 34 additions and 8 deletions

View File

@ -1,5 +1,6 @@
package com.hivekion.baseData.controller;
import com.hivekion.baseData.domain.TblWeaponVo.TblWeaponModelVo;
import com.hivekion.baseData.domain.tblvehicleVo.VehicleAddInputVo;
import com.hivekion.baseData.entity.WeatherResource;
import com.hivekion.baseData.service.IWeatherResourceService;
@ -14,6 +15,7 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.stereotype.Controller;
import javax.annotation.Resource;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
@ -37,12 +39,21 @@ public class WeatherResourceController extends BaseController{
@ApiOperation(value = "新增天气信息", notes = "")
@AutoLog(value = "新增天气信息", operationType = OperationTypeEnum.INSERT, module = "基础数据/新增车辆信息")
public boolean add(@RequestBody WeatherResource inputVo) throws Exception {
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
LocalDateTime begDate = LocalDateTime.parse(inputVo.getLastBegTimeStr(),dtf);
LocalDateTime endDate = LocalDateTime.parse(inputVo.getLastEndTimeStr(),dtf);
inputVo.setLastBegTime(begDate);
inputVo.setLastEndTime(endDate);
return weatherResourceService.save(inputVo);
if(inputVo.getId() == null) {
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
LocalDateTime begDate = LocalDateTime.parse(inputVo.getLastBegTimeStr(), dtf);
LocalDateTime endDate = LocalDateTime.parse(inputVo.getLastEndTimeStr(), dtf);
inputVo.setLastBegTime(begDate);
inputVo.setLastEndTime(endDate);
return weatherResourceService.save(inputVo);
}else{
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
LocalDateTime begDate = LocalDateTime.parse(inputVo.getLastBegTimeStr(), dtf);
LocalDateTime endDate = LocalDateTime.parse(inputVo.getLastEndTimeStr(), dtf);
inputVo.setLastBegTime(begDate);
inputVo.setLastEndTime(endDate);
return weatherResourceService.updateById(inputVo);
}
}
@ApiOperation(value = "查询天气列表", notes = "")
@ -75,4 +86,11 @@ public class WeatherResourceController extends BaseController{
weatherResourceService.removeById(id);
return ResponseData.success(null);
}
@GetMapping("/getInfo")
@ApiOperation(value = "获取天气详细信息", notes = "")
@AutoLog(value = "获取天气详细信息", operationType = OperationTypeEnum.SELECT, module = "天气详细信息")
public WeatherResource getInfo(@RequestParam("id") Integer id) {
return weatherResourceService.getById(id);
}
}

View File

@ -22,13 +22,21 @@ public class WeatherResourceServiceImpl extends ServiceImpl<WeatherResourceMappe
@Override
public List<WeatherResource> list(WeatherResource ebe) {
if(ebe.getScenarioId() != null){
return this.list(new QueryWrapper<WeatherResource>().eq("scenario_id",ebe.getScenarioId()));
}else{
return this.list();
}
return this.list(new QueryWrapper<WeatherResource>().eq("scenario_id",ebe.getScenarioId()));
}
@Override
public Long count(WeatherResource ebe) {
return this.list(new QueryWrapper<WeatherResource>().eq("scenario_id",ebe.getScenarioId())).stream().count();
if(ebe.getScenarioId() != null){
return this.list(new QueryWrapper<WeatherResource>().eq("scenario_id",ebe.getScenarioId())).stream().count();
}else{
return this.list().stream().count();
}
}
}