parent
33052f4e7c
commit
3a795a41e5
|
|
@ -0,0 +1,31 @@
|
||||||
|
package com.gunshi.project.ss.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import com.gunshi.core.result.R;
|
||||||
|
import com.gunshi.project.ss.model.ForecastProject;
|
||||||
|
import com.gunshi.project.ss.model.ForecastResults;
|
||||||
|
import com.gunshi.project.ss.service.ScreenReportService;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@Tag(name = "大屏-预报")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping(value="/screen/report")
|
||||||
|
public class ScreenReportController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ScreenReportService screenReportService;
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
public R<ForecastProject> getForecast(){
|
||||||
|
ForecastProject forecastProject = screenReportService.getForecast();
|
||||||
|
return R.ok(forecastProject);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,53 @@
|
||||||
|
package com.gunshi.project.ss.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import com.gunshi.core.result.R;
|
||||||
|
import com.gunshi.project.ss.entity.vo.ScreenPositionTrainingVo;
|
||||||
|
import com.gunshi.project.ss.model.FileAssociations;
|
||||||
|
import com.gunshi.project.ss.model.ResPerson;
|
||||||
|
import com.gunshi.project.ss.service.FileAssociationsService;
|
||||||
|
import com.gunshi.project.ss.service.PersonnelPlanService;
|
||||||
|
import com.gunshi.project.ss.service.ScreenResponsibilityService;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Tag(name = "大屏-落实责任制")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping(value="/screen/responsibility")
|
||||||
|
public class ScreenResponsibilityController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ScreenResponsibilityService screenResponsibilityService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private FileAssociationsService fileService;
|
||||||
|
|
||||||
|
@GetMapping("/getPerson")
|
||||||
|
public R<List<ResPerson>> getPerson(){
|
||||||
|
List<ResPerson> vo = screenResponsibilityService.getPerson();
|
||||||
|
return R.ok(vo);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/getTraining")
|
||||||
|
public R<ScreenPositionTrainingVo> getTraining(){
|
||||||
|
ScreenPositionTrainingVo vo = screenResponsibilityService.getTraining();
|
||||||
|
if(vo.getLatestPersonnelPlan() != null){
|
||||||
|
List<FileAssociations> files = fileService.getFiles(getGroupId(), vo.getLatestPersonnelPlan().getId().toString());
|
||||||
|
vo.getLatestPersonnelPlan().setFiles(files);
|
||||||
|
}
|
||||||
|
return R.ok(vo);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGroupId() {
|
||||||
|
return "personnelPlan";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,26 @@
|
||||||
|
package com.gunshi.project.ss.entity.vo;
|
||||||
|
|
||||||
|
|
||||||
|
import com.gunshi.project.ss.model.PersonnelPlan;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ScreenPositionTrainingVo {
|
||||||
|
|
||||||
|
|
||||||
|
//培训计划数量
|
||||||
|
private Long trainingCount;
|
||||||
|
|
||||||
|
//已开展
|
||||||
|
private Long hasTraining;
|
||||||
|
|
||||||
|
//未开展
|
||||||
|
private Long hasNoTraining;
|
||||||
|
|
||||||
|
//参训总人次
|
||||||
|
private Long totalTraining;
|
||||||
|
|
||||||
|
|
||||||
|
//最新培训内容
|
||||||
|
private PersonnelPlan latestPersonnelPlan;
|
||||||
|
}
|
||||||
|
|
@ -49,6 +49,9 @@ public class DocCategory {
|
||||||
@Schema(description = "当前层级")
|
@Schema(description = "当前层级")
|
||||||
private Integer level;
|
private Integer level;
|
||||||
|
|
||||||
|
@TableField("target_type")
|
||||||
|
private Integer targetType;
|
||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
@Schema(description = "子分类列表")
|
@Schema(description = "子分类列表")
|
||||||
private List<DocCategory> children;
|
private List<DocCategory> children;
|
||||||
|
|
@ -56,4 +59,5 @@ public class DocCategory {
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
@Schema(description = "所有者权限")
|
@Schema(description = "所有者权限")
|
||||||
private List<DocPermissionConfig> permissions;
|
private List<DocPermissionConfig> permissions;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -48,11 +48,6 @@ public class TaskGroupJob implements Job {
|
||||||
@Autowired
|
@Autowired
|
||||||
private ForecastResultsService forecastResultsService;
|
private ForecastResultsService forecastResultsService;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private ForecastUseparamService forecastUseparamService;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private AttResBaseService attResBaseService;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ForecastProjectService forecastProjectService;
|
private ForecastProjectService forecastProjectService;
|
||||||
|
|
@ -92,20 +87,6 @@ public class TaskGroupJob implements Job {
|
||||||
List<ForecastResultVo> voList = forecastResultsService.autoFloodForecast(forecastTask);
|
List<ForecastResultVo> voList = forecastResultsService.autoFloodForecast(forecastTask);
|
||||||
// 符合条件就保存到数据库
|
// 符合条件就保存到数据库
|
||||||
if (CollectionUtils.isNotEmpty(voList)) {
|
if (CollectionUtils.isNotEmpty(voList)) {
|
||||||
Map<String, Object> map = forecastUseparamService.getMap(new QueryWrapper<ForecastUseparam>().eq("param_code", "ydgdyjz"));// 获取安全值
|
|
||||||
AttResBase attResBase = attResBaseService.getOne(new QueryWrapper<>());// 获取堰顶高程
|
|
||||||
if (MapUtil.isNotEmpty(map) && ObjectUtils.isNotEmpty(attResBase) && ObjectUtils.isNotEmpty(attResBase.getWcrstel())) {
|
|
||||||
BigDecimal ydgdyjz = new BigDecimal(map.get("param_value").toString());
|
|
||||||
BigDecimal wcrstel = attResBase.getWcrstel();
|
|
||||||
Boolean isSave = false;
|
|
||||||
for (ForecastResultVo vo : voList) {
|
|
||||||
// 当计算的预报最高水位离堰顶高程小于此安全值,或者超过堰顶高度的值时,发送系统内消息提示。同时自动滚动预报保存方案结果
|
|
||||||
if ((vo.getYcSwHValue().add(ydgdyjz)).compareTo(wcrstel) > 0) {
|
|
||||||
isSave = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (isSave) {
|
|
||||||
ForecastProject forecastProject = new ForecastProject();
|
ForecastProject forecastProject = new ForecastProject();
|
||||||
forecastProject.setId(IdWorker.getId());
|
forecastProject.setId(IdWorker.getId());
|
||||||
forecastProject.setName("未来" + forecastPeriod + "小时洪水预报-".concat(sdfTime.format(nowTime)));
|
forecastProject.setName("未来" + forecastPeriod + "小时洪水预报-".concat(sdfTime.format(nowTime)));
|
||||||
|
|
@ -125,8 +106,6 @@ public class TaskGroupJob implements Job {
|
||||||
forecastProjectService.saveForecastResults(forecastProject);
|
forecastProjectService.saveForecastResults(forecastProject);
|
||||||
forecastTask.setLastResultsaveTm(nowDate);
|
forecastTask.setLastResultsaveTm(nowDate);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
forecastTaskService.updateById(forecastTask);
|
forecastTaskService.updateById(forecastTask);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,69 @@
|
||||||
|
package com.gunshi.project.ss.service;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||||
|
import com.gunshi.project.ss.entity.vo.ForecastResultVo;
|
||||||
|
import com.gunshi.project.ss.model.ForecastProject;
|
||||||
|
import com.gunshi.project.ss.model.ForecastResults;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
public class ScreenReportService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ForecastProjectService forecastProjectService;
|
||||||
|
|
||||||
|
private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ForecastResultsService forecastResultsService;
|
||||||
|
|
||||||
|
public ForecastProject getForecast() {
|
||||||
|
ForecastProject one = forecastProjectService.lambdaQuery().eq(ForecastProject::getType, "1").orderByDesc(ForecastProject::getForecastTm).last("limit 1").one();
|
||||||
|
if(one == null){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
List<ForecastResults> forecastResults = forecastResultsService.lambdaQuery()
|
||||||
|
.eq(ForecastResults::getProjectId, one.getId()).orderByAsc(ForecastResults::getTm).list();
|
||||||
|
if(!forecastResults.isEmpty()){
|
||||||
|
fillData(forecastResults,one);
|
||||||
|
}
|
||||||
|
return one;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void fillData(List<ForecastResults> resultList, ForecastProject forecastProject ){
|
||||||
|
if (CollectionUtils.isNotEmpty(resultList)) {
|
||||||
|
List<ForecastResultVo> vos = resultList.stream()
|
||||||
|
.map(result -> {
|
||||||
|
ForecastResultVo vo = new ForecastResultVo();
|
||||||
|
vo.setTm(sdf.format(result.getTm()));
|
||||||
|
vo.setYcRkQValue(result.getYcRkQValue());
|
||||||
|
vo.setRealRkQValue(result.getRealRkQValue());
|
||||||
|
vo.setYcCkQValue(result.getYcCkQValue());
|
||||||
|
vo.setRealCkQValue(result.getRealCkQValue());
|
||||||
|
vo.setYcSwHValue(result.getYcSwHValue());
|
||||||
|
vo.setRealSwHValue(result.getRealSwHValue());
|
||||||
|
BigDecimal ycSwHValue = result.getYcSwHValue() == null ? BigDecimal.ZERO : result.getYcSwHValue();
|
||||||
|
BigDecimal realSwHValue = result.getRealSwHValue() == null ? BigDecimal.ZERO : result.getRealSwHValue();
|
||||||
|
vo.setSwHDValue(ycSwHValue.subtract(realSwHValue));// 处理预测与实测水位差
|
||||||
|
vo.setDrp(result.getDrp());
|
||||||
|
vo.setIspreDrp(result.getIspreDrp());
|
||||||
|
vo.setR(result.getR());
|
||||||
|
vo.setFlLowLimLev(result.getFlLowLimLev());
|
||||||
|
vo.setCurrentYdgdyjz(result.getCurrentYdgdyjz());
|
||||||
|
vo.setPa(result.getPa());
|
||||||
|
return vo;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
forecastProject.setVoList(vos);
|
||||||
|
forecastResultsService.handleVoList(forecastProject);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,65 @@
|
||||||
|
package com.gunshi.project.ss.service;
|
||||||
|
|
||||||
|
|
||||||
|
import com.gunshi.project.ss.entity.vo.ScreenPositionTrainingVo;
|
||||||
|
import com.gunshi.project.ss.model.PersonnelPlan;
|
||||||
|
import com.gunshi.project.ss.model.PersonnelPlanLog;
|
||||||
|
import com.gunshi.project.ss.model.ResPerson;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
public class ScreenResponsibilityService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private PersonnelPlanService personnelPlanService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private PersonnelPlanLogService personnelPlanLogService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ResPersonService resPersonService;
|
||||||
|
|
||||||
|
public ScreenPositionTrainingVo getTraining() {
|
||||||
|
ScreenPositionTrainingVo vo = new ScreenPositionTrainingVo();
|
||||||
|
List<PersonnelPlan> list = personnelPlanService.lambdaQuery().orderByDesc(PersonnelPlan::getCreateTime).list();
|
||||||
|
vo.setTrainingCount(Long.valueOf(list.size()));
|
||||||
|
|
||||||
|
//已开展
|
||||||
|
List<Long> ids = list.stream().map(o -> o.getId()).collect(Collectors.toList());
|
||||||
|
Long hasTraining = 0l;
|
||||||
|
Long hasNoTraining = 0l;
|
||||||
|
Long totalTraining = 0L;
|
||||||
|
//TODO 这里N+1问题自己去解决一下吧,我懒得改了。
|
||||||
|
for (Long id : ids) {
|
||||||
|
List<PersonnelPlanLog> logs = personnelPlanLogService.lambdaQuery().eq(PersonnelPlanLog::getPlanId, id).list();
|
||||||
|
if(logs.isEmpty()){
|
||||||
|
hasNoTraining++;
|
||||||
|
}else{
|
||||||
|
hasTraining++;
|
||||||
|
totalTraining += logs.stream().mapToLong(o -> o.getNumPeople()).sum();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
vo.setHasTraining(hasTraining);
|
||||||
|
vo.setHasNoTraining(hasNoTraining);
|
||||||
|
vo.setTotalTraining(totalTraining);
|
||||||
|
if(!list.isEmpty()){
|
||||||
|
PersonnelPlan personnelPlan = list.get(0);
|
||||||
|
vo.setLatestPersonnelPlan(personnelPlan);
|
||||||
|
}
|
||||||
|
return vo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ResPerson> getPerson() {
|
||||||
|
List<ResPerson> list = resPersonService.lambdaQuery().in(ResPerson::getType, Arrays.asList(0, 1, 2))
|
||||||
|
.orderByDesc(ResPerson::getCreateTime)
|
||||||
|
.list();
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -45,8 +45,8 @@ public class StWaterDataTask {
|
||||||
@Autowired
|
@Autowired
|
||||||
private StWaterRRealService stWaterRRealService;
|
private StWaterRRealService stWaterRRealService;
|
||||||
|
|
||||||
@Scheduled(fixedDelay = 75 * 60 * 1000) // 75分钟,单位毫秒
|
// @Scheduled(fixedDelay = 75 * 60 * 1000) // 75分钟,单位毫秒
|
||||||
@Async
|
// @Async
|
||||||
public void syncFlowToWater(){
|
public void syncFlowToWater(){
|
||||||
List<String> stcds = stFlowRService.getStcdList();
|
List<String> stcds = stFlowRService.getStcdList();
|
||||||
//去供水量表查数据
|
//去供水量表查数据
|
||||||
|
|
@ -129,8 +129,8 @@ public class StWaterDataTask {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Scheduled(fixedDelay = 76 * 60 * 1000) // 75分钟,单位毫秒
|
// @Scheduled(fixedDelay = 76 * 60 * 1000) // 75分钟,单位毫秒
|
||||||
@Async
|
// @Async
|
||||||
public void syncWaterToReorganize(){
|
public void syncWaterToReorganize(){
|
||||||
List<StWaterRReorganize> list = stWaterRReorganizeService.lambdaQuery()
|
List<StWaterRReorganize> list = stWaterRReorganizeService.lambdaQuery()
|
||||||
.orderByDesc(StWaterRReorganize::getTm).last("limit 1").list();
|
.orderByDesc(StWaterRReorganize::getTm).last("limit 1").list();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue