Xiaojh преди 4 години
родител
ревизия
0044425c6a
променени са 1 файла, в които са добавени 13 реда и са изтрити 3 реда
  1. 13 3
      smart-city-platform/src/main/java/com/bz/smart_city/service/impl/pay/PayChargeSurveyServiceImpl.java

+ 13 - 3
smart-city-platform/src/main/java/com/bz/smart_city/service/impl/pay/PayChargeSurveyServiceImpl.java

@@ -81,7 +81,9 @@ public class PayChargeSurveyServiceImpl implements PayChargeSurveyService {
         BigDecimal defc = new BigDecimal("0.0");
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");//格式化为年月日
         BigInteger siteId = BigInteger.valueOf(loginUser.getSiteId());
-        BigInteger customerId = BigInteger.valueOf(loginUser.getCustomerId());
+        BigInteger customerId = null;
+        Integer cus = loginUser.getCustomerId() != null ? loginUser.getCustomerId() : null;
+        customerId = BigInteger.valueOf(cus);
         try {
             //1.获取客户总数跟较上月比率
             /***********************************时间计算*****************************************/
@@ -109,7 +111,13 @@ public class PayChargeSurveyServiceImpl implements PayChargeSurveyService {
             String endPeriod = list.get(0).getYear()+"-"+String.format("%02d", list.get(0).getMonth())+"-31";
 
             //上一账期汇总
-            String lastDate = list.get(1).getYear() +"-"+String.format("%02d", list.get(1).getMonth())+"-01";
+            String lastDate = "";
+            if(list.size() > 1){
+                lastDate = list.get(1).getYear() +"-"+String.format("%02d", list.get(1).getMonth())+"-01";
+            }else{
+                lastDate = list.get(0).getYear() +"-"+String.format("%02d", list.get(0).getMonth())+"-01";
+            }
+
             PayAccountSurvey accountSurvey = payChargeSurveyMapper.getlastAccount(lastDate,siteId,customerId);
 
             //客户总数计算
@@ -264,7 +272,9 @@ public class PayChargeSurveyServiceImpl implements PayChargeSurveyService {
         PayTransactionSurveyDto payTransactionSurveyDto = new PayTransactionSurveyDto();
         LoginUser loginUser = UserUtil.getCurrentUser();
         BigInteger siteId = BigInteger.valueOf(loginUser.getSiteId());
-        BigInteger customerId = BigInteger.valueOf(loginUser.getCustomerId());
+        BigInteger customerId = null;
+        Integer cus = loginUser.getCustomerId() != null ? loginUser.getCustomerId() : null;
+        customerId = BigInteger.valueOf(cus);
         BigDecimal defc = new BigDecimal("0.0");
         try {
             List<BaseClosingAccountInfoDto> list = baseClosingAccountInfoMapper.getList(null,null,