| | |
| | | package cn.gistack.alerts.sms.feign; |
| | | |
| | | import cn.gistack.alerts.sms.vo.SmsResultVO; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 短信发送记录 |
| | |
| | | String SEND_SMS_BY_OUT_CALL_NOT_CONNECT = API_PREFIX + "/sendSmsByOutCallNotConnect"; |
| | | String CREATE_OUT_CALL_ERROR_SEND_SMS = API_PREFIX + "/createOutCallErrorSendSms"; |
| | | |
| | | String SELECT_SMS_RESULT_PAGE = API_PREFIX + "/selectSmsResultPage"; |
| | | |
| | | @PostMapping(SELECT_SMS_RESULT_PAGE) |
| | | List<SmsResultVO> smsSuccessList(@RequestBody SmsResultVO smsResult); |
| | | |
| | | /** |
| | | * 保存短信发送记录 |
| | | * @param userNumber |
| | |
| | | package cn.gistack.alerts.sms.feign; |
| | | |
| | | import cn.gistack.alerts.sms.vo.SmsResultVO; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.util.List; |
| | | |
| | | |
| | | /** |
| | |
| | | public class ISmsRecordClientFallback implements ISmsRecordClient{ |
| | | |
| | | @Override |
| | | public List<SmsResultVO> smsSuccessList(SmsResultVO smsResult) { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public void saveSmsRecord(String userNumber, String messageContent, String templateId, String code, String msg, Integer number) { |
| | | |
| | | } |
| | |
| | | |
| | | import cn.com.flaginfo.sdk.cmc.api.sms.send.SMSSendRequest; |
| | | import cn.gistack.alerts.sms.entity.SmsResult; |
| | | import cn.gistack.alerts.sms.service.ISmsResultService; |
| | | import cn.gistack.alerts.sms.service.SmsService; |
| | | import cn.gistack.alerts.sms.vo.SmsResponseVO; |
| | | import cn.gistack.alerts.sms.vo.SmsResultVO; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springblade.core.tenant.annotation.NonDS; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | |
| | | public class SmsRecordClient implements ISmsRecordClient { |
| | | |
| | | private final SmsService smsService; |
| | | private final ISmsResultService smsResultService; |
| | | |
| | | @Override |
| | | public List<SmsResultVO> smsSuccessList(SmsResultVO smsResult) { |
| | | List<SmsResultVO> resultVOList = (List<SmsResultVO>) smsResultService.selectSmsResultPage(null, smsResult); |
| | | return resultVOList; |
| | | } |
| | | |
| | | /** |
| | | * 短信记录发送保存 |
| | |
| | | package cn.gistack.sm.sjztmd.feign; |
| | | |
| | | import cn.gistack.alerts.sms.feign.ISmsRecordClient; |
| | | import cn.gistack.alerts.sms.vo.SmsResultVO; |
| | | import cn.gistack.resource.feign.IOssClient; |
| | | import cn.gistack.resource.vo.MyMultipartFile; |
| | | import cn.gistack.sm.sjztmd.entity.AttResBase; |
| | |
| | | import java.io.IOException; |
| | | import java.net.URLEncoder; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDate; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | |
| | | private final ISjztmdService sjztmdService; |
| | | private final IOssClient ossClient; |
| | | |
| | | private final ISmsRecordClient smsRecordClient; |
| | | |
| | | @Override |
| | | @GetMapping(GENERATE_DAY_REPORT_FLOOD) |
| | | public String generateDayReportFlood(String isShow) throws Exception{ |
| | |
| | | List<DzkInfo> dzkList = sjztmdService.getDzkInfo(isShow); |
| | | List<OverDetail> overDetailList = sjztmdService.getOverDetailInfo(isShow); |
| | | List<SzInfo> szInfoList = sjztmdService.getSzInfo(isShow); |
| | | |
| | | //短信预警数量 |
| | | SmsResultVO vo = new SmsResultVO(); |
| | | // 获取当前日期 |
| | | LocalDate today = LocalDate.now(); |
| | | // 获取前一天日期 |
| | | LocalDate yesterday = today.minusDays(1); |
| | | // 格式化日期并打印 |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
| | | vo.setStartTime(yesterday.format(formatter)); |
| | | vo.setEndTime(yesterday.format(formatter)); |
| | | vo.setSmsType("2"); |
| | | vo.setResCode("0"); |
| | | List<SmsResultVO> dxyjList = smsRecordClient.smsSuccessList(vo); |
| | | |
| | | HashMap<String,String> over10Params = new HashMap<>(); |
| | | //small_start_stag=0&small_end_stag=2&mid_start_stag=0&mid_end_stag=2&big_start_stag=0&big_end_stag=2 |
| | |
| | | List<TotalInfo> totalOver10List = sjztmdService.getTotalOverInfo(isShow,over10Params); |
| | | byte[] data = null; |
| | | if (MyDateUtils.isTodayInFloodSeason()){ |
| | | data = WordUtil.GetOverInfo(totalList,dzkList,overDetailList,szInfoList); |
| | | data = WordUtil.GetOverInfo(totalList,dzkList,overDetailList,szInfoList,dxyjList); |
| | | }else { |
| | | data= WordUtil.GetNotInSeasonOverInfo(totalList,dzkList,overDetailList,szInfoList,totalOverList,totalOver10List); |
| | | |
| | |
| | | |
| | | |
| | | |
| | | import cn.gistack.alerts.sms.feign.ISmsRecordClient; |
| | | import cn.gistack.alerts.sms.vo.SmsResultVO; |
| | | import cn.gistack.sm.sjztmd.util.MyDateUtils; |
| | | import cn.gistack.sm.sjztmd.word.service.ISjztmdService; |
| | | import cn.gistack.sm.sjztmd.word.util.BriefReportUtil; |
| | |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.DateUtil; |
| | | import org.springframework.core.io.InputStreamResource; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.http.ResponseEntity; |
| | |
| | | import java.io.*; |
| | | import java.net.URLEncoder; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDate; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | |
| | | |
| | | private final ISjztmdService sjztmdService; |
| | | |
| | | private final ISmsRecordClient smsRecordClient; |
| | | @GetMapping(value = "/getBriefReport") |
| | | public R getBriefReport() { |
| | | //获取总览、大中库、明细数据 |
| | |
| | | List<OverDetail> overDetailList = sjztmdService.getOverDetailInfo(isShow); |
| | | List<SzInfo> szInfoList = sjztmdService.getSzInfo(isShow); |
| | | |
| | | //短信预警数量 |
| | | SmsResultVO vo = new SmsResultVO(); |
| | | // 获取当前日期 |
| | | LocalDate today = LocalDate.now(); |
| | | // 获取前一天日期 |
| | | LocalDate yesterday = today.minusDays(1); |
| | | // 格式化日期并打印 |
| | | DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); |
| | | vo.setStartTime(yesterday.format(formatter)); |
| | | vo.setEndTime(yesterday.format(formatter)); |
| | | vo.setSmsType("2"); |
| | | vo.setResCode("0"); |
| | | vo.setIsExport(1); |
| | | List<SmsResultVO> dxyjList = smsRecordClient.smsSuccessList(vo); |
| | | |
| | | HashMap<String,String> over10Params = new HashMap<>(); |
| | | //small_start_stag=0&small_end_stag=2&mid_start_stag=0&mid_end_stag=2&big_start_stag=0&big_end_stag=2 |
| | | over10Params.put("small_start_stag", "0.1"); |
| | |
| | | List<TotalInfo> totalOver10List = sjztmdService.getTotalOverInfo(isShow,over10Params); |
| | | byte[] data = null; |
| | | if (MyDateUtils.isTodayInFloodSeason()){ |
| | | data = WordUtil.GetOverInfo(totalList,dzkList,overDetailList,szInfoList); |
| | | data = WordUtil.GetOverInfo(totalList,dzkList,overDetailList,szInfoList,dxyjList); |
| | | }else { |
| | | data= WordUtil.GetNotInSeasonOverInfo(totalList,dzkList,overDetailList,szInfoList,totalOverList,totalOver10List); |
| | | |
| | |
| | | package cn.gistack.sm.sjztmd.word.util; |
| | | |
| | | import cn.gistack.alerts.sms.vo.SmsResultVO; |
| | | 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) throws Exception { |
| | | public static byte[] GetOverInfo(List<TotalInfo> totalList, List<DzkInfo> dzkList, List<OverDetail> overDetailList,List<SzInfo> szInfoList,List<SmsResultVO> dxyjList) throws Exception { |
| | | InputStream inputStream = WordUtil.class.getClassLoader().getResourceAsStream("word/doc/overFloodTemplate.docx"); |
| | | ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); |
| | | OverWord overWord = new OverWord(totalList, dzkList, overDetailList, szInfoList); |
| | | OverWord overWord = new OverWord(totalList, dzkList, overDetailList, szInfoList, dxyjList); |
| | | XWPFTemplate template = XWPFTemplate.compile(inputStream).render(createOverWordParam(overWord)); |
| | | template.write(outputStream); |
| | | outputStream.flush(); |
| | |
| | | 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()); |
| | | //不在汛期内 |
| | | if (!MyDateUtils.isTodayInFloodSeason()){ |
| | | params.put("全省水库超正常", overWord.getTotalOverNormalInfo()); |
| | |
| | | params.put("超正常中型水库详情", overWord.getOverNormalMidInfo()); |
| | | } |
| | | |
| | | //短信预警和外呼统计 |
| | | //短信预警 |
| | | |
| | | |
| | | //外呼统计 |
| | | |
| | | |
| | | return params; |
| | | } |
| | | |
| | |
| | | package cn.gistack.sm.sjztmd.word.vo; |
| | | |
| | | import cn.gistack.alerts.sms.vo.SmsResultVO; |
| | | import lombok.Data; |
| | | import org.springblade.core.tool.utils.DateUtil; |
| | | import org.springblade.core.tool.utils.ObjectUtil; |
| | |
| | | //超正常中型水库 |
| | | private String overNormalMidInfo; |
| | | |
| | | public OverWord(List<TotalInfo> totalList, List<DzkInfo> dzkList, List<OverDetail> overDetailList,List<SzInfo> szInfoList){ |
| | | private String smsResultInfo; |
| | | |
| | | public OverWord(List<TotalInfo> totalList, List<DzkInfo> dzkList, List<OverDetail> overDetailList,List<SzInfo> szInfoList,List<SmsResultVO> resultVOList){ |
| | | this.tm = new SimpleDateFormat("MM月dd日H时").format(new Date()); |
| | | this.hour = new SimpleDateFormat("H时").format(new Date()); |
| | | |
| | | formatTotalInfo(totalList); |
| | | formatDzkInfo(dzkList); |
| | | formatSzInfo(szInfoList); |
| | | formatSmsResultInfo(resultVOList); |
| | | } |
| | | |
| | | private void formatSmsResultInfo(List<SmsResultVO> resultVOList) { |
| | | int dxyjCount = 0; |
| | | for (SmsResultVO vo : resultVOList) { |
| | | int number = null == vo.getNumber()?0:vo.getNumber(); |
| | | dxyjCount = dxyjCount + number; |
| | | } |
| | | |
| | | String str = StringUtil.format("过去24小时内,发送水库短信预警{}条,抽查黄冈、襄阳、随州、荆门水库防汛责任人XX人次,应答率XX,责任人履职情况总体较好。", |
| | | dxyjCount); |
| | | this.smsResultInfo = str; |
| | | } |
| | | |
| | | public OverWord(List<TotalInfo> totalList, List<DzkInfo> dzkList, List<OverDetail> overDetailList,List<SzInfo> szInfoList,List<TotalInfo> totalOverList, List<TotalInfo> totalOver10List){ |