diff --git a/hai-cweb/src/main/java/com/cweb/config/AuthConfig.java b/hai-cweb/src/main/java/com/cweb/config/AuthConfig.java index 95345f64..4b8642bb 100644 --- a/hai-cweb/src/main/java/com/cweb/config/AuthConfig.java +++ b/hai-cweb/src/main/java/com/cweb/config/AuthConfig.java @@ -104,6 +104,7 @@ public class AuthConfig implements WebMvcConfigurer { .excludePathPatterns("/highMerchantStore/getStoreListByMerchant") .excludePathPatterns("/sms/sendSmsCode") .excludePathPatterns("/sms/getSmsCode") + .excludePathPatterns("/activity/getWinLotteryList") .excludePathPatterns("/user/login") .excludePathPatterns("/user/getUnionId") .excludePathPatterns("/order/orderToH5Pay") diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighActivityController.java b/hai-cweb/src/main/java/com/cweb/controller/HighActivityController.java index 0d4371d6..03a5442c 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighActivityController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighActivityController.java @@ -15,6 +15,7 @@ import com.hai.enum_type.ActivityInfoStatus; import com.hai.model.HighUserModel; import com.hai.model.ResponseData; import com.hai.service.HighActivityAwardService; +import com.hai.service.HighActivityAwardUserService; import com.hai.service.HighActivityInfoService; import com.hai.service.HighActivityUserLotteryNumService; import com.mysql.jdbc.exceptions.jdbc4.MySQLTransactionRollbackException; @@ -53,6 +54,9 @@ public class HighActivityController { @Resource private HighActivityAwardService highActivityAwardService; + @Resource + private HighActivityAwardUserService highActivityAwardUserService; + @Resource private HighActivityUserLotteryNumService highActivityUserLotteryNumService; @@ -69,7 +73,6 @@ public class HighActivityController { log.error("HighActivityController --> lottery() error!", "参数错误"); throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); } - // 活动信息 HighActivityInfo activityInfo = highActivityInfoService.getDetailById(body.getLong("activityId")); if (activityInfo == null) { @@ -102,10 +105,10 @@ public class HighActivityController { } } - @RequestMapping(value="/getLotteryNum",method = RequestMethod.GET) + @RequestMapping(value="/getUserLotteryNum",method = RequestMethod.GET) @ResponseBody - @ApiOperation(value = "查询抽奖数量") - public ResponseData getLotteryNum(@RequestParam(name = "activityId", required = true) Long activityId, + @ApiOperation(value = "获取用户抽奖次数") + public ResponseData getUserLotteryNum(@RequestParam(name = "activityId", required = true) Long activityId, HttpServletRequest request) { try { // 用户 @@ -160,5 +163,19 @@ public class HighActivityController { } } + @RequestMapping(value="/getWinLotteryList",method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "查询中奖记录") + public ResponseData getWinLotteryList(@RequestParam(name = "activityId", required = true) Long activityId) { + try { + + return ResponseMsgUtil.success(highActivityAwardUserService.getWinLotteryList(activityId)); + + } catch (Exception e) { + log.error("HighActivityController -> getWinLotteryList() error!",e); + return ResponseMsgUtil.exception(e); + } + } + } diff --git a/hai-service/src/main/java/com/hai/dao/HighActivityAwardUserMapperExt.java b/hai-service/src/main/java/com/hai/dao/HighActivityAwardUserMapperExt.java index 95ba0571..8eb80574 100644 --- a/hai-service/src/main/java/com/hai/dao/HighActivityAwardUserMapperExt.java +++ b/hai-service/src/main/java/com/hai/dao/HighActivityAwardUserMapperExt.java @@ -1,7 +1,21 @@ package com.hai.dao; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; + +import java.util.List; +import java.util.Map; + /** * mapper扩展类 */ public interface HighActivityAwardUserMapperExt { -} \ No newline at end of file + + @Select(" select insert(b.phone, 4, 4, '****') phone,a.name awardName,a.create_time receiveTime from \n" + + " (select a.create_time, b.name,a.user_id " + + " from high_activity_award_user a,high_activity_award b " + + " where a.activity_award_id = b.id and a.activity_info_id = #{activityId} " + + " ORDER BY a.create_time desc LIMIT 50) a" + + " LEFT JOIN high_user b on b.id = a.user_id") + List> selectWinLotteryList(@Param("activityId") Long activityId); +} diff --git a/hai-service/src/main/java/com/hai/service/HighActivityAwardUserService.java b/hai-service/src/main/java/com/hai/service/HighActivityAwardUserService.java index c73fa587..ef4b4229 100644 --- a/hai-service/src/main/java/com/hai/service/HighActivityAwardUserService.java +++ b/hai-service/src/main/java/com/hai/service/HighActivityAwardUserService.java @@ -1,5 +1,8 @@ package com.hai.service; +import java.util.List; +import java.util.Map; + /** * @author hurui */ @@ -9,4 +12,12 @@ public interface HighActivityAwardUserService { * 增加用户中奖记录 */ void insertAwardUser(Long serialNumId,Long userId); + + /** + * 此方法请勿随意调用与修改,因为这个是专门对外开放的 + * 根据活动查询中奖记录 + * @param activityId + * @return + */ + List> getWinLotteryList(Long activityId); } diff --git a/hai-service/src/main/java/com/hai/service/impl/HighActivityAwardUserServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighActivityAwardUserServiceImpl.java index 754e2c61..c0d5f213 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighActivityAwardUserServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighActivityAwardUserServiceImpl.java @@ -9,6 +9,8 @@ import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.Date; +import java.util.List; +import java.util.Map; @Service("highActivityAwardUserService") public class HighActivityAwardUserServiceImpl implements HighActivityAwardUserService { @@ -33,4 +35,9 @@ public class HighActivityAwardUserServiceImpl implements HighActivityAwardUserSe highActivityAwardUserMapper.insert(awardUser); } } + + @Override + public List> getWinLotteryList(Long activityId) { + return highActivityAwardUserMapper.selectWinLotteryList(activityId); + } }