Your Name пре 2 година
родитељ
комит
38311f6e26

+ 13 - 1
java110-bean/src/main/java/com/java110/dto/report/QueryStatisticsDto.java

@@ -1,8 +1,10 @@
 package com.java110.dto.report;
 
+import com.java110.dto.PageDto;
+
 import java.io.Serializable;
 
-public class QueryStatisticsDto implements Serializable {
+public class QueryStatisticsDto extends PageDto implements Serializable {
 
     private String communityId;
     private String startDate;
@@ -26,6 +28,8 @@ public class QueryStatisticsDto implements Serializable {
 
     private String feeTypeCd;
 
+    private String[] unitIds;
+
 
     public String getCommunityId() {
         return communityId;
@@ -107,4 +111,12 @@ public class QueryStatisticsDto implements Serializable {
     public void setFeeTypeCd(String feeTypeCd) {
         this.feeTypeCd = feeTypeCd;
     }
+
+    public String[] getUnitIds() {
+        return unitIds;
+    }
+
+    public void setUnitIds(String[] unitIds) {
+        this.unitIds = unitIds;
+    }
 }

+ 85 - 0
java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml

@@ -658,5 +658,90 @@
         and a.table_columns = 'fee_type_cd'
     </select>
 
+    <select id="getObjFeeSummaryCount" parameterType="Map" resultType="Map">
+        select count(1) feeRoomCount
+        from
+        (
+        select a.obj_name objName,a.obj_id objId,a.owner_name ownerName,a.link
+        from pay_fee_detail_month a
+        where a.status_cd = '0'
+        and a.community_id = '2023013154290059'
+        group by a.obj_name,a.obj_id,a.owner_name,a.link
+        ) b
+    </select>
+
+    <select id="getObjFeeSummary" parameterType="Map" resultType="Map">
+        select a.obj_name objName,a.obj_id objId,a.owner_name ownerName,a.link,
+        (
+        select ifnull(sum(t.receivable_amount - t.received_amount - t.discount_amount),0.0) hisOweFee
+        from pay_fee_detail_month t
+        INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
+        where t.obj_id = a.obj_id
+        and t.status_cd = '0'
+        and t.community_id= a.community_id
+        and t.cur_month_time &lt; #{startDate}
+        ) hisOweFee, -- 历史欠费
+        (
+        select ifnull(sum(t.receivable_amount - t.received_amount - t.discount_amount),0.0) curOweFee
+        from pay_fee_detail_month t
+        INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
+        where t.obj_id = a.obj_id
+        and t.status_cd = '0'
+        and t.community_id= a.community_id
+        and t.cur_month_time &gt; #{startDate}
+        and t.cur_month_time &lt; #{endDate}
+        ) curOweFee, -- 当期欠费
+        (
+        select ifnull(sum(t.receivable_amount),0.0) curReceivableFee
+        from pay_fee_detail_month t
+        INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
+        where t.obj_id = a.obj_id
+        and t.status_cd = '0'
+        and t.community_id= a.community_id
+        and t.cur_month_time &gt; #{startDate}
+        and t.cur_month_time &lt; #{endDate}
+        ) curReceivableFee, -- 当月应收
+        (
+        select ifnull(sum(t.received_amount),0.0) hisReceivedFee
+        from pay_fee_detail_month t
+        INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
+        where t.obj_id = a.obj_id
+        and t.status_cd = '0'
+        and t.community_id= a.community_id
+        and t.pay_fee_time &gt; #{startDate}
+        and t.pay_fee_time &lt; #{endDate}
+        and t.cur_month_time &lt; #{startDate}
+        ) hisReceivedFee, -- 欠费追回
+        (
+        select ifnull(sum(t.received_amount),0.0) preReceivedFee
+        from pay_fee_detail_month t
+        INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
+        where t.obj_id = a.obj_id
+        and t.status_cd = '0'
+        and t.community_id= a.community_id
+        and t.pay_fee_time &gt; #{startDate}
+        and t.pay_fee_time &lt; #{endDate}
+        and t.cur_month_time &gt; #{endDate}
+        ) preReceivedFee, -- 预交费用
+        (
+        select ifnull(sum(t.received_amount),0.0) receivedFee
+        from pay_fee_detail_month t
+        INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
+        where t.obj_id = a.obj_id
+        and t.status_cd = '0'
+        and t.community_id= a.community_id
+        and t.pay_fee_time &gt; #{startDate}
+        and t.pay_fee_time &lt; #{endDate}
+        ) receivedFee -- 实收费用
+        from pay_fee_detail_month a
+        where a.status_cd = '0'
+        and a.community_id = #{communityId}
+        group by a.obj_name,a.obj_id,a.owner_name,a.link
+        order by  a.obj_name
+        <if test="page != -1 and page != null ">
+            limit #{page}, #{row}
+        </if>
+    </select>
+
 
 </mapper>

+ 6 - 0
java110-interface/src/main/java/com/java110/intf/report/IReportFeeStatisticsInnerServiceSMO.java

@@ -97,4 +97,10 @@ public interface IReportFeeStatisticsInnerServiceSMO {
      */
     @RequestMapping(value = "/getConfigFeeSummary", method = RequestMethod.POST)
     List<Map> getConfigFeeSummary(@RequestBody QueryStatisticsDto queryStatisticsDto);
+
+    @RequestMapping(value = "/getObjFeeSummaryCount", method = RequestMethod.POST)
+    int getObjFeeSummaryCount(@RequestBody QueryStatisticsDto queryStatisticsDto);
+
+    @RequestMapping(value = "/getObjFeeSummary", method = RequestMethod.POST)
+    List<Map> getObjFeeSummary(@RequestBody QueryStatisticsDto queryStatisticsDto);
 }

+ 18 - 18
service-job/src/main/java/com/java110/job/task/fee/CorrectionDataTemplate.java

@@ -142,7 +142,7 @@ public class CorrectionDataTemplate extends TaskSystemQuartz {
         double record = Math.ceil(count / DEFAULT_ROW);
 
         for (int page = 1; page <= record; page++) {
-            try {
+            //try {
                 feeDto.setPage(page);
                 feeDto.setRow(new Double(DEFAULT_ROW).intValue());
                 List<FeeDto> feeDtos = feeInnerServiceSMOImpl.queryFees(feeDto);
@@ -151,25 +151,25 @@ public class CorrectionDataTemplate extends TaskSystemQuartz {
                     continue;
                 }
                 for (FeeDto tmpFeeDto : feeDtos) {
-                    try {
+                    //try {
                         correctionData(tmpFeeDto, feeConfigDto);
-                    } catch (Exception e) {
-                        LogSystemErrorPo logSystemErrorPo = new LogSystemErrorPo();
-                        logSystemErrorPo.setErrId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_errId));
-                        logSystemErrorPo.setErrType(LogSystemErrorDto.ERR_TYPE_JOB);
-                        logSystemErrorPo.setMsg(ExceptionUtil.getStackTrace(e));
-                        saveSystemErrorSMOImpl.saveLog(logSystemErrorPo);
-                        logger.error("矫正数据出错", e);
-                    }
+//                    } catch (Exception e) {
+//                        LogSystemErrorPo logSystemErrorPo = new LogSystemErrorPo();
+//                        logSystemErrorPo.setErrId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_errId));
+//                        logSystemErrorPo.setErrType(LogSystemErrorDto.ERR_TYPE_JOB);
+//                        logSystemErrorPo.setMsg(ExceptionUtil.getStackTrace(e));
+//                        saveSystemErrorSMOImpl.saveLog(logSystemErrorPo);
+//                        logger.error("矫正数据出错", e);
+//                    }
                 }
-            } catch (Exception e) {
-                LogSystemErrorPo logSystemErrorPo = new LogSystemErrorPo();
-                logSystemErrorPo.setErrId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_errId));
-                logSystemErrorPo.setErrType(LogSystemErrorDto.ERR_TYPE_JOB);
-                logSystemErrorPo.setMsg(ExceptionUtil.getStackTrace(e));
-                saveSystemErrorSMOImpl.saveLog(logSystemErrorPo);
-                logger.error("矫正数据出错" + feeConfigDto.getConfigId(), e);
-            }
+//            } catch (Exception e) {
+//                LogSystemErrorPo logSystemErrorPo = new LogSystemErrorPo();
+//                logSystemErrorPo.setErrId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_errId));
+//                logSystemErrorPo.setErrType(LogSystemErrorDto.ERR_TYPE_JOB);
+//                logSystemErrorPo.setMsg(ExceptionUtil.getStackTrace(e));
+//                saveSystemErrorSMOImpl.saveLog(logSystemErrorPo);
+//                logger.error("矫正数据出错" + feeConfigDto.getConfigId(), e);
+//            }
         }
 
     }

+ 3 - 0
service-report/src/main/java/com/java110/report/cmd/reportFeeMonthStatistics/QueryReportFeeSummaryCmd.java

@@ -79,6 +79,9 @@ public class QueryReportFeeSummaryCmd extends Cmd {
         queryStatisticsDto.setFloorId(reqJson.getString("floorId"));
         queryStatisticsDto.setObjName(reqJson.getString("objName"));
         queryStatisticsDto.setFeeTypeCd(reqJson.getString("feeTypeCd"));
+        queryStatisticsDto.setOwnerName(reqJson.getString("ownerName"));
+        queryStatisticsDto.setLink(reqJson.getString("link"));
+
         if(reqJson.containsKey("configIds")){
             queryStatisticsDto.setConfigIds(reqJson.getString("configIds").split(","));
         }

+ 29 - 18
service-report/src/main/java/com/java110/report/cmd/reportFeeMonthStatistics/QueryReportFeeSummaryDetailCmd.java

@@ -6,9 +6,11 @@ import com.java110.core.context.ICmdDataFlowContext;
 import com.java110.core.event.cmd.Cmd;
 import com.java110.core.event.cmd.CmdEvent;
 import com.java110.dto.data.DataPrivilegeStaffDto;
+import com.java110.dto.report.QueryStatisticsDto;
 import com.java110.dto.reportFeeMonthStatistics.ReportFeeMonthStatisticsDto;
 import com.java110.intf.community.IDataPrivilegeUnitV1InnerServiceSMO;
 import com.java110.intf.report.IReportFeeMonthStatisticsInnerServiceSMO;
+import com.java110.report.statistics.IFeeStatistics;
 import com.java110.utils.exception.CmdException;
 import com.java110.utils.util.Assert;
 import com.java110.utils.util.BeanConvertUtil;
@@ -20,57 +22,66 @@ import org.springframework.http.ResponseEntity;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
 
 /**
  * 费用汇总明细
  */
-@Java110Cmd(serviceCode = "/reportFeeMonthStatistics/queryReportFeeSummaryDetail")
+@Java110Cmd(serviceCode = "/reportFeeMonthStatistics.queryReportFeeSummaryDetail")
 public class QueryReportFeeSummaryDetailCmd extends Cmd {
 
     @Autowired
-    private IReportFeeMonthStatisticsInnerServiceSMO reportFeeMonthStatisticsInnerServiceSMOImpl;
+    private IFeeStatistics feeStatisticsImpl;
 
     @Autowired
     private IDataPrivilegeUnitV1InnerServiceSMO dataPrivilegeUnitV1InnerServiceSMOImpl;
 
     @Override
     public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException {
-        Assert.hasKeyAndValue(reqJson, "communityId", "未传入小区信息");
-        Assert.hasKeyAndValue(reqJson, "feeYear", "未传入年份");
-        Assert.hasKeyAndValue(reqJson, "feeMonth", "未传入月份");
         super.validatePageInfo(reqJson);
+        Assert.hasKeyAndValue(reqJson, "startDate", "未包含开始日期");
+        Assert.hasKeyAndValue(reqJson, "endDate", "未包含结束日期");
+        Assert.hasKeyAndValue(reqJson, "communityId", "未包含小区信息");
     }
 
     @Override
     public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException {
-        String[] configIds = null;
-        if (reqJson.containsKey("configIds") && !StringUtil.isEmpty(reqJson.getString("configIds"))) {
-            configIds = reqJson.getString("configIds").split(",");
-            reqJson.remove("configIds");
+        QueryStatisticsDto queryStatisticsDto = new QueryStatisticsDto();
+        queryStatisticsDto.setCommunityId(reqJson.getString("communityId"));
+        queryStatisticsDto.setStartDate(reqJson.getString("startDate"));
+        queryStatisticsDto.setEndDate(reqJson.getString("endDate"));
+        queryStatisticsDto.setConfigId(reqJson.getString("configId"));
+        queryStatisticsDto.setFloorId(reqJson.getString("floorId"));
+        queryStatisticsDto.setObjName(reqJson.getString("objName"));
+        queryStatisticsDto.setFeeTypeCd(reqJson.getString("feeTypeCd"));
+        queryStatisticsDto.setOwnerName(reqJson.getString("ownerName"));
+        queryStatisticsDto.setLink(reqJson.getString("link"));
+        queryStatisticsDto.setPage(reqJson.getIntValue("page"));
+        queryStatisticsDto.setRow(reqJson.getIntValue("row"));
+        if (reqJson.containsKey("configIds")) {
+            queryStatisticsDto.setConfigIds(reqJson.getString("configIds").split(","));
         }
-        ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto = BeanConvertUtil.covertBean(reqJson, ReportFeeMonthStatisticsDto.class);
-        reportFeeMonthStatisticsDto.setConfigIds(configIds);
 
         String staffId = context.getReqHeaders().get("user-id");
         DataPrivilegeStaffDto dataPrivilegeStaffDto = new DataPrivilegeStaffDto();
         dataPrivilegeStaffDto.setStaffId(staffId);
         String[] unitIds = dataPrivilegeUnitV1InnerServiceSMOImpl.queryDataPrivilegeUnitsByStaff(dataPrivilegeStaffDto);
 
-        if(unitIds != null && unitIds.length>0){
-            reportFeeMonthStatisticsDto.setUnitIds(unitIds);
+        if (unitIds != null && unitIds.length > 0) {
+            queryStatisticsDto.setUnitIds(unitIds);
         }
 
 
-        int count = reportFeeMonthStatisticsInnerServiceSMOImpl.queryReportFeeSummaryDetailCount(reportFeeMonthStatisticsDto);
+        int count = feeStatisticsImpl.getObjFeeSummaryCount(queryStatisticsDto);
 
-        List<ReportFeeMonthStatisticsDto> reportFeeMonthStatisticsDtos = null;
+        List<Map> datas = null;
         if (count > 0) {
-            reportFeeMonthStatisticsDtos = reportFeeMonthStatisticsInnerServiceSMOImpl.queryReportFeeSummaryDetail(reportFeeMonthStatisticsDto);
+            datas = feeStatisticsImpl.getObjFeeSummary(queryStatisticsDto);
         } else {
-            reportFeeMonthStatisticsDtos = new ArrayList<>();
+            datas = new ArrayList<>();
         }
 
-        ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (double) reportFeeMonthStatisticsDto.getRow()), count, reportFeeMonthStatisticsDtos);
+        ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (double) queryStatisticsDto.getRow()), count, datas);
 
         ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
 

+ 14 - 0
service-report/src/main/java/com/java110/report/dao/IReportFeeStatisticsServiceDao.java

@@ -81,4 +81,18 @@ public interface IReportFeeStatisticsServiceDao {
      * @return
      */
     List<Map> getConfigFeeSummary(Map info);
+
+    /**
+     * 查询费用明细表(总数)
+     * @param info
+     * @return
+     */
+    int getObjFeeSummaryCount(Map info);
+
+    /**
+     * 查询费用明细表
+     * @param info
+     * @return
+     */
+    List<Map> getObjFeeSummary(Map info);
 }

+ 23 - 0
service-report/src/main/java/com/java110/report/dao/impl/ReportFeeStatisticsServiceDaoImpl.java

@@ -167,5 +167,28 @@ public class ReportFeeStatisticsServiceDaoImpl extends BaseServiceDao implements
         return infos;
     }
 
+    @Override
+    public int getObjFeeSummaryCount(Map info) {
+        logger.debug("查询 收费户数 入参 info : {}", JSONObject.toJSONString(info));
+
+        List<Map> infos = sqlSessionTemplate.selectList("reportFeeStatisticsServiceDaoImpl.getObjFeeSummaryCount", info);
+
+        if (infos == null || infos.size() < 1) {
+            return 0;
+        }
+
+        return Integer.parseInt(infos.get(0).get("total").toString());
+    }
+
+    @Override
+    public List<Map> getObjFeeSummary(Map info) {
+        logger.debug("查询 费用项收费率 入参 info : {}", JSONObject.toJSONString(info));
+
+        List<Map> infos = sqlSessionTemplate.selectList("reportFeeStatisticsServiceDaoImpl.getObjFeeSummary", info);
+
+
+        return infos;
+    }
+
 
 }

+ 23 - 2
service-report/src/main/java/com/java110/report/smo/impl/ReportFeeStatisticsInnerServiceSMOImpl.java

@@ -2,6 +2,7 @@ package com.java110.report.smo.impl;
 
 
 import com.java110.core.base.smo.BaseServiceSMO;
+import com.java110.dto.PageDto;
 import com.java110.dto.report.QueryStatisticsDto;
 import com.java110.intf.report.IReportFeeStatisticsInnerServiceSMO;
 import com.java110.report.dao.IReportFeeStatisticsServiceDao;
@@ -106,7 +107,7 @@ public class ReportFeeStatisticsInnerServiceSMOImpl extends BaseServiceSMO imple
      * @return
      */
     @Override
-    public List<Map> getFloorFeeSummary(QueryStatisticsDto queryStatisticsDto) {
+    public List<Map> getFloorFeeSummary(@RequestBody QueryStatisticsDto queryStatisticsDto) {
 
         List<Map> info = reportFeeStatisticsServiceDaoImpl.getFloorFeeSummary(BeanConvertUtil.beanCovertMap(queryStatisticsDto));
         return info;
@@ -119,9 +120,29 @@ public class ReportFeeStatisticsInnerServiceSMOImpl extends BaseServiceSMO imple
      * @return
      */
     @Override
-    public List<Map> getConfigFeeSummary(QueryStatisticsDto queryStatisticsDto) {
+    public List<Map> getConfigFeeSummary(@RequestBody QueryStatisticsDto queryStatisticsDto) {
 
         List<Map> info = reportFeeStatisticsServiceDaoImpl.getConfigFeeSummary(BeanConvertUtil.beanCovertMap(queryStatisticsDto));
         return info;
     }
+
+    @Override
+    public int getObjFeeSummaryCount(@RequestBody QueryStatisticsDto queryStatisticsDto) {
+        int info = reportFeeStatisticsServiceDaoImpl.getObjFeeSummaryCount(BeanConvertUtil.beanCovertMap(queryStatisticsDto));
+        return info;
+    }
+
+    @Override
+    public List<Map> getObjFeeSummary(@RequestBody QueryStatisticsDto queryStatisticsDto) {
+        //校验是否传了 分页信息
+
+        int page = queryStatisticsDto.getPage();
+
+        if (page != PageDto.DEFAULT_PAGE) {
+            queryStatisticsDto.setPage((page - 1) * queryStatisticsDto.getRow());
+        }
+
+        List<Map> info = reportFeeStatisticsServiceDaoImpl.getObjFeeSummary(BeanConvertUtil.beanCovertMap(queryStatisticsDto));
+        return info;
+    }
 }

+ 14 - 0
service-report/src/main/java/com/java110/report/statistics/IFeeStatistics.java

@@ -81,4 +81,18 @@ public interface IFeeStatistics {
      * @return
      */
     List<Map> getConfigFeeSummary(QueryStatisticsDto queryStatisticsDto);
+
+    /**
+     * 查询对象明细表(数量)
+     * @param queryStatisticsDto
+     * @return
+     */
+    int getObjFeeSummaryCount(QueryStatisticsDto queryStatisticsDto);
+
+    /**
+     * 查询对象明细表
+     * @param queryStatisticsDto
+     * @return
+     */
+    List<Map> getObjFeeSummary(QueryStatisticsDto queryStatisticsDto);
 }

+ 10 - 0
service-report/src/main/java/com/java110/report/statistics/impl/FeeStatisticsImpl.java

@@ -113,4 +113,14 @@ public class FeeStatisticsImpl implements IFeeStatistics {
         return reportFeeStatisticsInnerServiceSMOImpl.getConfigFeeSummary(queryStatisticsDto);
     }
 
+    @Override
+    public int getObjFeeSummaryCount(QueryStatisticsDto queryStatisticsDto) {
+        return reportFeeStatisticsInnerServiceSMOImpl.getObjFeeSummaryCount(queryStatisticsDto);
+    }
+
+    @Override
+    public List<Map> getObjFeeSummary(QueryStatisticsDto queryStatisticsDto) {
+        return reportFeeStatisticsInnerServiceSMOImpl.getObjFeeSummary(queryStatisticsDto);
+    }
+
 }