提交代码

dev-discount
胡锐 3 years ago
parent 233a73a316
commit 96203b04da
  1. 2
      hai-service/src/main/java/com/hai/dao/HighActivityInfoMapperExt.java
  2. 8
      hai-service/src/main/java/com/hai/service/HighActivityPrizeService.java
  3. 24
      hai-service/src/main/java/com/hai/service/impl/HighActivityPrizeServiceImpl.java
  4. 16
      hai-service/src/main/java/com/hai/service/impl/HighActivityUserLotteryNumServiceImpl.java

@ -19,7 +19,7 @@ public interface HighActivityInfoMapperExt {
" WHERE" +
" a.activity_info_id = b.id " +
" AND a.product_type = 1 " +
" AND a.product_id = 23423538 " +
" AND a.product_id = #{couponId} " +
" AND b.`status` = 2" +
" AND NOW() >= b.start_time " +
" AND NOW() <= b.end_time" +

@ -1,6 +1,6 @@
package com.hai.service;
import com.hai.entity.HighActivityAward;
import com.hai.entity.HighActivityPrize;
import java.util.List;
@ -10,5 +10,11 @@ import java.util.List;
*/
public interface HighActivityPrizeService {
/**
* 根据活动 查询奖励
* @param AwardId
* @return
*/
List<HighActivityPrize> getListByAwardId(Long activityAwardId);
}

@ -0,0 +1,24 @@
package com.hai.service.impl;
import com.hai.dao.HighActivityPrizeMapper;
import com.hai.entity.HighActivityPrize;
import com.hai.entity.HighActivityPrizeExample;
import com.hai.service.HighActivityPrizeService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service("highActivityPrizeService")
public class HighActivityPrizeServiceImpl implements HighActivityPrizeService {
@Resource
private HighActivityPrizeMapper highActivityPrizeMapper;
@Override
public List<HighActivityPrize> getListByAwardId(Long activityAwardId) {
HighActivityPrizeExample example = new HighActivityPrizeExample();
example.createCriteria().andActivityAwardIdEqualTo(activityAwardId).andStatusEqualTo(1);
return highActivityPrizeMapper.selectByExample(example);
}
}

@ -1,5 +1,6 @@
package com.hai.service.impl;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
@ -32,6 +33,9 @@ public class HighActivityUserLotteryNumServiceImpl implements HighActivityUserLo
@Resource
private HighActivityAwardUserService highActivityAwardUserService;
@Resource
private HighActivityPrizeService highActivityPrizeService;
@Resource
private HighActivityUserLotteryNumMapper highActivityUserLotteryNumMapper;
@ -69,6 +73,18 @@ public class HighActivityUserLotteryNumServiceImpl implements HighActivityUserLo
JSONObject jsonObject = new JSONObject();
jsonObject.put("activityAwardId", serialNum.getActivityAwardId());
jsonObject.put("serialNum", serialNum.getSerialNum());
// 查询中奖的奖品
JSONArray prizeArray = new JSONArray();
List<HighActivityPrize> prizeList = highActivityPrizeService.getListByAwardId(serialNum.getActivityAwardId());
for (HighActivityPrize prize : prizeList) {
JSONObject prizeObject = new JSONObject();
prizeObject.put("prizeName", prize.getPrizeName());
prizeObject.put("prizeNum", prize.getPrizeNum());
prizeArray.add(prize);
}
jsonObject.put("prizeList", prizeArray);
return jsonObject;
}

Loading…
Cancel
Save