|
@@ -9,6 +9,7 @@ import com.slibra.business.mapper.*;
|
|
|
import com.slibra.business.req.*;
|
|
|
import com.slibra.business.res.ShowValueCSBasic;
|
|
|
import com.slibra.business.res.ShowValueJSBasic;
|
|
|
+import com.slibra.business.res.ShowValueSHBasic;
|
|
|
import com.slibra.common.DecimalUtils;
|
|
|
import com.slibra.common.config.BigModelConfig;
|
|
|
import com.slibra.common.constant.MyConstants;
|
|
@@ -657,11 +658,11 @@ public class AsyncTask {
|
|
|
// BigDecimal nhlbqdsl = normConfig.getNHLBQDSL();
|
|
|
// BigDecimal nhlbdsjll = normConfig.getNHLBDSJLL();
|
|
|
// BigDecimal nhlbgzxl = normConfig.getNHLBGZXL();
|
|
|
- BigDecimal nhlb = xinyiCalculate.getNHLB();
|
|
|
+ /*BigDecimal nhlb = xinyiCalculate.getNHLB();
|
|
|
if(!Objects.isNull(nhlb) && !Objects.isNull(nhlbnkXxz)){
|
|
|
// BigDecimal divide = nhlbqdsl.multiply(nhlbdsjll).multiply(nhlbgzxl).divide(jsSlq, 4, RoundingMode.HALF_UP);
|
|
|
- handleXinYiWarningsSH(nhlbnkXxz, nhlb, BusinessEnum.WarningCategoryEnum.NHLB.getCode(), tXinyiIndustry, normConfig, true);
|
|
|
- }
|
|
|
+ handleXinYiWarningsSH(nhlbnkXxz, nhlb, BusinessEnum.WarningCategoryEnum.NHLB.getCode(), tXinyiIndustry, normConfig, true, BusinessEnum.BigModelUnitEnum.PERCENT.getCode());
|
|
|
+ }*/
|
|
|
|
|
|
//外回流比报警
|
|
|
// BigDecimal whlbqdsl = normConfig.getWHLBQDSL();
|
|
@@ -671,7 +672,7 @@ public class AsyncTask {
|
|
|
// BigDecimal whlbSjz = normConfig.getWhlbSjz();
|
|
|
BigDecimal whlb = xinyiCalculate.getWHLB();
|
|
|
if(!Objects.isNull(whlb) && !Objects.isNull(whlbnkXxz)){
|
|
|
- handleXinYiWarningsSH(whlbnkXxz, whlb, BusinessEnum.WarningCategoryEnum.WHLB.getCode(), tXinyiIndustry, normConfig, true);
|
|
|
+ handleXinYiWarningsSH(whlbnkXxz, whlb, BusinessEnum.WarningCategoryEnum.WHLB.getCode(), tXinyiIndustry, normConfig, true, BusinessEnum.BigModelUnitEnum.PERCENT.getCode());
|
|
|
}
|
|
|
|
|
|
|
|
@@ -695,12 +696,12 @@ public class AsyncTask {
|
|
|
//#1
|
|
|
BigDecimal oneMlss = tXinyiIndustry.getOneMlss();
|
|
|
if(!Objects.isNull(oneMlss) && !Objects.isNull(sjscgkz)){
|
|
|
- handleXinYiWarningsSH(sjscgkz, oneMlss, BusinessEnum.WarningCategoryEnum.WNND_MLSS_1.getCode(), tXinyiIndustry, normConfig, true);
|
|
|
+ handleXinYiWarningsSH(sjscgkz, oneMlss, BusinessEnum.WarningCategoryEnum.WNND_MLSS_1.getCode(), tXinyiIndustry, normConfig, true, BusinessEnum.BigModelUnitEnum.MG_L.getCode());
|
|
|
}
|
|
|
//#1
|
|
|
BigDecimal twoMlss = tXinyiIndustry.getTwoMlss();
|
|
|
if(!Objects.isNull(twoMlss) && !Objects.isNull(sjscgkz)){
|
|
|
- handleXinYiWarningsSH(sjscgkz, twoMlss, BusinessEnum.WarningCategoryEnum.WNND_MLSS_2.getCode(), tXinyiIndustry, normConfig, true);
|
|
|
+ handleXinYiWarningsSH(sjscgkz, twoMlss, BusinessEnum.WarningCategoryEnum.WNND_MLSS_2.getCode(), tXinyiIndustry, normConfig, true, BusinessEnum.BigModelUnitEnum.MG_L.getCode());
|
|
|
}
|
|
|
|
|
|
|
|
@@ -711,7 +712,7 @@ public class AsyncTask {
|
|
|
//2024年6月28日17:17:03 已经配置了新的
|
|
|
BigDecimal wnfhnkXxz = normConfig.getWnfhnkXxz();
|
|
|
if(!Objects.isNull(fm) && !Objects.isNull(wnfhnkXxz)){
|
|
|
- handleXinYiWarningsSH(wnfhnkXxz, fm, BusinessEnum.WarningCategoryEnum.WNFH.getCode(), tXinyiIndustry, normConfig, true);
|
|
|
+ handleXinYiWarningsSH(wnfhnkXxz, fm, BusinessEnum.WarningCategoryEnum.WNFH.getCode(), tXinyiIndustry, normConfig, true, BusinessEnum.BigModelUnitEnum.KGBOD_KGMLSS_D.getCode());
|
|
|
}
|
|
|
|
|
|
//万吨水产泥率(todo 没有计算规则,只能从日报获取)
|
|
@@ -722,21 +723,21 @@ public class AsyncTask {
|
|
|
BigDecimal hfxwnndzb = xinyiCalculate.getHFXWNNDZB();
|
|
|
BigDecimal hfxwnndzbSjz = normConfig.getHfxwnndzbSjz();
|
|
|
if(!Objects.isNull(hfxwnndzb) && !Objects.isNull(hfxwnndzbSjz)){
|
|
|
- handleXinYiWarningsSH(hfxwnndzbSjz, hfxwnndzb, BusinessEnum.WarningCategoryEnum.HFXWNNDZB.getCode(), tXinyiIndustry, normConfig, false);
|
|
|
+ handleXinYiWarningsSH(hfxwnndzbSjz, hfxwnndzb, BusinessEnum.WarningCategoryEnum.HFXWNNDZB.getCode(), tXinyiIndustry, normConfig, false, BusinessEnum.BigModelUnitEnum.NULL.getCode());
|
|
|
}
|
|
|
|
|
|
//进水碳氮比
|
|
|
BigDecimal jsTdb = xinyiCalculate.getJsTdb();
|
|
|
BigDecimal jstdbnkzXxz = normConfig.getJstdbnkzXxz();
|
|
|
if(!Objects.isNull(jsTdb) && !Objects.isNull(jstdbnkzXxz)){
|
|
|
- handleXinYiWarningsSH(jstdbnkzXxz, jsTdb, BusinessEnum.WarningCategoryEnum.TDB.getCode(), tXinyiIndustry, normConfig, true);
|
|
|
+ handleXinYiWarningsSH(jstdbnkzXxz, jsTdb, BusinessEnum.WarningCategoryEnum.TDB.getCode(), tXinyiIndustry, normConfig, true, BusinessEnum.BigModelUnitEnum.NULL.getCode());
|
|
|
}
|
|
|
|
|
|
//进水碳磷比
|
|
|
BigDecimal jsTlb = xinyiCalculate.getJsTlb();
|
|
|
BigDecimal jstlbNkz = normConfig.getJstlbNkz();
|
|
|
if(!Objects.isNull(jsTlb) && !Objects.isNull(jstlbNkz)){
|
|
|
- handleXinYiWarningsSH(jstlbNkz, jsTlb, BusinessEnum.WarningCategoryEnum.TLB.getCode(), tXinyiIndustry, normConfig, true);
|
|
|
+ handleXinYiWarningsSH(jstlbNkz, jsTlb, BusinessEnum.WarningCategoryEnum.TLB.getCode(), tXinyiIndustry, normConfig, true, BusinessEnum.BigModelUnitEnum.NULL.getCode());
|
|
|
}
|
|
|
|
|
|
//进水BOD与COD比值(生化性)
|
|
@@ -746,7 +747,7 @@ public class AsyncTask {
|
|
|
String[] split = jsbodycodbzGkz.split("-");
|
|
|
sjscgkz = new BigDecimal(split[0]);
|
|
|
if(!Objects.isNull(jsBodBCod)){
|
|
|
- handleXinYiWarningsSH(sjscgkz, jsBodBCod, BusinessEnum.WarningCategoryEnum.TLB.getCode(), tXinyiIndustry, normConfig, true);
|
|
|
+ handleXinYiWarningsSH(sjscgkz, jsBodBCod, BusinessEnum.WarningCategoryEnum.BODCODB.getCode(), tXinyiIndustry, normConfig, true, BusinessEnum.BigModelUnitEnum.NULL.getCode());
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -757,33 +758,33 @@ public class AsyncTask {
|
|
|
// BigDecimal hycrjysjzSxz = normConfig.getHycrjysjzSxz();
|
|
|
BigDecimal hycrjyNkz = normConfig.getHycrjyNkz();
|
|
|
if(!Objects.isNull(shcHyOneDo) && !Objects.isNull(hycrjyNkz)){
|
|
|
- handleXinYiWarningsSH(hycrjyNkz, shcHyOneDo, BusinessEnum.WarningCategoryEnum.HYQDO_ONE.getCode(), tXinyiIndustry, normConfig, true);
|
|
|
+ handleXinYiWarningsSH(hycrjyNkz, shcHyOneDo, BusinessEnum.WarningCategoryEnum.HYQDO_ONE.getCode(), tXinyiIndustry, normConfig, true, BusinessEnum.BigModelUnitEnum.MG_L.getCode());
|
|
|
}
|
|
|
//好氧区DO(二池) 2024年5月31日14:09:36 溶解氧从日报获取 工业的不准
|
|
|
//2024年6月27日17:00:31 都先从工业库获取,日报没有必要再报警了
|
|
|
BigDecimal shcHyTwoDo = tXinyiIndustry.getTwoHymdDo();
|
|
|
if(!Objects.isNull(shcHyTwoDo) && !Objects.isNull(hycrjyNkz)){
|
|
|
- handleXinYiWarningsSH(hycrjyNkz, shcHyTwoDo, BusinessEnum.WarningCategoryEnum.HYQDO_TWO.getCode(), tXinyiIndustry, normConfig, true);
|
|
|
+ handleXinYiWarningsSH(hycrjyNkz, shcHyTwoDo, BusinessEnum.WarningCategoryEnum.HYQDO_TWO.getCode(), tXinyiIndustry, normConfig, true, BusinessEnum.BigModelUnitEnum.MG_L.getCode());
|
|
|
}
|
|
|
|
|
|
//气水比
|
|
|
BigDecimal qsb = xinyiCalculate.getQSB();
|
|
|
BigDecimal shcqbNkz = normConfig.getShcqbNkz();
|
|
|
if(!Objects.isNull(qsb) && !Objects.isNull(shcqbNkz))
|
|
|
- handleXinYiWarningsSH(shcqbNkz, qsb, BusinessEnum.WarningCategoryEnum.QSB.getCode(), tXinyiIndustry, normConfig, true);
|
|
|
+ handleXinYiWarningsSH(shcqbNkz, qsb, BusinessEnum.WarningCategoryEnum.QSB.getCode(), tXinyiIndustry, normConfig, true, BusinessEnum.BigModelUnitEnum.M3_M3.getCode());
|
|
|
|
|
|
//二沉池表面负荷
|
|
|
BigDecimal eccBmfh = xinyiCalculate.getEccBmfh();
|
|
|
BigDecimal eccbmfhznkzXxz = normConfig.getEccbmfhznkzXxz();
|
|
|
if(!Objects.isNull(eccBmfh) && !Objects.isNull(eccbmfhznkzXxz)){
|
|
|
- handleXinYiWarningsSH(eccbmfhznkzXxz, eccBmfh, BusinessEnum.WarningCategoryEnum.ECC_BMFH.getCode(), tXinyiIndustry, normConfig, true);
|
|
|
+ handleXinYiWarningsSH(eccbmfhznkzXxz, eccBmfh, BusinessEnum.WarningCategoryEnum.ECC_BMFH.getCode(), tXinyiIndustry, normConfig, true, BusinessEnum.BigModelUnitEnum.M3_M2_H.getCode());
|
|
|
}
|
|
|
|
|
|
//二沉池固体负荷
|
|
|
BigDecimal eccGtfh = xinyiCalculate.getEccGtfh();
|
|
|
BigDecimal eccgtfhnkxxz = normConfig.getECCGTFHNKXXZ();
|
|
|
if(!Objects.isNull(eccGtfh) && !Objects.isNull(eccgtfhnkxxz)){
|
|
|
- handleXinYiWarningsSH(eccgtfhnkxxz, eccGtfh, BusinessEnum.WarningCategoryEnum.ECC_GTFH.getCode(), tXinyiIndustry, normConfig, true);
|
|
|
+ handleXinYiWarningsSH(eccgtfhnkxxz, eccGtfh, BusinessEnum.WarningCategoryEnum.ECC_GTFH.getCode(), tXinyiIndustry, normConfig, true, BusinessEnum.BigModelUnitEnum.KG_M2_D.getCode());
|
|
|
}
|
|
|
|
|
|
//反冲洗水量
|
|
@@ -791,7 +792,7 @@ public class AsyncTask {
|
|
|
BigDecimal fcxslBl = xinyiCalculate.getFCXSLBL();
|
|
|
BigDecimal fcxslblsjzXxz = normConfig.getFcxslblsjzXxz();
|
|
|
if(!Objects.isNull(fcxslBl) && !Objects.isNull(fcxslblsjzXxz))
|
|
|
- handleXinYiWarningsSH(fcxslblsjzXxz, fcxslBl, BusinessEnum.WarningCategoryEnum.FCXSL.getCode(), tXinyiIndustry, normConfig, true);
|
|
|
+ handleXinYiWarningsSH(fcxslblsjzXxz, fcxslBl, BusinessEnum.WarningCategoryEnum.FCXSL.getCode(), tXinyiIndustry, normConfig, true, BusinessEnum.BigModelUnitEnum.PERCENT.getCode());
|
|
|
}
|
|
|
|
|
|
|
|
@@ -804,9 +805,10 @@ public class AsyncTask {
|
|
|
* @param normConfig
|
|
|
* @param normal 是否常规判断:默认都是超过;只有这个挥发性污泥浓度占比(VSS/SS)是小于才报警
|
|
|
* 2024年6月27日15:39:15 调整:生化报警只取实际生产管控指标
|
|
|
+ * 2024年7月11日10:44:11 新增单位unit 拼接完单位以后返回
|
|
|
*
|
|
|
*/
|
|
|
- private void handleXinYiWarningsSH(BigDecimal sjscgkz, BigDecimal currentVal, String category, TXinyiIndustry tXinyiIndustry, TXinyiNormConfig normConfig, Boolean normal) {
|
|
|
+ private void handleXinYiWarningsSH(BigDecimal sjscgkz, BigDecimal currentVal, String category, TXinyiIndustry tXinyiIndustry, TXinyiNormConfig normConfig, Boolean normal, String unit) {
|
|
|
TXinyiWarningRecord tXinyiWarningRecord = new TXinyiWarningRecord();
|
|
|
/*String category = BusinessEnum.WarningCategoryEnum.CS_AD.getCode();*/
|
|
|
tXinyiWarningRecord.setStatus(0);
|
|
@@ -881,7 +883,7 @@ public class AsyncTask {
|
|
|
this.addChatRecordByDeviceErr(tXinyiWarningRecord, tXinyiIndustry, normConfig);
|
|
|
}else {
|
|
|
//继续调用决策(普通问答)
|
|
|
- this.askBigModelForSHWarning(tXinyiWarningRecord, tXinyiIndustry, normConfig);
|
|
|
+ this.askBigModelForSHWarning(tXinyiWarningRecord, tXinyiIndustry, normConfig, unit);
|
|
|
}
|
|
|
}else{
|
|
|
log.info("{}:之前已经有过告警记录了,且还是继续报警,无需重复添加报警,但是决策仍然要调用", category);
|
|
@@ -891,7 +893,7 @@ public class AsyncTask {
|
|
|
this.addChatRecordByDeviceErr(tXinyiWarningRecord, tXinyiIndustry, normConfig);
|
|
|
}else {
|
|
|
//继续调用决策(普通问答)
|
|
|
- this.askBigModelForSHWarning(xinyiWarningRecord, tXinyiIndustry, normConfig);
|
|
|
+ this.askBigModelForSHWarning(xinyiWarningRecord, tXinyiIndustry, normConfig, unit);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -981,7 +983,7 @@ public class AsyncTask {
|
|
|
|
|
|
|
|
|
|
|
|
- private void askBigModelForSHWarning(TXinyiWarningRecord xinyiWarningRecord, TXinyiIndustry tXinyiIndustry, TXinyiNormConfig normConfig) {
|
|
|
+ private void askBigModelForSHWarning(TXinyiWarningRecord xinyiWarningRecord, TXinyiIndustry tXinyiIndustry, TXinyiNormConfig normConfig, String unit) {
|
|
|
log.info("进入了后台接口调⽤⼤模型获取问答结果处理");
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
String sessionId = IdUtils.simpleUUID();
|
|
@@ -1037,7 +1039,7 @@ public class AsyncTask {
|
|
|
chatReq.setSessionId(sessionId);
|
|
|
chatReq.setType(1);//0问答 1决策 2本地 3仿真预测
|
|
|
chatReq.setModule(3);//0专家问答 1智能工单 2智能体助手 3告警 4简报
|
|
|
- String showVal = this.buildShowValue(xinyiWarningRecord, tXinyiIndustry, normConfig, DateUtils.getNowDate());
|
|
|
+ String showVal = this.buildShowValueSH(xinyiWarningRecord, tXinyiIndustry, normConfig, DateUtils.getNowDate(), unit);
|
|
|
chatReq.setShowVal(showVal);
|
|
|
chatReq.setQuestion(prompt.toString());
|
|
|
chatReq.setAnswer(sb.toString());
|
|
@@ -1238,6 +1240,60 @@ public class AsyncTask {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 2024年7月11日10:32:49 生化报警的展示额外处理(因为涉及到很多的单位)
|
|
|
+ *
|
|
|
+ * @param tXinyiWarningRecord
|
|
|
+ * @param tXinyiIndustry
|
|
|
+ * @param normConfig
|
|
|
+ * @param nowDate
|
|
|
+ * @param unit
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private String buildShowValueSH(TXinyiWarningRecord tXinyiWarningRecord, TXinyiIndustry tXinyiIndustry, TXinyiNormConfig normConfig, Date nowDate, String unit) {
|
|
|
+ JSONObject result = new JSONObject();
|
|
|
+// JSONObject basic = new JSONObject();
|
|
|
+ Integer status = tXinyiWarningRecord.getStatus();
|
|
|
+ Date warningTime = tXinyiWarningRecord.getTime();
|
|
|
+ String remark = tXinyiWarningRecord.getRemark();
|
|
|
+ int count = DateUtils.differentHoursByMillisecond(warningTime, DateUtils.getNowDate()) + 1;
|
|
|
+ ShowValueSHBasic showValueSHBasic = new ShowValueSHBasic();
|
|
|
+ /*if("0".equals(remark)){//水质报警
|
|
|
+ showValueSHBasic.setH("在线仪表");
|
|
|
+ showValueSHBasic.setF(tXinyiWarningRecord.getLevel());
|
|
|
+ }else if("1".equals(remark)){//生化报警
|
|
|
+ showValueSHBasic.setH("在线仪表");
|
|
|
+ }else if("2".equals(remark)){//预测报警
|
|
|
+ showValueSHBasic.setH("预测");
|
|
|
+// showValueCSBasic.setF(tXinyiWarningRecord.getLevel());
|
|
|
+ }else {//机器人化验室报警(特殊的 水质报警)
|
|
|
+ showValueSHBasic.setH("化验室");
|
|
|
+ showValueSHBasic.setF(tXinyiWarningRecord.getLevel());
|
|
|
+ }*/
|
|
|
+ //生化报警固定了
|
|
|
+ showValueSHBasic.setF(tXinyiWarningRecord.getLevel());
|
|
|
+ showValueSHBasic.setH("计算");
|
|
|
+
|
|
|
+ //通用的
|
|
|
+ // showValueBasic.setA(tXinyiWarningRecord.getReason());
|
|
|
+ showValueSHBasic.setB(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM ,warningTime));
|
|
|
+ showValueSHBasic.setC(DecimalUtils.getAbsAndScale(tXinyiWarningRecord.getWarningVal(), INT_2) + unit);
|
|
|
+ showValueSHBasic.setD(DecimalUtils.getAbsAndScale(tXinyiWarningRecord.getDesignVal(), INT_2) + unit);
|
|
|
+ showValueSHBasic.setG(Math.min(count, MAX_COUNT));
|
|
|
+ if(tXinyiWarningRecord.getType() != 2)
|
|
|
+ showValueSHBasic.setI(status == 0 ? "报警中" : status == 1 ? "用户关闭" : status == 2 ? "系统关闭" : "应急处理中");
|
|
|
+ else
|
|
|
+ showValueSHBasic.setI(status == 0 ? "预警中" : "已完成");
|
|
|
+ result.put("basic", showValueSHBasic);
|
|
|
+ JSONObject jsData = getJsonObject(tXinyiIndustry, normConfig);//进水数据
|
|
|
+ result.put("jsData", jsData);
|
|
|
+ JSONObject csData = getCsonObject(tXinyiIndustry, normConfig);//出水数据
|
|
|
+ result.put("csData", csData);
|
|
|
+// return JSON.toJSONString(result, JSONWriter.Feature.WriteNulls);
|
|
|
+ return JSON.toJSONString(result);
|
|
|
+ }
|
|
|
+
|
|
|
private String buildShowValue(TXinyiWarningRecord tXinyiWarningRecord, TXinyiIndustry tXinyiIndustry, TXinyiNormConfig normConfig, Date nowDate) {
|
|
|
JSONObject result = new JSONObject();
|
|
|
// JSONObject basic = new JSONObject();
|