12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988 |
- package com.slibra.web.controller.business;
- import cn.hutool.core.date.DateUtil;
- import cn.hutool.http.HttpRequest;
- import cn.hutool.http.HttpUtil;
- import cn.hutool.poi.excel.ExcelReader;
- import cn.hutool.poi.excel.ExcelUtil;
- import com.alibaba.fastjson2.JSON;
- import com.alibaba.fastjson2.JSONArray;
- import com.alibaba.fastjson2.JSONObject;
- import com.slibra.business.domain.*;
- import com.slibra.business.mapper.*;
- import com.slibra.business.res.ChartBasic;
- import com.slibra.business.service.ITXinyiForecastComparisonService;
- import com.slibra.common.DecimalUtils;
- import com.slibra.common.core.domain.TXinyiDaily;
- import com.slibra.common.core.controller.BaseController;
- import com.slibra.common.enums.BusinessEnum;
- import com.slibra.common.utils.DateUtils;
- import com.slibra.common.utils.StringUtils;
- import com.slibra.quartz.task.AsyncTask;
- import com.slibra.quartz.task.RyTask;
- import lombok.extern.slf4j.Slf4j;
- import org.apache.ibatis.session.ExecutorType;
- import org.apache.ibatis.session.SqlSession;
- import org.apache.ibatis.session.SqlSessionFactory;
- import org.springframework.beans.BeanUtils;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.util.CollectionUtils;
- import org.springframework.web.bind.annotation.*;
- import java.io.File;
- import java.math.BigDecimal;
- import java.math.RoundingMode;
- import java.time.LocalDateTime;
- import java.time.format.DateTimeFormatter;
- import java.util.*;
- import static com.slibra.common.constant.MyConstants.*;
- import static com.slibra.common.constant.MyConstants.BigDecimal_100;
- import static com.slibra.common.enums.BusinessEnum.WarningCategoryEnum.CS_TP_YC;
- /**
- * 参数配置 信息操作处理
- *
- *
- */
- @Slf4j
- @RestController
- @RequestMapping("/test")
- public class HandleDataController extends BaseController
- {
- @Autowired
- private TXinyiIndustryMapper xinyiIndustryMapper;
- @Autowired
- private TXinyiDailyMapper xinyiDailyMapper;
- @Autowired
- private TXinyiLaboratoryMapper xinyiLaboratoryMapper;
- @Autowired
- private TXinyiRobotMapper xinyiRobotMapper;
- @Autowired
- private TXinyiNormConfigMapper xinyiNormConfigMapper;
- @Autowired
- private TXinyiCalculateMapper xinyiCalculateMapper;
- @Autowired
- private TXinyiBigTableHourMapper tXinyiBigTableHourMapper;
- @Autowired
- private TXinyiBigTableDayMapper tXinyiBigTableDayMapper;
- @Autowired
- private TXinyiBigTableMonthMapper tXinyiBigTableMonthMapper;
- @Autowired
- private SqlSessionFactory sqlSessionFactory;
- @Autowired
- private RyTask ryTask;
- @Autowired
- private AsyncTask asyncTask;
- @Autowired
- private ITXinyiForecastComparisonService xinyiForecastComparisonService;
- public static final String[] queryTags = {"信义污水厂JS_COD_Value","信义污水厂JS_PH_Value","信义污水厂JS_SS_Value","信义污水厂JS_ZL_Value","信义污水厂JS_ZA_Value","信义污水厂JS_AD_Value","信义污水厂JS_T_Value","信义污水厂进水泵房液位","信义污水厂出水瞬时流量","信义污水厂升级出水COD","信义污水厂升级出水PH","信义污水厂升级出水SS","信义污水厂升级出水TN","信义污水厂升级出水TP","信义污水厂升级出水氨氮","信义污水厂AIT202_Value","信义污水厂AIT203_Value","信义污水厂AIT207_Value","信义污水厂AIT206_Value","信义污水厂AIT209_Value","信义污水厂AIT210_Value","信义污水厂进水TDS","信义污水厂FT101_Value","信义污水厂SWCHHYHLB1_R_Value","信义污水厂SWCHHYHLB2_R_Value","信义污水厂SWCHHYHLB3_R_Value","信义污水厂SWCHHYHLB4_R_Value","信义污水厂SWCHHYHLB5_R_Value","信义污水厂SWCHHYHLB6_R_Value","信义污水厂SWCWNHLB1_R_Value","信义污水厂SWCWNHLB2_R_Value","信义污水厂SWCWNHLB3_R_Value","信义污水厂SWCWNHLB4_R_Value","信义污水厂SWCWNHLB5_R_Value","信义污水厂GFJ1_R_Value","信义污水厂GFJ2_R_Value","信义污水厂GFJ3_R_Value","信义污水厂GFJ4_R_Value","信义污水厂GFJ5_R_Value","信义污水厂GFJ6_R_Value","信义污水厂GFJ1_KQLL_Value","信义污水厂GFJ2_KQLL_Value","信义污水厂GFJ3_KQLL_Value","信义污水厂GFJ4_KQLL_Value","信义污水厂GFJ5_KQLL_Value","信义污水厂GFJ6_KQLL_Value"};
- public static final String[] predictorArr = {"出水COD", "出水SS", "出水总磷", "出水氨氮", "xsy1", "xsy2"};
- /**
- *手动处理水质报警
- */
- @GetMapping("/waterWarning")
- public String waterWarning(){
- log.info("进入了 手动触发水质报警的 操作");
- //获取配置表
- List<TXinyiNormConfig> tXinyiNormConfigs = this.xinyiNormConfigMapper.selectTXinyiNormConfigList(null);
- if(CollectionUtils.isEmpty(tXinyiNormConfigs))
- throw new RuntimeException("未查询到配置信息");
- TXinyiNormConfig normConfig = tXinyiNormConfigs.get(0);
- TXinyiIndustry tXinyiIndustry = this.xinyiIndustryMapper.selectTXinyiIndustryNewest();
- if(Objects.isNull(tXinyiIndustry))
- throw new RuntimeException("未查询到工业库信息");
- asyncTask.handleSZWarning(tXinyiIndustry, normConfig);
- return "success";
- }
- /**
- *手动处理生化报警
- */
- @GetMapping("/shWarning")
- public String shWarning(){
- log.info("进入了 手动处理生化报警 操作");
- //获取配置表
- List<TXinyiNormConfig> tXinyiNormConfigs = this.xinyiNormConfigMapper.selectTXinyiNormConfigList(null);
- if(CollectionUtils.isEmpty(tXinyiNormConfigs))
- throw new RuntimeException("未查询到配置信息");
- TXinyiNormConfig normConfig = tXinyiNormConfigs.get(0);
- TXinyiIndustry tXinyiIndustry = this.xinyiIndustryMapper.selectTXinyiIndustryNewest();
- if(Objects.isNull(tXinyiIndustry))
- throw new RuntimeException("未查询到工业库信息");
- List<TXinyiCalculate> tXinyiCalculates = xinyiCalculateMapper.selectTXinyiCalculateList(TXinyiCalculate.builder().testHour(tXinyiIndustry.getTestHour()).build());
- if (!CollectionUtils.isEmpty(tXinyiCalculates)) {
- TXinyiCalculate tXinyiCalculate = tXinyiCalculates.get(0);
- asyncTask.handleSHWarning(tXinyiIndustry, normConfig, tXinyiCalculate);
- }
- return "success";
- }
- /**
- *手动处理化验室报警
- */
- @GetMapping("/robotWarning")
- public String robotWarning(){
- log.info("进入了 手动触发化验室报警的 操作");
- asyncTask.handleRobotWarning(this.xinyiRobotMapper.selectNRobot(1));
- return "success";
- }
- /**
- *手动处理预测报警
- */
- @GetMapping("/forecastWarning")
- public String forecastWarning(){
- log.info("进入了 手动触发预测报警的 操作");
- //获取最新的6条工业科数据
- List<TXinyiIndustry> tXinyiIndustries6 = this.xinyiIndustryMapper.selectNIndustry(INT_6);
- List<TXinyiRobot> tXinyiRobots6 = this.xinyiRobotMapper.selectNRobot(INT_6);
- //2024年7月18日10:31:18 加个校验,只有从来没有数据的水厂才会进入下面的判断
- if(CollectionUtils.isEmpty(tXinyiIndustries6) || tXinyiIndustries6.size() < INT_6
- || CollectionUtils.isEmpty(tXinyiRobots6) || tXinyiRobots6.size() <INT_6){
- log.error("预测的时候,获取最新的6条工业数据或者化验数据不满足,任务终止,工业数据为{}\n化验数据为{}", JSON.toJSONString(tXinyiIndustries6), JSON.toJSONString(tXinyiRobots6));
- return "预测的时候,获取最新的6条工业数据或者化验数据不满足,任务终止";
- }
- //先处理xsy1 和 xsy2 合并成一个数据
- // this.predictorSpecial(tXinyiIndustries6, tXinyiRobots6);
- //2024年7月11日16:55:27 xsy1 和 xsy2 又不合并了。。。 再次分开处理
- for (int i = 0; i < predictorArr.length; i++) {
- String result = ryTask.getPredictor(predictorArr[i]);
- if(StringUtils.isBlank(result) || "error".equals(result)){
- log.info("预测数据返回结果不符合解析条件,返回结果为{}", result);
- continue;
- }
- JSONObject jsonObject = null;
- try {
- jsonObject = JSON.parseObject(result);
- } catch (Exception e) {
- log.error("[转JSON的时候]预测数据返回结果不符合解析条件,返回结果为{}", result);
- continue;
- }
- log.info("^^^^^^^^^^^^^预测接口转弯JSON对象后,原内容是{}", JSON.toJSONString(jsonObject));
- //2024年7月8日15:25:51 加个校验 因为各种奇葩返回。。 比如返回的结果是 "null"
- if(Objects.isNull(jsonObject)){
- log.error("[转JSON的时候]预测数据返回结果是null,不处里");
- continue;
- }
- String task = jsonObject.getString("task");
- String hour = jsonObject.getString("hour");
- String pred = jsonObject.getString("pred");
- String date = jsonObject.getString("date");
- if(StringUtils.isNotBlank(pred) && pred.contains(",")){
- String[] split = pred.split(",");
- if(split.length != 3){
- log.error("预测数据返回结果为{},长度不是3,无法正常解析", result);
- //因为部分预测还不支持 所以不需要
- // ryTask.handleXinYiWarningsYC(cscodBzz, split, cscodGkz, BusinessEnum.WarningCategoryEnum.CS_COD_YC.getCode(), hour, normConfig);
- continue;
- }
- //解析数据 处理报警 调研prompt 保存等
- this.handlePredictorWarning(split, hour, task, tXinyiIndustries6, tXinyiRobots6, date);
- }else {
- log.error("预测数据返回结果为{},无法正常解析", result);
- }
- }
- return "success";
- }
- @GetMapping("/dateAdd")
- public String dateAdd() {
- // 给定时间段的起始时间和结束时间
- LocalDateTime startTime = LocalDateTime.parse("2024-04-13T16:00:00");
- LocalDateTime endTime = LocalDateTime.parse("2024-04-13T17:00:00");
- /*LocalDateTime startTime = LocalDateTime.parse("2024-02-26T00:00:00");
- LocalDateTime endTime = LocalDateTime.parse("2024-02-27T00:00:00");*/
- // 每个小时的时间格式
- DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
- // 循环按小时分割
- LocalDateTime currentHour = startTime;
- while (currentHour.isBefore(endTime)) {
- String begin = currentHour.format(formatter);
- String end = currentHour.plusMinutes(10).format(formatter);
- // 输出当前小时的起始时间和结束时间
- System.out.println("起始时间:" + begin);
- System.out.println("结束时间:" + end);
- // 当前小时加一小时,作为下一个小时的起始时间
- currentHour = currentHour.plusMinutes(10);
- //每个小时查询一次数据
- String url = "http://10.0.0.27:4568/api/v1/khquerydata";
- HashMap<String, Object> req = new HashMap<>();
- req.put("tagNames", queryTags);
- req.put("startTime", begin);
- req.put("endTime", end);
- req.put("recordNumbers", 100000);
- String body = HttpRequest.post(url).header("Authorization", "c2E6c2E=").header("clientName", "hongshan").body(JSON.toJSONString(req)).execute().body();
- // System.out.println("body = " + body);
- List<HashMap<String, String>> list = new ArrayList<>();
- //行转列数据处理
- for (String queryTag : queryTags) {
- JSONArray array = JSON.parseObject(body).getJSONArray(queryTag);
- //特殊数据处理一
- if(Objects.isNull(array) || array.isEmpty()){
- System.out.println(queryTag + "查询到了空的数据,跳过本次循环");
- continue;
- }
- int size = array.size();
- //特殊数据处理二
- if("0".equals(array.get(1) + "")){
- System.out.println(queryTag + "查询到了数据,但是数据集合只有一条,且都是0");
- continue;
- }
- //结合至少62个数据才满足条件(有可能获取不到)
- /*if(size < 62){
- System.out.println(queryTag + "查询到了不符合条件的数据,跳过本次循环");
- continue;
- }*/
- //存放的数据集
- //利用map去重
- HashMap<String, String> map = new LinkedHashMap<>();
- for (int i = 2; i < size; i++) {
- // System.out.println(i + "" + array.get(i));
- JSONArray oneRecord = JSON.parseArray(JSON.toJSONString(array.get(i)));
- //处理为空或者为0的数据
- Object timeStampValue = oneRecord.get(2);
- if(Objects.isNull(timeStampValue) || "0".equals(timeStampValue + ""))
- continue;
- BigDecimal value = Objects.isNull(oneRecord.get(0)) ? null : new BigDecimal(oneRecord.get(0) + "");
- long timestamp = (long) timeStampValue;
- String format = DateUtil.format(new Date(timestamp), DateUtils.YYYYMMDDHH_TS);
- map.put(format, queryTag + "-" + value);
- }
- list.add(map);
- }
- // System.out.println("list = " + list);
- //先构造对象(list中任意一个map遍历的key个数) 因为合并完并不是1分钟60条,参考上面筛选区间,有时候会有几个值获取不到
- /*HashMap<String, String> oneRow = list.get(0);
- Set<String> set = oneRow.keySet();
- List<Industry> result = new ArrayList<>(set.size());
- set.forEach(s -> {
- Industry industry = new Industry();
- industry.setTestTime(s);
- result.add(industry);
- });*/
- Set<String> recordTimeSet = new HashSet<>();
- Map<String, TXinyiIndustry> recordMap = new HashMap<>();
- for (int i = 0; i < list.size(); i++) {
- HashMap<String, String> map = list.get(i);
- int finalJ = i;
- map.forEach((k, v) ->{
- TXinyiIndustry industry = null;
- if(!recordTimeSet.contains(k)){//第一次
- industry = new TXinyiIndustry();
- recordTimeSet.add(k);
- recordMap.put(k, industry);
- }else{
- industry = recordMap.get(k);
- }
- industry.setTestTime(k);
- //2024年4月15日11:19:52 额外增加2个字段
- industry.setTestDate(k.substring(0,10));
- industry.setTestHour(k.substring(0,13));
- //解析值
- String[] split = v.split("-");
- String type = split[0];
- BigDecimal value = new BigDecimal(split[1]);
- if ("信义污水厂JS_COD_Value".equals(type)) {
- industry.setJsCod(value);
- } else if ("信义污水厂JS_PH_Value".equals(type)) {
- industry.setJsPh(value);
- } else if ("信义污水厂JS_SS_Value".equals(type)) {
- industry.setJsSs(value);
- } else if ("信义污水厂JS_ZL_Value".equals(type)) {
- industry.setJsTp(value);
- } else if ("信义污水厂JS_ZA_Value".equals(type)) {
- industry.setJsTn(value);
- } else if ("信义污水厂JS_AD_Value".equals(type)) {
- industry.setJsNh3(value);
- } else if ("信义污水厂JS_T_Value".equals(type)) {
- industry.setJsSwPh(value);
- } else if ("信义污水厂进水泵房液位".equals(type)) {
- industry.setJsBfyw(value);
- } else if ("信义污水厂出水瞬时流量".equals(type)) {
- industry.setCsSlqc(value);
- } else if ("信义污水厂升级出水COD".equals(type)) {
- industry.setCsCod(value);
- } else if ("信义污水厂升级出水PH".equals(type)) {
- industry.setCsPh(value);
- } else if ("信义污水厂升级出水SS".equals(type)) {
- industry.setCsSs(value);
- } else if ("信义污水厂升级出水TN".equals(type)) {
- industry.setCsTn(value);
- } else if ("信义污水厂升级出水TP".equals(type)) {
- industry.setCsTp(value);
- } else if ("信义污水厂升级出水氨氮".equals(type)) {
- industry.setCsNh3(value);
- } else if ("信义污水厂AIT202_Value".equals(type)) {
- industry.setOneHyzdDo(value);
- } else if ("信义污水厂AIT203_Value".equals(type)) {
- industry.setOneHymdDo(value);
- } else if ("信义污水厂AIT207_Value".equals(type)) {
- industry.setTwoHyzdDo(value);
- } else if ("信义污水厂AIT206_Value".equals(type)) {
- industry.setTwoHymdDo(value);
- } else if ("信义污水厂AIT209_Value".equals(type)) {
- industry.setOneMlss(value);
- } else if ("信义污水厂AIT210_Value".equals(type)) {
- industry.setTwoMlss(value);
- } else if ("信义污水厂进水TDS".equals(type)) {
- industry.setJsTds(value);
- } else if ("信义污水厂FT101_Value".equals(type)) {
- industry.setJsSlq(value);
- } else if ("信义污水厂SWCHHYHLB1_R_Value".equals(type)) {
- industry.setNHlbOneGp(value);
- } else if ("信义污水厂SWCHHYHLB2_R_Value".equals(type)) {
- industry.setNHlbTwoGp(value);
- } else if ("信义污水厂SWCHHYHLB3_R_Value".equals(type)) {
- industry.setNHlbThreeGp(value);
- } else if ("信义污水厂SWCHHYHLB4_R_Value".equals(type)) {
- industry.setNHlbFourGp(value);
- } else if ("信义污水厂SWCHHYHLB5_R_Value".equals(type)) {
- industry.setNhlBFiveGp(value);
- } else if ("信义污水厂SWCHHYHLB6_R_Value".equals(type)) {
- industry.setNHlbSixGp(value);
- } else if ("信义污水厂SWCWNHLB1_R_Value".equals(type)) {
- industry.setWHlbOneGp(value);
- } else if ("信义污水厂SWCWNHLB2_R_Value".equals(type)) {
- industry.setWHlbTwoGp(value);
- } else if ("信义污水厂SWCWNHLB3_R_Value".equals(type)) {
- industry.setWHlbThreeGp(value);
- } else if ("信义污水厂SWCWNHLB4_R_Value".equals(type)) {
- industry.setWHlbFourGp(value);
- } else if ("信义污水厂SWCWNHLB5_R_Value".equals(type)) {
- industry.setWHlbFiveGp(value);
- } else if ("信义污水厂GFJ1_R_Value".equals(type)) {
- industry.setFjOne(value);
- } else if ("信义污水厂GFJ2_R_Value".equals(type)) {
- industry.setFjTwo(value);
- } else if ("信义污水厂GFJ3_R_Value".equals(type)) {
- industry.setFjThree(value);
- } else if ("信义污水厂GFJ4_R_Value".equals(type)) {
- industry.setFjFour(value);
- } else if ("信义污水厂GFJ5_R_Value".equals(type)) {
- industry.setFjFive(value);
- } else if ("信义污水厂GFJ6_R_Value".equals(type)) {
- industry.setFjSix(value);
- } else if ("信义污水厂GFJ1_KQLL_Value".equals(type)) {
- industry.setKqllOne(value);
- } else if ("信义污水厂GFJ2_KQLL_Value".equals(type)) {
- industry.setKqllTwo(value);
- } else if ("信义污水厂GFJ3_KQLL_Value".equals(type)) {
- industry.setKqllThree(value);
- } else if ("信义污水厂GFJ4_KQLL_Value".equals(type)) {
- industry.setKqllFour(value);
- } else if ("信义污水厂GFJ5_KQLL_Value".equals(type)) {
- industry.setKqllFive(value);
- } else if ("信义污水厂GFJ6_KQLL_Value".equals(type)) {
- industry.setKqllSix(value);
- }else if ("信义污水厂实际碳源加药量".equals(type)) {
- industry.setSJTYJLY(value);
- }else if ("信义污水厂除磷加药瞬时流量".equals(type)) {
- industry.setCLJYSSLL(value);
- }
- //只有最后一次才执行数据库添加
- if(finalJ == list.size()-1){
- //插入数据库
- xinyiIndustryMapper.insertTXinyiIndustry(industry);
- }
- });
- }
- }
- return "ok";
- }
- // @GetMapping("/dateUpdateCL")
- // public String dateUpdateCL() {
- // String fileName = "除磷加药瞬时流量";
- // //输入目录
- // ExcelReader reader = ExcelUtil.getReader("C:\\Users\\10109\\Desktop\\新程序\\" + fileName + ".xls");
- // //解析数据
- // List<List<Object>> readAll = reader.read();
- // if(!CollectionUtils.isEmpty(readAll)){
- // for (List<Object> objects : readAll) {
- // String time = "20" + objects.get(0) + " " + objects.get(1).toString().substring(0, 5);
- // System.out.println("time = " + time);
- // TXinyiIndustry uniqueTXinyiIndustry = this.xinyiIndustryMapper.getUniqueTXinyiIndustry(time);
- // if(!Objects.isNull(uniqueTXinyiIndustry)){
- // System.out.println(objects.get(2));
- // BigDecimal CLJYSSLL = Objects.isNull(objects.get(2)) ? null : new BigDecimal(String.valueOf(objects.get(2)));
- // uniqueTXinyiIndustry.setCLJYSSLL(CLJYSSLL);
- // this.xinyiIndustryMapper.updateTXinyiIndustry(uniqueTXinyiIndustry);
- // }
- // }
- // }
- // return "ok";
- // }
- //
- //
- // @GetMapping("/dateUpdateSJTY")
- // public String dateUpdateSJTY() {
- // String fileName = "信义污水厂实际碳源加药量";
- // //输入目录
- // ExcelReader reader = ExcelUtil.getReader("C:\\Users\\10109\\Desktop\\新程序\\" + fileName + ".xls");
- // //解析数据
- // List<List<Object>> readAll = reader.read();
- // if(!CollectionUtils.isEmpty(readAll)){
- // int i = 0;
- // for (List<Object> objects : readAll) {
- // String format = "";
- // if(objects.get(0) instanceof String){
- // System.out.println("----------是字符串类型的");
- // String time = ((String) objects.get(0));
- // System.out.println("time = " + time);
- // format = time.replaceAll("-", "/").substring(0, 16);
- // }else if (objects.get(0) instanceof cn.hutool.core.date.DateTime){
- // System.out.println("++++++++++是日期类型的");
- // cn.hutool.core.date.DateTime time = (DateTime) objects.get(0);
- // System.out.println("time = " + time);
- // format = DateUtil.format(time, DateUtils.YYYYMMDDHHMM_TS);
- // System.out.println("format = " + format);
- // }else {
- // System.out.println(JSON.toJSONString(objects));
- // format = "";
- // i++;
- // }
- // TXinyiIndustry uniqueTXinyiIndustry = this.xinyiIndustryMapper.getUniqueTXinyiIndustry(format);
- // if(!Objects.isNull(uniqueTXinyiIndustry)){
- // BigDecimal SJTYJLY = Objects.isNull(objects.get(1)) ? null : new BigDecimal(String.valueOf(objects.get(1)));
- // uniqueTXinyiIndustry.setSJTYJLY(SJTYJLY);
- // this.xinyiIndustryMapper.updateTXinyiIndustry(uniqueTXinyiIndustry);
- // }
- // }
- // System.out.println("i =" + i);
- // }
- // return "ok";
- // }
- //
- // //下面是新的 将一个小时的数据 更新到一个小时之内的所有的数据中
- // @GetMapping("/dateUpdateCLMinute")
- // public String dateUpdateCLMinute() {
- // String fileName = "除磷加药瞬时流量";
- // //输入目录
- // ExcelReader reader = ExcelUtil.getReader("C:\\Users\\10109\\Desktop\\新程序\\" + fileName + ".xls");
- // //解析数据
- // List<List<Object>> readAll = reader.read();
- // int i = 0;
- // if(!CollectionUtils.isEmpty(readAll)){
- // for (List<Object> objects : readAll) {
- // if(!Objects.isNull(objects.get(0)) && !Objects.isNull(objects.get(1))){
- // String beginTime = "20" + objects.get(0) + " " + objects.get(1).toString().substring(0, 5);
- // System.out.println("beginTime = " + beginTime);
- // String endTime = "20" + objects.get(0) + " " + objects.get(1).toString().substring(0, 3) + "59";
- // System.out.println("endTime = " + endTime);
- // //更新数据
- // System.out.println(objects.get(2));
- // //有特殊情况
- // if(Objects.isNull(objects.get(2)) || objects.get(2).toString().contains("-")){
- // System.out.println("存在特殊的情况,值包含-,不做更新");
- // i++;
- // }else{
- // this.xinyiIndustryMapper.updateTXinyiIndustryCLByBetweenTime(beginTime, endTime, new BigDecimal(String.valueOf(objects.get(2))));
- // }
- // }
- // }
- // }
- // System.out.println("i = " + i);
- // return "ok";
- // }
- //
- //
- // @GetMapping("/dateUpdateSJTYMinute")
- // public String dateUpdateSJTYMinute() {
- // String fileName = "信义污水厂实际碳源加药量";
- // //输入目录
- // ExcelReader reader = ExcelUtil.getReader("C:\\Users\\10109\\Desktop\\新程序\\" + fileName + ".xls");
- // //解析数据
- // List<List<Object>> readAll = reader.read();
- // if(!CollectionUtils.isEmpty(readAll)){
- // int i = 0;
- // for (List<Object> objects : readAll) {
- // String beginTime = "";
- // if(objects.get(0) instanceof String){
- // System.out.println("----------是字符串类型的");
- // String time = ((String) objects.get(0));
- //// System.out.println("time = " + time);
- // beginTime = time.replaceAll("-", "/").substring(0, 16);
- // }else if (objects.get(0) instanceof cn.hutool.core.date.DateTime){
- // System.out.println("++++++++++是日期类型的");
- // cn.hutool.core.date.DateTime time = (DateTime) objects.get(0);
- //// System.out.println("time = " + time);
- // beginTime = DateUtil.format(time, DateUtils.YYYYMMDDHHMM_TS);
- // System.out.println("beginTime = " + beginTime);
- // }else {
- // System.out.println(JSON.toJSONString(objects));
- // beginTime = "";
- // i++;
- // }
- // //endTime
- // String endTime = beginTime.substring(0, 14) + "59";
- // System.out.println("endTime = " + endTime);
- // //更新数据
- // BigDecimal sjtyjly = Objects.isNull(objects.get(1)) ? null : new BigDecimal(String.valueOf(objects.get(1)));
- // this.xinyiIndustryMapper.updateTXinyiIndustrySJByBetweenTime(beginTime, endTime, sjtyjly);
- // }
- // System.out.println("i =" + i);
- // }
- // return "ok";
- // }
- // @GetMapping("/dateUpdateSJTYMinute")
- // public String dateUpdateSJTYMinute() {
- // log.info("进入了手动处理两个值的操作~~~~~~~~");
- // File file = new File("/home/slibra/历史数据");
- // if(file.isDirectory()){
- // for (File listFile : file.listFiles()) {
- // // 输入目录
- // ExcelReader reader = ExcelUtil.getReader(listFile);
- // List<List<Object>> readAll = reader.read();
- // if(!CollectionUtils.isEmpty(readAll)){
- // for (int i = 3; i < readAll.size(); i++) {
- // //解析数据
- // List<Object> objects = readAll.get(i);
- // String time = "20" + objects.get(0).toString().replaceAll(" ", "") + " " + objects.get(1).toString().replaceAll(" ", "").substring(0, 5);
- //// System.out.println("time = " + time);
- // TXinyiIndustry uniqueTXinyiIndustry = this.xinyiIndustryMapper.getUniqueTXinyiIndustry(time);
- // if(!Objects.isNull(uniqueTXinyiIndustry)){
- // TXinyiIndustry updateBean = new TXinyiIndustry();
- // updateBean.setID(uniqueTXinyiIndustry.getID());
- // BigDecimal CLJYSSLL = Objects.isNull(objects.get(2)) || String.valueOf(objects.get(2)).contains("-") ? null : new BigDecimal(String.valueOf(objects.get(2)));
- // updateBean.setCLJYSSLL(CLJYSSLL);
- // BigDecimal SJTYJLY = Objects.isNull(objects.get(3)) || String.valueOf(objects.get(3)).contains("-") ? null : new BigDecimal(String.valueOf(objects.get(3)));
- // updateBean.setSJTYJLY(SJTYJLY);
- // //如果两个都不为空再更新
- // if(!Objects.isNull(CLJYSSLL) || !Objects.isNull(SJTYJLY)){
- // this.xinyiIndustryMapper.updateTXinyiIndustry(updateBean);
- // }else{
- // log.error("要更新的两个字段全部为空--------");
- // }
- // }
- // }
- // }
- // }
- // }
- // return "ok";
- // }
- /**
- *
- * 从Excel读取数据 将新增的列数据更新到新的日报字段中
- * @return
- */
- @GetMapping("/dailyAddDataByExcel")
- public String dailyAddDataByExcel() {
- log.info("从Excel读取数据 将新增的列数据更新到新的日报字段中~~~~~~~~");
- File file = new File("/home/slibra/绝干泥量.xlsx");
- // File file = new File("C:\\Users\\10109\\Documents\\WeChat Files\\mz1010995810\\FileStorage\\File\\2024-05\\绝干泥量.xlsx");
- // 输入目录
- ExcelReader reader = ExcelUtil.getReader(file);
- List<List<Object>> readAll = reader.read();
- // log.info("Excel解析的结果为{}", JSON.toJSONString(readAll));
- if(!CollectionUtils.isEmpty(readAll)){
- for (int i = 1; i < readAll.size(); i++) {
- //解析数据
- List<Object> objects = readAll.get(i);
- String date = (String) objects.get(0);
- date = date.replaceAll("\\.", "/");
- date = handleDate(date);
- //用时间去查询 如果存在就更新,否则跳过
- List<TXinyiDaily> tXinyiDailies = this.xinyiDailyMapper.selectTXinyiDailyList(TXinyiDaily.builder().testDate(date).build());
- if(CollectionUtils.isEmpty(tXinyiDailies)){
- log.error("没有查询到对应的历史数据,跳过~~~~~~{}", date);
- continue;
- }
- //目前集合就一个对象 以后可能会多个
- TXinyiDaily tXinyiDaily = tXinyiDailies.get(0);
- //出泥量
- Object o1 = objects.get(1);
- BigDecimal CHUNILIANG = null;
- if(o1 instanceof String){
- log.error("数据异常,解析为null");
- CHUNILIANG = null;
- }else if(o1 instanceof Double){
- CHUNILIANG = new BigDecimal((Double) o1);
- }else {
- log.error("错误的类型,不用解析了");
- CHUNILIANG = null;
- }
- //出泥含水率
- BigDecimal CNHSL = null;
- Object o2 = objects.get(2);
- if(o2 instanceof String){
- log.error("数据异常,解析为null");
- CNHSL = null;
- }else if(o2 instanceof Double){
- CNHSL = new BigDecimal((Double) o2);
- }else {
- log.error("错误的类型,不用解析了");
- CNHSL = null;
- }
- //干污泥量
- Object o3 = objects.get(3);
- BigDecimal GWNL = null;
- if(o3 instanceof String){
- log.error("数据异常,解析为null");
- GWNL = null;
- }else if(o3 instanceof Double){
- GWNL = new BigDecimal((Double) o3);
- }else {
- log.error("错误的类型,不用解析了");
- GWNL = null;
- }
- //更新数据
- tXinyiDaily.setCHUNILIANG(CHUNILIANG);
- tXinyiDaily.setCNHSL(CNHSL);
- tXinyiDaily.setGWNL(GWNL);
- this.xinyiDailyMapper.updateTXinyiDaily(tXinyiDaily);
- }
- }
- return "ok";
- }
- /**
- * 手动处理日报数据 增加两个字段 时间和小时
- * @return
- */
- @GetMapping("/dateUpdateDaily")
- public String dateUpdateDaily() {
- //获取全部数据
- List<TXinyiDaily> tXinyiDailies = this.xinyiDailyMapper.selectTXinyiDailyList(null);
- if(!CollectionUtils.isEmpty(tXinyiDailies)){
- for (TXinyiDaily tXinyiDaily : tXinyiDailies) {
- String handleTime = handleDate(tXinyiDaily.getTestTime());
- tXinyiDaily.setTestTime(handleTime);
- tXinyiDaily.setTestDate(handleTime);
- //更新
- this.xinyiDailyMapper.updateTXinyiDaily(tXinyiDaily);
- }
- }
- return "ok";
- }
- /**
- * 手动处理化验数据 增加两个字段 时间和小时
- * @return
- */
- @GetMapping("/dateUpdateHuaYan")
- public String dateUpdateHuaYan() {
- //获取全部数据
- List<TXinyiLaboratory> tXinyiLaboratories = this.xinyiLaboratoryMapper.selectTXinyiLaboratoryList(null);
- if(!CollectionUtils.isEmpty(tXinyiLaboratories)){
- for (TXinyiLaboratory tXinyiLaboratory : tXinyiLaboratories) {
- String handleTime = handleDate(tXinyiLaboratory.getTestTime());
- tXinyiLaboratory.setTestTime(handleTime);//到分为止
- tXinyiLaboratory.setTestDate(handleTime.substring(0, 10));
- tXinyiLaboratory.setTestHour(handleTime.substring(0, 13));
- //更新
- this.xinyiLaboratoryMapper.updateTXinyiLaboratory(tXinyiLaboratory);
- }
- }
- return "ok";
- }
- /**
- * 手动处理 工业库的 某个值,将历史数据全部都更新
- * @return
- */
- @GetMapping("/updateGYKSomeFields")
- public String updateGYKSomeFields() {
- //更新的某个指标
- String[] queryTags = {"信义污水厂_除磷P04预测值_"};
- //找到对应的数据,然后更新它
- // 给定时间段的起始时间和结束时间
- LocalDateTime startTime = LocalDateTime.parse("2022-07-01T00:00:00");
- LocalDateTime endTime = LocalDateTime.parse("2024-04-25T09:00:01");
- // 每个小时的时间格式
- DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
- // 循环按小时分割
- LocalDateTime currentHour = startTime;
- while (currentHour.isBefore(endTime)) {
- String begin = currentHour.format(formatter);
- String end = currentHour.plusDays(1).format(formatter);
- // 输出当前小时的起始时间和结束时间
- System.out.println("起始时间:" + begin);
- System.out.println("结束时间:" + end);
- // 当前小时加一小时,作为下一个小时的起始时间
- currentHour = currentHour.plusDays(1);
- //每个小时查询一次数据
- String url = "http://10.0.0.27:4568/api/v1/khquerydata";
- HashMap<String, Object> req = new HashMap<>();
- req.put("tagNames", queryTags);
- req.put("startTime", begin);
- req.put("endTime", end);
- req.put("recordNumbers", 100000);
- String body = HttpRequest.post(url).header("Authorization", "c2E6c2E=").header("clientName", "hongshan").body(JSON.toJSONString(req)).execute().body();
- // System.out.println("body = " + body);
- List<HashMap<String, String>> list = new ArrayList<>();
- //行转列数据处理
- for (String queryTag : queryTags) {
- JSONArray array = JSON.parseObject(body).getJSONArray(queryTag);
- //特殊数据处理一
- if(Objects.isNull(array) || array.isEmpty()){
- System.out.println(queryTag + "查询到了空的数据,跳过本次循环");
- continue;
- }
- int size = array.size();
- //特殊数据处理二
- if("0".equals(array.get(1) + "")){
- System.out.println(queryTag + "查询到了数据,但是数据集合只有一条,且都是0");
- continue;
- }
- //存放的数据集
- //利用map去重
- HashMap<String, String> map = new LinkedHashMap<>();
- for (int i = 2; i < size; i++) {
- // System.out.println(i + "" + array.get(i));
- JSONArray oneRecord = JSON.parseArray(JSON.toJSONString(array.get(i)));
- //处理为空或者为0的数据
- Object timeStampValue = oneRecord.get(2);
- if(Objects.isNull(timeStampValue) || "0".equals(timeStampValue + ""))
- continue;
- BigDecimal value = Objects.isNull(oneRecord.get(0)) ? null : new BigDecimal(oneRecord.get(0) + "");
- long timestamp = (long) timeStampValue;
- String format = DateUtil.format(new Date(timestamp), DateUtils.YYYYMMDDHH_TS);
- map.put(format, queryTag + "-" + value);
- }
- list.add(map);
- }
- Set<String> recordTimeSet = new HashSet<>();
- Map<String, TXinyiIndustry> recordMap = new HashMap<>();
- for (int i = 0; i < list.size(); i++) {
- HashMap<String, String> map = list.get(i);
- int finalJ = i;
- map.forEach((k, v) ->{
- TXinyiIndustry industry = null;
- if(!recordTimeSet.contains(k)){//第一次
- industry = new TXinyiIndustry();
- recordTimeSet.add(k);
- recordMap.put(k, industry);
- }else{
- industry = recordMap.get(k);
- }
- industry.setTestTime(k);
- //解析值
- String[] split = v.split("-");
- String type = split[0];
- BigDecimal value = new BigDecimal(split[1]);
- if ("信义污水厂_除磷P04预测值_".equals(type)) {
- industry.setCLP04YCZ(value);//目前值更新此字段
- }
- /*else if ("信义污水厂除磷加药瞬时流量".equals(type)) {
- industry.setCLJYSSLL(value);
- }*/
- //只有最后一次才执行数据库添加
- if(finalJ == list.size()-1){
- //先去查询数据库
- TXinyiIndustry uniqueTXinyiIndustry = this.xinyiIndustryMapper.getUniqueTXinyiIndustry(industry.getTestTime());
- if(Objects.isNull(uniqueTXinyiIndustry))
- log.error("查询到的工业库数据为null,化验时间为{}", industry.getTestTime());
- else {
- //防止其他信息被更新,新建对象
- TXinyiIndustry updateTXinyiIndustry = new TXinyiIndustry();
- //赋值
- updateTXinyiIndustry.setID(uniqueTXinyiIndustry.getID());
- updateTXinyiIndustry.setCLP04YCZ(industry.getCLP04YCZ());
- //更新数据库
- xinyiIndustryMapper.updateTXinyiIndustry(updateTXinyiIndustry);
- }
- }
- });
- }
- }
- return "ok";
- }
- /**
- * 手动处理 计算相关的数据,处理历史数据
- * @return
- */
- @GetMapping("/handleCalculateHistoryDates")
- public String handleCalculateHistoryDates() {
- log.info("进入了 手动处理-重置计算表历史数据");
- long begin = System.currentTimeMillis();
- List<TXinyiNormConfig> tXinyiNormConfigs = xinyiNormConfigMapper.selectTXinyiNormConfigList(null);
- if(CollectionUtils.isEmpty(tXinyiNormConfigs)) {
- log.error( "未查询到配置信息");
- return null;
- }
- TXinyiNormConfig normConfig = tXinyiNormConfigs.get(0);
- int size = 500;
- int count = xinyiIndustryMapper.getCount();
- int num = ( count / size ) + 1;
- for (int i = 0; i < num; i++) {
- List<TXinyiIndustry> tXinyiIndustries = xinyiIndustryMapper.selectTXinyiIndustryListByPage(i * size, size);
- List<TXinyiCalculate> tempInsertData = new ArrayList<>();
- if (!CollectionUtils.isEmpty( tXinyiIndustries )) {
- for (int j = 0; j < tXinyiIndustries.size(); j++) {
- TXinyiIndustry tXinyiIndustry = tXinyiIndustries.get(j);
- //获取的一些配置信息
- BigDecimal nhlbqdsl = normConfig.getNHLBQDSL();
- BigDecimal nhlbdsjll = normConfig.getNHLBDSJLL();
- BigDecimal nhlbgzxl = normConfig.getNHLBGZXL();
- BigDecimal whlbqdsl = normConfig.getWHLBQDSL();
- BigDecimal whlbdsjll = normConfig.getWHLBDSJLL();
- BigDecimal whlbgzxl = normConfig.getWHLBGZXL();
- BigDecimal gfjgzts = normConfig.getGFJGZTS();
- BigDecimal gfjckll = normConfig.getGFJCKLL();
- BigDecimal fcxbsjll = normConfig.getFCXBSJLL();
- BigDecimal fclbsl = normConfig.getFCLBSL();
- BigDecimal fcxbgzxl = normConfig.getFCXBGZXL();
- //结算结果
- TXinyiCalculate tXinyiCalculate = new TXinyiCalculate();
- //时间相关
- tXinyiCalculate.setTestDate(tXinyiIndustry.getTestDate());
- tXinyiCalculate.setTestHour(tXinyiIndustry.getTestHour());
- tXinyiCalculate.setTestTime(tXinyiIndustry.getTestTime());
- //获取最新的一条日报信息
- TXinyiDaily tXinyiDaily = this.xinyiDailyMapper.getDetailByDay(tXinyiIndustry.getTestDate());
- if(Objects.isNull(tXinyiDaily)){
- //理论不会出现
- log.error("没有日报数据,取最新的");
- tXinyiDaily = this.xinyiDailyMapper.selectNewestData();
- }
- BigDecimal jsBod5 = tXinyiDaily.getJsBod5();
- BigDecimal csBod5 = tXinyiDaily.getCsBod5();
- BigDecimal whlR = tXinyiDaily.getWhlR();
- BigDecimal oneMlvss = tXinyiDaily.getShcHyOneMlvss();
- BigDecimal twoMlvss = tXinyiDaily.getShcHyTwoMlvss();
- BigDecimal avgMlvss = null;
- if(!Objects.isNull(oneMlvss) && !Objects.isNull(twoMlvss))
- avgMlvss = ((oneMlvss.add(twoMlvss)).divide(new BigDecimal(2),4, RoundingMode.HALF_UP));
- BigDecimal oneMlss = tXinyiDaily.getShcHyOneMlss();
- BigDecimal twoMlss = tXinyiDaily.getShcHyTwoMlss();
- BigDecimal avgMlss = null;
- if(!Objects.isNull(oneMlss) && !Objects.isNull(twoMlss))
- avgMlss = ((oneMlss.add(twoMlss)).divide(new BigDecimal(NUMBER_2),NUMBER_SCALE_4, RoundingMode.HALF_UP));
- //工业库的指标
- BigDecimal jsTn = tXinyiIndustry.getJsTn();
- BigDecimal jsTp = tXinyiIndustry.getJsTp();
- BigDecimal jsCod = tXinyiIndustry.getJsCod();
- BigDecimal jsSlq = tXinyiIndustry.getJsSlq();
- //计算
- if(!Objects.isNull(jsBod5)){
- if(!Objects.isNull(jsTn) && jsTn.compareTo(BigDecimal.ZERO) > 0)
- tXinyiCalculate.setJsTdb(jsBod5.divide(jsTn, NUMBER_SCALE_4, RoundingMode.HALF_UP));
- if(!Objects.isNull(jsTp) && jsTp.compareTo(BigDecimal.ZERO) > 0)
- tXinyiCalculate.setJsTlb(jsBod5.divide(jsTp, NUMBER_SCALE_4, RoundingMode.HALF_UP));
- if(!Objects.isNull(jsCod) && jsCod.compareTo(BigDecimal.ZERO) > 0)
- tXinyiCalculate.setJsBodBCod(jsBod5.divide(jsCod, NUMBER_SCALE_4, RoundingMode.HALF_UP));
- if(!Objects.isNull(csBod5) && !Objects.isNull(avgMlss) && avgMlss.compareTo(BigDecimal.ZERO) > 0 && !Objects.isNull(jsSlq) && jsSlq.compareTo(BigDecimal.ZERO) > 0)
- tXinyiCalculate.setFM(new BigDecimal(ONE_DAY_HOURS).multiply((jsBod5.subtract(csBod5))).multiply(jsSlq).divide(avgMlss, NUMBER_SCALE_4, RoundingMode.HALF_UP).divide(new BigDecimal(F_M_LAST), NUMBER_SCALE_4, RoundingMode.HALF_UP));
- }
- if(!Objects.isNull(avgMlss) && avgMlss.compareTo(BigDecimal.ZERO) > 0 && !Objects.isNull(avgMlvss) && avgMlvss.compareTo(BigDecimal.ZERO) > 0)
- tXinyiCalculate.setHFXWNNDZB(avgMlvss.divide(avgMlss, NUMBER_SCALE_4, RoundingMode.HALF_UP));
- if(!Objects.isNull(jsSlq) && jsSlq.compareTo(BigDecimal.ZERO) > 0){
- tXinyiCalculate.setYyqHrt(new BigDecimal(YYQ_TLSJ_FIRST).divide(jsSlq, NUMBER_SCALE_4, RoundingMode.HALF_UP));
- tXinyiCalculate.setQyqHrt(new BigDecimal(QYQ_TLSJ_FIRST).divide(jsSlq, NUMBER_SCALE_4, RoundingMode.HALF_UP));
- tXinyiCalculate.setHyqHrt(new BigDecimal(HYQ_TLSJ_FIRST).divide(jsSlq, NUMBER_SCALE_4, RoundingMode.HALF_UP));
- // tXinyiCalculate.setGSLS(jsSlq.divide(new BigDecimal(NUMBER_3600), NUMBER_SCALE_4, RoundingMode.HALF_UP).multiply(new BigDecimal(NUMBER_4)).divide((new BigDecimal(Math.PI).multiply(new BigDecimal(NUMBER_0_0_0_3)).multiply(new BigDecimal(NUMBER_0_0_0_3)).multiply(new BigDecimal(NUMBER_4)).multiply(new BigDecimal(NUMBER_4)).multiply(new BigDecimal(NUMBER_97119))) , NUMBER_SCALE_4, RoundingMode.HALF_UP));
- tXinyiCalculate.setGSLS(jsSlq.divide(GSLS_LAST, NUMBER_SCALE_4, RoundingMode.HALF_UP));
- tXinyiCalculate.setGslsOne(jsSlq.divide(new BigDecimal(NUMBER_3600), NUMBER_SCALE_4, RoundingMode.HALF_UP).multiply(new BigDecimal(Math.sqrt(Math.sin(Math.toRadians(DOUBLE_75))))).divide(GSLSONE_LAST, NUMBER_SCALE_4, RoundingMode.HALF_UP));
- tXinyiCalculate.setGslsTwo(jsSlq.divide(new BigDecimal(NUMBER_3600), NUMBER_SCALE_4, RoundingMode.HALF_UP).multiply(new BigDecimal(Math.sqrt(Math.sin(Math.toRadians(DOUBLE_75))))).divide(GSLSTWO_LAST, NUMBER_SCALE_4, RoundingMode.HALF_UP));
- tXinyiCalculate.setXgsGsls(jsSlq.divide(new BigDecimal(NUMBER_3600), NUMBER_SCALE_4, RoundingMode.HALF_UP).multiply(new BigDecimal(NUMBER_4)).divide((GSLS_XGS_LAST) , NUMBER_SCALE_4, RoundingMode.HALF_UP));
- tXinyiCalculate.setXlcscBmfh(jsSlq.divide(XLCSCBMFH_LAST, NUMBER_SCALE_4, RoundingMode.HALF_UP));
- tXinyiCalculate.setXlcscHrt(XLCSCHRT_LAST.divide(jsSlq, NUMBER_SCALE_4, RoundingMode.HALF_UP));
- tXinyiCalculate.setCccdcBmfh(jsSlq.divide(CCCDCBMFH_LAST, NUMBER_SCALE_4, RoundingMode.HALF_UP));
- tXinyiCalculate.setCccdcHrt(CCCDCHRT_LAST.divide(jsSlq, NUMBER_SCALE_4, RoundingMode.HALF_UP));
- tXinyiCalculate.setEccBmfh(jsSlq.divide(ECCBMFH_LAST, NUMBER_SCALE_4, RoundingMode.HALF_UP));
- tXinyiCalculate.setEccHrt(ECCHRT_LAST.divide(jsSlq, NUMBER_SCALE_4, RoundingMode.HALF_UP));
- //2024年7月1日17:16:16 计算逻辑调整
- if(!Objects.isNull(whlR) && avgMlss != null && jsSlq != null) {
- tXinyiCalculate.setEccGtfh((new BigDecimal(1).add(whlR.divide(BigDecimal_100, NUMBER_SCALE_4, RoundingMode.HALF_UP))).multiply(jsSlq).multiply(new BigDecimal(NUMBER_24)).multiply(avgMlss).divide(ECCGTFH_LAST, NUMBER_SCALE_4, RoundingMode.HALF_UP));
- }
- tXinyiCalculate.setClsnJcsj(CLSNJCSJ_LAST.divide(jsSlq, NUMBER_SCALE_4, RoundingMode.HALF_UP));
- tXinyiCalculate.setXgcdcQsqSsls(jsSlq.multiply(XGCDCQSQSSLS_LAST));
- //2024年6月29日15:18:01 增加几个新的计算指标
- if(!Objects.isNull(nhlbqdsl) && !Objects.isNull(nhlbdsjll) && !Objects.isNull(nhlbgzxl))
- tXinyiCalculate.setNHLB(nhlbqdsl.multiply(nhlbdsjll).multiply(nhlbgzxl).multiply(BigDecimal_100).divide(jsSlq, 4, RoundingMode.HALF_UP));
- if(!Objects.isNull(whlbqdsl) && !Objects.isNull(whlbdsjll) && !Objects.isNull(whlbgzxl))
- tXinyiCalculate.setWHLB(whlbqdsl.multiply(whlbdsjll).multiply(whlbgzxl).multiply(BigDecimal_100).divide(jsSlq, 4, RoundingMode.HALF_UP));
- if(!Objects.isNull(gfjgzts) && !Objects.isNull(gfjckll))
- tXinyiCalculate.setQSB(gfjgzts.multiply(gfjckll).divide(jsSlq, NUMBER_SCALE_4, RoundingMode.HALF_UP));
- if(!Objects.isNull(fcxbsjll) && !Objects.isNull(fclbsl) && !Objects.isNull(fcxbgzxl)){
- BigDecimal fcxsl = fcxbsjll.multiply(fclbsl).multiply(fcxbgzxl);
- tXinyiCalculate.setFCXSL(fcxsl);
- //2024年7月3日10:54:28 额外再增加一个字段
- tXinyiCalculate.setFCXSLBL(fcxsl.divide(jsSlq, NUMBER_SCALE_4, RoundingMode.HALF_UP).multiply(BigDecimal_100));
- }
- //2024年7月11日15:43:47 之前给的外回流比计算不准确,额外一个字段记录新的外回流比
- BigDecimal divide = jsSlq.divide(DECIMAL_2, NUMBER_SCALE_4, RoundingMode.HALF_UP);
- if(divide.compareTo(DECIMAL_1500) < 0)
- tXinyiCalculate.setWhlRN(DECIMAL_1200.divide(divide, NUMBER_SCALE_4, RoundingMode.HALF_UP).multiply(BigDecimal_100));
- else
- tXinyiCalculate.setWhlRN(DECIMAL_1620.divide(divide, NUMBER_SCALE_4, RoundingMode.HALF_UP).multiply(BigDecimal_100));
- }
- tempInsertData.add(tXinyiCalculate);
- xinyiCalculateMapper.insertTXinyiCalculate(tXinyiCalculate);
- }
- // xinyiCalculateMapper.insertBatchData(tempInsertData);
- // return tXinyiCalculate;
- }
- }
- long end = System.currentTimeMillis();
- return "ok;耗时:" + (end - begin) /1000 + "秒。";
- }
- public void main(String[] args) {
- // handleBigTableDayHistoryData();
- // HandleDataController handleDataController = new HandleDataController();
- //
- // handleDataController.handleBigTableDayHistoryData();
- // File file = new File("C:\\Users\\10109\\Desktop\\新程序\\历史数据");
- // if(file.isDirectory()){
- // for (File listFile : file.listFiles()) {
- //// System.out.println(listFile.getName());
- // ExcelReader reader = ExcelUtil.getReader(listFile);
- // List<List<Object>> readAll = reader.read();
- // for (int i = 3; i < 10; i++) {
- // System.out.println(readAll.get(i));
- // }
- // System.out.println("------------------");
- // }
- // }
- String str = "2022/07/11 19:00";
- // String str = "2022/7/1";
- // String str = "0:0:1";
- // String newStr = handleDate(str);
- // System.out.println(newStr);
- // System.out.println(str.substring(0, 12));
- // System.out.println(str.substring(0, 9));
- // System.out.println(handleDate("2024-3-9"));
- System.out.println(handleDate("2023/12/26 02:00"));
- System.out.println(handleDate("2023/12/26 02:00").substring(0, 10));
- System.out.println(handleDate("2023/12/26 02:00").substring(0, 13));
- }
- public static String handleDate(String str){
- StringBuilder sb = new StringBuilder();
- if(str.contains(" ")){//包含空格 就是年月日时分秒了
- String[] split = str.split(" ");
- addBeforeZero(sb, split[0], "/");
- sb.append(" ");
- addBeforeZero(sb, split[1], ":");
- }else{
- if(str.contains("/")){//年月日
- addBeforeZero(sb, str, "/");
- }else if(str.contains(":")){//时分秒
- addBeforeZero(sb, str, ":");
- }else if(str.contains("-")){//只有年月日
- addBeforeZero(sb, str, "-");
- }else {
- sb.append(str);
- }
- }
- return sb.toString();
- }
- public static StringBuilder addBeforeZero(StringBuilder sb, String str, String tag){
- String[] split = str.split(tag);
- int length = split.length;
- for (int i = 0; i < length; i++) {
- String value = split[i];
- Integer intValue = Integer.parseInt(value);
- if(intValue < 10 && value.length() == 1){////防止有正确的情况 额外再补充字符串
- sb.append(0).append(value);
- }else{
- sb.append(value);
- }
- if(i < length-1){
- sb.append(tag);
- }
- }
- return sb;
- }
- public BigDecimal getListAvg (Collection<BigDecimal> bigDecimals) {
- if (bigDecimals.isEmpty()) {
- return null;
- }
- BigDecimal sum = bigDecimals.stream()
- .reduce(BigDecimal.ZERO, BigDecimal::add);
- int size = bigDecimals.size();
- return sum.divide(new BigDecimal(size), 6, RoundingMode.HALF_UP);
- }
- public String formatList(List<BigDecimal> list) {
- if (CollectionUtils.isEmpty(list)) {
- return null;
- }
- boolean isNullList = list.stream().allMatch(x -> x == null);
- return isNullList ? null : list.toString();
- }
- /**
- * 处理big_table_month历史数据
- * @return
- */
- @GetMapping("/handleBigTableMonthHistoryData")
- public String handleBigTableMonthHistoryData() {
- log.info("进入了处理big_table_month历史数据");
- long begin = System.currentTimeMillis();
- List<TXinyiBigTableMonth> tXinyiBigTableDayList = tXinyiBigTableDayMapper.selectTXinyiBigTableDayByMonthAvg();
- if ( !CollectionUtils.isEmpty(tXinyiBigTableDayList) ) {
- for (int i = 0; i < tXinyiBigTableDayList.size(); i++) {
- TXinyiBigTableMonth tableMonth = tXinyiBigTableDayList.get(i);
- ArrayList<BigDecimal> gyHycRjyAll = new ArrayList<>();
- ArrayList<BigDecimal> gyHycRjyZdAll = new ArrayList<>();
- ArrayList<BigDecimal> gyHycWnndAll = new ArrayList<>();
- ArrayList<BigDecimal> rbHycRjyAll = new ArrayList<>();
- ArrayList<BigDecimal> rbHycWnndAll = new ArrayList<>();
- ArrayList<BigDecimal> rbYycRjyAll = new ArrayList<>();
- ArrayList<BigDecimal> rbQycRjyAll = new ArrayList<>();
- ArrayList<BigDecimal> rbWncjbAll = new ArrayList<>();
- ArrayList<BigDecimal> rbWntjzsAll = new ArrayList<>();
- ArrayList<BigDecimal> rbHfxwnndAll = new ArrayList<>();
- ArrayList<BigDecimal> hyHycxsyAll = new ArrayList<>();
- ArrayList<BigDecimal> hyQyanAll = new ArrayList<>();
- ArrayList<BigDecimal> hyQyckxsyAll = new ArrayList<>();
- ArrayList<BigDecimal> hyHyzlsyAll = new ArrayList<>();
- gyHycRjyAll.add(tableMonth.getGyOneHymdDo());
- gyHycRjyAll.add(tableMonth.getGyTwoHymdDo());
- gyHycRjyZdAll.add(tableMonth.getGyOneHyzdDo());
- gyHycRjyZdAll.add(tableMonth.getGyTwoHyzdDo());
- gyHycWnndAll.add(tableMonth.getGyOneMlss());
- gyHycWnndAll.add(tableMonth.getGyTwoMlss());
- rbHycRjyAll.add(tableMonth.getRbShcHyOneDo());
- rbHycRjyAll.add(tableMonth.getRbShcHyTwoDo());
- rbHycWnndAll.add(tableMonth.getRbShcHyOneMlss());
- rbHycWnndAll.add(tableMonth.getRbShcHyTwoMlss());
- rbYycRjyAll.add(tableMonth.getRbShcYyOneDo());
- rbYycRjyAll.add(tableMonth.getRbShcYyTwoDo());
- rbQycRjyAll.add(tableMonth.getRbShcQyOneDo());
- rbQycRjyAll.add(tableMonth.getRbShcQyTwoDo());
- rbWncjbAll.add(tableMonth.getRbShcHyOneSv());
- rbWncjbAll.add(tableMonth.getRbShcHyTwoSv());
- rbWntjzsAll.add(tableMonth.getRbShcHyOneSvi());
- rbWntjzsAll.add(tableMonth.getRbShcHyTwoSvi());
- rbHfxwnndAll.add(tableMonth.getRbShcHyOneMlvss());
- rbHfxwnndAll.add(tableMonth.getRbShcHyTwoMlvss());
- hyHycxsyAll.add(tableMonth.getHyNo3Hlj1Jqr());
- hyHycxsyAll.add(tableMonth.getHyNo3Hlj2Jqr());
- hyQyanAll.add(tableMonth.getHyNh31Jqr());
- hyQyanAll.add(tableMonth.getHyNh32Jqr());
- hyQyckxsyAll.add(tableMonth.getHyNo3Qyc1Jqr());
- hyQyckxsyAll.add(tableMonth.getHyNo3Qyc2Jqr());
- hyHyzlsyAll.add(tableMonth.getHyTpHl1Jqr());
- hyHyzlsyAll.add(tableMonth.getHyTpHl2Jqr());
- tableMonth.setGyHycRjyAll(formatList(gyHycRjyAll));
- tableMonth.setGyHycRjyZdAll(formatList(gyHycRjyZdAll));
- tableMonth.setGyHycWnndAll(formatList(gyHycWnndAll));
- tableMonth.setRbHycRjyAll(formatList(rbHycRjyAll));
- tableMonth.setRbHycWnndAll(formatList(rbHycWnndAll));
- tableMonth.setRbYycRjyAll(formatList(rbYycRjyAll));
- tableMonth.setRbQycRjyAll(formatList(rbQycRjyAll));
- tableMonth.setRbWncjbAll(formatList(rbWncjbAll));
- tableMonth.setRbWntjzsAll(formatList(rbWntjzsAll));
- tableMonth.setRbHfxwnndAll(formatList(rbHfxwnndAll));
- tableMonth.setHyHycxsyAll(formatList(hyHycxsyAll));
- tableMonth.setHyQyanAll(formatList(hyQyanAll));
- tableMonth.setHyQyckxsyAll(formatList(hyQyckxsyAll));
- tableMonth.setHyHyzlsyAll(formatList(hyHyzlsyAll));
- tXinyiBigTableMonthMapper.insertTXinyiBigTableMonth(tableMonth);
- }
- }
- long end = System.currentTimeMillis();
- return "ok;耗时:" + (end - begin) / 1000 + "秒。";
- }
- /**
- * 处理big_table_day历史数据
- * @return
- */
- @GetMapping("/handleBigTableDayHistoryData")
- public String handleBigTableDayHistoryData() {
- log.info("进入了 处理big_table_day历史数据");
- long begin = System.currentTimeMillis();
- List<TXinyiBigTableHour> tXinyiBigTableHours = tXinyiBigTableHourMapper.selectTXinyiBigTableHourByTestDate();
- if ( !CollectionUtils.isEmpty(tXinyiBigTableHours) ) {
- List<TXinyiBigTableDay> bigTableDayList = new ArrayList<>();
- for (int i = 0; i < tXinyiBigTableHours.size(); i++) {
- TXinyiBigTableHour tXinyiBigTableHour = tXinyiBigTableHours.get(i);
- String testDate = tXinyiBigTableHour.getTestDate();
- TXinyiBigTableDay tableDay = tXinyiBigTableDayMapper.selectTXinyiBigTableHourAvg(testDate);
- if (!Objects.isNull(tableDay)) {
- ArrayList<BigDecimal> gyHycRjyAll = new ArrayList<>();
- ArrayList<BigDecimal> gyHycRjyZdAll = new ArrayList<>();
- ArrayList<BigDecimal> gyHycWnndAll = new ArrayList<>();
- ArrayList<BigDecimal> rbHycRjyAll = new ArrayList<>();
- ArrayList<BigDecimal> rbHycWnndAll = new ArrayList<>();
- ArrayList<BigDecimal> rbYycRjyAll = new ArrayList<>();
- ArrayList<BigDecimal> rbQycRjyAll = new ArrayList<>();
- ArrayList<BigDecimal> rbWncjbAll = new ArrayList<>();
- ArrayList<BigDecimal> rbWntjzsAll = new ArrayList<>();
- ArrayList<BigDecimal> rbHfxwnndAll = new ArrayList<>();
- ArrayList<BigDecimal> hyHycxsyAll = new ArrayList<>();
- ArrayList<BigDecimal> hyQyanAll = new ArrayList<>();
- ArrayList<BigDecimal> hyQyckxsyAll = new ArrayList<>();
- ArrayList<BigDecimal> hyHyzlsyAll = new ArrayList<>();
- gyHycRjyAll.add(tableDay.getGyOneHymdDo());
- gyHycRjyAll.add(tableDay.getGyTwoHymdDo());
- gyHycRjyZdAll.add(tableDay.getGyOneHyzdDo());
- gyHycRjyZdAll.add(tableDay.getGyTwoHyzdDo());
- gyHycWnndAll.add(tableDay.getGyOneMlss());
- gyHycWnndAll.add(tableDay.getGyTwoMlss());
- rbHycRjyAll.add(tableDay.getRbShcHyOneDo());
- rbHycRjyAll.add(tableDay.getRbShcHyTwoDo());
- rbHycWnndAll.add(tableDay.getRbShcHyOneMlss());
- rbHycWnndAll.add(tableDay.getRbShcHyTwoMlss());
- rbYycRjyAll.add(tableDay.getRbShcYyOneDo());
- rbYycRjyAll.add(tableDay.getRbShcYyTwoDo());
- rbQycRjyAll.add(tableDay.getRbShcQyOneDo());
- rbQycRjyAll.add(tableDay.getRbShcQyTwoDo());
- rbWncjbAll.add(tableDay.getRbShcHyOneSv());
- rbWncjbAll.add(tableDay.getRbShcHyTwoSv());
- rbWntjzsAll.add(tableDay.getRbShcHyOneSvi());
- rbWntjzsAll.add(tableDay.getRbShcHyTwoSvi());
- rbHfxwnndAll.add(tableDay.getRbShcHyOneMlvss());
- rbHfxwnndAll.add(tableDay.getRbShcHyTwoMlvss());
- hyHycxsyAll.add(tableDay.getHyNo3Hlj1Jqr());
- hyHycxsyAll.add(tableDay.getHyNo3Hlj2Jqr());
- hyQyanAll.add(tableDay.getHyNh31Jqr());
- hyQyanAll.add(tableDay.getHyNh32Jqr());
- hyQyckxsyAll.add(tableDay.getHyNo3Qyc1Jqr());
- hyQyckxsyAll.add(tableDay.getHyNo3Qyc2Jqr());
- hyHyzlsyAll.add(tableDay.getHyTpHl1Jqr());
- hyHyzlsyAll.add(tableDay.getHyTpHl2Jqr());
- tableDay.setGyHycRjyAll(formatList(gyHycRjyAll));
- tableDay.setGyHycRjyZdAll(formatList(gyHycRjyZdAll));
- tableDay.setGyHycWnndAll(formatList(gyHycWnndAll));
- tableDay.setRbHycRjyAll(formatList(rbHycRjyAll));
- tableDay.setRbHycWnndAll(formatList(rbHycWnndAll));
- tableDay.setRbYycRjyAll(formatList(rbYycRjyAll));
- tableDay.setRbQycRjyAll(formatList(rbQycRjyAll));
- tableDay.setRbWncjbAll(formatList(rbWncjbAll));
- tableDay.setRbWntjzsAll(formatList(rbWntjzsAll));
- tableDay.setRbHfxwnndAll(formatList(rbHfxwnndAll));
- tableDay.setHyHycxsyAll(formatList(hyHycxsyAll));
- tableDay.setHyQyanAll(formatList(hyQyanAll));
- tableDay.setHyQyckxsyAll(formatList(hyQyckxsyAll));
- tableDay.setHyHyzlsyAll(formatList(hyHyzlsyAll));
- tableDay.setTestDate(testDate);
- bigTableDayList.add(tableDay);
- }
- }
- if (!CollectionUtils.isEmpty(bigTableDayList)) {
- SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH, false);
- TXinyiBigTableDayMapper sqlSessionMapper = sqlSession.getMapper(TXinyiBigTableDayMapper.class);
- bigTableDayList.forEach(sqlSessionMapper::insertTXinyiBigTableDay);
- sqlSession.commit();
- sqlSession.close();
- }
- }
- long end = System.currentTimeMillis();
- return "ok;耗时:" + (end - begin) / 1000 + "秒。";
- }
- /**
- * 处理big_table_hour历史数据
- * @return
- */
- @GetMapping("/handleBigTableHourHistoryData")
- public String handleBigTableHourHistoryData () {
- log.info("进入了 处理big_table_hour历史数据");
- long begin = System.currentTimeMillis();
- int size = 500;
- int count = xinyiIndustryMapper.getCount();
- int num = ( count / size ) + 1;
- for (int i = 0; i < num; i++) {
- List<TXinyiIndustry> tXinyiIndustries = xinyiIndustryMapper.selectTXinyiIndustryListByPage(i * size, size);
- if ( !CollectionUtils.isEmpty(tXinyiIndustries) ) {
- List<TXinyiBigTableHour> tXinyiBigTableHourList = new ArrayList();
- for (int j = 0; j < tXinyiIndustries.size(); j++) {
- TXinyiBigTableHour xinyiBigTableHour = new TXinyiBigTableHour();
- TXinyiIndustry tXinyiIndustry = tXinyiIndustries.get(j);
- String testHour = tXinyiIndustry.getTestHour();
- String testDate = tXinyiIndustry.getTestDate();
- // 处理工业库
- handleIndustryData(xinyiBigTableHour, tXinyiIndustry);
- // 处理计算表
- List<TXinyiCalculate> tXinyiCalculates = xinyiCalculateMapper.selectTXinyiCalculateList(TXinyiCalculate.builder().testHour(testHour).build());
- if ( !CollectionUtils.isEmpty(tXinyiCalculates) ) {
- TXinyiCalculate tXinyiCalculate = tXinyiCalculates.get(0);
- handleCalculateData(xinyiBigTableHour, tXinyiCalculate);
- }
- // 处理日报表
- List<TXinyiDaily> tXinyiDailies = xinyiDailyMapper.selectTXinyiDailyList(TXinyiDaily.builder().testDate(testDate).build());
- if ( !CollectionUtils.isEmpty(tXinyiDailies) ) {
- TXinyiDaily tXinyiDaily = tXinyiDailies.get(0);
- handleDailyData(xinyiBigTableHour, tXinyiDaily);
- }
- // 处理化验室
- List<TXinyiRobot> tXinyiRobots = xinyiRobotMapper.selectTXinyiRobotList(TXinyiRobot.builder().testHour(testHour).build());
- if (!CollectionUtils.isEmpty(tXinyiRobots)) {
- TXinyiRobot tXinyiRobot = tXinyiRobots.get(0);
- handleRobotData(xinyiBigTableHour, tXinyiRobot);
- }
- // TXinyiRobot tXinyiRobot = xinyiRobotMapper.selectTXinyiRobotByAvg(TXinyiRobot.builder().testHour(testHour).build());
- // if ( !Objects.isNull(tXinyiRobot) ) {
- // handleRobotData(xinyiBigTableHour, tXinyiRobot);
- // }
- tXinyiBigTableHourList.add(xinyiBigTableHour);
- }
- if (!CollectionUtils.isEmpty(tXinyiBigTableHourList)) {
- SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH,false);
- TXinyiBigTableHourMapper sqlSessionMapper = sqlSession.getMapper(TXinyiBigTableHourMapper.class);
- tXinyiBigTableHourList.stream().forEach(item -> sqlSessionMapper.insertTXinyiBigTableHour(item));
- sqlSession.commit();
- sqlSession.close();
- }
- }
- }
- long end = System.currentTimeMillis();
- return "ok;耗时:" + (end - begin) /1000 + "秒。";
- }
- // 处理工业库
- private void handleIndustryData(TXinyiBigTableHour xinyiBigTableHour, TXinyiIndustry tXinyiIndustry) {
- xinyiBigTableHour.setTestDate(tXinyiIndustry.getTestDate());
- xinyiBigTableHour.setTestHour(tXinyiIndustry.getTestHour());
- xinyiBigTableHour.setGyJsCod(tXinyiIndustry.getJsCod());
- xinyiBigTableHour.setGyJsPh(tXinyiIndustry.getJsPh());
- xinyiBigTableHour.setGyJsSs(tXinyiIndustry.getJsSs());
- xinyiBigTableHour.setGyJsTp(tXinyiIndustry.getJsTp());
- xinyiBigTableHour.setGyJsTn(tXinyiIndustry.getJsTn());
- xinyiBigTableHour.setGyJsNh3(tXinyiIndustry.getJsNh3());
- xinyiBigTableHour.setGyJsSwPh(tXinyiIndustry.getJsSwPh());
- xinyiBigTableHour.setGyJsBfyw(tXinyiIndustry.getJsBfyw());
- xinyiBigTableHour.setGyCsSlqc(tXinyiIndustry.getCsSlqc());
- xinyiBigTableHour.setGyCsCod(tXinyiIndustry.getCsCod());
- xinyiBigTableHour.setGyCsPh(tXinyiIndustry.getCsPh());
- xinyiBigTableHour.setGyCsSs(tXinyiIndustry.getCsSs());
- xinyiBigTableHour.setGyCsTn(tXinyiIndustry.getCsTn());
- xinyiBigTableHour.setGyCsTp(tXinyiIndustry.getCsTp());
- xinyiBigTableHour.setGyCsNh3(tXinyiIndustry.getCsNh3());
- xinyiBigTableHour.setGyOneHyzdDo(tXinyiIndustry.getOneHyzdDo());
- xinyiBigTableHour.setGyOneHymdDo(tXinyiIndustry.getOneHymdDo());
- xinyiBigTableHour.setGyTwoHyzdDo(tXinyiIndustry.getTwoHyzdDo());
- xinyiBigTableHour.setGyTwoHymdDo(tXinyiIndustry.getTwoHymdDo());
- xinyiBigTableHour.setGyOneMlss(tXinyiIndustry.getOneMlss());
- xinyiBigTableHour.setGyTwoMlss(tXinyiIndustry.getTwoMlss());
- xinyiBigTableHour.setGyJsTds(tXinyiIndustry.getJsTds());
- xinyiBigTableHour.setGyJsSlq(tXinyiIndustry.getJsSlq());
- xinyiBigTableHour.setGyNHlbOneGp(tXinyiIndustry.getNHlbOneGp());
- xinyiBigTableHour.setGyNHlbTwoGp(tXinyiIndustry.getNHlbTwoGp());
- xinyiBigTableHour.setGyNHlbThreeGp(tXinyiIndustry.getNHlbThreeGp());
- xinyiBigTableHour.setGyNHlbFourGp(tXinyiIndustry.getNHlbFourGp());
- xinyiBigTableHour.setGyNhlBFiveGp(tXinyiIndustry.getNhlBFiveGp());
- xinyiBigTableHour.setGyNHlbSixGp(tXinyiIndustry.getNHlbSixGp());
- xinyiBigTableHour.setGyWHlbOneGp(tXinyiIndustry.getWHlbOneGp());
- xinyiBigTableHour.setGyWHlbTwoGp(tXinyiIndustry.getWHlbTwoGp());
- xinyiBigTableHour.setGyWHlbThreeGp(tXinyiIndustry.getWHlbThreeGp());
- xinyiBigTableHour.setGyWHlbFourGp(tXinyiIndustry.getWHlbFourGp());
- xinyiBigTableHour.setGyWHlbFiveGp(tXinyiIndustry.getWHlbFiveGp());
- xinyiBigTableHour.setGyFjOne(tXinyiIndustry.getFjOne());
- xinyiBigTableHour.setGyFjTwo(tXinyiIndustry.getFjTwo());
- xinyiBigTableHour.setGyFjThree(tXinyiIndustry.getFjThree());
- xinyiBigTableHour.setGyFjFour(tXinyiIndustry.getFjFour());
- xinyiBigTableHour.setGyFjFive(tXinyiIndustry.getFjFive());
- xinyiBigTableHour.setGyFjSix(tXinyiIndustry.getFjSix());
- xinyiBigTableHour.setGyKqllOne(tXinyiIndustry.getKqllOne());
- xinyiBigTableHour.setGyKqllTwo(tXinyiIndustry.getKqllTwo());
- xinyiBigTableHour.setGyKqllThree(tXinyiIndustry.getKqllThree());
- xinyiBigTableHour.setGyKqllFour(tXinyiIndustry.getKqllFour());
- xinyiBigTableHour.setGyKqllFive(tXinyiIndustry.getKqllFive());
- xinyiBigTableHour.setGyKqllSix(tXinyiIndustry.getKqllSix());
- xinyiBigTableHour.setGySjtyjly(tXinyiIndustry.getSJTYJLY());
- xinyiBigTableHour.setGyCljyssll(tXinyiIndustry.getCLJYSSLL());
- xinyiBigTableHour.setGyHycRjyAll(tXinyiIndustry.getHycRjyAll());
- xinyiBigTableHour.setGyHycRjyZdAll(tXinyiIndustry.getHycRjyZdAll());
- xinyiBigTableHour.setGyHycWnndAll(tXinyiIndustry.getHycWnndAll());
- xinyiBigTableHour.setGyClP04Ycz(tXinyiIndustry.getCLP04YCZ());
- }
- // 处理计算表
- private void handleCalculateData(TXinyiBigTableHour xinyiBigTableHour, TXinyiCalculate xinyiCalculate) {
- xinyiBigTableHour.setJsJsTdb(xinyiCalculate.getJsTdb());
- xinyiBigTableHour.setJsJsTlb(xinyiCalculate.getJsTlb());
- xinyiBigTableHour.setJsJsBodBCod(xinyiCalculate.getJsBodBCod());
- xinyiBigTableHour.setJsYyqHrt(xinyiCalculate.getYyqHrt());
- xinyiBigTableHour.setJsQyqHrt(xinyiCalculate.getQyqHrt());
- xinyiBigTableHour.setJsHyqHrt(xinyiCalculate.getHyqHrt());
- xinyiBigTableHour.setJsHfxwnndzb(xinyiCalculate.getHFXWNNDZB());
- xinyiBigTableHour.setJsFM(xinyiCalculate.getFM());
- xinyiBigTableHour.setJsGsls(xinyiCalculate.getGSLS());
- xinyiBigTableHour.setJsGslsOne(xinyiCalculate.getGslsOne());
- xinyiBigTableHour.setJsGslsTwo(xinyiCalculate.getGslsTwo());
- xinyiBigTableHour.setJsXgsGsls(xinyiCalculate.getXgsGsls());
- xinyiBigTableHour.setJsXlcscBmfh(xinyiCalculate.getXlcscBmfh());
- xinyiBigTableHour.setJsXlcscHrt(xinyiCalculate.getXlcscHrt());
- xinyiBigTableHour.setJsCccdcBmfh(xinyiCalculate.getCccdcBmfh());
- xinyiBigTableHour.setJsCccdcHrt(xinyiCalculate.getCccdcHrt());
- xinyiBigTableHour.setJsEccBmfh(xinyiCalculate.getEccBmfh());
- xinyiBigTableHour.setJsEccHrt(xinyiCalculate.getEccHrt());
- xinyiBigTableHour.setJsEccGtfh(xinyiCalculate.getEccGtfh());
- xinyiBigTableHour.setJsClsnJcsj(xinyiCalculate.getClsnJcsj());
- xinyiBigTableHour.setJsXgcdcQsqSsls(xinyiCalculate.getXgcdcQsqSsls());
- xinyiBigTableHour.setJsWhlb(xinyiCalculate.getWHLB());
- xinyiBigTableHour.setJsNhlb(xinyiCalculate.getNHLB());
- xinyiBigTableHour.setJsWdscnl(xinyiCalculate.getWDSCNL());
- xinyiBigTableHour.setJsQsb(xinyiCalculate.getQSB());
- xinyiBigTableHour.setJsFcxsl(xinyiCalculate.getFCXSL());
- xinyiBigTableHour.setJsFcxslbl(xinyiCalculate.getFCXSLBL());
- xinyiBigTableHour.setJsWhlbRN(xinyiCalculate.getWhlRN());
- }
- // 处理日报
- private void handleDailyData(TXinyiBigTableHour tXinyiBigTableHour, TXinyiDaily tXinyiDaily) {
- tXinyiBigTableHour.setRbJsCod(tXinyiDaily.getJsCod());
- tXinyiBigTableHour.setRbJsPh(tXinyiDaily.getJsPh());
- tXinyiBigTableHour.setRbJsBod5(tXinyiDaily.getJsBod5());
- tXinyiBigTableHour.setRbJsSs(tXinyiDaily.getJsSs());
- tXinyiBigTableHour.setRbJsNh3(tXinyiDaily.getJsNh3());
- tXinyiBigTableHour.setRbJsTn(tXinyiDaily.getJsTn());
- tXinyiBigTableHour.setRbJsTp(tXinyiDaily.getJsTp());
- tXinyiBigTableHour.setRbJsDcgj(tXinyiDaily.getJsDcgj());
- tXinyiBigTableHour.setRbCsCod(tXinyiDaily.getCsCod());
- tXinyiBigTableHour.setRbCsPh(tXinyiDaily.getCsPh());
- tXinyiBigTableHour.setRbCsBod5(tXinyiDaily.getCsBod5());
- tXinyiBigTableHour.setRbCsSs(tXinyiDaily.getCsSs());
- tXinyiBigTableHour.setRbCsNh3(tXinyiDaily.getCsNh3());
- tXinyiBigTableHour.setRbCsTn(tXinyiDaily.getCsTn());
- tXinyiBigTableHour.setRbCsTp(tXinyiDaily.getCsTp());
- tXinyiBigTableHour.setRbCsDcgj(tXinyiDaily.getCsDcgj());
- tXinyiBigTableHour.setRbJsSw(tXinyiDaily.getJsSw());
- tXinyiBigTableHour.setRbCsSw(tXinyiDaily.getCsSw());
- tXinyiBigTableHour.setRbShcOnePh(tXinyiDaily.getShcOnePh());
- tXinyiBigTableHour.setRbShcTwoPh(tXinyiDaily.getShcTwoPh());
- tXinyiBigTableHour.setRbShcHyOneSv(tXinyiDaily.getShcHyOneSv());
- tXinyiBigTableHour.setRbShcHyTwoSv(tXinyiDaily.getShcHyTwoSv());
- tXinyiBigTableHour.setRbShcHyOneSvi(tXinyiDaily.getShcHyOneSvi());
- tXinyiBigTableHour.setRbShcHyTwoSvi(tXinyiDaily.getShcHyTwoSvi());
- tXinyiBigTableHour.setRbShcHyOneMlss(tXinyiDaily.getShcHyOneMlss());
- tXinyiBigTableHour.setRbShcHyTwoMlss(tXinyiDaily.getShcHyTwoMlss());
- tXinyiBigTableHour.setRbShcHyOneMlvss(tXinyiDaily.getShcHyOneMlvss());
- tXinyiBigTableHour.setRbShcHyTwoMlvss(tXinyiDaily.getShcHyTwoMlvss());
- tXinyiBigTableHour.setRbShcYyOneDo(tXinyiDaily.getShcYyOneDo());
- tXinyiBigTableHour.setRbShcYyTwoDo(tXinyiDaily.getShcYyTwoDo());
- tXinyiBigTableHour.setRbShcQyOneDo(tXinyiDaily.getShcQyOneDo());
- tXinyiBigTableHour.setRbShcQyTwoDo(tXinyiDaily.getShcQyTwoDo());
- tXinyiBigTableHour.setRbShcHyOneDo(tXinyiDaily.getShcHyOneDo());
- tXinyiBigTableHour.setRbShcHyTwoDo(tXinyiDaily.getShcHyTwoDo());
- tXinyiBigTableHour.setRbJsl(tXinyiDaily.getJSL());
- tXinyiBigTableHour.setRbCsl(tXinyiDaily.getCSL());
- tXinyiBigTableHour.setRbSdclcxsl(tXinyiDaily.getSDCLCXSL());
- tXinyiBigTableHour.setRbQsb(tXinyiDaily.getQSB());
- tXinyiBigTableHour.setRbFM(tXinyiDaily.getFM());
- tXinyiBigTableHour.setRbYyHrt(tXinyiDaily.getYyHrt());
- tXinyiBigTableHour.setRbHyHrt(tXinyiDaily.getHyHrt());
- tXinyiBigTableHour.setRbQyHrt(tXinyiDaily.getQyHrt());
- tXinyiBigTableHour.setRbNhlR(tXinyiDaily.getNhlR());
- tXinyiBigTableHour.setRbWhlR(tXinyiDaily.getWhlR());
- tXinyiBigTableHour.setRbSrt(tXinyiDaily.getSRT());
- tXinyiBigTableHour.setRbCnl(tXinyiDaily.getCNL());
- tXinyiBigTableHour.setRbTyqBod5Tn(tXinyiDaily.getTyqBod5Tn());
- tXinyiBigTableHour.setRbTyhBod5Tn(tXinyiDaily.getTyhBod5Tn());
- tXinyiBigTableHour.setRbHycRjyAll(tXinyiDaily.getHycRjyAll());
- tXinyiBigTableHour.setRbHycWnndAll(tXinyiDaily.getHycWnndAll());
- tXinyiBigTableHour.setRbYycRjyAll(tXinyiDaily.getYycRjyAll());
- tXinyiBigTableHour.setRbQycRjyAll(tXinyiDaily.getQycRjyAll());
- tXinyiBigTableHour.setRbWncjbAll(tXinyiDaily.getWncjbAll());
- tXinyiBigTableHour.setRbWntjzsAll(tXinyiDaily.getWntjzsAll());
- tXinyiBigTableHour.setRbHfxwnndAll(tXinyiDaily.getHfxwnndAll());
- tXinyiBigTableHour.setRbChuniliang(tXinyiDaily.getCHUNILIANG());
- tXinyiBigTableHour.setRbCnhsl(tXinyiDaily.getCNHSL());
- tXinyiBigTableHour.setRbGwnl(tXinyiDaily.getGWNL());
- tXinyiBigTableHour.setRbDf(tXinyiDaily.getDF());
- tXinyiBigTableHour.setRbXnjf(tXinyiDaily.getXNJF());
- tXinyiBigTableHour.setRbClf(tXinyiDaily.getCLF());
- tXinyiBigTableHour.setRbTyf(tXinyiDaily.getTYF());
- tXinyiBigTableHour.setRbXdjf(tXinyiDaily.getXDJF());
- tXinyiBigTableHour.setRbQtyjf(tXinyiDaily.getQTYJF());
- tXinyiBigTableHour.setRbCnf(tXinyiDaily.getCNF());
- tXinyiBigTableHour.setRbZlsf(tXinyiDaily.getZLSF());
- tXinyiBigTableHour.setRbZjcb(tXinyiDaily.getZJCB());
- tXinyiBigTableHour.setRbDwcb(tXinyiDaily.getDWCB());
- }
- // 处理化验室
- private void handleRobotData(TXinyiBigTableHour tXinyiBigTableHour, TXinyiRobot tXinyiRobot) {
- tXinyiBigTableHour.setHyCodYb(tXinyiRobot.getCodYb());
- tXinyiBigTableHour.setHyCodJqr(tXinyiRobot.getCodJqr());
- tXinyiBigTableHour.setHyCodYz(tXinyiRobot.getCodYz());
- tXinyiBigTableHour.setHyTpHl1Jqr(tXinyiRobot.getTpHl1Jqr());
- tXinyiBigTableHour.setHyTpHl2Jqr(tXinyiRobot.getTpHl2Jqr());
- tXinyiBigTableHour.setHyTpRccJqr(tXinyiRobot.getTpRccJqr());
- tXinyiBigTableHour.setHyTp1Yz(tXinyiRobot.getTp1Yz());
- tXinyiBigTableHour.setHyTp2Yz(tXinyiRobot.getTp2Yz());
- tXinyiBigTableHour.setHyTpRccYz(tXinyiRobot.getTpRccYz());
- tXinyiBigTableHour.setHyNh31Jqr(tXinyiRobot.getNh31Jqr());
- tXinyiBigTableHour.setHyNh32Jqr(tXinyiRobot.getNh32Jqr());
- tXinyiBigTableHour.setHyNh31Yz(tXinyiRobot.getNh31Yz());
- tXinyiBigTableHour.setHyNo3Hlc1Yz(tXinyiRobot.getNo3Hlc1Yz());
- tXinyiBigTableHour.setHyNh32Yz(tXinyiRobot.getNh32Yz());
- tXinyiBigTableHour.setHyNo3Hlc2Yz(tXinyiRobot.getNo3Hlc2Yz());
- tXinyiBigTableHour.setHyNo3Hlj1Jqr(tXinyiRobot.getNo3Hlj1Jqr());
- tXinyiBigTableHour.setHyNo3Hlj2Jqr(tXinyiRobot.getNo3Hlj2Jqr());
- tXinyiBigTableHour.setHyTyll(tXinyiRobot.getTYLL());
- tXinyiBigTableHour.setHyNo3Qyc1Jqr(tXinyiRobot.getNo3Qyc1Jqr());
- tXinyiBigTableHour.setHyNo3Qyc2Jqr(tXinyiRobot.getNo3Qyc2Jqr());
- tXinyiBigTableHour.setHyNo3Qyc1Yz(tXinyiRobot.getNo3Qyc1Yz());
- tXinyiBigTableHour.setHyNo3Qyc2Yz(tXinyiRobot.getNo3Qyc2Yz());
- tXinyiBigTableHour.setHyJsll(tXinyiRobot.getJSLL());
- tXinyiBigTableHour.setHyHycxsyAll(tXinyiRobot.getHycxsyAll());
- tXinyiBigTableHour.setHyQyanAll(tXinyiRobot.getQyanAll());
- tXinyiBigTableHour.setHyQyckxsyAll(tXinyiRobot.getQyckxsyAll());
- tXinyiBigTableHour.setHyHyzlsyAll(tXinyiRobot.getHyzlsyAll());
- }
- private void handlePredictorWarning(String[] split, String hour, String task, List<TXinyiIndustry> tXinyiIndustries6, List<TXinyiRobot> tXinyiRobots6, String date) {
- String[] hours = hour.split(",");
- //2024年6月23日18:28:55 因为存在跨天问题 所以日期也是逗号拼接的
- String[] dates = date.split(",");
- //2024年6月18日13:41:10 统一格式,否则查询不到结果
- //2024年6月18日10:36:49 增加预测记录,预测准确度计算等
- TXinyiForecastComparison tXinyiForecastComparison = new TXinyiForecastComparison();
- //2024年7月11日17:04:11 TP改为zlsy
- tXinyiForecastComparison.setCategory(BusinessEnum.BigModelForecastEnum.TP.getCode().equalsIgnoreCase(task) ? BusinessEnum.BigModelForecastEnum.ZLSY.getCode() : task);
- tXinyiForecastComparison.setForecastTimeOne(dates[0].replaceAll("-", "/") + " " + hours[0]);
- tXinyiForecastComparison.setForecastTimeTwo(dates[1].replaceAll("-", "/") + " " + hours[1]);
- tXinyiForecastComparison.setForecastTimeThree(dates[2].replaceAll("-", "/") + " " + hours[2]);
- tXinyiForecastComparison.setHsForecastOne(new BigDecimal(split[0]));
- tXinyiForecastComparison.setHsForecastTwo(new BigDecimal(split[1]));
- tXinyiForecastComparison.setHsForecastThree(new BigDecimal(split[2]));
- //2024年6月20日14:28:31 增加字段,方便查询
- tXinyiForecastComparison.setRemark(DateUtil.format(DateUtils.getNowDate(), DateUtils.YYYYMMDDHH_TS));
- //防止工业库挂掉以后持续预测同一数据
- //2024年6月20日14:59:23 因为预测bug(以工业库为准,假如工业库挂了,获取的全是挂了时间段后的三小时) 判断是否生成过了否则不生成
- TXinyiForecastComparison tXinyiForecastComparisonReq = new TXinyiForecastComparison();
- //2024年08月20日16:24:56 因为remark存放的是当前时间,也就是每个小时的,所以都是不一样的,修复此bug
- // tXinyiForecastComparisonReq.setRemark(tXinyiForecastComparison.getRemark());
- tXinyiForecastComparisonReq.setCategory(tXinyiForecastComparison.getCategory());
- //2024年7月18日15:04:37 如果工业库挂掉以后,不管什么时刻,调用预测返回的未来三小时时间都是一样的,再增加一个查询条件
- tXinyiForecastComparisonReq.setForecastTimeOne(tXinyiForecastComparison.getForecastTimeOne());//一个时刻就可以了 没必要再比较第二和第三时刻了。
- List<TXinyiForecastComparison> tXinyiForecastComparisons = this.xinyiForecastComparisonService.selectTXinyiForecastComparisonList(tXinyiForecastComparisonReq);
- if(!CollectionUtils.isEmpty(tXinyiForecastComparisons)){
- log.error("预测已经进行过了,无需重复运行~~~~~~~~~~~@@@@@@@,要保存的预测数据为{}", JSON.toJSONString(tXinyiForecastComparison));
- return;
- }
- //获取配置表
- List<TXinyiNormConfig> tXinyiNormConfigs = this.xinyiNormConfigMapper.selectTXinyiNormConfigList(null);
- if(CollectionUtils.isEmpty(tXinyiNormConfigs)) {
- log.error( "未查询到配置信息");
- return;
- }
- TXinyiNormConfig normConfig = tXinyiNormConfigs.get(0);
- //获取最新的工业库的数据
- // TXinyiIndustry tXinyiIndustry = this.xinyiIndustryMapper.selectTXinyiIndustryNewest();
- //2024年7月18日10:29:44 因为获取了最新的六条数据,所以无需再查询最新的数据了
- TXinyiIndustry tXinyiIndustry = tXinyiIndustries6.get(0);
- TXinyiRobot tXinyiRobot = tXinyiRobots6.get(0);
- List<ChartBasic> chartsDataList = new ArrayList<>(9);
- if(BusinessEnum.BigModelForecastEnum.COD.getCode().equals(task)){
- //同时调用跃渊的预测接口 保存记录值
- try {
- String result = HttpUtil.get("http://10.0.3.52:10003/system/forecast?type=2&time=" + DateUtil.format(DateUtils.getNowDate(), DateUtils.YYYY_MM_DD_HH), INT_10000);
- if(!StringUtils.isBlank(result)){
- JSONArray array = JSON.parseArray(result);
- tXinyiForecastComparison.setYyForecastOne(array.getBigDecimal(6));
- tXinyiForecastComparison.setYyForecastTwo(array.getBigDecimal(7));
- tXinyiForecastComparison.setYyForecastThree(array.getBigDecimal(8));
- }
- } catch (Exception e) {
- log.error("调用跃渊的预测接口出现异常,异常信息为{}", e.getMessage());
- }
- // this.xinyiForecastComparisonService.insertTXinyiForecastComparison(tXinyiForecastComparison);
- BigDecimal cscodBzz = normConfig.getCscodBzz();
- BigDecimal cscodGkz = normConfig.getCscodGkz();
- //处理展示数据
- for (int i = 0; i < tXinyiIndustries6.size(); i++) {
- TXinyiIndustry tXinyiIndustryTemp = tXinyiIndustries6.get(5 - i);
- ChartBasic chartBasic = new ChartBasic();
- chartBasic.setTime(tXinyiIndustryTemp.getTestHour().substring(11));
- chartBasic.setVal(DecimalUtils.getAbsAndScale(tXinyiIndustryTemp.getCsCod(), INT_2));
- chartsDataList.add(chartBasic);
- }
- for (int i = 0; i < split.length; i++) {
- String val = split[i];
- ChartBasic chartBasic = new ChartBasic();
- chartBasic.setTime(hours[i]);
- chartBasic.setVal(DecimalUtils.getAbsAndScale(new BigDecimal(val), INT_2));
- chartsDataList.add(chartBasic);
- }
- ryTask.handleXinYiWarningsYC(cscodBzz, split, cscodGkz, BusinessEnum.WarningCategoryEnum.CS_COD_YC.getCode(), hour, normConfig, tXinyiIndustry.getCsCod(), tXinyiIndustry, chartsDataList, date);
- }else if(BusinessEnum.BigModelForecastEnum.SS.getCode().equals(task)){
- //同时调用跃渊的预测接口 保存记录值
- try {
- String result = HttpUtil.get("http://10.0.3.52:10003/system/forecast?type=5&time=" + DateUtil.format(DateUtils.getNowDate(), DateUtils.YYYY_MM_DD_HH), INT_10000);
- if(!StringUtils.isBlank(result)){
- JSONArray array = JSON.parseArray(result);
- tXinyiForecastComparison.setYyForecastOne(array.getBigDecimal(6));
- tXinyiForecastComparison.setYyForecastTwo(array.getBigDecimal(7));
- tXinyiForecastComparison.setYyForecastThree(array.getBigDecimal(8));
- }
- } catch (Exception e) {
- log.error("调用跃渊的预测接口出现异常,异常信息为{}", e.getMessage());
- }
- // this.xinyiForecastComparisonService.insertTXinyiForecastComparison(tXinyiForecastComparison);
- BigDecimal csSSBzz = normConfig.getCsssBzz();
- BigDecimal csssGkz = normConfig.getCsssGkz();
- //处理展示数据
- for (int i = 0; i < tXinyiIndustries6.size(); i++) {
- TXinyiIndustry tXinyiIndustryTemp = tXinyiIndustries6.get(5 - i);
- ChartBasic chartBasic = new ChartBasic();
- chartBasic.setTime(tXinyiIndustryTemp.getTestHour().substring(11));
- chartBasic.setVal(DecimalUtils.getAbsAndScale(tXinyiIndustryTemp.getCsSs(), INT_2));
- chartsDataList.add(chartBasic);
- }
- for (int i = 0; i < split.length; i++) {
- String val = split[i];
- ChartBasic chartBasic = new ChartBasic();
- chartBasic.setTime(hours[i]);
- chartBasic.setVal(DecimalUtils.getAbsAndScale(new BigDecimal(val), INT_2));
- chartsDataList.add(chartBasic);
- }
- ryTask.handleXinYiWarningsYC(csSSBzz, split, csssGkz, BusinessEnum.WarningCategoryEnum.CS_SS_YC.getCode(), hour, normConfig, tXinyiIndustry.getCsSs(), tXinyiIndustry, chartsDataList, date);
- }/*else if(BusinessEnum.BigModelForecastEnum.TN.getCode().equals(task)){
- //同时调用跃渊的预测接口 保存记录值
- try {
- String result = HttpUtil.get("http://10.0.3.52:10003/system/forecast?type=3&time=" + DateUtil.format(DateUtils.getNowDate(), DateUtils.YYYY_MM_DD_HH), INT_10);
- if(!StringUtils.isBlank(result)){
- JSONArray array = JSON.parseArray(result);
- tXinyiForecastComparison.setYyForecastOne(array.getBigDecimal(6));
- tXinyiForecastComparison.setYyForecastTwo(array.getBigDecimal(7));
- tXinyiForecastComparison.setYyForecastThree(array.getBigDecimal(8));
- }
- } catch (Exception e) {
- log.error("调用跃渊的预测接口出现异常,异常信息为{}", e.getMessage());
- }
- // this.xinyiForecastComparisonService.insertTXinyiForecastComparison(tXinyiForecastComparison);
- BigDecimal cszzBzz = normConfig.getCszzBzz();
- BigDecimal cszzGkz = normConfig.getCszzGkz();
- //处理展示数据
- for (int i = 0; i < tXinyiIndustries6.size(); i++) {
- TXinyiIndustry tXinyiIndustryTemp = tXinyiIndustries6.get(5 - i);
- ChartBasic chartBasic = new ChartBasic();
- chartBasic.setTime(tXinyiIndustryTemp.getTestHour().substring(11));
- chartBasic.setVal(DecimalUtils.getAbsAndScale(tXinyiIndustryTemp.getCsTn(), INT_2));
- chartsDataList.add(chartBasic);
- }
- for (int i = 0; i < split.length; i++) {
- String val = split[i];
- ChartBasic chartBasic = new ChartBasic();
- chartBasic.setTime(hours[i]);
- chartBasic.setVal(DecimalUtils.getAbsAndScale(new BigDecimal(val), INT_2));
- chartsDataList.add(chartBasic);
- }
- handleXinYiWarningsYC(cszzBzz, split, cszzGkz, BusinessEnum.WarningCategoryEnum.CS_TN_YC.getCode(), hour, normConfig,tXinyiIndustry.getCsCod(), tXinyiIndustry, chartsDataList, date);
- }*/else if(BusinessEnum.BigModelForecastEnum.TP.getCode().equals(task)){
- //同时调用跃渊的预测接口 保存记录值
- try {
- String result = HttpUtil.get("http://10.0.3.52:10003/system/forecast?type=1&time=" + DateUtil.format(DateUtils.getNowDate(), DateUtils.YYYY_MM_DD_HH), INT_10000);
- if(!StringUtils.isBlank(result)){
- JSONArray array = JSON.parseArray(result);
- tXinyiForecastComparison.setYyForecastOne(array.getBigDecimal(6));
- tXinyiForecastComparison.setYyForecastTwo(array.getBigDecimal(7));
- tXinyiForecastComparison.setYyForecastThree(array.getBigDecimal(8));
- }
- } catch (Exception e) {
- log.error("调用跃渊的预测接口出现异常,异常信息为{}", e.getMessage());
- }
- // this.xinyiForecastComparisonService.insertTXinyiForecastComparison(tXinyiForecastComparison);
- BigDecimal cszlBzz = normConfig.getCszlBzz();
- BigDecimal cszlGkz = normConfig.getCszlGkz();
- //处理展示数据
- for (int i = 0; i < tXinyiRobots6.size(); i++) {
- TXinyiRobot tXinyiRobotTemp = tXinyiRobots6.get(5 - i);
- ChartBasic chartBasic = new ChartBasic();
- chartBasic.setTime(tXinyiRobotTemp.getTestHour().substring(11));
- chartBasic.setVal(DecimalUtils.getAbsAndScale(tXinyiRobotTemp.getTpRccJqr(), INT_2));
- chartsDataList.add(chartBasic);
- }
- for (int i = 0; i < split.length; i++) {
- String val = split[i];
- ChartBasic chartBasic = new ChartBasic();
- chartBasic.setTime(hours[i]);
- chartBasic.setVal(DecimalUtils.getAbsAndScale(new BigDecimal(val), INT_2));
- chartsDataList.add(chartBasic);
- }
- ryTask.handleXinYiWarningsYC(cszlBzz, split, cszlGkz, CS_TP_YC.getCode(), hour, normConfig, tXinyiRobot.getTpRccJqr(), tXinyiIndustry, chartsDataList, date);
- }else if(BusinessEnum.BigModelForecastEnum.NH3.getCode().equals(task)){
- //同时调用跃渊的预测接口 保存记录值
- try {
- String result = HttpUtil.get("http://10.0.3.52:10003/system/forecast?type=4&time=" + DateUtil.format(DateUtils.getNowDate(), DateUtils.YYYY_MM_DD_HH), INT_10000);
- if(!StringUtils.isBlank(result)){
- JSONArray array = JSON.parseArray(result);
- tXinyiForecastComparison.setYyForecastOne(array.getBigDecimal(6));
- tXinyiForecastComparison.setYyForecastTwo(array.getBigDecimal(7));
- tXinyiForecastComparison.setYyForecastThree(array.getBigDecimal(8));
- }
- } catch (Exception e) {
- log.error("调用跃渊的预测接口出现异常,异常信息为{}", e.getMessage());
- }
- // this.xinyiForecastComparisonService.insertTXinyiForecastComparison(tXinyiForecastComparison);
- BigDecimal csadBzz = normConfig.getCsadBzz();
- BigDecimal csadGkz = normConfig.getCsadGkz();
- //处理展示数据
- for (int i = 0; i < tXinyiIndustries6.size(); i++) {
- TXinyiIndustry tXinyiIndustryTemp = tXinyiIndustries6.get(5 - i);
- ChartBasic chartBasic = new ChartBasic();
- chartBasic.setTime(tXinyiIndustryTemp.getTestHour().substring(11));
- chartBasic.setVal(DecimalUtils.getAbsAndScale(tXinyiIndustryTemp.getCsNh3(), INT_2));
- chartsDataList.add(chartBasic);
- }
- for (int i = 0; i < split.length; i++) {
- String val = split[i];
- ChartBasic chartBasic = new ChartBasic();
- chartBasic.setTime(hours[i]);
- chartBasic.setVal(DecimalUtils.getAbsAndScale(new BigDecimal(val), INT_2));
- chartsDataList.add(chartBasic);
- }
- ryTask.handleXinYiWarningsYC(csadBzz, split, csadGkz, BusinessEnum.WarningCategoryEnum.CS_AD_YC.getCode(), hour, normConfig, tXinyiIndustry.getCsNh3(), tXinyiIndustry, chartsDataList, date);
- }else if(BusinessEnum.BigModelForecastEnum.XSY1.getCode().equals(task)){
- //2024年6月21日14:57:02 红杉的出水总氮预测改成 不用工业库的,用化验科的两个xsy 相关指标
- //同时调用跃渊的预测接口 保存记录值
- try {
- String result = HttpUtil.get("http://10.0.3.52:10003/system/forecast?type=6&time=" + DateUtil.format(DateUtils.getNowDate(), DateUtils.YYYY_MM_DD_HH), INT_10000);
- if(!StringUtils.isBlank(result)){
- JSONArray array = JSON.parseArray(result);
- tXinyiForecastComparison.setYyForecastOne(array.getBigDecimal(6));
- tXinyiForecastComparison.setYyForecastTwo(array.getBigDecimal(7));
- tXinyiForecastComparison.setYyForecastThree(array.getBigDecimal(8));
- }
- } catch (Exception e) {
- log.error("调用跃渊的预测接口出现异常,异常信息为{}", e.getMessage());
- }
- // this.xinyiForecastComparisonService.insertTXinyiForecastComparison(tXinyiForecastComparison);
- /*BigDecimal cscodBzz = new BigDecimal(XIAOSUANYAN_BZK);
- BigDecimal cscodGkz = new BigDecimal(XIAOSUANYAN_GKZ);*/
- //2024年7月11日17:19:47 1#好氧硝酸盐、2#好氧硝酸盐使用总氮标准值和管控值来预警
- BigDecimal cszzBzz = normConfig.getCszzBzz();
- BigDecimal cszzGkz = normConfig.getCszzGkz();
- //处理展示数据
- for (int i = 0; i < tXinyiRobots6.size(); i++) {
- TXinyiRobot tXinyiRobotTemp = tXinyiRobots6.get(5 - i);
- ChartBasic chartBasic = new ChartBasic();
- chartBasic.setTime(tXinyiRobotTemp.getTestHour().substring(11));
- chartBasic.setVal(DecimalUtils.getAbsAndScale(tXinyiRobotTemp.getNo3Hlj1Jqr(), INT_2));
- chartsDataList.add(chartBasic);
- }
- for (int i = 0; i < split.length; i++) {
- String val = split[i];
- ChartBasic chartBasic = new ChartBasic();
- chartBasic.setTime(hours[i]);
- chartBasic.setVal(DecimalUtils.getAbsAndScale(new BigDecimal(val), INT_2));
- chartsDataList.add(chartBasic);
- }
- ryTask.handleXinYiWarningsYC(cszzBzz, split, cszzGkz, BusinessEnum.WarningCategoryEnum.CS_XSY_1_YC.getCode(), hour, normConfig, tXinyiRobot.getNo3Hlj1Jqr(), tXinyiIndustry, chartsDataList, date);
- }else if(BusinessEnum.BigModelForecastEnum.XSY2.getCode().equals(task)){
- //同时调用跃渊的预测接口 保存记录值
- try {
- String result = HttpUtil.get("http://10.0.3.52:10003/system/forecast?type=7&time=" + DateUtil.format(DateUtils.getNowDate(), DateUtils.YYYY_MM_DD_HH), INT_10000);
- if(!StringUtils.isBlank(result)){
- JSONArray array = JSON.parseArray(result);
- tXinyiForecastComparison.setYyForecastOne(array.getBigDecimal(6));
- tXinyiForecastComparison.setYyForecastTwo(array.getBigDecimal(7));
- tXinyiForecastComparison.setYyForecastThree(array.getBigDecimal(8));
- }
- } catch (Exception e) {
- log.error("调用跃渊的预测接口出现异常,异常信息为{}", e.getMessage());
- }
- // this.xinyiForecastComparisonService.insertTXinyiForecastComparison(tXinyiForecastComparison);
- /*BigDecimal cscodBzz = new BigDecimal(XIAOSUANYAN_BZK);
- BigDecimal cscodGkz = new BigDecimal(XIAOSUANYAN_GKZ);*/
- //2024年7月11日17:19:47 1#好氧硝酸盐、2#好氧硝酸盐使用总氮标准值和管控值来预警
- BigDecimal cszzBzz = normConfig.getCszzBzz();
- BigDecimal cszzGkz = normConfig.getCszzGkz();
- //处理展示数据
- for (int i = 0; i < tXinyiRobots6.size(); i++) {
- TXinyiRobot tXinyiRobotTemp = tXinyiRobots6.get(5 - i);
- ChartBasic chartBasic = new ChartBasic();
- chartBasic.setTime(tXinyiRobotTemp.getTestHour().substring(11));
- chartBasic.setVal(DecimalUtils.getAbsAndScale(tXinyiRobotTemp.getNo3Hlj2Jqr(), INT_2));
- chartsDataList.add(chartBasic);
- }
- for (int i = 0; i < split.length; i++) {
- String val = split[i];
- ChartBasic chartBasic = new ChartBasic();
- chartBasic.setTime(hours[i]);
- chartBasic.setVal(DecimalUtils.getAbsAndScale(new BigDecimal(val), INT_2));
- chartsDataList.add(chartBasic);
- }
- ryTask.handleXinYiWarningsYC(cszzBzz, split, cszzGkz, BusinessEnum.WarningCategoryEnum.CS_XSY_2_YC.getCode(), hour, normConfig, tXinyiRobot.getNo3Hlj2Jqr(), tXinyiIndustry, chartsDataList, date);
- }else if(BusinessEnum.BigModelForecastEnum.QYXSY1.getCode().equals(task)){
- //同时调用跃渊的预测接口 保存记录值
- /*try {
- String result = HttpUtil.get("http://10.0.3.52:10003/system/forecast?type=7&time=" + DateUtil.format(DateUtils.getNowDate(), DateUtils.YYYY_MM_DD_HH), INT_10000);
- if(!StringUtils.isBlank(result)){
- JSONArray array = JSON.parseArray(result);
- tXinyiForecastComparison.setYyForecastOne(array.getBigDecimal(6));
- tXinyiForecastComparison.setYyForecastTwo(array.getBigDecimal(7));
- tXinyiForecastComparison.setYyForecastThree(array.getBigDecimal(8));
- }
- } catch (Exception e) {
- log.error("调用跃渊的预测接口出现异常,异常信息为{}", e.getMessage());
- }*/
- // this.xinyiForecastComparisonService.insertTXinyiForecastComparison(tXinyiForecastComparison);
- /*BigDecimal cscodBzz = new BigDecimal(XIAOSUANYAN_BZK);
- BigDecimal cscodGkz = new BigDecimal(XIAOSUANYAN_GKZ);*/
- //2024年7月11日17:19:47 1#好氧硝酸盐、2#好氧硝酸盐使用总氮标准值和管控值来预警
- BigDecimal cszzBzz = normConfig.getCszzBzz();
- BigDecimal cszzGkz = normConfig.getCszzGkz();
- //处理展示数据
- for (int i = 0; i < tXinyiRobots6.size(); i++) {
- TXinyiRobot tXinyiRobotTemp = tXinyiRobots6.get(5 - i);
- ChartBasic chartBasic = new ChartBasic();
- chartBasic.setTime(tXinyiRobotTemp.getTestHour().substring(11));
- chartBasic.setVal(DecimalUtils.getAbsAndScale(tXinyiRobotTemp.getNo3Qyc1Jqr(), INT_2));
- chartsDataList.add(chartBasic);
- }
- for (int i = 0; i < split.length; i++) {
- String val = split[i];
- ChartBasic chartBasic = new ChartBasic();
- chartBasic.setTime(hours[i]);
- chartBasic.setVal(DecimalUtils.getAbsAndScale(new BigDecimal(val), INT_2));
- chartsDataList.add(chartBasic);
- }
- ryTask.handleXinYiWarningsYC(cszzBzz, split, cszzGkz, BusinessEnum.WarningCategoryEnum.QYCXSY_1.getCode(), hour, normConfig, tXinyiRobot.getNo3Hlj2Jqr(), tXinyiIndustry, chartsDataList, date);
- }else if(BusinessEnum.BigModelForecastEnum.QYXSY2.getCode().equals(task)){
- //同时调用跃渊的预测接口 保存记录值
- /*try {
- String result = HttpUtil.get("http://10.0.3.52:10003/system/forecast?type=7&time=" + DateUtil.format(DateUtils.getNowDate(), DateUtils.YYYY_MM_DD_HH), INT_10000);
- if(!StringUtils.isBlank(result)){
- JSONArray array = JSON.parseArray(result);
- tXinyiForecastComparison.setYyForecastOne(array.getBigDecimal(6));
- tXinyiForecastComparison.setYyForecastTwo(array.getBigDecimal(7));
- tXinyiForecastComparison.setYyForecastThree(array.getBigDecimal(8));
- }
- } catch (Exception e) {
- log.error("调用跃渊的预测接口出现异常,异常信息为{}", e.getMessage());
- }*/
- // this.xinyiForecastComparisonService.insertTXinyiForecastComparison(tXinyiForecastComparison);
- /*BigDecimal cscodBzz = new BigDecimal(XIAOSUANYAN_BZK);
- BigDecimal cscodGkz = new BigDecimal(XIAOSUANYAN_GKZ);*/
- //2024年7月11日17:19:47 1#好氧硝酸盐、2#好氧硝酸盐使用总氮标准值和管控值来预警
- BigDecimal cszzBzz = normConfig.getCszzBzz();
- BigDecimal cszzGkz = normConfig.getCszzGkz();
- //处理展示数据
- for (int i = 0; i < tXinyiRobots6.size(); i++) {
- TXinyiRobot tXinyiRobotTemp = tXinyiRobots6.get(5 - i);
- ChartBasic chartBasic = new ChartBasic();
- chartBasic.setTime(tXinyiRobotTemp.getTestHour().substring(11));
- chartBasic.setVal(DecimalUtils.getAbsAndScale(tXinyiRobotTemp.getNo3Qyc2Jqr(), INT_2));
- chartsDataList.add(chartBasic);
- }
- for (int i = 0; i < split.length; i++) {
- String val = split[i];
- ChartBasic chartBasic = new ChartBasic();
- chartBasic.setTime(hours[i]);
- chartBasic.setVal(DecimalUtils.getAbsAndScale(new BigDecimal(val), INT_2));
- chartsDataList.add(chartBasic);
- }
- ryTask.handleXinYiWarningsYC(cszzBzz, split, cszzGkz, BusinessEnum.WarningCategoryEnum.QYCXSY_2.getCode(), hour, normConfig, tXinyiRobot.getNo3Hlj2Jqr(), tXinyiIndustry, chartsDataList, date);
- }else if(BusinessEnum.BigModelForecastEnum.QYNH31.getCode().equals(task)){
- //同时调用跃渊的预测接口 保存记录值
- /*try {
- String result = HttpUtil.get("http://10.0.3.52:10003/system/forecast?type=7&time=" + DateUtil.format(DateUtils.getNowDate(), DateUtils.YYYY_MM_DD_HH), INT_10000);
- if(!StringUtils.isBlank(result)){
- JSONArray array = JSON.parseArray(result);
- tXinyiForecastComparison.setYyForecastOne(array.getBigDecimal(6));
- tXinyiForecastComparison.setYyForecastTwo(array.getBigDecimal(7));
- tXinyiForecastComparison.setYyForecastThree(array.getBigDecimal(8));
- }
- } catch (Exception e) {
- log.error("调用跃渊的预测接口出现异常,异常信息为{}", e.getMessage());
- }*/
- // this.xinyiForecastComparisonService.insertTXinyiForecastComparison(tXinyiForecastComparison);
- /*BigDecimal cscodBzz = new BigDecimal(XIAOSUANYAN_BZK);
- BigDecimal cscodGkz = new BigDecimal(XIAOSUANYAN_GKZ);*/
- //2024年09月08日11:21:25 采用出水氨氮的标准值和管控值
- BigDecimal csadBzz = normConfig.getCsadBzz();
- BigDecimal csadGkz = normConfig.getCsadGkz();
- //处理展示数据
- for (int i = 0; i < tXinyiRobots6.size(); i++) {
- TXinyiRobot tXinyiRobotTemp = tXinyiRobots6.get(5 - i);
- ChartBasic chartBasic = new ChartBasic();
- chartBasic.setTime(tXinyiRobotTemp.getTestHour().substring(11));
- chartBasic.setVal(DecimalUtils.getAbsAndScale(tXinyiRobotTemp.getNh31Jqr(), INT_2));
- chartsDataList.add(chartBasic);
- }
- for (int i = 0; i < split.length; i++) {
- String val = split[i];
- ChartBasic chartBasic = new ChartBasic();
- chartBasic.setTime(hours[i]);
- chartBasic.setVal(DecimalUtils.getAbsAndScale(new BigDecimal(val), INT_2));
- chartsDataList.add(chartBasic);
- }
- ryTask.handleXinYiWarningsYC(csadBzz, split, csadGkz, BusinessEnum.WarningCategoryEnum.QYAD_1.getCode(), hour, normConfig, tXinyiRobot.getNo3Hlj2Jqr(), tXinyiIndustry, chartsDataList, date);
- }else if(BusinessEnum.BigModelForecastEnum.QYNH32.getCode().equals(task)){
- //同时调用跃渊的预测接口 保存记录值
- /*try {
- String result = HttpUtil.get("http://10.0.3.52:10003/system/forecast?type=7&time=" + DateUtil.format(DateUtils.getNowDate(), DateUtils.YYYY_MM_DD_HH), INT_10000);
- if(!StringUtils.isBlank(result)){
- JSONArray array = JSON.parseArray(result);
- tXinyiForecastComparison.setYyForecastOne(array.getBigDecimal(6));
- tXinyiForecastComparison.setYyForecastTwo(array.getBigDecimal(7));
- tXinyiForecastComparison.setYyForecastThree(array.getBigDecimal(8));
- }
- } catch (Exception e) {
- log.error("调用跃渊的预测接口出现异常,异常信息为{}", e.getMessage());
- }*/
- // this.xinyiForecastComparisonService.insertTXinyiForecastComparison(tXinyiForecastComparison);
- /*BigDecimal cscodBzz = new BigDecimal(XIAOSUANYAN_BZK);
- BigDecimal cscodGkz = new BigDecimal(XIAOSUANYAN_GKZ);*/
- //2024年09月08日11:21:25 采用出水氨氮的标准值和管控值
- BigDecimal csadBzz = normConfig.getCsadBzz();
- BigDecimal csadGkz = normConfig.getCsadGkz();
- //处理展示数据
- for (int i = 0; i < tXinyiRobots6.size(); i++) {
- TXinyiRobot tXinyiRobotTemp = tXinyiRobots6.get(5 - i);
- ChartBasic chartBasic = new ChartBasic();
- chartBasic.setTime(tXinyiRobotTemp.getTestHour().substring(11));
- chartBasic.setVal(DecimalUtils.getAbsAndScale(tXinyiRobotTemp.getNh32Jqr(), INT_2));
- chartsDataList.add(chartBasic);
- }
- for (int i = 0; i < split.length; i++) {
- String val = split[i];
- ChartBasic chartBasic = new ChartBasic();
- chartBasic.setTime(hours[i]);
- chartBasic.setVal(DecimalUtils.getAbsAndScale(new BigDecimal(val), INT_2));
- chartsDataList.add(chartBasic);
- }
- ryTask.handleXinYiWarningsYC(csadBzz, split, csadGkz, BusinessEnum.WarningCategoryEnum.QYAD_2.getCode(), hour, normConfig, tXinyiRobot.getNo3Hlj2Jqr(), tXinyiIndustry, chartsDataList, date);
- }else {
- log.error("暂未支持的类型{}", task);
- }
- //插入到数据库
- //2024年6月21日14:18:55 如果红杉预测和跃渊预测都有数据再保存
- //2024年7月8日15:15:46 逻辑调整:只要红杉的数据不为空就保存
- if(Objects.isNull(tXinyiForecastComparison.getHsForecastOne()) || Objects.isNull(tXinyiForecastComparison.getHsForecastTwo()) ||Objects.isNull(tXinyiForecastComparison.getHsForecastThree())){
- // || Objects.isNull(tXinyiForecastComparison.getYyForecastOne()) || Objects.isNull(tXinyiForecastComparison.getYyForecastTwo()) || Objects.isNull(tXinyiForecastComparison.getYyForecastThree())){
- log.error("保存预测对比数据时,有存在不满足条件的数据,不再保存数据,数据为{}", JSON.toJSONString(tXinyiForecastComparison));
- }else
- xinyiForecastComparisonService.insertTXinyiForecastComparison(tXinyiForecastComparison);
- }
- }
|