|
@@ -25,6 +25,8 @@ import com.qs.mp.user.domain.UserCoin;
|
|
import com.qs.mp.user.domain.UserCoinLog;
|
|
import com.qs.mp.user.domain.UserCoinLog;
|
|
import com.qs.mp.user.domain.UserCoupon;
|
|
import com.qs.mp.user.domain.UserCoupon;
|
|
import com.qs.mp.user.domain.UserPrizeStorage;
|
|
import com.qs.mp.user.domain.UserPrizeStorage;
|
|
|
|
+import com.qs.mp.user.domain.dto.CoinTransferParamDTO;
|
|
|
|
+import com.qs.mp.user.domain.param.CoinTransferParam;
|
|
import com.qs.mp.user.domain.param.CouponChannelQueryParam;
|
|
import com.qs.mp.user.domain.param.CouponChannelQueryParam;
|
|
import com.qs.mp.user.domain.param.UserPrizeStorageUpdateParam;
|
|
import com.qs.mp.user.domain.param.UserPrizeStorageUpdateParam;
|
|
import com.qs.mp.user.domain.vo.UserCouponVO;
|
|
import com.qs.mp.user.domain.vo.UserCouponVO;
|
|
@@ -36,25 +38,20 @@ import com.qs.mp.user.service.IUserPrizeStorageService;
|
|
import com.qs.mp.user.service.IUserTicketOrderItemService;
|
|
import com.qs.mp.user.service.IUserTicketOrderItemService;
|
|
import com.qs.mp.utils.SecurityUtils;
|
|
import com.qs.mp.utils.SecurityUtils;
|
|
import com.qs.mp.web.controller.common.BaseApiController;
|
|
import com.qs.mp.web.controller.common.BaseApiController;
|
|
-import io.swagger.annotations.Api;
|
|
|
|
-import io.swagger.annotations.ApiOperation;
|
|
|
|
|
|
+import io.swagger.annotations.*;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
|
|
-import io.swagger.annotations.ApiResponse;
|
|
|
|
-import io.swagger.annotations.ApiResponses;
|
|
|
|
|
|
+import java.util.Objects;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.AllArgsConstructor;
|
|
import ma.glasnost.orika.MapperFacade;
|
|
import ma.glasnost.orika.MapperFacade;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.util.CollectionUtils;
|
|
import org.springframework.util.CollectionUtils;
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.validation.annotation.Validated;
|
|
-import org.springframework.web.bind.annotation.PostMapping;
|
|
|
|
-import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
@RestController
|
|
@RestController
|
|
@@ -263,6 +260,70 @@ public class UserMineController extends BaseApiController {
|
|
return getDataTable(userCoinLogList);
|
|
return getDataTable(userCoinLogList);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 根据手机号查询用户昵称
|
|
|
|
+ */
|
|
|
|
+ @PostMapping("/sysUser/mobile/{mobile}")
|
|
|
|
+ @ApiOperation(value = "根据手机号查询用户信息")
|
|
|
|
+ @ApiImplicitParams(
|
|
|
|
+ @ApiImplicitParam(name = "mobile", value = "手机号", required = true, dataType = "String", paramType = "path")
|
|
|
|
+ )
|
|
|
|
+ @ApiResponses(
|
|
|
|
+ @ApiResponse(code = 200, message = "成功", response = SysUser.class)
|
|
|
|
+ )
|
|
|
|
+ public AjaxResult sysUserInfoByMobile(@PathVariable("mobile") String mobile){
|
|
|
|
+ if (StringUtils.isBlank(mobile)) {
|
|
|
|
+ return AjaxResult.success();
|
|
|
|
+ }
|
|
|
|
+ SysUser user = userService.selectNickNameByPhoneNumber(mobile);
|
|
|
|
+ if (Objects.isNull(user)) {
|
|
|
|
+ return AjaxResult.error("未查询到用户");
|
|
|
|
+ }
|
|
|
|
+ return AjaxResult.success(user);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 盲豆转让
|
|
|
|
+ */
|
|
|
|
+ @PostMapping("/coin/transfer/save")
|
|
|
|
+ @ApiOperation(value = "盲豆转赠")
|
|
|
|
+ public AjaxResult transfer(@RequestBody CoinTransferParam coinTransferParam) {
|
|
|
|
+ // 自己为转让人
|
|
|
|
+ Long fromUserId = SecurityUtils.getUserId();
|
|
|
|
+ if (fromUserId == null) {
|
|
|
|
+ return AjaxResult.error("非法调用");
|
|
|
|
+ }
|
|
|
|
+ if (StringUtils.isBlank(coinTransferParam.getPhone())
|
|
|
|
+ || Objects.isNull(coinTransferParam.getTransferCoin())) {
|
|
|
|
+ return AjaxResult.error("转赠参数不能为空");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 校验受赠人信息
|
|
|
|
+ SysUser toUser = userService.selectUserByPhoneNumber(coinTransferParam.getPhone());
|
|
|
|
+
|
|
|
|
+ // 查询转赠人信息
|
|
|
|
+ if (Objects.isNull(toUser)) {
|
|
|
|
+ return AjaxResult.error("未查询到受赠用户");
|
|
|
|
+ }
|
|
|
|
+ if (fromUserId.equals(toUser.getUserId())) {
|
|
|
|
+ return AjaxResult.error("不能转赠给自己");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ CoinTransferParamDTO coinTransferParamDTO = new CoinTransferParamDTO();
|
|
|
|
+ coinTransferParamDTO.setFromUserId(fromUserId);
|
|
|
|
+ coinTransferParamDTO.setToUserId(toUser.getUserId());
|
|
|
|
+ coinTransferParamDTO.setToPhone(toUser.getPhonenumber());
|
|
|
|
+ coinTransferParamDTO.setFromPhone(coinTransferParam.getPhone());
|
|
|
|
+ coinTransferParamDTO.setRealTransferCoin(coinTransferParam.getTransferCoin() - 10);
|
|
|
|
+ coinTransferParamDTO.setDeductTransferCoin(10);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ // 转赠盲豆
|
|
|
|
+ boolean flag = userCoinService.transfer(coinTransferParamDTO);
|
|
|
|
+
|
|
|
|
+ return AjaxResult.success(flag);
|
|
|
|
+ }
|
|
/**
|
|
/**
|
|
* 我的实物奖品库
|
|
* 我的实物奖品库
|
|
*/
|
|
*/
|