Browse Source

1修改客户状况统计汇总

Xiaojh 4 years ago
parent
commit
bf31320ed5

+ 1 - 1
smart-city-platform/src/main/java/com/bz/smart_city/dao/pay/PayChargeSurveyMapper.java

@@ -13,7 +13,7 @@ import java.util.List;
 @Mapper
 public interface PayChargeSurveyMapper {
 
-    public Integer getAccountCount();
+    public Integer getAccountCount(@Param("siteId")BigInteger siteId, @Param("customerId")BigInteger customerId);
 
     public PayAccountSurvey getlastNumber(@Param("year")Integer year, @Param("month")Integer month,
                                           @Param("siteId")BigInteger siteId, @Param("customerId")BigInteger customerId);

+ 12 - 12
smart-city-platform/src/main/java/com/bz/smart_city/service/impl/pay/BaseClosingAccountInfoServiceImpl.java

@@ -123,7 +123,7 @@ public class BaseClosingAccountInfoServiceImpl implements BaseClosingAccountInfo
             //1.先判断客户概况表是否存在记录,如果不存在则按账期月去卡旧数据的客户总数、水表总数、开户总数
             //2.根据历史账期对旧数据进行入库保存
             //查看记录表是否已经存在数据,为NULL则代表没有存在历史数据
-            Integer count = 0;
+            Integer count = payChargeSurveyMapper.getAccountCount(BigInteger.valueOf(loginUser.getSiteId()),BigInteger.valueOf(loginUser.getCustomerId()));
             if(count <= 0){
                 //按账期月卡旧数据
                 List<BaseClosingAccountInfoDto> list = baseClosingAccountInfoMapper.getListNumber(null,null,
@@ -134,29 +134,29 @@ public class BaseClosingAccountInfoServiceImpl implements BaseClosingAccountInfo
                         int state = list.get(i).getState();
                         /*if(state == 1){*/
                         //把历史结账数据存进去,但不包含本期未结账的
-                        //this.insertAccountNumber(list.get(i).getYear(),list.get(i).getMonth(),list.get(i).getStartTime(),list.get(i).getEndTime());
+                        this.insertAccountNumber(list.get(i).getYear(),list.get(i).getMonth(),list.get(i).getStartTime(),list.get(i).getEndTime());
                         //历史交易数据
                         this.insertTransaction(list.get(i).getYear(),list.get(i).getMonth());
                         //历史交易数据
-                        //this.insertFeeSummary(list.get(i).getYear(),list.get(i).getMonth());
+                        this.insertFeeSummary(list.get(i).getYear(),list.get(i).getMonth());
                         //历史水量
-                        //this.insetAmountInfo(list.get(i).getYear(),list.get(i).getMonth());
+                        this.insetAmountInfo(list.get(i).getYear(),list.get(i).getMonth());
                         /*}*/
                     }
                 }
             }else if(count > 0){
                 //存储本期未结账数据
-                //this.insertAccountNumber(year,month,startTime,endTime);
+                this.insertAccountNumber(year,month,startTime,endTime);
                 //本期交易未结账数据
                 this.insertTransaction(year,month);
                 //本期交易数据
-                //this.insertFeeSummary(year,month);
+                this.insertFeeSummary(year,month);
                 //本期水量
-                //this.insetAmountInfo(year,month);
+                this.insetAmountInfo(year,month);
             }
 
             // 更新本账期
-            /*String msg2 = year + "年" + String.format("%02d", month) + "月已经结账";
+            String msg2 = year + "年" + String.format("%02d", month) + "月已经结账";
             baseClosingAccountInfoDto.setEndTime(endTime);
             baseClosingAccountInfoDto.setRemarks(msg2);
             baseClosingAccountInfoDto.setState(1);
@@ -180,7 +180,7 @@ public class BaseClosingAccountInfoServiceImpl implements BaseClosingAccountInfo
                 baseClosingAccountInfoDto.setMonth(1);
             }
             baseClosingAccountInfoDto.setName(baseClosingAccountInfoDto.getYear()+"年"+String.format("%02d", baseClosingAccountInfoDto.getMonth())+"月");
-            this.add(baseClosingAccountInfoDto);*/
+            this.add(baseClosingAccountInfoDto);
         }else{
             message.setStatus(-707);
             message.setMsg(msg);
@@ -215,13 +215,13 @@ public class BaseClosingAccountInfoServiceImpl implements BaseClosingAccountInfo
 
             //根据账期查找历史客户数(仅统计状态为欠费与正常的客户总数之和)
             Integer accountNumber = payChargeSurveyMapper.getAccountNumber
-                    (strarDate,endDate,BigInteger.valueOf(loginUser.getSiteId()),BigInteger.valueOf(loginUser.getCustomerId()));
+                    (null,endDate,BigInteger.valueOf(loginUser.getSiteId()),BigInteger.valueOf(loginUser.getCustomerId()));
             //根据账期查找历史水表数(仅统计状态为已开户的水表总数)
             Integer meterNumber = payChargeSurveyMapper.getMeterNumber
-                    (strarDate,endDate,BigInteger.valueOf(loginUser.getSiteId()),BigInteger.valueOf(loginUser.getCustomerId()));
+                    (null,endDate,BigInteger.valueOf(loginUser.getSiteId()),BigInteger.valueOf(loginUser.getCustomerId()));
             //根据账期查找历史开户数(仅统计状态为正常的开户总数)
             Integer customerNumber = payChargeSurveyMapper.getCustomerNumber
-                    (strarDate,endDate,BigInteger.valueOf(loginUser.getSiteId()),BigInteger.valueOf(loginUser.getCustomerId()));
+                    (null,endDate,BigInteger.valueOf(loginUser.getSiteId()),BigInteger.valueOf(loginUser.getCustomerId()));
 
             //上一账期汇总
             PayAccountSurvey lastAccount = payChargeSurveyMapper.getlastNumber(lastYear,lastMonth,

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

@@ -32,8 +32,8 @@ public class PayChargeSurveyServiceImpl implements PayChargeSurveyService {
     private BaseClosingAccountInfoMapper baseClosingAccountInfoMapper;
 
 
-    public Integer getAccountCount(){
-        return payChargeSurveyMapper.getAccountCount();
+    public Integer getAccountCount(BigInteger siteId,BigInteger customerId){
+        return payChargeSurveyMapper.getAccountCount(siteId,customerId);
     }
 
     public static void main(String[] args) {
@@ -191,9 +191,9 @@ public class PayChargeSurveyServiceImpl implements PayChargeSurveyService {
             List<PayChangePeriodDto> accountList2 = new ArrayList<PayChangePeriodDto>();
             periodDto.setYear(list.get(0).getYear());
             periodDto.setMonth(list.get(0).getMonth());
-            periodDto.setAccountNumber(sumCurrentAccount);
-            periodDto.setCustomerNumber(sumCurrentCustomer);
-            periodDto.setMeterNumber(sumCurrentMeter);
+            periodDto.setAccountNumber(sumAccount);
+            periodDto.setCustomerNumber(sumCustomer);
+            periodDto.setMeterNumber(sumMeter);
             accountList2.add(periodDto);
             accountList2.addAll(accoutList);
             //填补缺失月

+ 3 - 1
smart-city-platform/src/main/java/com/bz/smart_city/service/pay/PayChargeSurveyService.java

@@ -5,8 +5,10 @@ import com.bz.smart_city.dto.pay.PayChargeSurveyDto;
 import com.bz.smart_city.dto.pay.PayFeeSueveyDto;
 import com.bz.smart_city.dto.pay.PayTransactionSurveyDto;
 
+import java.math.BigInteger;
+
 public interface PayChargeSurveyService {
-    public Integer getAccountCount();
+    public Integer getAccountCount(BigInteger siteId,BigInteger customerId);
 
     public PayChargeSurveyDto accountSurvey();
 

+ 9 - 1
smart-city-platform/src/main/resources/mapper/pay/PayChargeSurveyMapper.xml

@@ -3,7 +3,15 @@
 <mapper namespace="com.bz.smart_city.dao.pay.PayChargeSurveyMapper">
 
     <select id="getAccountCount" resultType="java.lang.Integer">
-        select count(a.id) from pay_account_survey a
+        select count(a.id) as number from pay_account_survey a
+        <where>
+            <if test="siteId != null">
+                and a.site_id =#{siteId}
+            </if>
+            <if test="customerId != null">
+                and a.customer_id =#{customerId}
+            </if>
+        </where>
     </select>
 
     <select id="getlastNumber" resultType="com.bz.smart_city.entity.pay.PayAccountSurvey">