Bläddra i källkod

优化 优惠劵赠送费用

wuxw 3 år sedan
förälder
incheckning
cc768ac5ed

+ 42 - 19
java110-bean/src/main/java/com/java110/dto/couponRuleFee/CouponRuleFeeDto.java

@@ -1,6 +1,7 @@
 package com.java110.dto.couponRuleFee;
 
 import com.java110.dto.PageDto;
+
 import java.io.Serializable;
 import java.util.Date;
 
@@ -15,12 +16,13 @@ import java.util.Date;
 public class CouponRuleFeeDto extends PageDto implements Serializable {
 
     private String payMonth;
-private String payStartTime;
-private String payEndTime;
-private String crfId;
-private String ruleId;
-private String communityId;
-private String feeConfigId;
+    private String payStartTime;
+    private String payEndTime;
+    private String crfId;
+    private String ruleId;
+    private String communityId;
+    private String feeConfigId;
+    private String feeConfigName;
 
 
     private Date createTime;
@@ -31,43 +33,56 @@ private String feeConfigId;
     public String getPayMonth() {
         return payMonth;
     }
-public void setPayMonth(String payMonth) {
+
+    public void setPayMonth(String payMonth) {
         this.payMonth = payMonth;
     }
-public String getPayStartTime() {
+
+    public String getPayStartTime() {
         return payStartTime;
     }
-public void setPayStartTime(String payStartTime) {
+
+    public void setPayStartTime(String payStartTime) {
         this.payStartTime = payStartTime;
     }
-public String getPayEndTime() {
+
+    public String getPayEndTime() {
         return payEndTime;
     }
-public void setPayEndTime(String payEndTime) {
+
+    public void setPayEndTime(String payEndTime) {
         this.payEndTime = payEndTime;
     }
-public String getCrfId() {
+
+    public String getCrfId() {
         return crfId;
     }
-public void setCrfId(String crfId) {
+
+    public void setCrfId(String crfId) {
         this.crfId = crfId;
     }
-public String getRuleId() {
+
+    public String getRuleId() {
         return ruleId;
     }
-public void setRuleId(String ruleId) {
+
+    public void setRuleId(String ruleId) {
         this.ruleId = ruleId;
     }
-public String getCommunityId() {
+
+    public String getCommunityId() {
         return communityId;
     }
-public void setCommunityId(String communityId) {
+
+    public void setCommunityId(String communityId) {
         this.communityId = communityId;
     }
-public String getFeeConfigId() {
+
+    public String getFeeConfigId() {
         return feeConfigId;
     }
-public void setFeeConfigId(String feeConfigId) {
+
+    public void setFeeConfigId(String feeConfigId) {
         this.feeConfigId = feeConfigId;
     }
 
@@ -87,4 +102,12 @@ public void setFeeConfigId(String feeConfigId) {
     public void setStatusCd(String statusCd) {
         this.statusCd = statusCd;
     }
+
+    public String getFeeConfigName() {
+        return feeConfigName;
+    }
+
+    public void setFeeConfigName(String feeConfigName) {
+        this.feeConfigName = feeConfigName;
+    }
 }

+ 47 - 25
java110-bean/src/main/java/com/java110/po/couponRuleFee/CouponRuleFeePo.java

@@ -16,7 +16,7 @@
 package com.java110.po.couponRuleFee;
 
 import java.io.Serializable;
-import java.util.Date;
+
 /**
  * 类表述: Po 数据模型实体对象 基本保持与数据库模型一直 用于 增加修改删除 等时的数据载体
  * add by 吴学文 at 2022-11-22 01:44:48 mail: 928255095@qq.com
@@ -28,62 +28,84 @@ import java.util.Date;
 public class CouponRuleFeePo implements Serializable {
 
     private String payMonth;
-private String payStartTime;
-private String payEndTime;
-private String crfId;
-private String statusCd = "0";
-private String ruleId;
-private String communityId;
-private String feeConfigId;
-public String getPayMonth() {
+    private String payStartTime;
+    private String payEndTime;
+    private String crfId;
+    private String statusCd = "0";
+    private String ruleId;
+    private String communityId;
+    private String feeConfigId;
+    private String feeConfigName;
+
+    public String getPayMonth() {
         return payMonth;
     }
-public void setPayMonth(String payMonth) {
+
+    public void setPayMonth(String payMonth) {
         this.payMonth = payMonth;
     }
-public String getPayStartTime() {
+
+    public String getPayStartTime() {
         return payStartTime;
     }
-public void setPayStartTime(String payStartTime) {
+
+    public void setPayStartTime(String payStartTime) {
         this.payStartTime = payStartTime;
     }
-public String getPayEndTime() {
+
+    public String getPayEndTime() {
         return payEndTime;
     }
-public void setPayEndTime(String payEndTime) {
+
+    public void setPayEndTime(String payEndTime) {
         this.payEndTime = payEndTime;
     }
-public String getCrfId() {
+
+    public String getCrfId() {
         return crfId;
     }
-public void setCrfId(String crfId) {
+
+    public void setCrfId(String crfId) {
         this.crfId = crfId;
     }
-public String getStatusCd() {
+
+    public String getStatusCd() {
         return statusCd;
     }
-public void setStatusCd(String statusCd) {
+
+    public void setStatusCd(String statusCd) {
         this.statusCd = statusCd;
     }
-public String getRuleId() {
+
+    public String getRuleId() {
         return ruleId;
     }
-public void setRuleId(String ruleId) {
+
+    public void setRuleId(String ruleId) {
         this.ruleId = ruleId;
     }
-public String getCommunityId() {
+
+    public String getCommunityId() {
         return communityId;
     }
-public void setCommunityId(String communityId) {
+
+    public void setCommunityId(String communityId) {
         this.communityId = communityId;
     }
-public String getFeeConfigId() {
+
+    public String getFeeConfigId() {
         return feeConfigId;
     }
-public void setFeeConfigId(String feeConfigId) {
+
+    public void setFeeConfigId(String feeConfigId) {
         this.feeConfigId = feeConfigId;
     }
 
+    public String getFeeConfigName() {
+        return feeConfigName;
+    }
 
-
+    public void setFeeConfigName(String feeConfigName) {
+        this.feeConfigName = feeConfigName;
+    }
 }

+ 6 - 3
java110-db/src/main/resources/mapper/acct/CouponRuleFeeV1ServiceDaoImplMapper.xml

@@ -8,9 +8,9 @@
     <!-- 保存规则费用信息 add by wuxw 2018-07-03 -->
     <insert id="saveCouponRuleFeeInfo" parameterType="Map">
         insert into coupon_rule_fee(
-        pay_month,pay_start_time,pay_end_time,crf_id,rule_id,community_id,fee_config_id
+        pay_month,pay_start_time,pay_end_time,crf_id,rule_id,community_id,fee_config_id,fee_config_name
         ) values (
-        #{payMonth},#{payStartTime},#{payEndTime},#{crfId},#{ruleId},#{communityId},#{feeConfigId}
+        #{payMonth},#{payStartTime},#{payEndTime},#{crfId},#{ruleId},#{communityId},#{feeConfigId},#{feeConfigName}
         )
     </insert>
 
@@ -20,7 +20,7 @@
         select t.pay_month,t.pay_month payMonth,t.pay_start_time,t.pay_start_time
         payStartTime,t.pay_end_time,t.pay_end_time payEndTime,t.crf_id,t.crf_id crfId,t.status_cd,t.status_cd
         statusCd,t.rule_id,t.rule_id ruleId,t.community_id,t.community_id communityId,t.fee_config_id,t.fee_config_id
-        feeConfigId
+        feeConfigId,t.fee_config_name feeConfigName
         from coupon_rule_fee t
         where 1 =1
         <if test="payMonth !=null and payMonth != ''">
@@ -79,6 +79,9 @@
         <if test="feeConfigId !=null and feeConfigId != ''">
             , t.fee_config_id= #{feeConfigId}
         </if>
+        <if test="feeConfigName !=null and feeConfigName != ''">
+            , t.fee_config_name= #{feeConfigName}
+        </if>
         where 1=1
         <if test="crfId !=null and crfId != ''">
             and t.crf_id= #{crfId}

+ 32 - 7
service-acct/src/main/java/com/java110/acct/cmd/couponRule/SaveCouponRuleFeeCmd.java

@@ -22,15 +22,20 @@ import com.java110.core.context.ICmdDataFlowContext;
 import com.java110.core.event.cmd.Cmd;
 import com.java110.core.event.cmd.CmdEvent;
 import com.java110.core.factory.GenerateCodeFactory;
+import com.java110.dto.couponRuleFee.CouponRuleFeeDto;
+import com.java110.dto.fee.FeeConfigDto;
 import com.java110.intf.acct.ICouponRuleFeeV1InnerServiceSMO;
+import com.java110.intf.fee.IFeeConfigInnerServiceSMO;
 import com.java110.po.couponRuleFee.CouponRuleFeePo;
 import com.java110.utils.exception.CmdException;
 import com.java110.utils.util.Assert;
 import com.java110.utils.util.BeanConvertUtil;
 import com.java110.vo.ResultVo;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.util.List;
 
 /**
  * 类表述:保存
@@ -52,14 +57,27 @@ public class SaveCouponRuleFeeCmd extends Cmd {
     @Autowired
     private ICouponRuleFeeV1InnerServiceSMO couponRuleFeeV1InnerServiceSMOImpl;
 
+    @Autowired
+    private IFeeConfigInnerServiceSMO feeConfigInnerServiceSMOImpl;
+
+
     @Override
     public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
         Assert.hasKeyAndValue(reqJson, "ruleId", "请求报文中未包含ruleId");
-Assert.hasKeyAndValue(reqJson, "feeConfigId", "请求报文中未包含feeConfigId");
-Assert.hasKeyAndValue(reqJson, "communityId", "请求报文中未包含communityId");
-Assert.hasKeyAndValue(reqJson, "payStartTime", "请求报文中未包含payStartTime");
-Assert.hasKeyAndValue(reqJson, "payEndTime", "请求报文中未包含payEndTime");
-Assert.hasKeyAndValue(reqJson, "payMonth", "请求报文中未包含payMonth");
+        Assert.hasKeyAndValue(reqJson, "feeConfigId", "请求报文中未包含feeConfigId");
+        Assert.hasKeyAndValue(reqJson, "communityId", "请求报文中未包含communityId");
+        Assert.hasKeyAndValue(reqJson, "payStartTime", "请求报文中未包含payStartTime");
+        Assert.hasKeyAndValue(reqJson, "payEndTime", "请求报文中未包含payEndTime");
+        Assert.hasKeyAndValue(reqJson, "payMonth", "请求报文中未包含payMonth");
+
+        CouponRuleFeeDto couponRuleFeeDto = new CouponRuleFeeDto();
+        couponRuleFeeDto.setRuleId(reqJson.getString("ruleId"));
+        couponRuleFeeDto.setFeeConfigId(reqJson.getString("feeConfigId"));
+        long count = couponRuleFeeV1InnerServiceSMOImpl.queryCouponRuleFeesCount(couponRuleFeeDto);
+
+        if(count > 0){
+            throw new CmdException("费用项已经关联");
+        }
 
     }
 
@@ -67,8 +85,15 @@ Assert.hasKeyAndValue(reqJson, "payMonth", "请求报文中未包含payMonth");
     @Java110Transactional
     public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
 
-       CouponRuleFeePo couponRuleFeePo = BeanConvertUtil.covertBean(reqJson, CouponRuleFeePo.class);
+        FeeConfigDto feeConfigDto = new FeeConfigDto();
+        feeConfigDto.setConfigId(reqJson.getString("feeConfigId"));
+        List<FeeConfigDto> feeConfigDtos = feeConfigInnerServiceSMOImpl.queryFeeConfigs(feeConfigDto);
+
+        Assert.listOnlyOne(feeConfigDtos,"费用项不存在");
+
+        CouponRuleFeePo couponRuleFeePo = BeanConvertUtil.covertBean(reqJson, CouponRuleFeePo.class);
         couponRuleFeePo.setCrfId(GenerateCodeFactory.getGeneratorId(CODE_PREFIX_ID));
+        couponRuleFeePo.setFeeConfigName(feeConfigDtos.get(0).getFeeName());
         int flag = couponRuleFeeV1InnerServiceSMOImpl.saveCouponRuleFee(couponRuleFeePo);
 
         if (flag < 1) {

+ 19 - 5
service-acct/src/main/java/com/java110/acct/cmd/couponRule/UpdateCouponRuleFeeCmd.java

@@ -21,16 +21,19 @@ import com.java110.core.annotation.Java110Transactional;
 import com.java110.core.context.ICmdDataFlowContext;
 import com.java110.core.event.cmd.Cmd;
 import com.java110.core.event.cmd.CmdEvent;
-import com.java110.core.factory.GenerateCodeFactory;
+import com.java110.dto.fee.FeeConfigDto;
 import com.java110.intf.acct.ICouponRuleFeeV1InnerServiceSMO;
+import com.java110.intf.fee.IFeeConfigInnerServiceSMO;
 import com.java110.po.couponRuleFee.CouponRuleFeePo;
 import com.java110.utils.exception.CmdException;
 import com.java110.utils.util.Assert;
 import com.java110.utils.util.BeanConvertUtil;
 import com.java110.vo.ResultVo;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.util.List;
 
 
 /**
@@ -46,16 +49,19 @@ import org.slf4j.LoggerFactory;
 @Java110Cmd(serviceCode = "couponRule.updateCouponRuleFee")
 public class UpdateCouponRuleFeeCmd extends Cmd {
 
-  private static Logger logger = LoggerFactory.getLogger(UpdateCouponRuleFeeCmd.class);
+    private static Logger logger = LoggerFactory.getLogger(UpdateCouponRuleFeeCmd.class);
 
 
     @Autowired
     private ICouponRuleFeeV1InnerServiceSMO couponRuleFeeV1InnerServiceSMOImpl;
 
+    @Autowired
+    private IFeeConfigInnerServiceSMO feeConfigInnerServiceSMOImpl;
+
     @Override
     public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
         Assert.hasKeyAndValue(reqJson, "crfId", "crfId不能为空");
-Assert.hasKeyAndValue(reqJson, "communityId", "communityId不能为空");
+        Assert.hasKeyAndValue(reqJson, "communityId", "communityId不能为空");
 
     }
 
@@ -63,7 +69,15 @@ Assert.hasKeyAndValue(reqJson, "communityId", "communityId不能为空");
     @Java110Transactional
     public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
 
-       CouponRuleFeePo couponRuleFeePo = BeanConvertUtil.covertBean(reqJson, CouponRuleFeePo.class);
+        FeeConfigDto feeConfigDto = new FeeConfigDto();
+        feeConfigDto.setConfigId(reqJson.getString("feeConfigId"));
+        List<FeeConfigDto> feeConfigDtos = feeConfigInnerServiceSMOImpl.queryFeeConfigs(feeConfigDto);
+
+        Assert.listOnlyOne(feeConfigDtos,"费用项不存在");
+
+        CouponRuleFeePo couponRuleFeePo = BeanConvertUtil.covertBean(reqJson, CouponRuleFeePo.class);
+        couponRuleFeePo.setFeeConfigName(feeConfigDtos.get(0).getFeeName());
+
         int flag = couponRuleFeeV1InnerServiceSMOImpl.updateCouponRuleFee(couponRuleFeePo);
 
         if (flag < 1) {