Przeglądaj źródła

积分,优惠券查询,id查询

koushanshan 1 rok temu
rodzic
commit
467bbc2cbf
46 zmienionych plików z 811 dodań i 91 usunięć
  1. 20 2
      src/main/java/com/dk/oauth/controller/integral/CouponSendController.java
  2. 1 1
      src/main/java/com/dk/oauth/controller/integral/IntegralController.java
  3. 31 2
      src/main/java/com/dk/oauth/controller/integral/IntegralItemController.java
  4. 34 6
      src/main/java/com/dk/oauth/controller/integral/IntegralShareController.java
  5. 31 2
      src/main/java/com/dk/oauth/controller/integral/SignRecordController.java
  6. 23 0
      src/main/java/com/dk/oauth/infrastructure/convert/integral/CouponSendConvert.java
  7. 9 2
      src/main/java/com/dk/oauth/mapper/integral/CouponMapper.xml
  8. 25 11
      src/main/java/com/dk/oauth/mapper/integral/CouponReceiveMapper.xml
  9. 8 0
      src/main/java/com/dk/oauth/mapper/integral/CouponSendMapper.java
  10. 29 12
      src/main/java/com/dk/oauth/mapper/integral/CouponSendMapper.xml
  11. 28 14
      src/main/java/com/dk/oauth/mapper/integral/CouponUseMapper.xml
  12. 2 4
      src/main/java/com/dk/oauth/mapper/integral/IntegralItemMapper.java
  13. 1 1
      src/main/java/com/dk/oauth/mapper/integral/IntegralMapper.java
  14. 1 1
      src/main/java/com/dk/oauth/mapper/integral/IntegralShareMapper.java
  15. 15 8
      src/main/java/com/dk/oauth/mapper/integral/IntegralShareMapper.xml
  16. 9 2
      src/main/java/com/dk/oauth/mapper/integral/IntegralTacticMapper.xml
  17. 16 0
      src/main/java/com/dk/oauth/model/VO/integral/CouponReceiveVO.java
  18. 6 0
      src/main/java/com/dk/oauth/model/VO/integral/CouponSendVO.java
  19. 16 0
      src/main/java/com/dk/oauth/model/VO/integral/CouponUseVO.java
  20. 11 3
      src/main/java/com/dk/oauth/model/VO/integral/CouponVO.java
  21. 100 0
      src/main/java/com/dk/oauth/model/VO/integral/IntegralShareVO.java
  22. 9 0
      src/main/java/com/dk/oauth/model/VO/integral/IntegralTacticVO.java
  23. 11 3
      src/main/java/com/dk/oauth/model/pojo/integral/Coupon.java
  24. 17 1
      src/main/java/com/dk/oauth/model/pojo/integral/CouponReceive.java
  25. 4 1
      src/main/java/com/dk/oauth/model/pojo/integral/CouponSend.java
  26. 17 1
      src/main/java/com/dk/oauth/model/pojo/integral/CouponUse.java
  27. 9 0
      src/main/java/com/dk/oauth/model/pojo/integral/IntegralShare.java
  28. 8 0
      src/main/java/com/dk/oauth/model/pojo/integral/IntegralTactic.java
  29. 11 3
      src/main/java/com/dk/oauth/model/query/integral/CouponQuery.java
  30. 16 0
      src/main/java/com/dk/oauth/model/query/integral/CouponReceiveQuery.java
  31. 5 0
      src/main/java/com/dk/oauth/model/query/integral/CouponSendQuery.java
  32. 16 0
      src/main/java/com/dk/oauth/model/query/integral/CouponUseQuery.java
  33. 9 0
      src/main/java/com/dk/oauth/model/query/integral/IntegralShareQuery.java
  34. 9 0
      src/main/java/com/dk/oauth/model/query/integral/IntegralTacticQuery.java
  35. 16 0
      src/main/java/com/dk/oauth/model/response/integral/CouponReceiveResponse.java
  36. 12 3
      src/main/java/com/dk/oauth/model/response/integral/CouponResponse.java
  37. 4 0
      src/main/java/com/dk/oauth/model/response/integral/CouponSendResponse.java
  38. 16 0
      src/main/java/com/dk/oauth/model/response/integral/CouponUseResponse.java
  39. 9 0
      src/main/java/com/dk/oauth/model/response/integral/IntegralShareResponse.java
  40. 7 0
      src/main/java/com/dk/oauth/model/response/integral/IntegralTacticResponse.java
  41. 93 6
      src/main/java/com/dk/oauth/service/integral/CouponSendService.java
  42. 33 0
      src/main/java/com/dk/oauth/service/integral/IntegralItemService.java
  43. 12 0
      src/main/java/com/dk/oauth/service/integral/IntegralService.java
  44. 30 0
      src/main/java/com/dk/oauth/service/integral/IntegralShareService.java
  45. 3 2
      src/main/java/com/dk/oauth/service/integral/IntegralTacticService.java
  46. 19 0
      src/main/java/com/dk/oauth/service/integral/SignRecordService.java

+ 20 - 2
src/main/java/com/dk/oauth/controller/integral/CouponSendController.java

@@ -2,6 +2,7 @@ package com.dk.oauth.controller.integral;
 
 import com.dk.common.model.pojo.PageList;
 import com.dk.common.response.ResponseResultVO;
+import com.dk.oauth.model.VO.integral.CouponSendVO;
 import com.dk.oauth.model.pojo.integral.CouponSend;
 import com.dk.common.controller.BaseController;
 import com.dk.common.service.BaseService;
@@ -15,9 +16,11 @@ import org.springframework.beans.factory.annotation.Autowired;
 import io.swagger.annotations.Api;
 import com.dk.oauth.service.integral.CouponSendService;
 
+import javax.validation.Valid;
+
 @Api(tags = "优惠券发出API接口")
 @RestController
-@RequestMapping("/oauth/couponSend")
+@RequestMapping("/oauth/couponSend/")
 public class CouponSendController{
 
     public BaseService<CouponSend> getService() {
@@ -44,9 +47,24 @@ public class CouponSendController{
      * @date   : 2024/7/25 10:21
      * @author : 寇珊珊
      */
-    @PostMapping({"/{id}"})
+    @PostMapping({"{id}"})
     public ResponseResultVO<?> selectById(@PathVariable String id) {
         return couponSendService.selectById(id);
     }
 
+    /**
+     * @desc   : 新建
+     * @date   : 2024/7/25 13:06
+     * @author : 寇珊珊
+     */
+    @ApiOperation(
+            value = "新建",
+            notes = "新建"
+    )
+    @PostMapping({"insert"})
+    public ResponseResultVO<?> otherOutboundInsert(@Valid @RequestBody CouponSendVO couponSendVO) {
+        return couponSendService.insert(couponSendVO);
+    }
+
+
 }

+ 1 - 1
src/main/java/com/dk/oauth/controller/integral/IntegralController.java

@@ -41,7 +41,7 @@ public class IntegralController{
      * @author : 寇珊珊
      */
     @PostMapping({"/{id}"})
-    public ResponseResultVO<?> selectById(@PathVariable String id) {
+    public ResponseResultVO<?> selectById(@PathVariable Integer id) {
         return integralService.selectById(id);
     }
 

+ 31 - 2
src/main/java/com/dk/oauth/controller/integral/IntegralItemController.java

@@ -1,11 +1,17 @@
 package com.dk.oauth.controller.integral;
 
+import com.dk.common.model.pojo.PageList;
+import com.dk.common.response.ResponseResultVO;
 import com.dk.oauth.model.pojo.integral.IntegralItem;
 import com.dk.common.controller.BaseController;
 import com.dk.common.service.BaseService;
-import org.springframework.web.bind.annotation.RequestMapping;
+import com.dk.oauth.model.query.integral.IntegralItemQuery;
+import com.dk.oauth.model.query.integral.IntegralQuery;
+import com.dk.oauth.model.response.integral.IntegralItemResponse;
+import com.dk.oauth.model.response.integral.IntegralResponse;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.web.bind.annotation.*;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.RestController;
 import io.swagger.annotations.Api;
 import com.dk.oauth.service.integral.IntegralItemService;
 
@@ -21,4 +27,27 @@ public class IntegralItemController{
     @Autowired
     private IntegralItemService integralItemService;
 
+
+    /**
+     * @desc   : 条件查询
+     * @date   : 2024/7/24 15:46
+     * @author : 寇珊珊
+     */
+    @ApiOperation(value = "分页、关联、条件查询", notes = "分页、关联、条件查询")
+    @PostMapping({"list_by"})
+    public ResponseResultVO<PageList<IntegralItemResponse>> selectByCond(@RequestBody IntegralItemQuery integralItemQuery) {
+        return integralItemService.selectByCond(integralItemQuery);
+    }
+
+    /**
+     * @desc   : 通过ID查询
+     * @date   : 2024/7/24 15:48
+     * @author : 寇珊珊
+     */
+    @PostMapping({"/{id}"})
+    public ResponseResultVO<?> selectById(@PathVariable Integer id) {
+        return integralItemService.selectById(id);
+    }
+
+
 }

+ 34 - 6
src/main/java/com/dk/oauth/controller/integral/IntegralShareController.java

@@ -1,13 +1,16 @@
 package com.dk.oauth.controller.integral;
 
-import com.dk.oauth.model.pojo.integral.IntegralShare;
-import com.dk.common.controller.BaseController;
+import com.dk.common.model.pojo.PageList;
+import com.dk.common.response.ResponseResultVO;
 import com.dk.common.service.BaseService;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.RestController;
-import io.swagger.annotations.Api;
+import com.dk.oauth.model.pojo.integral.IntegralShare;
+import com.dk.oauth.model.query.integral.IntegralShareQuery;
+import com.dk.oauth.model.response.integral.IntegralShareResponse;
 import com.dk.oauth.service.integral.IntegralShareService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
 
 @Api(tags = "积分分享API接口")
 @RestController
@@ -21,4 +24,29 @@ public class IntegralShareController{
     @Autowired
     private IntegralShareService integralShareService;
 
+
+
+    /**
+     * @desc   : 条件查询
+     * @date   : 2024/7/24 15:46
+     * @author : 寇珊珊
+     */
+    @ApiOperation(value = "分页、关联、条件查询", notes = "分页、关联、条件查询")
+    @PostMapping({"list_by"})
+    public ResponseResultVO<PageList<IntegralShareResponse>> selectByCond(@RequestBody IntegralShareQuery integralShareQuery ) {
+        return integralShareService.selectByCond(integralShareQuery);
+    }
+
+    /**
+     * @desc   : 通过ID查询
+     * @date   : 2024/7/24 15:48
+     * @author : 寇珊珊
+     */
+    @PostMapping({"/{id}"})
+    public ResponseResultVO<?> selectById(@PathVariable Integer id) {
+        return integralShareService.selectById(id);
+    }
+
+
+
 }

+ 31 - 2
src/main/java/com/dk/oauth/controller/integral/SignRecordController.java

@@ -1,11 +1,17 @@
 package com.dk.oauth.controller.integral;
 
+import com.dk.common.model.pojo.PageList;
+import com.dk.common.response.ResponseResultVO;
 import com.dk.oauth.model.pojo.integral.SignRecord;
 import com.dk.common.controller.BaseController;
 import com.dk.common.service.BaseService;
-import org.springframework.web.bind.annotation.RequestMapping;
+import com.dk.oauth.model.query.integral.IntegralItemQuery;
+import com.dk.oauth.model.query.integral.SignRecordQuery;
+import com.dk.oauth.model.response.integral.IntegralItemResponse;
+import com.dk.oauth.model.response.integral.SignRecordResponse;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.web.bind.annotation.*;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.RestController;
 import io.swagger.annotations.Api;
 import com.dk.oauth.service.integral.SignRecordService;
 
@@ -21,4 +27,27 @@ public class SignRecordController{
     @Autowired
     private SignRecordService signRecordService;
 
+
+    /**
+     * @desc   : 条件查询
+     * @date   : 2024/7/24 15:46
+     * @author : 寇珊珊
+     */
+    @ApiOperation(value = "分页、关联、条件查询", notes = "分页、关联、条件查询")
+    @PostMapping({"list_by"})
+    public ResponseResultVO<PageList<SignRecordResponse>> selectByCond(@RequestBody SignRecordQuery signRecordQuery) {
+        return signRecordService.selectByCond(signRecordQuery);
+    }
+
+    /**
+     * @desc   : 通过ID查询
+     * @date   : 2024/7/24 15:48
+     * @author : 寇珊珊
+     */
+    @PostMapping({"/{id}"})
+    public ResponseResultVO<?> selectById(@PathVariable String id) {
+        return signRecordService.selectById(id);
+    }
+
+
 }

+ 23 - 0
src/main/java/com/dk/oauth/infrastructure/convert/integral/CouponSendConvert.java

@@ -0,0 +1,23 @@
+package com.dk.oauth.infrastructure.convert.integral;
+
+import com.dk.oauth.model.VO.integral.CouponSendVO;
+import com.dk.oauth.model.pojo.integral.CouponSend;
+import org.mapstruct.Mapper;
+
+/**
+ * @desc   : 优惠券发出实体类型转换
+ * @date   : 2024/7/26 9:36
+ * @author : 寇珊珊
+ */
+@Mapper(componentModel = "spring")
+public interface CouponSendConvert {
+
+    /**
+     * @desc   : VO转pojo
+     * @date   : 2024/7/26 9:37
+     * @author : 寇珊珊
+     */
+    CouponSend convertToPo(CouponSendVO couponSendVO);
+
+
+}

+ 9 - 2
src/main/java/com/dk/oauth/mapper/integral/CouponMapper.xml

@@ -5,11 +5,11 @@
     <!-- 通用设置 -->
     <!-- 通用查询列 -->
     <sql id="Base_Column_List">
-        coupon_id, coupon_name, coupon_desc, discount, use_valid_days, user_num, display_no, flg_valid,grade_code
+        coupon_id, coupon_name, coupon_desc, discount, use_valid_days, user_num, display_no, flg_valid,grade_code,link_valid_times
     </sql>
     <!-- 通用查询列Response -->
     <sql id="Base_Column_List_Response">
-        tmc.coupon_id, tmc.coupon_name, tmc.coupon_desc, tmc.discount, tmc.use_valid_days, tmc.user_num, tmc.display_no, tmc.flg_valid, tmc.grade_code
+        tmc.coupon_id, tmc.coupon_name, tmc.coupon_desc, tmc.discount, tmc.use_valid_days, tmc.user_num, tmc.display_no, tmc.flg_valid, tmc.grade_code, tmc.link_valid_times
     </sql>
 
 
@@ -20,6 +20,7 @@
                 <result column="coupon_desc" property="couponDesc"/>
                 <result column="discount" property="discount"/>
                 <result column="use_valid_days" property="useValidDays"/>
+                <result column="link_valid_times" property="linkValidTimes"/>
                 <result column="user_num" property="userNum"/>
                 <result column="display_no" property="displayNo"/>
                 <result column="flg_valid" property="flgValid"/>
@@ -32,6 +33,7 @@
         <result column="coupon_desc" property="couponDesc"/>
         <result column="discount" property="discount"/>
         <result column="use_valid_days" property="useValidDays"/>
+        <result column="link_valid_times" property="linkValidTimes"/>
         <result column="user_num" property="userNum"/>
         <result column="display_no" property="displayNo"/>
         <result column="flg_valid" property="flgValid"/>
@@ -54,6 +56,9 @@
             <if test="useValidDays != null">
                 AND tmc.use_valid_days = #{useValidDays}
             </if>
+            <if test="linkValidTimes != null">
+                AND tmc.link_valid_times = #{linkValidTimes}
+            </if>
             <if test="userNum != null">
                 AND tmc.user_num = #{userNum}
             </if>
@@ -130,6 +135,7 @@
             coupon_desc,
             discount,
             use_valid_days,
+            link_valid_times,
             user_num,
             display_no,
         </trim>
@@ -142,6 +148,7 @@
                 #{item.couponDesc},
                 #{item.discount},
                 #{item.useValidDays},
+                #{item.linkValidTimes},
                 #{item.userNum},
                 #{item.displayNo},
             </trim>

+ 25 - 11
src/main/java/com/dk/oauth/mapper/integral/CouponReceiveMapper.xml

@@ -5,28 +5,32 @@
     <!-- 通用设置 -->
     <!-- 通用查询列 -->
     <sql id="Base_Column_List">
-        cp_id, coupon_id, user_wxid, assist_date, flg_valid
+        receive_id, cp_id, coupon_id, send_id, user_wxid, assist_date, flg_valid
     </sql>
     <!-- 通用查询列Response -->
     <sql id="Base_Column_List_Response">
-        tmcr.cp_id, tmcr.coupon_id, tmcr.user_wxid, tmcr.assist_date, tmcr.flg_valid
+        tmcr.receive_id,tmcr.cp_id, tmcr.send_id, tmcr.coupon_id, tmcr.user_wxid, tmcr.assist_date, tmcr.flg_valid
     </sql>
 
 
     <!-- 通用查询映射结果 -->
     <resultMap id="BaseResultMap" type="com.dk.oauth.model.pojo.integral.CouponReceive">
-        <id column="cp_id" property="cpId" />
-                <result column="coupon_id" property="couponId" typeHandler="UuidTypeHandler"/>
-                <result column="user_wxid" property="userWxid"/>
-            <result column="assist_date" property="assistDate" typeHandler="TimestampTypeHandler"/>
-                <result column="flg_valid" property="flgValid"/>
+        <id column="receive_id" property="receiveId"/>
+        <result column="cp_id" property="cpId"/>
+        <result column="coupon_id" property="couponId" typeHandler="UuidTypeHandler"/>
+        <result column="send_id" property="sendId" typeHandler="UuidTypeHandler"/>
+        <result column="user_wxid" property="userWxid"/>
+        <result column="assist_date" property="assistDate" typeHandler="TimestampTypeHandler"/>
+        <result column="flg_valid" property="flgValid"/>
     </resultMap>
     <!-- 通用查询映射结果 -->
     <resultMap id="BaseResultMapResponse" type="com.dk.oauth.model.response.integral.CouponReceiveResponse">
-        <id column="cp_id" property="cpId" />
+        <id column="receive_id" property="receiveId"/>
+        <result column="cp_id" property="cpId"/>
         <result column="cp_name" property="cpName"/>
         <result column="coupon_id" property="couponId" typeHandler="UuidTypeHandler"/>
         <result column="coupon_name" property="couponName" />
+        <result column="send_id" property="sendId" typeHandler="UuidTypeHandler"/>
         <result column="user_wxid" property="userWxid"/>
         <result column="assist_date" property="assistDate" typeHandler="TimestampTypeHandler"/>
         <result column="flg_valid" property="flgValid"/>
@@ -36,9 +40,15 @@
     <!-- 通用条件列 -->
     <sql id="Condition">
         <where>
+            <if test="cpId != null and cpId != ''">
+                AND tmcr.cp_id = #{cpId}::
+            </if>
             <if test="couponId != null and couponId != ''">
                 AND tmcr.coupon_id = #{couponId}::uuid
             </if>
+            <if test="sendId != null and sendId != ''">
+                AND tmcr.send_id = #{sendId}::uuid
+            </if>
             <if test="userWxid != null">
                 AND tmcr.user_wxid = #{userWxid}
             </if>
@@ -59,7 +69,7 @@
 
     <sql id="idsForeach">
         <!-- 根据主键cpId批量操作 -->
-        WHERE cp_id in
+        WHERE receive_id in
         <foreach collection="ids" index="index" item="item" separator="," open="(" close=")">
             #{item}
         </foreach>
@@ -99,7 +109,7 @@
         FROM dkic_a.t_mst_coupon_receive tmcr
         left join dkic_a.t_mst_coupon tmc on tmc.coupon_id = tmcr.coupon_id
         left join dkic_a.t_a_company tac on tac.cp_id = tmcr.cp_id
-        WHERE cp_id = #{id}
+        WHERE receive_id = #{id}
     </select>
 
     <!-- 根据主键锁定表dkic_a.t_mst_coupon_receive的一行数据 -->
@@ -107,7 +117,7 @@
         SELECT
         <include refid="Base_Column_List"/>
         FROM dkic_a.t_mst_coupon_receive
-        WHERE cp_id = #{cpId}
+        WHERE receive_id = #{receiveId}
         for update
     </select>
 
@@ -124,7 +134,9 @@
         insert into dkic_a.t_mst_coupon_receive
         (
         <trim suffixOverrides=",">
+            cp_id,
             coupon_id,
+            send_id,
             user_wxid,
             assist_date,
         </trim>
@@ -133,7 +145,9 @@
         <foreach collection="list" index="index" item="item" separator=",">
             (
             <trim suffixOverrides=",">
+                #{item.cpId},
                 #{item.couponId}::uuid,
+                #{item.sendId}::uuid,
                 #{item.userWxid},
                 #{item.assistDate},
             </trim>

+ 8 - 0
src/main/java/com/dk/oauth/mapper/integral/CouponSendMapper.java

@@ -37,6 +37,14 @@ public interface CouponSendMapper extends BaseMapper<CouponSend>{
      * @author : 寇珊珊
      */
     Long countByCond(CouponSendQuery couponSendQuery);
+
+
+    /**
+     * @desc   : 根据公司id和优惠券id查询截止时间
+     * @date   : 2024/7/25 13:13
+     * @author : 寇珊珊
+     */
+    CouponSendResponse selectEndTime(CouponSendQuery couponSendQuery);
 	
 }
 

+ 29 - 12
src/main/java/com/dk/oauth/mapper/integral/CouponSendMapper.xml

@@ -5,25 +5,27 @@
     <!-- 通用设置 -->
     <!-- 通用查询列 -->
     <sql id="Base_Column_List">
-        cp_id, coupon_id, send_date, end_date, user_num, flg_valid
+        send_id,cp_id, coupon_id, send_date, end_date, user_num, flg_valid
     </sql>
     <!-- 通用查询列Response -->
     <sql id="Base_Column_List_Response">
-        tmcs.cp_id, tmcs.coupon_id, tmcs.send_date, tmcs.end_date, tmcs.user_num, tmcs.flg_valid
+        tmcs.send_id,tmcs.cp_id, tmcs.coupon_id, tmcs.send_date, tmcs.end_date, tmcs.user_num, tmcs.flg_valid
     </sql>
 
     <!-- 通用查询映射结果 -->
     <resultMap id="BaseResultMap" type="com.dk.oauth.model.pojo.integral.CouponSend">
-        <id column="cp_id" property="cpId" />
-                <result column="coupon_id" property="couponId" typeHandler="UuidTypeHandler"/>
-            <result column="send_date" property="sendDate" typeHandler="TimestampTypeHandler"/>
-            <result column="end_date" property="endDate" typeHandler="TimestampTypeHandler"/>
-                <result column="user_num" property="userNum"/>
-                <result column="flg_valid" property="flgValid"/>
+        <id column="send_id" property="sendId" typeHandler="UuidTypeHandler"/>
+        <result column="cp_id" property="cpId"/>
+        <result column="coupon_id" property="couponId" typeHandler="UuidTypeHandler"/>
+        <result column="send_date" property="sendDate" typeHandler="TimestampTypeHandler"/>
+        <result column="end_date" property="endDate" typeHandler="TimestampTypeHandler"/>
+        <result column="user_num" property="userNum"/>
+        <result column="flg_valid" property="flgValid"/>
     </resultMap>
     <!-- 通用查询映射结果 -->
     <resultMap id="BaseResultMapResponse" type="com.dk.oauth.model.response.integral.CouponSendResponse">
-        <id column="cp_id" property="cpId" />
+        <id column="send_id" property="sendId" typeHandler="UuidTypeHandler"/>
+        <result column="cp_id" property="cpId"/>
         <result column="coupon_id" property="couponId" typeHandler="UuidTypeHandler"/>
         <result column="send_date" property="sendDate" typeHandler="TimestampTypeHandler"/>
         <result column="end_date" property="endDate" typeHandler="TimestampTypeHandler"/>
@@ -36,6 +38,9 @@
     <!-- 通用条件列 -->
     <sql id="Condition">
         <where>
+            <if test="cpId != null and cpId != ''">
+                AND tmcs.cp_id = #{cpId}
+            </if>
             <if test="couponId != null and couponId != ''">
                 AND tmcs.coupon_id = #{couponId}
             </if>
@@ -62,7 +67,7 @@
 
     <sql id="idsForeach">
         <!-- 根据主键cpId批量操作 -->
-        WHERE cp_id in
+        WHERE send_id in
         <foreach collection="ids" index="index" item="item" separator="," open="(" close=")">
             #{item}
         </foreach>
@@ -97,7 +102,7 @@
         <include refid="Base_Column_List_Response"/>
         ,tac.cp_name
         ,tmc.coupon_name
-        FROM dkic_a.t_mst_coupon_send
+        FROM dkic_a.t_mst_coupon_send tmcs
         left join dkic_a.t_a_company tac on tac.cp_id = tmcs.cp_id
         left join dkic_a.t_mst_coupon tmc on tmc.coupon_id = tmcs.coupon_id
         WHERE cp_id = #{id}
@@ -108,7 +113,7 @@
         SELECT
         <include refid="Base_Column_List"/>
         FROM dkic_a.t_mst_coupon_send
-        WHERE cp_id = #{cpId}
+        WHERE send_id = #{sendId}
         for update
     </select>
 
@@ -125,6 +130,7 @@
         insert into dkic_a.t_mst_coupon_send
         (
         <trim suffixOverrides=",">
+            cp_id,
             coupon_id,
             send_date,
             end_date,
@@ -135,6 +141,7 @@
         <foreach collection="list" index="index" item="item" separator=",">
             (
             <trim suffixOverrides=",">
+                #{item.cpId},
                 #{item.couponId}::uuid,
                 #{item.sendDate},
                 #{item.endDate},
@@ -143,4 +150,14 @@
             )
         </foreach>
     </insert>
+
+
+    <!-- 根据公司id和优惠券id查询截止时间 -->
+    <select id="selectEndTime" resultMap="BaseResultMapResponse">
+        SELECT end_date
+        FROM dkic_a.t_mst_coupon_send
+        WHERE send_id = #{sendId}::uuid
+    </select>
+
+
 </mapper>

+ 28 - 14
src/main/java/com/dk/oauth/mapper/integral/CouponUseMapper.xml

@@ -5,27 +5,31 @@
     <!-- 通用设置 -->
     <!-- 通用查询列 -->
     <sql id="Base_Column_List">
-        cp_id, coupon_id, use_valid_days, receive_date, use_date, coupon_status, receive_user, flg_valid
+        use_id, cp_id, send_id, coupon_id, use_valid_days, receive_date, use_date, coupon_status, receive_user, flg_valid
     </sql>
     <!-- 通用查询列Response -->
     <sql id="Base_Column_List_Response">
-        tmcu.cp_id, tmcu.coupon_id, tmcu.use_valid_days, tmcu.receive_date, tmcu.use_date, tmcu.coupon_status, tmcu.receive_user, tmcu.flg_valid
+        tmcu.use_id, tmcu.cp_id, tmcu.send_id, tmcu.coupon_id, tmcu.use_valid_days, tmcu.receive_date, tmcu.use_date, tmcu.coupon_status, tmcu.receive_user, tmcu.flg_valid
     </sql>
 
     <!-- 通用查询映射结果 -->
     <resultMap id="BaseResultMap" type="com.dk.oauth.model.pojo.integral.CouponUse">
-        <id column="cp_id" property="cpId"  />
-                <result column="coupon_id" property="couponId" typeHandler="UuidTypeHandler"/>
-                <result column="use_valid_days" property="useValidDays"/>
-            <result column="receive_date" property="receiveDate" typeHandler="TimestampTypeHandler"/>
-            <result column="use_date" property="useDate" typeHandler="TimestampTypeHandler"/>
-                <result column="coupon_status" property="couponStatus"/>
-                <result column="receive_user" property="receiveUser" typeHandler="UuidTypeHandler"/>
-                <result column="flg_valid" property="flgValid"/>
+        <id column="use_id" property="useId" typeHandler="UuidTypeHandler"/>
+        <result column="cp_id" property="cpId"/>
+        <result column="send_id" property="sendId" typeHandler="UuidTypeHandler"/>
+        <result column="coupon_id" property="couponId" typeHandler="UuidTypeHandler"/>
+        <result column="use_valid_days" property="useValidDays"/>
+        <result column="receive_date" property="receiveDate" typeHandler="TimestampTypeHandler"/>
+        <result column="use_date" property="useDate" typeHandler="TimestampTypeHandler"/>
+        <result column="coupon_status" property="couponStatus"/>
+        <result column="receive_user" property="receiveUser" typeHandler="UuidTypeHandler"/>
+        <result column="flg_valid" property="flgValid"/>
     </resultMap>
     <!-- 通用查询映射结果Response -->
     <resultMap id="BaseResultMapResponse" type="com.dk.oauth.model.response.integral.CouponUseResponse">
-        <id column="cp_id" property="cpId" />
+        <id column="use_id" property="useId" typeHandler="UuidTypeHandler"/>
+        <result column="cp_id" property="cpId"/>
+        <result column="send_id" property="sendId" typeHandler="UuidTypeHandler"/>
         <result column="cp_name" property="cpName"/>
         <result column="coupon_id" property="couponId" typeHandler="UuidTypeHandler"/>
         <result column="coupon_name" property="couponName" />
@@ -41,6 +45,12 @@
     <!-- 通用条件列 -->
     <sql id="Condition">
         <where>
+            <if test="cpId != null and cpId != ''">
+                AND tmcu.cp_id = #{cpId}
+            </if>
+            <if test="sendId != null and sendId != ''">
+                AND tmcu.send_id = #{sendId}::uuid
+            </if>
             <if test="couponId != null and couponId != ''">
                 AND tmcu.coupon_id = #{couponId}::uuid
             </if>
@@ -73,7 +83,7 @@
 
     <sql id="idsForeach">
         <!-- 根据主键cpId批量操作 -->
-        WHERE cp_id in
+        WHERE use_id in
         <foreach collection="ids" index="index" item="item" separator="," open="(" close=")">
             #{item}
         </foreach>
@@ -113,7 +123,7 @@
         FROM dkic_a.t_mst_coupon_use tmcu
         left join dkic_a.t_mst_coupon tmc on tmc.coupon_id = tmcu.coupon_id
         left join dkic_a.t_a_company tac on tac.cp_id = tmcu.cp_id
-        WHERE cp_id = #{id}
+        WHERE use_id = #{id}
     </select>
 
     <!-- 根据主键锁定表t_mst_coupon_use的一行数据 -->
@@ -121,7 +131,7 @@
         SELECT
         <include refid="Base_Column_List"/>
         FROM dkic_a.t_mst_coupon_use
-        WHERE cp_id = #{cpId}
+        WHERE use_id = #{useId}
         for update
     </select>
 
@@ -138,7 +148,9 @@
         insert into dkic_a.t_mst_coupon_use
         (
         <trim suffixOverrides=",">
+            cp_id,
             coupon_id,
+            send_id,
             use_valid_days,
             receive_date,
             use_date,
@@ -150,6 +162,8 @@
         <foreach collection="list" index="index" item="item" separator=",">
             (
             <trim suffixOverrides=",">
+                #{item.cpId},
+                #{item.sendId}::uuid,
                 #{item.couponId}::uuid,
                 #{item.useValidDays},
                 #{item.receiveDate},

+ 2 - 4
src/main/java/com/dk/oauth/mapper/integral/IntegralItemMapper.java

@@ -1,10 +1,8 @@
 package com.dk.oauth.mapper.integral;
 
-import com.dk.oauth.model.pojo.integral.IntegralItem;
 import com.dk.common.mapper.BaseMapper;
-import com.dk.oauth.model.query.integral.CouponReceiveQuery;
+import com.dk.oauth.model.pojo.integral.IntegralItem;
 import com.dk.oauth.model.query.integral.IntegralItemQuery;
-import com.dk.oauth.model.response.integral.CouponReceiveResponse;
 import com.dk.oauth.model.response.integral.IntegralItemResponse;
 import org.apache.ibatis.annotations.Param;
 import org.springframework.stereotype.Repository;
@@ -22,7 +20,7 @@ public interface IntegralItemMapper extends BaseMapper<IntegralItem>{
      * @date   : 2024/7/24 9:23
      * @author : 寇珊珊
      */
-    IntegralItemResponse selectById(@Param("id") String id);
+    IntegralItemResponse selectById(@Param("id") Integer id);
 
     /**
      * @desc   : 条件查询

+ 1 - 1
src/main/java/com/dk/oauth/mapper/integral/IntegralMapper.java

@@ -20,7 +20,7 @@ public interface IntegralMapper extends BaseMapper<Integral>{
      * @date   : 2024/7/24 10:14
      * @author : 寇珊珊
      */
-    IntegralResponse selectById(@Param("id") String id);
+    IntegralResponse selectById(@Param("id") Integer id);
 
     /**
      * @desc   : 条件查询

+ 1 - 1
src/main/java/com/dk/oauth/mapper/integral/IntegralShareMapper.java

@@ -22,7 +22,7 @@ public interface IntegralShareMapper extends BaseMapper<IntegralShare>{
      * @date   : 2024/7/24 9:23
      * @author : 寇珊珊
      */
-    IntegralShareResponse selectById(@Param("id") String id);
+    IntegralShareResponse selectById(@Param("id") Integer id);
 
     /**
      * @desc   : 条件查询

+ 15 - 8
src/main/java/com/dk/oauth/mapper/integral/IntegralShareMapper.xml

@@ -5,24 +5,26 @@
     <!-- 通用设置 -->
     <!-- 通用查询列 -->
     <sql id="Base_Column_List">
-        cp_id, tactic_id, share_date, end_date, flg_valid
+        cp_id, user_id, tactic_id, share_date, end_date, flg_valid
     </sql>
     <!-- 通用查询列Response -->
     <sql id="Base_Column_List_Response">
-        tmis.cp_id, tmis.tactic_id, tmis.share_date, tmis.end_date, tmis.flg_valid
+        tmis.cp_id, tmis.user_id, tmis.tactic_id, tmis.share_date, tmis.end_date, tmis.flg_valid
     </sql>
 
     <!-- 通用查询映射结果 -->
     <resultMap id="BaseResultMap" type="com.dk.oauth.model.pojo.integral.IntegralShare">
-        <id column="cp_id" property="cpId" />
-                <result column="tactic_id" property="tacticId" typeHandler="UuidTypeHandler"/>
-            <result column="share_date" property="shareDate" typeHandler="TimestampTypeHandler"/>
-            <result column="end_date" property="endDate" typeHandler="TimestampTypeHandler"/>
-                <result column="flg_valid" property="flgValid"/>
+        <id column="cp_id" property="cpId"/>
+        <result column="user_id" property="userId" typeHandler="UuidTypeHandler"/>
+        <result column="tactic_id" property="tacticId" typeHandler="UuidTypeHandler"/>
+        <result column="share_date" property="shareDate" typeHandler="TimestampTypeHandler"/>
+        <result column="end_date" property="endDate" typeHandler="TimestampTypeHandler"/>
+        <result column="flg_valid" property="flgValid"/>
     </resultMap>
     <!-- 通用查询映射结果 -->
     <resultMap id="BaseResultMapResponse" type="com.dk.oauth.model.response.integral.IntegralShareResponse">
         <id column="cp_id" property="cpId" />
+        <result column="user_id" property="userId" typeHandler="UuidTypeHandler"/>
         <result column="tactic_id" property="tacticId" typeHandler="UuidTypeHandler"/>
         <result column="share_date" property="shareDate" typeHandler="TimestampTypeHandler"/>
         <result column="end_date" property="endDate" typeHandler="TimestampTypeHandler"/>
@@ -34,7 +36,10 @@
     <sql id="Condition">
         <where>
             <if test="tacticId != null and tacticId != ''">
-                AND tmis.tactic_id = #{tacticId}
+                AND tmis.tactic_id = #{tacticId}::uuid
+            </if>
+            <if test="userId != null and userId != ''">
+                AND tmis.user_id = #{userId}::uuid
             </if>
             <if test="shareDate != null">
                 AND tmis.share_date = #{shareDate}
@@ -113,6 +118,7 @@
             tactic_id,
             share_date,
             end_date,
+            user_id,
         </trim>
         )
         values
@@ -122,6 +128,7 @@
                 #{item.tacticId}::uuid,
                 #{item.shareDate},
                 #{item.endDate},
+                #{item.userId}::uuid,
             </trim>
             )
         </foreach>

+ 9 - 2
src/main/java/com/dk/oauth/mapper/integral/IntegralTacticMapper.xml

@@ -5,16 +5,17 @@
     <!-- 通用设置 -->
     <!-- 通用查询列 -->
     <sql id="Base_Column_List">
-        tactic_id, reg_integral, sign_integral, fifteen_integral, share_integral, share_reg_integral, sign_day_num
+        tactic_id, share_day_num, reg_integral, sign_integral, fifteen_integral, share_integral, share_reg_integral, sign_day_num
     </sql>
     <!-- 通用查询列Response -->
     <sql id="Base_Column_List_Response">
-        tmit.tactic_id, tmit.reg_integral, tmit.sign_integral, tmit.fifteen_integral, tmit.share_integral, tmit.share_reg_integral, tmit.sign_day_num
+        tmit.tactic_id, tmit.share_day_num, tmit.reg_integral, tmit.sign_integral, tmit.fifteen_integral, tmit.share_integral, tmit.share_reg_integral, tmit.sign_day_num
     </sql>
 
     <!-- 通用查询映射结果 -->
     <resultMap id="BaseResultMap" type="com.dk.oauth.model.pojo.integral.IntegralTactic">
         <id column="tactic_id" property="tacticId"/>
+                <result column="share_day_num" property="shareDayNum"/>
                 <result column="reg_integral" property="regIntegral"/>
                 <result column="sign_integral" property="signIntegral"/>
                 <result column="fifteen_integral" property="fifteenIntegral"/>
@@ -25,6 +26,7 @@
     <!-- 通用查询映射结果 -->
     <resultMap id="BaseResultMapResponse" type="com.dk.oauth.model.response.integral.IntegralTacticResponse">
         <id column="tactic_id" property="tacticId"/>
+        <result column="share_day_num" property="shareDayNum"/>
         <result column="reg_integral" property="regIntegral"/>
         <result column="sign_integral" property="signIntegral"/>
         <result column="fifteen_integral" property="fifteenIntegral"/>
@@ -55,6 +57,9 @@
             <if test="signDayNum != null">
                 AND tmit.sign_day_num = #{signDayNum}
             </if>
+            <if test="shareDayNum != null">
+                AND tmit.share_day_num = #{shareDayNum}
+            </if>
         </where>
     </sql>
 
@@ -121,6 +126,7 @@
             share_integral,
             share_reg_integral,
             sign_day_num,
+            share_day_num,
         </trim>
         )
         values
@@ -133,6 +139,7 @@
                 #{item.shareIntegral},
                 #{item.shareRegIntegral},
                 #{item.signDayNum},
+                #{item.shareDayNum},
             </trim>
             )
         </foreach>

+ 16 - 0
src/main/java/com/dk/oauth/model/VO/integral/CouponReceiveVO.java

@@ -30,6 +30,14 @@ public class CouponReceiveVO  {
      */
 
     /**
+     * 优惠券获取ID
+     */
+    @ApiModelProperty(value = "优惠券获取ID")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String receiveId;
+
+
+    /**
      * 公司ID
      */
     @ApiModelProperty(value = "公司ID")
@@ -46,6 +54,14 @@ public class CouponReceiveVO  {
 
 
     /**
+     * 优惠券发出ID
+     */
+    @ApiModelProperty(value = "优惠券发出ID")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String sendId;
+
+
+    /**
      * 微信Id
      */
     @Excel(name = "微信Id")

+ 6 - 0
src/main/java/com/dk/oauth/model/VO/integral/CouponSendVO.java

@@ -32,6 +32,12 @@ public class CouponSendVO  {
      * 数据库字段
      */
 
+
+    @ApiModelProperty(value = "优惠券发出Id")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String sendId;
+
+
     /**
      * 公司ID
      */

+ 16 - 0
src/main/java/com/dk/oauth/model/VO/integral/CouponUseVO.java

@@ -33,6 +33,14 @@ public class CouponUseVO{
      */
 
     /**
+     * 优惠券使用ID
+     */
+    @ApiModelProperty(value = "优惠券使用ID")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String useId;
+
+
+    /**
      * 公司ID
      */
     @ApiModelProperty(value = "公司ID")
@@ -40,6 +48,14 @@ public class CouponUseVO{
 
 
     /**
+     * 优惠券发出ID
+     */
+    @ApiModelProperty(value = "优惠券发出ID")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String sendId;
+
+
+    /**
      * 优惠券ID
      */
     @Excel(name = "优惠券ID")

+ 11 - 3
src/main/java/com/dk/oauth/model/VO/integral/CouponVO.java

@@ -63,14 +63,22 @@ public class CouponVO  {
 
 
     /**
-     * 使用有效期 (优惠券在使用有效期内有效)
+     * 使用有效期 (优惠券在使用有效期内有效(单位:天))
      */
-    @Excel(name = "使用有效期 (优惠券在使用有效期内有效)")
-    @ApiModelProperty(value = "使用有效期 (优惠券在使用有效期内有效)")
+    @Excel(name = "使用有效期 (优惠券在使用有效期内有效(单位:天))")
+    @ApiModelProperty(value = "使用有效期 (优惠券在使用有效期内有效(单位:天))")
     private Integer useValidDays;
 
 
     /**
+     * 链接有效期 (优惠券发出链接的有效期(单位:小时))
+     */
+    @Excel(name = "链接有效期 (优惠券发出链接的有效期(单位:小时))")
+    @ApiModelProperty(value = "链接有效期 (优惠券发出链接的有效期(单位:小时))")
+    private Integer linkValidTimes;
+
+
+    /**
      * 所需人数
      */
     @Excel(name = "所需人数")

+ 100 - 0
src/main/java/com/dk/oauth/model/VO/integral/IntegralShareVO.java

@@ -0,0 +1,100 @@
+package com.dk.oauth.model.VO.integral;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.dk.common.infrastructure.annotaiton.ExportTitle;
+import com.dk.common.infrastructure.handler.TimestampTypeHandler;
+import com.dk.common.infrastructure.handler.UuidTypeHandler;
+import com.dk.common.model.pojo.PageInfo;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ *  积分分享
+ */
+@Data
+@Accessors(chain = true)
+public class IntegralShareVO {
+
+    /*
+     * 数据库字段
+     */
+
+    /**
+     * 公司ID
+     */
+//    @TableId(value = "cp_id", type = IdType.AUTO)
+    @ApiModelProperty(value = "公司ID")
+    private Integer cpId;
+
+
+    /**
+     * 微信用户
+     */
+    @Excel(name = "微信用户")
+    @ApiModelProperty(value = "微信用户")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String userId;
+
+
+    /**
+     * 积分策略Id
+     */
+    @Excel(name = "积分策略Id")
+    @ApiModelProperty(value = "积分策略Id")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String tacticId;
+
+
+    /**
+     * 分享时间
+     */
+    @Excel(name = "分享时间")
+    @ApiModelProperty(value = "分享时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField(typeHandler = TimestampTypeHandler.class)
+    private LocalDateTime shareDate;
+
+
+    /**
+     * 截止时间
+     */
+    @Excel(name = "截止时间")
+    @ApiModelProperty(value = "截止时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    @TableField(typeHandler = TimestampTypeHandler.class)
+    private LocalDateTime endDate;
+
+
+    /**
+     * 有效标识 (1:正常 0:停用)
+     */
+    @Excel(name = "有效标识 (1:正常 0:停用)")
+    @ApiModelProperty(value = "有效标识 (1:正常 0:停用)")
+    private Boolean flgValid;
+
+
+    /*
+     * 相关属性
+     * @TableField(exist = false)
+     */
+
+    /*
+     * 关联属性 + 查询条件
+     * @TableField(exist = false)
+     */
+
+
+    private static final long serialVersionUID = 1L;
+
+}

+ 9 - 0
src/main/java/com/dk/oauth/model/VO/integral/IntegralTacticVO.java

@@ -83,6 +83,15 @@ public class IntegralTacticVO {
     private Integer signDayNum;
 
 
+    /**
+     * 每日分享次数
+     */
+    @Excel(name = "每日分享次数")
+    @ApiModelProperty(value = "每日分享次数")
+    private Integer shareDayNum;
+
+
+
     /*
      * 相关属性
      * @TableField(exist = false)

+ 11 - 3
src/main/java/com/dk/oauth/model/pojo/integral/Coupon.java

@@ -71,14 +71,22 @@ public class Coupon extends PageInfo<Coupon> implements Serializable {
 
 
     /**
-     * 使用有效期 (优惠券在使用有效期内有效)
+     * 使用有效期 (优惠券在使用有效期内有效(单位:天))
      */
-    @Excel(name = "使用有效期 (优惠券在使用有效期内有效)")
-    @ApiModelProperty(value = "使用有效期 (优惠券在使用有效期内有效)")
+    @Excel(name = "使用有效期 (优惠券在使用有效期内有效(单位:天))")
+    @ApiModelProperty(value = "使用有效期 (优惠券在使用有效期内有效(单位:天))")
     private Integer useValidDays;
 
 
     /**
+     * 链接有效期 (优惠券发出链接的有效期(单位:小时))
+     */
+    @Excel(name = "链接有效期 (优惠券发出链接的有效期(单位:小时))")
+    @ApiModelProperty(value = "链接有效期 (优惠券发出链接的有效期(单位:小时))")
+    private Integer linkValidTimes;
+
+
+    /**
      * 所需人数
      */
     @Excel(name = "所需人数")

+ 17 - 1
src/main/java/com/dk/oauth/model/pojo/integral/CouponReceive.java

@@ -38,9 +38,17 @@ public class CouponReceive extends PageInfo<CouponReceive> implements Serializab
      */
 
     /**
+     * 优惠券获取ID
+     */
+    //    @TableId(value = "receive_id", type = IdType.AUTO)
+    @ApiModelProperty(value = "优惠券获取ID")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String receiveId;
+
+
+    /**
      * 公司ID
      */
-//    @TableId(value = "cp_id", type = IdType.AUTO)
     @ApiModelProperty(value = "公司ID")
     private Integer cpId;
 
@@ -55,6 +63,14 @@ public class CouponReceive extends PageInfo<CouponReceive> implements Serializab
 
 
     /**
+     * 优惠券发出ID
+     */
+    @ApiModelProperty(value = "优惠券发出ID")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String sendId;
+
+
+    /**
      * 微信Id
      */
     @Excel(name = "微信Id")

+ 4 - 1
src/main/java/com/dk/oauth/model/pojo/integral/CouponSend.java

@@ -36,11 +36,14 @@ public class CouponSend extends PageInfo<CouponSend> implements Serializable {
     /*
      * 数据库字段
      */
+    //    @TableId(value = "send_id", type = IdType.AUTO)
+    @ApiModelProperty(value = "优惠券发出Id")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String sendId;
 
     /**
      * 公司ID
      */
-//    @TableId(value = "cp_id", type = IdType.AUTO)
     @ApiModelProperty(value = "公司ID")
     private Integer cpId;
 

+ 17 - 1
src/main/java/com/dk/oauth/model/pojo/integral/CouponUse.java

@@ -38,14 +38,30 @@ public class CouponUse extends PageInfo<CouponUse> implements Serializable {
      */
 
     /**
+     * 优惠券使用ID
+     */
+    //    @TableId(value = "use_id", type = IdType.AUTO)
+    @ApiModelProperty(value = "优惠券使用ID")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String useId;
+
+
+    /**
      * 公司ID
      */
-//    @TableId(value = "cp_id", type = IdType.AUTO)
     @ApiModelProperty(value = "公司ID")
     private Integer cpId;
 
 
     /**
+     * 优惠券发出ID
+     */
+    @ApiModelProperty(value = "优惠券发出ID")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String sendId;
+
+
+    /**
      * 优惠券ID
      */
     @Excel(name = "优惠券ID")

+ 9 - 0
src/main/java/com/dk/oauth/model/pojo/integral/IntegralShare.java

@@ -46,6 +46,15 @@ public class IntegralShare extends PageInfo<IntegralShare> implements Serializab
 
 
     /**
+     * 微信用户
+     */
+    @Excel(name = "微信用户")
+    @ApiModelProperty(value = "微信用户")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String userId;
+
+
+    /**
      * 积分策略Id
      */
     @Excel(name = "积分策略Id")

+ 8 - 0
src/main/java/com/dk/oauth/model/pojo/integral/IntegralTactic.java

@@ -93,6 +93,14 @@ public class IntegralTactic extends PageInfo<IntegralTactic> implements Serializ
     private Integer signDayNum;
 
 
+    /**
+     * 每日分享次数
+     */
+    @Excel(name = "每日分享次数")
+    @ApiModelProperty(value = "每日分享次数")
+    private Integer shareDayNum;
+
+
     /*
      * 相关属性
      * @TableField(exist = false)

+ 11 - 3
src/main/java/com/dk/oauth/model/query/integral/CouponQuery.java

@@ -54,14 +54,22 @@ public class CouponQuery extends PageInfo<CouponQuery>{
 
 
     /**
-     * 使用有效期 (优惠券在使用有效期内有效)
+     * 使用有效期 (优惠券在使用有效期内有效(单位:天))
      */
-    @Excel(name = "使用有效期 (优惠券在使用有效期内有效)")
-    @ApiModelProperty(value = "使用有效期 (优惠券在使用有效期内有效)")
+    @Excel(name = "使用有效期 (优惠券在使用有效期内有效(单位:天))")
+    @ApiModelProperty(value = "使用有效期 (优惠券在使用有效期内有效(单位:天))")
     private Integer useValidDays;
 
 
     /**
+     * 链接有效期 (优惠券发出链接的有效期(单位:小时))
+     */
+    @Excel(name = "链接有效期 (优惠券发出链接的有效期(单位:小时))")
+    @ApiModelProperty(value = "链接有效期 (优惠券发出链接的有效期(单位:小时))")
+    private Integer linkValidTimes;
+
+
+    /**
      * 所需人数
      */
     @Excel(name = "所需人数")

+ 16 - 0
src/main/java/com/dk/oauth/model/query/integral/CouponReceiveQuery.java

@@ -24,6 +24,14 @@ public class CouponReceiveQuery extends PageInfo<CouponReceiveQuery> {
      */
 
     /**
+     * 优惠券使用ID
+     */
+    @ApiModelProperty(value = "优惠券使用ID")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String useId;
+
+
+    /**
      * 公司ID
      */
     @ApiModelProperty(value = "公司ID")
@@ -40,6 +48,14 @@ public class CouponReceiveQuery extends PageInfo<CouponReceiveQuery> {
 
 
     /**
+     * 优惠券发出ID
+     */
+    @ApiModelProperty(value = "优惠券发出ID")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String sendId;
+
+
+    /**
      * 微信Id
      */
     @Excel(name = "微信Id")

+ 5 - 0
src/main/java/com/dk/oauth/model/query/integral/CouponSendQuery.java

@@ -32,6 +32,11 @@ public class CouponSendQuery extends PageInfo<CouponSendQuery>  {
      * 数据库字段
      */
 
+    @ApiModelProperty(value = "优惠券发出Id")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String sendId;
+
+
     /**
      * 公司ID
      */

+ 16 - 0
src/main/java/com/dk/oauth/model/query/integral/CouponUseQuery.java

@@ -24,6 +24,14 @@ public class CouponUseQuery extends PageInfo<CouponUseQuery>  {
      */
 
     /**
+     * 优惠券使用ID
+     */
+    @ApiModelProperty(value = "优惠券使用ID")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String useId;
+
+
+    /**
      * 公司ID
      */
     @ApiModelProperty(value = "公司ID")
@@ -31,6 +39,14 @@ public class CouponUseQuery extends PageInfo<CouponUseQuery>  {
 
 
     /**
+     * 优惠券发出ID
+     */
+    @ApiModelProperty(value = "优惠券发出ID")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String sendId;
+
+
+    /**
      * 优惠券ID
      */
     @Excel(name = "优惠券ID")

+ 9 - 0
src/main/java/com/dk/oauth/model/query/integral/IntegralShareQuery.java

@@ -38,6 +38,15 @@ public class IntegralShareQuery extends PageInfo<IntegralShareQuery>  {
 
 
     /**
+     * 微信用户
+     */
+    @Excel(name = "微信用户")
+    @ApiModelProperty(value = "微信用户")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String userId;
+
+
+    /**
      * 积分策略Id
      */
     @Excel(name = "积分策略Id")

+ 9 - 0
src/main/java/com/dk/oauth/model/query/integral/IntegralTacticQuery.java

@@ -75,6 +75,15 @@ public class IntegralTacticQuery extends PageInfo<IntegralTacticQuery>  {
     private Integer signDayNum;
 
 
+    /**
+     * 每日分享次数
+     */
+    @Excel(name = "每日分享次数")
+    @ApiModelProperty(value = "每日分享次数")
+    private Integer shareDayNum;
+
+
+
     /*
      * 相关属性
      * @TableField(exist = false)

+ 16 - 0
src/main/java/com/dk/oauth/model/response/integral/CouponReceiveResponse.java

@@ -33,6 +33,14 @@ public class CouponReceiveResponse {
      */
 
     /**
+     * 优惠券获取ID
+     */
+    @ApiModelProperty(value = "优惠券获取ID")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String receiveId;
+
+
+    /**
      * 公司ID
      */
     @ApiModelProperty(value = "公司ID")
@@ -49,6 +57,14 @@ public class CouponReceiveResponse {
 
 
     /**
+     * 优惠券发出ID
+     */
+    @ApiModelProperty(value = "优惠券发出ID")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String sendId;
+
+
+    /**
      * 微信Id
      */
     @Excel(name = "微信Id")

+ 12 - 3
src/main/java/com/dk/oauth/model/response/integral/CouponResponse.java

@@ -62,15 +62,24 @@ public class CouponResponse  {
     private BigDecimal discount;
 
 
+
     /**
-     * 使用有效期 (优惠券在使用有效期内有效)
+     * 使用有效期 (优惠券在使用有效期内有效(单位:天))
      */
-    @Excel(name = "使用有效期 (优惠券在使用有效期内有效)")
-    @ApiModelProperty(value = "使用有效期 (优惠券在使用有效期内有效)")
+    @Excel(name = "使用有效期 (优惠券在使用有效期内有效(单位:天))")
+    @ApiModelProperty(value = "使用有效期 (优惠券在使用有效期内有效(单位:天))")
     private Integer useValidDays;
 
 
     /**
+     * 链接有效期 (优惠券发出链接的有效期(单位:小时))
+     */
+    @Excel(name = "链接有效期 (优惠券发出链接的有效期(单位:小时))")
+    @ApiModelProperty(value = "链接有效期 (优惠券发出链接的有效期(单位:小时))")
+    private Integer linkValidTimes;
+
+
+    /**
      * 所需人数
      */
     @Excel(name = "所需人数")

+ 4 - 0
src/main/java/com/dk/oauth/model/response/integral/CouponSendResponse.java

@@ -34,6 +34,10 @@ public class CouponSendResponse {
      * 数据库字段
      */
 
+    @ApiModelProperty(value = "优惠券发出Id")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String sendId;
+
     /**
      * 公司ID
      */

+ 16 - 0
src/main/java/com/dk/oauth/model/response/integral/CouponUseResponse.java

@@ -33,6 +33,14 @@ public class CouponUseResponse {
      */
 
     /**
+     * 优惠券使用ID
+     */
+    @ApiModelProperty(value = "优惠券使用ID")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String useId;
+
+
+    /**
      * 公司ID
      */
     @ApiModelProperty(value = "公司ID")
@@ -40,6 +48,14 @@ public class CouponUseResponse {
 
 
     /**
+     * 优惠券发出ID
+     */
+    @ApiModelProperty(value = "优惠券发出ID")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String sendId;
+
+
+    /**
      * 优惠券ID
      */
     @Excel(name = "优惠券ID")

+ 9 - 0
src/main/java/com/dk/oauth/model/response/integral/IntegralShareResponse.java

@@ -40,6 +40,15 @@ public class IntegralShareResponse {
 
 
     /**
+     * 微信用户
+     */
+    @Excel(name = "微信用户")
+    @ApiModelProperty(value = "微信用户")
+    @TableField(typeHandler = UuidTypeHandler.class)
+    private String userId;
+
+
+    /**
      * 积分策略Id
      */
     @Excel(name = "积分策略Id")

+ 7 - 0
src/main/java/com/dk/oauth/model/response/integral/IntegralTacticResponse.java

@@ -85,6 +85,13 @@ public class IntegralTacticResponse {
     private Integer signDayNum;
 
 
+    /**
+     * 每日分享次数
+     */
+    @Excel(name = "每日分享次数")
+    @ApiModelProperty(value = "每日分享次数")
+    private Integer shareDayNum;
+
     /*
      * 相关属性
      * @TableField(exist = false)

+ 93 - 6
src/main/java/com/dk/oauth/service/integral/CouponSendService.java

@@ -1,20 +1,29 @@
 package com.dk.oauth.service.integral;
 
 import com.dk.common.infrastructure.annotaiton.Pagination;
+import com.dk.common.mapper.BaseMapper;
 import com.dk.common.model.pojo.PageList;
+import com.dk.common.response.ResponseResultUtil;
 import com.dk.common.response.ResponseResultVO;
-import com.dk.oauth.model.pojo.integral.CouponSend;
-import com.dk.oauth.mapper.integral.CouponSendMapper;
 import com.dk.common.service.BaseService;
-import com.dk.common.mapper.BaseMapper;
-import com.dk.oauth.model.query.integral.CouponQuery;
+import com.dk.oauth.infrastructure.convert.integral.CouponSendConvert;
+import com.dk.oauth.mapper.integral.CouponMapper;
+import com.dk.oauth.mapper.integral.CouponReceiveMapper;
+import com.dk.oauth.mapper.integral.CouponSendMapper;
+import com.dk.oauth.model.VO.integral.CouponSendVO;
+import com.dk.oauth.model.pojo.integral.CouponSend;
+import com.dk.oauth.model.query.integral.CouponReceiveQuery;
 import com.dk.oauth.model.query.integral.CouponSendQuery;
-import com.dk.oauth.model.response.integral.CouponResponse;
+import com.dk.oauth.model.response.integral.CouponReceiveResponse;
 import com.dk.oauth.model.response.integral.CouponSendResponse;
-import org.springframework.stereotype.Service;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.time.LocalDateTime;
+import java.time.ZoneOffset;
+import java.util.List;
+
 @Service
 @Transactional
 public class CouponSendService extends BaseService<CouponSend> {
@@ -27,6 +36,18 @@ public class CouponSendService extends BaseService<CouponSend> {
 	@Autowired
 	private CouponSendMapper couponSendMapper;
 
+	@Autowired
+	//优惠券发出实体转换
+	private CouponSendConvert couponSendConvert;
+
+	@Autowired
+	//优惠券获取
+	private CouponReceiveMapper couponReceiveMapper;
+
+	@Autowired
+	//优惠券
+	private CouponMapper couponMapper;
+
 	/**
 	 * @desc   : 条件查询
 	 * @date   : 2024/7/25 10:22
@@ -39,5 +60,71 @@ public class CouponSendService extends BaseService<CouponSend> {
 	}
 
 
+	/**
+	 * @desc   : 新建
+	 * @date   : 2024/7/25 13:07
+	 * @author : 寇珊珊
+	 */
+	@Transactional(rollbackFor = {Exception.class})
+	public ResponseResultVO<?> insert(CouponSendVO couponSendVO) {
+		//region 根据id查询数据, 如果存在: 1:判断已助力人数是否已满 2:判断发送时间是否已过期
+		CouponSendResponse couponSendResponse = couponSendMapper.selectById(couponSendVO.getCouponId());
+		if(couponSendResponse!=null){
+
+			//region 查询已助力人数
+			List<CouponReceiveResponse> couponReceiveResponses = couponReceiveMapper.selectByCond(new CouponReceiveQuery().setCouponId(couponSendResponse.getCouponId()));
+//			if(couponReceiveResponses.size()>couponSendResponse.getUserNum()){
+//				//所需助力人数已满
+//				throw new BaseBusinessException(ErrorCodeEnum.THE_REQUIRED_NUMBER_OF_HELPERS_IS_FULL.getCode(),ErrorCodeEnum.THE_REQUIRED_NUMBER_OF_HELPERS_IS_FULL.getMessage());
+//			}
+			//endregion
+
+			//region 校验单据时间
+			LocalDateTime endTime = couponSendMapper.selectEndTime( new CouponSendQuery()
+					.setCouponId(couponSendVO.getCouponId()) )
+					.getEndDate();
+			//原时间戳
+			long primaryTime = endTime.toInstant(ZoneOffset.of("+8")).toEpochMilli();
+			//本次时间戳
+			long thisTime = couponSendVO.getEndDate().toInstant(ZoneOffset.of("+8")).toEpochMilli();
+			//本次发出时间大于截止日期
+			if ( (thisTime / 1000) > (primaryTime / 1000)) {
+				//新建
+				CouponSend couponSend = couponSendConvert.convertToPo(couponSendVO);
+				couponSendMapper.insert(couponSend);
+				return ResponseResultUtil.success();
+
+//				//链接已无效
+//				throw new BaseBusinessException(ErrorCodeEnum.THE_LINK_IS_NO_LONGER_VALID.getCode(),ErrorCodeEnum.THE_LINK_IS_NO_LONGER_VALID.getMessage());
+			}
+			//本次发出时间小于等于截止日期  并且助力人数未够 直接返回
+			if ( (thisTime / 1000) <= (primaryTime / 1000) && couponReceiveResponses.size() < couponSendResponse.getUserNum() ) {
+				return ResponseResultUtil.success();
+			}
+			//本次发出时间小于等于截止日期  并且助力已满足 新建
+			if ( (thisTime / 1000) <= (primaryTime / 1000) && couponReceiveResponses.size() == couponSendResponse.getUserNum() ) {
+				//新建
+
+
+				return ResponseResultUtil.success();
+			}
+			//endregion
+
+		}
+		//endregion
+
+		//region 不存在 新建
+		else {
+
+		}
+
+		//endregion
+
+		return ResponseResultUtil.success();
+
+
+	}
+
+
 
 }

+ 33 - 0
src/main/java/com/dk/oauth/service/integral/IntegralItemService.java

@@ -1,9 +1,17 @@
 package com.dk.oauth.service.integral;
 
+import com.dk.common.infrastructure.annotaiton.Pagination;
+import com.dk.common.model.pojo.PageList;
+import com.dk.common.response.ResponseResultUtil;
+import com.dk.common.response.ResponseResultVO;
 import com.dk.oauth.model.pojo.integral.IntegralItem;
 import com.dk.oauth.mapper.integral.IntegralItemMapper;
 import com.dk.common.service.BaseService;
 import com.dk.common.mapper.BaseMapper;
+import com.dk.oauth.model.query.integral.IntegralItemQuery;
+import com.dk.oauth.model.query.integral.IntegralQuery;
+import com.dk.oauth.model.response.integral.IntegralItemResponse;
+import com.dk.oauth.model.response.integral.IntegralResponse;
 import org.springframework.stereotype.Service;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
@@ -20,4 +28,29 @@ public class IntegralItemService extends BaseService<IntegralItem> {
 	@Autowired
 	private IntegralItemMapper integralItemMapper;
 
+
+
+	/**
+	 * @desc   : 条件查询
+	 * @date   : 2024/7/26 9:00
+	 * @author : 寇珊珊
+	 */
+	@Pagination
+	public ResponseResultVO<PageList<IntegralItemResponse>> selectByCond(IntegralItemQuery integralItemQuery) {
+		return super.mergeListWithCount(integralItemQuery, integralItemMapper.selectByCond(integralItemQuery),
+				integralItemMapper.countByCond(integralItemQuery));
+	}
+
+	/**
+	 * @desc   : 根据id查询
+	 * @date   : 2024/7/26 9:00
+	 * @author : 寇珊珊
+	 */
+	public ResponseResultVO<?> selectById(Integer id) {
+		IntegralItemResponse integralItemResponse = integralItemMapper.selectById(id);
+		return ResponseResultUtil.success(integralItemResponse);
+	}
+
+
+
 }

+ 12 - 0
src/main/java/com/dk/oauth/service/integral/IntegralService.java

@@ -2,6 +2,8 @@ package com.dk.oauth.service.integral;
 
 import com.dk.common.infrastructure.annotaiton.Pagination;
 import com.dk.common.model.pojo.PageList;
+import com.dk.common.response.ResponseCodeEnum;
+import com.dk.common.response.ResponseResultUtil;
 import com.dk.common.response.ResponseResultVO;
 import com.dk.oauth.model.pojo.integral.Integral;
 import com.dk.oauth.mapper.integral.IntegralMapper;
@@ -37,4 +39,14 @@ public class IntegralService extends BaseService<Integral> {
 				integralMapper.countByCond(integralQuery));
 	}
 
+	/**
+	 * @desc   : 根据id查询
+	 * @date   : 2024/7/26 8:55
+	 * @author : 寇珊珊
+	 */
+	public ResponseResultVO<?> selectById(Integer id) {
+		IntegralResponse integralResponse = integralMapper.selectById(id);
+		return ResponseResultUtil.success(integralResponse);
+	}
+
 }

+ 30 - 0
src/main/java/com/dk/oauth/service/integral/IntegralShareService.java

@@ -1,9 +1,17 @@
 package com.dk.oauth.service.integral;
 
+import com.dk.common.infrastructure.annotaiton.Pagination;
+import com.dk.common.model.pojo.PageList;
+import com.dk.common.response.ResponseResultUtil;
+import com.dk.common.response.ResponseResultVO;
 import com.dk.oauth.model.pojo.integral.IntegralShare;
 import com.dk.oauth.mapper.integral.IntegralShareMapper;
 import com.dk.common.service.BaseService;
 import com.dk.common.mapper.BaseMapper;
+import com.dk.oauth.model.query.integral.IntegralQuery;
+import com.dk.oauth.model.query.integral.IntegralShareQuery;
+import com.dk.oauth.model.response.integral.IntegralResponse;
+import com.dk.oauth.model.response.integral.IntegralShareResponse;
 import org.springframework.stereotype.Service;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
@@ -20,4 +28,26 @@ public class IntegralShareService extends BaseService<IntegralShare> {
 	@Autowired
 	private IntegralShareMapper integralShareMapper;
 
+
+	/**
+	 * @desc   : 条件查询
+	 * @date   : 2024/7/24 15:47
+	 * @author : 寇珊珊
+	 */
+	@Pagination
+	public ResponseResultVO<PageList<IntegralShareResponse>> selectByCond(IntegralShareQuery integralShareQuery) {
+		return super.mergeListWithCount(integralShareQuery, integralShareMapper.selectByCond(integralShareQuery),
+				integralShareMapper.countByCond(integralShareQuery));
+	}
+
+	/**
+	 * @desc   : 根据id查询
+	 * @date   : 2024/7/26 8:55
+	 * @author : 寇珊珊
+	 */
+	public ResponseResultVO<?> selectById(Integer id) {
+		IntegralShareResponse integralShareResponse = integralShareMapper.selectById(id);
+		return ResponseResultUtil.success(integralShareResponse);
+	}
+
 }

+ 3 - 2
src/main/java/com/dk/oauth/service/integral/IntegralTacticService.java

@@ -2,14 +2,14 @@ package com.dk.oauth.service.integral;
 
 import com.dk.common.infrastructure.annotaiton.Pagination;
 import com.dk.common.model.pojo.PageList;
+import com.dk.common.response.ResponseCodeEnum;
+import com.dk.common.response.ResponseResultUtil;
 import com.dk.common.response.ResponseResultVO;
 import com.dk.oauth.model.pojo.integral.IntegralTactic;
 import com.dk.oauth.mapper.integral.IntegralTacticMapper;
 import com.dk.common.service.BaseService;
 import com.dk.common.mapper.BaseMapper;
-import com.dk.oauth.model.query.integral.IntegralQuery;
 import com.dk.oauth.model.query.integral.IntegralTacticQuery;
-import com.dk.oauth.model.response.integral.IntegralResponse;
 import com.dk.oauth.model.response.integral.IntegralTacticResponse;
 import org.springframework.stereotype.Service;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -39,4 +39,5 @@ public class IntegralTacticService extends BaseService<IntegralTactic> {
 				integralTacticMapper.countByCond(integralTacticQuery));
 	}
 
+
 }

+ 19 - 0
src/main/java/com/dk/oauth/service/integral/SignRecordService.java

@@ -1,9 +1,17 @@
 package com.dk.oauth.service.integral;
 
+import com.dk.common.infrastructure.annotaiton.Pagination;
+import com.dk.common.model.pojo.PageList;
+import com.dk.common.response.ResponseResultUtil;
+import com.dk.common.response.ResponseResultVO;
 import com.dk.oauth.model.pojo.integral.SignRecord;
 import com.dk.oauth.mapper.integral.SignRecordMapper;
 import com.dk.common.service.BaseService;
 import com.dk.common.mapper.BaseMapper;
+import com.dk.oauth.model.query.integral.IntegralItemQuery;
+import com.dk.oauth.model.query.integral.SignRecordQuery;
+import com.dk.oauth.model.response.integral.IntegralItemResponse;
+import com.dk.oauth.model.response.integral.SignRecordResponse;
 import org.springframework.stereotype.Service;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
@@ -20,4 +28,15 @@ public class SignRecordService extends BaseService<SignRecord> {
 	@Autowired
 	private SignRecordMapper signRecordMapper;
 
+	/**
+	 * @desc   : 条件查询
+	 * @date   : 2024/7/26 9:00
+	 * @author : 寇珊珊
+	 */
+	@Pagination
+	public ResponseResultVO<PageList<SignRecordResponse>> selectByCond(SignRecordQuery signRecordQuery) {
+		return super.mergeListWithCount(signRecordQuery, signRecordMapper.selectByCond(signRecordQuery),
+				signRecordMapper.countByCond(signRecordQuery));
+	}
+
 }