From bc8ab2ccb801ece9f2638098e8acd07f3ef1978d Mon Sep 17 00:00:00 2001 From: zhubaomin <zhubaomin> Date: 星期五, 30 八月 2024 20:35:09 +0800 Subject: [PATCH] 2024-08-30 朱宝民 解决获取水卡列表接口错误,无虚拟卡时不显示空对象 --- pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/util/InitListener.java | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 53 insertions(+), 1 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 08dd62f..4e54a8f 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,12 +8,14 @@ import com.dy.pipIrrGlobal.daoBa.BaDistrictMapper; import com.dy.pipIrrGlobal.daoBa.BaSettingsMapper; import com.dy.pipIrrGlobal.daoBa.BaUserMapper; +import com.dy.pipIrrGlobal.daoPr.PrWaterPriceMapper; 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.pojoPr.PrWaterPrice; import com.dy.pipIrrGlobal.pojoRm.RmIrrigateProfile; import com.dy.pipIrrGlobal.pojoSe.SePaymentMethod; import com.dy.pipIrrGlobal.pojoSe.SeWaterType; @@ -43,6 +45,7 @@ private BaSettingsMapper settingsDao ; private SeWaterTypeMapper waterTypeDao ; private RmIrrigateProfileMapper rmIrrigateProfileDao; + private PrWaterPriceMapper prWaterPriceDao; @Autowired public void setResourceLoader(ResourceLoader resourceLoader){ @@ -77,6 +80,11 @@ @Autowired public void setRmIrrigateProfileDao(RmIrrigateProfileMapper rmIrrigateProfileDao) { this.rmIrrigateProfileDao = rmIrrigateProfileDao; + } + + @Autowired + public void setWaterPriceDao(PrWaterPriceMapper prWaterPriceDao) { + this.prWaterPriceDao = prWaterPriceDao; } /** @@ -189,6 +197,24 @@ } } } + if(!this.existWaterTypes()){ + if(configXml.existElement(doc, "config.orgs.org" + num + ".waterTypes")){ + 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); + }else{ + break ; + } + } + } + } + if(!this.existWaterPrice()){ + if(configXml.existElement(doc, "config.orgs.org" + num + ".waterPrice")){ + String price = configXml.getSetAttrTxt(doc, "config.orgs.org" + num + ".waterPrice","price", null, false, null) ; + this.saveWaterPrice(orgTag, price); + } + } } }else{ break ; @@ -238,7 +264,7 @@ * @return 瀛樺湪鍚� */ private boolean existWaterTypes(){ - Long total = this.waterTypeDao.selectCount(null) ; + Long total = this.prWaterPriceDao.selectCount(null) ; return (total != null && total > 0) ; } @@ -248,6 +274,15 @@ */ private boolean existIrrigateProfile(){ Long total = this.rmIrrigateProfileDao.selectCount(null) ; + return (total != null && total > 0) ; + } + + /** + * 鏁版嵁搴撲腑鏄惁瀛樺湪姘翠环 + * @return + */ + private boolean existWaterPrice() { + Long total = this.prWaterPriceDao.selectCount(null); return (total != null && total > 0) ; } @@ -370,4 +405,21 @@ } } + /** + * 淇濆瓨姘翠环 + * @param price + */ + private void saveWaterPrice(String orgTag, String price) { + if(price != null && !price.trim().equals("")) { + PrWaterPrice po = new PrWaterPrice(); + po.setPrice(Double.parseDouble(price)); + po.setDeleted((byte)0); + this.prWaterPriceDao.insert(po); + + } + + } + + + } -- Gitblit v1.8.0