java110 пре 5 година
родитељ
комит
e97a800003

+ 40 - 16
java110-bean/src/main/java/com/java110/dto/feeDiscount/FeeDiscountDto.java

@@ -1,8 +1,11 @@
 package com.java110.dto.feeDiscount;
 
 import com.java110.dto.PageDto;
+import com.java110.dto.feeDiscountSpec.FeeDiscountSpecDto;
+
 import java.io.Serializable;
 import java.util.Date;
+import java.util.List;
 
 /**
  * @ClassName FloorDto
@@ -15,11 +18,13 @@ import java.util.Date;
 public class FeeDiscountDto extends PageDto implements Serializable {
 
     private String discountName;
-private String discountDesc;
-private String discountType;
-private String discountId;
-private String communityId;
-private String ruleId;
+    private String discountDesc;
+    private String discountType;
+    private String discountId;
+    private String communityId;
+    private String ruleId;
+
+    private List<FeeDiscountSpecDto> feeDiscountSpecs;
 
 
     private Date createTime;
@@ -30,37 +35,48 @@ private String ruleId;
     public String getDiscountName() {
         return discountName;
     }
-public void setDiscountName(String discountName) {
+
+    public void setDiscountName(String discountName) {
         this.discountName = discountName;
     }
-public String getDiscountDesc() {
+
+    public String getDiscountDesc() {
         return discountDesc;
     }
-public void setDiscountDesc(String discountDesc) {
+
+    public void setDiscountDesc(String discountDesc) {
         this.discountDesc = discountDesc;
     }
-public String getDiscountType() {
+
+    public String getDiscountType() {
         return discountType;
     }
-public void setDiscountType(String discountType) {
+
+    public void setDiscountType(String discountType) {
         this.discountType = discountType;
     }
-public String getDiscountId() {
+
+    public String getDiscountId() {
         return discountId;
     }
-public void setDiscountId(String discountId) {
+
+    public void setDiscountId(String discountId) {
         this.discountId = discountId;
     }
-public String getCommunityId() {
+
+    public String getCommunityId() {
         return communityId;
     }
-public void setCommunityId(String communityId) {
+
+    public void setCommunityId(String communityId) {
         this.communityId = communityId;
     }
-public String getRuleId() {
+
+    public String getRuleId() {
         return ruleId;
     }
-public void setRuleId(String ruleId) {
+
+    public void setRuleId(String ruleId) {
         this.ruleId = ruleId;
     }
 
@@ -80,4 +96,12 @@ public void setRuleId(String ruleId) {
     public void setStatusCd(String statusCd) {
         this.statusCd = statusCd;
     }
+
+    public List<FeeDiscountSpecDto> getFeeDiscountSpecs() {
+        return feeDiscountSpecs;
+    }
+
+    public void setFeeDiscountSpecs(List<FeeDiscountSpecDto> feeDiscountSpecs) {
+        this.feeDiscountSpecs = feeDiscountSpecs;
+    }
 }

+ 9 - 0
java110-bean/src/main/java/com/java110/dto/feeDiscountRule/FeeDiscountRuleDto.java

@@ -21,6 +21,7 @@ public class FeeDiscountRuleDto extends PageDto implements Serializable {
     private String remark;
     private String ruleId;
     private String beanImpl;
+    private String discountType;
 
     private List<FeeDiscountRuleSpecDto> feeDiscountRuleSpecs;
 
@@ -86,4 +87,12 @@ public class FeeDiscountRuleDto extends PageDto implements Serializable {
     public void setFeeDiscountRuleSpecs(List<FeeDiscountRuleSpecDto> feeDiscountRuleSpecs) {
         this.feeDiscountRuleSpecs = feeDiscountRuleSpecs;
     }
+
+    public String getDiscountType() {
+        return discountType;
+    }
+
+    public void setDiscountType(String discountType) {
+        this.discountType = discountType;
+    }
 }

+ 32 - 13
java110-bean/src/main/java/com/java110/dto/feeDiscountSpec/FeeDiscountSpecDto.java

@@ -1,6 +1,7 @@
 package com.java110.dto.feeDiscountSpec;
 
 import com.java110.dto.PageDto;
+
 import java.io.Serializable;
 import java.util.Date;
 
@@ -15,10 +16,11 @@ import java.util.Date;
 public class FeeDiscountSpecDto extends PageDto implements Serializable {
 
     private String specId;
-private String specName;
-private String specValue;
-private String discountId;
-private String communityId;
+    private String specName;
+    private String specValue;
+    private String discountId;
+    private String[] discountIds;
+    private String communityId;
 
 
     private Date createTime;
@@ -29,31 +31,40 @@ private String communityId;
     public String getSpecId() {
         return specId;
     }
-public void setSpecId(String specId) {
+
+    public void setSpecId(String specId) {
         this.specId = specId;
     }
-public String getSpecName() {
+
+    public String getSpecName() {
         return specName;
     }
-public void setSpecName(String specName) {
+
+    public void setSpecName(String specName) {
         this.specName = specName;
     }
-public String getSpecValue() {
+
+    public String getSpecValue() {
         return specValue;
     }
-public void setSpecValue(String specValue) {
+
+    public void setSpecValue(String specValue) {
         this.specValue = specValue;
     }
-public String getDiscountId() {
+
+    public String getDiscountId() {
         return discountId;
     }
-public void setDiscountId(String discountId) {
+
+    public void setDiscountId(String discountId) {
         this.discountId = discountId;
     }
-public String getCommunityId() {
+
+    public String getCommunityId() {
         return communityId;
     }
-public void setCommunityId(String communityId) {
+
+    public void setCommunityId(String communityId) {
         this.communityId = communityId;
     }
 
@@ -73,4 +84,12 @@ public void setCommunityId(String communityId) {
     public void setStatusCd(String statusCd) {
         this.statusCd = statusCd;
     }
+
+    public String[] getDiscountIds() {
+        return discountIds;
+    }
+
+    public void setDiscountIds(String[] discountIds) {
+        this.discountIds = discountIds;
+    }
 }

+ 70 - 68
java110-db/src/main/resources/mapper/fee/FeeDiscountRuleServiceDaoImplMapper.xml

@@ -5,93 +5,95 @@
 <mapper namespace="feeDiscountRuleServiceDaoImpl">
 
 
-
-
-
     <!-- 保存费用折扣规则信息 add by wuxw 2018-07-03 -->
     <insert id="saveFeeDiscountRuleInfo" parameterType="Map">
         insert into fee_discount_rule(
-rule_name,remark,rule_id,bean_impl
-) values (
-#{ruleName},#{remark},#{ruleId},#{beanImpl}
-)
+        rule_name,remark,rule_id,bean_impl,#{discount_type}
+        ) values (
+        #{ruleName},#{remark},#{ruleId},#{beanImpl},#{discountType}
+        )
     </insert>
 
 
-
     <!-- 查询费用折扣规则信息 add by wuxw 2018-07-03 -->
     <select id="getFeeDiscountRuleInfo" parameterType="Map" resultType="Map">
-        select  t.rule_name,t.rule_name ruleName,t.remark,t.status_cd,t.status_cd statusCd,t.rule_id,t.rule_id ruleId,t.bean_impl,t.bean_impl beanImpl 
-from fee_discount_rule t 
-where 1 =1 
-<if test="ruleName !=null and ruleName != ''">
-   and t.rule_name= #{ruleName}
-</if> 
-<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="ruleId !=null and ruleId != ''">
-   and t.rule_id= #{ruleId}
-</if> 
-<if test="beanImpl !=null and beanImpl != ''">
-   and t.bean_impl= #{beanImpl}
-</if> 
-order by t.create_time desc
-<if test="page != -1 and page != null ">
-   limit #{page}, #{row}
-</if> 
+        select t.rule_name,t.rule_name ruleName,t.remark,t.status_cd,t.status_cd statusCd,t.rule_id,t.rule_id
+        ruleId,t.bean_impl,t.bean_impl beanImpl,t.discount_type discountType
+        from fee_discount_rule t
+        where 1 =1
+        <if test="ruleName !=null and ruleName != ''">
+            and t.rule_name= #{ruleName}
+        </if>
+        <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="ruleId !=null and ruleId != ''">
+            and t.rule_id= #{ruleId}
+        </if>
+        <if test="beanImpl !=null and beanImpl != ''">
+            and t.bean_impl= #{beanImpl}
+        </if>
+        <if test="discountType !=null and discountType != ''">
+            and t.discount_type= #{discountType}
+        </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="updateFeeDiscountRuleInfo" parameterType="Map">
-        update  fee_discount_rule t set t.status_cd = #{statusCd}
-<if test="newBId != null and newBId != ''">
-,t.b_id = #{newBId}
-</if> 
-<if test="ruleName !=null and ruleName != ''">
-, t.rule_name= #{ruleName}
-</if> 
-<if test="remark !=null and remark != ''">
-, t.remark= #{remark}
-</if> 
-<if test="beanImpl !=null and beanImpl != ''">
-, t.bean_impl= #{beanImpl}
-</if> 
- where 1=1 <if test="ruleId !=null and ruleId != ''">
-and t.rule_id= #{ruleId}
-</if> 
+        update fee_discount_rule t set t.status_cd = #{statusCd}
+        <if test="newBId != null and newBId != ''">
+            ,t.b_id = #{newBId}
+        </if>
+        <if test="ruleName !=null and ruleName != ''">
+            , t.rule_name= #{ruleName}
+        </if>
+        <if test="remark !=null and remark != ''">
+            , t.remark= #{remark}
+        </if>
+        <if test="beanImpl !=null and beanImpl != ''">
+            , t.bean_impl= #{beanImpl}
+        </if>
+        where 1=1
+        <if test="ruleId !=null and ruleId != ''">
+            and t.rule_id= #{ruleId}
+        </if>
 
     </update>
 
     <!-- 查询费用折扣规则数量 add by wuxw 2018-07-03 -->
-     <select id="queryFeeDiscountRulesCount" parameterType="Map" resultType="Map">
-        select  count(1) count 
-from fee_discount_rule t 
-where 1 =1 
-<if test="ruleName !=null and ruleName != ''">
-   and t.rule_name= #{ruleName}
-</if> 
-<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="ruleId !=null and ruleId != ''">
-   and t.rule_id= #{ruleId}
-</if> 
-<if test="beanImpl !=null and beanImpl != ''">
-   and t.bean_impl= #{beanImpl}
-</if> 
+    <select id="queryFeeDiscountRulesCount" parameterType="Map" resultType="Map">
+        select count(1) count
+        from fee_discount_rule t
+        where 1 =1
+        <if test="ruleName !=null and ruleName != ''">
+            and t.rule_name= #{ruleName}
+        </if>
+        <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="ruleId !=null and ruleId != ''">
+            and t.rule_id= #{ruleId}
+        </if>
+        <if test="beanImpl !=null and beanImpl != ''">
+            and t.bean_impl= #{beanImpl}
+        </if>
+        <if test="discountType !=null and discountType != ''">
+            and t.discount_type= #{discountType}
+        </if>
 
 
-     </select>
+    </select>
 
 </mapper>

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

@@ -20,7 +20,7 @@
         select t.discount_name,t.discount_name discountName,t.discount_desc,t.discount_desc
         discountDesc,t.discount_type,t.discount_type discountType,t.status_cd,t.status_cd
         statusCd,t.discount_id,t.discount_id discountId,t.community_id,t.community_id communityId,t.rule_id,t.rule_id
-        ruleId
+        ruleId,t.create_time createTime
         from fee_discount t
         where 1 =1
         <if test="discountName !=null and discountName != ''">

+ 80 - 77
java110-db/src/main/resources/mapper/fee/FeeDiscountSpecServiceDaoImplMapper.xml

@@ -5,102 +5,105 @@
 <mapper namespace="feeDiscountSpecServiceDaoImpl">
 
 
-
-
-
     <!-- 保存费用折扣信息 add by wuxw 2018-07-03 -->
     <insert id="saveFeeDiscountSpecInfo" parameterType="Map">
         insert into fee_discount_spec(
-spec_id,spec_name,spec_value,discount_id,community_id
-) values (
-#{specId},#{specName},#{specValue},#{discountId},#{communityId}
-)
+        spec_id,spec_name,spec_value,discount_id,community_id
+        ) values (
+        #{specId},#{specName},#{specValue},#{discountId},#{communityId}
+        )
     </insert>
 
 
-
     <!-- 查询费用折扣信息 add by wuxw 2018-07-03 -->
     <select id="getFeeDiscountSpecInfo" parameterType="Map" resultType="Map">
-        select  t.spec_id,t.spec_id specId,t.spec_name,t.spec_name specName,t.spec_value,t.spec_value specValue,t.status_cd,t.status_cd statusCd,t.discount_id,t.discount_id discountId,t.community_id,t.community_id communityId 
-from fee_discount_spec t 
-where 1 =1 
-<if test="specId !=null and specId != ''">
-   and t.spec_id= #{specId}
-</if> 
-<if test="specName !=null and specName != ''">
-   and t.spec_name= #{specName}
-</if> 
-<if test="specValue !=null and specValue != ''">
-   and t.spec_value= #{specValue}
-</if> 
-<if test="statusCd !=null and statusCd != ''">
-   and t.status_cd= #{statusCd}
-</if> 
-<if test="discountId !=null and discountId != ''">
-   and t.discount_id= #{discountId}
-</if> 
-<if test="communityId !=null and communityId != ''">
-   and t.community_id= #{communityId}
-</if> 
-order by t.create_time desc
-<if test="page != -1 and page != null ">
-   limit #{page}, #{row}
-</if> 
+        select t.spec_id,t.spec_id specId,t.spec_name,t.spec_name specName,t.spec_value,t.spec_value
+        specValue,t.status_cd,t.status_cd statusCd,t.discount_id,t.discount_id discountId,t.community_id,t.community_id
+        communityId
+        from fee_discount_spec t
+        where 1 =1
+        <if test="specId !=null and specId != ''">
+            and t.spec_id= #{specId}
+        </if>
+        <if test="specName !=null and specName != ''">
+            and t.spec_name= #{specName}
+        </if>
+        <if test="specValue !=null and specValue != ''">
+            and t.spec_value= #{specValue}
+        </if>
+        <if test="statusCd !=null and statusCd != ''">
+            and t.status_cd= #{statusCd}
+        </if>
+        <if test="discountId !=null and discountId != ''">
+            and t.discount_id= #{discountId}
+        </if>
+        <if test="discountIds !=null ">
+            and t.discount_id in
+            <foreach collection="discountIds" item="item" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </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="updateFeeDiscountSpecInfo" parameterType="Map">
-        update  fee_discount_spec t set t.status_cd = #{statusCd}
-<if test="newBId != null and newBId != ''">
-,t.b_id = #{newBId}
-</if> 
-<if test="specName !=null and specName != ''">
-, t.spec_name= #{specName}
-</if> 
-<if test="specValue !=null and specValue != ''">
-, t.spec_value= #{specValue}
-</if> 
-<if test="discountId !=null and discountId != ''">
-, t.discount_id= #{discountId}
-</if> 
-<if test="communityId !=null and communityId != ''">
-, t.community_id= #{communityId}
-</if> 
- where 1=1 <if test="specId !=null and specId != ''">
-and t.spec_id= #{specId}
-</if> 
+        update fee_discount_spec t set t.status_cd = #{statusCd}
+        <if test="newBId != null and newBId != ''">
+            ,t.b_id = #{newBId}
+        </if>
+        <if test="specName !=null and specName != ''">
+            , t.spec_name= #{specName}
+        </if>
+        <if test="specValue !=null and specValue != ''">
+            , t.spec_value= #{specValue}
+        </if>
+        <if test="discountId !=null and discountId != ''">
+            , t.discount_id= #{discountId}
+        </if>
+        <if test="communityId !=null and communityId != ''">
+            , t.community_id= #{communityId}
+        </if>
+        where 1=1
+        <if test="specId !=null and specId != ''">
+            and t.spec_id= #{specId}
+        </if>
 
     </update>
 
     <!-- 查询费用折扣数量 add by wuxw 2018-07-03 -->
-     <select id="queryFeeDiscountSpecsCount" parameterType="Map" resultType="Map">
-        select  count(1) count 
-from fee_discount_spec t 
-where 1 =1 
-<if test="specId !=null and specId != ''">
-   and t.spec_id= #{specId}
-</if> 
-<if test="specName !=null and specName != ''">
-   and t.spec_name= #{specName}
-</if> 
-<if test="specValue !=null and specValue != ''">
-   and t.spec_value= #{specValue}
-</if> 
-<if test="statusCd !=null and statusCd != ''">
-   and t.status_cd= #{statusCd}
-</if> 
-<if test="discountId !=null and discountId != ''">
-   and t.discount_id= #{discountId}
-</if> 
-<if test="communityId !=null and communityId != ''">
-   and t.community_id= #{communityId}
-</if> 
+    <select id="queryFeeDiscountSpecsCount" parameterType="Map" resultType="Map">
+        select count(1) count
+        from fee_discount_spec t
+        where 1 =1
+        <if test="specId !=null and specId != ''">
+            and t.spec_id= #{specId}
+        </if>
+        <if test="specName !=null and specName != ''">
+            and t.spec_name= #{specName}
+        </if>
+        <if test="specValue !=null and specValue != ''">
+            and t.spec_value= #{specValue}
+        </if>
+        <if test="statusCd !=null and statusCd != ''">
+            and t.status_cd= #{statusCd}
+        </if>
+        <if test="discountId !=null and discountId != ''">
+            and t.discount_id= #{discountId}
+        </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
 
 
-     </select>
+    </select>
 
 </mapper>

+ 10 - 7
service-fee/src/main/java/com/java110/fee/api/FeeDiscountApi.java

@@ -1,5 +1,6 @@
 package com.java110.fee.api;
 
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.java110.dto.feeDiscount.FeeDiscountDto;
 import com.java110.dto.feeDiscountRule.FeeDiscountRuleDto;
@@ -57,9 +58,9 @@ public class FeeDiscountApi {
         Assert.hasKeyAndValue(reqJson, "ruleId", "请求报文中未包含ruleId");
         Assert.hasKeyAndValue(reqJson, "discountType", "请求报文中未包含discountType");
 
-
+        JSONArray feeDiscountRuleSpecs = reqJson.getJSONArray("feeDiscountRuleSpecs");
         FeeDiscountPo feeDiscountPo = BeanConvertUtil.covertBean(reqJson, FeeDiscountPo.class);
-        return saveFeeDiscountBMOImpl.save(feeDiscountPo);
+        return saveFeeDiscountBMOImpl.save(feeDiscountPo,feeDiscountRuleSpecs);
     }
 
     /**
@@ -124,27 +125,29 @@ public class FeeDiscountApi {
     /**
      * 微信删除消息模板
      *
-
      * @return
      * @serviceCode /feeDiscount/queryFeeDiscountRule
      * @path /app/feeDiscount/queryFeeDiscountRule
      */
     @RequestMapping(value = "/queryFeeDiscountRule", method = RequestMethod.GET)
     public ResponseEntity<String> queryFeeDiscountRule(
-                                                       @RequestParam(value = "page") int page,
-                                                       @RequestParam(value = "row") int row) {
+            @RequestParam(value = "discountType", required = false) String discountType,
+            @RequestParam(value = "page") int page,
+            @RequestParam(value = "row") int row) {
         FeeDiscountRuleDto feeDiscountRuleDto = new FeeDiscountRuleDto();
         feeDiscountRuleDto.setPage(page);
         feeDiscountRuleDto.setRow(row);
+        feeDiscountRuleDto.setDiscountType(discountType);
         return getFeeDiscountRuleBMOImpl.get(feeDiscountRuleDto);
     }
 
     /**
      * 微信删除消息模板
-     * @serviceCode /feeDiscount/queryFeeDiscountRuleSpec
-     * @path /app/feeDiscount/queryFeeDiscountRuleSpec
+     *
      * @param ruleId 小区ID
      * @return
+     * @serviceCode /feeDiscount/queryFeeDiscountRuleSpec
+     * @path /app/feeDiscount/queryFeeDiscountRuleSpec
      */
     @RequestMapping(value = "/queryFeeDiscountRuleSpec", method = RequestMethod.GET)
     public ResponseEntity<String> queryFeeDiscountRuleSpec(@RequestParam(value = "ruleId") String ruleId,

+ 2 - 1
service-fee/src/main/java/com/java110/fee/bmo/feeDiscount/ISaveFeeDiscountBMO.java

@@ -1,5 +1,6 @@
 package com.java110.fee.bmo.feeDiscount;
 
+import com.alibaba.fastjson.JSONArray;
 import com.java110.po.feeDiscount.FeeDiscountPo;
 import org.springframework.http.ResponseEntity;
 
@@ -13,7 +14,7 @@ public interface ISaveFeeDiscountBMO {
      * @param feeDiscountPo
      * @return
      */
-    ResponseEntity<String> save(FeeDiscountPo feeDiscountPo);
+    ResponseEntity<String> save(FeeDiscountPo feeDiscountPo, JSONArray feeDiscountRuleSpecs);
 
 
 }

+ 40 - 0
service-fee/src/main/java/com/java110/fee/bmo/feeDiscount/impl/GetFeeDiscountBMOImpl.java

@@ -1,8 +1,10 @@
 package com.java110.fee.bmo.feeDiscount.impl;
 
 import com.java110.dto.feeDiscount.FeeDiscountDto;
+import com.java110.dto.feeDiscountSpec.FeeDiscountSpecDto;
 import com.java110.fee.bmo.feeDiscount.IGetFeeDiscountBMO;
 import com.java110.intf.fee.IFeeDiscountInnerServiceSMO;
+import com.java110.intf.fee.IFeeDiscountSpecInnerServiceSMO;
 import com.java110.vo.ResultVo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
@@ -18,6 +20,9 @@ public class GetFeeDiscountBMOImpl implements IGetFeeDiscountBMO {
     @Autowired
     private IFeeDiscountInnerServiceSMO feeDiscountInnerServiceSMOImpl;
 
+    @Autowired
+    private IFeeDiscountSpecInnerServiceSMO feeDiscountSpecInnerServiceSMOImpl;
+
     /**
      * @param feeDiscountDto
      * @return 订单服务能够接受的报文
@@ -30,6 +35,7 @@ public class GetFeeDiscountBMOImpl implements IGetFeeDiscountBMO {
         List<FeeDiscountDto> feeDiscountDtos = null;
         if (count > 0) {
             feeDiscountDtos = feeDiscountInnerServiceSMOImpl.queryFeeDiscounts(feeDiscountDto);
+            freshDiscountSpec(feeDiscountDtos);
         } else {
             feeDiscountDtos = new ArrayList<>();
         }
@@ -41,4 +47,38 @@ public class GetFeeDiscountBMOImpl implements IGetFeeDiscountBMO {
         return responseEntity;
     }
 
+    private void freshDiscountSpec(List<FeeDiscountDto> feeDiscountDtos) {
+
+        if (feeDiscountDtos == null || feeDiscountDtos.size() < 1) {
+            return;
+        }
+
+        List<String> discountIds = new ArrayList<>();
+        for (FeeDiscountDto feeDiscountDto : feeDiscountDtos) {
+            discountIds.add(feeDiscountDto.getDiscountId());
+        }
+
+        FeeDiscountSpecDto tmpFeeDiscountSpecDto = new FeeDiscountSpecDto();
+
+        tmpFeeDiscountSpecDto.setDiscountIds(discountIds.toArray(new String[discountIds.size()]));
+        tmpFeeDiscountSpecDto.setCommunityId(feeDiscountDtos.get(0).getCommunityId());
+
+        List<FeeDiscountSpecDto> feeDiscountSpecDtos = feeDiscountSpecInnerServiceSMOImpl.queryFeeDiscountSpecs(tmpFeeDiscountSpecDto);
+
+        if (feeDiscountSpecDtos == null || feeDiscountSpecDtos.size() < 1) {
+            return;
+        }
+        List<FeeDiscountSpecDto> tmpSpecs = null;
+        for (FeeDiscountDto feeDiscountDto : feeDiscountDtos) {
+            tmpSpecs = new ArrayList<>();
+            for (FeeDiscountSpecDto feeDiscountSpecDto : feeDiscountSpecDtos) {
+                if (feeDiscountDto.getDiscountId().equals(feeDiscountSpecDto.getDiscountId())) {
+                    tmpSpecs.add(feeDiscountSpecDto);
+
+                }
+            }
+            feeDiscountDto.setFeeDiscountSpecs(tmpSpecs);
+        }
+    }
+
 }

+ 62 - 3
service-fee/src/main/java/com/java110/fee/bmo/feeDiscount/impl/SaveFeeDiscountBMOImpl.java

@@ -1,10 +1,14 @@
 package com.java110.fee.bmo.feeDiscount.impl;
 
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
 import com.java110.core.annotation.Java110Transactional;
 import com.java110.core.factory.GenerateCodeFactory;
 import com.java110.fee.bmo.feeDiscount.ISaveFeeDiscountBMO;
 import com.java110.intf.fee.IFeeDiscountInnerServiceSMO;
+import com.java110.intf.fee.IFeeDiscountSpecInnerServiceSMO;
 import com.java110.po.feeDiscount.FeeDiscountPo;
+import com.java110.po.feeDiscountSpec.FeeDiscountSpecPo;
 import com.java110.vo.ResultVo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.ResponseEntity;
@@ -16,23 +20,78 @@ public class SaveFeeDiscountBMOImpl implements ISaveFeeDiscountBMO {
     @Autowired
     private IFeeDiscountInnerServiceSMO feeDiscountInnerServiceSMOImpl;
 
+    @Autowired
+    private IFeeDiscountSpecInnerServiceSMO feeDiscountSpecInnerServiceSMOImpl;
+
     /**
      * 添加小区信息
+     * <p>
+     * {
+     * "discountId": "",
+     * "discountName": "物业费减免",
+     * "discountType": "1001",
+     * "ruleId": "102020002",
+     * "discountDesc": "",
+     * "feeDiscountRuleSpecs": [{
+     * "page": -1,
+     * "records": 0,
+     * "remark": "必填,请填写减免金额(元)",
+     * "row": 0,
+     * "ruleId": "102020002",
+     * "specId": "89002020980004",
+     * "specName": "减免金额",
+     * "statusCd": "0",
+     * "total": 0,
+     * "specValue": "100"
+     * }, {
+     * "page": -1,
+     * "records": 0,
+     * "remark": "必填,请填写至少缴费月份",
+     * "row": 0,
+     * "ruleId": "102020002",
+     * "specId": "89002020980003",
+     * "specName": "月份",
+     * "statusCd": "0",
+     * "total": 0,
+     * "specValue": "12"
+     * }],
+     * "communityId": "7020181217000001"
+     * }
      *
      * @param feeDiscountPo
      * @return 订单服务能够接受的报文
      */
     @Java110Transactional
-    public ResponseEntity<String> save(FeeDiscountPo feeDiscountPo) {
+    public ResponseEntity<String> save(FeeDiscountPo feeDiscountPo, JSONArray feeDiscountRuleSpecs) {
 
         feeDiscountPo.setDiscountId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_discountId));
         int flag = feeDiscountInnerServiceSMOImpl.saveFeeDiscount(feeDiscountPo);
 
-        if (flag > 0) {
+        if (flag < 1) {
+            return ResultVo.createResponseEntity(ResultVo.CODE_ERROR, "保存失败");
+        }
+
+        if (feeDiscountRuleSpecs == null || feeDiscountRuleSpecs.size() < 1) {
             return ResultVo.createResponseEntity(ResultVo.CODE_OK, "保存成功");
         }
+        JSONObject specObj = null;
+        for (int specIndex = 0; specIndex < feeDiscountRuleSpecs.size(); specIndex++) {
+            specObj = feeDiscountRuleSpecs.getJSONObject(specIndex);
+            FeeDiscountSpecPo feeDiscountSpecPo = new FeeDiscountSpecPo();
+            feeDiscountSpecPo.setCommunityId(feeDiscountPo.getCommunityId());
+            feeDiscountSpecPo.setDiscountId(feeDiscountPo.getDiscountId());
+            feeDiscountSpecPo.setSpecId(specObj.getString("specId"));
+            feeDiscountSpecPo.setSpecName(specObj.getString("specName"));
+            feeDiscountSpecPo.setSpecValue(specObj.getString("specValue"));
+            flag = feeDiscountSpecInnerServiceSMOImpl.saveFeeDiscountSpec(feeDiscountSpecPo);
+            if (flag < 1) {
+                throw new IllegalArgumentException("保存 折扣规格失败");
+            }
+        }
+
+        return ResultVo.createResponseEntity(ResultVo.CODE_OK, "保存成功");
+
 
-        return ResultVo.createResponseEntity(ResultVo.CODE_ERROR, "保存失败");
     }
 
 }