java110 лет назад: 3
Родитель
Сommit
713f9ea8e9

+ 18 - 0
java110-db/src/main/resources/mapper/report/ReportCommunityServiceDaoImplMapper.xml

@@ -179,6 +179,24 @@
 
     </select>
 
+    <!-- 查询无效费用 add by wuxw 2018-07-03 -->
+    <select id="queryInvalidFeeMonthStatistics" parameterType="Map" resultType="Map">
+        select t.fee_id feeId from pay_fee t
+        inner join pay_fee_config pfc on t.config_id = pfc.config_id
+        inner join report_fee_year_collection rfyc on t.fee_id = rfyc.fee_id and rfyc.status_cd = '0'
+        where (t.status_cd = '1' or pfc.status_cd = '1')
+        and t.community_id= #{communityId}
+    </select>
+
+    <!--清理报表 无效数据-->
+    <update id="deleteInvalidFee" parameterType="Map">
+        delete from report_fee_year_collection where fee_id  in
+        <foreach collection="feeIds" item="item" open="(" close=")" separator=",">
+            #{item}
+        </foreach>
+        and community_id = #{communityId}
+    </update>
+
 
 
 

+ 10 - 0
service-report/src/main/java/com/java110/report/dao/IReportCommunityServiceDao.java

@@ -69,4 +69,14 @@ public interface IReportCommunityServiceDao {
      * @return
      */
     List<Map> queryCarStructures(Map info);
+
+    int deleteInvalidFee(Map info);
+
+    /**
+     * 查询无效的数据
+     * @param reportFeeDto
+     * @return
+     */
+    List<Map> queryInvalidFeeMonthStatistics(Map reportFeeDto);
+
 }

+ 17 - 0
service-report/src/main/java/com/java110/report/dao/impl/ReportCommunityServiceDaoImpl.java

@@ -100,4 +100,21 @@ public class ReportCommunityServiceDaoImpl extends BaseServiceDao implements IRe
 
         return communityDtos;
     }
+
+    public int deleteInvalidFee(Map info){
+        logger.debug("deleteInvalidFee 入参 info : {}", info);
+
+        int saveFlag = sqlSessionTemplate.update("reportCommunityServiceDaoImpl.deleteInvalidFee", info);
+
+        return saveFlag;
+    }
+
+    @Override
+    public List<Map> queryInvalidFeeMonthStatistics(Map info) {
+        logger.debug("查询押金退费总金额信息 入参 info : {}", info);
+
+        List<Map> deposits = sqlSessionTemplate.selectList("reportCommunityServiceDaoImpl.queryInvalidFeeMonthStatistics", info);
+
+        return deposits;
+    }
 }

+ 29 - 2
service-report/src/main/java/com/java110/report/smo/impl/GeneratorFeeYearStatisticsInnerServiceSMOImpl.java

@@ -31,8 +31,7 @@ import org.springframework.web.bind.annotation.RestController;
 
 import java.math.BigDecimal;
 import java.text.ParseException;
-import java.util.Calendar;
-import java.util.List;
+import java.util.*;
 
 /**
  * @ClassName GeneratorFeeMonthStatisticsInnerServiceSMOImpl
@@ -84,6 +83,9 @@ public class GeneratorFeeYearStatisticsInnerServiceSMOImpl implements IGenerator
 
         Assert.hasLength(communityId, "未包含小区信息");
 
+        //这里处理 报表中的费用是否被人为 取消 或者费用项是否被删除,这种数据 报表中做清理,以防影响 报表的准确度
+        feeDataFiltering(communityId);
+
         //处理房屋费用
         dealRoomFee(reportFeeMonthStatisticsPo);
 
@@ -92,6 +94,31 @@ public class GeneratorFeeYearStatisticsInnerServiceSMOImpl implements IGenerator
 
     }
 
+    private void feeDataFiltering(String communityId) {
+        Map reportFeeDto = new HashMap();
+        reportFeeDto.put("communityId", communityId);
+        List<Map> feeDtos = reportCommunityServiceDaoImpl.queryInvalidFeeMonthStatistics(reportFeeDto);
+
+        List<String> feeIds = new ArrayList<>();
+        for (Map feeDto : feeDtos) {
+            if (!feeDto.containsKey("feeId") || StringUtil.isNullOrNone(feeDto.get("feeId"))) {
+                continue;
+            }
+
+            feeIds.add(feeDto.get("feeId").toString());
+
+            if (feeIds.size() >= 50) {
+                reportFeeDto.put("feeIds", feeIds);
+                reportCommunityServiceDaoImpl.deleteInvalidFee(reportFeeDto);
+                feeIds = new ArrayList<>();
+            }
+        }
+        reportFeeDto.put("feeIds", feeIds);
+        if (feeIds.size() > 0) {
+            reportCommunityServiceDaoImpl.deleteInvalidFee(reportFeeDto);
+        }
+    }
+
 
     /**
      * 处理车位 车辆费用