|
|
|
@ -9,16 +9,23 @@
|
|
|
|
|
package co.yixiang.modules.user.rest; |
|
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.framework.common.exception.YshopException; |
|
|
|
|
import co.yixiang.enums.ShopCommonEnum; |
|
|
|
|
import co.yixiang.logging.aop.log.Log; |
|
|
|
|
import co.yixiang.modules.aop.ForbidSubmit; |
|
|
|
|
import co.yixiang.modules.shop.domain.YxSystemUserLevel; |
|
|
|
|
import co.yixiang.modules.user.domain.YxUser; |
|
|
|
|
import co.yixiang.modules.user.service.YxSystemUserLevelService; |
|
|
|
|
import co.yixiang.modules.user.service.YxUserLevelService; |
|
|
|
|
import co.yixiang.modules.user.service.YxUserService; |
|
|
|
|
import co.yixiang.modules.user.service.dto.UserMoneyDto; |
|
|
|
|
import co.yixiang.modules.user.service.dto.YxUserQueryCriteria; |
|
|
|
|
import co.yixiang.modules.user.service.impl.YxUserLevelServiceImpl; |
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
|
import io.swagger.annotations.Api; |
|
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
import org.springframework.data.domain.Pageable; |
|
|
|
|
import org.springframework.http.HttpStatus; |
|
|
|
|
import org.springframework.http.ResponseEntity; |
|
|
|
@ -44,7 +51,14 @@ import java.math.BigDecimal;
|
|
|
|
|
@RequestMapping("api") |
|
|
|
|
public class MemberController { |
|
|
|
|
|
|
|
|
|
private final YxUserService yxUserService; |
|
|
|
|
@Autowired |
|
|
|
|
private YxUserService yxUserService; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private YxUserLevelServiceImpl yxUserLevelServiceImpl; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private YxSystemUserLevelService yxSystemUserLevelService; |
|
|
|
|
|
|
|
|
|
public MemberController(YxUserService yxUserService) { |
|
|
|
|
this.yxUserService = yxUserService; |
|
|
|
@ -76,6 +90,18 @@ public class MemberController {
|
|
|
|
|
// if (resources.getIntegral().compareTo(BigDecimal.valueOf(999999.99))>=0){
|
|
|
|
|
// throw new YshopException("999999.99");
|
|
|
|
|
// }
|
|
|
|
|
//这里判断是否对会员等级进行了修改
|
|
|
|
|
YxUser yxUser=yxUserService.getById(resources.getUid()); |
|
|
|
|
//会员等级进行了修改
|
|
|
|
|
if (yxUser.getLevel()!=resources.getLevel()){ |
|
|
|
|
LambdaQueryWrapper<YxSystemUserLevel> wrapper=new LambdaQueryWrapper<>(); |
|
|
|
|
wrapper.eq(YxSystemUserLevel::getGrade,resources.getLevel()) |
|
|
|
|
.eq(YxSystemUserLevel::getIsShow, ShopCommonEnum.SHOW_1.getValue()) |
|
|
|
|
.orderByAsc(YxSystemUserLevel::getGrade) |
|
|
|
|
.last("limit 1"); |
|
|
|
|
int levelId=yxSystemUserLevelService.getOne(wrapper).getId(); |
|
|
|
|
yxUserLevelServiceImpl.setUserLevel(resources.getUid(),levelId); |
|
|
|
|
} |
|
|
|
|
yxUserService.saveOrUpdate(resources); |
|
|
|
|
return new ResponseEntity(HttpStatus.NO_CONTENT); |
|
|
|
|
} |
|
|
|
|