Просмотр исходного кода

Merge remote-tracking branch 'origin/master'

dongke 1 год назад
Родитель
Сommit
9640200f44

+ 7 - 0
src/main/java/com/dk/oauth/mapper/integral/CouponReceiveMapper.java

@@ -36,5 +36,12 @@ public interface CouponReceiveMapper extends BaseMapper<CouponReceive>{
      */
     Long countByCond(CouponReceiveQuery couponReceiveQuery);
 
+    /**
+     * @desc   : 条件查询-不需要cpid
+     * @date   : 2024/7/24 9:22
+     * @author : 寇珊珊
+     */
+    Long countByCondNoExistCpId(CouponReceiveQuery couponReceiveQuery);
+
 }
 

+ 17 - 0
src/main/java/com/dk/oauth/mapper/integral/CouponReceiveMapper.xml

@@ -93,6 +93,23 @@
         </if>
     </select>
 
+    <!-- 查询表dkic_a.t_mst_coupon_receive,(条件查询+分页)列表 -->
+    <select id="countByCondNoExistCpId" resultType="Long">
+        SELECT
+        count(1)
+        FROM dkic_a.t_mst_coupon_receive tmcr
+        <where>
+            tmcr.flg_valid
+            <if test="userWxid != null">
+                AND tmcr.user_wxid = #{userWxid}
+            </if>
+            <if test="assistFlag != null and assistFlag ">
+                AND tmcr.assist_date >= NOW() - INTERVAL '7 DAY'
+            </if>
+        </where>
+
+    </select>
+
     <!-- 查询表dkic_a.t_mst_coupon_receive,(条件查询)个数 -->
     <select id="countByCond" resultType="Long">
         SELECT

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

@@ -109,6 +109,12 @@ public class CouponReceiveVO  {
     @TableField(typeHandler = UuidTypeHandler.class)
     private String receiveUser;
 
+    /**
+     * 发出的员工
+     */
+    @ApiModelProperty(value = "发出的员工")
+    private String staffName;
+
 
     private static final long serialVersionUID = 1L;
 

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

@@ -117,7 +117,7 @@ public class CouponUse extends PageInfo<CouponUse> implements Serializable {
 
 
     /**
-     * 使用员工
+     * 使用员工-发出的员工是同一个字段
      */
     @Excel(name = "使用员工")
     @ApiModelProperty(value = "使用员工")

+ 11 - 3
src/main/java/com/dk/oauth/service/integral/CouponReceiveService.java

@@ -87,14 +87,20 @@ public class CouponReceiveService extends BaseService<CouponReceive> {
         // 限制助力链接发出本人不可给自己助力  2024/08/01 刘尧
         UserLogin userLogin = userMapper.selectById(couponReceiveVO.getUserIdForm());
 
-        if (userLogin.getUserWxid().equals(couponReceiveVO.getUserWxid())){
+        if (userLogin.getUserWxid().equals(couponReceiveVO.getUserWxid())) {
             //助力链接发出者不能为自己助力
             throw new BaseBusinessException(ErrorCodeEnum.USER_POWER_OWN.getCode(), ErrorCodeEnum.USER_POWER_OWN.getMessage());
         }
 
         //region 查询7日内已进行过优惠券助力
-        List<CouponReceiveResponse> couponReceiveResponses = couponReceiveMapper.selectByCond(new CouponReceiveQuery().setUserWxid(couponReceiveVO.getUserWxid()).setAssistFlag(true));
-        if (couponReceiveResponses != null && couponReceiveResponses.size() > 0) {
+//        List<CouponReceiveResponse> couponReceiveResponses = couponReceiveMapper.selectByCond(new CouponReceiveQuery().setUserWxid(couponReceiveVO.getUserWxid()).setAssistFlag(true));
+//        if (couponReceiveResponses != null && couponReceiveResponses.size() > 0) {
+//            //近期己助力过
+//            throw new BaseBusinessException(ErrorCodeEnum.I_HAVE_RECENTLY_PROVIDED_ASSISTANCE.getCode(), ErrorCodeEnum.I_HAVE_RECENTLY_PROVIDED_ASSISTANCE.getMessage());
+//        }
+        // todo.......... 正式的发版要改成大于000000000000000000000000
+        Long cpCount = couponReceiveMapper.countByCondNoExistCpId(new CouponReceiveQuery().setUserWxid(couponReceiveVO.getUserWxid()).setAssistFlag(true));
+        if (cpCount < 0) {
             //近期己助力过
             throw new BaseBusinessException(ErrorCodeEnum.I_HAVE_RECENTLY_PROVIDED_ASSISTANCE.getCode(), ErrorCodeEnum.I_HAVE_RECENTLY_PROVIDED_ASSISTANCE.getMessage());
         }
@@ -143,6 +149,8 @@ public class CouponReceiveService extends BaseService<CouponReceive> {
                     couponUse.setCouponStatus(Constant.couponStatus.WEI_SHI_YONG.getName());
                     //获取用户
                     couponUse.setReceiveUser(couponReceiveVO.getReceiveUser());
+                    //  使用员工-发出的员工是同一个字段
+                    couponUse.setUseStaff(couponReceiveVO.getStaffName());
                     couponUseMapper.insert(couponUse);
                     //endregion