|
@@ -11,6 +11,7 @@ import com.slibra.business.domain.AutoFeedback;
|
|
import com.slibra.business.domain.TXinyiIndustry;
|
|
import com.slibra.business.domain.TXinyiIndustry;
|
|
import com.slibra.business.mapper.AutoFeedbackMapper;
|
|
import com.slibra.business.mapper.AutoFeedbackMapper;
|
|
import com.slibra.business.mapper.TXinyiIndustryMapper;
|
|
import com.slibra.business.mapper.TXinyiIndustryMapper;
|
|
|
|
+import com.slibra.business.res.MedicineRemote;
|
|
import com.slibra.business.res.SmartAdd;
|
|
import com.slibra.business.res.SmartAdd;
|
|
import com.slibra.business.service.IFrontService;
|
|
import com.slibra.business.service.IFrontService;
|
|
import com.slibra.common.DecimalUtils;
|
|
import com.slibra.common.DecimalUtils;
|
|
@@ -201,8 +202,7 @@ public class TXinyiMedicineParamServiceImpl implements ITXinyiMedicineParamServi
|
|
latestRecord.setTytjTransientLL(DecimalUtils.getNLengthHalfUp(total.divide(yymd, NUMBER_SCALE_10, RoundingMode.HALF_UP).divide(BigDecimal_1000, NUMBER_SCALE_10, RoundingMode.HALF_UP), INT_3));
|
|
latestRecord.setTytjTransientLL(DecimalUtils.getNLengthHalfUp(total.divide(yymd, NUMBER_SCALE_10, RoundingMode.HALF_UP).divide(BigDecimal_1000, NUMBER_SCALE_10, RoundingMode.HALF_UP), INT_3));
|
|
}*/
|
|
}*/
|
|
//2024年09月20日10:12:43 做个兜底处理,防止计算的结果是负数
|
|
//2024年09月20日10:12:43 做个兜底处理,防止计算的结果是负数
|
|
- Object calculateVal = this.calculateMedicineByLastRecord(latestRecord).get("CALCULATE_VAL");
|
|
|
|
- BigDecimal val = Objects.isNull(calculateVal) ? null : new BigDecimal(calculateVal.toString());
|
|
|
|
|
|
+ BigDecimal val = this.calculateMedicineByLastRecord(latestRecord).getCalculateVal();
|
|
if(!Objects.isNull(val) && val.compareTo(BigDecimal.ZERO) < 0){
|
|
if(!Objects.isNull(val) && val.compareTo(BigDecimal.ZERO) < 0){
|
|
log.info("计算得到的碳源投加量是负数,按0处理");
|
|
log.info("计算得到的碳源投加量是负数,按0处理");
|
|
val = BigDecimal.ZERO;
|
|
val = BigDecimal.ZERO;
|
|
@@ -214,6 +214,7 @@ public class TXinyiMedicineParamServiceImpl implements ITXinyiMedicineParamServi
|
|
/**
|
|
/**
|
|
* 2025年04月27日10:26:29 逻辑调整:以前此方法只返回计算的碳源投加的结果,现在改成:
|
|
* 2025年04月27日10:26:29 逻辑调整:以前此方法只返回计算的碳源投加的结果,现在改成:
|
|
* 返回map:存放:
|
|
* 返回map:存放:
|
|
|
|
+ * 2025年04月27日16:06:39 优化,返回改成对象
|
|
* 1.计算结果 CALCULATE_VAL
|
|
* 1.计算结果 CALCULATE_VAL
|
|
* 2.用户选择的采用的哪个池子投药 CHOOSE_POOL:0一池 1二池 2自动 3手动
|
|
* 2.用户选择的采用的哪个池子投药 CHOOSE_POOL:0一池 1二池 2自动 3手动
|
|
* 3.真实的投药池子(自动的话,2选1)ADD_POOL:0一池 1二池
|
|
* 3.真实的投药池子(自动的话,2选1)ADD_POOL:0一池 1二池
|
|
@@ -223,10 +224,10 @@ public class TXinyiMedicineParamServiceImpl implements ITXinyiMedicineParamServi
|
|
* @param param
|
|
* @param param
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- public HashMap<Object, Object> calculateMedicineByLastRecord(TXinyiMedicineParam param) {
|
|
|
|
- HashMap<Object, Object> map = new HashMap<>();
|
|
|
|
|
|
+ public MedicineRemote calculateMedicineByLastRecord(TXinyiMedicineParam param) {
|
|
|
|
+ MedicineRemote medicineRemote = new MedicineRemote();
|
|
if (Objects.isNull(param)) {
|
|
if (Objects.isNull(param)) {
|
|
- return map;
|
|
|
|
|
|
+ return medicineRemote;
|
|
}
|
|
}
|
|
|
|
|
|
//2025年04月24日17:21:58 控制系数获取创哥预测的值,不再由用户主动输入
|
|
//2025年04月24日17:21:58 控制系数获取创哥预测的值,不再由用户主动输入
|
|
@@ -234,7 +235,7 @@ public class TXinyiMedicineParamServiceImpl implements ITXinyiMedicineParamServi
|
|
AutoFeedback autoFeedback2 = autoFeedbackMapper.selectAutoFeedbackLatestByPool(2);
|
|
AutoFeedback autoFeedback2 = autoFeedbackMapper.selectAutoFeedbackLatestByPool(2);
|
|
if(Objects.isNull(autoFeedback1) || Objects.isNull(autoFeedback2)){
|
|
if(Objects.isNull(autoFeedback1) || Objects.isNull(autoFeedback2)){
|
|
log.error("获取创哥推荐的系数失败,无法计算");
|
|
log.error("获取创哥推荐的系数失败,无法计算");
|
|
- return map;
|
|
|
|
|
|
+ return medicineRemote;
|
|
}
|
|
}
|
|
BigDecimal htfksd1 = autoFeedback1.getBasePara();
|
|
BigDecimal htfksd1 = autoFeedback1.getBasePara();
|
|
BigDecimal htfksd2 = autoFeedback2.getBasePara();
|
|
BigDecimal htfksd2 = autoFeedback2.getBasePara();
|
|
@@ -291,12 +292,12 @@ public class TXinyiMedicineParamServiceImpl implements ITXinyiMedicineParamServi
|
|
if(!Objects.isNull(type)) {
|
|
if(!Objects.isNull(type)) {
|
|
if(3 == type){
|
|
if(3 == type){
|
|
// return medicineAmount;
|
|
// return medicineAmount;
|
|
- map.put("CHOOSE_POOL", 3);
|
|
|
|
- map.put("ADD_POOL", null);
|
|
|
|
- map.put("CALCULATE_VAL", medicineAmount);
|
|
|
|
- map.put("HTFKSD", null);
|
|
|
|
- map.put("KZXS", null);
|
|
|
|
- return map;
|
|
|
|
|
|
+ medicineRemote.setChoosePool(3);
|
|
|
|
+ medicineRemote.setAddPool(null);
|
|
|
|
+ medicineRemote.setCalculateVal(medicineAmount);
|
|
|
|
+ medicineRemote.setHtfksd(null);
|
|
|
|
+ medicineRemote.setKzxs(null);
|
|
|
|
+ return medicineRemote;
|
|
}
|
|
}
|
|
//计算1号池的值
|
|
//计算1号池的值
|
|
BigDecimal oneResult = this.getResultByDiff(hycXsyType, hycXsyOne, htfksd1, qycAdType, qycAdOne, qycYxyType, qycYxyOne, xzxs, jzxs, jsLlType, jsLlOne, slfpxs, kzxs1, jsCodType, jsCodOne, zhxs, tydl, "one", yymd, sxps);
|
|
BigDecimal oneResult = this.getResultByDiff(hycXsyType, hycXsyOne, htfksd1, qycAdType, qycAdOne, qycYxyType, qycYxyOne, xzxs, jzxs, jsLlType, jsLlOne, slfpxs, kzxs1, jsCodType, jsCodOne, zhxs, tydl, "one", yymd, sxps);
|
|
@@ -304,43 +305,43 @@ public class TXinyiMedicineParamServiceImpl implements ITXinyiMedicineParamServi
|
|
BigDecimal twoResult = this.getResultByDiff(hycXsyType, hycXsyTwo, htfksd2, qycAdType, qycAdTwo, qycYxyType, qycYxyTwo, xzxs, jzxs, jsLlType, jsLlTwo, slfpxs, kzxs2, jsCodType, jsCodTwo, zhxs, tydl, "two", yymd, sxps);
|
|
BigDecimal twoResult = this.getResultByDiff(hycXsyType, hycXsyTwo, htfksd2, qycAdType, qycAdTwo, qycYxyType, qycYxyTwo, xzxs, jzxs, jsLlType, jsLlTwo, slfpxs, kzxs2, jsCodType, jsCodTwo, zhxs, tydl, "two", yymd, sxps);
|
|
//判断,返回值
|
|
//判断,返回值
|
|
if(0 == type){
|
|
if(0 == type){
|
|
- map.put("CHOOSE_POOL", 2);
|
|
|
|
|
|
+ medicineRemote.setChoosePool(2);
|
|
if(!Objects.isNull(oneResult) && !Objects.isNull(twoResult)){
|
|
if(!Objects.isNull(oneResult) && !Objects.isNull(twoResult)){
|
|
if(oneResult.compareTo(twoResult) > 0){
|
|
if(oneResult.compareTo(twoResult) > 0){
|
|
- map.put("ADD_POOL", 0);
|
|
|
|
- map.put("CALCULATE_VAL", oneResult);
|
|
|
|
- map.put("HTFKSD", htfksd1);
|
|
|
|
- map.put("KZXS", kzxs1);
|
|
|
|
- return map;
|
|
|
|
|
|
+ medicineRemote.setAddPool(0);
|
|
|
|
+ medicineRemote.setCalculateVal(oneResult);
|
|
|
|
+ medicineRemote.setHtfksd(htfksd1);
|
|
|
|
+ medicineRemote.setKzxs(kzxs1);
|
|
|
|
+ return medicineRemote;
|
|
}else{
|
|
}else{
|
|
- map.put("ADD_POOL", 1);
|
|
|
|
- map.put("CALCULATE_VAL", twoResult);
|
|
|
|
- map.put("HTFKSD", htfksd2);
|
|
|
|
- map.put("KZXS", kzxs2);
|
|
|
|
- return map;
|
|
|
|
|
|
+ medicineRemote.setAddPool(1);
|
|
|
|
+ medicineRemote.setCalculateVal(twoResult);
|
|
|
|
+ medicineRemote.setHtfksd(htfksd2);
|
|
|
|
+ medicineRemote.setKzxs(kzxs2);
|
|
|
|
+ return medicineRemote;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else if(1 == type) {
|
|
else if(1 == type) {
|
|
- map.put("CHOOSE_POOL", 0);
|
|
|
|
- map.put("ADD_POOL", 0);
|
|
|
|
- map.put("CALCULATE_VAL", oneResult);
|
|
|
|
- map.put("HTFKSD", htfksd1);
|
|
|
|
- map.put("KZXS", kzxs1);
|
|
|
|
- return map;
|
|
|
|
|
|
+ medicineRemote.setChoosePool(0);
|
|
|
|
+ medicineRemote.setAddPool(0);
|
|
|
|
+ medicineRemote.setCalculateVal(oneResult);
|
|
|
|
+ medicineRemote.setHtfksd(htfksd1);
|
|
|
|
+ medicineRemote.setKzxs(kzxs1);
|
|
|
|
+ return medicineRemote;
|
|
}else if(2 == type){
|
|
}else if(2 == type){
|
|
- map.put("CHOOSE_POOL", 1);
|
|
|
|
- map.put("ADD_POOL", 1);
|
|
|
|
- map.put("CALCULATE_VAL", twoResult);
|
|
|
|
- map.put("HTFKSD", htfksd2);
|
|
|
|
- map.put("KZXS", kzxs2);
|
|
|
|
- return map;
|
|
|
|
|
|
+ medicineRemote.setChoosePool(1);
|
|
|
|
+ medicineRemote.setAddPool(1);
|
|
|
|
+ medicineRemote.setCalculateVal(twoResult);
|
|
|
|
+ medicineRemote.setHtfksd(htfksd2);
|
|
|
|
+ medicineRemote.setKzxs(kzxs2);
|
|
|
|
+ return medicineRemote;
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
- return map;//错误的配置
|
|
|
|
|
|
+ return medicineRemote;//错误的配置
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- return map;
|
|
|
|
|
|
+ return medicineRemote;
|
|
}
|
|
}
|
|
|
|
|
|
private BigDecimal getResultByDiff(Integer hycXsyType, BigDecimal hycXsyVal, BigDecimal htfksd, Integer qycAdType, BigDecimal qycAdVal, Integer qycYxyType,
|
|
private BigDecimal getResultByDiff(Integer hycXsyType, BigDecimal hycXsyVal, BigDecimal htfksd, Integer qycAdType, BigDecimal qycAdVal, Integer qycYxyType,
|