From 0a743eb2edb19bdeaed985224d28d7e11fc93167 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=84=89=E5=BF=AB=E7=9A=84=E5=A4=A7=E7=A6=8F?=
 <8790092+honest_zcy@user.noreply.gitee.com>
Date: Sun, 8 Sep 2024 18:26:21 +0800
Subject: [PATCH] =?UTF-8?q?=E5=82=A8=E5=80=BC=E5=8D=A1=E8=A7=84=E5=88=99?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../views/EventMarketing/SaveBlock/index.vue  | 147 +------------
 .../cardCoupon/entity/CardCoupon.java         |   5 +
 .../controller/CardValueRuleController.java   |  95 +++++++++
 .../cardValueRule/dao/CardValueRuleDao.java   |  15 ++
 .../cardValueRule/entity/CardValueRule.java   | 197 ++++++++++++++++++
 .../service/CardValueRuleService.java         |  15 ++
 .../impl/CardValueRuleServiceImpl.java        |  19 ++
 7 files changed, 353 insertions(+), 140 deletions(-)
 create mode 100644 fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueRule/controller/CardValueRuleController.java
 create mode 100644 fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueRule/dao/CardValueRuleDao.java
 create mode 100644 fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueRule/entity/CardValueRule.java
 create mode 100644 fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueRule/service/CardValueRuleService.java
 create mode 100644 fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueRule/service/impl/CardValueRuleServiceImpl.java

diff --git a/fuintAdmin/src/views/EventMarketing/SaveBlock/index.vue b/fuintAdmin/src/views/EventMarketing/SaveBlock/index.vue
index e00e96951..4ab381fcb 100644
--- a/fuintAdmin/src/views/EventMarketing/SaveBlock/index.vue
+++ b/fuintAdmin/src/views/EventMarketing/SaveBlock/index.vue
@@ -355,75 +355,6 @@
 
             </div>
           </div>
-          <!--        选择兑换券-->
-<!--          <div class="xh-box"    >-->
-<!--            <div class="box-bt"> <div >选择兑换券</div>  <el-button type="primary" icon="el-icon-plus" @click="getlistExchange()" >新增</el-button>  </div>-->
-<!--            <div style="margin: 10px 0px">-->
-<!--              <el-table-->
-<!--                :data="duihuanquanlist"-->
-<!--                border-->
-<!--                style="width: 100%">-->
-<!--                <el-table-column-->
-<!--                  prop="giftCardName"-->
-<!--                  label="卡券名称"-->
-<!--                  width="80">-->
-<!--                </el-table-column>-->
-<!--                <el-table-column-->
-<!--                  prop="date"-->
-<!--                  label="券类型"-->
-<!--                  width="80">-->
-<!--                  <template slot-scope="scope">-->
-<!--                    <span v-if="scope.row.giftCardType == 0" >商品兑换券</span>-->
-<!--                    <span v-if="scope.row.giftCardType == 1" >洗车券</span>-->
-<!--                  </template>-->
-<!--                </el-table-column>-->
-<!--                <el-table-column-->
-<!--                  prop="date"-->
-<!--                  label="券详情"-->
-<!--                  width="80">-->
-<!--                  <template slot-scope="scope">-->
-<!--                    <span>{{scope.row.giftCardDetail}}</span>-->
-<!--                  </template>-->
-<!--                </el-table-column>-->
-<!--                <el-table-column-->
-<!--                  prop="instruction"-->
-<!--                  label="使用说明"-->
-<!--                  width="0">-->
-<!--                </el-table-column>-->
-<!--                <el-table-column-->
-<!--                  prop="date"-->
-<!--                  label="有效期(天)">-->
-<!--                  <template slot-scope="scope">-->
-<!--                    <span> {{ scope.row.giftCardTime }}天 </span>-->
-
-<!--                  </template>-->
-<!--                </el-table-column>-->
-<!--                <el-table-column-->
-<!--                  prop="date"-->
-<!--                  label="数量"-->
-<!--                  width="240">-->
-<!--                  <template slot-scope="scope">-->
-<!--                    <el-input-number v-model="scope.row.giftCardTotal" controls-position="right"  :min="1" :max="9999"></el-input-number>-->
-<!--                  </template>-->
-<!--                </el-table-column>-->
-<!--                <el-table-column-->
-<!--                  prop="address"-->
-<!--                  label="操作"-->
-
-<!--                >-->
-<!--                  <template slot-scope="scope">-->
-<!--                    <el-button-->
-<!--                      size="mini"-->
-<!--                      type="text"-->
-<!--                      @click="deletedhdata(scope.row)"-->
-<!--                    >删除</el-button>-->
-<!--                  </template>-->
-<!--                </el-table-column>-->
-<!--              </el-table>-->
-
-<!--            </div>-->
-<!--          </div>-->
-<!--          附加特权-->
           <div class="box-popup">
             <div class="dis-bit">附加特权</div>
             <el-input
@@ -463,9 +394,7 @@
             label="券类型"
             >
             <template slot-scope="scope">
-              <span v-if="scope.row.type == 0" >油品券</span>
-              <span v-if="scope.row.type == 1"  >商品券</span>
-              <span v-if="scope.row.type == 2"  >通用券</span>
+              <dict-tag :options="dict.type.CardCoupon_type" :value="scope.row.type"/>
             </template>
           </el-table-column>
           <el-table-column
@@ -473,7 +402,7 @@
             label="券详情"
             >
             <template slot-scope="scope">
-              <span>{{scope.row.cardDetail}}</span>
+              <span>{{scope.row.useType=='1'?'订单金额':'实付金额'+'满'+scope.row.reachAmount+'优惠'+scope.row.reduceAmount}}</span>
             </template>
           </el-table-column>
           <el-table-column
@@ -481,9 +410,8 @@
             label="有效期(天)"
             >
             <template slot-scope="scope">
-              <span v-if="scope.row.timeType == 0" >{{scope.row.validityZero}}天 </span>
-              <span v-if="scope.row.timeType == 1" >{{scope.row.validityOne}}天 </span>
-              <span v-if="scope.row.timeType == 2" >{{scope.row.validityTwo}}天 </span>
+            <span>{{scope.row.effectiveDateStart}}~{{scope.row.effectiveDateEnd}}</span>
+
             </template>
           </el-table-column>
 
@@ -587,70 +515,6 @@
         </el-form>
       </el-dialog>
 
-      <!--    兑换券列表-->
-      <el-dialog title="兑换券列表" :visible.sync="dialogTableVisibledh">
-        <div style="display: flex;align-items: center; margin-bottom: 20px ">
-          <el-input v-model="duihuanquan.name" placeholder="兑换券名称"></el-input>
-          <el-button type="primary" icon="el-icon-search" @click="getlistExchange" >搜索</el-button>
-        </div>
-
-        <el-table
-          :data="tableDatadh"
-          border
-          style="width: 100%">
-          <el-table-column
-            prop="name"
-            label="卡券名称"
-            >
-          </el-table-column>
-          <el-table-column
-            prop="date"
-            label="券类型"
-            >
-            <template slot-scope="scope">
-              <span v-if="scope.row.type == 0" >油品券</span>
-              <span v-if="scope.row.type == 1"  >商品券</span>
-              <span v-if="scope.row.type == 2"  >通用券</span>
-            </template>
-          </el-table-column>
-          <el-table-column
-            prop="date"
-            label="使用说明"
-            >
-            <template slot-scope="scope">
-              <span>{{scope.row.useInstructions}}</span>
-            </template>
-          </el-table-column>
-          <el-table-column
-            prop="date"
-            label="有效期(天)"
-            >
-            <template slot-scope="scope">
-              <span  >{{scope.row.validity}}天 </span>
-            </template>
-          </el-table-column>
-
-          <el-table-column
-            prop="address"
-            label="操作">
-            <template slot-scope="scope">
-              <el-button
-                size="mini"
-                type="text"
-                @click="Favorabledata(scope.row)"
-              >选择</el-button>
-            </template>
-          </el-table-column>
-        </el-table>
-        <div><pagination
-          v-show="dtotal>0"
-          :total="dtotal"
-          :page.sync="duihuanquan.pageNum"
-          :limit.sync="duihuanquan.pageSize"
-          @pagination="getlistExchange"
-        /></div>
-      </el-dialog>
-
     </div>
 </template>
 
@@ -660,6 +524,7 @@
   import {delLJGoods} from "@/api/convenienceStore/ljgoods";
   export default {
     name: 'index',
+    dicts: ['CardCoupon_type', 'putType_type', 'oilNumber_type'],
     data(){
       return{
         ruleForm: {
@@ -691,6 +556,8 @@
         //请求优惠券列表时的参数
         youhuiquan:{
           name:'',
+          status:'1',
+          putType:'1',
           pageNum: 1,
           pageSize: 10,
         },
diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/entity/CardCoupon.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/entity/CardCoupon.java
index ebcc2fcfb..d14273368 100644
--- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/entity/CardCoupon.java
+++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardCoupon/entity/CardCoupon.java
@@ -3,7 +3,9 @@ package com.fuint.business.marketingActivity.cardCoupon.entity;
 import java.time.LocalTime;
 import java.util.Date;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
 
 import java.io.Serializable;
 
@@ -62,8 +64,10 @@ public class CardCoupon extends Model<CardCoupon> {
     //生效日期类型1.领取后多少天内有效 2指定具体使用日期
     private String timeType;
     //生效开始时间
+    @JsonFormat(pattern = "yyyy-MM-dd" , timezone = "GMT+8")
     private Date effectiveDateStart;
     //生效结束时间
+    @JsonFormat(pattern = "yyyy-MM-dd" , timezone = "GMT+8")
     private Date effectiveDateEnd;
     //领取后多少天内有效的天数
     private Integer validityDay;
@@ -114,6 +118,7 @@ public class CardCoupon extends Model<CardCoupon> {
     //创建者
     private String createBy;
     //创建时间
+    @JsonFormat(pattern = "yyyy-MM-dd" , timezone = "GMT+8")
     private Date createTime;
     //更新者
     private String updateBy;
diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueRule/controller/CardValueRuleController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueRule/controller/CardValueRuleController.java
new file mode 100644
index 000000000..4805a3496
--- /dev/null
+++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueRule/controller/CardValueRuleController.java
@@ -0,0 +1,95 @@
+package com.fuint.business.marketingActivity.cardValueRule.controller;
+
+
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.api.ApiController;
+import com.baomidou.mybatisplus.extension.api.R;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fuint.business.marketingActivity.cardValueRule.entity.CardValueRule;
+import com.fuint.business.marketingActivity.cardValueRule.service.CardValueRuleService;
+import com.fuint.common.util.TokenUtil;
+import com.fuint.framework.web.BaseController;
+import com.fuint.framework.web.ResponseObject;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * 储值卡规则(CardValueRule)表控制层
+ *
+ * @author makejava
+ * @since 2024-09-08 18:19:04
+ */
+@RestController
+@RequestMapping("cardValueRule")
+public class CardValueRuleController extends BaseController {
+    /**
+     * 服务对象
+     */
+    @Resource
+    private CardValueRuleService cardValueRuleService;
+
+    /**
+     * 分页查询所有数据
+     *
+     * @param page 分页对象
+     * @param cardValueRule 查询实体
+     * @return 所有数据
+     */
+    @GetMapping
+    public ResponseObject selectAll(Page<CardValueRule> page, CardValueRule cardValueRule) {
+        LambdaQueryWrapper<CardValueRule> queryWrapper =new LambdaQueryWrapper<CardValueRule>();
+        queryWrapper.eq(CardValueRule::getStoreId, TokenUtil.getNowAccountInfo().getStoreId());
+        return getSuccessResult(this.cardValueRuleService.page(page, queryWrapper));
+    }
+
+    /**
+     * 通过主键查询单条数据
+     *
+     * @return 单条数据
+     */
+    @GetMapping("/nowRule")
+    public ResponseObject selectOne() {
+        LambdaQueryWrapper<CardValueRule> queryWrapper =new LambdaQueryWrapper<CardValueRule>();
+        queryWrapper.eq(CardValueRule::getStoreId, TokenUtil.getNowAccountInfo().getStoreId()).last("limit 1");
+        return getSuccessResult(this.cardValueRuleService.getOne(queryWrapper));
+    }
+
+    /**
+     * 新增数据
+     *
+     * @param cardValueRule 实体对象
+     * @return 新增结果
+     */
+    @PostMapping("/saveOrUpdate")
+    public ResponseObject saveOrUpdate(@RequestBody CardValueRule cardValueRule) {
+        return getSuccessResult(this.cardValueRuleService.saveOrUpdate(cardValueRule));
+    }
+
+    /**
+     * 修改数据
+     *
+     * @param cardValueRule 实体对象
+     * @return 修改结果
+     */
+    @PutMapping
+    public ResponseObject update(@RequestBody CardValueRule cardValueRule) {
+        return getSuccessResult(this.cardValueRuleService.updateById(cardValueRule));
+    }
+
+    /**
+     * 删除数据
+     *
+     * @param idList 主键结合
+     * @return 删除结果
+     */
+    @DeleteMapping
+    public ResponseObject delete(@RequestParam("idList") List<Long> idList) {
+        return getSuccessResult(this.cardValueRuleService.removeByIds(idList));
+    }
+}
+
diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueRule/dao/CardValueRuleDao.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueRule/dao/CardValueRuleDao.java
new file mode 100644
index 000000000..e462740f7
--- /dev/null
+++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueRule/dao/CardValueRuleDao.java
@@ -0,0 +1,15 @@
+package com.fuint.business.marketingActivity.cardValueRule.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.fuint.business.marketingActivity.cardValueRule.entity.CardValueRule;
+
+/**
+ * 储值卡规则(CardValueRule)表数据库访问层
+ *
+ * @author makejava
+ * @since 2024-09-08 18:19:04
+ */
+public interface CardValueRuleDao extends BaseMapper<CardValueRule> {
+
+}
+
diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueRule/entity/CardValueRule.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueRule/entity/CardValueRule.java
new file mode 100644
index 000000000..4d03e4d2c
--- /dev/null
+++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueRule/entity/CardValueRule.java
@@ -0,0 +1,197 @@
+package com.fuint.business.marketingActivity.cardValueRule.entity;
+
+import java.util.Date;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import java.io.Serializable;
+
+/**
+ * 储值卡规则(CardValueRule)表实体类
+ *
+ * @author makejava
+ * @since 2024-09-08 18:19:04
+ */
+@SuppressWarnings("serial")
+public class CardValueRule extends Model<CardValueRule> {
+    //主键
+    private Integer id;
+    //所属连锁店id
+    private Integer chainStoreId;
+    //店铺id
+    private Integer storeId;
+    //名称
+    private String name;
+    //权益说明
+    private String qyDetail;
+    //规则说明
+    private String gzDetail;
+    //1不限制 2自定义  油品
+    private String oilLimit;
+    //可用油品 oil_name 主键 可多选
+    private String oilNumber;
+    //1不限制2自定义  商品
+    private String productLimit;
+    //商品id
+    private String productIds;
+    //1不限制2自定义  有效期
+    private String timeLimit;
+    //生效开始时间
+    private Date effectiveDateStart;
+    //生效结束时间
+    private Date effectiveDateEnd;
+    //创建者
+    private String createBy;
+    //创建时间
+    private Date createTime;
+    //更新者
+    private String updateBy;
+    //更新时间
+    private Date updateTime;
+
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public Integer getChainStoreId() {
+        return chainStoreId;
+    }
+
+    public void setChainStoreId(Integer chainStoreId) {
+        this.chainStoreId = chainStoreId;
+    }
+
+    public Integer getStoreId() {
+        return storeId;
+    }
+
+    public void setStoreId(Integer storeId) {
+        this.storeId = storeId;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getQyDetail() {
+        return qyDetail;
+    }
+
+    public void setQyDetail(String qyDetail) {
+        this.qyDetail = qyDetail;
+    }
+
+    public String getGzDetail() {
+        return gzDetail;
+    }
+
+    public void setGzDetail(String gzDetail) {
+        this.gzDetail = gzDetail;
+    }
+
+    public String getOilLimit() {
+        return oilLimit;
+    }
+
+    public void setOilLimit(String oilLimit) {
+        this.oilLimit = oilLimit;
+    }
+
+    public String getOilNumber() {
+        return oilNumber;
+    }
+
+    public void setOilNumber(String oilNumber) {
+        this.oilNumber = oilNumber;
+    }
+
+    public String getProductLimit() {
+        return productLimit;
+    }
+
+    public void setProductLimit(String productLimit) {
+        this.productLimit = productLimit;
+    }
+
+    public String getProductIds() {
+        return productIds;
+    }
+
+    public void setProductIds(String productIds) {
+        this.productIds = productIds;
+    }
+
+    public String getTimeLimit() {
+        return timeLimit;
+    }
+
+    public void setTimeLimit(String timeLimit) {
+        this.timeLimit = timeLimit;
+    }
+
+    public Date getEffectiveDateStart() {
+        return effectiveDateStart;
+    }
+
+    public void setEffectiveDateStart(Date effectiveDateStart) {
+        this.effectiveDateStart = effectiveDateStart;
+    }
+
+    public Date getEffectiveDateEnd() {
+        return effectiveDateEnd;
+    }
+
+    public void setEffectiveDateEnd(Date effectiveDateEnd) {
+        this.effectiveDateEnd = effectiveDateEnd;
+    }
+
+    public String getCreateBy() {
+        return createBy;
+    }
+
+    public void setCreateBy(String createBy) {
+        this.createBy = createBy;
+    }
+
+    public Date getCreateTime() {
+        return createTime;
+    }
+
+    public void setCreateTime(Date createTime) {
+        this.createTime = createTime;
+    }
+
+    public String getUpdateBy() {
+        return updateBy;
+    }
+
+    public void setUpdateBy(String updateBy) {
+        this.updateBy = updateBy;
+    }
+
+    public Date getUpdateTime() {
+        return updateTime;
+    }
+
+    public void setUpdateTime(Date updateTime) {
+        this.updateTime = updateTime;
+    }
+
+    /**
+     * 获取主键值
+     *
+     * @return 主键值
+     */
+    @Override
+    protected Serializable pkVal() {
+        return this.id;
+    }
+    }
+
diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueRule/service/CardValueRuleService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueRule/service/CardValueRuleService.java
new file mode 100644
index 000000000..7803cacd8
--- /dev/null
+++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueRule/service/CardValueRuleService.java
@@ -0,0 +1,15 @@
+package com.fuint.business.marketingActivity.cardValueRule.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.fuint.business.marketingActivity.cardValueRule.entity.CardValueRule;
+
+/**
+ * 储值卡规则(CardValueRule)表服务接口
+ *
+ * @author makejava
+ * @since 2024-09-08 18:19:04
+ */
+public interface CardValueRuleService extends IService<CardValueRule> {
+
+}
+
diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueRule/service/impl/CardValueRuleServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueRule/service/impl/CardValueRuleServiceImpl.java
new file mode 100644
index 000000000..e4607eb17
--- /dev/null
+++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueRule/service/impl/CardValueRuleServiceImpl.java
@@ -0,0 +1,19 @@
+package com.fuint.business.marketingActivity.cardValueRule.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fuint.business.marketingActivity.cardValueRule.dao.CardValueRuleDao;
+import com.fuint.business.marketingActivity.cardValueRule.entity.CardValueRule;
+import com.fuint.business.marketingActivity.cardValueRule.service.CardValueRuleService;
+import org.springframework.stereotype.Service;
+
+/**
+ * 储值卡规则(CardValueRule)表服务实现类
+ *
+ * @author makejava
+ * @since 2024-09-08 18:19:04
+ */
+@Service("cardValueRuleService")
+public class CardValueRuleServiceImpl extends ServiceImpl<CardValueRuleDao, CardValueRule> implements CardValueRuleService {
+
+}
+