7 files modified
6 files added
| | |
| | | |
| | | String GET_RESERVOIR_RAINFALL_FORECAST = API_PREFIX + "/getReservoirRainfallForecast"; |
| | | |
| | | //保存昨日报汛内容 |
| | | String SAVE_YESTERDAY_FLOOD_REPORT_CONTENT = API_PREFIX + "/saveYesterdayFloodReportContent"; |
| | | |
| | | @GetMapping(GENERATE_DAY_REPORT_FLOOD) |
| | | String generateDayReportFlood(@RequestParam("isShow") String isShow) throws Exception; |
| | | |
| | | @GetMapping(SAVE_YESTERDAY_FLOOD_REPORT_CONTENT) |
| | | String saveYesterdayFloodReportContent(@RequestParam("isShow") String isShow) throws Exception; |
| | | |
| | | |
| | | @GetMapping(GET_RESERVOIR_RAINFALL_FORECAST) |
| | | void getReservoirRainfallForecast(@RequestParam("dayIndexList") List<String> dayIndexList) throws Exception; |
| | |
| | | public void getReservoirRainfallForecast(List<String> dayIndexList) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public String saveYesterdayFloodReportContent(String isShow) throws Exception { |
| | | return null; |
| | | } |
| | | } |
| New file |
| | |
| | | package cn.gistack.sm.sjztmd.controller; |
| | | |
| | | import cn.gistack.sm.sjztmd.entity.TbResStagCapDisc; |
| | | import cn.gistack.sm.sjztmd.feign.ISjztMdClient; |
| | | import cn.gistack.sm.sjztmd.service.IYwFloodReportInfoService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.SneakyThrows; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springblade.core.tool.api.R; |
| | | 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; |
| | | |
| | | /** |
| | | * @Author AIX |
| | | * @Date 2024/7/8 12:49 |
| | | * @Version 1.0 |
| | | */ |
| | | @Slf4j |
| | | @Api(tags = "每日报汛内容") |
| | | @RestController |
| | | @RequestMapping("/ywxt/ywFloodReportInfo") |
| | | @AllArgsConstructor |
| | | public class YwFloodReportInfoController { |
| | | |
| | | @Autowired |
| | | private ISjztMdClient sjztMdClient; |
| | | |
| | | @SneakyThrows |
| | | @GetMapping(value = "/addFloodReport") |
| | | public R getAll() { |
| | | sjztMdClient.saveYesterdayFloodReportContent("1"); |
| | | return R.status(true); |
| | | } |
| | | } |
| New file |
| | |
| | | package cn.gistack.sm.sjztmd.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModel; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | | import org.springblade.core.mp.base.BaseEntity; |
| | | |
| | | /** |
| | | * @Author AIX |
| | | * @Date 2024/7/8 12:34 |
| | | * @Version 1.0 |
| | | */ |
| | | @Data |
| | | @TableName("YW_FLOOD_REPORT_INFO") |
| | | @ApiModel(value = "每日报汛内容", description = "每日报汛内容对象") |
| | | @EqualsAndHashCode(callSuper = false) |
| | | @Accessors(chain = true) |
| | | public class YwFloodReportInfo extends BaseEntity { |
| | | |
| | | private String totalInfo; |
| | | private String oversmallInfo; |
| | | |
| | | } |
| | |
| | | import cn.gistack.sm.intelligentCall.service.CallService; |
| | | import cn.gistack.sm.intelligentCall.vo.CallTaskResultVO; |
| | | import cn.gistack.sm.sjztmd.entity.AttResBase; |
| | | import cn.gistack.sm.sjztmd.entity.YwFloodReportInfo; |
| | | import cn.gistack.sm.sjztmd.feign.IAttResBaseClient; |
| | | import cn.gistack.sm.sjztmd.feign.ISjztMdClient; |
| | | import cn.gistack.sm.sjztmd.service.IAttResBaseService; |
| | | import cn.gistack.sm.sjztmd.service.IYwFloodReportInfoService; |
| | | import cn.gistack.sm.sjztmd.util.MyDateUtils; |
| | | import cn.gistack.sm.sjztmd.word.service.ISjztmdService; |
| | | import cn.gistack.sm.sjztmd.word.util.WordUtil; |
| | | import cn.gistack.sm.sjztmd.word.vo.DzkInfo; |
| | | import cn.gistack.sm.sjztmd.word.vo.OverDetail; |
| | | import cn.gistack.sm.sjztmd.word.vo.SzInfo; |
| | | import cn.gistack.sm.sjztmd.word.vo.TotalInfo; |
| | | import cn.gistack.sm.sjztmd.word.vo.*; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springblade.core.redis.cache.BladeRedis; |
| | | import org.springblade.core.tenant.annotation.NonDS; |
| | | import org.springframework.core.io.InputStreamResource; |
| | | import org.springframework.http.MediaType; |
| | |
| | | private final ISmsRecordClient smsRecordClient; |
| | | |
| | | private final CallService callService; |
| | | |
| | | private final IYwFloodReportInfoService ywFloodReportInfoService; |
| | | |
| | | @Override |
| | | public String saveYesterdayFloodReportContent(String isShow) throws Exception { |
| | | //获取总览、大中库、明细数据 |
| | | List<TotalInfo> totalList = sjztmdService.getTotalInfo(isShow); |
| | | OverWord overWord = WordUtil.GetOverInfo(totalList); |
| | | // bladeRedis.set("yesterDayFloodReport-totalinfo",overWord.getTotalInfo()); |
| | | // bladeRedis.set("yesterDayFloodReport-oversmallinfo",overWord.getOverSmallInfo()); |
| | | YwFloodReportInfo info = new YwFloodReportInfo(); |
| | | info.setCreateTime(new Date()); |
| | | info.setTotalInfo(overWord.getTotalInfo()); |
| | | info.setOversmallInfo(overWord.getOverSmallInfo()); |
| | | ywFloodReportInfoService.save(info); |
| | | return "保存昨日报汛内容"; |
| | | } |
| | | |
| | | @Override |
| | | @GetMapping(GENERATE_DAY_REPORT_FLOOD) |
| | |
| | | |
| | | List<TotalInfo> totalOverList = sjztmdService.getTotalOverInfo(isShow, normalParams); |
| | | List<TotalInfo> totalOver10List = sjztmdService.getTotalOverInfo(isShow, over10Params); |
| | | |
| | | |
| | | //昨日报汛内容 |
| | | QueryWrapper queryWrapper = new QueryWrapper(); |
| | | YwFloodReportInfo ywFloodReportInfo = ywFloodReportInfoService.getLatestReport(queryWrapper); |
| | | |
| | | byte[] data = null; |
| | | if (MyDateUtils.isTodayInFloodSeason()) { |
| | | data = WordUtil.GetOverInfo(totalList, dzkList, overDetailList, szInfoList, dxyjList, whtjList); |
| | | data = WordUtil.GetOverInfo(totalList, dzkList, overDetailList, szInfoList, dxyjList, whtjList, ywFloodReportInfo); |
| | | } else { |
| | | data = WordUtil.GetNotInSeasonOverInfo(totalList, dzkList, overDetailList, szInfoList, totalOverList, totalOver10List); |
| | | |
| New file |
| | |
| | | package cn.gistack.sm.sjztmd.mapper; |
| | | |
| | | import cn.gistack.sm.sjztmd.entity.YwFloodReportInfo; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Constants; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.apache.ibatis.annotations.Select; |
| | | |
| | | /** |
| | | * @Author AIX |
| | | * @Date 2024/7/8 12:34 |
| | | * @Version 1.0 |
| | | */ |
| | | public interface YwFloodReportInfoMapper extends BaseMapper<YwFloodReportInfo> { |
| | | |
| | | @Select("SELECT * FROM ywxt.yw_flood_report_info ORDER BY create_time DESC LIMIT 1") |
| | | YwFloodReportInfo getLatestReport(@Param(Constants.WRAPPER) QueryWrapper<YwFloodReportInfo> queryWrapper); |
| | | |
| | | } |
| New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="cn.gistack.sm.sjztmd.mapper.YwFloodReportInfoMapper"> |
| | | |
| | | </mapper> |
| New file |
| | |
| | | package cn.gistack.sm.sjztmd.service; |
| | | |
| | | import cn.gistack.sm.sjztmd.entity.YwFloodReportInfo; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import org.springblade.core.mp.base.BaseService; |
| | | |
| | | /** |
| | | * @Author AIX |
| | | * @Date 2024/7/8 12:44 |
| | | * @Version 1.0 |
| | | */ |
| | | public interface IYwFloodReportInfoService extends BaseService<YwFloodReportInfo> { |
| | | YwFloodReportInfo getLatestReport(QueryWrapper<YwFloodReportInfo> queryWrapper); |
| | | } |
| New file |
| | |
| | | package cn.gistack.sm.sjztmd.service.impl; |
| | | |
| | | import cn.gistack.sm.sjztmd.entity.YwFloodReportInfo; |
| | | import cn.gistack.sm.sjztmd.mapper.YwFloodReportInfoMapper; |
| | | import cn.gistack.sm.sjztmd.service.IYwFloodReportInfoService; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springblade.core.mp.base.BaseServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | | * @Author AIX |
| | | * @Date 2024/7/8 12:45 |
| | | * @Version 1.0 |
| | | */ |
| | | @Service |
| | | @AllArgsConstructor |
| | | public class YwFloodReportInfoServiceImpl extends BaseServiceImpl<YwFloodReportInfoMapper, YwFloodReportInfo> implements IYwFloodReportInfoService { |
| | | @Override |
| | | public YwFloodReportInfo getLatestReport(QueryWrapper<YwFloodReportInfo> queryWrapper) { |
| | | return baseMapper.getLatestReport(queryWrapper); |
| | | } |
| | | } |
| | |
| | | package cn.gistack.sm.sjztmd.word.controller; |
| | | |
| | | |
| | | |
| | | import cn.gistack.alerts.sms.feign.ISmsRecordClient; |
| | | import cn.gistack.alerts.sms.vo.SmsResultVO; |
| | | import cn.gistack.sm.intelligentCall.service.CallService; |
| | | import cn.gistack.sm.intelligentCall.vo.CallTaskResultVO; |
| | | import cn.gistack.sm.sjztmd.entity.YwFloodReportInfo; |
| | | import cn.gistack.sm.sjztmd.service.IYwFloodReportInfoService; |
| | | import cn.gistack.sm.sjztmd.util.MyDateUtils; |
| | | import cn.gistack.sm.sjztmd.word.service.ISjztmdService; |
| | | import cn.gistack.sm.sjztmd.word.util.BriefReportUtil; |
| | | import cn.gistack.sm.sjztmd.word.util.ExcelUtil; |
| | | import cn.gistack.sm.sjztmd.word.util.WordUtil; |
| | | import cn.gistack.sm.sjztmd.word.vo.*; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.deepoove.poi.XWPFTemplate; |
| | | import io.swagger.annotations.Api; |
| | | import lombok.AllArgsConstructor; |
| | |
| | | private final ISmsRecordClient smsRecordClient; |
| | | |
| | | private final CallService callService; |
| | | |
| | | private final IYwFloodReportInfoService ywFloodReportInfoService; |
| | | |
| | | @GetMapping(value = "/getBriefReport") |
| | | public R getBriefReport() { |
| | | //获取总览、大中库、明细数据 |
| | |
| | | |
| | | List<TotalInfo> totalOverList = sjztmdService.getTotalOverInfo(isShow,normalParams); |
| | | List<TotalInfo> totalOver10List = sjztmdService.getTotalOverInfo(isShow,over10Params); |
| | | |
| | | //昨日报汛内容 |
| | | QueryWrapper queryWrapper = new QueryWrapper(); |
| | | YwFloodReportInfo ywFloodReportInfo = ywFloodReportInfoService.getLatestReport(queryWrapper); |
| | | |
| | | byte[] data = null; |
| | | if (MyDateUtils.isTodayInFloodSeason()){ |
| | | data = WordUtil.GetOverInfo(totalList,dzkList,overDetailList,szInfoList,dxyjList,whtjList); |
| | | data = WordUtil.GetOverInfo(totalList, dzkList, overDetailList, szInfoList, dxyjList, whtjList, ywFloodReportInfo); |
| | | }else { |
| | | data= WordUtil.GetNotInSeasonOverInfo(totalList,dzkList,overDetailList,szInfoList,totalOverList,totalOver10List); |
| | | |
| | |
| | | |
| | | import cn.gistack.alerts.sms.vo.SmsResultVO; |
| | | import cn.gistack.sm.intelligentCall.vo.CallTaskResultVO; |
| | | import cn.gistack.sm.sjztmd.entity.YwFloodReportInfo; |
| | | import cn.gistack.sm.sjztmd.util.MyDateUtils; |
| | | import cn.gistack.sm.sjztmd.word.vo.*; |
| | | import com.deepoove.poi.XWPFTemplate; |
| | |
| | | } |
| | | |
| | | |
| | | public static byte[] GetOverInfo(List<TotalInfo> totalList, List<DzkInfo> dzkList, List<OverDetail> overDetailList, List<SzInfo> szInfoList, List<SmsResultVO> dxyjList, List<CallTaskResultVO> whtjList) throws Exception { |
| | | public static byte[] GetOverInfo(List<TotalInfo> totalList, List<DzkInfo> dzkList, List<OverDetail> overDetailList, List<SzInfo> szInfoList, List<SmsResultVO> dxyjList, List<CallTaskResultVO> whtjList, YwFloodReportInfo ywFloodReportInfo) throws Exception { |
| | | InputStream inputStream = WordUtil.class.getClassLoader().getResourceAsStream("word/doc/overFloodTemplate.docx"); |
| | | ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); |
| | | OverWord overWord = new OverWord(totalList, dzkList, overDetailList, szInfoList, dxyjList, whtjList,null); |
| | | XWPFTemplate template = XWPFTemplate.compile(inputStream).render(createOverWordParam(overWord)); |
| | | XWPFTemplate template = XWPFTemplate.compile(inputStream).render(createOverWordParam(overWord, ywFloodReportInfo)); |
| | | template.write(outputStream); |
| | | outputStream.flush(); |
| | | outputStream.close(); |
| | |
| | | params.put("超正常中型水库详情", overWord.getOverNormalMidInfo()); |
| | | } |
| | | |
| | | //短信预警和外呼统计 |
| | | //短信预警 |
| | | return params; |
| | | } |
| | | |
| | | private static Map<String, Object> createOverWordParam(OverWord overWord, YwFloodReportInfo info) { |
| | | Map<String, Object> params = new HashMap<>(); |
| | | |
| | | //外呼统计 |
| | | params.put("时间", overWord.getTm()); |
| | | params.put("全省水库超汛限", overWord.getTotalInfo()); |
| | | params.put("小型水库详情", overWord.getOverSmallInfo()); |
| | | String dxStr = StringUtil.isNotBlank(overWord.getOverBigInfo()) ? "超汛限的水库的大型水库有:" : ""; |
| | | params.put("超汛限的水库的大型水库有", dxStr); |
| | | params.put("大型水库详情", overWord.getOverBigInfo()); |
| | | String zxStr = StringUtil.isNotBlank(overWord.getOverMidInfo()) ? "超汛限的水库的中型水库有:" : ""; |
| | | params.put("超汛限的水库的中型水库有", zxStr); |
| | | params.put("中型水库详情", overWord.getOverMidInfo()); |
| | | params.put("省直水库详情", overWord.getProvinceInfo()); |
| | | params.put("短信预警和外呼抽查", overWord.getSmsResultInfo()); |
| | | params.put("重点水库详情", overWord.getZdInfo()); |
| | | //不在汛期内 |
| | | if (!MyDateUtils.isTodayInFloodSeason()) { |
| | | params.put("全省水库超正常", overWord.getTotalOverNormalInfo()); |
| | | params.put("全省水库超正常十厘米以上", overWord.getTotalOverNormal10Info()); |
| | | params.put("超正常小型水库详情", overWord.getOverNormalSmallInfo()); |
| | | params.put("超正常大型水库详情", overWord.getOverNormalBigInfo()); |
| | | params.put("超正常中型水库详情", overWord.getOverNormalMidInfo()); |
| | | } |
| | | |
| | | //昨日报汛 |
| | | params.put("昨日全省水库超汛限", "昨日全省水库超汛限:" + info.getTotalInfo().replace("今日", "昨日")); |
| | | params.put("昨日超汛限的小型水库有", "昨日超汛限的小型水库有:" + info.getOversmallInfo()); |
| | | |
| | | return params; |
| | | } |
| | |
| | | } |
| | | |
| | | |
| | | public static OverWord GetOverInfo(List<TotalInfo> totalList) { |
| | | |
| | | OverWord overWord = new OverWord(totalList); |
| | | return overWord; |
| | | } |
| | | } |
| | |
| | | formatSmsResultInfo(resultVOList, whtjList); |
| | | } |
| | | |
| | | public OverWord(List<TotalInfo> totalList) { |
| | | this.tm = new SimpleDateFormat("MM月dd日H时").format(new Date()); |
| | | this.hour = new SimpleDateFormat("H时").format(new Date()); |
| | | formatTotalInfo(totalList); |
| | | } |
| | | |
| | | private void formatSmsResultInfo(List<SmsResultVO> resultVOList, List<CallTaskResultVO> whtjList) { |
| | | // 短信预警处理 |
| | | int dxyjCount = 0; |