用户积分
This commit is contained in:
@@ -5,6 +5,7 @@ import com.czg.annotation.SaAdminCheckPermission;
|
||||
import com.czg.market.dto.MkPointsConfigDTO;
|
||||
import com.czg.market.dto.MkPointsUserDTO;
|
||||
import com.czg.market.entity.MkPointsConfig;
|
||||
import com.czg.market.entity.MkPointsUser;
|
||||
import com.czg.market.entity.MkPointsUserRecord;
|
||||
import com.czg.market.service.MkPointsConfigService;
|
||||
import com.czg.market.service.MkPointsUserRecordService;
|
||||
@@ -12,15 +13,16 @@ import com.czg.market.service.MkPointsUserService;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.sa.StpKit;
|
||||
import com.czg.utils.CzgStrUtils;
|
||||
import com.czg.validator.ValidatorUtil;
|
||||
import com.czg.validator.group.DefaultGroup;
|
||||
import com.czg.validator.group.InsertGroup;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* 积分配置
|
||||
@@ -88,4 +90,23 @@ public class PointsConfigController {
|
||||
@RequestParam(required = false) Long id) {
|
||||
return CzgResult.success(userRecordService.pageByPointsUserId(page, size, id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户积分 包括配置信息
|
||||
* {
|
||||
* "pointsConfig": 配置信息,
|
||||
* "pointsUser": 用户积分信息
|
||||
* }
|
||||
*/
|
||||
@GetMapping("userPoints")
|
||||
public CzgResult<Map<String, Object>> userPoints(@RequestParam(required = false) Long shopUserId) {
|
||||
Long shopId = StpKit.USER.getShopId();
|
||||
Map<String, Object> result = new HashMap<>(2);
|
||||
MkPointsConfig pointsConfig = pointsConfigService.getById(shopId);
|
||||
MkPointsUser pointsUser = pointsUserService.getOne(QueryWrapper.create().eq(MkPointsUser::getShopId, shopId).eq(MkPointsUser::getShopUserId, shopUserId));
|
||||
result.put("pointsConfig", pointsConfig == null ? "" : pointsConfig);
|
||||
result.put("pointsUser", pointsUser == null ? "" : pointsUser);
|
||||
return CzgResult.success(result);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -60,10 +60,10 @@ public class UPointsController {
|
||||
Long shopId = StpKit.USER.getShopId();
|
||||
Map<String, Object> result = new HashMap<>(2);
|
||||
MkPointsConfig pointsConfig = pointsConfigService.getById(shopId);
|
||||
MkPointsUser pointsUser = pointsUserService.getOne(QueryWrapper.create().eq(MkPointsUser::getShopId, shopId).eq(MkPointsUser::getUserId, shopUserId));
|
||||
MkPointsUser pointsUser = pointsUserService.getOne(QueryWrapper.create().eq(MkPointsUser::getShopId, shopId).eq(MkPointsUser::getShopUserId, shopUserId));
|
||||
result.put("pointsConfig", pointsConfig == null ? "" : pointsConfig);
|
||||
result.put("pointsUser", pointsUser == null ? "" : pointsUser);
|
||||
return CzgResult.success();
|
||||
return CzgResult.success(result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user