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; package com.hivekion.baseData.controller;
import com.hivekion.baseData.domain.TblWeaponVo.TblWeaponModelVo;
import com.hivekion.baseData.domain.tblvehicleVo.VehicleAddInputVo; import com.hivekion.baseData.domain.tblvehicleVo.VehicleAddInputVo;
import com.hivekion.baseData.entity.WeatherResource; import com.hivekion.baseData.entity.WeatherResource;
import com.hivekion.baseData.service.IWeatherResourceService; import com.hivekion.baseData.service.IWeatherResourceService;
@ -14,6 +15,7 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.io.Serializable;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.List; import java.util.List;
@ -37,12 +39,21 @@ public class WeatherResourceController extends BaseController{
@ApiOperation(value = "新增天气信息", notes = "") @ApiOperation(value = "新增天气信息", notes = "")
@AutoLog(value = "新增天气信息", operationType = OperationTypeEnum.INSERT, module = "基础数据/新增车辆信息") @AutoLog(value = "新增天气信息", operationType = OperationTypeEnum.INSERT, module = "基础数据/新增车辆信息")
public boolean add(@RequestBody WeatherResource inputVo) throws Exception { public boolean add(@RequestBody WeatherResource inputVo) throws Exception {
if(inputVo.getId() == null) {
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
LocalDateTime begDate = LocalDateTime.parse(inputVo.getLastBegTimeStr(), dtf); LocalDateTime begDate = LocalDateTime.parse(inputVo.getLastBegTimeStr(), dtf);
LocalDateTime endDate = LocalDateTime.parse(inputVo.getLastEndTimeStr(), dtf); LocalDateTime endDate = LocalDateTime.parse(inputVo.getLastEndTimeStr(), dtf);
inputVo.setLastBegTime(begDate); inputVo.setLastBegTime(begDate);
inputVo.setLastEndTime(endDate); inputVo.setLastEndTime(endDate);
return weatherResourceService.save(inputVo); 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 = "") @ApiOperation(value = "查询天气列表", notes = "")
@ -75,4 +86,11 @@ public class WeatherResourceController extends BaseController{
weatherResourceService.removeById(id); weatherResourceService.removeById(id);
return ResponseData.success(null); 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 @Override
public List<WeatherResource> list(WeatherResource ebe) { public List<WeatherResource> list(WeatherResource ebe) {
if(ebe.getScenarioId() != null){
return this.list(new QueryWrapper<WeatherResource>().eq("scenario_id",ebe.getScenarioId())); return this.list(new QueryWrapper<WeatherResource>().eq("scenario_id",ebe.getScenarioId()));
}else{
return this.list();
}
} }
@Override @Override
public Long count(WeatherResource ebe) { public Long count(WeatherResource ebe) {
if(ebe.getScenarioId() != null){
return this.list(new QueryWrapper<WeatherResource>().eq("scenario_id",ebe.getScenarioId())).stream().count(); return this.list(new QueryWrapper<WeatherResource>().eq("scenario_id",ebe.getScenarioId())).stream().count();
}else{
return this.list().stream().count();
}
} }
} }