From 1e567af8bbdda31ce3342cd41bb40157168b3da9 Mon Sep 17 00:00:00 2001
From: wuzeyu <1223318623@qq.com>
Date: 星期三, 28 八月 2024 17:27:13 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/util/InitListener.java | 52 +++++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 47 insertions(+), 5 deletions(-)
diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/util/InitListener.java b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/util/InitListener.java
index 11c4f8a..08dd62f 100644
--- a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/util/InitListener.java
+++ b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/util/InitListener.java
@@ -8,11 +8,13 @@
import com.dy.pipIrrGlobal.daoBa.BaDistrictMapper;
import com.dy.pipIrrGlobal.daoBa.BaSettingsMapper;
import com.dy.pipIrrGlobal.daoBa.BaUserMapper;
+import com.dy.pipIrrGlobal.daoRm.RmIrrigateProfileMapper;
import com.dy.pipIrrGlobal.daoSe.SePaymentMethodMapper;
import com.dy.pipIrrGlobal.daoSe.SeWaterTypeMapper;
import com.dy.pipIrrGlobal.pojoBa.BaDistrict;
import com.dy.pipIrrGlobal.pojoBa.BaSettings;
import com.dy.pipIrrGlobal.pojoBa.BaUser;
+import com.dy.pipIrrGlobal.pojoRm.RmIrrigateProfile;
import com.dy.pipIrrGlobal.pojoSe.SePaymentMethod;
import com.dy.pipIrrGlobal.pojoSe.SeWaterType;
import com.dy.pipIrrGlobal.util.DistrictLevel;
@@ -40,6 +42,7 @@
private SePaymentMethodMapper paymentMethodDao ;
private BaSettingsMapper settingsDao ;
private SeWaterTypeMapper waterTypeDao ;
+ private RmIrrigateProfileMapper rmIrrigateProfileDao;
@Autowired
public void setResourceLoader(ResourceLoader resourceLoader){
@@ -71,6 +74,10 @@
this.waterTypeDao = waterTypeDao ;
}
+ @Autowired
+ public void setRmIrrigateProfileDao(RmIrrigateProfileMapper rmIrrigateProfileDao) {
+ this.rmIrrigateProfileDao = rmIrrigateProfileDao;
+ }
/**
* SpringBoot瀹瑰櫒宸茬粡鍑嗗濂戒簡
@@ -167,12 +174,15 @@
}
}
}
- if(!this.existWaterTypes()){
- if(configXml.existElement(doc, "config.orgs.org" + num + ".waterTypes")){
+ if(!this.existIrrigateProfile()){
+ if(configXml.existElement(doc, "config.orgs.org" + num + ".irrigateProfile")){
for(int i = 1 ; i < 10000; i++){
- if(configXml.existElement(doc, "config.orgs.org" + num + ".waterTypes.item" + i)){
- String typeName = configXml.getSetAttrTxt(doc, "config.orgs.org" + num + ".waterTypes.item" + i,"typeName", null, false, null) ;
- this.saveWaterType(orgTag, typeName);
+ if(configXml.existElement(doc, "config.orgs.org" + num + ".irrigateProfile.item" + i)){
+ String default_value = configXml.getSetAttrTxt(doc, "config.orgs.org" + num + ".irrigateProfile.item" + i,"default_value", null, false, null) ;
+ String unit = configXml.getSetAttrTxt(doc, "config.orgs.org" + num + ".irrigateProfile.item" + i,"unit", null, false, null) ;
+ String sort = configXml.getSetAttrTxt(doc, "config.orgs.org" + num + ".irrigateProfile.item" + i,"sort", null, false, null) ;
+ String type = configXml.getSetAttrTxt(doc, "config.orgs.org" + num + ".irrigateProfile.item" + i,"type", null, false, null) ;
+ this.saveIrrigateProfile(orgTag, default_value, unit,sort,type);
}else{
break ;
}
@@ -229,6 +239,15 @@
*/
private boolean existWaterTypes(){
Long total = this.waterTypeDao.selectCount(null) ;
+ return (total != null && total > 0) ;
+ }
+
+ /**
+ * 鏁版嵁搴撲腑鏄惁瀛樺湪鐏屾簤閰嶇疆
+ * @return
+ */
+ private boolean existIrrigateProfile(){
+ Long total = this.rmIrrigateProfileDao.selectCount(null) ;
return (total != null && total > 0) ;
}
@@ -328,4 +347,27 @@
}
}
+ /**
+ * 淇濆瓨鐏屾簤閰嶇疆
+ * @param orgTag
+ * @param default_value
+ * @param unit
+ * @param sort
+ * @param type
+ * @throws Exception
+ */
+ private void saveIrrigateProfile(String orgTag, String default_value, String unit, String sort, String type) throws Exception{
+ if((default_value != null && !default_value.trim().equals("")) &&
+ (unit != null && !unit.trim().equals("")) &&
+ (sort != null && !sort.trim().equals("")) &&
+ (type != null && !type.trim().equals(""))){
+ RmIrrigateProfile po = new RmIrrigateProfile();
+ po.setDefaultValue(Integer.parseInt(default_value));
+ po.setUnit(Byte.valueOf(unit));
+ po.setSort(Integer.parseInt(sort));
+ po.setType(Byte.valueOf(type));
+ this.rmIrrigateProfileDao.insert(po);
+ }
+ }
+
}
--
Gitblit v1.8.0