Преглед на файлове

1、已投递简历的判断更改为7天

rayson преди 6 месеца
родител
ревизия
7790b33240

+ 2 - 0
citu-module-mall/citu-module-promotion-api/src/main/java/com/citu/module/promotion/enums/ErrorCodeConstants.java

@@ -143,6 +143,8 @@ public interface ErrorCodeConstants {
     ErrorCode LUCK_LOTTERY_NOT_START = new ErrorCode(1_013_050_02, "幸运抽奖活动还未开始");
     ErrorCode LUCK_LOTTERY_END = new ErrorCode(1_013_050_03, "幸运抽奖活动已结束");
     ErrorCode LUCK_LOTTERY_NAME_USED = new ErrorCode(1_013_050_04, "幸运抽奖活动名称({})已经被使用");
+    ErrorCode LUCK_LOTTERY_PRODUCT_USED = new ErrorCode(1_013_050_05, "该商品已被其他活动选择,请修改选中商品或修改对应的抽奖活动");
+    ErrorCode LUCK_LOTTERY_PRODUCT_NOT_SELECTED = new ErrorCode(1_013_050_06, "请选择下单指定商品");
 
     // ========== 幸运抽奖-奖品 1-013-051-00 ==========
     ErrorCode LUCK_PRIZE_NOT_EXISTS = new ErrorCode(1_013_051_01, "幸运抽奖奖品不存在");

+ 0 - 11
citu-module-mall/citu-module-promotion-biz/src/main/java/com/citu/module/promotion/controller/app/luck/AppLuckLotteryController.java

@@ -41,15 +41,4 @@ public class AppLuckLotteryController {
         return success(BeanUtils.toBean(pageResult, LuckLotteryRespVO.class));
     }
 
-    @GetMapping("/list2")
-    @Operation(summary = "获得幸运抽奖活动分页2")
-    public CommonResult<List<LuckLotteryRespVO>> getLuckLotteryList2(@RequestParam("spuId") Long spuId) {
-        LocalDateTime now = LocalDateTime.now();
-        // 当天开始时间和当天结束时间
-        LocalDateTime startTime = now.withHour(0).withMinute(0).withSecond(0);
-        LocalDateTime endTime = now.withHour(23).withMinute(59).withSecond(59);
-        List<LuckLotteryDO> pageResult = luckLotteryService.getLuckLotteryListByTime(spuId,startTime, endTime);
-        return success(BeanUtils.toBean(pageResult, LuckLotteryRespVO.class));
-    }
-
 }

+ 12 - 3
citu-module-mall/citu-module-promotion-biz/src/main/java/com/citu/module/promotion/controller/app/luck/AppLuckPrizeController.java

@@ -3,6 +3,8 @@ package com.citu.module.promotion.controller.app.luck;
 
 import com.citu.framework.common.pojo.CommonResult;
 import com.citu.module.promotion.controller.admin.luck.vo.prize.LuckPrizeDetailRespVO;
+import com.citu.module.promotion.dal.dataobject.luck.LuckLotteryDO;
+import com.citu.module.promotion.service.luck.LuckLotteryService;
 import com.citu.module.promotion.service.luck.LuckPrizeService;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.tags.Tag;
@@ -27,14 +29,21 @@ public class AppLuckPrizeController {
     @Resource
     private LuckPrizeService luckPrizeService;
 
+    @Resource
+    private LuckLotteryService luckLotteryService;
+
 
     @GetMapping("/get/extend/area")
-    @Operation(summary = "根据活动id获取奖品区域信息")
+    @Operation(summary = "根据商品id活动对应的奖品区域信息")
     public CommonResult<Map<String, List<LuckPrizeDetailRespVO>>>
-    getLuckPrizeExtendAreaMap(@RequestParam("lotteryId") Long lotteryId,
+    getLuckPrizeExtendAreaMap(@RequestParam("spuId") Long spuId,
                               @RequestParam(value = "type", required = false) String type,
                               @RequestParam(value = "parentAreaId", required = false) Long parentAreaId) {
-        return success(luckPrizeService.getLuckPrizeExtendAreaMap(lotteryId, type, parentAreaId));
+        LuckLotteryDO luckLottery = luckLotteryService.getLuckLotteryListBySpuId(String.valueOf(spuId));
+        if (null == luckLottery) {
+            return null;
+        }
+        return success(luckPrizeService.getLuckPrizeExtendAreaMap(luckLottery.getId(), type, parentAreaId));
     }
 
 }

+ 14 - 0
citu-module-mall/citu-module-promotion-biz/src/main/java/com/citu/module/promotion/dal/mysql/luck/LuckLotteryMapper.java

@@ -6,6 +6,7 @@ import com.citu.framework.mybatis.core.mapper.BaseMapperX;
 import com.citu.framework.mybatis.core.query.LambdaQueryWrapperX;
 import com.citu.module.promotion.controller.admin.luck.vo.LuckLotteryPageReqVO;
 import com.citu.module.promotion.dal.dataobject.luck.LuckLotteryDO;
+import com.citu.module.promotion.enums.luck.LuckLotteryFactorEnum;
 import com.citu.module.promotion.enums.luck.LuckStatusEnum;
 import org.apache.ibatis.annotations.Mapper;
 
@@ -61,6 +62,7 @@ public interface LuckLotteryMapper extends BaseMapperX<LuckLotteryDO> {
      */
     default List<LuckLotteryDO> getLuckLotteryListByTime(Long id,LocalDateTime startTime, LocalDateTime endTime) {
         return selectList(new LambdaQueryWrapperX<LuckLotteryDO>()
+                .eq(LuckLotteryDO::getFactor, LuckLotteryFactorEnum.ORDER_PRODUCT_PAY_SUCCESS.getFactor())
                 .le(LuckLotteryDO::getStartTime, startTime)
                 .ge(LuckLotteryDO::getEndTime, endTime)
                 .eq(LuckLotteryDO::getStatus, LuckStatusEnum.ENABLE.getStatus())
@@ -68,6 +70,18 @@ public interface LuckLotteryMapper extends BaseMapperX<LuckLotteryDO> {
                 .orderByDesc(LuckLotteryDO::getSort));
     }
 
+    /**
+     * 根据商品id获取的抽奖活动
+     *
+     * @param spuId 商品id
+     */
+    default LuckLotteryDO getLuckLotteryListBySpuId(String spuId,String status) {
+        return selectOne(new LambdaQueryWrapperX<LuckLotteryDO>()
+                .eq(LuckLotteryDO::getFactor, LuckLotteryFactorEnum.ORDER_PRODUCT_PAY_SUCCESS.getFactor())
+                .eqIfPresent(LuckLotteryDO::getStatus,status)
+                .apply("JSON_CONTAINS(factor_info, '\""+spuId+"\"')")
+                .orderByDesc(LuckLotteryDO::getSort));
+    }
 
     default LuckLotteryDO selectByName(String name) {
         return selectOne(new LambdaQueryWrapperX<LuckLotteryDO>()

+ 6 - 0
citu-module-mall/citu-module-promotion-biz/src/main/java/com/citu/module/promotion/service/luck/LuckLotteryService.java

@@ -91,4 +91,10 @@ public interface LuckLotteryService {
      * @param name 活动名称
      */
     LuckLotteryDO getByName(String name);
+
+    /**
+     * 根据spuId获得抽奖活动
+     * @param spuId 商品id
+     */
+    LuckLotteryDO getLuckLotteryListBySpuId(String spuId);
 }

+ 48 - 2
citu-module-mall/citu-module-promotion-biz/src/main/java/com/citu/module/promotion/service/luck/LuckLotteryServiceImpl.java

@@ -1,6 +1,7 @@
 package com.citu.module.promotion.service.luck;
 
 
+import cn.hutool.core.collection.CollUtil;
 import com.citu.framework.common.pojo.PageResult;
 import com.citu.framework.common.util.object.BeanUtils;
 import com.citu.module.product.api.spu.ProductSpuApi;
@@ -12,12 +13,14 @@ import com.citu.module.promotion.convert.luck.LuckLotteryConvert;
 import com.citu.module.promotion.dal.dataobject.luck.LuckLotteryDO;
 import com.citu.module.promotion.dal.mysql.luck.LuckLotteryMapper;
 import com.citu.module.promotion.enums.luck.LuckLotteryFactorEnum;
+import com.citu.module.promotion.enums.luck.LuckStatusEnum;
 import org.springframework.stereotype.Service;
 import org.springframework.validation.annotation.Validated;
 
 import javax.annotation.Resource;
 import java.time.LocalDateTime;
 import java.util.List;
+import java.util.Objects;
 import java.util.stream.Collectors;
 
 import static com.citu.framework.common.exception.util.ServiceExceptionUtil.exception;
@@ -45,6 +48,22 @@ public class LuckLotteryServiceImpl implements LuckLotteryService {
         if (null != luckLotteryDO) {
             throw exception(LUCK_LOTTERY_NAME_USED, createReqVO.getName());
         }
+        if (LuckLotteryFactorEnum.ORDER_PRODUCT_PAY_SUCCESS.getFactor()
+                .equals(createReqVO.getFactor())) {
+            // 下单指定商品支付成功
+            if (CollUtil.isEmpty(createReqVO.getFactorInfo())) {
+                // 不存在
+                throw exception(LUCK_LOTTERY_PRODUCT_NOT_SELECTED);
+            }
+            for (String spuId : createReqVO.getFactorInfo()) {
+                LuckLotteryDO luckLottery = luckLotteryMapper.getLuckLotteryListBySpuId(spuId,null);
+                if (null != luckLottery) {
+                    // 已经存在
+                    throw exception(LUCK_LOTTERY_PRODUCT_USED);
+                }
+            }
+
+        }
         LuckLotteryDO luckLottery = BeanUtils.toBean(createReqVO, LuckLotteryDO.class);
         luckLotteryMapper.insert(luckLottery);
         // 返回
@@ -54,7 +73,29 @@ public class LuckLotteryServiceImpl implements LuckLotteryService {
     @Override
     public void updateLuckLottery(LuckLotterySaveReqVO updateReqVO) {
         // 校验存在
-        validateLuckLotteryExists(updateReqVO.getId());
+        LuckLotteryDO luckLottery = validateLuckLotteryExists(updateReqVO.getId());
+        LuckLotteryDO exist =  luckLotteryMapper.selectByName(updateReqVO.getName());
+        if (null != exist &&
+                !Objects.equals(luckLottery.getId(), exist.getId())) {
+            throw exception(LUCK_LOTTERY_NAME_USED, updateReqVO.getName());
+        }
+
+        if (LuckLotteryFactorEnum.ORDER_PRODUCT_PAY_SUCCESS.getFactor()
+                .equals(updateReqVO.getFactor())) {
+            // 下单指定商品支付成功
+            if (CollUtil.isEmpty(updateReqVO.getFactorInfo())) {
+                // 不存在
+                throw exception(LUCK_LOTTERY_PRODUCT_NOT_SELECTED);
+            }
+            for (String spuId : updateReqVO.getFactorInfo()) {
+                LuckLotteryDO spuExist = luckLotteryMapper.getLuckLotteryListBySpuId(spuId,null);
+                if (null != spuExist && !Objects.equals(luckLottery.getId(), spuExist.getId())) {
+                    // 已经存在
+                    throw exception(LUCK_LOTTERY_PRODUCT_USED);
+                }
+            }
+
+        }
         // 更新
         LuckLotteryDO updateObj = BeanUtils.toBean(updateReqVO, LuckLotteryDO.class);
         luckLotteryMapper.updateById(updateObj);
@@ -129,7 +170,7 @@ public class LuckLotteryServiceImpl implements LuckLotteryService {
 
     @Override
     public List<LuckLotteryDO> getLuckLotteryListByTime(Long spuId, LocalDateTime startTime, LocalDateTime endTime) {
-        return luckLotteryMapper.getLuckLotteryListByTime(spuId,startTime, endTime);
+        return luckLotteryMapper.getLuckLotteryListByTime(spuId, startTime, endTime);
     }
 
     @Override
@@ -140,4 +181,9 @@ public class LuckLotteryServiceImpl implements LuckLotteryService {
         }
         return luckLottery;
     }
+
+    @Override
+    public LuckLotteryDO getLuckLotteryListBySpuId(String spuId) {
+        return luckLotteryMapper.getLuckLotteryListBySpuId(spuId, LuckStatusEnum.ENABLE.getStatus());
+    }
 }

+ 2 - 0
citu-module-mall/citu-module-promotion-biz/src/main/java/com/citu/module/promotion/service/luck/LuckPrizeService.java

@@ -120,4 +120,6 @@ public interface LuckPrizeService {
      */
     Map<String, List<LuckPrizeDetailRespVO>> getLuckPrizeExtendAreaMap(Long lotteryId, String type, Long areaId);
 
+
+
 }

+ 3 - 3
menduner/menduner-system-biz/src/main/java/com/citu/module/menduner/system/dal/mysql/job/JobCvRelMapper.java

@@ -174,12 +174,12 @@ public interface JobCvRelMapper extends BaseMapperX<JobCvRelDO> {
     }
 
 
-    // 根据用户ID和职位id判断15天内是否有数据,如果有返回true
-    default Boolean checkDataWithin15Day(Long userId, Long jobId) {
+    // 根据用户ID和职位id判断7天内是否有数据,如果有返回true
+    default Boolean checkDataWithin7Day(Long userId, Long jobId) {
         return selectCount(new LambdaQueryWrapperX<JobCvRelDO>()
                 .eq(JobCvRelDO::getUserId, userId)
                 .eq(JobCvRelDO::getJobId, jobId)
-                .ge(JobCvRelDO::getCreateTime, LocalDateTime.now().minusDays(15))) > 0;
+                .ge(JobCvRelDO::getCreateTime, LocalDateTime.now().minusDays(7))) > 0;
     }
 
     // 根据用户id和职位id获取投递简历信息

+ 3 - 3
menduner/menduner-system-biz/src/main/java/com/citu/module/menduner/system/service/job/JobCvRelServiceImpl.java

@@ -132,7 +132,7 @@ public class JobCvRelServiceImpl implements JobCvRelService {
         }
         Long userId = LoginUserContext.getUserId();
         // 效验某段时间是否投递过
-        if (jobCvRelMapper.checkDataWithin15Day(userId, reqVO.getJobId())) {
+        if (jobCvRelMapper.checkDataWithin7Day(userId, reqVO.getJobId())) {
             throw exception(JOB_CV_REL_EXISTS);
         }
         // 赋值
@@ -165,7 +165,7 @@ public class JobCvRelServiceImpl implements JobCvRelService {
         if (null != userId) {
             // 登录效验
             // 效验某段时间是否投递过
-            if (jobCvRelMapper.checkDataWithin15Day(userId, reqVO.getJobId())) {
+            if (jobCvRelMapper.checkDataWithin7Day(userId, reqVO.getJobId())) {
                 throw exception(JOB_CV_REL_EXISTS);
             }
         }
@@ -199,7 +199,7 @@ public class JobCvRelServiceImpl implements JobCvRelService {
             return false;
         }
         // 效验某段时间是否投递过
-        return jobCvRelMapper.checkDataWithin15Day(userId, jobId);
+        return jobCvRelMapper.checkDataWithin7Day(userId, jobId);
     }
 
     @Override