Просмотр исходного кода

加入抄表动态单价功能

java110 лет назад: 4
Родитель
Сommit
38b7741d06

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

@@ -51,6 +51,7 @@ public class FeeDto extends PageDto implements Serializable {
     private String receivedAmountSwitch;
 
     private String squarePrice;
+    private String mwPrice;
     private String additionalAmount;
     private String state;
     private String stateName;
@@ -580,4 +581,12 @@ public class FeeDto extends PageDto implements Serializable {
     public void setComputingFormulaText(String computingFormulaText) {
         this.computingFormulaText = computingFormulaText;
     }
+
+    public String getMwPrice() {
+        return mwPrice;
+    }
+
+    public void setMwPrice(String mwPrice) {
+        this.mwPrice = mwPrice;
+    }
 }

+ 9 - 0
java110-bean/src/main/java/com/java110/dto/meterWater/ImportExportMeterWaterDto.java

@@ -26,6 +26,7 @@ public class ImportExportMeterWaterDto extends PageDto implements Serializable {
     private String floorNum;
     private String unitNum;
     private String roomNum;
+    private double price;
 
 
     public String getRemark() {
@@ -115,4 +116,12 @@ public class ImportExportMeterWaterDto extends PageDto implements Serializable {
     public void setRoomNum(String roomNum) {
         this.roomNum = roomNum;
     }
+
+    public double getPrice() {
+        return price;
+    }
+
+    public void setPrice(double price) {
+        this.price = price;
+    }
 }

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

@@ -31,6 +31,7 @@ public class MeterWaterDto extends PageDto implements Serializable {
     private String communityId;
     private String objType;
     private String feeId;
+    private double price;
 
 
     private Date createTime;
@@ -151,4 +152,13 @@ public class MeterWaterDto extends PageDto implements Serializable {
     public void setObjName(String objName) {
         this.objName = objName;
     }
+
+
+    public double getPrice() {
+        return price;
+    }
+
+    public void setPrice(double price) {
+        this.price = price;
+    }
 }

+ 9 - 0
java110-bean/src/main/java/com/java110/dto/report/ReportFeeDto.java

@@ -28,6 +28,7 @@ public class ReportFeeDto extends PageDto implements Serializable {
     private String configId;
 
     private String squarePrice;
+    private String mwPrice;
     private String additionalAmount;
     private String additionalAmountText;
     private String state;
@@ -501,4 +502,12 @@ public class ReportFeeDto extends PageDto implements Serializable {
     public void setAdditionalAmountText(String additionalAmountText) {
         this.additionalAmountText = additionalAmountText;
     }
+
+    public String getMwPrice() {
+        return mwPrice;
+    }
+
+    public void setMwPrice(String mwPrice) {
+        this.mwPrice = mwPrice;
+    }
 }

+ 9 - 0
java110-bean/src/main/java/com/java110/po/meterWater/MeterWaterPo.java

@@ -17,6 +17,7 @@ public class MeterWaterPo implements Serializable {
     private String communityId;
     private String objType;
     private String feeId;
+    private double price;
     private Date createTime;
 
     public String getRemark() {
@@ -122,4 +123,12 @@ public class MeterWaterPo implements Serializable {
     public void setCreateTime(Date createTime) {
         this.createTime = createTime;
     }
+
+    public double getPrice() {
+        return price;
+    }
+
+    public void setPrice(double price) {
+        this.price = price;
+    }
 }

+ 84 - 1
java110-core/src/main/java/com/java110/core/smo/impl/ComputeFeeSMOImpl.java

@@ -279,6 +279,15 @@ public class ComputeFeeSMOImpl implements IComputeFeeSMO {
             } else if ("7007".equals(computingFormula)) { //自定义公式
                 feeReceiptDetailPo.setArea(roomDtos.get(0).getBuiltUpArea());
                 feeReceiptDetailPo.setSquarePrice(feeDto.getComputingFormulaText());
+            }else if ("9009".equals(computingFormula)) {
+                if (StringUtil.isEmpty(feeDto.getCurDegrees())) {
+                } else {
+                    BigDecimal curDegree = new BigDecimal(Double.parseDouble(feeDto.getCurDegrees()));
+                    BigDecimal preDegree = new BigDecimal(Double.parseDouble(feeDto.getPreDegrees()));
+                    BigDecimal sub = curDegree.subtract(preDegree).setScale(2, BigDecimal.ROUND_HALF_EVEN);
+                    feeReceiptDetailPo.setArea(sub.doubleValue() + "");
+                    feeReceiptDetailPo.setSquarePrice(feeDto.getMwPrice() + "/" + feeDto.getAdditionalAmount());
+                }
             } else {
             }
         } else if (FeeDto.PAYER_OBJ_TYPE_CAR.equals(feeDto.getPayerObjType())) {//车位相关
@@ -331,7 +340,16 @@ public class ComputeFeeSMOImpl implements IComputeFeeSMO {
                 }
                 feeReceiptDetailPo.setArea(parkingSpaceDtos.get(0).getArea());
                 feeReceiptDetailPo.setSquarePrice(feeDto.getComputingFormulaText());
-            } else {
+            } else if ("9009".equals(computingFormula)) {
+                if (StringUtil.isEmpty(feeDto.getCurDegrees())) {
+                } else {
+                    BigDecimal curDegree = new BigDecimal(Double.parseDouble(feeDto.getCurDegrees()));
+                    BigDecimal preDegree = new BigDecimal(Double.parseDouble(feeDto.getPreDegrees()));
+                    BigDecimal sub = curDegree.subtract(preDegree).setScale(2, BigDecimal.ROUND_HALF_EVEN);
+                    feeReceiptDetailPo.setArea(sub.doubleValue() + "");
+                    feeReceiptDetailPo.setSquarePrice(feeDto.getMwPrice() + "/" + feeDto.getAdditionalAmount());
+                }
+            }else {
             }
         }
     }
@@ -696,6 +714,19 @@ public class ComputeFeeSMOImpl implements IComputeFeeSMO {
                 feePrice = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getAmount()));
             } else if ("7007".equals(computingFormula)) { //自定义公式
                 feePrice = computeRoomCustomizeFormula(BeanConvertUtil.covertBean(tmpReportFeeDto, FeeDto.class), BeanConvertUtil.covertBean(reportRoomDto, RoomDto.class));
+            }else if ("9009".equals(computingFormula)) {
+                if (StringUtil.isEmpty(tmpReportFeeDto.getCurDegrees())) {
+                    //throw new IllegalArgumentException("抄表数据异常");
+                } else {
+                    BigDecimal curDegree = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getCurDegrees()));
+                    BigDecimal preDegree = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getPreDegrees()));
+                    BigDecimal squarePrice = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getMwPrice()));
+                    BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getAdditionalAmount()));
+                    BigDecimal sub = curDegree.subtract(preDegree);
+                    feePrice = sub.multiply(squarePrice)
+                            .add(additionalAmount)
+                            .setScale(2, BigDecimal.ROUND_HALF_EVEN);
+                }
             } else {
                 throw new IllegalArgumentException("暂不支持该类公式");
             }
@@ -730,6 +761,19 @@ public class ComputeFeeSMOImpl implements IComputeFeeSMO {
                 feePrice = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getAmount()));
             } else if ("7007".equals(computingFormula)) { //自定义公式
                 feePrice = computeCarCustomizeFormula(BeanConvertUtil.covertBean(tmpReportFeeDto, FeeDto.class), BeanConvertUtil.covertBean(reportCarDto, OwnerCarDto.class));
+            }else if ("9009".equals(computingFormula)) {
+                if (StringUtil.isEmpty(tmpReportFeeDto.getCurDegrees())) {
+                    throw new IllegalArgumentException("抄表数据异常");
+                } else {
+                    BigDecimal curDegree = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getCurDegrees()));
+                    BigDecimal preDegree = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getPreDegrees()));
+                    BigDecimal squarePrice = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getMwPrice()));
+                    BigDecimal additionalAmount = new BigDecimal(Double.parseDouble(tmpReportFeeDto.getAdditionalAmount()));
+                    BigDecimal sub = curDegree.subtract(preDegree);
+                    feePrice = sub.multiply(squarePrice)
+                            .add(additionalAmount)
+                            .setScale(2, BigDecimal.ROUND_HALF_EVEN);
+                }
             } else {
                 throw new IllegalArgumentException("暂不支持该类公式");
             }
@@ -788,6 +832,19 @@ public class ComputeFeeSMOImpl implements IComputeFeeSMO {
                 feePrice = computeRoomCustomizeFormula(feeDto, roomDto);
             } else if ("8008".equals(computingFormula)) {  //手动动态费用
                 feePrice = new BigDecimal(Double.parseDouble(feeDto.getAmount()));
+            } else if ("9009".equals(computingFormula)) {  //(本期度数-上期度数)*动态单价+附加费
+                if (StringUtil.isEmpty(feeDto.getCurDegrees())) {
+                    //throw new IllegalArgumentException("抄表数据异常");
+                } else {
+                    BigDecimal curDegree = new BigDecimal(Double.parseDouble(feeDto.getCurDegrees()));
+                    BigDecimal preDegree = new BigDecimal(Double.parseDouble(feeDto.getPreDegrees()));
+                    BigDecimal squarePrice = new BigDecimal(Double.parseDouble(feeDto.getMwPrice()));
+                    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);
+                }
             } else {
                 throw new IllegalArgumentException("暂不支持该类公式");
             }
@@ -834,6 +891,19 @@ public class ComputeFeeSMOImpl implements IComputeFeeSMO {
                 feePrice = new BigDecimal(Double.parseDouble(feeDto.getAmount()));
             } else if ("7007".equals(computingFormula)) { //自定义公式
                 feePrice = computeCarCustomizeFormula(feeDto, ownerCarDtos.get(0));
+            } else if ("9009".equals(computingFormula)) {  //(本期度数-上期度数)*动态单价+附加费
+                if (StringUtil.isEmpty(feeDto.getCurDegrees())) {
+                    //throw new IllegalArgumentException("抄表数据异常");
+                } else {
+                    BigDecimal curDegree = new BigDecimal(Double.parseDouble(feeDto.getCurDegrees()));
+                    BigDecimal preDegree = new BigDecimal(Double.parseDouble(feeDto.getPreDegrees()));
+                    BigDecimal squarePrice = new BigDecimal(Double.parseDouble(feeDto.getMwPrice()));
+                    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);
+                }
             } else {
                 throw new IllegalArgumentException("暂不支持该类公式");
             }
@@ -883,6 +953,19 @@ public class ComputeFeeSMOImpl implements IComputeFeeSMO {
                 feePrice = computeContractCustomizeFormula(feeDto, contractRoomDtos);
             } else if ("8008".equals(computingFormula)) {  //手动动态费用
                 feePrice = new BigDecimal(Double.parseDouble(feeDto.getAmount()));
+            } else if ("9009".equals(computingFormula)) {  //(本期度数-上期度数)*动态单价+附加费
+                if (StringUtil.isEmpty(feeDto.getCurDegrees())) {
+                    //throw new IllegalArgumentException("抄表数据异常");
+                } else {
+                    BigDecimal curDegree = new BigDecimal(Double.parseDouble(feeDto.getCurDegrees()));
+                    BigDecimal preDegree = new BigDecimal(Double.parseDouble(feeDto.getPreDegrees()));
+                    BigDecimal squarePrice = new BigDecimal(Double.parseDouble(feeDto.getMwPrice()));
+                    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);
+                }
             } else {
                 throw new IllegalArgumentException("暂不支持该类公式");
             }

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

@@ -142,7 +142,7 @@
         configStartTime,pfc.end_time configEndTime,pfc.payment_cd paymentCd,pfc.payment_cycle paymentCycle,td4.name
         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,pfa1.`value` deadlineTime
+        mw.pre_reading_time preReadingTime,mw.cur_reading_time curReadingTime,pfa1.`value` deadlineTime,mw.price mwPrice
         from pay_fee t
         INNER join pay_fee_config pfc on t.config_id = pfc.config_id and
         pfc.status_cd = '0'

+ 8 - 8
java110-db/src/main/resources/mapper/fee/MeterWaterServiceDaoImplMapper.xml

@@ -8,10 +8,10 @@
     <insert id="saveBusinessMeterWaterInfo" parameterType="Map">
         insert into business_meter_water(
         remark,cur_reading_time,water_id,cur_degrees,operate,meter_type,pre_degrees,obj_id,pre_reading_time,
-        b_id,community_id,obj_type,fee_id,obj_name
+        b_id,community_id,obj_type,fee_id,obj_name,price
         ) values (
         #{remark},#{curReadingTime},#{waterId},#{curDegrees},#{operate},#{meterType},#{preDegrees},#{objId},
-        #{preReadingTime},#{bId},#{communityId},#{objType},#{feeId},#{objName}
+        #{preReadingTime},#{bId},#{communityId},#{objType},#{feeId},#{objName},#{price}
         )
     </insert>
 
@@ -22,7 +22,7 @@
         waterId,t.cur_degrees,t.cur_degrees curDegrees,t.operate,t.meter_type,t.meter_type
         meterType,t.pre_degrees,t.pre_degrees preDegrees,t.obj_id,t.obj_id
         objId,t.pre_reading_time,t.pre_reading_time preReadingTime,t.b_id,t.b_id bId,t.community_id,t.community_id
-        communityId,t.obj_type,t.obj_type objType,t.fee_id,t.fee_id feeId,t.obj_name,t.obj_name objName
+        communityId,t.obj_type,t.obj_type objType,t.fee_id,t.fee_id feeId,t.obj_name,t.obj_name objName,t.price
         from business_meter_water t
         where 1 =1
         <if test="remark !=null and remark != ''">
@@ -72,10 +72,10 @@
     <insert id="saveMeterWaterInfoInstance" parameterType="Map">
         insert into meter_water(
         remark,status_cd,cur_reading_time,water_id,cur_degrees,meter_type,pre_degrees,obj_id,pre_reading_time,b_id,
-        community_id,obj_type,fee_id,obj_name
+        community_id,obj_type,fee_id,obj_name,price
         ) select
         t.remark,'0',t.cur_reading_time,t.water_id,t.cur_degrees,t.meter_type,t.pre_degrees,t.obj_id,
-        t.pre_reading_time,t.b_id,t.community_id,t.obj_type,t.fee_id,t.obj_name
+        t.pre_reading_time,t.b_id,t.community_id,t.obj_type,t.fee_id,t.obj_name,t.price
         from business_meter_water t where 1=1
         <if test="remark !=null and remark != ''">
             and t.remark= #{remark}
@@ -124,7 +124,7 @@
         curReadingTime,t.water_id,t.water_id waterId,t.cur_degrees,t.cur_degrees curDegrees,t.create_time,t.create_time
         createTime,t.meter_type,t.meter_type meterType,t.pre_degrees,t.pre_degrees preDegrees,t.obj_id,t.obj_id
         objId,t.pre_reading_time,t.pre_reading_time preReadingTime,t.b_id,t.b_id bId,t.community_id,t.community_id
-        communityId,t.obj_type,t.obj_type objType,t.fee_id,t.fee_id feeId,t.obj_name,t.obj_name objName
+        communityId,t.obj_type,t.obj_type objType,t.fee_id,t.fee_id feeId,t.obj_name,t.obj_name objName,t.price
         from meter_water t
         left join pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
         where 1 =1
@@ -278,11 +278,11 @@
     <insert id="insertMeterWaters" parameterType="Map">
         insert into meter_water
         (remark,status_cd,cur_reading_time,water_id,cur_degrees,meter_type,pre_degrees,obj_id,pre_reading_time,b_id,
-        community_id,obj_type,fee_id,obj_name)
+        community_id,obj_type,fee_id,obj_name,price)
         VALUES
         <foreach collection="meterWaterPos" item="item" separator=",">
             (#{item.remark},'0',#{item.curReadingTime},#{item.waterId},#{item.curDegrees},#{item.meterType},#{item.preDegrees},
-            #{item.objId},#{item.preReadingTime},'-1',#{item.communityId},#{item.objType},#{item.feeId},#{item.objName})
+            #{item.objId},#{item.preReadingTime},'-1',#{item.communityId},#{item.objType},#{item.feeId},#{item.objName},#{price})
         </foreach>
     </insert>
 

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

@@ -63,7 +63,7 @@
         storeTypeCd,
         t.community_id communityId,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,pfa1.`value` deadlineTime
+        mw.pre_reading_time preReadingTime,mw.cur_reading_time curReadingTime,pfa1.`value` deadlineTime,mw.price mwPrice
         from pay_fee t
         INNER JOIN pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
         left join building_room br on t.payer_obj_id = br.room_id and t.payer_obj_type = '3333' and br.status_cd = '0'

+ 32 - 10
service-fee/src/main/java/com/java110/fee/bmo/impl/QueryOweFeeImpl.java

@@ -31,12 +31,7 @@ import org.springframework.stereotype.Service;
 
 import java.math.BigDecimal;
 import java.math.RoundingMode;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 @Service
 public class QueryOweFeeImpl implements IQueryOweFee {
@@ -187,8 +182,8 @@ public class QueryOweFeeImpl implements IQueryOweFee {
         int threadNum = Java110ThreadPoolFactory.JAVA110_DEFAULT_THREAD_NUM;
 
         tempRooms.addAll(doGetTmpRoomDto(roomDtos, feeDto, threadNum));
-        for(RoomDto tmpRoomDto:tempRooms){
-            if(tmpRoomDto == null){
+        for (RoomDto tmpRoomDto : tempRooms) {
+            if (tmpRoomDto == null) {
                 continue;
             }
             tmpRoomDtos.add(tmpRoomDto);
@@ -422,6 +417,19 @@ public class QueryOweFeeImpl implements IQueryOweFee {
                         .add(additionalAmount)
                         .setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue();
             }
+        } else if ("9009".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.getMwPrice()));
+                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 = 0.00;
         }
@@ -521,6 +529,20 @@ public class QueryOweFeeImpl implements IQueryOweFee {
                         .add(additionalAmount)
                         .setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue();
             }
+        } else if ("9009".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.getMwPrice()));
+                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 = 0.00;
         }
@@ -581,9 +603,9 @@ public class QueryOweFeeImpl implements IQueryOweFee {
             return targetEndDateAndOweMonth;
         }
         if (FeeDto.FEE_FLAG_ONCE.equals(feeDto.getFeeFlag())) {
-            if(feeDto.getDeadlineTime() != null){
+            if (feeDto.getDeadlineTime() != null) {
                 targetEndDate = feeDto.getDeadlineTime();
-            }else if(!StringUtil.isEmpty(feeDto.getCurDegrees())) {
+            } else if (!StringUtil.isEmpty(feeDto.getCurDegrees())) {
                 targetEndDate = feeDto.getCurReadingTime();
             } else if (feeDto.getImportFeeEndTime() == null) {
                 targetEndDate = feeDto.getConfigEndTime();

+ 7 - 1
service-fee/src/main/java/com/java110/fee/bmo/meterWater/impl/QueryPreMeterWaterImpl.java

@@ -97,12 +97,15 @@ public class QueryPreMeterWaterImpl implements IQueryPreMeterWater {
             importExportMeterWaterDto = BeanConvertUtil.covertBean(tmpRoomDto, ImportExportMeterWaterDto.class);
             String preDegree = "0";
             String preReadTime = DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_B);
+            double price = 0;
             if (meterWaterDtos != null && meterWaterDtos.size() > 0) {
                 preDegree = meterWaterDtos.get(0).getCurDegrees();
                 preReadTime = DateUtil.dateTimeToDate(meterWaterDtos.get(0).getCurReadingTime());
+                price = meterWaterDtos.get(0).getPrice();
             }
             importExportMeterWaterDto.setPreDegrees(preDegree);
             importExportMeterWaterDto.setPreReadingTime(preReadTime);
+            importExportMeterWaterDto.setPrice(price);
             importExportMeterWaterDtos.add(importExportMeterWaterDto);
         }
         return ResultVo.createResponseEntity(1, importExportMeterWaterDtos.size(), importExportMeterWaterDtos);
@@ -204,8 +207,10 @@ public class QueryPreMeterWaterImpl implements IQueryPreMeterWater {
 
             if ("1010".equals(importExportMeterWaterDto.getMeterType())) {
                 feeName += "水费";
-            } else {
+            } else if("2020".equals(importExportMeterWaterDto.getMeterType())) {
                 feeName += "电费";
+            }else{
+                feeName += "燃气费";
             }
             feeAttrPo.setValue(feeName);
             feeAttrPo.setFeeId(payFeePo.getFeeId());
@@ -265,6 +270,7 @@ public class QueryPreMeterWaterImpl implements IQueryPreMeterWater {
         meterWaterPo.setPreReadingTime(importExportMeterWaterDto.getPreReadingTime());
         meterWaterPo.setWaterId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_waterId));
         meterWaterPo.setRemark(importExportMeterWaterDto.getRemark());
+        meterWaterPo.setPrice(importExportMeterWaterDto.getPrice());
         meterWaterPos.add(meterWaterPo);
     }
 

+ 1 - 1
service-front/src/main/java/com/java110/front/components/assetImport/ImportMeterWaterFeeComponent.java

@@ -68,7 +68,7 @@ public class ImportMeterWaterFeeComponent {
      */
     public ResponseEntity<Object> exportData2(IPageData pd) throws Exception {
 
-        return exportMeterWaterSMOImpl.exportExcelData(pd);
+        return exportMeterWaterSMOImpl.exportExcelData2(pd);
     }
 
 

+ 58 - 2
service-front/src/main/java/com/java110/front/smo/assetExport/impl/ExportMeterWaterSMOImpl.java

@@ -176,13 +176,13 @@ public class ExportMeterWaterSMOImpl extends BaseComponentSMO implements IExport
         //工作表
         workbook = new XSSFWorkbook();
         //获取楼信息
-        getMeterWater(pd, result, workbook);
+        getMeterWater2(pd, result, workbook);
 
 
         ByteArrayOutputStream os = new ByteArrayOutputStream();
         MultiValueMap headers = new HttpHeaders();
         headers.add("content-type", "application/octet-stream;charset=UTF-8");
-        headers.add("Content-Disposition", "attachment;filename=meteWaterImport_" + DateUtil.getyyyyMMddhhmmssDateString() + ".xlsx");
+        headers.add("Content-Disposition", "attachment;filename=meteWaterImport2_" + DateUtil.getyyyyMMddhhmmssDateString() + ".xlsx");
         headers.add("Pargam", "no-cache");
         headers.add("Cache-Control", "no-cache");
         //headers.add("Content-Disposition", "attachment; filename=" + outParam.getString("fileName"));
@@ -202,6 +202,62 @@ public class ExportMeterWaterSMOImpl extends BaseComponentSMO implements IExport
         return new ResponseEntity<Object>(context, headers, HttpStatus.OK);
     }
 
+    /**
+     * 获取 房屋信息
+     *
+     * @param componentValidateResult
+     * @param workbook
+     */
+    private void getMeterWater2(IPageData pd, ComponentValidateResult componentValidateResult, Workbook workbook) {
+        JSONObject reqJson = JSONObject.parseObject(pd.getReqData());
+        Sheet sheet = workbook.createSheet("房屋费用信息");
+        Row row = sheet.createRow(0);
+        Cell cell0 = row.createCell(0);
+        cell0.setCellValue("上期度数: 请填写上期表读数 ;\n上期读表时间: " +
+                "格式为YYYY-MM-DD; \n本期度数: 本次表读数;\n本期读表时间: 格式为YYYY-MM-DD; " +
+                "\n注意:所有单元格式为文本");
+        CellStyle cs = workbook.createCellStyle();
+        cs.setWrapText(true);  //关键
+        cell0.setCellStyle(cs);
+        row.setHeight((short) (200 * 10));
+        row = sheet.createRow(1);
+        row.createCell(0).setCellValue("楼栋编号");
+        row.createCell(1).setCellValue("单元编号");
+        row.createCell(2).setCellValue("房屋编码");
+        row.createCell(3).setCellValue("费用类型");
+        row.createCell(4).setCellValue("单价");
+        row.createCell(5).setCellValue("上期度数");
+        row.createCell(6).setCellValue("上期读表时间");
+        row.createCell(7).setCellValue("本期度数");
+        row.createCell(8).setCellValue("本期读表时间");
+        row.createCell(9).setCellValue("备注");
+
+        //查询楼栋信息
+        JSONArray rooms = this.getExistsRoom(pd, componentValidateResult);
+        if (rooms == null) {
+            CellRangeAddress region = new CellRangeAddress(0, 0, 0, 6);
+            sheet.addMergedRegion(region);
+            return;
+        }
+
+        for (int roomIndex = 0; roomIndex < rooms.size(); roomIndex++) {
+            row = sheet.createRow(roomIndex + 2);
+            row.createCell(0).setCellValue(rooms.getJSONObject(roomIndex).getString("floorNum"));
+            row.createCell(1).setCellValue(rooms.getJSONObject(roomIndex).getString("unitNum"));
+            row.createCell(2).setCellValue(rooms.getJSONObject(roomIndex).getString("roomNum"));
+            row.createCell(3).setCellValue(reqJson.getString("feeName"));
+            row.createCell(4).setCellValue(rooms.getJSONObject(roomIndex).getString("price"));
+            row.createCell(5).setCellValue(rooms.getJSONObject(roomIndex).getString("preDegrees"));
+            row.createCell(6).setCellValue(rooms.getJSONObject(roomIndex).getString("preReadingTime"));
+            row.createCell(7).setCellValue("");
+            row.createCell(8).setCellValue("");
+            row.createCell(9).setCellValue("");
+        }
+
+        CellRangeAddress region = new CellRangeAddress(0, 0, 0, 6);
+        sheet.addMergedRegion(region);
+    }
+
     public RestTemplate getRestTemplate() {
         return restTemplate;
     }

+ 50 - 1
service-front/src/main/java/com/java110/front/smo/assetImport/impl/ImportMeterWaterFeeSMOImpl.java

@@ -82,7 +82,7 @@ public class ImportMeterWaterFeeSMOImpl extends BaseComponentSMO implements IImp
             List<ImportExportMeterWaterDto> rooms = new ArrayList<ImportExportMeterWaterDto>();
 
             //获取楼信息
-            getRooms(workbook, rooms);
+            getRooms2(workbook, rooms);
             // 保存数据
             return dealExcelData(pd, rooms, result);
         } catch (Exception e) {
@@ -212,6 +212,55 @@ public class ImportMeterWaterFeeSMOImpl extends BaseComponentSMO implements IImp
             importRoomFee.setPreReadingTime(startTime);
             importRoomFee.setCurDegrees(os[5].toString());
             importRoomFee.setCurReadingTime(endTime);
+            importRoomFee.setPrice(-1);
+            rooms.add(importRoomFee);
+        }
+    }
+
+    /**
+     * 获取 房屋信息
+     *
+     * @param workbook
+     * @param rooms
+     */
+    private void getRooms2(Workbook workbook, List<ImportExportMeterWaterDto> rooms) {
+        Sheet sheet = null;
+        sheet = ImportExcelUtils.getSheet(workbook, "房屋费用信息");
+        List<Object[]> oList = ImportExcelUtils.listFromSheet(sheet);
+        ImportExportMeterWaterDto importRoomFee = null;
+        for (int osIndex = 0; osIndex < oList.size(); osIndex++) {
+            Object[] os = oList.get(osIndex);
+            if (osIndex == 0 || osIndex == 1) { // 第一行是 头部信息 直接跳过
+                continue;
+            }
+            if (StringUtil.isNullOrNone(os[0])) {
+                continue;
+            }
+            Assert.hasValue(os[1], (osIndex + 1) + "单元编号不能为空");
+            Assert.hasValue(os[2], (osIndex + 1) + "房屋编号不能为空");
+            Assert.hasValue(os[4], (osIndex + 1) + "单价不能为空");
+            Assert.hasValue(os[5], (osIndex + 1) + "上期度数不能为空");
+            Assert.hasValue(os[6], (osIndex + 1) + "上期度数时间不能为空");
+            Assert.hasValue(os[7], (osIndex + 1) + "本期度数不能为空");
+            Assert.hasValue(os[8], (osIndex + 1) + "本期度数时间不能为空");
+
+//
+
+            String startTime = excelDoubleToDate(os[6].toString());
+            String endTime = excelDoubleToDate(os[8].toString());
+            Assert.isDate(startTime, DateUtil.DATE_FORMATE_STRING_B, (osIndex + 1) + "行开始时间格式错误 请填写YYYY-MM-DD 文本格式");
+            Assert.isDate(endTime, DateUtil.DATE_FORMATE_STRING_B, (osIndex + 1) + "行结束时间格式错误 请填写YYYY-MM-DD 文本格式");
+
+
+            importRoomFee = new ImportExportMeterWaterDto();
+            importRoomFee.setFloorNum(os[0].toString());
+            importRoomFee.setUnitNum(os[1].toString());
+            importRoomFee.setRoomNum(os[2].toString());
+            importRoomFee.setPrice(Double.parseDouble(os[4].toString()));
+            importRoomFee.setPreDegrees(os[5].toString());
+            importRoomFee.setPreReadingTime(startTime);
+            importRoomFee.setCurDegrees(os[7].toString());
+            importRoomFee.setCurReadingTime(endTime);
             rooms.add(importRoomFee);
         }
     }