记得上下班打卡 | git大法好,push需谨慎

Commit 551c9734 authored by 张国柄's avatar 张国柄

会员ADMIN.API补充权限配置;

parent 05f4b446
......@@ -14,6 +14,7 @@ import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
......@@ -36,12 +37,7 @@ public class AdamMemberAdminController {
@Autowired
RedisUtil redisUtil;
@ApiOperation(value = "添加会员卡")
@PostMapping("add")
public ResponseDto<Object> add(@RequestBody AdamMemberParam parameter) {
return ResponseDto.success(adamMemberService.add(parameter));
}
@RequiresPermissions("adam:member:list")
@ApiOperation(value = "会员卡列表")
@PostMapping("list")
public ResponseDto<List<AdamMemberVo>> list() {
......@@ -53,18 +49,21 @@ public class AdamMemberAdminController {
return ResponseDto.success(vos);
}
@ApiOperation(value = "同步会员卡")
@PostMapping("sync")
public ResponseDto<Object> sync() {
return adamMemberService.sync();
@RequiresPermissions("adam:member:add")
@ApiOperation(value = "添加会员卡")
@PostMapping("add")
public ResponseDto<Object> add(@RequestBody AdamMemberParam parameter) {
return ResponseDto.success(adamMemberService.add(parameter));
}
@RequiresPermissions("adam:member:gen_code")
@ApiOperation(value = "生成兑换码")
@PostMapping("gen_code")
public ResponseDto<String> genMemberCode(@RequestBody AdamMemberCodeParam parameter) {
return ResponseDto.success(adamMemberCodeAdminService.createGiftCode(parameter));
}
@RequiresPermissions("adam:member:switch:buy")
@ApiOperation(value = "开放/限制购买会员")
@ApiImplicitParams({
@ApiImplicitParam(type = "form", required = true, dataType = "int", name = "opt", value = "0-限制|1-开放", example = "0"),
......
......@@ -11,6 +11,7 @@ import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
......@@ -30,6 +31,7 @@ public class AdamMemberPriceAdminController {
@Autowired
IAdamMemberPriceAdminService adamMemberPriceService;
@RequiresPermissions("adam:mprice:list")
@ApiOperation(value = "会员价格列表")
@ApiImplicitParams({
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "memberId", value = "会员卡ID[64]"),
......@@ -46,6 +48,7 @@ public class AdamMemberPriceAdminController {
return ResponseDto.success(vos);
}
@RequiresPermissions("adam:mprice:info")
@ApiOperation(value = "会员价格详情")
@ApiImplicitParams({
@ApiImplicitParam(type = "form", required = true, dataType = "String", name = "memberId", value = "会员卡ID[64]"),
......@@ -61,6 +64,7 @@ public class AdamMemberPriceAdminController {
return ResponseDto.success(AdamMemberPriceVo.getNew().copy(one));
}
@RequiresPermissions("adam:mprice:add")
@ApiOperation(value = "添加会员价格")
@PostMapping("add")
public ResponseDto<AdamMemberPriceVo> add(@Valid @RequestBody AdamMemberPriceParam param) {
......@@ -69,6 +73,7 @@ public class AdamMemberPriceAdminController {
return ResponseDto.success(adamMemberPriceService.add(entity));
}
@RequiresPermissions("adam:mprice:edit")
@ApiOperation(value = "编辑会员价格")
@PostMapping("edit")
public ResponseDto<AdamMemberPriceVo> edit(@Valid @RequestBody AdamMemberPriceParam param) {
......
......@@ -7,6 +7,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.validation.annotation.Validated;
......@@ -28,12 +29,14 @@ public class AdamUserMemberAdminController {
@Autowired
RedisUtil redisUtil;
@RequiresPermissions("adam:umember:blk:lis")
@ApiOperation(value = "会员黑名单UID")
@PostMapping("blk/lis")
public ResponseDto<List<String>> listBlack() {
return ResponseDto.success((List<String>) redisUtil.get(AdamRedisConst.BLK_LIST_MEMBER_UID));
}
@RequiresPermissions("adam:umember:blk:add")
@ApiOperation(value = "添加会员黑名单")
@PostMapping("blk/add")
public ResponseDto<List<String>> addBlack(@NotBlank @RequestParam String opts) {
......@@ -60,6 +63,7 @@ public class AdamUserMemberAdminController {
return ResponseDto.success(invalidList);
}
@RequiresPermissions("adam:umember:blk:del")
@ApiOperation(value = "删除会员黑名单")
@PostMapping("blk/del")
public ResponseDto<Object> delBlack(@NotBlank @RequestParam String opts) {
......
......@@ -11,6 +11,4 @@ import com.liquidnet.service.base.ResponseDto;
*/
public interface IAdamMemberAdminService extends IService<AdamMember> {
AdamMemberVo add(AdamMemberParam info);
ResponseDto<Object> sync();
}
......@@ -3,7 +3,9 @@ package com.liquidnet.client.admin.zhengzai.adam.service.impl;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.liquidnet.client.admin.zhengzai.adam.service.IAdamMemberAdminService;
import com.liquidnet.common.cache.redis.util.RedisUtil;
import com.liquidnet.commons.lang.util.IDGenerator;
import com.liquidnet.service.adam.constant.AdamRedisConst;
import com.liquidnet.service.adam.dto.AdamMemberParam;
import com.liquidnet.service.adam.dto.vo.AdamMemberVo;
import com.liquidnet.service.adam.entity.AdamMember;
......@@ -28,8 +30,8 @@ public class AdamMemberServiceAdminImpl extends ServiceImpl<AdamMemberMapper, Ad
AdamMemberMapper adamMemberMapper;
@Autowired
MongoTemplate mongoTemplate;
// @Autowired
// AdamRdmService adamRdmService;
@Autowired
RedisUtil redisUtil;
@Override
public AdamMemberVo add(AdamMemberParam param) {
......@@ -38,7 +40,7 @@ public class AdamMemberServiceAdminImpl extends ServiceImpl<AdamMemberMapper, Ad
List<AdamMember> existList = adamMemberMapper.selectList(Wrappers.lambdaQuery());
adamMember.setMemberId(CollectionUtils.isEmpty(existList) ? "1" : IDGenerator.nextSnowId().toString());
adamMember.setMemberId(CollectionUtils.isEmpty(existList) ? "1" : IDGenerator.nextSnowId());
adamMember.setType(1);
adamMember.setStartNo(10000);
adamMember.setCreatedAt(LocalDateTime.now());
......@@ -50,21 +52,8 @@ public class AdamMemberServiceAdminImpl extends ServiceImpl<AdamMemberMapper, Ad
mongoTemplate.insert(vo, AdamMemberVo.class.getSimpleName());
// adamRdmService.setMemberVoByMemberId(vo.getMemberId(), vo);
redisUtil.set(AdamRedisConst.INFO_MEMBER_CATEGORY.concat(vo.getMemberId()), vo);
return vo;
}
@Override
public ResponseDto<Object> sync() {
List<AdamMember> list = adamMemberMapper.selectList(Wrappers.lambdaQuery(AdamMember.class).orderByAsc(AdamMember::getMemberId));
if (CollectionUtils.isEmpty(list)) {
return ResponseDto.failure("会员数据不存在,请核实");
}
mongoTemplate.remove(Query.query(Criteria.where("_id").exists(true)), AdamMemberVo.class.getSimpleName());
AdamMemberVo vo = AdamMemberVo.getNew().copy(list.get(0));
mongoTemplate.insert(vo, AdamMemberVo.class.getSimpleName());
// adamRdmService.delMemberVoByMemberId(vo.getMemberId());
return ResponseDto.success();
}
}
package com.liquidnet.service.adam.service;
import com.liquidnet.common.cache.redis.util.RedisUtil;
import com.liquidnet.commons.lang.util.DateUtil;
import com.liquidnet.commons.lang.util.SensitizeUtil;
import com.liquidnet.service.adam.constant.AdamRedisConst;
import com.liquidnet.service.adam.dto.vo.*;
......@@ -18,7 +17,6 @@ import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
......@@ -37,6 +35,8 @@ public class AdamRdmService {
return null == i ? 1 : i;
}
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | <Mobile|OPENID, UID> */
public boolean setUidByMobile(String mobile, String uid) {
return redisUtil.set(AdamRedisConst.IDENTITY_MOBILE.concat(mobile), uid);
}
......@@ -91,6 +91,8 @@ public class AdamRdmService {
redisUtil.del(AdamRedisConst.IDENTITY_THIRD_PARTY + platform + ":" + openId);
}
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | <UID, USER_INFO> */
public boolean setUserInfoVoByUid(String uid, AdamUserInfoVo vo) {
return redisUtil.set(AdamRedisConst.INFO_USER.concat(uid), vo);
}
......@@ -115,6 +117,8 @@ public class AdamRdmService {
redisUtil.del(AdamRedisConst.INFO_USER.concat(uid));
}
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | <UID, REAL_INFO> */
public boolean setRealInfoVoByUid(String uid, AdamRealInfoVo vo) {
return redisUtil.set(AdamRedisConst.INFO_REAL_NAME.concat(uid), vo);
}
......@@ -139,6 +143,8 @@ public class AdamRdmService {
return vo;
}
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | <ID_TYPE+ID_NO, ID_NAME> */
public boolean setCertification(int idType, String idNo, String idName) {
return redisUtil.set(AdamRedisConst.INFO_CERTIFICATION + idType + idNo, idName);
}
......@@ -148,6 +154,8 @@ public class AdamRdmService {
return !StringUtils.isEmpty(o) && o.equals(idName);
}
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | <UID, List<AdamThirdPartInfoVo>> */
public boolean setThirdPartVoListByUid(String uid, List<AdamThirdPartInfoVo> voList) {
return redisUtil.set(AdamRedisConst.INFO_THIRD_PARTY.concat(uid), voList);
}
......@@ -185,6 +193,8 @@ public class AdamRdmService {
redisUtil.del(AdamRedisConst.INFO_THIRD_PARTY.concat(uid));
}
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | <UID, List<AdamEntersVo>> */
public boolean setEntersVoByUid(String uid, List<AdamEntersVo> list) {
return redisUtil.set(AdamRedisConst.INFO_ENTERS.concat(uid), list);
}
......@@ -220,6 +230,8 @@ public class AdamRdmService {
redisUtil.del(AdamRedisConst.INFO_ENTERS.concat(uid));
}
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | <UID, List<AdamAddressesVo>> */
public boolean setAddressesVoByUid(String uid, List<AdamAddressesVo> list) {
return redisUtil.set(AdamRedisConst.INFO_ADDRESSES.concat(uid), list);
}
......@@ -250,6 +262,8 @@ public class AdamRdmService {
redisUtil.del(AdamRedisConst.INFO_ADDRESSES.concat(uid));
}
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | List<购买会员黑名单UID> */
public boolean setBlacklistForMember(List<String> uids) {
return redisUtil.set(AdamRedisConst.BLK_LIST_MEMBER_UID, uids);
}
......@@ -258,6 +272,8 @@ public class AdamRdmService {
return (List<String>) redisUtil.get(AdamRedisConst.BLK_LIST_MEMBER_UID);
}
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | <UID, USER_MEMBER> */
public boolean setUserMemberVoByUid(String uid, AdamUserMemberVo vo) {
return redisUtil.set(AdamRedisConst.INFO_USER_MEMBER.concat(uid), vo);
}
......@@ -284,6 +300,8 @@ public class AdamRdmService {
redisUtil.del(AdamRedisConst.INFO_USER_MEMBER.concat(uid));
}
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | <MEMBER_SIMPLE_INFO> */
public AdamMemberSimpleVo getMemberSimpleVo() {
AdamMemberSimpleVo vo = (AdamMemberSimpleVo) redisUtil.get(AdamRedisConst.INFO_MEMBER_SIMPLE);
if (null == vo) {
......@@ -301,6 +319,8 @@ public class AdamRdmService {
return vo;
}
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | <MEMBER_ID, MEMBER_INFO> */
public boolean setMemberVoByMemberId(String memberId, AdamMemberVo vo) {
return redisUtil.set(AdamRedisConst.INFO_MEMBER_CATEGORY.concat(memberId), vo);
}
......@@ -326,6 +346,8 @@ public class AdamRdmService {
redisUtil.del(AdamRedisConst.INFO_MEMBER_CATEGORY.concat(memberId));
}
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | <MEMBER_ID, List<AdamMemberPriceVo>> */
public boolean setMemberPriceVoByMemberId(String memberId, List<AdamMemberPriceVo> vos) {
return redisUtil.set(AdamRedisConst.INFO_MEMBER_PRICE.concat(memberId), vos);
}
......@@ -365,6 +387,8 @@ public class AdamRdmService {
return null;
}
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | <MEMBER_ID, List<AdamMemberRightsVo>> */
public boolean setMemberRightsVoByMemberId(String memberId, List<AdamMemberRightsVo> vos) {
return redisUtil.set(AdamRedisConst.INFO_MEMBER_RIGHTS.concat(memberId), vos);
}
......@@ -387,6 +411,8 @@ public class AdamRdmService {
return vos;
}
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | MEMBER_AGREEMENT */
public String getMemberAgreement() {
String val = (String) redisUtil.get(AdamRedisConst.INFO_MEMBER_AGREEMENT);
if (StringUtils.isEmpty(val)) {
......@@ -397,6 +423,8 @@ public class AdamRdmService {
return val;
}
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | <ORDER_NO, MEMBER_ORDER_INFO> */
public boolean setShotMemberOrderVoByOrderNo(String orderNo, AdamMemberOrderVo vo) {
return redisUtil.set(AdamRedisConst.SHOT_MEMBER_ORDER + orderNo, vo);
}
......@@ -423,6 +451,8 @@ public class AdamRdmService {
redisUtil.del(AdamRedisConst.SHOT_MEMBER_ORDER + orderNo);
}
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | INCR_MEMBER_NO */
public boolean setMaxMemberNo(int val) {
return redisUtil.set(AdamRedisConst.INCR_MEMBER_NO, val);
}
......@@ -436,6 +466,8 @@ public class AdamRdmService {
return null == o ? -1 : (int) o;
}
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | <MEMBER_CODE, MEMBER_CODE_INFO> */
public boolean setMemberCodeVoByCode(String memberCode, AdamMemberCodeVo vo) {
return redisUtil.set(AdamRedisConst.INFO_MEMBER_CODE.concat(memberCode), vo);
}
......@@ -457,6 +489,12 @@ public class AdamRdmService {
return vo;
}
public void delMemberCodeVoByCode(String memberCode) {
redisUtil.del(AdamRedisConst.INFO_MEMBER_CODE.concat(memberCode));
}
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | */
/**
* Temporarily connect Mongo
*/
......@@ -471,9 +509,7 @@ public class AdamRdmService {
return vo;
}
public void delMemberCodeVoByCode(String memberCode) {
redisUtil.del(AdamRedisConst.INFO_MEMBER_CODE.concat(memberCode));
}
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | TAGS:List<AdamTagVo> */
public boolean setTagsForSex(List<AdamTagVo> voList) {
return redisUtil.set(AdamRedisConst.INFO_TAGS_SEX, voList);
......@@ -491,6 +527,24 @@ public class AdamRdmService {
return (List<AdamTagParentVo>) redisUtil.get(AdamRedisConst.INFO_TAGS_MUSIC);
}
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | */
/* ========================================================== | Other micro-service data inquiry */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment