Browse Source

加入抄表信息

java110 6 years ago
parent
commit
abca46482c

+ 37 - 0
java110-bean/src/main/java/com/java110/dto/fee/FeeDto.java

@@ -93,6 +93,11 @@ public class FeeDto extends PageDto implements Serializable {
     private Date importFeeEndTime;
 
 
+    private String curDegrees;
+    private String preDegrees;
+
+    private Date preReadingTime;
+    private Date curReadingTime;
 
 
     public String getAmount() {
@@ -448,4 +453,36 @@ public class FeeDto extends PageDto implements Serializable {
     public void setImportFeeEndTime(Date importFeeEndTime) {
         this.importFeeEndTime = importFeeEndTime;
     }
+
+    public String getCurDegrees() {
+        return curDegrees;
+    }
+
+    public void setCurDegrees(String curDegrees) {
+        this.curDegrees = curDegrees;
+    }
+
+    public String getPreDegrees() {
+        return preDegrees;
+    }
+
+    public void setPreDegrees(String preDegrees) {
+        this.preDegrees = preDegrees;
+    }
+
+    public Date getPreReadingTime() {
+        return preReadingTime;
+    }
+
+    public void setPreReadingTime(Date preReadingTime) {
+        this.preReadingTime = preReadingTime;
+    }
+
+    public Date getCurReadingTime() {
+        return curReadingTime;
+    }
+
+    public void setCurReadingTime(Date curReadingTime) {
+        this.curReadingTime = curReadingTime;
+    }
 }

+ 2 - 0
java110-bean/src/main/java/com/java110/dto/meterWater/MeterWaterDto.java

@@ -15,6 +15,8 @@ import java.util.Date;
  **/
 public class MeterWaterDto extends PageDto implements Serializable {
 
+    public static final String METER_TYPE_ROOM = "1010";
+
     private String remark;
     private String curReadingTime;
     private String waterId;

+ 3 - 1
java110-db/src/main/resources/mapper/fee/FeeServiceDaoImplMapper.xml

@@ -140,7 +140,8 @@
         computingFormula,
         pfc.bill_type billType,t.payer_obj_type,t.payer_obj_type payerObjType,pfc.is_default isDefault,pfc.start_time
         configStartTime,pfc.end_time configEndTime,pfc.payment_cd paymentCd,pfc.payment_cycle paymentCycle,td4.name
-        billTypeName,pfa.value importFeeName,ifd.end_time importFeeEndTime
+        billTypeName,pfa.value importFeeName,ifd.end_time importFeeEndTime,mw.cur_degrees curDegrees,mw.pre_degrees preDegrees,
+        mw.pre_reading_time preReadingTime,mw.cur_reading_time curReadingTime
         from pay_fee t
         INNER join pay_fee_config pfc on t.fee_type_cd = pfc.fee_type_cd and t.config_id = pfc.config_id and
         pfc.status_cd = '0'
@@ -153,6 +154,7 @@
         td4.table_columns = 'bill_type'
         LEFT JOIN pay_fee_attrs pfa on t.fee_id = pfa.fee_id and pfa.spec_cd = '390002' and pfa.status_cd = '0'
         left join import_fee_detail ifd on t.fee_id = ifd.fee_id and ifd.status_cd = '0' and t.fee_flag = '2006012'
+        LEFT JOIN meter_water mw on t.fee_id = mw.fee_id and mw.status_cd = '0' and mw.community_id = t.community_id
         where 1 =1
         <if test="amount !=null and amount != ''">
             and t.amount= #{amount}

+ 36 - 10
service-api/src/main/java/com/java110/api/listener/fee/ListFeeListener.java

@@ -9,7 +9,6 @@ import com.java110.dto.RoomDto;
 import com.java110.dto.fee.FeeDto;
 import com.java110.dto.owner.OwnerCarDto;
 import com.java110.dto.parking.ParkingSpaceDto;
-import com.java110.intf.IImportFeeDetailInnerServiceSMO;
 import com.java110.intf.community.IParkingSpaceInnerServiceSMO;
 import com.java110.intf.community.IRoomInnerServiceSMO;
 import com.java110.intf.fee.IFeeConfigInnerServiceSMO;
@@ -19,6 +18,7 @@ import com.java110.utils.constant.ServiceCodeFeeConfigConstant;
 import com.java110.utils.util.Assert;
 import com.java110.utils.util.BeanConvertUtil;
 import com.java110.utils.util.DateUtil;
+import com.java110.utils.util.StringUtil;
 import com.java110.vo.api.fee.ApiFeeDataVo;
 import com.java110.vo.api.fee.ApiFeeVo;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -28,7 +28,12 @@ import org.springframework.http.ResponseEntity;
 
 import java.math.BigDecimal;
 import java.math.RoundingMode;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 
 /**
@@ -52,7 +57,6 @@ public class ListFeeListener extends AbstractServiceApiListener {
     @Autowired
     private IFeeInnerServiceSMO feeInnerServiceSMOImpl;
 
-    private IImportFeeDetailInnerServiceSMO importFeeDetailInnerServiceSMOImpl;
 
     @Override
     public String getServiceCode() {
@@ -151,6 +155,8 @@ public class ListFeeListener extends AbstractServiceApiListener {
         if (FeeDto.FEE_FLAG_ONCE.equals(feeDto.getFeeFlag())) {
             if (feeDto.getImportFeeEndTime() == null) {
                 targetEndDate = feeDto.getConfigEndTime();
+            } else if (!StringUtil.isEmpty(feeDto.getCurDegrees())) {
+                targetEndDate = feeDto.getCurReadingTime();
             } else {
                 targetEndDate = feeDto.getImportFeeEndTime();
             }
@@ -223,7 +229,6 @@ public class ListFeeListener extends AbstractServiceApiListener {
     }
 
     private void computeFeePriceByCar(FeeDto feeDto, double oweMonth) {
-
         OwnerCarDto ownerCarDto = new OwnerCarDto();
         ownerCarDto.setCommunityId(feeDto.getCommunityId());
         ownerCarDto.setCarId(feeDto.getPayerObjId());
@@ -231,7 +236,6 @@ public class ListFeeListener extends AbstractServiceApiListener {
         if (ownerCarDtos == null || ownerCarDtos.size() < 1) { //数据有问题
             return;
         }
-
         ParkingSpaceDto parkingSpaceDto = new ParkingSpaceDto();
         parkingSpaceDto.setCommunityId(feeDto.getCommunityId());
         parkingSpaceDto.setPsId(ownerCarDtos.get(0).getPsId());
@@ -254,17 +258,26 @@ public class ListFeeListener extends AbstractServiceApiListener {
             feePrice = additionalAmount.setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue();
         } else if ("4004".equals(computingFormula)) {
             feePrice = Double.parseDouble(feeDto.getAmount());
+        } else if ("5005".equals(computingFormula)) {
+            if (StringUtil.isEmpty(feeDto.getCurDegrees())) {
+                feePrice = -1.00;
+            } else {
+                BigDecimal curDegree = new BigDecimal(Double.parseDouble(feeDto.getCurDegrees()));
+                BigDecimal preDegree = new BigDecimal(Double.parseDouble(feeDto.getPreDegrees()));
+                BigDecimal squarePrice = new BigDecimal(Double.parseDouble(feeDto.getSquarePrice()));
+                BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(feeDto.getAdditionalAmount()));
+                BigDecimal sub = curDegree.subtract(preDegree);
+                feePrice = sub.multiply(squarePrice)
+                        .add(additionalAmount)
+                        .setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue();
+            }
         } else {
             feePrice = -1.00;
         }
-
         feeDto.setFeePrice(feePrice);
-
         BigDecimal curFeePrice = new BigDecimal(feeDto.getFeePrice());
         curFeePrice = curFeePrice.multiply(new BigDecimal(oweMonth));
         feeDto.setAmountOwed(curFeePrice.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue() + "");
-
-
     }
 
     /**
@@ -281,7 +294,6 @@ public class ListFeeListener extends AbstractServiceApiListener {
         if (roomDtos == null || roomDtos.size() < 1) { //数据有问题
             return;
         }
-
         String computingFormula = feeDto.getComputingFormula();
         double feePrice = 0.00;
         if ("1001".equals(computingFormula)) { //面积*单价+附加费
@@ -294,6 +306,20 @@ public class ListFeeListener extends AbstractServiceApiListener {
             feePrice = additionalAmount.setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue();
         } else if ("4004".equals(computingFormula)) {
             feePrice = Double.parseDouble(feeDto.getAmount());
+        } else if ("5005".equals(computingFormula)) {
+
+            if (StringUtil.isEmpty(feeDto.getCurDegrees())) {
+                feePrice = -1.00;
+            } else {
+                BigDecimal curDegree = new BigDecimal(Double.parseDouble(feeDto.getCurDegrees()));
+                BigDecimal preDegree = new BigDecimal(Double.parseDouble(feeDto.getPreDegrees()));
+                BigDecimal squarePrice = new BigDecimal(Double.parseDouble(feeDto.getSquarePrice()));
+                BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(feeDto.getAdditionalAmount()));
+                BigDecimal sub = curDegree.subtract(preDegree);
+                feePrice = sub.multiply(squarePrice)
+                        .add(additionalAmount)
+                        .setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue();
+            }
         } else {
             feePrice = -1.00;
         }