From d6b30c6097618391359565de48519614363e8a26 Mon Sep 17 00:00:00 2001
From: wuxw <928255095@qq.com>
Date: 星期五, 05 四月 2024 22:23:13 +0800
Subject: [PATCH] 优化时间不对bug

---
 service-fee/src/main/java/com/java110/fee/cmd/fee/PayFeeCmd.java |  494 +++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 375 insertions(+), 119 deletions(-)

diff --git a/service-fee/src/main/java/com/java110/fee/cmd/fee/PayFeeCmd.java b/service-fee/src/main/java/com/java110/fee/cmd/fee/PayFeeCmd.java
index c63097a..d2a74df 100644
--- a/service-fee/src/main/java/com/java110/fee/cmd/fee/PayFeeCmd.java
+++ b/service-fee/src/main/java/com/java110/fee/cmd/fee/PayFeeCmd.java
@@ -4,6 +4,7 @@
 import com.alibaba.fastjson.JSONObject;
 import com.java110.core.annotation.Java110Cmd;
 import com.java110.core.annotation.Java110Transactional;
+import com.java110.core.context.CmdContextUtils;
 import com.java110.core.context.ICmdDataFlowContext;
 import com.java110.core.event.cmd.Cmd;
 import com.java110.core.event.cmd.CmdEvent;
@@ -13,25 +14,21 @@
 import com.java110.core.smo.IComputeFeeSMO;
 import com.java110.dto.account.AccountDto;
 import com.java110.dto.account.AccountDetailDto;
-import com.java110.dto.fee.FeeAttrDto;
-import com.java110.dto.fee.FeeConfigDto;
-import com.java110.dto.fee.FeeDto;
-import com.java110.dto.fee.FeeReceiptDetailDto;
+import com.java110.dto.fee.*;
 import com.java110.dto.owner.OwnerCarDto;
 import com.java110.dto.parking.ParkingSpaceDto;
 import com.java110.dto.repair.RepairDto;
 import com.java110.dto.repair.RepairUserDto;
 import com.java110.dto.user.UserDto;
-import com.java110.intf.acct.IAccountDetailInnerServiceSMO;
+import com.java110.fee.smo.impl.FeeReceiptInnerServiceSMOImpl;
 import com.java110.intf.acct.IAccountInnerServiceSMO;
-import com.java110.intf.acct.ICouponUserDetailV1InnerServiceSMO;
-import com.java110.intf.acct.ICouponUserV1InnerServiceSMO;
 import com.java110.intf.community.*;
 import com.java110.intf.fee.*;
 import com.java110.intf.fee.IFeeAccountDetailServiceSMO;
 import com.java110.intf.user.IOwnerCarInnerServiceSMO;
 import com.java110.intf.user.IUserV1InnerServiceSMO;
 import com.java110.po.account.AccountDetailPo;
+import com.java110.po.fee.FeeAttrPo;
 import com.java110.po.room.ApplyRoomDiscountPo;
 import com.java110.po.car.OwnerCarPo;
 import com.java110.po.fee.PayFeeDetailPo;
@@ -42,14 +39,9 @@
 import com.java110.po.payFee.PayFeeDetailDiscountPo;
 import com.java110.utils.cache.CommonCache;
 import com.java110.utils.constant.FeeFlagTypeConstant;
-import com.java110.utils.constant.ResponseConstant;
 import com.java110.utils.exception.CmdException;
-import com.java110.utils.exception.ListenerExecuteException;
 import com.java110.utils.lock.DistributedLock;
-import com.java110.utils.util.Assert;
-import com.java110.utils.util.BeanConvertUtil;
-import com.java110.utils.util.DateUtil;
-import com.java110.utils.util.StringUtil;
+import com.java110.utils.util.*;
 import com.java110.vo.ResultVo;
 import org.slf4j.Logger;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -83,16 +75,10 @@
     private IFeeAttrInnerServiceSMO feeAttrInnerServiceSMOImpl;
 
     @Autowired
-    private IRoomInnerServiceSMO roomInnerServiceSMOImpl;
-
-    @Autowired
     private IFeeConfigInnerServiceSMO feeConfigInnerServiceSMOImpl;
 
     @Autowired
     private IOwnerCarInnerServiceSMO ownerCarInnerServiceSMOImpl;
-
-    @Autowired
-    private IFeeReceiptDetailInnerServiceSMO feeReceiptDetailInnerServiceSMOImpl;
 
     @Autowired
     private IRepairUserInnerServiceSMO repairUserInnerServiceSMO;
@@ -105,9 +91,6 @@
 
     @Autowired
     private IParkingSpaceInnerServiceSMO parkingSpaceInnerServiceSMOImpl;
-
-    @Autowired
-    private IAccountDetailInnerServiceSMO accountDetailInnerServiceSMOImpl;
 
     @Autowired
     private IAccountInnerServiceSMO accountInnerServiceSMOImpl;
@@ -125,12 +108,6 @@
     private IRepairUserV1InnerServiceSMO repairUserNewV1InnerServiceSMOImpl;
 
     @Autowired
-    private ICouponUserV1InnerServiceSMO couponUserV1InnerServiceSMOImpl;
-
-    @Autowired
-    private ICouponUserDetailV1InnerServiceSMO couponUserDetailV1InnerServiceSMOImpl;
-
-    @Autowired
     private IOwnerCarNewV1InnerServiceSMO ownerCarNewV1InnerServiceSMOImpl;
 
     @Autowired
@@ -139,6 +116,11 @@
     @Autowired
     private IUserV1InnerServiceSMO userV1InnerServiceSMOImpl;
 
+    @Autowired
+    private FeeReceiptInnerServiceSMOImpl feeReceiptInnerServiceSMOImpl;
+
+    @Autowired
+    private IFeeDiscountInnerServiceSMO feeDiscountInnerServiceSMOImpl;
 
     @Override
     public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
@@ -146,12 +128,10 @@
         Assert.jsonObjectHaveKey(reqJson, "cycles", "璇锋眰鎶ユ枃涓湭鍖呭惈cycles鑺傜偣");
         Assert.jsonObjectHaveKey(reqJson, "receivedAmount", "璇锋眰鎶ユ枃涓湭鍖呭惈receivedAmount鑺傜偣");
         Assert.jsonObjectHaveKey(reqJson, "feeId", "璇锋眰鎶ユ枃涓湭鍖呭惈feeId鑺傜偣");
-
         Assert.hasLength(reqJson.getString("communityId"), "灏忓尯ID涓嶈兘涓虹┖");
         Assert.hasLength(reqJson.getString("cycles"), "鍛ㄦ湡涓嶈兘涓虹┖");
         Assert.hasLength(reqJson.getString("receivedAmount"), "瀹炴敹閲戦涓嶈兘涓虹┖");
         Assert.hasLength(reqJson.getString("feeId"), "璐圭敤ID涓嶈兘涓虹┖");
-
         //鍒ゆ柇鏄惁 璐圭敤鐘舵�佷负缂磋垂缁撴潫
         FeeDto feeDto = new FeeDto();
         feeDto.setFeeId(reqJson.getString("feeId"));
@@ -163,7 +143,7 @@
         feeDto = feeDtos.get(0);
 
         if (FeeDto.STATE_FINISH.equals(feeDto.getState())) {
-            throw new IllegalArgumentException("鏀惰垂宸茬粡缁撴潫锛屼笉鑳藉啀缂磋垂");
+            throw new CmdException("鏀惰垂宸茬粡缁撴潫锛屼笉鑳藉啀缂磋垂");
         }
 
         Date endTime = feeDto.getEndTime();
@@ -172,29 +152,41 @@
         feeConfigDto.setConfigId(feeDto.getConfigId());
         feeConfigDto.setCommunityId(reqJson.getString("communityId"));
         List<FeeConfigDto> feeConfigDtos = feeConfigInnerServiceSMOImpl.queryFeeConfigs(feeConfigDto);
-
-        if (feeConfigDtos == null || feeConfigDtos.size() != 1) {
-            throw new IllegalArgumentException("璐圭敤椤逛笉瀛樺湪");
+        if (ListUtil.isNull(feeConfigDtos)) {
+            throw new CmdException("璐圭敤椤逛笉瀛樺湪");
         }
-        //涓�娆℃�ц垂鐢� 鍜岄棿鎺ユ�ц垂鐢�
+        // 鑾峰彇璐圭敤缁撴潫鏃堕棿
         Date maxEndTime = feeDtos.get(0).getDeadlineTime();
         //鍛ㄦ湡鎬ц垂鐢�
-        if (maxEndTime == null || FeeDto.FEE_FLAG_CYCLE.equals(feeConfigDtos.get(0).getFeeFlag())) {
+        if (maxEndTime == null) {
             maxEndTime = DateUtil.getDateFromStringA(feeConfigDtos.get(0).getEndTime());
         }
 
-        if (maxEndTime != null && endTime != null && !FeeDto.FEE_FLAG_ONCE.equals(feeConfigDtos.get(0).getFeeFlag())) {
+        if (maxEndTime != null && endTime != null && !FeeDto.FEE_FLAG_ONCE.equals(feeDtos.get(0).getFeeFlag())) {
             Date newDate = DateUtil.stepMonth(endTime, reqJson.getDouble("cycles").intValue());
             if (newDate.getTime() > maxEndTime.getTime()) {
                 throw new IllegalArgumentException("缂磋垂鍛ㄦ湡瓒呰繃 缂磋垂缁撴潫鏃堕棿,璇风敤鎸夌粨鏉熸椂闂存柟寮忕即璐�");
             }
         }
 
-        String selectUserAccount = reqJson.getString("selectUserAccount");
-        JSONArray params = JSONArray.parseArray(selectUserAccount);
-        for (int paramIndex = 0; paramIndex < params.size(); paramIndex++) {
-            JSONObject param = params.getJSONObject(paramIndex);
+        JSONArray selectUserAccount = reqJson.getJSONArray("selectUserAccount");
+        for (int paramIndex = 0; paramIndex < selectUserAccount.size(); paramIndex++) {
+            JSONObject param = selectUserAccount.getJSONObject(paramIndex);
             String maximumNumber = param.getString("maximumNumber");
+        }
+
+
+        //todo 鏄惁鎸夌即璐规椂闂存缂磋垂
+        validateIfPayFeeStartEndDate(reqJson, feeConfigDtos.get(0));
+
+        //todo 鏍¢獙 浼樻儬
+        JSONArray selectDiscounts = reqJson.getJSONArray("selectDiscount");
+        if (!ListUtil.isNull(selectDiscounts)) {
+            for (int discountIndex = 0; discountIndex < selectDiscounts.size(); discountIndex++) {
+                JSONObject param = selectDiscounts.getJSONObject(discountIndex);
+                Assert.hasKeyAndValue(param, "discountId", "鏈寘鍚紭鎯營D");
+                Assert.hasKeyAndValue(param, "discountPrice", "鏈寘鍚紭鎯犻噾棰�");
+            }
         }
     }
 
@@ -203,29 +195,46 @@
     @Java110Transactional
     public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject paramObj) throws CmdException {
         logger.debug("paramObj : {}", paramObj);
+        String payOrderId = paramObj.getString("payOrderId");
 
-        String userId = cmdDataFlowContext.getReqHeaders().get("user-id");
+        String userId = CmdContextUtils.getUserId(cmdDataFlowContext);
         UserDto userDto = new UserDto();
         userDto.setUserId(userId);
         List<UserDto> userDtos = userV1InnerServiceSMOImpl.queryUsers(userDto);
         Assert.listOnlyOne(userDtos, "鐢ㄦ埛鏈櫥褰�");
+
+        String cycles = paramObj.getString("cycles");
+        Date endTime = null;
+
+        //todo 鐢熸垚鏀舵嵁缂栧彿
+        String receiptCode = feeReceiptInnerServiceSMOImpl.generatorReceiptCode(paramObj.getString("communityId"));
 
         PayFeePo payFeePo = null;
         String requestId = DistributedLock.getLockUUID();
         String key = this.getClass().getSimpleName() + paramObj.get("feeId");
         try {
             DistributedLock.waitGetDistributedLock(key, requestId);
+            //todo 灏佽 缂磋垂璁板綍鎶ユ枃
             JSONObject feeDetail = addFeeDetail(paramObj);
+            FeeDto feeInfo = (FeeDto) paramObj.get("feeInfo");
+            endTime = feeInfo.getEndTime();
             feeDetail.put("payableAmount", feeDetail.getString("receivableAmount"));
-            JSONObject fee = modifyFee(paramObj);
-            payFeePo = BeanConvertUtil.covertBean(fee, PayFeePo.class);
+
             PayFeeDetailPo payFeeDetailPo = BeanConvertUtil.covertBean(feeDetail, PayFeeDetailPo.class);
             payFeeDetailPo.setReceivableAmount(feeDetail.getString("totalFeePrice"));
-            //鍒ゆ柇鏄惁鏈夎禒閫佽鍒�
-            hasDiscount(paramObj, payFeePo, payFeeDetailPo);
+            //todo 缂撳瓨鏀舵嵁缂栧彿
+            CommonCache.setValue(payFeeDetailPo.getDetailId() + CommonCache.RECEIPT_CODE, receiptCode, CommonCache.DEFAULT_EXPIRETIME_TWO_MIN);
+
+            //todo 灏佽 淇敼璐圭敤鏃堕棿鎶ユ枃
+            JSONObject fee = modifyFee(paramObj, payFeeDetailPo);
+            payFeePo = BeanConvertUtil.covertBean(fee, PayFeePo.class);
+
+            //todo 鍒ゆ柇鏄惁鏈夋姌鎵h鍒�
+            hasDiscount(paramObj, payFeePo, payFeeDetailPo, feeInfo);
 
             // todo 澶勭悊鐢ㄦ埛璐︽埛
             dealUserAccount(paramObj, payFeeDetailPo);
+
 
             String oId = Java110TransactionalFactory.getOId();
             if (StringUtil.isEmpty(oId)) {
@@ -233,8 +242,38 @@
             }
 
             payFeeDetailPo.setPayOrderId(oId);
+            // todo 濡傛灉 鎵爜鏋敮浠� 杈撳叆鏀粯璁㈠崟ID
+            if (!StringUtil.isEmpty(payOrderId)) {
+                payFeeDetailPo.setPayOrderId(payOrderId);
+            }
             payFeeDetailPo.setCashierId(userDtos.get(0).getUserId());
             payFeeDetailPo.setCashierName(userDtos.get(0).getName());
+            payFeeDetailPo.setOpenInvoice("N");
+            if (!StringUtil.isEmpty(paramObj.getString("cashAmount")) && !StringUtil.isEmpty(paramObj.getString("integralAmount"))) {
+                BigDecimal cashAmount = new BigDecimal(paramObj.getString("cashAmount")).setScale(2, BigDecimal.ROUND_HALF_UP);
+                BigDecimal integralAmount = new BigDecimal(paramObj.getString("integralAmount")).setScale(2, BigDecimal.ROUND_HALF_UP);
+                if (!StringUtil.isEmpty(payFeeDetailPo.getRemark())) {
+                    payFeeDetailPo.setRemark(payFeeDetailPo.getRemark() + "锛岀幇閲戣处鎴锋姷鎵�" + cashAmount + "鍏冿紝绉垎璐︽埛鎶垫墸" + integralAmount + "鍏�");
+                } else {
+                    payFeeDetailPo.setRemark("鐜伴噾璐︽埛鎶垫墸" + cashAmount + "鍏冿紝绉垎璐︽埛鎶垫墸" + integralAmount + "鍏�");
+                }
+            }
+            if (!StringUtil.isEmpty(paramObj.getString("cashAmount")) && StringUtil.isEmpty(paramObj.getString("integralAmount"))) {
+                BigDecimal cashAmount = new BigDecimal(paramObj.getString("cashAmount")).setScale(2, BigDecimal.ROUND_HALF_UP);
+                if (!StringUtil.isEmpty(payFeeDetailPo.getRemark())) {
+                    payFeeDetailPo.setRemark(payFeeDetailPo.getRemark() + "锛岀幇閲戣处鎴锋姷鎵�" + cashAmount + "鍏�");
+                } else {
+                    payFeeDetailPo.setRemark("鐜伴噾璐︽埛鎶垫墸" + cashAmount + "鍏�");
+                }
+            }
+            if (StringUtil.isEmpty(paramObj.getString("cashAmount")) && !StringUtil.isEmpty(paramObj.getString("integralAmount"))) {
+                BigDecimal integralAmount = new BigDecimal(paramObj.getString("integralAmount")).setScale(2, BigDecimal.ROUND_HALF_UP);
+                if (!StringUtil.isEmpty(payFeeDetailPo.getRemark())) {
+                    payFeeDetailPo.setRemark(payFeeDetailPo.getRemark() + "锛岀Н鍒嗚处鎴锋姷鎵�" + integralAmount + "鍏�");
+                } else {
+                    payFeeDetailPo.setRemark("绉垎璐︽埛鎶垫墸" + integralAmount + "鍏�");
+                }
+            }
             int flag = payFeeDetailNewV1InnerServiceSMOImpl.savePayFeeDetailNew(payFeeDetailPo);
             if (flag < 1) {
                 throw new CmdException("缂磋垂澶辫触");
@@ -244,27 +283,21 @@
             if (flag < 1) {
                 throw new CmdException("缂磋垂澶辫触");
             }
+            // todo 濡傛灉鏄寜 鑷畾涔夋椂闂存缂磋垂锛岃繖閲岃ˉ涓�鏉$即璐硅褰� 鍜� 娆犺垂璐圭敤
+            ifCustomStartEndTimePayFee(cycles, endTime, payFeeDetailPo, payFeePo, paramObj);
         } catch (ParseException e) {
             e.printStackTrace();
         } finally {
-            DistributedLock.releaseDistributedLock(requestId, key);
+            DistributedLock.releaseDistributedLock(key, requestId);
         }
-        //璐︽埛澶勭悊
+        //todo 璐︽埛澶勭悊
         dealAccount(paramObj);
-        //鎶樻墸绠$悊
-        if (paramObj.containsKey("selectDiscount")) {
-            JSONObject discountBusiness = null;
-            JSONArray selectDiscounts = paramObj.getJSONArray("selectDiscount");
-            for (int discountIndex = 0; discountIndex < selectDiscounts.size(); discountIndex++) {
-                JSONObject param = selectDiscounts.getJSONObject(discountIndex);
-                addPayFeeDetailDiscount(paramObj, param);
-            }
-        }
 
-        //涓哄仠杞﹁垂鍗曠嫭澶勭悊
+
+        //todo 涓哄仠杞﹁垂鍗曠嫭澶勭悊
         updateCarEndTime(paramObj);
 
-        //澶勭悊鎶ヤ慨鍗�
+        //todo 澶勭悊鎶ヤ慨鍗�
         doDealRepairOrder(paramObj);
 
 
@@ -282,6 +315,7 @@
             }
         }
 
+
         //鏍规嵁鏄庣粏ID 鏌ヨ鏀舵嵁淇℃伅
         FeeReceiptDetailDto feeReceiptDetailDto = new FeeReceiptDetailDto();
         feeReceiptDetailDto.setDetailId(paramObj.getString("detailId"));
@@ -289,10 +323,11 @@
         cmdDataFlowContext.setResponseEntity(ResultVo.createResponseEntity(feeReceiptDetailDto));
     }
 
+
     private void dealUserAccount(JSONObject paramObj, PayFeeDetailPo payFeeDetailPo) {
         //鍒ゆ柇閫夋嫨鐨勮处鍙�
         JSONArray jsonArray = paramObj.getJSONArray("selectUserAccount");
-        if (jsonArray == null || jsonArray.size() < 1) {
+        if (ListUtil.isNull(jsonArray)) {
             return;
         }
 
@@ -337,8 +372,19 @@
                 } else if (flag < 1) { //绉垎鎹㈢畻閲戦灏忎簬绛変簬瀹炰粯閲戦
                     subtract = receivedAmount.subtract(divide);
                 }
-                integralSum = integralSum.add(subtract);
+//                integralSum = integralSum.add(subtract);
                 payFeeDetailPo.setReceivedAmount(subtract.toString());
+                integralSum = integralSum.add(divide);
+                // todo 濡傛灉绉垎澶т簬0
+                if (integralSum.doubleValue() > 0) {
+                    FeeAccountDetailPo feeAccountDetailPo = new FeeAccountDetailPo();
+                    feeAccountDetailPo.setFadId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_fadId));
+                    feeAccountDetailPo.setDetailId(payFeeDetailPo.getDetailId());
+                    feeAccountDetailPo.setCommunityId(payFeeDetailPo.getCommunityId());
+                    feeAccountDetailPo.setAmount(integralSum.doubleValue() + "");
+                    feeAccountDetailPo.setState("1003"); //1001 鏃犳姷鎵� 1002 鐜伴噾璐︽埛鎶垫墸 1003 绉垎璐︽埛鎶垫墸 1004 浼樻儬鍒告姷鎵�
+                    feeAccountDetailServiceSMOImpl.saveFeeAccountDetail(feeAccountDetailPo);
+                }
             } else if (AccountDto.ACCT_TYPE_CASH.equals(param.getString("acctType"))) { //鐜伴噾璐︽埛
                 //瀹炴敹閲戦
                 BigDecimal receivedAmount = new BigDecimal(payFeeDetailPo.getReceivedAmount());
@@ -385,6 +431,7 @@
                 BigDecimal receivedAmountDec = new BigDecimal(payFeeDetailPo.getReceivedAmount());
                 receivedAmountDec = receivedAmountDec.subtract(cashSum);
                 payFeeDetailPo.setReceivedAmount(receivedAmountDec.doubleValue() + "");
+                payFeeDetailPo.setAcctAmount(cashSum.doubleValue() + "");
             }
         }
     }
@@ -397,22 +444,23 @@
      * @param payFeeDetailPo
      * @throws ParseException
      */
-    private void hasDiscount(JSONObject paramObj, PayFeePo payFeePo, PayFeeDetailPo payFeeDetailPo) throws ParseException {
+    private void hasDiscount(JSONObject paramObj, PayFeePo payFeePo, PayFeeDetailPo payFeeDetailPo, FeeDto feeDto) throws ParseException {
         if (!paramObj.containsKey("selectDiscount")) {
             return;
         }
-        JSONArray selectDiscount = paramObj.getJSONArray("selectDiscount");
+        JSONArray selectDiscounts = paramObj.getJSONArray("selectDiscount");
 
-        if (selectDiscount == null || selectDiscount.size() < 1) {
+        if (ListUtil.isNull(selectDiscounts)) {
             return;
         }
-        for (int index = 0; index < selectDiscount.size(); index++) {
-            JSONObject paramJson = selectDiscount.getJSONObject(index);
+        Map feePriceMap = computeFeeSMOImpl.getFeePrice(feeDto);
+        for (int index = 0; index < selectDiscounts.size(); index++) {
+            JSONObject paramJson = selectDiscounts.getJSONObject(index);
             if (!"102020008".equals(paramJson.getString("ruleId"))) { //璧犻�佽鍒�
                 continue;
             }
             JSONArray feeDiscountSpecs = paramJson.getJSONArray("feeDiscountSpecs");
-            if (feeDiscountSpecs == null || feeDiscountSpecs.size() < 1) {
+            if (ListUtil.isNull(feeDiscountSpecs)) {
                 continue;
             }
             for (int specIndex = 0; specIndex < feeDiscountSpecs.size(); specIndex++) {
@@ -429,8 +477,18 @@
                 cal.add(Calendar.MONTH, Integer.parseInt(specValue));
                 payFeeDetailPo.setEndTime(df.format(cal.getTime()));
                 payFeePo.setEndTime(df.format(cal.getTime()));
+
+                BigDecimal value = new BigDecimal(payFeeDetailPo.getGiftAmount());
+                value = value.add(new BigDecimal(specValue).multiply(new BigDecimal(feePriceMap.get("feePrice").toString())));
+                payFeeDetailPo.setGiftAmount(value.doubleValue() + "");
             }
         }
+
+        for (int discountIndex = 0; discountIndex < selectDiscounts.size(); discountIndex++) {
+            JSONObject param = selectDiscounts.getJSONObject(discountIndex);
+            addPayFeeDetailDiscount(paramObj, param, payFeeDetailPo);
+        }
+
     }
 
     /**
@@ -532,7 +590,7 @@
         feeDto.setCommunityId(paramObj.getString("communityId"));
         List<FeeDto> feeDtos = feeInnerServiceSMOImpl.queryFees(feeDto);
 
-        if (feeDtos == null || feeDtos.size() < 1) {
+        if (ListUtil.isNull(feeDtos)) {
             return;
         }
         if (!FeeDto.PAYER_OBJ_TYPE_CAR.equals(feeDtos.get(0).getPayerObjType())) {
@@ -545,7 +603,7 @@
         ownerCarDto.setCarTypeCd("1001"); //涓氫富杞﹁締
         List<OwnerCarDto> ownerCarDtos = ownerCarInnerServiceSMOImpl.queryOwnerCars(ownerCarDto);
 
-        if (ownerCarDtos == null || ownerCarDtos.size() < 1) {
+        if (ListUtil.isNull(ownerCarDtos)) {
             return;
         }
         //鑾峰彇杞︿綅id
@@ -645,7 +703,7 @@
      * @param paramInJson 鎺ュ彛璋冪敤鏀句紶鍏ュ叆鍙�
      * @return 璁㈠崟鏈嶅姟鑳藉鎺ュ彈鐨勬姤鏂�
      */
-    public void addPayFeeDetailDiscount(JSONObject paramInJson, JSONObject discountJson) {
+    public void addPayFeeDetailDiscount(JSONObject paramInJson, JSONObject discountJson, PayFeeDetailPo payFeeDetailPo) {
         JSONObject businessFee = new JSONObject();
         businessFee.put("detailDiscountId", GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_detailDiscountId));
         businessFee.put("discountPrice", discountJson.getString("discountPrice"));
@@ -659,6 +717,32 @@
 
         if (fage < 1) {
             throw new CmdException("鏇存柊璐圭敤淇℃伅澶辫触");
+        }
+
+        FeeDiscountDto feeDiscountDto = new FeeDiscountDto();
+        feeDiscountDto.setDiscountId(discountJson.getString("discountId"));
+        List<FeeDiscountDto> feeDiscountDtos = feeDiscountInnerServiceSMOImpl.queryFeeDiscounts(feeDiscountDto);
+
+        if (ListUtil.isNull(feeDiscountDtos)) {
+            return;
+        }
+
+        //todo 鎵撴姌鎴栬�呯┖缃埧鎵撴姌
+        if (FeeDiscountRuleDto.DISCOUNT_SMALL_TYPE_DISCOUNT.equals(feeDiscountDtos.get(0).getDiscountSmallType())
+                || FeeDiscountRuleDto.DISCOUNT_SMALL_TYPE_APPLY_DISCOUNT.equals(feeDiscountDtos.get(0).getDiscountSmallType())
+        ) {
+            BigDecimal value = new BigDecimal(payFeeDetailPo.getDiscountAmount());
+            value = value.add(new BigDecimal(discountJson.getString("discountPrice")));
+            payFeeDetailPo.setDiscountAmount(value.doubleValue() + "");
+        } else if (FeeDiscountRuleDto.DISCOUNT_SMALL_TYPE_DEDUCTION.equals(feeDiscountDtos.get(0).getDiscountSmallType())
+                || FeeDiscountRuleDto.DISCOUNT_SMALL_TYPE_APPLY_DEDUCTION.equals(feeDiscountDtos.get(0).getDiscountSmallType())) {
+            BigDecimal value = new BigDecimal(payFeeDetailPo.getDeductionAmount());
+            value = value.add(new BigDecimal(discountJson.getString("discountPrice")));
+            payFeeDetailPo.setDeductionAmount(value.doubleValue() + "");
+        } else if (FeeDiscountRuleDto.DISCOUNT_SMALL_TYPE_LATE.equals(feeDiscountDtos.get(0).getDiscountSmallType())) {
+            BigDecimal value = new BigDecimal(payFeeDetailPo.getLateAmount());
+            value = value.add(new BigDecimal(discountJson.getString("discountPrice")));
+            payFeeDetailPo.setLateAmount(value.doubleValue() + "");
         }
     }
 
@@ -680,20 +764,19 @@
         feeDto.setFeeId(paramInJson.getString("feeId"));
         feeDto.setCommunityId(paramInJson.getString("communityId"));
         List<FeeDto> feeDtos = feeInnerServiceSMOImpl.queryFees(feeDto);
-        if (feeDtos == null || feeDtos.size() != 1) {
-            throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_ERROR, "鏌ヨ璐圭敤淇℃伅澶辫触锛屾湭鏌ュ埌鏁版嵁鎴栨煡鍒板鏉℃暟鎹�");
+        if (ListUtil.isNull(feeDtos)) {
+            throw new CmdException("鏌ヨ璐圭敤淇℃伅澶辫触锛屾湭鏌ュ埌鏁版嵁鎴栨煡鍒板鏉℃暟鎹�");
         }
         if (!businessFeeDetail.containsKey("state") || StringUtil.isEmpty(businessFeeDetail.getString("state"))) {
             businessFeeDetail.put("state", "1400");
         }
         feeDto = feeDtos.get(0);
-        businessFeeDetail.put("startTime", DateUtil.getFormatTimeString(feeDto.getEndTime(), DateUtil.DATE_FORMATE_STRING_A));
-        int hours = 0;
+        businessFeeDetail.put("startTime", DateUtil.getFormatTimeStringA(feeDto.getEndTime()));
         Date targetEndTime = null;
         BigDecimal cycles = null;
         Map feePriceAll = computeFeeSMOImpl.getFeePrice(feeDto);
         BigDecimal feePrice = new BigDecimal(feePriceAll.get("feePrice").toString());
-        if ("-101".equals(paramInJson.getString("cycles"))) {
+        if ("-101".equals(paramInJson.getString("cycles"))) { // 鑷畾涔夐噾棰濅氦璐�
             Date endTime = feeDto.getEndTime();
             Calendar endCalender = Calendar.getInstance();
             endCalender.setTime(endTime);
@@ -707,6 +790,10 @@
             if (paramInJson.containsKey("receivableAmount") && !StringUtil.isEmpty(paramInJson.getString("receivableAmount"))) {
                 businessFeeDetail.put("receivableAmount", paramInJson.getString("receivableAmount"));
             } else {
+                businessFeeDetail.put("receivableAmount", receivedAmount.doubleValue());
+            }
+            //todo 濡傛灉搴旀敹灏忎簬瀹炴敹锛屽皢搴旀敹鍒蜂负 瀹炴敹
+            if (businessFeeDetail.getDoubleValue("receivableAmount") < receivedAmount.doubleValue()) {
                 businessFeeDetail.put("receivableAmount", receivedAmount.doubleValue());
             }
         } else if ("-103".equals(paramInJson.getString("cycles"))) { //杩欓噷鎸夌即璐圭粨鏉熸椂闂寸即璐�
@@ -728,7 +815,36 @@
             } else {
                 businessFeeDetail.put("receivableAmount", receivedAmount.doubleValue());
             }
-        } else {
+            //todo 濡傛灉搴旀敹灏忎簬瀹炴敹锛屽皢搴旀敹鍒蜂负 瀹炴敹
+            if (businessFeeDetail.getDoubleValue("receivableAmount") < receivedAmount.doubleValue()) {
+                businessFeeDetail.put("receivableAmount", receivedAmount.doubleValue());
+            }
+        } else if ("-105".equals(paramInJson.getString("cycles"))) { //杩欓噷鎸夌即璐圭粨鏉熸椂闂寸即璐�
+            String customEndTime = paramInJson.getString("customEndTime");
+            Date endDates = DateUtil.getDateFromStringB(customEndTime);
+            Calendar c = Calendar.getInstance();
+            c.setTime(endDates);
+            c.add(Calendar.DAY_OF_MONTH, 1);
+            endDates = c.getTime();//杩欐槸鏄庡ぉ
+            targetEndTime = endDates;
+            BigDecimal receivedAmount1 = new BigDecimal(Double.parseDouble(paramInJson.getString("receivedAmount")));
+            cycles = receivedAmount1.divide(feePrice, 4, BigDecimal.ROUND_HALF_EVEN);
+            paramInJson.put("tmpCycles", cycles.doubleValue());
+            businessFeeDetail.put("cycles", cycles.doubleValue());
+            BigDecimal receivedAmount = new BigDecimal(Double.parseDouble(paramInJson.getString("receivedAmount")));
+            //澶勭悊 鍙兘杩樺瓨鍦� 瀹炴敹鎵嬪伐鍑忓厤鐨勬儏鍐�
+            if (paramInJson.containsKey("receivableAmount") && !StringUtil.isEmpty(paramInJson.getString("receivableAmount"))) {
+                businessFeeDetail.put("receivableAmount", paramInJson.getString("receivableAmount"));
+            } else {
+                businessFeeDetail.put("receivableAmount", receivedAmount.doubleValue());
+            }
+            //todo 濡傛灉搴旀敹灏忎簬瀹炴敹锛屽皢搴旀敹鍒蜂负 瀹炴敹
+            if (businessFeeDetail.getDoubleValue("receivableAmount") < receivedAmount.doubleValue()) {
+                businessFeeDetail.put("receivableAmount", receivedAmount.doubleValue());
+            }
+            //todo 鏀瑰啓寮�濮嬫椂闂�
+            businessFeeDetail.put("startTime", paramInJson.getString("customStartTime"));
+        } else { //鑷畾涔夊懆鏈�
             targetEndTime = computeFeeSMOImpl.getFeeEndTimeByCycles(feeDto, paramInJson.getString("cycles"));//鏍规嵁缂磋垂鍛ㄦ湡璁$畻 缁撴潫鏃堕棿
             cycles = new BigDecimal(Double.parseDouble(paramInJson.getString("cycles")));
             double tmpReceivableAmount = cycles.multiply(feePrice).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue();
@@ -741,58 +857,22 @@
                 }
             }
         }
-        businessFeeDetail.put("endTime", DateUtil.getFormatTimeString(targetEndTime, DateUtil.DATE_FORMATE_STRING_A));
+
+        businessFeeDetail.put("endTime", DateUtil.getFormatTimeStringA(targetEndTime));
         paramInJson.put("feeInfo", feeDto);
 
         return businessFeeDetail;
     }
 
-    public JSONObject modifyFee(JSONObject paramInJson) {
+    public JSONObject modifyFee(JSONObject paramInJson, PayFeeDetailPo payFeeDetailPo) {
 
         JSONObject businessFee = new JSONObject();
         FeeDto feeInfo = (FeeDto) paramInJson.get("feeInfo");
-        Date endTime = feeInfo.getEndTime();
-        Calendar endCalender = Calendar.getInstance();
-        endCalender.setTime(endTime);
-        int hours = 0;
-        //-101鑷畾涔夐噾棰� -102鑷畾涔夊懆鏈� -103 鑷畾涔夌粨鏉熸椂闂�
-        if ("-101".equals(paramInJson.getString("cycles"))) {
-            endCalender = getTargetEndTime(endCalender, Double.parseDouble(paramInJson.getString("tmpCycles")));
-        } else if ("-103".equals(paramInJson.getString("cycles"))) {
-            String custEndTime = paramInJson.getString("custEndTime");
-            Date endDates = DateUtil.getDateFromStringB(custEndTime);
-            Calendar c = Calendar.getInstance();
-            c.setTime(endDates);
-            c.add(Calendar.DAY_OF_MONTH, 1);
-            endDates = c.getTime();//杩欐槸鏄庡ぉ
-            endCalender.setTime(endDates);
-        } else {
-            endCalender.add(Calendar.MONTH, Integer.parseInt(paramInJson.getString("cycles")));
-        }
-        if (FeeDto.FEE_FLAG_ONCE.equals(feeInfo.getFeeFlag())) {
-            if (feeInfo.getDeadlineTime() != null) {
-                endCalender.setTime(feeInfo.getDeadlineTime());
-            } else if (!StringUtil.isEmpty(feeInfo.getCurDegrees())) {
-                endCalender.setTime(feeInfo.getCurReadingTime());
-            } else if (feeInfo.getImportFeeEndTime() == null) {
-                endCalender.setTime(feeInfo.getConfigEndTime());
-            } else {
-                endCalender.setTime(feeInfo.getImportFeeEndTime());
-            }
-            //businessFee.put("state",FeeDto.STATE_FINISH);
-            feeInfo.setState(FeeDto.STATE_FINISH);
-        }
-        feeInfo.setEndTime(endCalender.getTime());
-        Date maxEndTime = feeInfo.getDeadlineTime();
-        if (FeeDto.FEE_FLAG_CYCLE.equals(feeInfo.getFeeFlag())) {
-            maxEndTime = feeInfo.getConfigEndTime();
-        }
 
-        if (FeeDto.FEE_FLAG_CYCLE_ONCE.equals(feeInfo.getFeeFlag())) {
-            maxEndTime = feeInfo.getMaxEndTime();
-        }
+        String endTime = DateUtil.getNextSecTime(payFeeDetailPo.getEndTime());
+        feeInfo.setEndTime(DateUtil.getDateFromStringA(endTime));
 
-        //濡傛灉闂存瓏鎬ц垂鐢ㄦ病鏈夎缃粨鏉熸椂闂� 鍒欏彇璐圭敤椤圭殑
+        Date maxEndTime = feeInfo.getMaxEndTime();
         if (maxEndTime == null) {
             maxEndTime = feeInfo.getConfigEndTime();
         }
@@ -833,7 +913,7 @@
     public void dealAccount(JSONObject paramObj) {
         //鍒ゆ柇閫夋嫨鐨勮处鍙�
         JSONArray jsonArray = paramObj.getJSONArray("selectUserAccount");
-        if (jsonArray == null || jsonArray.size() < 1) {
+        if (ListUtil.isNull(jsonArray)) {
             return;
         }
         List<AccountDto> accountDtos = new ArrayList<>();
@@ -960,6 +1040,182 @@
         }
     }
 
+
+    /**
+     * 鏍¢獙鏄惁鎸夌即璐规椂闂存缂磋垂
+     *
+     * @param reqJson
+     * @param feeConfigDto
+     */
+    private void validateIfPayFeeStartEndDate(JSONObject reqJson, FeeConfigDto feeConfigDto) {
+        if (!"-105".equals(reqJson.getString("cycles"))) {
+            return;
+        }
+        // todo 鑷繁鏄棿鎺ユ�ц垂鐢�
+        if (FeeDto.FEE_FLAG_CYCLE_ONCE.equals(feeConfigDto.getFeeFlag())) {
+            return;
+        }
+
+        FeeConfigDto tmpFeeConfigDto = new FeeConfigDto();
+        tmpFeeConfigDto.setFeeNameEq(feeConfigDto.getFeeName() + "娆犺垂");
+        tmpFeeConfigDto.setFeeFlag(FeeDto.FEE_FLAG_CYCLE_ONCE);
+        tmpFeeConfigDto.setComputingFormula(feeConfigDto.getComputingFormula());
+        List<FeeConfigDto> feeConfigDtos = feeConfigInnerServiceSMOImpl.queryFeeConfigs(tmpFeeConfigDto);
+
+        Assert.listOnlyOne(feeConfigDtos, "鎸夎嚜瀹氫箟鏃堕棿娈电即璐规椂锛岃垂鐢ㄥ繀椤讳负闂存帴鎬ц垂鐢紝鎴栬�呭瓨鍦ㄥ悕绉颁负 " + feeConfigDto.getFeeName() + "娆犺垂 鐨勯棿鎺ユ�ц垂鐢紝瀹冪殑鍏紡璁$畻蹇呴』瑕佸拰" + feeConfigDto.getFeeName() + "涓�鑷�");
+    }
+
+
+    /**
+     * 鑷畾涔夋椂闂存 缂磋垂
+     *
+     * @param cycles
+     * @param endTime
+     * @param payFeeDetailPo
+     * @param payFeePo
+     */
+    private void ifCustomStartEndTimePayFee(String cycles, Date endTime, PayFeeDetailPo payFeeDetailPo, PayFeePo payFeePo, JSONObject reqJson) {
+        if (!"-105".equals(cycles)) {
+            return;
+        }
+
+        //todo 濡傛灉鏄悓涓�澶╀笉鍒涘缓
+        if (DateUtil.getFormatTimeStringB(endTime).equals(reqJson.getString("customStartTime"))) {
+            return;
+        }
+
+        FeeDto feeInfo = (FeeDto) reqJson.get("feeInfo");
+        String payObjNameRemark = "鎴垮眿";
+        if (FeeDto.PAYER_OBJ_TYPE_CAR.equals(feeInfo.getPayerObjType())) {
+            payObjNameRemark = "杞﹁締";
+        } else if (FeeDto.PAYER_OBJ_TYPE_CONTRACT.equals(feeInfo.getPayerObjType())) {
+            payObjNameRemark = "鍚堝悓";
+        }
+
+        //todo 琛ュ厖涓�鏉� 缂磋垂璁板綍鏁版嵁
+        PayFeeDetailPo tmpPayFeeDetailPo = BeanConvertUtil.covertBean(payFeeDetailPo, PayFeeDetailPo.class);
+        tmpPayFeeDetailPo.setDetailId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_detailId));
+        tmpPayFeeDetailPo.setCycles("0");
+        tmpPayFeeDetailPo.setReceivableAmount("0");
+        tmpPayFeeDetailPo.setReceivedAmount("0");
+        tmpPayFeeDetailPo.setPayableAmount("0");
+        tmpPayFeeDetailPo.setStartTime(DateUtil.getFormatTimeStringB(endTime));
+        tmpPayFeeDetailPo.setEndTime(reqJson.getString("customStartTime"));
+        tmpPayFeeDetailPo.setState(FeeDetailDto.STATE_OWE);
+        tmpPayFeeDetailPo.setOpenInvoice("N");
+        tmpPayFeeDetailPo.setRemark("鎸夌即璐规椂闂存缂磋垂,杩欓儴鍒嗚垂鐢ㄦ寜娆犺垂鐨勬柟寮忛噸鏂扮敓鎴愶紝璇峰湪" + payObjNameRemark + "涓婃煡鐪�");
+        if (!StringUtil.isEmpty(reqJson.getString("cashAmount")) && !StringUtil.isEmpty(reqJson.getString("integralAmount"))) {
+            BigDecimal cashAmount = new BigDecimal(reqJson.getString("cashAmount")).setScale(2, BigDecimal.ROUND_HALF_UP);
+            BigDecimal integralAmount = new BigDecimal(reqJson.getString("integralAmount")).setScale(2, BigDecimal.ROUND_HALF_UP);
+            if (!StringUtil.isEmpty(tmpPayFeeDetailPo.getRemark())) {
+                tmpPayFeeDetailPo.setRemark(tmpPayFeeDetailPo.getRemark() + "锛岀幇閲戣处鎴锋姷鎵�" + cashAmount + "鍏冿紝绉垎璐︽埛鎶垫墸" + integralAmount + "鍏�");
+            } else {
+                tmpPayFeeDetailPo.setRemark("鐜伴噾璐︽埛鎶垫墸" + cashAmount + "鍏冿紝绉垎璐︽埛鎶垫墸" + integralAmount + "鍏�");
+            }
+        }
+        if (!StringUtil.isEmpty(reqJson.getString("cashAmount")) && StringUtil.isEmpty(reqJson.getString("integralAmount"))) {
+            BigDecimal cashAmount = new BigDecimal(reqJson.getString("cashAmount")).setScale(2, BigDecimal.ROUND_HALF_UP);
+            if (!StringUtil.isEmpty(tmpPayFeeDetailPo.getRemark())) {
+                tmpPayFeeDetailPo.setRemark(tmpPayFeeDetailPo.getRemark() + "锛岀幇閲戣处鎴锋姷鎵�" + cashAmount + "鍏�");
+            } else {
+                tmpPayFeeDetailPo.setRemark("鐜伴噾璐︽埛鎶垫墸" + cashAmount + "鍏�");
+            }
+        }
+        if (StringUtil.isEmpty(reqJson.getString("cashAmount")) && !StringUtil.isEmpty(reqJson.getString("integralAmount"))) {
+            BigDecimal integralAmount = new BigDecimal(reqJson.getString("integralAmount")).setScale(2, BigDecimal.ROUND_HALF_UP);
+            if (!StringUtil.isEmpty(tmpPayFeeDetailPo.getRemark())) {
+                tmpPayFeeDetailPo.setRemark(tmpPayFeeDetailPo.getRemark() + "锛岀Н鍒嗚处鎴锋姷鎵�" + integralAmount + "鍏�");
+            } else {
+                tmpPayFeeDetailPo.setRemark("绉垎璐︽埛鎶垫墸" + integralAmount + "鍏�");
+            }
+        }
+        int flag = payFeeDetailNewV1InnerServiceSMOImpl.savePayFeeDetailNew(tmpPayFeeDetailPo);
+
+        if (flag < 1) {
+            throw new CmdException("鐢熸垚娆犺垂澶辫触");
+        }
+
+        //todo 鐢熸垚璐圭敤
+        PayFeePo tmpPayFeePo = BeanConvertUtil.covertBean(feeInfo, PayFeePo.class);
+        tmpPayFeePo.setFeeId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_feeId));
+        tmpPayFeePo.setEndTime(DateUtil.getFormatTimeStringB(endTime));
+        tmpPayFeePo.setState(FeeDto.STATE_DOING);
+
+        // todo 澶勭悊configId
+        doChangeConfigId(tmpPayFeePo, feeInfo);
+
+
+        flag = payFeeV1InnerServiceSMOImpl.savePayFee(tmpPayFeePo);
+        if (flag < 1) {
+            throw new CmdException("鐢熸垚娆犺垂澶辫触");
+        }
+
+        //todo 琛ュ厖 璐圭敤灞炴��
+        FeeAttrDto feeAttrDto = new FeeAttrDto();
+        feeAttrDto.setFeeId(payFeePo.getFeeId());
+        feeAttrDto.setCommunityId(payFeePo.getCommunityId());
+        List<FeeAttrDto> feeAttrDtos = feeAttrInnerServiceSMOImpl.queryFeeAttrs(feeAttrDto);
+
+        if (feeAttrDtos == null || feeAttrDtos.size() < 1) {
+            return;
+        }
+
+        List<FeeAttrPo> tmpFeeAttrPos = new ArrayList<>();
+        FeeAttrPo tmpFeeAttrPo = null;
+        boolean hasDeadLineTime = false;
+        for (FeeAttrDto tmpFeeAttrDto : feeAttrDtos) {
+            tmpFeeAttrDto.setFeeId(tmpPayFeePo.getFeeId());
+            tmpFeeAttrDto.setAttrId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_attrId, true));
+
+            if (FeeAttrDto.SPEC_CD_ONCE_FEE_DEADLINE_TIME.equals(tmpFeeAttrDto.getSpecCd())) {
+                tmpFeeAttrDto.setValue(reqJson.getString("customStartTime"));
+                hasDeadLineTime = true;
+            }
+            tmpFeeAttrPo = BeanConvertUtil.covertBean(tmpFeeAttrDto, FeeAttrPo.class);
+            tmpFeeAttrPos.add(tmpFeeAttrPo);
+        }
+        //todo 娌℃湁缁撴潫鏃堕棿鏃�
+        if (!hasDeadLineTime) {
+            tmpFeeAttrPo = new FeeAttrPo();
+            tmpFeeAttrPo.setAttrId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_attrId, true));
+            tmpFeeAttrPo.setFeeId(tmpPayFeePo.getFeeId());
+            tmpFeeAttrPo.setCommunityId(tmpFeeAttrPo.getCommunityId());
+            tmpFeeAttrPo.setSpecCd(FeeAttrDto.SPEC_CD_ONCE_FEE_DEADLINE_TIME);
+            tmpFeeAttrPo.setValue(reqJson.getString("customStartTime"));
+            tmpFeeAttrPos.add(tmpFeeAttrPo);
+        }
+
+        feeAttrInnerServiceSMOImpl.saveFeeAttrs(tmpFeeAttrPos);
+
+    }
+
+    /**
+     * 澶勭悊璐圭敤椤笽D
+     *
+     * @param tmpPayFeePo
+     * @param feeInfo
+     */
+    private void doChangeConfigId(PayFeePo tmpPayFeePo, FeeDto feeInfo) {
+        FeeConfigDto feeConfigDto = new FeeConfigDto();
+        feeConfigDto.setConfigId(feeInfo.getConfigId());
+        feeConfigDto.setCommunityId(feeInfo.getCommunityId());
+        List<FeeConfigDto> feeConfigDtos = feeConfigInnerServiceSMOImpl.queryFeeConfigs(feeConfigDto);
+        Assert.listOnlyOne(feeConfigDtos, "璐圭敤椤逛笉瀛樺湪");
+        if (FeeDto.FEE_FLAG_CYCLE_ONCE.equals(feeConfigDtos.get(0).getFeeFlag())) {
+            return;
+        }
+
+
+        FeeConfigDto tmpFeeConfigDto = new FeeConfigDto();
+        tmpFeeConfigDto.setFeeNameEq(feeConfigDtos.get(0).getFeeName() + "娆犺垂");
+        tmpFeeConfigDto.setFeeFlag(FeeDto.FEE_FLAG_CYCLE_ONCE);
+        tmpFeeConfigDto.setComputingFormula(feeConfigDto.getComputingFormula());
+        //todo 鏍¢獙鐨勬椂鍊欐牎楠岃繃浜� 鎵�浠ヨ繖閲屼笉鍙兘涓虹┖
+        feeConfigDtos = feeConfigInnerServiceSMOImpl.queryFeeConfigs(tmpFeeConfigDto);
+
+        tmpPayFeePo.setConfigId(feeConfigDtos.get(0).getConfigId());
+    }
+
     private static Calendar getTargetEndTime(Calendar endCalender, Double cycles) {
         if (StringUtil.isInteger(cycles.toString())) {
             endCalender.add(Calendar.MONTH, new Double(cycles).intValue());

--
Gitblit v1.8.0