Przeglądaj źródła

加入优惠券赠送规则

wuxw 3 lat temu
rodzic
commit
d5470fd2c8

+ 77 - 0
java110-bean/src/main/java/com/java110/dto/couponRule/CouponRuleDto.java

@@ -0,0 +1,77 @@
+package com.java110.dto.couponRule;
+
+import com.java110.dto.PageDto;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @ClassName FloorDto
+ * @Description 优惠券规则数据层封装
+ * @Author wuxw
+ * @Date 2019/4/24 8:52
+ * @Version 1.0
+ * add by wuxw 2019/4/24
+ **/
+public class CouponRuleDto extends PageDto implements Serializable {
+
+    private String ruleName;
+    private String remark;
+    private String ruleId;
+    private String communityId;
+
+
+    private Date createTime;
+
+    private String statusCd = "0";
+
+
+    public String getRuleName() {
+        return ruleName;
+    }
+
+    public void setRuleName(String ruleName) {
+        this.ruleName = ruleName;
+    }
+
+    public String getRemark() {
+        return remark;
+    }
+
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
+
+    public String getRuleId() {
+        return ruleId;
+    }
+
+    public void setRuleId(String ruleId) {
+        this.ruleId = ruleId;
+    }
+
+    public String getCommunityId() {
+        return communityId;
+    }
+
+    public void setCommunityId(String communityId) {
+        this.communityId = communityId;
+    }
+
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    public String getStatusCd() {
+        return statusCd;
+    }
+
+    public void setStatusCd(String statusCd) {
+        this.statusCd = statusCd;
+    }
+}

+ 77 - 0
java110-bean/src/main/java/com/java110/po/couponRule/CouponRulePo.java

@@ -0,0 +1,77 @@
+/*
+ * Copyright 2017-2020 吴学文 and java110 team.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.java110.po.couponRule;
+
+import java.io.Serializable;
+
+/**
+ * 类表述: Po 数据模型实体对象 基本保持与数据库模型一直 用于 增加修改删除 等时的数据载体
+ * add by 吴学文 at 2022-11-22 01:28:14 mail: 928255095@qq.com
+ * open source address: https://gitee.com/wuxw7/MicroCommunity
+ * 官网:http://www.homecommunity.cn
+ * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
+ * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
+ */
+public class CouponRulePo implements Serializable {
+
+    private String ruleName;
+    private String remark;
+    private String statusCd = "0";
+    private String ruleId;
+    private String communityId;
+
+    public String getRuleName() {
+        return ruleName;
+    }
+
+    public void setRuleName(String ruleName) {
+        this.ruleName = ruleName;
+    }
+
+    public String getRemark() {
+        return remark;
+    }
+
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
+
+    public String getStatusCd() {
+        return statusCd;
+    }
+
+    public void setStatusCd(String statusCd) {
+        this.statusCd = statusCd;
+    }
+
+    public String getRuleId() {
+        return ruleId;
+    }
+
+    public void setRuleId(String ruleId) {
+        this.ruleId = ruleId;
+    }
+
+    public String getCommunityId() {
+        return communityId;
+    }
+
+    public void setCommunityId(String communityId) {
+        this.communityId = communityId;
+    }
+
+
+}

+ 93 - 0
java110-db/src/main/resources/mapper/acct/CouponRuleV1ServiceDaoImplMapper.xml

@@ -0,0 +1,93 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="couponRuleV1ServiceDaoImpl">
+
+
+    <!-- 保存优惠券规则信息 add by wuxw 2018-07-03 -->
+    <insert id="saveCouponRuleInfo" parameterType="Map">
+        insert into coupon_rule(
+        rule_name,remark,rule_id,community_id
+        ) values (
+        #{ruleName},#{remark},#{ruleId},#{communityId}
+        )
+    </insert>
+
+
+    <!-- 查询优惠券规则信息 add by wuxw 2018-07-03 -->
+    <select id="getCouponRuleInfo" 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.community_id,t.community_id communityId
+        from coupon_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="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="updateCouponRuleInfo" parameterType="Map">
+        update coupon_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="communityId !=null and communityId != ''">
+            , t.community_id= #{communityId}
+        </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="queryCouponRulesCount" parameterType="Map" resultType="Map">
+        select count(1) count
+        from coupon_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="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
+
+
+    </select>
+
+</mapper>

+ 68 - 0
java110-interface/src/main/java/com/java110/intf/acct/ICouponRuleV1InnerServiceSMO.java

@@ -0,0 +1,68 @@
+/*
+ * Copyright 2017-2020 吴学文 and java110 team.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.java110.intf.acct;
+
+import com.java110.config.feign.FeignConfiguration;
+import com.java110.dto.couponRule.CouponRuleDto;
+import com.java110.po.couponRule.CouponRulePo;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+
+import java.util.List;
+
+/**
+ * 类表述: 服务之前调用的接口类,不对外提供接口能力 只用于接口建调用
+ * add by 吴学文 at 2022-11-22 01:28:14 mail: 928255095@qq.com
+ * open source address: https://gitee.com/wuxw7/MicroCommunity
+ * 官网:http://www.homecommunity.cn
+ * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
+ * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
+ */
+@FeignClient(name = "acct-service", configuration = {FeignConfiguration.class})
+@RequestMapping("/couponRuleV1Api")
+public interface ICouponRuleV1InnerServiceSMO {
+
+
+    @RequestMapping(value = "/saveCouponRule", method = RequestMethod.POST)
+    public int saveCouponRule(@RequestBody CouponRulePo couponRulePo);
+
+    @RequestMapping(value = "/updateCouponRule", method = RequestMethod.POST)
+    public int updateCouponRule(@RequestBody CouponRulePo couponRulePo);
+
+    @RequestMapping(value = "/deleteCouponRule", method = RequestMethod.POST)
+    public int deleteCouponRule(@RequestBody CouponRulePo couponRulePo);
+
+    /**
+     * <p>查询小区楼信息</p>
+     *
+     *
+     * @param couponRuleDto 数据对象分享
+     * @return CouponRuleDto 对象数据
+     */
+    @RequestMapping(value = "/queryCouponRules", method = RequestMethod.POST)
+    List<CouponRuleDto> queryCouponRules(@RequestBody CouponRuleDto couponRuleDto);
+
+    /**
+     * 查询<p>小区楼</p>总记录数
+     *
+     * @param couponRuleDto 数据对象分享
+     * @return 小区下的小区楼记录数
+     */
+    @RequestMapping(value = "/queryCouponRulesCount", method = RequestMethod.POST)
+    int queryCouponRulesCount(@RequestBody CouponRuleDto couponRuleDto);
+}

+ 71 - 0
service-acct/src/main/java/com/java110/acct/cmd/couponRule/DeleteCouponRuleCmd.java

@@ -0,0 +1,71 @@
+/*
+ * Copyright 2017-2020 吴学文 and java110 team.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.java110.acct.cmd.couponRule;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.core.annotation.Java110Cmd;
+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.intf.acct.ICouponRuleV1InnerServiceSMO;
+import com.java110.po.couponRule.CouponRulePo;
+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;
+/**
+ * 类表述:删除
+ * 服务编码:couponRule.deleteCouponRule
+ * 请求路劲:/app/couponRule.DeleteCouponRule
+ * add by 吴学文 at 2022-11-22 01:28:14 mail: 928255095@qq.com
+ * open source address: https://gitee.com/wuxw7/MicroCommunity
+ * 官网:http://www.homecommunity.cn
+ * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
+ * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
+ */
+@Java110Cmd(serviceCode = "couponRule.deleteCouponRule")
+public class DeleteCouponRuleCmd extends Cmd {
+  private static Logger logger = LoggerFactory.getLogger(DeleteCouponRuleCmd.class);
+
+    @Autowired
+    private ICouponRuleV1InnerServiceSMO couponRuleV1InnerServiceSMOImpl;
+
+    @Override
+    public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
+        Assert.hasKeyAndValue(reqJson, "ruleId", "ruleId不能为空");
+Assert.hasKeyAndValue(reqJson, "communityId", "communityId不能为空");
+
+    }
+
+    @Override
+    @Java110Transactional
+    public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
+
+       CouponRulePo couponRulePo = BeanConvertUtil.covertBean(reqJson, CouponRulePo.class);
+        int flag = couponRuleV1InnerServiceSMOImpl.deleteCouponRule(couponRulePo);
+
+        if (flag < 1) {
+            throw new CmdException("删除数据失败");
+        }
+
+        cmdDataFlowContext.setResponseEntity(ResultVo.success());
+    }
+}

+ 84 - 0
service-acct/src/main/java/com/java110/acct/cmd/couponRule/ListCouponRuleCmd.java

@@ -0,0 +1,84 @@
+/*
+ * Copyright 2017-2020 吴学文 and java110 team.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.java110.acct.cmd.couponRule;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.core.annotation.Java110Cmd;
+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.intf.acct.ICouponRuleV1InnerServiceSMO;
+import com.java110.po.couponRule.CouponRulePo;
+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 com.java110.dto.couponRule.CouponRuleDto;
+import java.util.List;
+import java.util.ArrayList;
+import org.springframework.http.ResponseEntity;
+import org.springframework.http.HttpStatus;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * 类表述:查询
+ * 服务编码:couponRule.listCouponRule
+ * 请求路劲:/app/couponRule.ListCouponRule
+ * add by 吴学文 at 2022-11-22 01:28:14 mail: 928255095@qq.com
+ * open source address: https://gitee.com/wuxw7/MicroCommunity
+ * 官网:http://www.homecommunity.cn
+ * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
+ * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
+ */
+@Java110Cmd(serviceCode = "couponRule.listCouponRule")
+public class ListCouponRuleCmd extends Cmd {
+
+  private static Logger logger = LoggerFactory.getLogger(ListCouponRuleCmd.class);
+    @Autowired
+    private ICouponRuleV1InnerServiceSMO couponRuleV1InnerServiceSMOImpl;
+
+    @Override
+    public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
+        super.validatePageInfo(reqJson);
+    }
+
+    @Override
+    public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
+
+           CouponRuleDto couponRuleDto = BeanConvertUtil.covertBean(reqJson, CouponRuleDto.class);
+
+           int count = couponRuleV1InnerServiceSMOImpl.queryCouponRulesCount(couponRuleDto);
+
+           List<CouponRuleDto> couponRuleDtos = null;
+
+           if (count > 0) {
+               couponRuleDtos = couponRuleV1InnerServiceSMOImpl.queryCouponRules(couponRuleDto);
+           } else {
+               couponRuleDtos = new ArrayList<>();
+           }
+
+           ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (double) reqJson.getInteger("row")), count, couponRuleDtos);
+
+           ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
+
+           cmdDataFlowContext.setResponseEntity(responseEntity);
+    }
+}

+ 76 - 0
service-acct/src/main/java/com/java110/acct/cmd/couponRule/SaveCouponRuleCmd.java

@@ -0,0 +1,76 @@
+/*
+ * Copyright 2017-2020 吴学文 and java110 team.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.java110.acct.cmd.couponRule;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.core.annotation.Java110Cmd;
+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.intf.acct.ICouponRuleV1InnerServiceSMO;
+import com.java110.po.couponRule.CouponRulePo;
+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;
+
+/**
+ * 类表述:保存
+ * 服务编码:couponRule.saveCouponRule
+ * 请求路劲:/app/couponRule.SaveCouponRule
+ * add by 吴学文 at 2022-11-22 01:28:14 mail: 928255095@qq.com
+ * open source address: https://gitee.com/wuxw7/MicroCommunity
+ * 官网:http://www.homecommunity.cn
+ * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
+ * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
+ */
+@Java110Cmd(serviceCode = "couponRule.saveCouponRule")
+public class SaveCouponRuleCmd extends Cmd {
+
+    private static Logger logger = LoggerFactory.getLogger(SaveCouponRuleCmd.class);
+
+    public static final String CODE_PREFIX_ID = "10";
+
+    @Autowired
+    private ICouponRuleV1InnerServiceSMO couponRuleV1InnerServiceSMOImpl;
+
+    @Override
+    public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
+        Assert.hasKeyAndValue(reqJson, "ruleName", "请求报文中未包含ruleName");
+Assert.hasKeyAndValue(reqJson, "communityId", "请求报文中未包含communityId");
+
+    }
+
+    @Override
+    @Java110Transactional
+    public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
+
+       CouponRulePo couponRulePo = BeanConvertUtil.covertBean(reqJson, CouponRulePo.class);
+        couponRulePo.setRuleId(GenerateCodeFactory.getGeneratorId(CODE_PREFIX_ID));
+        int flag = couponRuleV1InnerServiceSMOImpl.saveCouponRule(couponRulePo);
+
+        if (flag < 1) {
+            throw new CmdException("保存数据失败");
+        }
+
+        cmdDataFlowContext.setResponseEntity(ResultVo.success());
+    }
+}

+ 75 - 0
service-acct/src/main/java/com/java110/acct/cmd/couponRule/UpdateCouponRuleCmd.java

@@ -0,0 +1,75 @@
+/*
+ * Copyright 2017-2020 吴学文 and java110 team.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.java110.acct.cmd.couponRule;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.core.annotation.Java110Cmd;
+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.intf.acct.ICouponRuleV1InnerServiceSMO;
+import com.java110.po.couponRule.CouponRulePo;
+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;
+
+
+/**
+ * 类表述:更新
+ * 服务编码:couponRule.updateCouponRule
+ * 请求路劲:/app/couponRule.UpdateCouponRule
+ * add by 吴学文 at 2022-11-22 01:28:14 mail: 928255095@qq.com
+ * open source address: https://gitee.com/wuxw7/MicroCommunity
+ * 官网:http://www.homecommunity.cn
+ * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
+ * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
+ */
+@Java110Cmd(serviceCode = "couponRule.updateCouponRule")
+public class UpdateCouponRuleCmd extends Cmd {
+
+  private static Logger logger = LoggerFactory.getLogger(UpdateCouponRuleCmd.class);
+
+
+    @Autowired
+    private ICouponRuleV1InnerServiceSMO couponRuleV1InnerServiceSMOImpl;
+
+    @Override
+    public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
+        Assert.hasKeyAndValue(reqJson, "ruleId", "ruleId不能为空");
+Assert.hasKeyAndValue(reqJson, "communityId", "communityId不能为空");
+
+    }
+
+    @Override
+    @Java110Transactional
+    public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
+
+       CouponRulePo couponRulePo = BeanConvertUtil.covertBean(reqJson, CouponRulePo.class);
+        int flag = couponRuleV1InnerServiceSMOImpl.updateCouponRule(couponRulePo);
+
+        if (flag < 1) {
+            throw new CmdException("更新数据失败");
+        }
+
+        cmdDataFlowContext.setResponseEntity(ResultVo.success());
+    }
+}

+ 77 - 0
service-acct/src/main/java/com/java110/acct/dao/ICouponRuleV1ServiceDao.java

@@ -0,0 +1,77 @@
+/*
+ * Copyright 2017-2020 吴学文 and java110 team.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.java110.acct.dao;
+
+
+import com.java110.utils.exception.DAOException;
+import com.java110.entity.merchant.BoMerchant;
+import com.java110.entity.merchant.BoMerchantAttr;
+import com.java110.entity.merchant.Merchant;
+import com.java110.entity.merchant.MerchantAttr;
+
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 类表述:
+ * add by 吴学文 at 2022-11-22 01:28:14 mail: 928255095@qq.com
+ * open source address: https://gitee.com/wuxw7/MicroCommunity
+ * 官网:http://www.homecommunity.cn
+ * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
+ * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
+ */
+public interface ICouponRuleV1ServiceDao {
+
+
+    /**
+     * 保存 优惠券规则信息
+     * @param info
+     * @throws DAOException DAO异常
+     */
+    int saveCouponRuleInfo(Map info) throws DAOException;
+
+
+
+
+    /**
+     * 查询优惠券规则信息(instance过程)
+     * 根据bId 查询优惠券规则信息
+     * @param info bId 信息
+     * @return 优惠券规则信息
+     * @throws DAOException DAO异常
+     */
+    List<Map> getCouponRuleInfo(Map info) throws DAOException;
+
+
+
+    /**
+     * 修改优惠券规则信息
+     * @param info 修改信息
+     * @throws DAOException DAO异常
+     */
+    int updateCouponRuleInfo(Map info) throws DAOException;
+
+
+    /**
+     * 查询优惠券规则总数
+     *
+     * @param info 优惠券规则信息
+     * @return 优惠券规则数量
+     */
+    int queryCouponRulesCount(Map info);
+
+}

+ 112 - 0
service-acct/src/main/java/com/java110/acct/dao/impl/CouponRuleV1ServiceDaoImpl.java

@@ -0,0 +1,112 @@
+/*
+ * Copyright 2017-2020 吴学文 and java110 team.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.java110.acct.dao.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.utils.constant.ResponseConstant;
+import com.java110.utils.exception.DAOException;
+import com.java110.utils.util.DateUtil;
+import com.java110.core.base.dao.BaseServiceDao;
+import com.java110.acct.dao.ICouponRuleV1ServiceDao;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 类表述:
+ * add by 吴学文 at 2022-11-22 01:28:14 mail: 928255095@qq.com
+ * open source address: https://gitee.com/wuxw7/MicroCommunity
+ * 官网:http://www.homecommunity.cn
+ * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
+ * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
+ */
+@Service("couponRuleV1ServiceDaoImpl")
+public class CouponRuleV1ServiceDaoImpl extends BaseServiceDao implements ICouponRuleV1ServiceDao {
+
+    private static Logger logger = LoggerFactory.getLogger(CouponRuleV1ServiceDaoImpl.class);
+
+
+
+
+
+    /**
+     * 保存优惠券规则信息 到 instance
+     * @param info   bId 信息
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public int saveCouponRuleInfo(Map info) throws DAOException {
+        logger.debug("保存 saveCouponRuleInfo 入参 info : {}",info);
+
+        int saveFlag = sqlSessionTemplate.insert("couponRuleV1ServiceDaoImpl.saveCouponRuleInfo",info);
+
+        return saveFlag;
+    }
+
+
+    /**
+     * 查询优惠券规则信息(instance)
+     * @param info bId 信息
+     * @return List<Map>
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public List<Map> getCouponRuleInfo(Map info) throws DAOException {
+        logger.debug("查询 getCouponRuleInfo 入参 info : {}",info);
+
+        List<Map> businessCouponRuleInfos = sqlSessionTemplate.selectList("couponRuleV1ServiceDaoImpl.getCouponRuleInfo",info);
+
+        return businessCouponRuleInfos;
+    }
+
+
+    /**
+     * 修改优惠券规则信息
+     * @param info 修改信息
+     * @throws DAOException DAO异常
+     */
+    @Override
+    public int updateCouponRuleInfo(Map info) throws DAOException {
+        logger.debug("修改 updateCouponRuleInfo 入参 info : {}",info);
+
+        int saveFlag = sqlSessionTemplate.update("couponRuleV1ServiceDaoImpl.updateCouponRuleInfo",info);
+
+        return saveFlag;
+    }
+
+     /**
+     * 查询优惠券规则数量
+     * @param info 优惠券规则信息
+     * @return 优惠券规则数量
+     */
+    @Override
+    public int queryCouponRulesCount(Map info) {
+        logger.debug("查询 queryCouponRulesCount 入参 info : {}",info);
+
+        List<Map> businessCouponRuleInfos = sqlSessionTemplate.selectList("couponRuleV1ServiceDaoImpl.queryCouponRulesCount", info);
+        if (businessCouponRuleInfos.size() < 1) {
+            return 0;
+        }
+
+        return Integer.parseInt(businessCouponRuleInfos.get(0).get("count").toString());
+    }
+
+
+}

+ 89 - 0
service-acct/src/main/java/com/java110/acct/smo/impl/CouponRuleV1InnerServiceSMOImpl.java

@@ -0,0 +1,89 @@
+/*
+ * Copyright 2017-2020 吴学文 and java110 team.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.java110.acct.smo.impl;
+
+
+import com.java110.acct.dao.ICouponRuleV1ServiceDao;
+import com.java110.intf.acct.ICouponRuleV1InnerServiceSMO;
+import com.java110.dto.couponRule.CouponRuleDto;
+import com.java110.po.couponRule.CouponRulePo;
+import com.java110.utils.util.BeanConvertUtil;
+import com.java110.core.base.smo.BaseServiceSMO;
+import com.java110.dto.user.UserDto;
+import com.java110.dto.PageDto;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 类表述: 服务之前调用的接口实现类,不对外提供接口能力 只用于接口建调用
+ * add by 吴学文 at 2022-11-22 01:28:14 mail: 928255095@qq.com
+ * open source address: https://gitee.com/wuxw7/MicroCommunity
+ * 官网:http://www.homecommunity.cn
+ * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
+ * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
+ */
+@RestController
+public class CouponRuleV1InnerServiceSMOImpl extends BaseServiceSMO implements ICouponRuleV1InnerServiceSMO {
+
+    @Autowired
+    private ICouponRuleV1ServiceDao couponRuleV1ServiceDaoImpl;
+
+
+    @Override
+    public int saveCouponRule(@RequestBody  CouponRulePo couponRulePo) {
+        int saveFlag = couponRuleV1ServiceDaoImpl.saveCouponRuleInfo(BeanConvertUtil.beanCovertMap(couponRulePo));
+        return saveFlag;
+    }
+
+     @Override
+    public int updateCouponRule(@RequestBody  CouponRulePo couponRulePo) {
+        int saveFlag = couponRuleV1ServiceDaoImpl.updateCouponRuleInfo(BeanConvertUtil.beanCovertMap(couponRulePo));
+        return saveFlag;
+    }
+
+     @Override
+    public int deleteCouponRule(@RequestBody  CouponRulePo couponRulePo) {
+       couponRulePo.setStatusCd("1");
+       int saveFlag = couponRuleV1ServiceDaoImpl.updateCouponRuleInfo(BeanConvertUtil.beanCovertMap(couponRulePo));
+       return saveFlag;
+    }
+
+    @Override
+    public List<CouponRuleDto> queryCouponRules(@RequestBody  CouponRuleDto couponRuleDto) {
+
+        //校验是否传了 分页信息
+
+        int page = couponRuleDto.getPage();
+
+        if (page != PageDto.DEFAULT_PAGE) {
+            couponRuleDto.setPage((page - 1) * couponRuleDto.getRow());
+        }
+
+        List<CouponRuleDto> couponRules = BeanConvertUtil.covertBeanList(couponRuleV1ServiceDaoImpl.getCouponRuleInfo(BeanConvertUtil.beanCovertMap(couponRuleDto)), CouponRuleDto.class);
+
+        return couponRules;
+    }
+
+
+    @Override
+    public int queryCouponRulesCount(@RequestBody CouponRuleDto couponRuleDto) {
+        return couponRuleV1ServiceDaoImpl.queryCouponRulesCount(BeanConvertUtil.beanCovertMap(couponRuleDto));    }
+
+}