chengf
2026-01-27 b6184e2ddf3db37a94f7efb3b619bbc64642a292
service-fee/src/main/java/com/java110/fee/smo/impl/FeeInnerServiceSMOImpl.java
old mode 100644 new mode 100755
@@ -3,10 +3,14 @@
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.java110.core.annotation.Java110Transactional;
import com.java110.core.base.smo.BaseServiceSMO;
import com.java110.dto.PageDto;
import com.java110.dto.fee.*;
import com.java110.dto.user.UserDto;
import com.java110.dto.fee.BillDto;
import com.java110.dto.fee.BillOweFeeDto;
import com.java110.dto.fee.FeeAttrDto;
import com.java110.dto.fee.FeeConfigDto;
import com.java110.dto.fee.FeeDto;
import com.java110.fee.dao.IFeeAttrServiceDao;
import com.java110.fee.dao.IFeeServiceDao;
import com.java110.intf.fee.IFeeConfigInnerServiceSMO;
@@ -15,6 +19,7 @@
import com.java110.po.fee.PayFeePo;
import com.java110.utils.util.BeanConvertUtil;
import com.java110.utils.util.DateUtil;
import com.java110.utils.util.ListUtil;
import com.java110.utils.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
@@ -61,16 +66,12 @@
        List<FeeDto> fees = BeanConvertUtil.covertBeanList(feeServiceDaoImpl.getFeeInfo(BeanConvertUtil.beanCovertMap(feeDto)), FeeDto.class);
        if (fees == null || fees.size() == 0) {
        if (ListUtil.isNull(fees)) {
            return fees;
        }
        String[] userIds = getUserIds(fees);
        //根据 userId 查询用户信息
        List<UserDto> users = userInnerServiceSMOImpl.getUserInfo(userIds);
        for (FeeDto fee : fees) {
            refreshFee(fee, users);
            refreshFee(fee);
        }
        List<String> feeIds = new ArrayList<>();
@@ -86,16 +87,52 @@
        List<FeeAttrDto> feeAttrDtos = BeanConvertUtil.covertBeanList(attrMaps, FeeAttrDto.class);
        List<FeeAttrDto> tmpFeeAttrDtos = null;
        String payerObjName = "";
        String ownerId = "";
        for (FeeDto tmpFeeDto : fees) {
            payerObjName = "";
            ownerId = "";
            tmpFeeAttrDtos = new ArrayList<>();
            for (FeeAttrDto feeAttrDto : feeAttrDtos) {
                if (tmpFeeDto.getFeeId().equals(feeAttrDto.getFeeId())) {
                    tmpFeeAttrDtos.add(feeAttrDto);
                if (!tmpFeeDto.getFeeId().equals(feeAttrDto.getFeeId())) {
                    continue;
                }
                tmpFeeAttrDtos.add(feeAttrDto);
                if (FeeAttrDto.SPEC_CD_PAY_OBJECT_NAME.equals(feeAttrDto.getSpecCd())) {
                    payerObjName = feeAttrDto.getValue();
                }
                if (FeeAttrDto.SPEC_CD_OWNER_ID.equals(feeAttrDto.getSpecCd())) {
                    ownerId = feeAttrDto.getValue();
                }
            }
            tmpFeeDto.setPayerObjName(payerObjName);
            tmpFeeDto.setFeeAttrDtos(tmpFeeAttrDtos);
            tmpFeeDto.setOwnerId(ownerId);
        }
        return fees;
    }
    @Override
    public List<FeeDto> querySimpleFees(@RequestBody FeeDto feeDto) {
        //校验是否传了 分页信息
        int page = feeDto.getPage();
        if (page != PageDto.DEFAULT_PAGE) {
            feeDto.setPage((page - 1) * feeDto.getRow());
        }
        List<FeeDto> fees = BeanConvertUtil.covertBeanList(feeServiceDaoImpl.getFeeInfo(BeanConvertUtil.beanCovertMap(feeDto)), FeeDto.class);
        for (FeeDto tmpFeeDto : fees) {
            if (!StringUtil.isEmpty(tmpFeeDto.getImportFeeName())) {
                //fee.setFeeName(fee.getImportFeeName() + "(" + fee.getFeeName() + ")");
                tmpFeeDto.setFeeName(tmpFeeDto.getImportFeeName());
            }
        }
        return fees;
    }
@@ -111,15 +148,15 @@
    /**
     * 从用户列表中查询用户,将用户中的信息 刷新到 floor对象中
     *
     * @param fee   小区费用信息
     * @param users 用户列表
     * @param fee 小区费用信息
     *            //@param users 用户列表
     */
    private void refreshFee(FeeDto fee, List<UserDto> users) {
        for (UserDto user : users) {
            if (fee.getUserId().equals(user.getUserId())) {
                BeanConvertUtil.covertBean(user, fee);
            }
        }
    private void refreshFee(FeeDto fee) {
//        for (UserDto user : users) {
//            if (fee.getUserId().equals(user.getUserId())) {
//                BeanConvertUtil.covertBean(user, fee);
//            }
//        }
        if (!StringUtil.isEmpty(fee.getImportFeeName())) {
            //fee.setFeeName(fee.getImportFeeName() + "(" + fee.getFeeName() + ")");
@@ -292,6 +329,7 @@
    }
    @Override
    @Java110Transactional
    public int updateFee(@RequestBody PayFeePo payFeePo) {
        feeServiceDaoImpl.updateFeeInfoInstance(BeanConvertUtil.beanCovertMap(payFeePo));
        return 1;
@@ -307,6 +345,26 @@
        Map info = new HashMap();
        info.put("payFeePos", fees);
        return feeServiceDaoImpl.insertFees(info);
    }
    @Override
    @Java110Transactional
    public int saveOneFee(@RequestBody PayFeePo payFeePo) {
        List<Map> fees = new ArrayList<>();
        fees.add(BeanConvertUtil.beanCovertMap(payFeePo));
        Map info = new HashMap();
        info.put("payFeePos", fees);
        return feeServiceDaoImpl.insertFees(info);
    }
    @Override
    public int deleteFeesByBatch(@RequestBody PayFeePo payFeePo) {
        return feeServiceDaoImpl.deleteFeesByBatch(BeanConvertUtil.beanCovertMap(payFeePo));
    }
    @Override
    public int getFeeInfoBus(@RequestBody FeeDto feeDto) {
        return feeServiceDaoImpl.getFeeInfoBus(BeanConvertUtil.beanCovertMap(feeDto));
    }
    @Override
@@ -331,51 +389,21 @@
        return data;
    }
    private void dealFeeConfig(JSONArray data, FeeConfigDto tmpFeeConfigDto) {
        String billType = tmpFeeConfigDto.getBillType();
        JSONObject config = new JSONObject();
        if (FeeConfigDto.BILL_TYPE_EVERY.equals(billType)) {
            Map info = new HashMap();
            info.put("configId", tmpFeeConfigDto.getConfigId());
            info.put("communityId", tmpFeeConfigDto.getCommunityId());
            info.put("arrearsEndTime", DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_A));
            info.put("state", FeeDto.STATE_DOING);
            int oweFeeCount = feeServiceDaoImpl.queryFeesCount(info);
            config.put("oweFeeCount", oweFeeCount);
            info.put("noArrearsEndTime", DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_A));
            info.put("state", FeeDto.STATE_DOING);
            int feeCount = feeServiceDaoImpl.queryFeesCount(info);
            config.put("feeCount", feeCount);
            config.put("feeName", tmpFeeConfigDto.getFeeName());
            data.add(config);
            return;
        }
        BillDto billDto = new BillDto();
        billDto.setConfigId(tmpFeeConfigDto.getConfigId());
        billDto.setCommunityId(tmpFeeConfigDto.getCommunityId());
        billDto.setCurBill("T");
        List<Map> bills = feeServiceDaoImpl.queryBills(BeanConvertUtil.beanCovertMap(billDto));
        if (bills == null || bills.size() < 1) {
            config.put("oweFeeCount", 0);
            config.put("feeCount", 0);
            config.put("feeName", tmpFeeConfigDto.getFeeName());
            return;
        }
        Map tmpBillDto = bills.get(0);
        Map info = new HashMap();
        info.put("billId", tmpBillDto.get("billId"));
        info.put("communityId", tmpFeeConfigDto.getCommunityId());
        int oweFeeCount = feeServiceDaoImpl.queryBillOweFeeCount(info);
        config.put("oweFeeCount", oweFeeCount);
        info.put("configId", tmpFeeConfigDto.getConfigId());
        info.put("communityId", tmpFeeConfigDto.getCommunityId());
        info.put("arrearsEndTime", DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_A));
        info.put("state", FeeDto.STATE_DOING);
        int feeTotalCount = feeServiceDaoImpl.queryFeesCount(info);
        config.put("feeCount", feeTotalCount - oweFeeCount);
        int oweFeeCount = feeServiceDaoImpl.queryFeesCount(info);
        config.put("oweFeeCount", oweFeeCount);
        info.put("noArrearsEndTime", DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_A));
        info.put("state", FeeDto.STATE_DOING);
        int feeCount = feeServiceDaoImpl.queryFeesCount(info);
        config.put("feeCount", feeCount);
        config.put("feeName", tmpFeeConfigDto.getFeeName());
        data.add(config);
@@ -397,4 +425,11 @@
    public void setUserInnerServiceSMOImpl(IUserInnerServiceSMO userInnerServiceSMOImpl) {
        this.userInnerServiceSMOImpl = userInnerServiceSMOImpl;
    }
    @Override
    public int countValidPayFeeByConfigId(String configId) {
        Map info = new HashMap();
        info.put("configId", configId);
        return feeServiceDaoImpl.countValidPayFeeByConfigId(info);
    }
}