java110 пре 5 година
родитељ
комит
e81b2fb247

+ 10 - 0
java110-db/src/main/resources/mapper/report/ReportFeeMonthStatisticsServiceDaoImplMapper.xml

@@ -1085,4 +1085,14 @@
         order by objCount desc
     </select>
 
+    <select id="queryFinishOweFee" parameterType="Map" resultType="Map">
+        select t.config_id configId, t.fee_id feeId,t.statistics_id statisticsId,t.fee_year feeYear,fee_month feeMonth
+        from report_fee_month_statistics t
+        inner join pay_fee pf on t.fee_id = pf.fee_id and pf.state = '2009001' and pf.community_id = #{communityId} and pf.status_cd = '0'
+        where t.owe_amount > 0
+        and t.status_cd = '0'
+        and t.community_id = #{communityId}
+    </select>
+
+
 </mapper>

+ 4 - 0
service-front/src/main/java/com/java110/front/smo/payment/impl/GoodsToPaySMOImpl.java

@@ -13,6 +13,7 @@ import com.java110.front.smo.payment.IGoodsToPaySMO;
 import com.java110.utils.constant.ServiceConstant;
 import com.java110.utils.util.Assert;
 import com.java110.utils.util.BeanConvertUtil;
+import com.java110.vo.ResultVo;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -77,6 +78,9 @@ public class GoodsToPaySMOImpl extends AppAbstractComponentSMO implements IGoods
             return responseEntity;
         }
         JSONObject orderInfo = JSONObject.parseObject(responseEntity.getBody().toString());
+        if(orderInfo.getInteger("code") != ResultVo.CODE_OK){
+            throw new IllegalArgumentException("下单失败:"+orderInfo.getString("msg"));
+        }
         String orderId = orderInfo.getString("orderId");
         double money = Double.parseDouble(orderInfo.getString("payPrice"));
         String appType = OwnerAppUserDto.APP_TYPE_WECHAT_MINA;

+ 11 - 0
service-report/src/main/java/com/java110/report/dao/IReportFeeMonthStatisticsServiceDao.java

@@ -202,4 +202,15 @@ public interface IReportFeeMonthStatisticsServiceDao {
     List<Map> queryOwePaymentCount(Map info) throws DAOException;
 
 
+    /**
+     * 查询 缴费已经结束 报表表还有欠费的数据
+     * 根据bId 查询费用月统计信息
+     *
+     * @param info bId 信息
+     * @return 费用月统计信息
+     * @throws DAOException DAO异常
+     */
+    List<Map> queryFinishOweFee(Map info) throws DAOException;
+
+
 }

+ 8 - 0
service-report/src/main/java/com/java110/report/dao/impl/ReportFeeMonthStatisticsServiceDaoImpl.java

@@ -303,5 +303,13 @@ public class ReportFeeMonthStatisticsServiceDaoImpl extends BaseServiceDao imple
         return businessReportFeeMonthStatisticsInfos;
     }
 
+    @Override
+    public List<Map> queryFinishOweFee(Map info) throws DAOException {
+        logger.debug("查询费用月统计信息 入参 info : {}", info);
+
+        List<Map> businessReportFeeMonthStatisticsInfos = sqlSessionTemplate.selectList("reportFeeMonthStatisticsServiceDaoImpl.queryFinishOweFee", info);
+
+        return businessReportFeeMonthStatisticsInfos;    }
+
 
 }

+ 33 - 4
service-report/src/main/java/com/java110/report/smo/impl/GeneratorFeeMonthStatisticsInnerServiceSMOImpl.java

@@ -24,10 +24,7 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RestController;
 
 import java.math.BigDecimal;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 /**
  * @ClassName GeneratorFeeMonthStatisticsInnerServiceSMOImpl
@@ -74,6 +71,38 @@ public class GeneratorFeeMonthStatisticsInnerServiceSMOImpl implements IGenerato
 
         //处理车位费用
         dealCarFee(reportFeeMonthStatisticsPo);
+
+        //处理缴费结束的情况
+
+        dealFinishFee(communityId);
+    }
+
+    private void dealFinishFee(String communityId) {
+        Map reportFeeDto = new HashMap();
+        reportFeeDto.put("communityId", communityId);
+        List<Map> feeDtos = reportFeeMonthStatisticsServiceDaoImpl.queryFinishOweFee(reportFeeDto);
+        ReportFeeMonthStatisticsPo reportFeeMonthStatisticsPo = null;
+        for (Map info : feeDtos) {
+            try {
+                Date tmpTime = DateUtil.getDateFromString(info.get("feeYear").toString() + "-" + info.get("feeMonth").toString() + "-01", DateUtil.DATE_FORMATE_STRING_B);
+                Calendar c = Calendar.getInstance();
+                c.setTime(tmpTime);
+                c.add(Calendar.MONTH, 1);
+                ReportFeeDetailDto feeDetailDto = new ReportFeeDetailDto();
+                feeDetailDto.setStartTime(DateUtil.getFormatTimeString(tmpTime, DateUtil.DATE_FORMATE_STRING_A));
+                feeDetailDto.setEndTime(DateUtil.getFormatTimeString(c.getTime(), DateUtil.DATE_FORMATE_STRING_A));
+                feeDetailDto.setFeeId(info.get("feeId").toString());
+                double receivedAmount = reportFeeServiceDaoImpl.getFeeReceivedAmount(feeDetailDto);
+                reportFeeMonthStatisticsPo = new ReportFeeMonthStatisticsPo();
+                reportFeeMonthStatisticsPo.setStatisticsId(info.get("statisticsId").toString());
+                reportFeeMonthStatisticsPo.setReceivedAmount(receivedAmount + "");
+                reportFeeMonthStatisticsPo.setOweAmount("0");
+                reportFeeMonthStatisticsPo.setUpdateTime(DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_A));
+                reportFeeMonthStatisticsServiceDaoImpl.updateReportFeeMonthStatisticsInfo(BeanConvertUtil.beanCovertMap(reportFeeMonthStatisticsPo));
+            } catch (Exception e) {
+                logger.error("处理 缴费结束报表失败");
+            }
+        }
     }
 
     /**