|
@@ -1031,36 +1031,42 @@ public class KprAimWaterCollecationBizFun {
|
|
|
LocalDateTime startDate = LocalDateTime.now().withYear(Integer.valueOf(yearStr))
|
|
|
.withMonth(Integer.valueOf(monthStr)).withHour(0).withMinute(0).withSecond(0).withNano(0);
|
|
|
//TODO 总体逻辑: 先查询指定月上一年的每日平均值,再按平均值的上下啊百分比去插入指定的浮动百分比数据
|
|
|
+ List<Map<String,Object>> orgConfig = getWaterTapWaterApi().getOrgConfig(false,0,0," AND org_name not like '%水厂'");
|
|
|
+ if("water_volume_prediction_jiangjin2".equals(databaseName)){
|
|
|
+ orgConfig = getWaterTapWaterApi().getOrgConfig(false,0,0,"");
|
|
|
+ }
|
|
|
for (int i = 0;i<=3;i++){
|
|
|
LocalDateTime dateNow = startDate.minusDays(-i);//当前循环时间
|
|
|
//TODO 数据库操作 A 调用对应时间预测接口 B 在修改实际值
|
|
|
DateTimeFormatter formatter2 = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
String dateStr = dateNow.withYear(LocalDateTime.now().getYear()).toLocalDate().format(formatter2);
|
|
|
//TODO A
|
|
|
- JP3TPHour tpHour = new JP3TPHour();
|
|
|
- tpHour.setOrgId("");
|
|
|
- tpHour.setDate(dateStr);
|
|
|
- LogPrintMgr.getInstance().printLogMsg(LogLevelFlag.LOG_INFO
|
|
|
- , mStrClassName
|
|
|
- , mStrClassName
|
|
|
- , String.format("执行未来预测小时数据" + FastJsonUtil.toJSON(tpHour) + "调用"));
|
|
|
- try {
|
|
|
- ResponseRes<String> tpRes = ServiceMgrProxy.getInstance()
|
|
|
- .applyCloud3tpServiceApi().dayHourPredictSupply(tpHour);
|
|
|
- if(ResponseCode.RESULT_BAD.toStrCode().equals(tpRes.getRescode())){
|
|
|
- LogPrintMgr.getInstance().printLogMsg(LogLevelFlag.LOG_ERROR
|
|
|
- , mStrClassName
|
|
|
- , mStrClassName
|
|
|
- , String.format("预测小时数据"+dateStr+"调用失败 ERROR:{%s} ",
|
|
|
- tpRes.getResdata()));
|
|
|
- }
|
|
|
- }catch(Exception ex){
|
|
|
- LogPrintMgr.getInstance().printLogMsg(LogLevelFlag.LOG_ERROR
|
|
|
- , mStrClassName
|
|
|
- , mStrClassName
|
|
|
- , String.format("预测小时数据"+dateStr+"调用异常 ERROR:{%s} ",
|
|
|
- ex.getLocalizedMessage()));
|
|
|
- }
|
|
|
+ for (Map<String,Object> org : orgConfig) {
|
|
|
+ JP3TPHour tpHour = new JP3TPHour();
|
|
|
+ tpHour.setOrgId(org.get("org_id").toString());
|
|
|
+ tpHour.setDate(dateStr);
|
|
|
+ LogPrintMgr.getInstance().printLogMsg(LogLevelFlag.LOG_INFO
|
|
|
+ , mStrClassName
|
|
|
+ , mStrClassName
|
|
|
+ , String.format("执行未来预测小时数据" + FastJsonUtil.toJSON(tpHour) + "调用"));
|
|
|
+ try {
|
|
|
+ ResponseRes<String> tpRes = ServiceMgrProxy.getInstance()
|
|
|
+ .applyCloud3tpServiceApi().dayHourPredictSupply(tpHour);
|
|
|
+ if (ResponseCode.RESULT_BAD.toStrCode().equals(tpRes.getRescode())) {
|
|
|
+ LogPrintMgr.getInstance().printLogMsg(LogLevelFlag.LOG_ERROR
|
|
|
+ , mStrClassName
|
|
|
+ , mStrClassName
|
|
|
+ , String.format("预测小时数据" + dateStr + "调用失败 ERROR:{%s} ",
|
|
|
+ tpRes.getResdata()));
|
|
|
+ }
|
|
|
+ } catch (Exception ex) {
|
|
|
+ LogPrintMgr.getInstance().printLogMsg(LogLevelFlag.LOG_ERROR
|
|
|
+ , mStrClassName
|
|
|
+ , mStrClassName
|
|
|
+ , String.format("预测小时数据" + dateStr + "调用异常 ERROR:{%s} ",
|
|
|
+ ex.getLocalizedMessage()));
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
System.out.println("调用预测模型小时数据结束"+ TimeTool.convertUTC2DateStr(TimeTool.getCurMsUTC(),TimeTool.TIMESTAMP_FORMAT));
|
|
|
}catch(Exception ex){
|