Kaynağa Gözat

优化代码

java110 5 yıl önce
ebeveyn
işleme
727051b595

+ 3 - 0
java110-bean/src/main/java/com/java110/dto/fee/FeeConfigDto.java

@@ -23,6 +23,9 @@ public class FeeConfigDto extends PageDto implements Serializable {
 
     public static final String DEFAULT_FEE_CONFIG = "T";
 
+    public static final String FEE_TYPE_CD_WATER = "888800010016";//电费
+    public static final String FEE_TYPE_CD_METER = "888800010015";//水费
+
 
     private String feeTypeCd;
     private String computingFormula;

+ 57 - 28
java110-bean/src/main/java/com/java110/dto/meterWater/MeterWaterDto.java

@@ -1,6 +1,7 @@
 package com.java110.dto.meterWater;
 
 import com.java110.dto.PageDto;
+
 import java.io.Serializable;
 import java.util.Date;
 
@@ -15,15 +16,16 @@ import java.util.Date;
 public class MeterWaterDto extends PageDto implements Serializable {
 
     private String remark;
-private String curReadingTime;
-private String waterId;
-private String curDegrees;
-private String meterType;
-private String preDegrees;
-private String objId;
-private String preReadingTime;
-private String communityId;
-private String objType;
+    private String curReadingTime;
+    private String waterId;
+    private String curDegrees;
+    private String meterType;
+    private String preDegrees;
+    private String objId;
+    private String preReadingTime;
+    private String communityId;
+    private String objType;
+    private String feeId;
 
 
     private Date createTime;
@@ -34,61 +36,80 @@ private String objType;
     public String getRemark() {
         return remark;
     }
-public void setRemark(String remark) {
+
+    public void setRemark(String remark) {
         this.remark = remark;
     }
-public String getCurReadingTime() {
+
+    public String getCurReadingTime() {
         return curReadingTime;
     }
-public void setCurReadingTime(String curReadingTime) {
+
+    public void setCurReadingTime(String curReadingTime) {
         this.curReadingTime = curReadingTime;
     }
-public String getWaterId() {
+
+    public String getWaterId() {
         return waterId;
     }
-public void setWaterId(String waterId) {
+
+    public void setWaterId(String waterId) {
         this.waterId = waterId;
     }
-public String getCurDegrees() {
+
+    public String getCurDegrees() {
         return curDegrees;
     }
-public void setCurDegrees(String curDegrees) {
+
+    public void setCurDegrees(String curDegrees) {
         this.curDegrees = curDegrees;
     }
-public String getMeterType() {
+
+    public String getMeterType() {
         return meterType;
     }
-public void setMeterType(String meterType) {
+
+    public void setMeterType(String meterType) {
         this.meterType = meterType;
     }
-public String getPreDegrees() {
+
+    public String getPreDegrees() {
         return preDegrees;
     }
-public void setPreDegrees(String preDegrees) {
+
+    public void setPreDegrees(String preDegrees) {
         this.preDegrees = preDegrees;
     }
-public String getObjId() {
+
+    public String getObjId() {
         return objId;
     }
-public void setObjId(String objId) {
+
+    public void setObjId(String objId) {
         this.objId = objId;
     }
-public String getPreReadingTime() {
+
+    public String getPreReadingTime() {
         return preReadingTime;
     }
-public void setPreReadingTime(String preReadingTime) {
+
+    public void setPreReadingTime(String preReadingTime) {
         this.preReadingTime = preReadingTime;
     }
-public String getCommunityId() {
+
+    public String getCommunityId() {
         return communityId;
     }
-public void setCommunityId(String communityId) {
+
+    public void setCommunityId(String communityId) {
         this.communityId = communityId;
     }
-public String getObjType() {
+
+    public String getObjType() {
         return objType;
     }
-public void setObjType(String objType) {
+
+    public void setObjType(String objType) {
         this.objType = objType;
     }
 
@@ -108,4 +129,12 @@ public void setObjType(String objType) {
     public void setStatusCd(String statusCd) {
         this.statusCd = statusCd;
     }
+
+    public String getFeeId() {
+        return feeId;
+    }
+
+    public void setFeeId(String feeId) {
+        this.feeId = feeId;
+    }
 }

+ 56 - 31
java110-bean/src/main/java/com/java110/po/meterWater/MeterWaterPo.java

@@ -1,81 +1,106 @@
 package com.java110.po.meterWater;
 
 import java.io.Serializable;
-import java.util.Date;
 
 public class MeterWaterPo implements Serializable {
 
     private String remark;
-private String curReadingTime;
-private String waterId;
-private String curDegrees;
-private String meterType;
-private String preDegrees;
-private String objId;
-private String preReadingTime;
-private String communityId;
-private String objType;
-public String getRemark() {
+    private String curReadingTime;
+    private String waterId;
+    private String curDegrees;
+    private String meterType;
+    private String preDegrees;
+    private String objId;
+    private String preReadingTime;
+    private String communityId;
+    private String objType;
+    private String feeId;
+
+    public String getRemark() {
         return remark;
     }
-public void setRemark(String remark) {
+
+    public void setRemark(String remark) {
         this.remark = remark;
     }
-public String getCurReadingTime() {
+
+    public String getCurReadingTime() {
         return curReadingTime;
     }
-public void setCurReadingTime(String curReadingTime) {
+
+    public void setCurReadingTime(String curReadingTime) {
         this.curReadingTime = curReadingTime;
     }
-public String getWaterId() {
+
+    public String getWaterId() {
         return waterId;
     }
-public void setWaterId(String waterId) {
+
+    public void setWaterId(String waterId) {
         this.waterId = waterId;
     }
-public String getCurDegrees() {
+
+    public String getCurDegrees() {
         return curDegrees;
     }
-public void setCurDegrees(String curDegrees) {
+
+    public void setCurDegrees(String curDegrees) {
         this.curDegrees = curDegrees;
     }
-public String getMeterType() {
+
+    public String getMeterType() {
         return meterType;
     }
-public void setMeterType(String meterType) {
+
+    public void setMeterType(String meterType) {
         this.meterType = meterType;
     }
-public String getPreDegrees() {
+
+    public String getPreDegrees() {
         return preDegrees;
     }
-public void setPreDegrees(String preDegrees) {
+
+    public void setPreDegrees(String preDegrees) {
         this.preDegrees = preDegrees;
     }
-public String getObjId() {
+
+    public String getObjId() {
         return objId;
     }
-public void setObjId(String objId) {
+
+    public void setObjId(String objId) {
         this.objId = objId;
     }
-public String getPreReadingTime() {
+
+    public String getPreReadingTime() {
         return preReadingTime;
     }
-public void setPreReadingTime(String preReadingTime) {
+
+    public void setPreReadingTime(String preReadingTime) {
         this.preReadingTime = preReadingTime;
     }
-public String getCommunityId() {
+
+    public String getCommunityId() {
         return communityId;
     }
-public void setCommunityId(String communityId) {
+
+    public void setCommunityId(String communityId) {
         this.communityId = communityId;
     }
-public String getObjType() {
+
+    public String getObjType() {
         return objType;
     }
-public void setObjType(String objType) {
+
+    public void setObjType(String objType) {
         this.objType = objType;
     }
 
+    public String getFeeId() {
+        return feeId;
+    }
 
-
+    public void setFeeId(String feeId) {
+        this.feeId = feeId;
+    }
 }

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

@@ -5,258 +5,272 @@
 <mapper namespace="meterWaterServiceDaoImpl">
 
     <!-- 保存水电费信息 add by wuxw 2018-07-03 -->
-       <insert id="saveBusinessMeterWaterInfo" parameterType="Map">
-           insert into business_meter_water(
-remark,cur_reading_time,water_id,cur_degrees,operate,create_time,meter_type,pre_degrees,obj_id,pre_reading_time,b_id,community_id,obj_type
-) values (
-#{remark},#{curReadingTime},#{waterId},#{curDegrees},#{operate},#{createTime},#{meterType},#{preDegrees},#{objId},#{preReadingTime},#{bId},#{communityId},#{objType}
-)
-       </insert>
-
-
-       <!-- 查询水电费信息(Business) add by wuxw 2018-07-03 -->
-       <select id="getBusinessMeterWaterInfo" parameterType="Map" resultType="Map">
-           select  t.remark,t.cur_reading_time,t.cur_reading_time curReadingTime,t.water_id,t.water_id waterId,t.cur_degrees,t.cur_degrees curDegrees,t.operate,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 
-from business_meter_water t 
-where 1 =1 
-<if test="remark !=null and remark != ''">
-   and t.remark= #{remark}
-</if> 
-<if test="curReadingTime !=null and curReadingTime != ''">
-   and t.cur_reading_time= #{curReadingTime}
-</if> 
-<if test="waterId !=null and waterId != ''">
-   and t.water_id= #{waterId}
-</if> 
-<if test="curDegrees !=null and curDegrees != ''">
-   and t.cur_degrees= #{curDegrees}
-</if> 
-<if test="operate !=null and operate != ''">
-   and t.operate= #{operate}
-</if> 
-<if test="createTime !=null and createTime != ''">
-   and t.create_time= #{createTime}
-</if> 
-<if test="meterType !=null and meterType != ''">
-   and t.meter_type= #{meterType}
-</if> 
-<if test="preDegrees !=null and preDegrees != ''">
-   and t.pre_degrees= #{preDegrees}
-</if> 
-<if test="objId !=null and objId != ''">
-   and t.obj_id= #{objId}
-</if> 
-<if test="preReadingTime !=null and preReadingTime != ''">
-   and t.pre_reading_time= #{preReadingTime}
-</if> 
-<if test="bId !=null and bId != ''">
-   and t.b_id= #{bId}
-</if> 
-<if test="communityId !=null and communityId != ''">
-   and t.community_id= #{communityId}
-</if> 
-<if test="objType !=null and objType != ''">
-   and t.obj_type= #{objType}
-</if> 
-
-       </select>
+    <insert id="saveBusinessMeterWaterInfo" parameterType="Map">
+        insert into business_meter_water(
+        remark,cur_reading_time,water_id,cur_degrees,operate,create_time,meter_type,pre_degrees,obj_id,pre_reading_time,
+        b_id,community_id,obj_type,fee_id
+        ) values (
+        #{remark},#{curReadingTime},#{waterId},#{curDegrees},#{operate},#{createTime},#{meterType},#{preDegrees},#{objId},
+        #{preReadingTime},#{bId},#{communityId},#{objType},#{feeId}
+        )
+    </insert>
 
 
+    <!-- 查询水电费信息(Business) add by wuxw 2018-07-03 -->
+    <select id="getBusinessMeterWaterInfo" parameterType="Map" resultType="Map">
+        select t.remark,t.cur_reading_time,t.cur_reading_time curReadingTime,t.water_id,t.water_id
+        waterId,t.cur_degrees,t.cur_degrees curDegrees,t.operate,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
+        from business_meter_water t
+        where 1 =1
+        <if test="remark !=null and remark != ''">
+            and t.remark= #{remark}
+        </if>
+        <if test="curReadingTime !=null and curReadingTime != ''">
+            and t.cur_reading_time= #{curReadingTime}
+        </if>
+        <if test="waterId !=null and waterId != ''">
+            and t.water_id= #{waterId}
+        </if>
+        <if test="curDegrees !=null and curDegrees != ''">
+            and t.cur_degrees= #{curDegrees}
+        </if>
+        <if test="operate !=null and operate != ''">
+            and t.operate= #{operate}
+        </if>
+        <if test="createTime !=null and createTime != ''">
+            and t.create_time= #{createTime}
+        </if>
+        <if test="meterType !=null and meterType != ''">
+            and t.meter_type= #{meterType}
+        </if>
+        <if test="preDegrees !=null and preDegrees != ''">
+            and t.pre_degrees= #{preDegrees}
+        </if>
+        <if test="objId !=null and objId != ''">
+            and t.obj_id= #{objId}
+        </if>
+        <if test="preReadingTime !=null and preReadingTime != ''">
+            and t.pre_reading_time= #{preReadingTime}
+        </if>
+        <if test="bId !=null and bId != ''">
+            and t.b_id= #{bId}
+        </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
+        <if test="objType !=null and objType != ''">
+            and t.obj_type= #{objType}
+        </if>
 
+    </select>
 
 
     <!-- 保存水电费信息至 instance表中 add by wuxw 2018-07-03 -->
     <insert id="saveMeterWaterInfoInstance" parameterType="Map">
         insert into meter_water(
-remark,status_cd,cur_reading_time,water_id,cur_degrees,create_time,meter_type,pre_degrees,obj_id,pre_reading_time,b_id,community_id,obj_type
-) select t.remark,'0',t.cur_reading_time,t.water_id,t.cur_degrees,t.create_time,t.meter_type,t.pre_degrees,t.obj_id,t.pre_reading_time,t.b_id,t.community_id,t.obj_type from business_meter_water t where 1=1
-<if test="remark !=null and remark != ''">
-   and t.remark= #{remark}
-</if> 
-<if test="curReadingTime !=null and curReadingTime != ''">
-   and t.cur_reading_time= #{curReadingTime}
-</if> 
-<if test="waterId !=null and waterId != ''">
-   and t.water_id= #{waterId}
-</if> 
-<if test="curDegrees !=null and curDegrees != ''">
-   and t.cur_degrees= #{curDegrees}
-</if> 
-   and t.operate= 'ADD'
-<if test="createTime !=null and createTime != ''">
-   and t.create_time= #{createTime}
-</if> 
-<if test="meterType !=null and meterType != ''">
-   and t.meter_type= #{meterType}
-</if> 
-<if test="preDegrees !=null and preDegrees != ''">
-   and t.pre_degrees= #{preDegrees}
-</if> 
-<if test="objId !=null and objId != ''">
-   and t.obj_id= #{objId}
-</if> 
-<if test="preReadingTime !=null and preReadingTime != ''">
-   and t.pre_reading_time= #{preReadingTime}
-</if> 
-<if test="bId !=null and bId != ''">
-   and t.b_id= #{bId}
-</if> 
-<if test="communityId !=null and communityId != ''">
-   and t.community_id= #{communityId}
-</if> 
-<if test="objType !=null and objType != ''">
-   and t.obj_type= #{objType}
-</if> 
+        remark,status_cd,cur_reading_time,water_id,cur_degrees,create_time,meter_type,pre_degrees,obj_id,pre_reading_time,b_id,community_id,obj_type,fee_id
+        ) select
+        t.remark,'0',t.cur_reading_time,t.water_id,t.cur_degrees,t.create_time,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
+        from business_meter_water t where 1=1
+        <if test="remark !=null and remark != ''">
+            and t.remark= #{remark}
+        </if>
+        <if test="curReadingTime !=null and curReadingTime != ''">
+            and t.cur_reading_time= #{curReadingTime}
+        </if>
+        <if test="waterId !=null and waterId != ''">
+            and t.water_id= #{waterId}
+        </if>
+        <if test="curDegrees !=null and curDegrees != ''">
+            and t.cur_degrees= #{curDegrees}
+        </if>
+        and t.operate= 'ADD'
+        <if test="createTime !=null and createTime != ''">
+            and t.create_time= #{createTime}
+        </if>
+        <if test="meterType !=null and meterType != ''">
+            and t.meter_type= #{meterType}
+        </if>
+        <if test="preDegrees !=null and preDegrees != ''">
+            and t.pre_degrees= #{preDegrees}
+        </if>
+        <if test="objId !=null and objId != ''">
+            and t.obj_id= #{objId}
+        </if>
+        <if test="preReadingTime !=null and preReadingTime != ''">
+            and t.pre_reading_time= #{preReadingTime}
+        </if>
+        <if test="bId !=null and bId != ''">
+            and t.b_id= #{bId}
+        </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
+        <if test="objType !=null and objType != ''">
+            and t.obj_type= #{objType}
+        </if>
 
     </insert>
 
 
-
     <!-- 查询水电费信息 add by wuxw 2018-07-03 -->
     <select id="getMeterWaterInfo" parameterType="Map" resultType="Map">
-        select  t.remark,t.status_cd,t.status_cd statusCd,t.cur_reading_time,t.cur_reading_time 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 
-from meter_water t 
-where 1 =1 
-<if test="remark !=null and remark != ''">
-   and t.remark= #{remark}
-</if> 
-<if test="statusCd !=null and statusCd != ''">
-   and t.status_cd= #{statusCd}
-</if> 
-<if test="curReadingTime !=null and curReadingTime != ''">
-   and t.cur_reading_time= #{curReadingTime}
-</if> 
-<if test="waterId !=null and waterId != ''">
-   and t.water_id= #{waterId}
-</if> 
-<if test="curDegrees !=null and curDegrees != ''">
-   and t.cur_degrees= #{curDegrees}
-</if> 
-<if test="createTime !=null and createTime != ''">
-   and t.create_time= #{createTime}
-</if> 
-<if test="meterType !=null and meterType != ''">
-   and t.meter_type= #{meterType}
-</if> 
-<if test="preDegrees !=null and preDegrees != ''">
-   and t.pre_degrees= #{preDegrees}
-</if> 
-<if test="objId !=null and objId != ''">
-   and t.obj_id= #{objId}
-</if> 
-<if test="preReadingTime !=null and preReadingTime != ''">
-   and t.pre_reading_time= #{preReadingTime}
-</if> 
-<if test="bId !=null and bId != ''">
-   and t.b_id= #{bId}
-</if> 
-<if test="communityId !=null and communityId != ''">
-   and t.community_id= #{communityId}
-</if> 
-<if test="objType !=null and objType != ''">
-   and t.obj_type= #{objType}
-</if> 
-order by t.create_time desc
-<if test="page != -1 and page != null ">
-   limit #{page}, #{row}
-</if> 
+        select t.remark,t.status_cd,t.status_cd statusCd,t.cur_reading_time,t.cur_reading_time
+        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
+        from meter_water t
+        where 1 =1
+        <if test="remark !=null and remark != ''">
+            and t.remark= #{remark}
+        </if>
+        <if test="statusCd !=null and statusCd != ''">
+            and t.status_cd= #{statusCd}
+        </if>
+        <if test="curReadingTime !=null and curReadingTime != ''">
+            and t.cur_reading_time= #{curReadingTime}
+        </if>
+        <if test="waterId !=null and waterId != ''">
+            and t.water_id= #{waterId}
+        </if>
+        <if test="curDegrees !=null and curDegrees != ''">
+            and t.cur_degrees= #{curDegrees}
+        </if>
+        <if test="createTime !=null and createTime != ''">
+            and t.create_time= #{createTime}
+        </if>
+        <if test="meterType !=null and meterType != ''">
+            and t.meter_type= #{meterType}
+        </if>
+        <if test="preDegrees !=null and preDegrees != ''">
+            and t.pre_degrees= #{preDegrees}
+        </if>
+        <if test="objId !=null and objId != ''">
+            and t.obj_id= #{objId}
+        </if>
+        <if test="preReadingTime !=null and preReadingTime != ''">
+            and t.pre_reading_time= #{preReadingTime}
+        </if>
+        <if test="bId !=null and bId != ''">
+            and t.b_id= #{bId}
+        </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
+        <if test="objType !=null and objType != ''">
+            and t.obj_type= #{objType}
+        </if>
+        <if test="feeId !=null and feeId != ''">
+            and t.fee_id = #{feeId}
+        </if>
+        order by t.create_time desc
+        <if test="page != -1 and page != null ">
+            limit #{page}, #{row}
+        </if>
 
     </select>
 
 
-
-
     <!-- 修改水电费信息 add by wuxw 2018-07-03 -->
     <update id="updateMeterWaterInfoInstance" parameterType="Map">
-        update  meter_water t set t.status_cd = #{statusCd}
-<if test="newBId != null and newBId != ''">
-,t.b_id = #{newBId}
-</if> 
-<if test="remark !=null and remark != ''">
-, t.remark= #{remark}
-</if> 
-<if test="curReadingTime !=null and curReadingTime != ''">
-, t.cur_reading_time= #{curReadingTime}
-</if> 
-<if test="curDegrees !=null and curDegrees != ''">
-, t.cur_degrees= #{curDegrees}
-</if> 
-<if test="createTime !=null and createTime != ''">
-, t.create_time= #{createTime}
-</if> 
-<if test="meterType !=null and meterType != ''">
-, t.meter_type= #{meterType}
-</if> 
-<if test="preDegrees !=null and preDegrees != ''">
-, t.pre_degrees= #{preDegrees}
-</if> 
-<if test="objId !=null and objId != ''">
-, t.obj_id= #{objId}
-</if> 
-<if test="preReadingTime !=null and preReadingTime != ''">
-, t.pre_reading_time= #{preReadingTime}
-</if> 
-<if test="communityId !=null and communityId != ''">
-, t.community_id= #{communityId}
-</if> 
-<if test="objType !=null and objType != ''">
-, t.obj_type= #{objType}
-</if> 
- where 1=1 <if test="waterId !=null and waterId != ''">
-and t.water_id= #{waterId}
-</if> 
-<if test="bId !=null and bId != ''">
-and t.b_id= #{bId}
-</if> 
+        update meter_water t set t.status_cd = #{statusCd}
+        <if test="newBId != null and newBId != ''">
+            ,t.b_id = #{newBId}
+        </if>
+        <if test="remark !=null and remark != ''">
+            , t.remark= #{remark}
+        </if>
+        <if test="curReadingTime !=null and curReadingTime != ''">
+            , t.cur_reading_time= #{curReadingTime}
+        </if>
+        <if test="curDegrees !=null and curDegrees != ''">
+            , t.cur_degrees= #{curDegrees}
+        </if>
+        <if test="createTime !=null and createTime != ''">
+            , t.create_time= #{createTime}
+        </if>
+        <if test="meterType !=null and meterType != ''">
+            , t.meter_type= #{meterType}
+        </if>
+        <if test="preDegrees !=null and preDegrees != ''">
+            , t.pre_degrees= #{preDegrees}
+        </if>
+        <if test="objId !=null and objId != ''">
+            , t.obj_id= #{objId}
+        </if>
+        <if test="preReadingTime !=null and preReadingTime != ''">
+            , t.pre_reading_time= #{preReadingTime}
+        </if>
+        <if test="communityId !=null and communityId != ''">
+            , t.community_id= #{communityId}
+        </if>
+        <if test="objType !=null and objType != ''">
+            , t.obj_type= #{objType}
+        </if>
+        where 1=1
+        <if test="waterId !=null and waterId != ''">
+            and t.water_id= #{waterId}
+        </if>
+        <if test="bId !=null and bId != ''">
+            and t.b_id= #{bId}
+        </if>
 
     </update>
 
     <!-- 查询水电费数量 add by wuxw 2018-07-03 -->
-     <select id="queryMeterWatersCount" parameterType="Map" resultType="Map">
-        select  count(1) count 
-from meter_water t 
-where 1 =1 
-<if test="remark !=null and remark != ''">
-   and t.remark= #{remark}
-</if> 
-<if test="statusCd !=null and statusCd != ''">
-   and t.status_cd= #{statusCd}
-</if> 
-<if test="curReadingTime !=null and curReadingTime != ''">
-   and t.cur_reading_time= #{curReadingTime}
-</if> 
-<if test="waterId !=null and waterId != ''">
-   and t.water_id= #{waterId}
-</if> 
-<if test="curDegrees !=null and curDegrees != ''">
-   and t.cur_degrees= #{curDegrees}
-</if> 
-<if test="createTime !=null and createTime != ''">
-   and t.create_time= #{createTime}
-</if> 
-<if test="meterType !=null and meterType != ''">
-   and t.meter_type= #{meterType}
-</if> 
-<if test="preDegrees !=null and preDegrees != ''">
-   and t.pre_degrees= #{preDegrees}
-</if> 
-<if test="objId !=null and objId != ''">
-   and t.obj_id= #{objId}
-</if> 
-<if test="preReadingTime !=null and preReadingTime != ''">
-   and t.pre_reading_time= #{preReadingTime}
-</if> 
-<if test="bId !=null and bId != ''">
-   and t.b_id= #{bId}
-</if> 
-<if test="communityId !=null and communityId != ''">
-   and t.community_id= #{communityId}
-</if> 
-<if test="objType !=null and objType != ''">
-   and t.obj_type= #{objType}
-</if> 
+    <select id="queryMeterWatersCount" parameterType="Map" resultType="Map">
+        select count(1) count
+        from meter_water t
+        where 1 =1
+        <if test="remark !=null and remark != ''">
+            and t.remark= #{remark}
+        </if>
+        <if test="statusCd !=null and statusCd != ''">
+            and t.status_cd= #{statusCd}
+        </if>
+        <if test="curReadingTime !=null and curReadingTime != ''">
+            and t.cur_reading_time= #{curReadingTime}
+        </if>
+        <if test="waterId !=null and waterId != ''">
+            and t.water_id= #{waterId}
+        </if>
+        <if test="curDegrees !=null and curDegrees != ''">
+            and t.cur_degrees= #{curDegrees}
+        </if>
+        <if test="createTime !=null and createTime != ''">
+            and t.create_time= #{createTime}
+        </if>
+        <if test="meterType !=null and meterType != ''">
+            and t.meter_type= #{meterType}
+        </if>
+        <if test="preDegrees !=null and preDegrees != ''">
+            and t.pre_degrees= #{preDegrees}
+        </if>
+        <if test="objId !=null and objId != ''">
+            and t.obj_id= #{objId}
+        </if>
+        <if test="preReadingTime !=null and preReadingTime != ''">
+            and t.pre_reading_time= #{preReadingTime}
+        </if>
+        <if test="bId !=null and bId != ''">
+            and t.b_id= #{bId}
+        </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
+        <if test="objType !=null and objType != ''">
+            and t.obj_type= #{objType}
+        </if>
+        <if test="feeId !=null and feeId != ''">
+            and t.fee_id = #{feeId}
+        </if>
 
 
-     </select>
+    </select>
 
 </mapper>

+ 45 - 71
java110-generator/src/main/resources/web/template_1.json

@@ -1,76 +1,76 @@
 {
-  "templateName":"房源",
-  "directories": "admin",
-  "templateCode":"rentingPool",
-  "templateKey":"rentingId",
-  "templateKeyName":"租房ID",
-  "searchCode": "rentingId",
-  "searchName": "租房ID",
+  "templateName":"抄表",
+  "directories": "property",
+  "templateCode":"meterWater",
+  "templateKey":"waterId",
+  "templateKeyName":"ID",
+  "searchCode": "waterId",
+  "searchName": "ID",
   "conditions": [
     {
-      "name": "租房名称",
+      "name": "表ID",
       "inputType": "input",
-      "code": "rentingTitle",
+      "code": "waterId",
       "whereCondition": "equal"
     },
     {
-      "name": "预付类型",
+      "name": "类型",
       "inputType": "select",
-      "selectValue":"1001,2002,3003",
-      "selectValueName":"押一付一,押一付三,押一付六",
-      "code": "paymentType",
+      "selectValue":"1010,2020",
+      "selectValueName":"电表,水表",
+      "code": "meterType",
       "whereCondition": "equal"
     },
     {
-      "name": "业主名称",
+      "name": "房屋编号",
       "inputType": "input",
-      "code": "ownerName",
+      "code": "roomNum",
       "whereCondition": "equal"
     }
   ],
   "columns":[
     {
-      "code": "rentingTitle",
-      "cnCode":"出租标题",
-      "desc":"必填,请填写出租标题",
+      "code": "meterType",
+      "cnCode":"表类型",
+      "desc":"必填,请选择表类型",
       "required":true,
       "hasDefaultValue":false,
-      "inputType": "input",
-      "limit":"maxLength",
-      "limitParam":"100",
-      "limitErrInfo":"标题太长 超过100位",
+      "inputType": "select",
+      "selectValue":"1010,2020",
+      "selectValueName":"电表,水表",
+      "limit":"num",
+      "limitParam":"",
+      "limitErrInfo":"表类型错误",
       "show": true
     },
     {
-      "code": "price",
-      "cnCode":"租金",
-      "desc":"必填,请填写出租金",
+      "code": "preDegrees",
+      "cnCode":"上期度数",
+      "desc":"必填,请填写上期度数",
       "required":true,
       "hasDefaultValue":false,
       "inputType": "input",
       "limit":"money",
       "limitParam":"",
-      "limitErrInfo":"格式错误",
+      "limitErrInfo":"上期度数格式错误",
       "show": true
     },
     {
-      "inputType": "select",
-      "selectValue":"1001,2002,3003",
-      "selectValueName":"押一付一,押一付三,押一付六",
-      "code": "paymentType",
-      "cnCode":"预付类型",
-      "desc":"必填,请填写值",
+      "code": "curDegrees",
+      "cnCode":"本期度数",
+      "desc":"必填,请填写本期度数",
       "required":true,
       "hasDefaultValue":false,
-      "limit":"num",
+      "inputType": "input",
+      "limit":"money",
       "limitParam":"",
-      "limitErrInfo":"格式错误",
+      "limitErrInfo":"本期度数格式错误",
       "show": true
     },
     {
-      "code": "checkInDate",
-      "cnCode":"入住时间",
-      "desc":"必填,请填写入住时间",
+      "code": "preReadingTime",
+      "cnCode":"上期读表时间",
+      "desc":"必填,请填写上期读表时间",
       "required":true,
       "hasDefaultValue":false,
       "inputType": "input",
@@ -80,23 +80,21 @@
       "show": true
     },
     {
-      "code":"rentingConfigId",
-      "cnCode":"出租配置",
-      "desc":"必填,请选择出租配置",
+      "code": "curReadingTime",
+      "cnCode":"本期读表时间",
+      "desc":"必填,请填写本期读表时间",
       "required":true,
       "hasDefaultValue":false,
-      "inputType": "select",
-      "selectValue":"1001,2002",
-      "selectValueName":"出租配置,每月租金比例",
-      "limit":"num",
+      "inputType": "input",
+      "limit":"date",
       "limitParam":"",
-      "limitErrInfo":"显示格式错误",
+      "limitErrInfo":"格式错误",
       "show": true
     },
     {
-      "code": "rentingDesc",
+      "code": "remark",
       "cnCode":"备注",
-      "desc":"选填,请填写租客收费比率",
+      "desc":"选填,请填写备注",
       "required":false,
       "hasDefaultValue":false,
       "inputType": "input",
@@ -104,30 +102,6 @@
       "limitParam":"500",
       "limitErrInfo":"备注格式错误",
       "show": false
-    },
-    {
-      "code": "ownerName",
-      "cnCode":"业主名称",
-      "desc":"必填,请填写业主名称",
-      "required":true,
-      "hasDefaultValue":false,
-      "inputType": "input",
-      "limit":"maxLength",
-      "limitParam":"100",
-      "limitErrInfo":"业主名称太长",
-      "show": true
-    },
-    {
-      "code": "ownerTel",
-      "cnCode":"业主电话",
-      "desc":"必填,请填写业主电话",
-      "required":true,
-      "hasDefaultValue":false,
-      "inputType": "input",
-      "limit":"phone",
-      "limitParam":"",
-      "limitErrInfo":"业主电话格式错误",
-      "show": true
     }
   ]
 }

+ 133 - 0
java110-generator/src/main/resources/web/template_rentingPool.json

@@ -0,0 +1,133 @@
+{
+  "templateName":"房源",
+  "directories": "admin",
+  "templateCode":"rentingPool",
+  "templateKey":"rentingId",
+  "templateKeyName":"租房ID",
+  "searchCode": "rentingId",
+  "searchName": "租房ID",
+  "conditions": [
+    {
+      "name": "租房名称",
+      "inputType": "input",
+      "code": "rentingTitle",
+      "whereCondition": "equal"
+    },
+    {
+      "name": "预付类型",
+      "inputType": "select",
+      "selectValue":"1001,2002,3003",
+      "selectValueName":"押一付一,押一付三,押一付六",
+      "code": "paymentType",
+      "whereCondition": "equal"
+    },
+    {
+      "name": "业主名称",
+      "inputType": "input",
+      "code": "ownerName",
+      "whereCondition": "equal"
+    }
+  ],
+  "columns":[
+    {
+      "code": "rentingTitle",
+      "cnCode":"出租标题",
+      "desc":"必填,请填写出租标题",
+      "required":true,
+      "hasDefaultValue":false,
+      "inputType": "input",
+      "limit":"maxLength",
+      "limitParam":"100",
+      "limitErrInfo":"标题太长 超过100位",
+      "show": true
+    },
+    {
+      "code": "price",
+      "cnCode":"租金",
+      "desc":"必填,请填写出租金",
+      "required":true,
+      "hasDefaultValue":false,
+      "inputType": "input",
+      "limit":"money",
+      "limitParam":"",
+      "limitErrInfo":"格式错误",
+      "show": true
+    },
+    {
+      "inputType": "select",
+      "selectValue":"1001,2002,3003",
+      "selectValueName":"押一付一,押一付三,押一付六",
+      "code": "paymentType",
+      "cnCode":"预付类型",
+      "desc":"必填,请填写值",
+      "required":true,
+      "hasDefaultValue":false,
+      "limit":"num",
+      "limitParam":"",
+      "limitErrInfo":"格式错误",
+      "show": true
+    },
+    {
+      "code": "checkInDate",
+      "cnCode":"入住时间",
+      "desc":"必填,请填写入住时间",
+      "required":true,
+      "hasDefaultValue":false,
+      "inputType": "input",
+      "limit":"date",
+      "limitParam":"",
+      "limitErrInfo":"格式错误",
+      "show": true
+    },
+    {
+      "code":"rentingConfigId",
+      "cnCode":"出租配置",
+      "desc":"必填,请选择出租配置",
+      "required":true,
+      "hasDefaultValue":false,
+      "inputType": "select",
+      "selectValue":"1001,2002",
+      "selectValueName":"出租配置,每月租金比例",
+      "limit":"num",
+      "limitParam":"",
+      "limitErrInfo":"显示格式错误",
+      "show": true
+    },
+    {
+      "code": "rentingDesc",
+      "cnCode":"备注",
+      "desc":"选填,请填写租客收费比率",
+      "required":false,
+      "hasDefaultValue":false,
+      "inputType": "input",
+      "limit":"maxLength",
+      "limitParam":"500",
+      "limitErrInfo":"备注格式错误",
+      "show": false
+    },
+    {
+      "code": "ownerName",
+      "cnCode":"业主名称",
+      "desc":"必填,请填写业主名称",
+      "required":true,
+      "hasDefaultValue":false,
+      "inputType": "input",
+      "limit":"maxLength",
+      "limitParam":"100",
+      "limitErrInfo":"业主名称太长",
+      "show": true
+    },
+    {
+      "code": "ownerTel",
+      "cnCode":"业主电话",
+      "desc":"必填,请填写业主电话",
+      "required":true,
+      "hasDefaultValue":false,
+      "inputType": "input",
+      "limit":"phone",
+      "limitParam":"",
+      "limitErrInfo":"业主电话格式错误",
+      "show": true
+    }
+  ]
+}

+ 37 - 1
service-api/src/main/java/com/java110/api/listener/meterWater/SaveMeterWaterListener.java

@@ -1,13 +1,22 @@
 package com.java110.api.listener.meterWater;
 
 import com.alibaba.fastjson.JSONObject;
+import com.java110.api.bmo.fee.IFeeBMO;
 import com.java110.api.bmo.meterWater.IMeterWaterBMO;
 import com.java110.api.listener.AbstractServiceApiPlusListener;
 import com.java110.core.annotation.Java110Listener;
 import com.java110.core.context.DataFlowContext;
 import com.java110.core.event.service.api.ServiceDataFlowEvent;
+import com.java110.core.factory.GenerateCodeFactory;
+import com.java110.dto.fee.FeeConfigDto;
+import com.java110.dto.fee.FeeDto;
+import com.java110.po.fee.PayFeePo;
+import com.java110.utils.constant.BusinessTypeConstant;
+import com.java110.utils.constant.CommonConstant;
 import com.java110.utils.constant.ServiceCodeMeterWaterConstant;
 import com.java110.utils.util.Assert;
+import com.java110.utils.util.BeanConvertUtil;
+import com.java110.utils.util.DateUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpMethod;
 
@@ -21,11 +30,15 @@ public class SaveMeterWaterListener extends AbstractServiceApiPlusListener {
     @Autowired
     private IMeterWaterBMO meterWaterBMOImpl;
 
+    @Autowired
+    private IFeeBMO feeBMOImpl;
+
     @Override
     protected void validate(ServiceDataFlowEvent event, JSONObject reqJson) {
         //Assert.hasKeyAndValue(reqJson, "xxx", "xxx");
 
-        Assert.hasKeyAndValue(reqJson, "meterType", "请求报文中未包含meterType");
+        Assert.hasKeyAndValue(reqJson, "feeTypeCd", "请求报文中未包含费用类型");
+        Assert.hasKeyAndValue(reqJson, "configId", "请求报文中未包含费用项");
         Assert.hasKeyAndValue(reqJson, "objType", "请求报文中未包含objType");
         Assert.hasKeyAndValue(reqJson, "objId", "请求报文中未包含objId");
         Assert.hasKeyAndValue(reqJson, "preDegrees", "请求报文中未包含preDegrees");
@@ -38,6 +51,29 @@ public class SaveMeterWaterListener extends AbstractServiceApiPlusListener {
 
     @Override
     protected void doSoService(ServiceDataFlowEvent event, DataFlowContext context, JSONObject reqJson) {
+
+        if (FeeConfigDto.FEE_TYPE_CD_WATER.equals(reqJson.getString("feeTypeCd"))) {
+            reqJson.put("meterType", "1010");
+        } else {
+            reqJson.put("meterType", "2020");
+        }
+
+        PayFeePo payFeePo = BeanConvertUtil.covertBean(reqJson, PayFeePo.class);
+        payFeePo.setFeeId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_feeId));
+        payFeePo.setIncomeObjId(reqJson.getString("storeId"));
+        payFeePo.setAmount("-1");
+        payFeePo.setStartTime(reqJson.getString("preDegrees"));
+        payFeePo.setEndTime(reqJson.getString("preDegrees"));
+        payFeePo.setPayerObjId(reqJson.getString("objId"));
+        payFeePo.setPayerObjType(FeeDto.PAYER_OBJ_TYPE_ROOM);
+        payFeePo.setFeeFlag(FeeDto.FEE_FLAG_ONCE);
+        payFeePo.setState(FeeDto.STATE_DOING);
+        payFeePo.setUserId(context.getRequestCurrentHeaders().get(CommonConstant.HTTP_USER_ID));
+
+        super.insert(context, payFeePo, BusinessTypeConstant.BUSINESS_TYPE_SAVE_FEE_INFO);
+
+        reqJson.put("feeId",payFeePo.getFeeId());
+
         meterWaterBMOImpl.addMeterWater(reqJson, context);
     }
 

+ 41 - 0
service-fee/src/main/java/com/java110/fee/api/MeterWaterApi.java

@@ -0,0 +1,41 @@
+package com.java110.fee.api;
+
+import com.java110.dto.meterWater.MeterWaterDto;
+import com.java110.fee.bmo.meterWater.IQueryPreMeterWater;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+@RequestMapping(value = "/meterWater")
+public class MeterWaterApi {
+
+
+    @Autowired
+    private IQueryPreMeterWater queryPreMeterWaterImpl;
+
+
+    /**
+     * 查询上期度数信息
+     *
+     * @param communityId 小区ID
+     * @return
+     * @serviceCode /meterWater/queryPreMeterWater
+     * @path /app/meterWater/queryPreMeterWater
+     */
+    @RequestMapping(value = "/queryPreMeterWater", method = RequestMethod.GET)
+    public ResponseEntity<String> queryPreMeterWater(@RequestParam(value = "communityId") String communityId,
+                                                     @RequestParam(value = "objId") String objId,
+                                                     @RequestParam(value = "objType") String objType) {
+        MeterWaterDto meterWaterDto = new MeterWaterDto();
+        meterWaterDto.setObjId(objId);
+        meterWaterDto.setObjType(objType);
+        meterWaterDto.setPage(1);
+        meterWaterDto.setRow(1);
+        meterWaterDto.setCommunityId(communityId);
+        return queryPreMeterWaterImpl.query(meterWaterDto);
+    }
+}

+ 18 - 0
service-fee/src/main/java/com/java110/fee/bmo/meterWater/IQueryPreMeterWater.java

@@ -0,0 +1,18 @@
+package com.java110.fee.bmo.meterWater;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.dto.meterWater.MeterWaterDto;
+import org.springframework.http.ResponseEntity;
+
+/**
+ * 查询上期信息
+ */
+public interface IQueryPreMeterWater {
+
+    /**
+     * 查询记录
+     * @param meterWaterDto 表信息
+     * @return
+     */
+    ResponseEntity<String> query(MeterWaterDto meterWaterDto);
+}

+ 34 - 0
service-fee/src/main/java/com/java110/fee/bmo/meterWater/impl/QueryPreMeterWaterImpl.java

@@ -0,0 +1,34 @@
+package com.java110.fee.bmo.meterWater.impl;
+
+import com.java110.dto.meterWater.MeterWaterDto;
+import com.java110.fee.bmo.meterWater.IQueryPreMeterWater;
+import com.java110.intf.fee.IMeterWaterInnerServiceSMO;
+import com.java110.vo.ResultVo;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * 上期度数查询
+ */
+@Service
+public class QueryPreMeterWaterImpl implements IQueryPreMeterWater {
+
+    private static Logger logger = LoggerFactory.getLogger(QueryPreMeterWaterImpl.class);
+
+    @Autowired
+    private IMeterWaterInnerServiceSMO meterWaterInnerServiceSMOImpl;
+
+
+    @Override
+    public ResponseEntity<String> query(MeterWaterDto meterWaterDto) {
+
+        List<MeterWaterDto> meterWaterDtos = meterWaterInnerServiceSMOImpl.queryMeterWaters(meterWaterDto);
+        int total = meterWaterDtos == null ? 0 : meterWaterDtos.size();
+        return ResultVo.createResponseEntity(1, total, meterWaterDtos);
+    }
+}

+ 2 - 0
service-fee/src/main/java/com/java110/fee/listener/meterWater/AbstractMeterWaterBusinessServiceDataFlowListener.java

@@ -49,6 +49,7 @@ public abstract class AbstractMeterWaterBusinessServiceDataFlowListener extends
         businessMeterWaterInfo.put("preReadingTime", businessMeterWaterInfo.get("pre_reading_time"));
         businessMeterWaterInfo.put("communityId", businessMeterWaterInfo.get("community_id"));
         businessMeterWaterInfo.put("objType", businessMeterWaterInfo.get("obj_type"));
+        businessMeterWaterInfo.put("feeId", businessMeterWaterInfo.get("fee_id"));
         businessMeterWaterInfo.remove("bId");
         businessMeterWaterInfo.put("statusCd", statusCd);
     }
@@ -85,6 +86,7 @@ public abstract class AbstractMeterWaterBusinessServiceDataFlowListener extends
         currentMeterWaterInfo.put("preReadingTime", currentMeterWaterInfo.get("pre_reading_time"));
         currentMeterWaterInfo.put("communityId", currentMeterWaterInfo.get("community_id"));
         currentMeterWaterInfo.put("objType", currentMeterWaterInfo.get("obj_type"));
+        currentMeterWaterInfo.put("feeId", currentMeterWaterInfo.get("fee_id"));
 
 
         currentMeterWaterInfo.put("operate", StatusConstant.OPERATE_DEL);