提交
This commit is contained in:
parent
907018ca9f
commit
07cafb2d09
smart-switch-service/src/main/java/com/ruoyi/ss/vip
domain
mapper
service
smart-switch-web/src/main/java/com/ruoyi/web/controller
|
@ -1,10 +1,10 @@
|
|||
package com.ruoyi.ss.vip.domain;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author wjh
|
||||
* 2024/12/9
|
||||
|
@ -18,4 +18,6 @@ public class VipQuery extends VipVO{
|
|||
@ApiModelProperty("VIP等级ID列表")
|
||||
private List<Long> vipLevelIds;
|
||||
|
||||
@ApiModelProperty("VIP ID列表")
|
||||
private List<Long> ids;
|
||||
}
|
||||
|
|
|
@ -72,6 +72,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="query.ids != null and query.ids.size() > 0">
|
||||
and sv.id in
|
||||
<foreach collection="query.ids" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<select id="selectVipList" parameterType="VipQuery" resultMap="VipResult">
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
package com.ruoyi.ss.vip.service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.ss.vip.domain.Vip;
|
||||
import com.ruoyi.ss.vip.domain.VipQuery;
|
||||
import com.ruoyi.ss.vip.domain.VipVO;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 会员Service接口
|
||||
*
|
||||
|
@ -96,4 +96,10 @@ public interface VipService
|
|||
* @return
|
||||
*/
|
||||
int logicDel(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 获取会员列表
|
||||
* @param ids
|
||||
*/
|
||||
List<VipVO> selectVipByIds(List<Long> ids);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.ruoyi.ss.vip.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.ss.vip.domain.Vip;
|
||||
import com.ruoyi.ss.vip.domain.VipVO;
|
||||
|
||||
|
@ -23,4 +25,9 @@ public interface VipValidator {
|
|||
* 是否允许查看
|
||||
*/
|
||||
boolean canView(VipVO vo, Long userId);
|
||||
|
||||
/**
|
||||
* 是否允许操作所有会员
|
||||
*/
|
||||
boolean canOperateAll(List<VipVO> vipList, Long userId);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,13 @@
|
|||
package com.ruoyi.ss.vip.service.impl;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.support.TransactionTemplate;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.collection.CollectionUtils;
|
||||
|
@ -9,12 +17,6 @@ import com.ruoyi.ss.vip.domain.VipVO;
|
|||
import com.ruoyi.ss.vip.mapper.VipMapper;
|
||||
import com.ruoyi.ss.vip.service.VipService;
|
||||
import com.ruoyi.ss.vip.service.VipValidator;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.support.TransactionTemplate;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 会员Service业务层处理
|
||||
|
@ -169,4 +171,15 @@ public class VipServiceImpl implements VipService
|
|||
}
|
||||
return vipMapper.logicDel(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<VipVO> selectVipByIds(List<Long> ids) {
|
||||
if (CollectionUtils.isEmptyElement(ids)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
VipQuery query = new VipQuery();
|
||||
query.setIds(ids);
|
||||
return vipMapper.selectVipList(query);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,13 @@
|
|||
package com.ruoyi.ss.vip.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.ruoyi.common.utils.ServiceUtil;
|
||||
import com.ruoyi.common.utils.collection.CollectionUtils;
|
||||
import com.ruoyi.ss.store.service.StoreValidator;
|
||||
import com.ruoyi.ss.user.service.UserValidator;
|
||||
import com.ruoyi.ss.vip.domain.Vip;
|
||||
|
@ -8,10 +15,6 @@ import com.ruoyi.ss.vip.domain.VipQuery;
|
|||
import com.ruoyi.ss.vip.domain.VipVO;
|
||||
import com.ruoyi.ss.vip.service.VipService;
|
||||
import com.ruoyi.ss.vip.service.VipValidator;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author wjh
|
||||
|
@ -55,6 +58,21 @@ public class VipValidatorImpl implements VipValidator {
|
|||
return vo != null && userId != null && Objects.equals(vo.getStoreMchId(), userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canOperateAll(List<VipVO> vipList, Long userId) {
|
||||
if (CollectionUtils.isEmptyElement(vipList) || userId == null) {
|
||||
return false;
|
||||
}
|
||||
return vipList.stream().allMatch(vo -> this.canOperate(vo, userId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否允许操作VIP
|
||||
*/
|
||||
private boolean canOperate(VipVO vo, Long userId) {
|
||||
return vo != null && userId != null && Objects.equals(vo.getVipMchId(), userId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验用户是否重复成为店铺会员
|
||||
* @param id 会员ID
|
||||
|
|
|
@ -1,18 +1,23 @@
|
|||
package com.ruoyi.web.controller.mch;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.ValidGroup;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.ss.vip.domain.Vip;
|
||||
import com.ruoyi.ss.vip.domain.VipQuery;
|
||||
import com.ruoyi.ss.vip.domain.VipVO;
|
||||
import com.ruoyi.ss.vip.service.VipService;
|
||||
import com.ruoyi.ss.vip.service.VipValidator;
|
||||
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* @author wjh
|
||||
|
@ -46,11 +51,15 @@ public class MchVipController extends BaseController {
|
|||
return success(vo);
|
||||
}
|
||||
|
||||
@ApiOperation("商户新增VIP")
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody @Validated(ValidGroup.FrontCreate.class) Vip data) {
|
||||
// TODO
|
||||
return success();
|
||||
@ApiOperation("商户删除会员")
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult delete(@PathVariable List<Long> ids) {
|
||||
// 校验权限
|
||||
List<VipVO> vipList = vipService.selectVipByIds(ids);
|
||||
if (vipValidator.canOperateAll(vipList, getUserId())) {
|
||||
return error("您无权删除该会员");
|
||||
}
|
||||
return toAjax(vipService.logicDel(ids));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -95,6 +95,12 @@ public class SmUserController extends BaseController
|
|||
List<SmUserVO> list = Collections.singletonList(user);
|
||||
userAssembler.assembleChannelList(list);
|
||||
userAssembler.assembleRealServiceRate(list);
|
||||
userAssembler.assembleStoreCount(list);
|
||||
userAssembler.assembleDeviceCount(list);
|
||||
userAssembler.assembleTotalIncome(list);
|
||||
userAssembler.assembleWaitBonusAmount(list);
|
||||
userAssembler.assembleWithdrawAmount(list);
|
||||
userAssembler.assembleRechargeAmount(list);
|
||||
userService.desensitization(list);
|
||||
return success(user);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user