记得上下班打卡 | git大法好,push需谨慎

Commit 5ddb9bf7 authored by wangyifan's avatar wangyifan

福袋补充需求:兑换码核销接口

parent 50d9bc92
...@@ -4,4 +4,6 @@ import com.liquidnet.service.kylin.dto.vo.KylinLuckyBagVo; ...@@ -4,4 +4,6 @@ import com.liquidnet.service.kylin.dto.vo.KylinLuckyBagVo;
public interface IKylinLuckyBagService { public interface IKylinLuckyBagService {
KylinLuckyBagVo getLuckyBagByOrderId(String orderId); KylinLuckyBagVo getLuckyBagByOrderId(String orderId);
Boolean consumeCode(String code, String luckyBagId);
} }
...@@ -154,6 +154,7 @@ global-auth: ...@@ -154,6 +154,7 @@ global-auth:
# 场地摄像头列表 # 场地摄像头列表
- ${liquidnet.info.context}/camera/list - ${liquidnet.info.context}/camera/list
- ${liquidnet.info.context}/inner/** - ${liquidnet.info.context}/inner/**
- ${liquidnet.info.context}/luckyBag/code/consume
oncheck-url-pattern: oncheck-url-pattern:
- ${liquidnet.info.context}/order/details - ${liquidnet.info.context}/order/details
- ${liquidnet.info.context}/order/transfer* - ${liquidnet.info.context}/order/transfer*
......
...@@ -47,7 +47,7 @@ public class KylinRewardUser implements Serializable, Cloneable{ ...@@ -47,7 +47,7 @@ public class KylinRewardUser implements Serializable, Cloneable{
private String code; private String code;
/** /**
* 状态 0不可用 1可用 * 状态 0不可用 1可用 2已使用
*/ */
private Integer state; private Integer state;
......
...@@ -19,12 +19,19 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -19,12 +19,19 @@ import org.springframework.web.bind.annotation.RestController;
public class KylinLuckyBagController { public class KylinLuckyBagController {
@Autowired @Autowired
private IKylinLuckyBagService benefitsService; private IKylinLuckyBagService luckyBagService;
@GetMapping("") @GetMapping("")
@ApiOperation("获取福袋权益列表") @ApiOperation("获取福袋权益列表")
public ResponseDto<KylinLuckyBagVo> getLuckyBagByOrderId(@RequestParam(value = "orderId") String orderId) { public ResponseDto<KylinLuckyBagVo> getLuckyBagByOrderId(@RequestParam(value = "orderId") String orderId) {
return ResponseDto.success(benefitsService.getLuckyBagByOrderId(orderId)); return ResponseDto.success(luckyBagService.getLuckyBagByOrderId(orderId));
}
@GetMapping("/code/consume")
@ApiOperation("兑换码核销")
public ResponseDto<Boolean> consumeCode(@RequestParam(value = "code") String code,
@RequestParam(value = "luckyBagId") String luckyBagId){
return ResponseDto.success(luckyBagService.consumeCode(code, luckyBagId));
} }
} }
...@@ -87,6 +87,28 @@ public class KylinLuckyBagServiceImpl implements IKylinLuckyBagService { ...@@ -87,6 +87,28 @@ public class KylinLuckyBagServiceImpl implements IKylinLuckyBagService {
} }
@Override
public Boolean consumeCode(String code, String luckyBagId) {
LambdaQueryWrapper<KylinRewardUser> queryWrapper = new QueryWrapper<KylinRewardUser>()
.lambda()
.eq(KylinRewardUser::getCode, code)
.eq(KylinRewardUser::getLuckyBagId, luckyBagId);
KylinRewardUser rewardUser = kylinRewardUserMapper.selectOne(queryWrapper);
if (rewardUser == null) {
log.error("code does not exist, code: {}, luckyBagId: {}.", code, luckyBagId);
return Boolean.FALSE;
}
if (rewardUser.getState().equals(2)) {
log.info("code be used, code: {}, luckyBagId: {}.", code, luckyBagId);
return Boolean.FALSE;
}
rewardUser.setState(2);
rewardUser.setUpdatedAt(LocalDateTime.now());
int updateById = kylinRewardUserMapper.updateById(rewardUser);
log.info("update code result: {}.", updateById);
return updateById > 0;
}
/** /**
* 获取福袋列表 * 获取福袋列表
* *
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment