zhubaomin
2024-11-01 e6f64dc1c6a24c3f6f38fcb312ed45aa9d57b68f
2024-11-01 虚拟卡常用充值金额实现自动初始化
2个文件已修改
72 ■■■■■ 已修改文件
pipIrr-platform/pipIrr-global/src/main/resources/init-config.xml 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/util/InitListener.java 48 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pipIrr-platform/pipIrr-global/src/main/resources/init-config.xml
@@ -49,6 +49,14 @@
                <item7 defaultValue = "50" unit = "3" sort = "3" type = "2"/>
                <item8 defaultValue = "80" unit = "3" sort = "4" type = "2"/>
            </irrigateProfile>
            <rechargeProfile>
                <item1 rechargeAmount = "5000" sort = "1"/>
                <item2 rechargeAmount = "10000" sort = "2" />
                <item3 rechargeAmount = "20000" sort = "3"/>
                <item4 rechargeAmount = "30000" sort = "4"/>
                <item5 rechargeAmount = "50000" sort = "5"/>
                <item6 rechargeAmount = "100000" sort = "6"/>
            </rechargeProfile>
        </org1>
        <org2 tag="sp" name="沙盘" enable="true">
            <districts>
@@ -97,6 +105,14 @@
                <item7 defaultValue = "50" unit = "3" sort = "3" type = "2"/>
                <item8 defaultValue = "80" unit = "3" sort = "4" type = "2"/>
            </irrigateProfile>
            <rechargeProfile>
                <item1 rechargeAmount = "5000" sort = "1"/>
                <item2 rechargeAmount = "10000" sort = "2" />
                <item3 rechargeAmount = "20000" sort = "3"/>
                <item4 rechargeAmount = "30000" sort = "4"/>
                <item5 rechargeAmount = "50000" sort = "5"/>
                <item6 rechargeAmount = "100000" sort = "6"/>
            </rechargeProfile>
        </org2>
        <org3 tag="test" name="测试" enable="true">
            <districts>
@@ -145,6 +161,14 @@
                <item7 defaultValue = "50" unit = "3" sort = "3" type = "2"/>
                <item8 defaultValue = "80" unit = "3" sort = "4" type = "2"/>
            </irrigateProfile>
            <rechargeProfile>
                <item1 rechargeAmount = "5000" sort = "1"/>
                <item2 rechargeAmount = "10000" sort = "2" />
                <item3 rechargeAmount = "20000" sort = "3"/>
                <item4 rechargeAmount = "30000" sort = "4"/>
                <item5 rechargeAmount = "50000" sort = "5"/>
                <item6 rechargeAmount = "100000" sort = "6"/>
            </rechargeProfile>
        </org3>
    </orgs>
</config>
pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/util/InitListener.java
@@ -9,11 +9,13 @@
import com.dy.pipIrrGlobal.daoPr.PrWaterPriceMapper;
import com.dy.pipIrrGlobal.daoRm.RmIrrigateProfileMapper;
import com.dy.pipIrrGlobal.daoSe.SePaymentMethodMapper;
import com.dy.pipIrrGlobal.daoSe.SeRechargeProfileMapper;
import com.dy.pipIrrGlobal.daoSe.SeWaterTypeMapper;
import com.dy.pipIrrGlobal.pojoBa.*;
import com.dy.pipIrrGlobal.pojoPr.PrWaterPrice;
import com.dy.pipIrrGlobal.pojoRm.RmIrrigateProfile;
import com.dy.pipIrrGlobal.pojoSe.SePaymentMethod;
import com.dy.pipIrrGlobal.pojoSe.SeRechargeProfile;
import com.dy.pipIrrGlobal.pojoSe.SeWaterType;
import com.dy.pipIrrGlobal.util.DistrictLevel;
import org.jdom2.Document;
@@ -44,6 +46,7 @@
    private PrWaterPriceMapper prWaterPriceDao;
    private BaDictMapper baDictDao;
    private BaDictItemMapper baDictItemDao;
    private SeRechargeProfileMapper seRechargeProfileDao;
    @Autowired
    public void setResourceLoader(ResourceLoader resourceLoader){
@@ -93,6 +96,11 @@
    @Autowired
    public void setBaDictItemDao(BaDictItemMapper baDictItemDao) {
        this.baDictItemDao = baDictItemDao;
    }
    @Autowired
    public void setSeRechargeProfileDao(SeRechargeProfileMapper seRechargeProfileDao) {
        this.seRechargeProfileDao = seRechargeProfileDao;
    }
    /**
@@ -205,6 +213,21 @@
                                }
                            }
                        }
                        if(!this.existRechargeProfile()){
                            if(configXml.existElement(doc, "config.orgs.org" + num + ".rechargeProfile")){
                                for(int i = 1 ; i < 10000; i++){
                                    if(configXml.existElement(doc, "config.orgs.org" + num + ".rechargeProfile.item" + i)){
                                        String rechargeAmount = configXml.getSetAttrTxt(doc, "config.orgs.org" + num + ".rechargeProfile.item" + i,"rechargeAmount", null, false, null) ;
                                        String sort = configXml.getSetAttrTxt(doc, "config.orgs.org" + num + ".rechargeProfile.item" + i,"sort", null, false, null) ;
                                        this.saveRechargeProfile(orgTag, rechargeAmount, sort);
                                    }else{
                                        break ;
                                    }
                                }
                            }
                        }
                        if(!this.existWaterTypes()){
                            if(configXml.existElement(doc, "config.orgs.org" + num + ".waterTypes")){
                                for(int i = 1 ; i < 10000; i++){
@@ -305,6 +328,15 @@
    private boolean existIrrigateProfile(){
        Long total = this.rmIrrigateProfileDao.selectCount(null) ;
        return (total != null && total > 0) ;
    }
    /**
     * 数据库中是否存在虚拟常用充值金额配置
     * @return
     */
    private boolean existRechargeProfile() {
        Long total = this.seRechargeProfileDao.selectCount(null);
        return (total != null && total > 0);
    }
    /**
@@ -446,6 +478,22 @@
    }
    /**
     * 保存虚拟卡常用充值金额配置
     * @param orgTag
     * @param recharge_amount
     * @param sort
     */
    private void saveRechargeProfile(String orgTag, String recharge_amount, String sort) {
        if((recharge_amount != null && !recharge_amount.trim().equals("")) && (sort != null && !sort.trim().equals(""))) {
            SeRechargeProfile po = new SeRechargeProfile();
            po.setRechargeAmount(Integer.parseInt(recharge_amount));
            po.setSort(Integer.parseInt(sort));
            this.seRechargeProfileDao.insert(po);
        }
    }
    /**
     * 保存水价
     * @param price
     */