chengf
2025-08-25 bf3924206b359d77e928255328f8625cb986bd72
修复费用初始化0825
9个文件已修改
1个文件已添加
370 ■■■■ 已修改文件
java110-bean/src/main/java/com/java110/dto/importData/ImportRoomFee.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-bean/src/main/java/com/java110/po/car/CarInoutPo.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-db/src/main/resources/mapper/fee/FeeServiceDaoImplMapper.xml 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
java110-db/src/main/resources/mapper/fee/ReportFeeServiceDaoImplMapper.xml 207 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-fee/src/main/java/com/java110/fee/cmd/fee/ReportFeePropertyCmd.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-job/src/main/java/com/java110/job/cmd/importCarInout/QueryCarInout.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-job/src/main/java/com/java110/job/importData/adapt/ImportCarHistoryFeeDetailQueueDataAdapt.java 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-job/src/main/java/com/java110/job/importData/adapt/ImportHistoryFeeDetailQueueDataAdapt.java 117 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-job/src/main/java/com/java110/job/importData/adapt/ImportRoomFeeQueueDataAdapt.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
service-job/src/main/resources/templates/fee_reminder_template.docx 补丁 | 查看 | 原始文档 | blame | 历史
java110-bean/src/main/java/com/java110/dto/importData/ImportRoomFee.java
@@ -364,4 +364,6 @@
    public void setIsContractFee(String isContractFee) {
        this.isContractFee = isContractFee;
    }
}
java110-bean/src/main/java/com/java110/po/car/CarInoutPo.java
@@ -29,6 +29,7 @@
    private String errorTest;
    private String communityName;
    private String detailId;
    public String getInoutId() {
        return inoutId;
@@ -157,4 +158,12 @@
    public void setCommunityName(String communityName) {
        this.communityName = communityName;
    }
    public String getDetailId() {
        return detailId;
    }
    public void setDetailId(String detailId) {
        this.detailId = detailId;
    }
}
java110-db/src/main/resources/mapper/fee/FeeServiceDaoImplMapper.xml
@@ -168,6 +168,9 @@
        <if test="incomeObjId !=null and incomeObjId != ''">
            and t.income_obj_id= #{incomeObjId}
        </if>
          <if test="feeName != null and feeName != ''">
              and pfc.fee_name = #{feeName}
          </if>
        <if test="feeTypeCd !=null and feeTypeCd != ''">
            and t.fee_type_cd= #{feeTypeCd}
        </if>
java110-db/src/main/resources/mapper/fee/ReportFeeServiceDaoImplMapper.xml
@@ -175,8 +175,8 @@
        row24 as row23,
        row25 as row24,
        row26 as row25,
        null as row26;
        null as row27;
        null as row26,
        null as row27,
        row27 as row28,
        null as row29,
        null as row30
@@ -258,4 +258,207 @@
            LIMIT #{pageNum}, #{pageSize}
        </if>
    </select>
    <select id="sss">
        WITH year_series AS (
            -- 生成2016-2025年序列(独立CTE便于复用)
            SELECT 2016 + n AS year
            FROM (
                     SELECT 0 AS n UNION SELECT 1 UNION SELECT 2 UNION SELECT 3 UNION SELECT 4
                     UNION SELECT 5 UNION SELECT 6 UNION SELECT 7 UNION SELECT 8 UNION SELECT 9
                 ) AS nums
        ),
             all_data AS (
                 SELECT
                     pf.fee_id AS 费用编号,
                     pfc.fee_name AS 费用名称,
                     ys.year AS 年份,
                     -- 计算当年有效时间范围(1月1日至12月31日)
                     STR_TO_DATE(CONCAT(ys.year, '-01-01'), '%Y-%m-%d') AS 当年起始日,
                     STR_TO_DATE(CONCAT(ys.year, '-12-31'), '%Y-%m-%d') AS 当年截止日,
                     -- 已收区间(严格限定在当年范围内)
                     CASE
                         -- 费用起始时间晚于当年年底:无已收
                         WHEN pf.start_time > STR_TO_DATE(CONCAT(ys.year, '-12-31'), '%Y-%m-%d') THEN NULL
                         -- 费用截止时间早于当年年初:无已收
                         WHEN pf.end_time &lt; STR_TO_DATE(CONCAT(ys.year, '-01-01'), '%Y-%m-%d') THEN NULL
                         -- 正常情况:取重叠区间
                         ELSE GREATEST(pf.start_time, STR_TO_DATE(CONCAT(ys.year, '-01-01'), '%Y-%m-%d'))
                         END AS 当年已收起始日,
                     CASE
                         WHEN pf.start_time > STR_TO_DATE(CONCAT(ys.year, '-12-31'), '%Y-%m-%d') THEN NULL
                         WHEN pf.end_time &lt; STR_TO_DATE(CONCAT(ys.year, '-01-01'), '%Y-%m-%d') THEN NULL
                         ELSE LEAST(pf.end_time, STR_TO_DATE(CONCAT(ys.year, '-12-31'), '%Y-%m-%d'))
                         END AS 当年已收截止日,
                     -- 未收区间(严格限定在当年范围内)
                     CASE
                         -- 应缴截止时间早于当年年初:无未收
                         WHEN STR_TO_DATE(pfa.`value`, '%Y-%m-%d') &lt; STR_TO_DATE(CONCAT(ys.year, '-01-01'), '%Y-%m-%d') THEN NULL
                         -- 费用截止时间晚于当年年底:无未收
                         WHEN pf.end_time > STR_TO_DATE(CONCAT(ys.year, '-12-31'), '%Y-%m-%d') THEN NULL
                         -- 正常情况:取重叠区间
                         ELSE GREATEST(pf.end_time, STR_TO_DATE(CONCAT(ys.year, '-01-01'), '%Y-%m-%d'))
                         END AS 当年未收起始日,
                     CASE
                         WHEN STR_TO_DATE(pfa.`value`, '%Y-%m-%d') &lt; STR_TO_DATE(CONCAT(ys.year, '-01-01'), '%Y-%m-%d') THEN NULL
                         WHEN pf.end_time > STR_TO_DATE(CONCAT(ys.year, '-12-31'), '%Y-%m-%d') THEN NULL
                         ELSE LEAST(STR_TO_DATE(pfa.`value`, '%Y-%m-%d'), STR_TO_DATE(CONCAT(ys.year, '-12-31'), '%Y-%m-%d'))
                         END AS 当年未收截止日,
                     -- 已收月数(仅统计当年的有效明细)
                     COALESCE(COUNT(DISTINCT CASE
                                                 WHEN pfdm.detail_year = ys.year AND pfdm.status_cd = '0'
                                                     THEN CONCAT(pfdm.detail_year, '-', LPAD(pfdm.detail_month, 2, '0'))
                         END), 0) AS 当年已收月数,
                     -- 应收月数(当年内的理论应收月数)
                     CASE
                         WHEN GREATEST(pf.start_time, STR_TO_DATE(CONCAT(ys.year, '-01-01'), '%Y-%m-%d')) >
                              LEAST(STR_TO_DATE(pfa.`value`, '%Y-%m-%d'), STR_TO_DATE(CONCAT(ys.year, '-12-31'), '%Y-%m-%d'))
                             THEN 0
                         ELSE TIMESTAMPDIFF(
                                      MONTH,
                                      GREATEST(pf.start_time, STR_TO_DATE(CONCAT(ys.year, '-01-01'), '%Y-%m-%d')),
                                      LEAST(STR_TO_DATE(pfa.`value`, '%Y-%m-%d'), STR_TO_DATE(CONCAT(ys.year, '-12-31'), '%Y-%m-%d'))
                              ) + 1
                         END AS 当年应收月数,
                     -- 计算每月费用(单价×面积)
                     pfc.square_price * br.built_up_area AS 每月费用,
                     -- 折扣金额(仅统计当年的有效折扣)
                     COALESCE(SUM(CASE WHEN pfdm.detail_year = ys.year THEN pfdm.discount_amount ELSE 0 END), 0) AS 当年折扣金额
                 FROM pay_fee pf
                          INNER JOIN pay_fee_config pfc
                                     ON pf.config_id = pfc.config_id
                                         AND pfc.square_price > 0  -- 确保有有效单价
                          INNER JOIN building_room br
                                     ON pf.payer_obj_id = br.room_id
                          INNER JOIN pay_fee_attrs pfa
                                     ON pf.fee_id = pfa.fee_id
                                         AND pfa.spec_cd = '390010'  -- 应缴截止日期属性
                          INNER JOIN year_series ys ON 1=1  -- 关联年份序列
                          LEFT JOIN pay_fee_detail_month pfdm
                                    ON pf.fee_id = pfdm.fee_id
                                        AND pfdm.obj_id = pf.payer_obj_id
                                        AND pfdm.status_cd = '0'  -- 有效明细
                 WHERE pf.payer_obj_id = '752025071562520009'
                   AND pf.fee_type_cd IN ('630000001', '630000002')
                   AND pf.status_cd = '0'  -- 有效费用
                 GROUP BY
                     pf.fee_id, pfc.fee_name, ys.year,
                     pf.start_time, pf.end_time, pfa.`value`,
                     pfc.square_price, br.built_up_area
             ),
             calculated_data AS (
                 -- 计算金额字段(基于已收/应收月数)
                 SELECT
                     费用编号,
                     费用名称,
                     年份,
                     当年已收起始日,
                     当年已收截止日,
                     当年未收起始日,
                     当年未收截止日,
                     当年已收月数,
                     当年应收月数,
                     每月费用,
                     当年折扣金额,
                     -- 应收金额=应收月数×每月费用
                     当年应收月数 * 每月费用 AS 当年应收金额,
                     -- 实收金额=已收月数×每月费用-折扣金额
                     (当年已收月数 * 每月费用) - 当年折扣金额 AS 当年实收金额
                 FROM all_data
             ),
             grouped_data AS (
                 -- 各年份数据
                 SELECT
                     费用编号,
                     费用名称,
                     CONCAT(年份, '年') AS 统计维度,
                     年份 AS 排序辅助,
                     当年已收月数 AS 已收月数,
                     -- 已收区间(仅显示有效区间)
                     CASE
                         WHEN 当年已收起始日 IS NOT NULL AND 当年已收截止日 IS NOT NULL
                             THEN CONCAT(DATE_FORMAT(当年已收起始日, '%Y-%m-%d'), ' ~ ', DATE_FORMAT(当年已收截止日, '%Y-%m-%d'))
                         ELSE NULL
                         END AS 已收区间,
                     -- 未收区间(仅显示有效区间)
                     CASE
                         WHEN 当年未收起始日 IS NOT NULL AND 当年未收截止日 IS NOT NULL
                             THEN CONCAT(DATE_FORMAT(当年未收起始日, '%Y-%m-%d'), ' ~ ', DATE_FORMAT(当年未收截止日, '%Y-%m-%d'))
                         ELSE NULL
                         END AS 未收区间,
                     当年应收金额 AS 应收金额,
                     当年实收金额 AS 实收金额,
                     当年折扣金额 AS 折扣金额
                 FROM calculated_data
                 WHERE 年份 BETWEEN 2016 AND 2025
                 UNION ALL
                 -- 2020年单独统计
                 SELECT
                     费用编号,
                     费用名称,
                     '2020年' AS 统计维度,
                     2020 AS 排序辅助,
                     SUM(当年已收月数) AS 已收月数,
                     CASE
                         WHEN MIN(当年已收起始日) IS NOT NULL AND MAX(当年已收截止日) IS NOT NULL
                             THEN CONCAT(DATE_FORMAT(MIN(当年已收起始日), '%Y-%m-%d'), ' ~ ', DATE_FORMAT(MAX(当年已收截止日), '%Y-%m-%d'))
                         ELSE NULL
                         END AS 已收区间,
                     CASE
                         WHEN MIN(当年未收起始日) IS NOT NULL AND MAX(当年未收截止日) IS NOT NULL
                             THEN CONCAT(DATE_FORMAT(MIN(当年未收起始日), '%Y-%m-%d'), ' ~ ', DATE_FORMAT(MAX(当年未收截止日), '%Y-%m-%d'))
                         ELSE NULL
                         END AS 未收区间,
                     SUM(当年应收金额) AS 应收金额,
                     SUM(当年实收金额) AS 实收金额,
                     SUM(当年折扣金额) AS 折扣金额
                 FROM calculated_data
                 WHERE 年份 = 2020
                 GROUP BY 费用编号, 费用名称, 统计维度, 排序辅助
                 UNION ALL
                 -- 2016-2025年合计
                 SELECT
                     费用编号,
                     费用名称,
                     '2016-2025年合计' AS 统计维度,
                     9999 AS 排序辅助,
                     SUM(当年已收月数) AS 已收月数,
                     CASE
                         WHEN MIN(当年已收起始日) IS NOT NULL AND MAX(当年已收截止日) IS NOT NULL
                             THEN CONCAT(DATE_FORMAT(MIN(当年已收起始日), '%Y-%m-%d'), ' ~ ', DATE_FORMAT(MAX(当年已收截止日), '%Y-%m-%d'))
                         ELSE NULL
                         END AS 已收区间,
                     CASE
                         WHEN MIN(当年未收起始日) IS NOT NULL AND MAX(当年未收截止日) IS NOT NULL
                             THEN CONCAT(DATE_FORMAT(MIN(当年未收起始日), '%Y-%m-%d'), ' ~ ', DATE_FORMAT(MAX(当年未收截止日), '%Y-%m-%d'))
                         ELSE NULL
                         END AS 未收区间,
                     SUM(当年应收金额) AS 应收金额,
                     SUM(当年实收金额) AS 实收金额,
                     SUM(当年折扣金额) AS 折扣金额
                 FROM calculated_data
                 WHERE 年份 BETWEEN 2016 AND 2025
                 GROUP BY 费用编号, 费用名称, 统计维度, 排序辅助
             )
-- 最终结果输出
        SELECT
            费用编号,
            费用名称,
            统计维度,
            已收月数,
            已收区间,
            未收区间,
            应收金额,
            实收金额,
            折扣金额
        FROM grouped_data where 应收金额 != 0
        ORDER BY
            费用编号,
            排序辅助;
    </select>
</mapper>
service-fee/src/main/java/com/java110/fee/cmd/fee/ReportFeePropertyCmd.java
@@ -97,8 +97,8 @@
//            int i = reportFeeInnerServiceSMOImpl.saveReport(BeanConvertUtil.beanCovertMap(reportQueryRecord));
            ResultVo resultVo = new ResultVo();
            String[][] strings = new String[10][57];
            ResultVo resultVo = new ResultVo(strings);
            ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
service-job/src/main/java/com/java110/job/cmd/importCarInout/QueryCarInout.java
@@ -56,7 +56,6 @@
                    apiCarInoutDataVo.setCarInoutFeeHistory(list.get(0));
                }
            }
            i = carInoutDtos.size();
            ApiCarInoutVo carInoutVo = new ApiCarInoutVo();
            carInoutVo.setTotal(i);
service-job/src/main/java/com/java110/job/importData/adapt/ImportCarHistoryFeeDetailQueueDataAdapt.java
@@ -103,7 +103,7 @@
        importCarFees = ownerCarInnerServiceSMOImpl.freshCarIds(importCarFees);
        for (ImportRoomFee importCarFee : importCarFees) {
            try {
                if (StringUtil.isEmpty(importCarFee.getCarId())) {
                if (StringUtil.isEmpty(importCarFee.getCarNum())) {
                    continue;
                }
                importCarFeeDetail(importCarFee, storeId, userId, batchId);
@@ -123,14 +123,26 @@
    private void importCarFeeDetail(ImportRoomFee importRoomFee, String storeId, String userId, String batchId) {
        RoomDto roomDto = new RoomDto();
        roomDto.setDoorRoomNum(importRoomFee.getDoorRoomNum());
//        roomDto.setDoorRoomNum(importRoomFee.getDoorRoomNum());
        roomDto.setCommunityId(importRoomFee.getCommunityId());
        if(importRoomFee.getDoorRoomNum()!=null){
            String[] split = importRoomFee.getDoorRoomNum().split("-");
            if(split.length==2){
                roomDto.setDoorRoomNum(importRoomFee.getDoorRoomNum());
            }else if(split.length > 2){
                roomDto.setFloorNum(split[0]);
                roomDto.setUnitNum(split[1]);
                roomDto.setRoomNum(split[2]);
            }
        }
        List<RoomDto> roomDtos = iRoomInnerServiceSMOImpl.queryRooms(roomDto);
        try {
            importRoomFee.setRoomId(roomDtos.get(0).getRoomId());
        }catch (Exception e){
            updateImportLogDetailState(importRoomFee.getDetailId(),new IllegalArgumentException("费用项"+importRoomFee.getFeeName()+"不存在"));
            throw new IllegalArgumentException("门室号"+importRoomFee.getDoorRoomNum()+"未查询到房屋");
            if(!(importRoomFee.getPayObjId().equals("7777"))){
                updateImportLogDetailState(importRoomFee.getDetailId(),new IllegalArgumentException("费用项"+importRoomFee.getFeeName()+"不存在"));
                throw new IllegalArgumentException("门室号"+importRoomFee.getDoorRoomNum()+"未查询到房屋");
            }
        }
        PayFeeDetailPo payFeeDetailPo = new PayFeeDetailPo();
        payFeeDetailPo.setPayOrderId(importRoomFee.getRoomId());
service-job/src/main/java/com/java110/job/importData/adapt/ImportHistoryFeeDetailQueueDataAdapt.java
@@ -94,16 +94,30 @@
    @Autowired
    private IPayFeeDetailDiscountNewV1InnerServiceSMO payFeeDetailDiscountNewV1InnerServiceSMOImpl;
    @Autowired
    private ImportRoomFeeQueueDataAdapt importRoomFeeQueueDataAdapt;
    @Override
    public void importData(List<AssetImportLogDetailDto> assetImportLogDetailDtos) {
        importDatas(assetImportLogDetailDtos);
        for (AssetImportLogDetailDto assetImportLogDetailDto : assetImportLogDetailDtos) {
            try {
                importDatas(assetImportLogDetailDto);
                updateImportLogDetailState(assetImportLogDetailDto.getDetailId());
            } catch (Exception e) {
                e.printStackTrace();
                updateImportLogDetailState(assetImportLogDetailDto.getDetailId(), e);
            }
        }
    }
    private void importDatas(List<AssetImportLogDetailDto> infos) {
    private void importDatas(AssetImportLogDetailDto assetImportLogDetailDto) {
        List<ImportRoomFee> importRoomFees = new ArrayList<>();
        List<ImportRoomFee> importCarFees = new ArrayList<>();
        for (AssetImportLogDetailDto assetImportLogDetailDto : infos) {
        List<ImportRoomFee> importContractFees = new ArrayList<>();
        List<CarInoutPo> carInoutPos = new ArrayList<>();
            String communityId = assetImportLogDetailDto.getCommunityId();
            JSONObject data = JSONObject.parseObject(assetImportLogDetailDto.getContent());
            ImportRoomFee importRoomFee = BeanConvertUtil.covertBean(data, ImportRoomFee.class);
@@ -123,8 +137,8 @@
                carInout.setCreateTime(JSONObject.parseObject(assetImportLogDetailDto.getContent().toString()).getString("inputTime"));
                carInout.setbId(JSONObject.parseObject(assetImportLogDetailDto.getContent().toString()).getString("batchId"));
                List<CarInoutPo> carInoutPos = new ArrayList<>();
                carInout.setInoutId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_inoutId));
                carInout.setDetailId(assetImportLogDetailDto.getDetailId());
                carInoutPos.add(carInout);
// 如果有结束时间,创建新的对象作为出口记录
@@ -146,18 +160,10 @@
                    exitCarInout.setState("100400");
                    exitCarInout.setInoutId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_inoutId));
                    exitCarInout.setPaymentAmount(JSONObject.parseObject(assetImportLogDetailDto.getContent().toString()).getString("chargeAmount"));
                    exitCarInout.setDetailId(assetImportLogDetailDto.getDetailId());
                    carInoutPos.add(exitCarInout);
                }
                try {
                    carInoutInnerServiceSMOImpl.batchSaveCarInout2(carInoutPos);
                }catch (Exception e){
                    updateImportLogDetailState(importRoomFee.getDetailId(),e);
                    throw new IllegalArgumentException(e.getMessage());
                }
                updateImportLogDetailState(importRoomFee.getDetailId());
            }
            else if(contractTypes.contains(importRoomFee.getSecondaryFeeTypeCd())){
                importRoomFee.setFeeName(data.getString("secondaryFeeTypeCd"));
@@ -179,7 +185,7 @@
//            if(importRoomFee.getPayerObjName())
                importCarFees.add(importRoomFee);
            }
            else if(carTypes.contains(JSONObject.parseObject(infos.get(0).getContent()).get("category22"))){
            else if(carTypes.contains(JSONObject.parseObject(assetImportLogDetailDto.getContent()).get("category22"))){
                importRoomFee.setCommunityId(communityId);
                importRoomFee.setFeeName(data.getString("secondaryFeeTypeCd"));
                importRoomFee.setDetailId(assetImportLogDetailDto.getDetailId());
@@ -212,7 +218,7 @@
//            if(importRoomFee.getPayerObjName())
                importRoomFees.add(importRoomFee);
            }
        }
        importFeeDetailsByCarInout(carInoutPos);
        if (ListUtil.isNull(importRoomFees) && ListUtil.isNull(importCarFees)) {
            return;
@@ -224,9 +230,22 @@
        if(!(ListUtil.isNull(importCarFees))){
            importCarHistoryFeeDetailQueueDataAdapt.importCarFeeDetails(importCarFees.get(0).getStoreId(), importCarFees.get(0).getUserId(), importCarFees, importCarFees.get(0).getBatchId());
        }
//
//
    }
    private void importFeeDetailsByCarInout(List<CarInoutPo> carInoutPos) {
        for (CarInoutPo carInoutPo : carInoutPos) {
            try {
                ArrayList<CarInoutPo> carInoutPos1 = new ArrayList<>();
                carInoutPos1.add(carInoutPo);
                carInoutInnerServiceSMOImpl.batchSaveCarInout2(carInoutPos1);
                updateImportLogDetailState(carInoutPo.getDetailId());
            }catch (Exception e){
                updateImportLogDetailState(carInoutPo.getDetailId(),e);
                throw new IllegalArgumentException(e.getMessage());
            }
        }
    }
@@ -253,6 +272,7 @@
            } catch (Exception e) {
                e.printStackTrace();
                updateImportLogDetailState(importRoomFee.getDetailId(), e);
                throw new IllegalArgumentException(e.getMessage());
            }
        }
    }
@@ -269,8 +289,18 @@
    private void importFeeDetail(ImportRoomFee importRoomFee, String storeId, String userId, String batchId) {
        RoomDto roomDto = new RoomDto();
        roomDto.setDoorRoomNum(importRoomFee.getDoorRoomNum());
//        roomDto.setDoorRoomNum(importRoomFee.getDoorRoomNum());
        roomDto.setCommunityId(importRoomFee.getCommunityId());
        if(importRoomFee.getDoorRoomNum()!=null){
            String[] split = importRoomFee.getDoorRoomNum().split("-");
            if(split.length==2){
                roomDto.setDoorRoomNum(importRoomFee.getDoorRoomNum());
            }else if(split.length > 2){
                roomDto.setFloorNum(split[0]);
                roomDto.setUnitNum(split[1]);
                roomDto.setRoomNum(split[2]);
            }
        }
        List<RoomDto> roomDtos = iRoomInnerServiceSMOImpl.queryRooms(roomDto);
        try {
            importRoomFee.setRoomId(roomDtos.get(0).getRoomId());
@@ -279,38 +309,17 @@
        }
        FeeDto feeDto2 = new FeeDto();
        feeDto2.setFeeName(importRoomFee.getFeeName());
        List<FeeDto> feeDtos2 = feeInnerServiceSMOImpl.queryFees(feeDto2);
        if(feeDtos2.size() == 0){
        feeDto2.setPayerObjId(importRoomFee.getRoomId());
        feeDto2.setCommunityId(importRoomFee.getCommunityId());
        List<FeeDto> feeDtos = feeInnerServiceSMOImpl.queryFees(feeDto2);
        if(feeDtos.size() == 0){
            updateImportLogDetailState(importRoomFee.getDetailId(),new IllegalArgumentException("费用项"+importRoomFee.getFeeName()+"不存在"));
            throw new IllegalArgumentException("费用项"+importRoomFee.getFeeName()+"不存在");
        }
        FeeConfigDto feeConfigDto = new FeeConfigDto();
        feeConfigDto.setFeeName(importRoomFee.getFeeName().trim());
        feeConfigDto.setCommunityId(importRoomFee.getCommunityId());
        List<FeeConfigDto> feeConfigDtos = feeConfigInnerServiceSMOImpl.queryFeeConfigs(feeConfigDto);
        if (ListUtil.isNull(feeConfigDtos)) {
            throw new IllegalArgumentException("收费项"+feeConfigDto.getFeeName()+"不存在");
        }
        FeeConfigDto tmpFeeConfigDto = feeConfigDtos.get(0);
        FeeDto feeDto = new FeeDto();
        feeDto.setConfigId(tmpFeeConfigDto.getConfigId());
        feeDto.setCommunityId(importRoomFee.getCommunityId());
        feeDto.setPayerObjId(importRoomFee.getRoomId());
        feeDto.setPayerObjType(importRoomFee.getObjType() ==null?FeeDto.PAYER_OBJ_TYPE_ROOM:importRoomFee.getObjType());
        feeDto.setFeeTypeCd(feeConfigDtos.get(0).getFeeTypeCd());
        feeDto.setConfigId(tmpFeeConfigDto.getConfigId());
        // 解析日期字符串
        LocalDateTime startDate = LocalDateTime.parse(importRoomFee.getStartTime(), formatter);
        LocalDateTime endDate = LocalDateTime.parse(importRoomFee.getEndTime(), formatter);
        importRoomFee.setCycle(String.valueOf(ChronoUnit.MONTHS.between(startDate, endDate)));
        List<FeeDto> feeDtos = feeInnerServiceSMOImpl.queryFees(feeDto);
        importRoomFee.setPayObjId(importRoomFee.getRoomId());
        if (ListUtil.isNull(feeDtos)) {
            throw new IllegalArgumentException("查询不到该记录的费用项:"+importRoomFee.getFeeName()+startDate+endDate);
            throw new IllegalArgumentException("查询不到该记录的费用项:"+importRoomFee.getFeeName());
//            List<FeeAttrPo> feeAttrsPos = new ArrayList<>();
//            PayFeePo payFeePo = new PayFeePo();
//            payFeePo.setCommunityId(importRoomFee.getCommunityId());
@@ -355,10 +364,10 @@
//            feeDtos = feeInnerServiceSMOImpl.queryFees(feeDto);
        }
        if(feeDtos.size()>1){
            throw new IllegalArgumentException("该初始化缴费记录信息中包含多个费用记录"+importRoomFee.getFeeName()+startDate+endDate);
            throw new IllegalArgumentException("该初始化缴费记录信息中包含多个费用记录"+importRoomFee.getFeeName());
        }
        for (FeeDto tmpFeeDto : feeDtos) {
            if(DateUtil.getDateFromStringB(importRoomFee.getEndTime()).getTime() > tmpFeeDto.getEndTime().getTime()){
            if(DateUtil.getDateFromStringB(importRoomFee.getEndTime()).getTime() > tmpFeeDto.getMaxEndTime().getTime()){
                throw new IllegalArgumentException("该费用记录结束时间大于费用记录最大缴费时间");
            }
            doImportFeeDetail(tmpFeeDto, importRoomFee);
@@ -384,11 +393,9 @@
        PayFeeDetailPo payFeeDetailPo = new PayFeeDetailPo();
        payFeeDetailPo.setCommunityId(importRoomFee.getCommunityId());
        payFeeDetailPo.setReceivedAmount(importRoomFee.getAmount());
        payFeeDetailPo.setCycles(importRoomFee.getCycle());
        payFeeDetailPo.setPrimeRate("1.0");
        payFeeDetailPo.setFeeId(tmpFeeDto.getFeeId());
        payFeeDetailPo.setStartTime(importRoomFee.getStartTime());
        payFeeDetailPo.setEndTime(importRoomFee.getEndTime());
        payFeeDetailPo.setRemark(importRoomFee.getRemark());
        payFeeDetailPo.setCreateTime(importRoomFee.getCreateTime());
        payFeeDetailPo.setState("1400");
@@ -397,14 +404,16 @@
        payFeeDetailPo.setB("T");
        double cycle = (DateUtil.dayCompare(
                DateUtil.getDateFromStringA(payFeeDetailPo.getStartTime()),
                DateUtil.getDateFromStringA(payFeeDetailPo.getEndTime())
                DateUtil.getDateFromStringA(importRoomFee.getEndTime())
        ));
        payFeeDetailPo.setCycles(cycle+"");
        int count = feeDetailInnerServiceSMOImpl.queryFeeDetailsCountByVo(payFeeDetailPo);
        payFeeDetailPo.setPayableAmount(importRoomFee.getAmount());
        payFeeDetailPo.setCycles(importRoomFee.getCycle());
        payFeeDetailPo.setCycles(cycle+"");
        payFeeDetailPo.setEndTime(importRoomFee.getEndTime());
        if (count > 0) {
            throw new IllegalStateException("重复的缴费记录");
        }
@@ -427,10 +436,12 @@
                    payFeeDetailPo.setReceivableAmount((Double.parseDouble(payFeeDetailPo.getReceivedAmount()) + Double.parseDouble(payFeeDetailPo.getDiscountAmount()))+"");
                    payFeeDetailDiscount.setDiscountId(discountId);
                    payFeeDetailDiscount.setDiscountPrice(discountPrice);
                }else{
                    payFeeDetailPo.setReceivableAmount(payFeeDetailPo.getReceivedAmount()+"");
                }
            }
        } catch (ParseException e) {
            throw new RuntimeException(e);
            throw new RuntimeException(e.getMessage());
        }
@@ -451,9 +462,9 @@
            payFeeDetailDiscount.setCommunityId(feeDtos.get(0).getCommunityId());
            payFeeDetailDiscount.setFeeId(feeDtos.get(0).getFeeId());
            payFeeDetailDiscount.setDetailDiscountId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_discountId));
        }
        payFeeDetailDiscountNewV1InnerServiceSMOImpl.savePayFeeDetailDiscountNew(payFeeDetailDiscount);
            payFeeDetailDiscountNewV1InnerServiceSMOImpl.savePayFeeDetailDiscountNew(payFeeDetailDiscount);
        }
        if (saved < 1) {
            return;
service-job/src/main/java/com/java110/job/importData/adapt/ImportRoomFeeQueueDataAdapt.java
@@ -102,8 +102,13 @@
    public void importData(List<AssetImportLogDetailDto> assetImportLogDetailDtos) {
        for (AssetImportLogDetailDto assetImportLogDetailDto : assetImportLogDetailDtos) {
            try {
                doImportData(assetImportLogDetailDto);
                updateImportLogDetailState(assetImportLogDetailDto.getDetailId());
            } catch (Exception e) {
                e.printStackTrace();
                updateImportLogDetailState(assetImportLogDetailDto.getDetailId(), e);
            }
        }
    }
@@ -207,7 +212,7 @@
     * @param importRoomFee
     * @param batchId
     */
    private void doImportContractFee(ImportRoomFee importRoomFee, String batchId) {
    public void doImportContractFee(ImportRoomFee importRoomFee, String batchId) {
        if (!FeeDto.PAYER_OBJ_TYPE_CAR.equals(importRoomFee.getObjType())) {
            return;
        }
service-job/src/main/resources/templates/fee_reminder_template.docx
Binary files differ