实物领取
This commit is contained in:
parent
131e022c76
commit
dacf309731
|
|
@ -10,6 +10,7 @@ import com.alipay.api.request.AlipayFundTransToaccountTransferRequest;
|
|||
import com.alipay.api.request.AlipayFundTransUniTransferRequest;
|
||||
import com.alipay.api.response.AlipayFundTransToaccountTransferResponse;
|
||||
import com.alipay.api.response.AlipayFundTransUniTransferResponse;
|
||||
import com.sqx.common.annotation.Debounce;
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.app.annotation.Login;
|
||||
import com.sqx.modules.app.entity.UserEntity;
|
||||
|
|
@ -265,6 +266,7 @@ public class CashController {
|
|||
@RequestMapping(value = "/alipay/{cashId}", method = RequestMethod.POST)
|
||||
@ApiOperation("管理平台确认提现")
|
||||
@ResponseBody
|
||||
@Debounce(interval = 3000, value = "#cashId")
|
||||
public Result alipayPay(@PathVariable Long cashId) {
|
||||
reentrantReadWriteLock.writeLock().lock();
|
||||
try {
|
||||
|
|
@ -419,6 +421,7 @@ public class CashController {
|
|||
@RequestMapping(value = "/refund/{cashId}/{content}", method = RequestMethod.POST)
|
||||
@ApiOperation("管理平台退款")
|
||||
@ResponseBody
|
||||
@Debounce(interval = 3000, value = "#cashId")
|
||||
public Result refund(@PathVariable("cashId") Long cashId, @PathVariable("content") String content) {
|
||||
CashOut one = cashOutService.selectById(cashId);
|
||||
if (one == null) {
|
||||
|
|
@ -479,6 +482,7 @@ public class CashController {
|
|||
|
||||
@GetMapping(value = "/cashMoney")
|
||||
@ApiOperation("发起提现")
|
||||
@Debounce(interval = 3000, value = "#userId")
|
||||
public Result cashMoney(Long userId, Double money) {
|
||||
return cashOutService.sysCashMoney(userId, money);
|
||||
}
|
||||
|
|
@ -491,6 +495,7 @@ public class CashController {
|
|||
@ApiImplicitParam(name = "money", value = "提现金额", dataTypeClass = Double.class, paramType = "param"),
|
||||
@ApiImplicitParam(name = "msg", value = "验证码", dataTypeClass = String.class, paramType = "param"),
|
||||
})
|
||||
@Debounce(interval = 3000, value = "#userId")
|
||||
public Result withdraw(Long userId, Double money, String msg) {
|
||||
if (StringUtils.isBlank(msg)) {
|
||||
return Result.error("请输入验证码");
|
||||
|
|
|
|||
|
|
@ -8,7 +8,12 @@ import com.sqx.common.annotation.Debounce;
|
|||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.app.annotation.Login;
|
||||
import com.sqx.modules.taskCenter.entity.TaskCenter;
|
||||
import com.sqx.modules.taskCenter.entity.TaskCenterRecord;
|
||||
import com.sqx.modules.taskCenter.entity.TaskCenterReward;
|
||||
import com.sqx.modules.taskCenter.service.TaskCenterRecordService;
|
||||
import com.sqx.modules.taskCenter.service.TaskCenterRewardService;
|
||||
import com.sqx.modules.taskCenter.service.TaskCenterService;
|
||||
import com.sqx.modules.userSign.entity.UserSignRecord;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
|
|
@ -18,6 +23,9 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.web.bind.annotation.*;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Api(value = "任务中心", tags = {"任务中心"})
|
||||
|
|
@ -29,6 +37,11 @@ public class TaskCenterController {
|
|||
@Autowired
|
||||
private TaskCenterService taskCenterService;
|
||||
|
||||
@Autowired
|
||||
private TaskCenterRecordService recordService;
|
||||
@Autowired
|
||||
private TaskCenterRewardService taskRewardService;
|
||||
|
||||
@PostMapping("/taskCenter/insertTaskCenter")
|
||||
@ApiOperation("添加任务中心")
|
||||
public Result insertTaskCenter(@RequestBody TaskCenter taskCenter) {
|
||||
|
|
@ -61,7 +74,7 @@ public class TaskCenterController {
|
|||
@GetMapping("/taskCenter/selectTaskCenter")
|
||||
@ApiOperation("查询任务中心")
|
||||
public Result selectTaskCenter(Integer page, Integer limit) {
|
||||
return Result.success().put("data", taskCenterService.page(new Page<>(page, limit), new QueryWrapper<TaskCenter>().orderByAsc("sort","type")));
|
||||
return Result.success().put("data", taskCenterService.page(new Page<>(page, limit), new QueryWrapper<TaskCenter>().orderByAsc("sort", "type")));
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -79,8 +92,45 @@ public class TaskCenterController {
|
|||
})
|
||||
@ApiOperation("App 任务中心 领取")
|
||||
@Debounce(interval = 1000, value = "#userId")
|
||||
public Result taskReceive(@ApiIgnore @RequestAttribute("userId") Long userId,Long id) {
|
||||
return taskCenterService.taskReceive(userId,id);
|
||||
public Result taskReceive(@ApiIgnore @RequestAttribute("userId") Long userId, Long id) {
|
||||
return taskCenterService.taskReceive(userId, id);
|
||||
}
|
||||
|
||||
@Login
|
||||
@PostMapping("/app/taskCenter/receiveGoods")
|
||||
@ApiOperation("App 实物领取")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "taskId", value = "任务id", dataTypeClass = Long.class, paramType = "body"),
|
||||
@ApiImplicitParam(name = "sourceId", value = "实物(物品Id)", dataTypeClass = Long.class, paramType = "body")
|
||||
})
|
||||
@Debounce(interval = 1000, value = "#userId")
|
||||
public Result receiveGoods(@ApiIgnore @RequestAttribute("userId") Long userId, TaskCenterRecord record) {
|
||||
TaskCenter task = taskCenterService.getById(record.getTaskId());
|
||||
if (Objects.isNull(task)) {
|
||||
return Result.error("任务不存在。");
|
||||
}
|
||||
if (recordService.countTaskNum(userId, record.getTaskId(), DateUtil.beginOfMonth(new Date()) + " 00:00:00") > 0) {
|
||||
return Result.error("该奖励仅可领取一次。");
|
||||
}
|
||||
TaskCenterReward reward = taskRewardService.getOne(new QueryWrapper<TaskCenterReward>()
|
||||
.eq("task_id", record.getTaskId())
|
||||
.eq("type", 3)
|
||||
.eq("id", record.getSourceId()));
|
||||
if (Objects.isNull(reward)) {
|
||||
return Result.error("该奖励不存在。");
|
||||
}
|
||||
if (reward.getSurplusNumber() == null || reward.getSurplusNumber() < 1) {
|
||||
return Result.error("暂无库存,请领取其它奖励。");
|
||||
}
|
||||
record.setNumber(1);
|
||||
record.setName(reward.getName());
|
||||
record.setUserId(userId);
|
||||
record.setType(3);
|
||||
record.setCreateTime(DateUtil.now());
|
||||
record.setUpdateTime(DateUtil.now());
|
||||
recordService.save(record);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,14 +1,9 @@
|
|||
package com.sqx.modules.taskCenter.entity;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
|
|
@ -21,17 +16,17 @@ import lombok.Data;
|
|||
@TableName("task_center_record")
|
||||
@ApiModel(value = "任务领取记录 实体类")
|
||||
public class TaskCenterRecord extends Model<TaskCenterRecord> {
|
||||
@ApiModelProperty("id")
|
||||
@ApiModelProperty(value = "id",hidden = true)
|
||||
private Long id;
|
||||
@ApiModelProperty("用户id")
|
||||
@ApiModelProperty(value = "用户id",hidden = true)
|
||||
private Long userId;
|
||||
@ApiModelProperty("任务Id 周任务转盘奖励时 该值为 user_sign_record的id")
|
||||
private Long taskId;
|
||||
@ApiModelProperty("来源Id 目前仅周任务使用")
|
||||
@ApiModelProperty("来源Id 周任务(签到的Id) 实物(物品Id)")
|
||||
private Long sourceId;
|
||||
@ApiModelProperty("奖励名称")
|
||||
private String name;
|
||||
@ApiModelProperty("奖励类型 1 金币 2 现金 3 4 5 9转盘")
|
||||
@ApiModelProperty("奖励类型 1 金币 2 现金 3 虚拟物品 4 5 9转盘")
|
||||
private Integer type;
|
||||
private Long targetId;
|
||||
@ApiModelProperty("数量")
|
||||
|
|
|
|||
|
|
@ -29,6 +29,10 @@ public class TaskCenterReward extends Model<TaskCenterReward> {
|
|||
private Integer targetId;
|
||||
@ApiModelProperty("数量")
|
||||
private Integer number;
|
||||
@ApiModelProperty("总数量")
|
||||
private Integer totalNumber;
|
||||
@ApiModelProperty("剩余数量")
|
||||
private Integer surplusNumber;
|
||||
private String createTime;
|
||||
private String updateTime;
|
||||
|
||||
|
|
|
|||
|
|
@ -136,11 +136,19 @@ public class TaskCenterServiceImpl extends ServiceImpl<TaskCenterDao, TaskCenter
|
|||
} else {
|
||||
s.setButtonTitle("已领取");
|
||||
s.setDisabled(false);
|
||||
s.setDiscNumber(null);
|
||||
s.setNumber(null);
|
||||
}
|
||||
}else{
|
||||
s.setDiscNumber(null);
|
||||
s.setNumber(null);
|
||||
if (recordService.countTaskNum(userId, s.getId(), DateUtil.beginOfMonth(new Date()) + " 00:00:00") > 0) {
|
||||
s.setButtonTitle("已领取");
|
||||
s.setDisabled(false);
|
||||
s.setNumber(null);
|
||||
s.setDiscNumber(null);
|
||||
}else {
|
||||
s.setDiscNumber(null);
|
||||
s.setNumber(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue