java110 4 lat temu
rodzic
commit
30fbba0928

+ 51 - 31
java110-db/src/main/resources/mapper/report/ReportFeeMonthStatisticsServiceDaoImplMapper.xml

@@ -145,9 +145,7 @@
         <if test="oweAmount !=null and oweAmount != ''">
             , t.owe_amount= #{oweAmount}
         </if>
-        <if test="communityId !=null and communityId != ''">
-            , t.community_id= #{communityId}
-        </if>
+
         <if test="feeCreateTime !=null and feeCreateTime != ''">
             , t.fee_create_time= #{feeCreateTime}
         </if>
@@ -155,9 +153,11 @@
             , t.obj_type= #{objType}
         </if>
         where 1=1
-        <if test="statisticsId !=null and statisticsId != ''">
-            and t.statistics_id= #{statisticsId}
+        and t.statistics_id= #{statisticsId}
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
         </if>
+
     </update>
 
     <!-- 查询费用月统计数量 add by wuxw 2018-07-03 -->
@@ -2104,7 +2104,8 @@
         from f_floor t
         left join building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
         left join building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
-        LEFT JOIN report_fee_month_statistics rfms on rfms.obj_id = br.room_id and rfms.obj_type = '3333' and rfms.status_cd = '0'
+        LEFT JOIN report_fee_month_statistics rfms on rfms.obj_id = br.room_id and rfms.obj_type = '3333' and
+        rfms.status_cd = '0'
         inner join report_fee_month_statistics curT on curT.obj_id = br.room_id and curT.community_id = t.community_id
         where t.status_cd = '0'
         <if test="roomNum !=null and roomNum != ''">
@@ -2138,7 +2139,8 @@
         from f_floor t
         left join building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
         left join building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
-        LEFT JOIN report_fee_month_statistics rfms on rfms.obj_id = br.room_id and rfms.obj_type = '3333' and rfms.status_cd = '0'
+        LEFT JOIN report_fee_month_statistics rfms on rfms.obj_id = br.room_id and rfms.obj_type = '3333' and
+        rfms.status_cd = '0'
         inner join report_fee_month_statistics curT on curT.obj_id = br.room_id and curT.community_id = t.community_id
         where t.status_cd = '0'
         <if test="roomNum !=null and roomNum != ''">
@@ -2178,14 +2180,19 @@
         SUM(pfdm3.received_amount) receivedAmount4
         from f_floor t
         LEFT JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
-        LEFT JOIN building_room br on br.unit_id = bu.unit_id  and br.status_cd = '0'
+        LEFT JOIN building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
         LEFT JOIN pay_fee pf on pf.payer_obj_id = br.room_id and pf.status_cd = '0'
         LEFT join pay_fee_detail pfd on pf.fee_id = pfd.fee_id and pfd.status_cd = '0'
-        LEFT JOIN pay_fee_detail_month pfdm on  pf.fee_id = pfdm.fee_id and pfd.detail_id = pfdm.detail_id and pfdm.status_cd = '0'
-        LEFT JOIN pay_fee_detail_month pfdm1 on  pf.fee_id = pfdm1.fee_id and pfd.detail_id = pfdm1.detail_id and pfdm1.status_cd = '0' and pfdm1.detail_year = #{year} and pfdm1.detail_month &lt; #{month}
-        LEFT JOIN pay_fee_detail_month pfdm2 on  pf.fee_id = pfdm2.fee_id and pfd.detail_id = pfdm2.detail_id and pfdm2.status_cd = '0' and pfdm2.detail_year = #{year} and pfdm2.detail_month = #{month}
-        LEFT JOIN pay_fee_detail_month pfdm3 on  pf.fee_id = pfdm3.fee_id and pfd.detail_id = pfdm3.detail_id and pfdm3.status_cd = '0' and pfdm3.detail_year = #{nextYear} and pfdm3.detail_month = #{nextMonth}
-        LEFT JOIN pay_fee_detail_month pfdm4 on  pf.fee_id = pfdm4.fee_id and pfd.detail_id = pfdm4.detail_id and pfdm4.status_cd = '0' and pfdm4.detail_year &lt; #{year}
+        LEFT JOIN pay_fee_detail_month pfdm on pf.fee_id = pfdm.fee_id and pfd.detail_id = pfdm.detail_id and
+        pfdm.status_cd = '0'
+        LEFT JOIN pay_fee_detail_month pfdm1 on pf.fee_id = pfdm1.fee_id and pfd.detail_id = pfdm1.detail_id and
+        pfdm1.status_cd = '0' and pfdm1.detail_year = #{year} and pfdm1.detail_month &lt; #{month}
+        LEFT JOIN pay_fee_detail_month pfdm2 on pf.fee_id = pfdm2.fee_id and pfd.detail_id = pfdm2.detail_id and
+        pfdm2.status_cd = '0' and pfdm2.detail_year = #{year} and pfdm2.detail_month = #{month}
+        LEFT JOIN pay_fee_detail_month pfdm3 on pf.fee_id = pfdm3.fee_id and pfd.detail_id = pfdm3.detail_id and
+        pfdm3.status_cd = '0' and pfdm3.detail_year = #{nextYear} and pfdm3.detail_month = #{nextMonth}
+        LEFT JOIN pay_fee_detail_month pfdm4 on pf.fee_id = pfdm4.fee_id and pfd.detail_id = pfdm4.detail_id and
+        pfdm4.status_cd = '0' and pfdm4.detail_year &lt; #{year}
         where 1=1
         and DATE_FORMAT(pfd.create_time,'%Y-%m') = #{yearMonth}
         <if test="communityId !=null and communityId != ''">
@@ -2203,14 +2210,19 @@
         SUM(pfdm3.received_amount) receivedAmount4
         from f_floor t
         LEFT JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
-        LEFT JOIN building_room br on br.unit_id = bu.unit_id  and br.status_cd = '0'
+        LEFT JOIN building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
         LEFT JOIN pay_fee pf on pf.payer_obj_id = br.room_id and pf.status_cd = '0'
         LEFT join pay_fee_detail pfd on pf.fee_id = pfd.fee_id and pfd.status_cd = '0'
-        LEFT JOIN pay_fee_detail_month pfdm on  pf.fee_id = pfdm.fee_id and pfd.detail_id = pfdm.detail_id and pfdm.status_cd = '0'
-        LEFT JOIN pay_fee_detail_month pfdm1 on  pf.fee_id = pfdm1.fee_id and pfd.detail_id = pfdm1.detail_id and pfdm1.status_cd = '0' and pfdm1.detail_year = #{year} and pfdm1.detail_month &lt; #{month}
-        LEFT JOIN pay_fee_detail_month pfdm2 on  pf.fee_id = pfdm2.fee_id and pfd.detail_id = pfdm2.detail_id and pfdm2.status_cd = '0' and pfdm2.detail_year = #{year} and pfdm2.detail_month = #{month}
-        LEFT JOIN pay_fee_detail_month pfdm3 on  pf.fee_id = pfdm3.fee_id and pfd.detail_id = pfdm3.detail_id and pfdm3.status_cd = '0' and pfdm3.detail_year = #{nextYear} and pfdm3.detail_month = #{nextMonth}
-        LEFT JOIN pay_fee_detail_month pfdm4 on  pf.fee_id = pfdm4.fee_id and pfd.detail_id = pfdm4.detail_id and pfdm4.status_cd = '0' and pfdm4.detail_year &lt; #{year}
+        LEFT JOIN pay_fee_detail_month pfdm on pf.fee_id = pfdm.fee_id and pfd.detail_id = pfdm.detail_id and
+        pfdm.status_cd = '0'
+        LEFT JOIN pay_fee_detail_month pfdm1 on pf.fee_id = pfdm1.fee_id and pfd.detail_id = pfdm1.detail_id and
+        pfdm1.status_cd = '0' and pfdm1.detail_year = #{year} and pfdm1.detail_month &lt; #{month}
+        LEFT JOIN pay_fee_detail_month pfdm2 on pf.fee_id = pfdm2.fee_id and pfd.detail_id = pfdm2.detail_id and
+        pfdm2.status_cd = '0' and pfdm2.detail_year = #{year} and pfdm2.detail_month = #{month}
+        LEFT JOIN pay_fee_detail_month pfdm3 on pf.fee_id = pfdm3.fee_id and pfd.detail_id = pfdm3.detail_id and
+        pfdm3.status_cd = '0' and pfdm3.detail_year = #{nextYear} and pfdm3.detail_month = #{nextMonth}
+        LEFT JOIN pay_fee_detail_month pfdm4 on pf.fee_id = pfdm4.fee_id and pfd.detail_id = pfdm4.detail_id and
+        pfdm4.status_cd = '0' and pfdm4.detail_year &lt; #{year}
         where 1=1
         and DATE_FORMAT(pfd.create_time,'%Y-%m') = #{yearMonth}
         <if test="communityId !=null and communityId != ''">
@@ -2229,14 +2241,17 @@
         SUM(pfdm2.received_amount) receivedAmount2
         from f_floor t
         LEFT JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
-        LEFT JOIN building_room br on br.unit_id = bu.unit_id  and br.status_cd = '0'
+        LEFT JOIN building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
         LEFT JOIN pay_fee pf on pf.payer_obj_id = br.room_id and pf.status_cd = '0'
         LEFT join pay_fee_detail pfd on pf.fee_id = pfd.fee_id and pfd.status_cd = '0'
-        LEFT JOIN pay_fee_detail_month pfdm on  pf.fee_id = pfdm.fee_id and pfd.detail_id = pfdm.detail_id and pfdm.status_cd = '0'
-        LEFT JOIN pay_fee_detail_month pfdm1 on  pf.fee_id = pfdm1.fee_id and pfd.detail_id = pfdm1.detail_id and pfdm1.status_cd = '0' and pfdm1.detail_year =  #{year}  and pfdm1.detail_month &lt; #{month}
-        LEFT JOIN pay_fee_detail_month pfdm2 on  pf.fee_id = pfdm2.fee_id and pfd.detail_id = pfdm2.detail_id and pfdm2.status_cd = '0' and pfdm2.detail_year =  #{year}  and pfdm2.detail_month &gt; #{month}
+        LEFT JOIN pay_fee_detail_month pfdm on pf.fee_id = pfdm.fee_id and pfd.detail_id = pfdm.detail_id and
+        pfdm.status_cd = '0'
+        LEFT JOIN pay_fee_detail_month pfdm1 on pf.fee_id = pfdm1.fee_id and pfd.detail_id = pfdm1.detail_id and
+        pfdm1.status_cd = '0' and pfdm1.detail_year = #{year} and pfdm1.detail_month &lt; #{month}
+        LEFT JOIN pay_fee_detail_month pfdm2 on pf.fee_id = pfdm2.fee_id and pfd.detail_id = pfdm2.detail_id and
+        pfdm2.status_cd = '0' and pfdm2.detail_year = #{year} and pfdm2.detail_month &gt; #{month}
         where 1=1
-        and DATE_FORMAT(pfd.create_time,'%Y-%m') =  #{yearMonth}
+        and DATE_FORMAT(pfd.create_time,'%Y-%m') = #{yearMonth}
         <if test="communityId !=null and communityId != ''">
             and t.community_id= #{communityId}
         </if>
@@ -2251,14 +2266,17 @@
         SUM(pfdm2.received_amount) receivedAmount2
         from f_floor t
         LEFT JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
-        LEFT JOIN building_room br on br.unit_id = bu.unit_id  and br.status_cd = '0'
+        LEFT JOIN building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
         LEFT JOIN pay_fee pf on pf.payer_obj_id = br.room_id and pf.status_cd = '0'
         LEFT join pay_fee_detail pfd on pf.fee_id = pfd.fee_id and pfd.status_cd = '0'
-        LEFT JOIN pay_fee_detail_month pfdm on  pf.fee_id = pfdm.fee_id and pfd.detail_id = pfdm.detail_id and pfdm.status_cd = '0'
-        LEFT JOIN pay_fee_detail_month pfdm1 on  pf.fee_id = pfdm1.fee_id and pfd.detail_id = pfdm1.detail_id and pfdm1.status_cd = '0' and pfdm1.detail_year =  #{year}  and pfdm1.detail_month &lt; #{month}
-        LEFT JOIN pay_fee_detail_month pfdm2 on  pf.fee_id = pfdm2.fee_id and pfd.detail_id = pfdm2.detail_id and pfdm2.status_cd = '0' and pfdm2.detail_year =  #{year}  and pfdm2.detail_month &gt; #{month}
+        LEFT JOIN pay_fee_detail_month pfdm on pf.fee_id = pfdm.fee_id and pfd.detail_id = pfdm.detail_id and
+        pfdm.status_cd = '0'
+        LEFT JOIN pay_fee_detail_month pfdm1 on pf.fee_id = pfdm1.fee_id and pfd.detail_id = pfdm1.detail_id and
+        pfdm1.status_cd = '0' and pfdm1.detail_year = #{year} and pfdm1.detail_month &lt; #{month}
+        LEFT JOIN pay_fee_detail_month pfdm2 on pf.fee_id = pfdm2.fee_id and pfd.detail_id = pfdm2.detail_id and
+        pfdm2.status_cd = '0' and pfdm2.detail_year = #{year} and pfdm2.detail_month &gt; #{month}
         where 1=1
-        and DATE_FORMAT(pfd.create_time,'%Y-%m') =  #{yearMonth}
+        and DATE_FORMAT(pfd.create_time,'%Y-%m') = #{yearMonth}
         <if test="communityId !=null and communityId != ''">
             and t.community_id= #{communityId}
         </if>
@@ -2270,7 +2288,8 @@
     <select id="queryHuaningOweFeeDetailCount" parameterType="Map" resultType="Map">
         select count(1) count
         from (
-        select t.payer_obj_name payerObjName,br.built_up_area builtUpArea,pfc.square_price squarePrice, t.fee_id feeId,t.end_time startTime,t.deadline_time endTime,t.amount_owed oweAmount
+        select t.payer_obj_name payerObjName,br.built_up_area builtUpArea,pfc.square_price squarePrice, t.fee_id
+        feeId,t.end_time startTime,t.deadline_time endTime,t.amount_owed oweAmount
         from report_owe_fee t
         left join building_room br on t.payer_obj_id = br.room_id and br.status_cd = '0'
         left join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
@@ -2284,7 +2303,8 @@
 
     <!-- 查询费用月统计信息 add by wuxw 2018-07-03 -->
     <select id="queryHuaningOweFeeDetail" parameterType="Map" resultType="Map">
-        select t.payer_obj_name payerObjName,br.built_up_area builtUpArea,pfc.square_price squarePrice, t.fee_id feeId,t.end_time startTime,t.deadline_time endTime,t.amount_owed oweAmount
+        select t.payer_obj_name payerObjName,br.built_up_area builtUpArea,pfc.square_price squarePrice, t.fee_id
+        feeId,t.end_time startTime,t.deadline_time endTime,t.amount_owed oweAmount
         from report_owe_fee t
         left join building_room br on t.payer_obj_id = br.room_id and br.status_cd = '0'
         left join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'

+ 47 - 0
service-acct/src/main/java/com/java110/acct/listener/accountDetail/SaveAccountDetailInfoListener.java

@@ -2,20 +2,27 @@ package com.java110.acct.listener.accountDetail;
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.java110.acct.dao.IAccountServiceDao;
+import com.java110.dto.account.AccountDto;
+import com.java110.dto.accountDetail.AccountDetailDto;
+import com.java110.po.account.AccountPo;
 import com.java110.po.accountDetail.AccountDetailPo;
 import com.java110.utils.constant.BusinessTypeConstant;
 import com.java110.utils.constant.StatusConstant;
+import com.java110.utils.lock.DistributedLock;
 import com.java110.utils.util.Assert;
 import com.java110.acct.dao.IAccountDetailServiceDao;
 import com.java110.core.annotation.Java110Listener;
 import com.java110.core.context.DataFlowContext;
 import com.java110.core.factory.GenerateCodeFactory;
 import com.java110.entity.center.Business;
+import com.java110.utils.util.BeanConvertUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.math.BigDecimal;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -33,6 +40,9 @@ public class SaveAccountDetailInfoListener extends AbstractAccountDetailBusiness
     @Autowired
     private IAccountDetailServiceDao accountDetailServiceDaoImpl;
 
+    @Autowired
+    private IAccountServiceDao accountServiceDaoImpl;
+
     @Override
     public int getOrder() {
         return 0;
@@ -96,6 +106,42 @@ public class SaveAccountDetailInfoListener extends AbstractAccountDetailBusiness
                 dataFlowContext.addParamOut("detailId", businessAccountDetailInfo.get(0).get("detail_id"));
             }
         }
+
+        //修改账户信息
+        //开始枷锁
+        String requestId = DistributedLock.getLockUUID();
+        String key = businessAccountDetailInfo.get(0).get("acctId").toString();
+        int flag = 0;
+        String detailType = "";
+        try {
+            DistributedLock.waitGetDistributedLock(key, requestId);
+            AccountDto accountDto = new AccountDto();
+            accountDto.setObjId(businessAccountDetailInfo.get(0).get("objId").toString());
+            accountDto.setAcctId(businessAccountDetailInfo.get(0).get("acctId").toString());
+            List<AccountDto> accounts = BeanConvertUtil.covertBeanList(accountServiceDaoImpl.getAccountInfo(BeanConvertUtil.beanCovertMap(accountDto)), AccountDto.class);
+            if (accounts == null || accounts.size() < 1) {
+                throw new IllegalArgumentException("账户不存在");
+            }
+            //在账户增加
+            double amount = Double.parseDouble(accounts.get(0).getAmount());
+            BigDecimal amountBig = new BigDecimal(amount);
+            detailType = businessAccountDetailInfo.get(0).get("detailType").toString();
+            if(AccountDetailDto.DETAIL_TYPE_IN.equals(detailType)) {
+                amount = amountBig.add(new BigDecimal(businessAccountDetailInfo.get(0).get("amount").toString())).doubleValue();
+            }else{
+                amount = amountBig.subtract(new BigDecimal(businessAccountDetailInfo.get(0).get("amount").toString())).doubleValue();
+            }
+            AccountPo accountPo = new AccountPo();
+            accountPo.setObjId(businessAccountDetailInfo.get(0).get("objId").toString());
+            accountPo.setAcctId(businessAccountDetailInfo.get(0).get("acctId").toString());
+            accountPo.setAmount(amount + "");
+            flag = accountServiceDaoImpl.updateAccount(BeanConvertUtil.beanCovertMap(accountPo));
+            if (flag < 1) {
+                throw new IllegalArgumentException("更新账户失败");
+            }
+        } finally {
+            DistributedLock.releaseDistributedLock(requestId, key);
+        }
     }
 
 
@@ -165,6 +211,7 @@ public class SaveAccountDetailInfoListener extends AbstractAccountDetailBusiness
         accountDetailServiceDaoImpl.saveBusinessAccountDetailInfo(businessAccountDetail);
 
     }
+
     @Override
     public IAccountDetailServiceDao getAccountDetailServiceDaoImpl() {
         return accountDetailServiceDaoImpl;

+ 6 - 2
service-api/src/main/java/com/java110/api/bmo/account/IAccountDetailBMO.java

@@ -33,6 +33,10 @@ public interface IAccountDetailBMO extends IApiBaseBMO {
      */
      void deleteAccountDetail(JSONObject paramInJson, DataFlowContext dataFlowContext);
 
-
-
+    /**
+     * 账户处理
+     * @param paramObj
+     * @param dataFlowContext
+     */
+    void dealAccount(JSONObject paramObj, DataFlowContext dataFlowContext);
 }

+ 57 - 1
service-api/src/main/java/com/java110/api/bmo/account/impl/AccountDetailBMOImpl.java

@@ -4,19 +4,30 @@ import com.alibaba.fastjson.JSONObject;
 import com.java110.api.bmo.ApiBaseBMO;
 import com.java110.api.bmo.account.IAccountDetailBMO;
 import com.java110.core.context.DataFlowContext;
+import com.java110.core.factory.GenerateCodeFactory;
+import com.java110.dto.account.AccountDto;
+import com.java110.dto.accountDetail.AccountDetailDto;
 import com.java110.intf.acct.IAccountDetailInnerServiceSMO;
+import com.java110.intf.acct.IAccountInnerServiceSMO;
 import com.java110.po.accountDetail.AccountDetailPo;
 import com.java110.utils.constant.BusinessTypeConstant;
+import com.java110.utils.util.Assert;
 import com.java110.utils.util.BeanConvertUtil;
+import com.java110.utils.util.StringUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 @Service("accountDetailBMOImpl")
 public class AccountDetailBMOImpl extends ApiBaseBMO implements IAccountDetailBMO {
 
     @Autowired
     private IAccountDetailInnerServiceSMO accountDetailInnerServiceSMOImpl;
 
+    @Autowired
+    private IAccountInnerServiceSMO accountInnerServiceSMOImpl;
+
     /**
      * 添加小区信息
      *
@@ -25,7 +36,6 @@ public class AccountDetailBMOImpl extends ApiBaseBMO implements IAccountDetailBM
      * @return 订单服务能够接受的报文
      */
     public void addAccountDetail(JSONObject paramInJson, DataFlowContext dataFlowContext) {
-
         paramInJson.put("detailId", "-1");
         AccountDetailPo accountDetailPo = BeanConvertUtil.covertBean(paramInJson, AccountDetailPo.class);
         super.insert(dataFlowContext, accountDetailPo, BusinessTypeConstant.BUSINESS_TYPE_SAVE_ACCT_DETAIL);
@@ -58,4 +68,50 @@ public class AccountDetailBMOImpl extends ApiBaseBMO implements IAccountDetailBM
         super.update(dataFlowContext, accountDetailPo, BusinessTypeConstant.BUSINESS_TYPE_DELETE_ACCT_DETAIL);
     }
 
+    @Override
+    public void dealAccount(JSONObject paramObj, DataFlowContext dataFlowContext) {
+        //账户金额
+        double deductionAmount = paramObj.getDouble("deductionAmount"); //抵扣金额
+        double redepositAmount = paramObj.getDouble("redepositAmount"); //转存金额
+
+        if (deductionAmount == 0 || redepositAmount == 0) { //抵扣金额
+            return;
+        }
+        String acctId = paramObj.getString("acctId");
+        if (StringUtil.isEmpty(acctId)) {
+            throw new IllegalArgumentException("账户id为空!");
+        }
+        AccountDto accountDto = new AccountDto();
+        accountDto.setAcctId(acctId);
+        //查询账户金额
+        List<AccountDto> accountDtos = accountInnerServiceSMOImpl.queryAccounts(accountDto);
+        Assert.listOnlyOne(accountDtos, "查询账户金额错误!");
+        //获取金额
+        double amount = Double.parseDouble(accountDtos.get(0).getAmount());
+
+        if (amount < deductionAmount && deductionAmount > 0) {
+            throw new IllegalArgumentException("余额不足");
+        }
+
+        AccountDetailPo accountDetailPo = new AccountDetailPo();
+        accountDetailPo.setDetailId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_detailId));
+        if (deductionAmount > 0) {
+            //accountDetailPo.setAmount((deductionAmount * -1) + "");
+            accountDetailPo.setAmount(deductionAmount  + "");
+            accountDetailPo.setDetailType(AccountDetailDto.DETAIL_TYPE_OUT);
+            accountDetailPo.setRemark("前台缴费扣款");
+        } else {
+            accountDetailPo.setAmount(redepositAmount + "");
+            accountDetailPo.setDetailType(AccountDetailDto.DETAIL_TYPE_IN);
+            accountDetailPo.setRemark("前台缴费预存");
+        }
+        accountDetailPo.setOrderId("-1");
+        accountDetailPo.setObjType(accountDtos.get(0).getObjType());
+        accountDetailPo.setObjId(accountDtos.get(0).getObjId());
+        accountDetailPo.setAcctId(accountDtos.get(0).getAcctId());
+        accountDetailPo.setRelAcctId("-1");
+        super.insert(dataFlowContext, accountDetailPo, BusinessTypeConstant.BUSINESS_TYPE_SAVE_ACCT_DETAIL);
+
+    }
+
 }

+ 7 - 40
service-api/src/main/java/com/java110/api/listener/fee/PayFeeListener.java

@@ -3,6 +3,7 @@ package com.java110.api.listener.fee;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.java110.api.bmo.account.IAccountBMO;
+import com.java110.api.bmo.account.IAccountDetailBMO;
 import com.java110.api.bmo.fee.IFeeBMO;
 import com.java110.api.bmo.payFeeDetailDiscount.IPayFeeDetailDiscountBMO;
 import com.java110.api.listener.AbstractServiceApiDataFlowListener;
@@ -10,8 +11,6 @@ import com.java110.core.annotation.Java110Listener;
 import com.java110.core.context.DataFlowContext;
 import com.java110.core.event.service.api.ServiceDataFlowEvent;
 import com.java110.core.factory.GenerateCodeFactory;
-import com.java110.dto.account.AccountDto;
-import com.java110.dto.accountDetail.AccountDetailDto;
 import com.java110.dto.fee.FeeAttrDto;
 import com.java110.dto.fee.FeeConfigDto;
 import com.java110.dto.fee.FeeDto;
@@ -28,7 +27,6 @@ import com.java110.intf.community.IRepairUserInnerServiceSMO;
 import com.java110.intf.community.IRoomInnerServiceSMO;
 import com.java110.intf.fee.*;
 import com.java110.intf.user.IOwnerCarInnerServiceSMO;
-import com.java110.po.accountDetail.AccountDetailPo;
 import com.java110.po.applyRoomDiscount.ApplyRoomDiscountPo;
 import com.java110.po.car.OwnerCarPo;
 import com.java110.po.feeReceipt.FeeReceiptPo;
@@ -51,7 +49,6 @@ import org.springframework.http.HttpMethod;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
 
-import java.math.BigDecimal;
 import java.text.ParseException;
 import java.util.Date;
 import java.util.List;
@@ -109,7 +106,9 @@ public class PayFeeListener extends AbstractServiceApiDataFlowListener {
     private IParkingSpaceInnerServiceSMO parkingSpaceInnerServiceSMOImpl;
 
     @Autowired
-    private IAccountInnerServiceSMO accountInnerServiceSMOImpl;
+    private IAccountDetailBMO accountDetailBMOImpl;
+
+
 
     @Override
     public String getServiceCode() {
@@ -145,41 +144,9 @@ public class PayFeeListener extends AbstractServiceApiDataFlowListener {
         businesses.add(feeBMOImpl.addFeeDetail(paramObj, dataFlowContext, feeReceiptDetailPo, feeReceiptPo));
         businesses.add(feeBMOImpl.modifyFee(paramObj, dataFlowContext));
 
-        //账户金额
-        String useUserAmount = paramObj.getString("useUserAmount"); //获取是否使用账户金额标识
-        if (paramObj.containsKey("useUserAmount") && useUserAmount.equals("true")) {
-            //获取账户id
-            String acctId = paramObj.getString("acctId");
-            if (StringUtil.isEmpty(acctId)) {
-                throw new IllegalArgumentException("账户id为空!");
-            }
-            AccountDto accountDto = new AccountDto();
-            accountDto.setAcctId(acctId);
-            //查询账户金额
-            List<AccountDto> accountDtos = accountInnerServiceSMOImpl.queryAccounts(accountDto);
-            Assert.listOnlyOne(accountDtos, "查询账户金额错误!");
-            //获取金额
-            double amount = Double.parseDouble(accountDtos.get(0).getAmount());
-            //获取实收款
-            double receivedAmount = Double.parseDouble(paramObj.getString("receivedAmount"));
-            if (amount >= receivedAmount) { //如果账户余额大于实收款,则账户余额扣掉的钱数是实收款的钱数
-                AccountDetailPo accountDetailPo=new AccountDetailPo();
-                accountDetailPo.setOrderId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_orderId));
-                accountDetailPo.setAcctId(accountDto.getAcctId());
-                accountDetailPo.setAmount(String.valueOf(receivedAmount));
-                accountDetailPo.setObjType(AccountDetailDto.ORDER_TYPE_USER);
-                //调用扣款接口
-                int flag = accountInnerServiceSMOImpl.withholdAccount(accountDetailPo);
-            } else { //如果账户余额小于实收款,则账户余额钱数会全部用掉,即扣掉的钱数为账户余额钱数
-                AccountDetailPo accountDetailPo=new AccountDetailPo();
-                accountDetailPo.setOrderId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_orderId));
-                accountDetailPo.setAcctId(accountDto.getAcctId());
-                accountDetailPo.setAmount(accountDtos.get(0).getAmount());
-                accountDetailPo.setObjType(AccountDetailDto.ORDER_TYPE_USER);
-                //调用扣款接口
-                int flag = accountInnerServiceSMOImpl.withholdAccount(accountDetailPo);
-            }
-        }
+        //账户处理
+        accountDetailBMOImpl.dealAccount(paramObj, dataFlowContext);
+
 
         //折扣管理
         if (paramObj.containsKey("selectDiscount")) {

+ 1 - 1
service-report/src/main/java/com/java110/report/smo/impl/GeneratorFeeMonthStatisticsInnerServiceSMOImpl.java

@@ -208,7 +208,7 @@ public class GeneratorFeeMonthStatisticsInnerServiceSMOImpl implements IGenerato
             try {
                 doDealCarFee(tmpReportCarDto, tmpReportFeeDto);
             } catch (Exception e) {
-                logger.error("处理房屋费用失败" + JSONObject.toJSONString(tmpReportFeeDto), e);
+                logger.error("处理车辆费用失败" + JSONObject.toJSONString(tmpReportFeeDto), e);
             }
         }
     }