chengf
2025-08-20 aab1ad64e309fa904cc9cbeba4d76b533a5b6c71
service-fee/src/main/java/com/java110/fee/cmd/fee/ReportFeeCmd.java
@@ -8,12 +8,14 @@
import com.java110.dto.community.CommunityDto;
import com.java110.dto.dict.DictDto;
import com.java110.dto.fee.FeeDto;
import com.java110.dto.report.ReportQueryRecord;
import com.java110.intf.community.ICommunityInnerServiceSMO;
import com.java110.intf.dev.IDictV1InnerServiceSMO;
import com.java110.intf.fee.IReportFeeInnerServiceSMO;
import com.java110.po.fee.PayFeePo;
import com.java110.utils.exception.CmdException;
import com.java110.utils.util.Assert;
import com.java110.utils.util.BeanConvertUtil;
import com.java110.vo.FeeQueryParams;
import com.java110.vo.ResultVo;
import org.springframework.beans.factory.annotation.Autowired;
@@ -53,25 +55,72 @@
        int currentYear = java.time.Year.now().getValue();
        feeQueryParams.setEndYear(currentYear + 2);
        int endYear = feeQueryParams.getEndYear();
        List<Map> result = reportFeeInnerServiceSMOImpl.repostPaidInFee(feeQueryParams);
        DictDto dictDto = new DictDto();
        dictDto.setTableName("pay_fee_config");
        dictDto.setTableColumns("fee_type_cd");
        List<DictDto> dictDtos = dictV1InnerServiceSMOImpl.queryDicts(dictDto);
        int doYear = endYear - startYear;
        ReportQueryRecord reportQueryRecord = new ReportQueryRecord();
        reportQueryRecord.setCommunityId(reqJson.getString("communityId"));
        reportQueryRecord.setQueryStatus("0");
        reportQueryRecord.setEndYear(currentYear+"");
        List<ReportQueryRecord> reportQueryRecords = reportFeeInnerServiceSMOImpl.queryReport(BeanConvertUtil.beanCovertMap(reportQueryRecord));
        if(reportQueryRecords.size()>0){
        }
        List<List<FeeDto>> reportFeeDtoLists = new LinkedList<>();
        reportFeeDtoLists.add(new LinkedList<FeeDto>());
        reportFeeDtoLists.add(new LinkedList<FeeDto>());
        reportFeeDtoLists.add(new LinkedList<FeeDto>());
        reportFeeDtoLists.add(new LinkedList<FeeDto>());
        int ind = 1;
        queryFee(reportFeeDtoLists ,reqJson);
        int[] arr = new int[endYear - startYear + 1];
        for (int i = startYear; i <= endYear; i++) {
            arr[i-startYear] = i;
        }
        FeeDto feeDto = new FeeDto();
        feeDto.setRepostList(reportFeeDtoLists);
        feeDto.setYearArr(arr);
        feeDto.setLength(doYear - 1 + 20);
        reportQueryRecord.setCommunityId(reqJson.getString("communityId"));
        reportQueryRecord.setQueryStatus("0");
        reportQueryRecord.setEndYear(currentYear+"");
        reportQueryRecord.setReportContent(JSONObject.toJSONString(feeDto));
        int i = reportFeeInnerServiceSMOImpl.saveReport(BeanConvertUtil.beanCovertMap(reportQueryRecord));
        ResultVo resultVo = new ResultVo(feeDto);
        ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
        context.setResponseEntity(responseEntity);
    }
    public void queryFee(List<List<FeeDto>> reportFeeDtoLists, JSONObject reqJson) {
        int startYear = 2020;
        CommunityDto communityDto = new CommunityDto();
        communityDto.setCommunityId(reqJson.getString("communityId"));
        List<CommunityDto> communityDtos = communityInnerServiceSMOImpl.queryCommunitys(communityDto);
        FeeQueryParams feeQueryParams = new FeeQueryParams();
        feeQueryParams.setCommunityId(reqJson.getString("communityId"));
        feeQueryParams.setStartYear(startYear);
        int currentYear = java.time.Year.now().getValue();
        feeQueryParams.setEndYear(currentYear + 2);
        int endYear = feeQueryParams.getEndYear();
        reportFeeDtoLists.add(new LinkedList<FeeDto>());
        reportFeeDtoLists.add(new LinkedList<FeeDto>());
        reportFeeDtoLists.add(new LinkedList<FeeDto>());
        reportFeeDtoLists.add(new LinkedList<FeeDto>());
        int ind = 1;
        int doYear = endYear - startYear;
        int[] arr = new int[endYear - startYear + 1];
        for (int i = startYear; i <= endYear; i++) {
            arr[i-startYear] = i;
        }
        List<Map> result = reportFeeInnerServiceSMOImpl.repostPaidInFee(feeQueryParams);
        DictDto dictDto = new DictDto();
        dictDto.setTableName("pay_fee_config");
        dictDto.setTableColumns("fee_type_cd");
        List<DictDto> dictDtos = dictV1InnerServiceSMOImpl.queryDicts(dictDto);
        for (DictDto dictDto1 : dictDtos) {//类型
            List<FeeDto> reportFeeDtos = new LinkedList<>();//该类型的数组
            FeeDto feeDto = new FeeDto();
@@ -83,7 +132,7 @@
                    doubles[0] = ((BigDecimal) map.get("该年应缴总额")).doubleValue();
                    doubles[1] = ((BigDecimal) map.get("每月费用")).doubleValue();
                    doubles[2] = ((Long) map.get("应收月份数")).doubleValue();
                    doubles[3] = ((BigDecimal) map.get("当年收缴率(%)")).doubleValue();
                    doubles[3] = ((BigDecimal) map.get("当年收缴率")).doubleValue();
                    doubles[4] = ((BigDecimal) map.get("折扣金额")).doubleValue();
                    int inde = 0;
                    for (int i : arr){
@@ -98,7 +147,7 @@
                    doubles[inde + 8] =((BigDecimal) map.get("当年欠款")).doubleValue();
                    for (int i = 1 ; i <= 12 ; i++){
                        doubles[inde + 8 + i] =((BigDecimal) map.get("当年"+i+"月实缴")).doubleValue();
                        doubles[inde + 8 + i] =((BigDecimal) map.get("当年"+(i < 10 ? "0"+i : i) +"月实缴")).doubleValue();
                    }
                    feeDto.setCurYear(dictDto1.getName()+"总计");
                    feeDto.setReport(doubles);
@@ -129,7 +178,7 @@
                        doubles[0] = ((BigDecimal) map.get("该年应缴总额")).doubleValue();
                        doubles[1] = ((BigDecimal) map.get("每月费用")).doubleValue();
                        doubles[2] = ((Long) map.get("应收月份数")).doubleValue();
                        doubles[3] = ((BigDecimal) map.get("当年收缴率(%)")).doubleValue();
                        doubles[3] = ((BigDecimal) map.get("当年收缴率")).doubleValue();
                        doubles[4] = ((BigDecimal) map.get("折扣金额")).doubleValue();
                        int inde = 0;
                        for (int in : arr){
@@ -144,7 +193,7 @@
                        doubles[inde + 8] =((BigDecimal) map.get("当年欠款")).doubleValue();
                        for (int in = 1 ; in <= 12 ; in++){
                            doubles[inde + 8 + in] =((BigDecimal) map.get("当年"+in+"月实缴")).doubleValue();
                            doubles[inde + 8 + in] =((BigDecimal) map.get("当年"+(in < 10 ? "0"+in : in) +"月实缴")).doubleValue();
                        }
                        feeDto = new FeeDto();
                        feeDto.setFeeTypeCdName(dictDto1.getName());
@@ -195,15 +244,5 @@
            }
            ind ++;
        }
        FeeDto feeDto = new FeeDto();
        feeDto.setRepostList(reportFeeDtoLists);
        feeDto.setYearArr(arr);
        feeDto.setLength(String.valueOf(doYear+12+1+5+4));
        ResultVo resultVo = new ResultVo(feeDto);
        ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
        context.setResponseEntity(responseEntity);
    }
}