java110 5 éve%!(EXTRA string=óta)
szülő
commit
e40ab64cca

+ 1 - 0
java110-core/src/main/java/com/java110/core/smo/IComputeFeeSMO.java

@@ -138,5 +138,6 @@ public interface IComputeFeeSMO {
     double getReportFeePrice(ReportFeeDto tmpReportFeeDto, ReportRoomDto reportRoomDto, ReportCarDto reportCarDto);
 
     void computeEveryOweFee(FeeDto tmpFeeDto);
+
     void computeEveryOweFee(FeeDto tmpFeeDto, RoomDto roomDto);
 }

+ 83 - 0
java110-db/src/main/resources/mapper/report/ReportFeeServiceDaoImplMapper.xml

@@ -95,5 +95,88 @@
         </if>
     </select>
 
+    <!-- 查询费用配置信息 add by wuxw 2018-07-03 -->
+    <select id="getFeeConfigs" parameterType="com.java110.dto.fee.FeeConfigDto"
+            resultType="com.java110.dto.fee.FeeConfigDto">
+        select t.fee_type_cd,t.fee_type_cd feeTypeCd,t.computing_formula,t.computing_formula
+        computingFormula,t.additional_amount,t.additional_amount additionalAmount,t.status_cd,t.status_cd
+        statusCd,t.square_price,t.square_price squarePrice,t.is_default,t.is_default isDefault,t.config_id,t.config_id
+        configId,t.fee_flag,t.fee_flag feeFlag,t.fee_name,t.fee_name feeName,t.start_time,t.start_time
+        startTime,t.end_time,t.end_time endTime,t.community_id,t.community_id communityId,t.b_id,t.b_id bId,
+        td1.name feeTypeCdName,td2.name feeFlagName,t.bill_type billType,t.bill_type,td3.name billTypeName,
+        t.payment_cd,t.payment_cycle,t.payment_cd paymentCd,t.payment_cycle paymentCycle,
+        t.computing_formula_text,t.computing_formula_text computingFormulaText
+        from pay_fee_config t,t_dict td1,t_dict td2,t_dict td3
+        where 1 =1
+        and t.fee_type_cd = td1.status_cd
+        and td1.table_name = 'pay_fee_config'
+        and td1.table_columns = 'fee_type_cd'
+        and t.fee_flag = td2.status_cd
+        and td2.table_name = 'pay_fee_config'
+        and td2.table_columns = 'fee_flag'
+        and t.bill_type = td3.status_cd
+        and td3.table_name = 'pay_fee_config'
+        and td3.table_columns = 'bill_type'
+        <if test="feeTypeCd !=null and feeTypeCd != ''">
+            and t.fee_type_cd= #{feeTypeCd}
+        </if>
+        <if test="computingFormula !=null and computingFormula != ''">
+            and t.computing_formula= #{computingFormula}
+        </if>
+        <if test="additionalAmount !=null and additionalAmount != ''">
+            and t.additional_amount= #{additionalAmount}
+        </if>
+        <if test="statusCd !=null and statusCd != ''">
+            and t.status_cd= #{statusCd}
+        </if>
+        <if test="squarePrice !=null and squarePrice != ''">
+            and t.square_price= #{squarePrice}
+        </if>
+        <if test="isDefault !=null and isDefault != ''">
+            and t.is_default= #{isDefault}
+        </if>
+        <if test="configId !=null and configId != ''">
+            and t.config_id= #{configId}
+        </if>
+        <if test="feeFlag !=null and feeFlag != ''">
+            and t.fee_flag= #{feeFlag}
+        </if>
+        <if test="feeName !=null and feeName != ''">
+            and t.fee_name like '%${feeName}%'
+        </if>
+        <if test="startTime !=null ">
+            and t.start_time= #{startTime}
+        </if>
+        <if test="endTime !=null ">
+            and t.end_time= #{endTime}
+        </if>
+        <if test="valid !=null and valid == 1">
+            and t.end_time &gt; now()
+        </if>
+        <if test="curTime !=null ">
+            and t.end_time &gt; #{curTime}
+            and t.start_time &lt; #{curTime}
+        </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
+        <if test="bId !=null and bId != ''">
+            and t.b_id= #{bId}
+        </if>
+        <if test="paymentCd !=null and paymentCd != ''">
+            and t.payment_cd= #{paymentCd}
+        </if>
+        <if test="paymentCycle !=null and paymentCycle != ''">
+            and t.payment_cycle= #{paymentCycle}
+        </if>
+        <if test="billType !=null and billType != ''">
+            and t.bill_type= #{billType}
+        </if>
+        order by t.create_time desc
+        <if test="page != -1 and page != null ">
+            limit #{page}, #{row}
+        </if>
+    </select>
+
 
 </mapper>

+ 27 - 0
java110-interface/src/main/java/com/java110/intf/report/IGeneratorOweFeeInnerServiceSMO.java

@@ -0,0 +1,27 @@
+package com.java110.intf.report;
+
+import com.java110.config.feign.FeignConfiguration;
+import com.java110.po.reportFeeMonthStatistics.ReportFeeMonthStatisticsPo;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+
+/**
+ * @ClassName IGeneratorFeeMonthStatisticsInnerServiceSMO
+ * @Description TODO
+ * @Author wuxw
+ * @Date 2020/10/15 21:51
+ * @Version 1.0
+ * add by wuxw 2020/10/15
+ **/
+@FeignClient(name = "report-service", configuration = {FeignConfiguration.class})
+@RequestMapping("/generatorOweFeeInnerServiceSMOApi")
+public interface IGeneratorOweFeeInnerServiceSMO {
+
+
+
+    @RequestMapping(value = "/generatorOweData", method = RequestMethod.POST)
+    public int generatorOweData(@RequestBody ReportFeeMonthStatisticsPo reportFeeMonthStatisticsPo);
+
+}

+ 1 - 1
service-report/src/main/java/com/java110/report/ReportServiceApplicationStart.java

@@ -37,7 +37,7 @@ import java.nio.charset.Charset;
 @EnableDiscoveryClient
 @Java110ListenerDiscovery(listenerPublishClass = BusinessServiceDataFlowEventPublishing.class,
         basePackages = {"com.java110.report.listener"})
-@EnableFeignClients(basePackages = {"com.java110.intf.user","com.java110.intf.order"})
+@EnableFeignClients(basePackages = {"com.java110.intf.user","com.java110.intf.order","com.java110.intf.common"})
 public class ReportServiceApplicationStart {
 
     private static Logger logger = LoggerFactory.getLogger(ReportServiceApplicationStart.class);

+ 7 - 0
service-report/src/main/java/com/java110/report/dao/IReportFeeServiceDao.java

@@ -1,5 +1,6 @@
 package com.java110.report.dao;
 
+import com.java110.dto.fee.FeeConfigDto;
 import com.java110.dto.report.ReportFeeDetailDto;
 import com.java110.dto.report.ReportFeeDto;
 import com.java110.dto.report.ReportRoomDto;
@@ -29,6 +30,12 @@ public interface IReportFeeServiceDao {
      */
     List<ReportFeeDto> getFees(ReportFeeDto reportFeeDto);
 
+    /**
+     * 查询 房屋 楼栋 单元 和 业主 信息
+     * @return
+     */
+    List<FeeConfigDto> getFeeConfigs(FeeConfigDto reportFeeDto);
+
     /**
      * 实收费用查询
      * @param reportFeeDetailDto

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

@@ -2,6 +2,7 @@ package com.java110.report.dao.impl;
 
 import com.alibaba.fastjson.JSONObject;
 import com.java110.core.base.dao.BaseServiceDao;
+import com.java110.dto.fee.FeeConfigDto;
 import com.java110.dto.report.ReportFeeDetailDto;
 import com.java110.dto.report.ReportFeeDto;
 import com.java110.report.dao.IReportFeeServiceDao;
@@ -46,6 +47,15 @@ public class ReportFeeServiceDaoImpl extends BaseServiceDao implements IReportFe
         return roomDtos;
     }
 
+    @Override
+    public List<FeeConfigDto> getFeeConfigs(FeeConfigDto reportFeeDto) {
+        logger.debug("getFeeConfigs 入参 info : {}", JSONObject.toJSONString(reportFeeDto));
+
+        List<FeeConfigDto> feeConfigDtos = sqlSessionTemplate.selectList("reportFeeServiceDaoImpl.getFeeConfigs", reportFeeDto);
+
+        return feeConfigDtos;
+    }
+
     @Override
     public double getFeeReceivedAmount(ReportFeeDetailDto reportFeeDetailDto) {
         logger.debug("查询实收费用 入参 info : {}", JSONObject.toJSONString(reportFeeDetailDto));

+ 205 - 0
service-report/src/main/java/com/java110/report/smo/impl/GeneratorOweFeeInnerServiceSMOImpl.java

@@ -0,0 +1,205 @@
+package com.java110.report.smo.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.core.factory.GenerateCodeFactory;
+import com.java110.core.smo.IComputeFeeSMO;
+import com.java110.dto.RoomDto;
+import com.java110.dto.fee.FeeAttrDto;
+import com.java110.dto.fee.FeeConfigDto;
+import com.java110.dto.fee.FeeDto;
+import com.java110.dto.logSystemError.LogSystemErrorDto;
+import com.java110.dto.report.ReportCarDto;
+import com.java110.dto.report.ReportFeeDetailDto;
+import com.java110.dto.report.ReportFeeDto;
+import com.java110.dto.report.ReportRoomDto;
+import com.java110.dto.reportFeeMonthStatistics.ReportFeeMonthStatisticsDto;
+import com.java110.dto.reportFeeYearCollection.ReportFeeYearCollectionDto;
+import com.java110.dto.reportFeeYearCollectionDetail.ReportFeeYearCollectionDetailDto;
+import com.java110.dto.reportOweFee.ReportOweFeeDto;
+import com.java110.dto.task.TaskDto;
+import com.java110.intf.report.IGeneratorFeeYearStatisticsInnerServiceSMO;
+import com.java110.intf.report.IGeneratorOweFeeInnerServiceSMO;
+import com.java110.intf.user.IOwnerCarInnerServiceSMO;
+import com.java110.po.logSystemError.LogSystemErrorPo;
+import com.java110.po.reportFeeMonthStatistics.ReportFeeMonthStatisticsPo;
+import com.java110.po.reportFeeYearCollection.ReportFeeYearCollectionPo;
+import com.java110.po.reportFeeYearCollectionDetail.ReportFeeYearCollectionDetailPo;
+import com.java110.po.reportOweFee.ReportOweFeePo;
+import com.java110.report.dao.IReportCommunityServiceDao;
+import com.java110.report.dao.IReportFeeServiceDao;
+import com.java110.report.dao.IReportFeeYearCollectionDetailServiceDao;
+import com.java110.report.dao.IReportFeeYearCollectionServiceDao;
+import com.java110.report.dao.IReportOweFeeServiceDao;
+import com.java110.service.smo.ISaveSystemErrorSMO;
+import com.java110.utils.cache.CommonCache;
+import com.java110.utils.util.Assert;
+import com.java110.utils.util.BeanConvertUtil;
+import com.java110.utils.util.DateUtil;
+import com.java110.utils.util.ExceptionUtil;
+import com.java110.utils.util.ListUtil;
+import com.java110.utils.util.StringUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.web.bind.annotation.RequestBody;
+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.Map;
+
+/**
+ * @ClassName GeneratorFeeMonthStatisticsInnerServiceSMOImpl
+ * @Description TODO
+ * @Author wuxw
+ * @Date 2020/10/15 21:53
+ * @Version 1.0
+ * add by wuxw 2020/10/15
+ **/
+@RestController
+public class GeneratorOweFeeInnerServiceSMOImpl implements IGeneratorOweFeeInnerServiceSMO {
+    private static final Logger logger = LoggerFactory.getLogger(GeneratorOweFeeInnerServiceSMOImpl.class);
+
+    //默认 处理房屋数量
+    private static final int DEFAULT_DEAL_ROOM_COUNT = 1000;
+
+    private static final String RECEIVED_TIME = "RECEIVED_TIME";
+    private static final String RECEIVED_TIME_START = "START";
+    private static final String RECEIVED_TIME_END = "END";
+
+    @Autowired
+    private IReportFeeYearCollectionServiceDao reportFeeYearCollectionServiceDaoImpl;
+
+    @Autowired
+    private IReportFeeYearCollectionDetailServiceDao reportFeeYearCollectionDetailServiceDaoImpl;
+
+    @Autowired
+    private IReportCommunityServiceDao reportCommunityServiceDaoImpl;
+
+    @Autowired
+    private IReportFeeServiceDao reportFeeServiceDaoImpl;
+
+    @Autowired
+    private IComputeFeeSMO computeFeeSMOImpl;
+
+    @Autowired
+    private IOwnerCarInnerServiceSMO ownerCarInnerServiceSMOImpl;
+
+    @Autowired
+    private ISaveSystemErrorSMO saveSystemErrorSMOImpl;
+
+    @Autowired
+    private IReportOweFeeServiceDao reportOweFeeServiceDaoImpl;
+
+    @Override
+    public int generatorOweData(@RequestBody ReportFeeMonthStatisticsPo reportFeeMonthStatisticsPo) {
+
+        doGeneratorData(reportFeeMonthStatisticsPo);
+        return 0;
+    }
+
+    @Async
+    private void doGeneratorData(ReportFeeMonthStatisticsPo reportFeeMonthStatisticsPo) {
+        String communityId = reportFeeMonthStatisticsPo.getCommunityId();
+
+        Assert.hasLength(communityId, "未包含小区信息");
+
+        //查询费用项
+        FeeConfigDto feeConfigDto = new FeeConfigDto();
+        feeConfigDto.setCommunityId(communityId);
+
+        List<FeeConfigDto> feeConfigDtos = reportFeeServiceDaoImpl.getFeeConfigs(feeConfigDto);
+
+        for (FeeConfigDto tmpFeeConfigDto : feeConfigDtos) {
+            try {
+                GenerateOweFeeByFeeConfig(tmpFeeConfigDto);
+            } 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("费用出账失败" + tmpFeeConfigDto.getConfigId(), e);
+            }
+        }
+
+    }
+
+    /**
+     * 按费用项来出账
+     *
+     * @param feeConfigDto
+     */
+    private void GenerateOweFeeByFeeConfig(FeeConfigDto feeConfigDto) throws Exception {
+
+        //当前费用项是否
+
+        ReportFeeDto feeDto = new ReportFeeDto();
+        feeDto.setConfigId(feeConfigDto.getConfigId());
+        feeDto.setCommunityId(feeConfigDto.getCommunityId());
+        List<ReportFeeDto> feeDtos = reportFeeServiceDaoImpl.getFees(feeDto);
+
+        //没有关联费用
+        if (feeDto == null || feeDtos.size() < 1) {
+            return;
+        }
+        for (ReportFeeDto tmpFeeDto : feeDtos) {
+            try {
+                generateFee(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);
+            }
+        }
+
+    }
+
+    /**
+     * 生成 费用
+     *
+     * @param reportFeeDto
+     */
+    private void generateFee(ReportFeeDto reportFeeDto, FeeConfigDto feeConfigDto) {
+
+        FeeDto feeDto = BeanConvertUtil.covertBean(reportFeeDto,FeeDto.class);
+        //刷入欠费金额
+        computeFeeSMOImpl.computeEveryOweFee(feeDto);
+
+        //保存数据
+        ReportOweFeePo reportOweFeePo = new ReportOweFeePo();
+        reportOweFeePo.setAmountOwed(feeDto.getFeePrice() + "");
+        reportOweFeePo.setCommunityId(feeDto.getCommunityId());
+        reportOweFeePo.setConfigId(feeConfigDto.getConfigId());
+        reportOweFeePo.setConfigName(feeConfigDto.getFeeName());
+        reportOweFeePo.setDeadlineTime(DateUtil.getFormatTimeString(feeDto.getDeadlineTime(), DateUtil.DATE_FORMATE_STRING_A));
+        reportOweFeePo.setEndTime(DateUtil.getFormatTimeString(feeDto.getEndTime(), DateUtil.DATE_FORMATE_STRING_A));
+        reportOweFeePo.setFeeId(feeDto.getFeeId());
+        reportOweFeePo.setFeeName(feeDto.getFeeName());
+        reportOweFeePo.setOwnerId(FeeAttrDto.getFeeAttrValue(feeDto, FeeAttrDto.SPEC_CD_OWNER_ID));
+        reportOweFeePo.setOwnerName(FeeAttrDto.getFeeAttrValue(feeDto, FeeAttrDto.SPEC_CD_OWNER_NAME));
+        reportOweFeePo.setOwnerTel(FeeAttrDto.getFeeAttrValue(feeDto, FeeAttrDto.SPEC_CD_OWNER_LINK));
+        reportOweFeePo.setPayerObjId(feeDto.getPayerObjId());
+        reportOweFeePo.setPayerObjName(computeFeeSMOImpl.getFeeObjName(feeDto));
+        reportOweFeePo.setPayerObjType(feeDto.getPayerObjType());
+        reportOweFeePo.setUpdateTime(DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_A));
+        ReportOweFeeDto reportOweFeeDto = new ReportOweFeeDto();
+        reportOweFeeDto.setFeeId(feeDto.getFeeId());
+        reportOweFeeDto.setPayerObjId(feeDto.getPayerObjId());
+        List<Map> reportOweFeeDtos = reportOweFeeServiceDaoImpl.queryReportAllOweFees(BeanConvertUtil.beanCovertMap(reportOweFeeDto));
+        if (reportOweFeeDtos == null || reportOweFeeDtos.size() < 1) {
+            reportOweFeePo.setOweId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_oweId));
+            reportOweFeeServiceDaoImpl.saveReportOweFeeInfo(BeanConvertUtil.beanCovertMap(reportOweFeePo));
+        } else {
+            reportOweFeePo.setOweId(reportOweFeeDtos.get(0).get("oweId").toString());
+            reportOweFeeServiceDaoImpl.updateReportOweFeeInfo(BeanConvertUtil.beanCovertMap(reportOweFeePo));
+        }
+    }
+
+}