Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
7ec8bc59ec
|
|
@ -50,8 +50,16 @@ public class AccountApplication implements CommandLineRunner {
|
|||
SaAdminCheckPermission annotation = AnnotationUtils.getAnnotation(method, SaAdminCheckPermission.class);
|
||||
if (annotation == null) return;
|
||||
for (String s : annotation.value()) {
|
||||
long count = sysMenuService.queryChain().eq(SysMenu::getPermission, s).count();
|
||||
if (count > 0) {
|
||||
SysMenu menu1 = sysMenuService.queryChain().eq(SysMenu::getPermission, s).one();
|
||||
if (menu1 !=null) {
|
||||
long count1 = sysRolesMenusService.queryChain().eq(SysRolesMenus::getMenuId, menu1.getMenuId()).eq(SysRolesMenus::getRoleId, 1L).count();
|
||||
if (count1 == 0) {
|
||||
SysRolesMenus sysRolesMenus = new SysRolesMenus();
|
||||
sysRolesMenus.setMenuId(menu1.getMenuId());
|
||||
sysRolesMenus.setRoleId(1L);
|
||||
sysRolesMenusService.save(sysRolesMenus);
|
||||
log.info("接口菜单添加成功, 菜单名称: {}, 菜单权限: {}", menu1.getName(), menu1.getPermission());
|
||||
}
|
||||
continue;
|
||||
}
|
||||
SysMenu sysMenu = new SysMenu();
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ public class MenuController {
|
|||
* @return 菜单结构
|
||||
*/
|
||||
@SaAdminCheckRole("管理员")
|
||||
@SaAdminCheckPermission("menu:list")
|
||||
// @SaAdminCheckPermission("menu:list")
|
||||
@GetMapping("/list")
|
||||
public CzgResult<List<MenuVO>> all(String title, String startTime, String endTime) {
|
||||
return CzgResult.success(menuService.getAll(title, startTime, endTime));
|
||||
|
|
@ -51,7 +51,7 @@ public class MenuController {
|
|||
* @return 菜单结构
|
||||
*/
|
||||
@SaAdminCheckRole("管理员")
|
||||
@SaAdminCheckPermission("menu:detail")
|
||||
// @SaAdminCheckPermission("menu:detail")
|
||||
@GetMapping("/detail")
|
||||
public CzgResult<SysMenu> detail(@RequestParam Integer id) {
|
||||
return CzgResult.success(menuService.getById(id));
|
||||
|
|
@ -62,7 +62,7 @@ public class MenuController {
|
|||
* @return 是否成功
|
||||
*/
|
||||
@SaAdminCheckRole("管理员")
|
||||
@SaAdminCheckPermission("menu:add")
|
||||
// @SaAdminCheckPermission("menu:add")
|
||||
@PostMapping
|
||||
public CzgResult<Boolean> add(@RequestBody @Validated MenuAddDTO menuAddDTO) {
|
||||
return CzgResult.success(menuService.add(menuAddDTO));
|
||||
|
|
@ -73,7 +73,7 @@ public class MenuController {
|
|||
* @return 是否成功
|
||||
*/
|
||||
@SaAdminCheckRole("管理员")
|
||||
@SaAdminCheckPermission("menu:edit")
|
||||
// @SaAdminCheckPermission("menu:edit")
|
||||
@PutMapping()
|
||||
public CzgResult<Boolean> edit(@RequestBody @Validated MenuEditDTO menuEditDTO) {
|
||||
return CzgResult.success(menuService.edit(menuEditDTO));
|
||||
|
|
@ -84,7 +84,7 @@ public class MenuController {
|
|||
* @return 是否成功
|
||||
*/
|
||||
@SaAdminCheckRole("管理员")
|
||||
@SaAdminCheckPermission("menu:del")
|
||||
// @SaAdminCheckPermission("menu:del")
|
||||
@DeleteMapping()
|
||||
public CzgResult<Boolean> edit(@RequestBody @Validated MenuDelDTO menuDelDTO) {
|
||||
return CzgResult.success(menuService.removeById(menuDelDTO.getId()));
|
||||
|
|
|
|||
|
|
@ -0,0 +1,54 @@
|
|||
package com.czg.controller.admin;
|
||||
|
||||
import com.czg.account.dto.ShopActivateDTO;
|
||||
import com.czg.account.service.ShopActivateService;
|
||||
import com.czg.annotation.SaAdminCheckPermission;
|
||||
import com.czg.resp.CzgResult;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 店铺充值活动管理
|
||||
* @author ww
|
||||
* @description
|
||||
*/
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/admin/activate")
|
||||
public class ShopActivateController {
|
||||
@Resource
|
||||
private ShopActivateService shopActivateService;
|
||||
|
||||
/**
|
||||
* 店铺充值活动列表
|
||||
* 权限标识: activate:list
|
||||
*/
|
||||
@SaAdminCheckPermission("activate:list")
|
||||
@GetMapping
|
||||
public CzgResult<List<ShopActivateDTO>> detail() {
|
||||
return CzgResult.success(shopActivateService.getList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 店铺充值活动新增
|
||||
* 权限标识: activate:add
|
||||
*/
|
||||
@SaAdminCheckPermission("activate:add")
|
||||
@PostMapping
|
||||
public CzgResult<Boolean> add(@RequestBody @Validated ShopActivateDTO activateDTO) {
|
||||
return CzgResult.success(shopActivateService.add(activateDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 店铺充值活动修改
|
||||
* 权限标识: activate:edit
|
||||
*/
|
||||
@SaAdminCheckPermission("activate:edit")
|
||||
@PutMapping
|
||||
public CzgResult<Boolean> edit(@RequestBody @Validated ShopActivateDTO activateDTO) {
|
||||
return CzgResult.success(shopActivateService.edit(activateDTO));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package com.czg.controller.admin;
|
||||
|
||||
import com.czg.account.service.ShopCouponService;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @author ww
|
||||
* @description
|
||||
*/
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/admin/coupon")
|
||||
public class ShopCouponController {
|
||||
@Resource
|
||||
private ShopCouponService couponService;
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -38,6 +38,6 @@ public class UserAuthorizationController {
|
|||
@PostMapping("/test")
|
||||
public CzgResult<String> login() {
|
||||
StpKit.USER.login(1L, null, false, false);
|
||||
return CzgResult.success(StpKit.USER.getTokenValue() +"哈哈哈");
|
||||
return CzgResult.success(StpKit.USER.getTokenValue());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.czg.controller.user;
|
|||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.czg.account.dto.user.userinfo.UserInfoDTO;
|
||||
import com.czg.account.dto.user.userinfo.UserInfoEditDTO;
|
||||
import com.czg.account.entity.UserInfo;
|
||||
import com.czg.account.service.UserInfoService;
|
||||
|
|
@ -26,8 +27,8 @@ public class UserController {
|
|||
* @return 用户信息
|
||||
*/
|
||||
@GetMapping
|
||||
public CzgResult<UserInfo> get() {
|
||||
return CzgResult.success(userInfoService.getById(StpKit.USER.getLoginIdAsLong()));
|
||||
public CzgResult<UserInfoDTO> get() {
|
||||
return CzgResult.success(userInfoService.getInfo(StpKit.USER.getLoginIdAsLong()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -0,0 +1,31 @@
|
|||
package com.czg.controller.user;
|
||||
|
||||
import com.czg.account.dto.ShopActivateDTO;
|
||||
import com.czg.account.service.ShopActivateService;
|
||||
import com.czg.resp.CzgResult;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 店铺充值活动管理
|
||||
* @author ww
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/user/activate")
|
||||
public class UserShopActivateController {
|
||||
@Resource
|
||||
private ShopActivateService shopActivateService;
|
||||
|
||||
/**
|
||||
* 店铺充值活动列表
|
||||
*/
|
||||
@GetMapping
|
||||
public CzgResult<List<ShopActivateDTO>> detail() {
|
||||
return CzgResult.success(shopActivateService.getList());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,9 +1,12 @@
|
|||
package com.czg.controller.user;
|
||||
|
||||
import com.czg.order.dto.OrderInfoQueryDTO;
|
||||
import com.czg.order.entity.OrderInfo;
|
||||
import com.czg.order.service.OrderInfoService;
|
||||
import com.czg.order.vo.OrderInfoVo;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.sa.StpKit;
|
||||
import com.czg.utils.AssertUtil;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
|
@ -11,6 +14,7 @@ import org.springframework.web.bind.annotation.*;
|
|||
|
||||
/**
|
||||
* 订单管理
|
||||
*
|
||||
* @author ww
|
||||
* @description
|
||||
*/
|
||||
|
|
@ -25,7 +29,27 @@ public class UserOrderController {
|
|||
* 订单列表
|
||||
*/
|
||||
@PostMapping
|
||||
public CzgResult<Page<OrderInfoVo>> get(@RequestBody OrderInfoQueryDTO queryDTO) {
|
||||
public CzgResult<Page<OrderInfoVo>> getOrderPage(@RequestBody OrderInfoQueryDTO queryDTO) {
|
||||
queryDTO.setIsDel(1);
|
||||
queryDTO.setUserId(StpKit.USER.getLoginIdAsLong());
|
||||
return CzgResult.success(orderInfoService.getOrderByPage(queryDTO));
|
||||
}
|
||||
|
||||
@PostMapping("/createOrder")
|
||||
public CzgResult<Void> createOrder(@RequestBody OrderInfoQueryDTO queryDTO) {
|
||||
queryDTO.setIsDel(1);
|
||||
queryDTO.setUserId(StpKit.USER.getLoginIdAsLong());
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
@PutMapping("/{id}")
|
||||
public CzgResult<Void> upOrderIsDel(@PathVariable("id") Long id) {
|
||||
//效验数据
|
||||
AssertUtil.isNull(id, "{}不能为空", "订单Id");
|
||||
orderInfoService.updateChain()
|
||||
.set(OrderInfo::getIsDel, 1)
|
||||
.eq(OrderInfoVo::getId, id)
|
||||
.update();
|
||||
return CzgResult.success();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ public class RabbitmqReceiver {
|
|||
|
||||
/**
|
||||
* 消费者监听,绑定队列
|
||||
* Queue RabbitConfig类的 orderPrintQueue
|
||||
*/
|
||||
@RabbitListener(
|
||||
bindings = @QueueBinding(value = @Queue(value = "#{orderPrintQueue.name}", durable = "true",
|
||||
|
|
@ -26,11 +27,9 @@ public class RabbitmqReceiver {
|
|||
concurrency = "10"
|
||||
)
|
||||
@RabbitHandler
|
||||
public void receiveOrderPrintQueue(Channel channel, String payload, Message message) throws IOException {
|
||||
public void receiveOrderPrintQueue(Channel channel, String orderId, Message message) throws IOException {
|
||||
try {
|
||||
System.out.println("Topic模式(orderPrintQueue)消费者收到消息: " + message);
|
||||
System.out.println(payload);
|
||||
|
||||
log.info("订单监听 消息体:{},消息内容:{}", message, orderId);
|
||||
// 手动确认消息,multiple 参数表示是否批量确认
|
||||
channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
|
||||
} catch (Exception e) {
|
||||
|
|
|
|||
|
|
@ -17,12 +17,20 @@ public class RabbitPublisher {
|
|||
@Resource
|
||||
private RabbitTemplate rabbitTemplate;
|
||||
|
||||
public void sendOrderStockMsg(String msg) {
|
||||
sendMsg(RabbitConstants.Exchange.CASH_EXCHANGE, RabbitConstants.Queue.ORDER_STOCK_QUEUE, msg);
|
||||
/**
|
||||
* 库存损耗消息
|
||||
* @param orderId 订单id
|
||||
*/
|
||||
public void sendOrderStockMsg(String orderId) {
|
||||
sendMsg(RabbitConstants.Exchange.CASH_EXCHANGE, RabbitConstants.Queue.ORDER_STOCK_QUEUE, orderId);
|
||||
}
|
||||
|
||||
public void sendOrderPrintMsg(String msg) {
|
||||
sendMsg(RabbitConstants.Exchange.CASH_EXCHANGE, RabbitConstants.Queue.ORDER_PRINT_QUEUE, msg);
|
||||
/**
|
||||
* 订单打印消息
|
||||
* @param orderId
|
||||
*/
|
||||
public void sendOrderPrintMsg(String orderId) {
|
||||
sendMsg(RabbitConstants.Exchange.CASH_EXCHANGE, RabbitConstants.Queue.ORDER_PRINT_QUEUE, orderId);
|
||||
}
|
||||
|
||||
private void sendMsg(String exchange, String queue, String msg) {
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ import java.lang.annotation.Target;
|
|||
* 校验后台是否登录
|
||||
* @author Administrator
|
||||
*/
|
||||
//@SaCheckLogin(type = "admin")
|
||||
@SaCheckLogin(type = "user")
|
||||
@SaCheckLogin(type = "admin")
|
||||
//@SaCheckLogin(type = "user")
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ ElementType.METHOD, ElementType.TYPE})
|
||||
public @interface SaAdminCheckLogin {
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@ import java.lang.annotation.Target;
|
|||
* @author click33
|
||||
*
|
||||
*/
|
||||
//@SaCheckPermission(type = "admin")
|
||||
@SaCheckPermission(type = "user")
|
||||
@SaCheckPermission(type = "admin")
|
||||
//@SaCheckPermission(type = "user")
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ ElementType.METHOD, ElementType.TYPE})
|
||||
public @interface SaAdminCheckPermission {
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@ import java.lang.annotation.Target;
|
|||
* @author click33
|
||||
*
|
||||
*/
|
||||
@SaCheckRole(type = "user")
|
||||
//@SaCheckRole(type = "admin")
|
||||
//@SaCheckRole(type = "user")
|
||||
@SaCheckRole(type = "admin")
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ ElementType.METHOD, ElementType.TYPE})
|
||||
public @interface SaAdminCheckRole {
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import java.lang.annotation.Target;
|
|||
* 校验用户端是否登录
|
||||
* @author Administrator
|
||||
*/
|
||||
@SaCheckLogin(type = "user")
|
||||
@SaCheckLogin(type = "client")
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ ElementType.METHOD, ElementType.TYPE})
|
||||
public @interface SaUserCheckLogin {
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import java.lang.annotation.Target;
|
|||
* @author click33
|
||||
*
|
||||
*/
|
||||
@SaCheckPermission(type = "user")
|
||||
@SaCheckPermission(type = "client")
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ ElementType.METHOD, ElementType.TYPE})
|
||||
public @interface SaUserCheckPermission {
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import java.lang.annotation.Target;
|
|||
* @author click33
|
||||
*
|
||||
*/
|
||||
@SaCheckRole(type = "user")
|
||||
@SaCheckRole(type = "client")
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ ElementType.METHOD, ElementType.TYPE})
|
||||
public @interface SaUserCheckRole {
|
||||
|
|
|
|||
|
|
@ -7,6 +7,10 @@ import cn.dev33.satoken.context.SaHolder;
|
|||
import cn.dev33.satoken.interceptor.SaInterceptor;
|
||||
import cn.dev33.satoken.router.SaRouter;
|
||||
import cn.dev33.satoken.strategy.SaAnnotationStrategy;
|
||||
import cn.dev33.satoken.strategy.SaStrategy;
|
||||
import cn.dev33.satoken.util.SaFoxUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.czg.sa.MyStpLogic;
|
||||
import com.czg.sa.StpKit;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
|
@ -25,11 +29,13 @@ public class SaTokenConfigure implements WebMvcConfigurer {
|
|||
@PostConstruct
|
||||
public void setSaTokenConfig() {
|
||||
// admin配置
|
||||
// SaTokenConfig adminConfig = new SaTokenConfig();
|
||||
// adminConfig.setTokenName("token");
|
||||
// config1.setTimeout(1000);
|
||||
// adminConfig.setTokenStyle("simple-uuid");
|
||||
// StpKit.ADMIN.setConfig(adminConfig);
|
||||
SaTokenConfig adminConfig = new SaTokenConfig();
|
||||
adminConfig.setTokenName("token");
|
||||
adminConfig.setTimeout(1000);
|
||||
adminConfig.setTokenStyle("simple-uuid");
|
||||
adminConfig.setIsConcurrent(true);
|
||||
adminConfig.setIsShare(false);
|
||||
MyStpLogic.ADMIN_LOGIC.setConfig(adminConfig);
|
||||
|
||||
// 小程序配置
|
||||
SaTokenConfig userConfig = new SaTokenConfig();
|
||||
|
|
@ -38,7 +44,7 @@ public class SaTokenConfigure implements WebMvcConfigurer {
|
|||
userConfig.setIsShare(false);
|
||||
// config2.setTimeout(2000);
|
||||
userConfig.setTokenStyle("simple-uuid");
|
||||
StpKit.USER.setConfig(userConfig);
|
||||
MyStpLogic.CLIENT_LOGIC.setConfig(userConfig);
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
|
|
@ -47,6 +53,7 @@ public class SaTokenConfigure implements WebMvcConfigurer {
|
|||
SaAnnotationStrategy.instance.getAnnotation = AnnotatedElementUtils::getMergedAnnotation;
|
||||
}
|
||||
|
||||
|
||||
// 注册 Sa-Token 的拦截器
|
||||
@Override
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
|
|
@ -57,13 +64,13 @@ public class SaTokenConfigure implements WebMvcConfigurer {
|
|||
ApplicationInfo.routePrefix = "";
|
||||
|
||||
SaRouter.match("/user/**").notMatch("/user/login", "/user/test", "/user/geo/**", "/user/home/**")
|
||||
.check(r -> StpKit.USER.checkMiniUser())
|
||||
.check(r -> MyStpLogic.CLIENT_LOGIC.checkLogin())
|
||||
.setHit(true)
|
||||
// .match("/**")
|
||||
.notMatch("/user/**")
|
||||
.notMatch("/admin/auth/**")
|
||||
.notMatch("/notify/**")
|
||||
.check(r -> StpKit.USER.checkManager());
|
||||
.check(r -> MyStpLogic.ADMIN_LOGIC.checkLogin());
|
||||
|
||||
})).addPathPatterns("/**");
|
||||
|
||||
|
|
|
|||
|
|
@ -1,44 +1,52 @@
|
|||
package com.czg.sa;
|
||||
|
||||
import cn.dev33.satoken.config.SaTokenConfig;
|
||||
import cn.dev33.satoken.context.SaHolder;
|
||||
import cn.dev33.satoken.dao.SaTokenDao;
|
||||
import cn.dev33.satoken.exception.NotPermissionException;
|
||||
import cn.dev33.satoken.fun.SaFunction;
|
||||
import cn.dev33.satoken.router.SaRouter;
|
||||
import cn.dev33.satoken.session.SaSession;
|
||||
import cn.dev33.satoken.session.TokenSign;
|
||||
import cn.dev33.satoken.stp.SaLoginModel;
|
||||
import cn.dev33.satoken.stp.SaTokenInfo;
|
||||
import cn.dev33.satoken.stp.StpLogic;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import com.czg.exception.ApiNotPrintException;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
*/
|
||||
@Getter
|
||||
public class MyStpLogic extends StpLogic {
|
||||
public class MyStpLogic {
|
||||
public static final StpLogic CLIENT_LOGIC = new StpLogic("client");
|
||||
public static final StpLogic ADMIN_LOGIC = new StpLogic("admin");
|
||||
|
||||
|
||||
/**
|
||||
* 初始化 StpLogic, 并指定账号类型
|
||||
*
|
||||
* @param loginType 账号类型标识
|
||||
*/
|
||||
public MyStpLogic(String loginType) {
|
||||
super(loginType);
|
||||
private StpLogic getLogic() {
|
||||
boolean hit = SaRouter.match("/admin/**").isHit();
|
||||
if (hit) {
|
||||
return ADMIN_LOGIC;
|
||||
}
|
||||
return CLIENT_LOGIC;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param id 登录账号id
|
||||
* @param shopId 店铺id
|
||||
* @param id 登录账号id
|
||||
* @param shopId 店铺id
|
||||
* @param isManager true 管理端 false 用户端
|
||||
* @param isAdmin 是否为管理员账号
|
||||
* @param isAdmin 是否为管理员账号
|
||||
*/
|
||||
public void login(Long id, Long shopId, boolean isManager, boolean isAdmin) {
|
||||
login(id);
|
||||
StpLogic logic = getLogic();
|
||||
logic.login(id);
|
||||
if (isManager && shopId == null) {
|
||||
throw new ApiNotPrintException("管理端登录必须传递店铺id");
|
||||
}
|
||||
SaSession session = getSession().set("userId", id).set("isAdmin", isAdmin).set("isManager", isManager);
|
||||
SaSession session = logic.getSession().set("userId", id).set("isAdmin", isAdmin).set("isManager", isManager);
|
||||
if (shopId != null) {
|
||||
session.set("shopId", shopId);
|
||||
}
|
||||
|
|
@ -46,19 +54,21 @@ public class MyStpLogic extends StpLogic {
|
|||
|
||||
/**
|
||||
* 获取店铺id
|
||||
*
|
||||
* @param defaultValue 默认值,传递多个只取第一个
|
||||
* @return 返回店铺id,不存在抛出异常,如果传递了默认值不存在返回默认值
|
||||
*/
|
||||
public Long getShopId(Long... defaultValue) {
|
||||
StpLogic logic = getLogic();
|
||||
Long defaultVal = defaultValue.length > 0 ? defaultValue[0] : null;
|
||||
Object object = StpKit.USER.getSession().get("isManager");
|
||||
Object object = logic.getSession().get("isManager");
|
||||
Long shopId;
|
||||
int errType;
|
||||
if (object instanceof Boolean t && t) {
|
||||
Object info = StpKit.USER.getSession().get("shopId");
|
||||
Object info = logic.getSession().get("shopId");
|
||||
shopId = info instanceof Long l ? l : null;
|
||||
errType = 0;
|
||||
}else {
|
||||
} else {
|
||||
String header = SaHolder.getRequest().getHeader("shopId");
|
||||
shopId = header == null ? null : Long.parseLong(header);
|
||||
errType = 1;
|
||||
|
|
@ -74,8 +84,9 @@ public class MyStpLogic extends StpLogic {
|
|||
* 校验是否为管理端登录
|
||||
*/
|
||||
public void checkManager() {
|
||||
StpKit.USER.checkLogin();
|
||||
Object object = StpKit.USER.getSession().get("isManager");
|
||||
StpLogic logic = getLogic();
|
||||
logic.checkLogin();
|
||||
Object object = logic.getSession().get("isManager");
|
||||
if (object instanceof Boolean t && !t) {
|
||||
throw new NotPermissionException("权限不足");
|
||||
}
|
||||
|
|
@ -85,8 +96,9 @@ public class MyStpLogic extends StpLogic {
|
|||
* 校验是否为小程序登录
|
||||
*/
|
||||
public void checkMiniUser() {
|
||||
StpKit.USER.checkLogin();
|
||||
Object object = StpKit.USER.getSession().get("isManager");
|
||||
StpLogic logic = getLogic();
|
||||
logic.checkLogin();
|
||||
Object object = logic.getSession().get("isManager");
|
||||
if (object instanceof Boolean t && t) {
|
||||
throw new NotPermissionException("权限不足");
|
||||
}
|
||||
|
|
@ -94,30 +106,851 @@ public class MyStpLogic extends StpLogic {
|
|||
|
||||
/**
|
||||
* 是否为管理员
|
||||
*
|
||||
* @return 布尔值
|
||||
*/
|
||||
public boolean isAdmin() {
|
||||
Object object = StpKit.USER.getSession().get("isAdmin");
|
||||
StpLogic logic = getLogic();
|
||||
Object object = logic.getSession().get("isAdmin");
|
||||
return object instanceof Boolean t && t;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加当前账号的角色
|
||||
*
|
||||
* @param roleList 角色列表
|
||||
* @return 当前实例
|
||||
*/
|
||||
public MyStpLogic addRoleList(List<String> roleList) {
|
||||
getSession().set("sa:roleList:" + getLoginType() + ":" + getLoginId(), roleList);
|
||||
StpLogic logic = getLogic();
|
||||
logic.getSession().set("sa:roleList:" + logic.getLoginType() + ":" + logic.getLoginId(), roleList);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加当前账号的权限
|
||||
*
|
||||
* @param permissionList 角色列表
|
||||
* @return 当前实例
|
||||
*/
|
||||
public MyStpLogic addPermissionList(List<String> permissionList) {
|
||||
getSession().set("sa:permissionList:" + getLoginType() + ":" + getLoginId(), permissionList);
|
||||
StpLogic logic = getLogic();
|
||||
logic.getSession().set("sa:permissionList:" + logic.getLoginType() + ":" + logic.getLoginId(), permissionList);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public String getLoginType() {
|
||||
return getLogic().getLoginType();
|
||||
}
|
||||
|
||||
|
||||
public StpLogic setLoginType(String loginType) {
|
||||
return getLogic().setLoginType(loginType);
|
||||
}
|
||||
|
||||
|
||||
public StpLogic setConfig(SaTokenConfig config) {
|
||||
return getLogic().setConfig(config);
|
||||
}
|
||||
|
||||
|
||||
public SaTokenConfig getConfig() {
|
||||
return getLogic().getConfig();
|
||||
}
|
||||
|
||||
|
||||
public SaTokenConfig getConfigOrGlobal() {
|
||||
return getLogic().getConfigOrGlobal();
|
||||
}
|
||||
|
||||
|
||||
public String getTokenName() {
|
||||
return getLogic().getTokenName();
|
||||
}
|
||||
|
||||
|
||||
public String createTokenValue(Object loginId, String device, long timeout, Map<String, Object> extraData) {
|
||||
return getLogic().createTokenValue(loginId, device, timeout, extraData);
|
||||
}
|
||||
|
||||
|
||||
public void setTokenValue(String tokenValue) {
|
||||
getLogic().setTokenValue(tokenValue);
|
||||
}
|
||||
|
||||
|
||||
public void setTokenValue(String tokenValue, int cookieTimeout) {
|
||||
getLogic().setTokenValue(tokenValue, cookieTimeout);
|
||||
}
|
||||
|
||||
|
||||
public void setTokenValue(String tokenValue, SaLoginModel loginModel) {
|
||||
getLogic().setTokenValue(tokenValue, loginModel);
|
||||
}
|
||||
|
||||
|
||||
public void setTokenValueToStorage(String tokenValue) {
|
||||
getLogic().setTokenValueToStorage(tokenValue);
|
||||
}
|
||||
|
||||
|
||||
public void setTokenValueToCookie(String tokenValue, int cookieTimeout) {
|
||||
getLogic().setTokenValueToCookie(tokenValue, cookieTimeout);
|
||||
}
|
||||
|
||||
|
||||
public void setTokenValueToResponseHeader(String tokenValue) {
|
||||
getLogic().setTokenValueToResponseHeader(tokenValue);
|
||||
}
|
||||
|
||||
|
||||
public String getTokenValue() {
|
||||
return getLogic().getTokenValue();
|
||||
}
|
||||
|
||||
|
||||
public String getTokenValue(boolean noPrefixThrowException) {
|
||||
return getLogic().getTokenValue(noPrefixThrowException);
|
||||
}
|
||||
|
||||
|
||||
public String getTokenValueNotCut() {
|
||||
return getLogic().getTokenValueNotCut();
|
||||
}
|
||||
|
||||
|
||||
public String getTokenValueNotNull() {
|
||||
return getLogic().getTokenValueNotNull();
|
||||
}
|
||||
|
||||
|
||||
public SaTokenInfo getTokenInfo() {
|
||||
return getLogic().getTokenInfo();
|
||||
}
|
||||
|
||||
|
||||
public void login(Object id) {
|
||||
getLogic().login(id);
|
||||
}
|
||||
|
||||
|
||||
public void login(Object id, String device) {
|
||||
getLogic().login(id, device);
|
||||
}
|
||||
|
||||
|
||||
public void login(Object id, boolean isLastingCookie) {
|
||||
getLogic().login(id, isLastingCookie);
|
||||
}
|
||||
|
||||
|
||||
public void login(Object id, long timeout) {
|
||||
getLogic().login(id, timeout);
|
||||
}
|
||||
|
||||
|
||||
public void login(Object id, SaLoginModel loginModel) {
|
||||
getLogic().login(id, loginModel);
|
||||
}
|
||||
|
||||
|
||||
public String createLoginSession(Object id) {
|
||||
return getLogic().createLoginSession(id);
|
||||
}
|
||||
|
||||
|
||||
public String createLoginSession(Object id, SaLoginModel loginModel) {
|
||||
return getLogic().createLoginSession(id, loginModel);
|
||||
}
|
||||
|
||||
|
||||
public String getOrCreateLoginSession(Object id) {
|
||||
return getLogic().getOrCreateLoginSession(id);
|
||||
}
|
||||
|
||||
|
||||
public void logout() {
|
||||
getLogic().logout();
|
||||
}
|
||||
|
||||
|
||||
public void logout(Object loginId) {
|
||||
getLogic().logout(loginId);
|
||||
}
|
||||
|
||||
|
||||
public void logout(Object loginId, String device) {
|
||||
getLogic().logout(loginId, device);
|
||||
}
|
||||
|
||||
|
||||
public void logoutByMaxLoginCount(Object loginId, SaSession session, String device, int maxLoginCount) {
|
||||
getLogic().logoutByMaxLoginCount(loginId, session, device, maxLoginCount);
|
||||
}
|
||||
|
||||
|
||||
public void logoutByTokenValue(String tokenValue) {
|
||||
getLogic().logoutByTokenValue(tokenValue);
|
||||
}
|
||||
|
||||
|
||||
public void kickout(Object loginId) {
|
||||
getLogic().kickout(loginId);
|
||||
}
|
||||
|
||||
|
||||
public void kickout(Object loginId, String device) {
|
||||
getLogic().kickout(loginId, device);
|
||||
}
|
||||
|
||||
|
||||
public void kickoutByTokenValue(String tokenValue) {
|
||||
getLogic().kickoutByTokenValue(tokenValue);
|
||||
}
|
||||
|
||||
|
||||
public void replaced(Object loginId, String device) {
|
||||
getLogic().replaced(loginId, device);
|
||||
}
|
||||
|
||||
|
||||
public boolean isLogin() {
|
||||
return getLogic().isLogin();
|
||||
}
|
||||
|
||||
|
||||
public boolean isLogin(Object loginId) {
|
||||
return getLogic().isLogin(loginId);
|
||||
}
|
||||
|
||||
|
||||
public void checkLogin() {
|
||||
getLogic().checkLogin();
|
||||
}
|
||||
|
||||
|
||||
public Object getLoginId() {
|
||||
return getLogic().getLoginId();
|
||||
}
|
||||
|
||||
|
||||
public <T> T getLoginId(T defaultValue) {
|
||||
return getLogic().getLoginId(defaultValue);
|
||||
}
|
||||
|
||||
|
||||
public Object getLoginIdDefaultNull() {
|
||||
return getLogic().getLoginIdDefaultNull();
|
||||
}
|
||||
|
||||
|
||||
public String getLoginIdAsString() {
|
||||
return getLogic().getLoginIdAsString();
|
||||
}
|
||||
|
||||
|
||||
public int getLoginIdAsInt() {
|
||||
return getLogic().getLoginIdAsInt();
|
||||
}
|
||||
|
||||
|
||||
public long getLoginIdAsLong() {
|
||||
return getLogic().getLoginIdAsLong();
|
||||
}
|
||||
|
||||
|
||||
public Object getLoginIdByToken(String tokenValue) {
|
||||
return getLogic().getLoginIdByToken(tokenValue);
|
||||
}
|
||||
|
||||
|
||||
public String getLoginIdNotHandle(String tokenValue) {
|
||||
return getLogic().getLoginIdNotHandle(tokenValue);
|
||||
}
|
||||
|
||||
|
||||
public Object getExtra(String key) {
|
||||
return getLogic().getExtra(key);
|
||||
}
|
||||
|
||||
|
||||
public Object getExtra(String tokenValue, String key) {
|
||||
return getLogic().getExtra(tokenValue, key);
|
||||
}
|
||||
|
||||
|
||||
public boolean isValidLoginId(Object loginId) {
|
||||
return getLogic().isValidLoginId(loginId);
|
||||
}
|
||||
|
||||
|
||||
public void saveTokenToIdMapping(String tokenValue, Object loginId, long timeout) {
|
||||
getLogic().saveTokenToIdMapping(tokenValue, loginId, timeout);
|
||||
}
|
||||
|
||||
|
||||
public void updateTokenToIdMapping(String tokenValue, Object loginId) {
|
||||
getLogic().updateTokenToIdMapping(tokenValue, loginId);
|
||||
}
|
||||
|
||||
|
||||
public void deleteTokenToIdMapping(String tokenValue) {
|
||||
getLogic().deleteTokenToIdMapping(tokenValue);
|
||||
}
|
||||
|
||||
|
||||
public SaSession getSessionBySessionId(String sessionId, boolean isCreate, Long timeout, Consumer<SaSession> appendOperation) {
|
||||
return getLogic().getSessionBySessionId(sessionId, isCreate, timeout, appendOperation);
|
||||
}
|
||||
|
||||
|
||||
public SaSession getSessionBySessionId(String sessionId) {
|
||||
return getLogic().getSessionBySessionId(sessionId);
|
||||
}
|
||||
|
||||
|
||||
public SaSession getSessionByLoginId(Object loginId, boolean isCreate, Long timeout) {
|
||||
return getLogic().getSessionByLoginId(loginId, isCreate, timeout);
|
||||
}
|
||||
|
||||
|
||||
public SaSession getSessionByLoginId(Object loginId, boolean isCreate) {
|
||||
return getLogic().getSessionByLoginId(loginId, isCreate);
|
||||
}
|
||||
|
||||
|
||||
public SaSession getSessionByLoginId(Object loginId) {
|
||||
return getLogic().getSessionByLoginId(loginId);
|
||||
}
|
||||
|
||||
|
||||
public SaSession getSession(boolean isCreate) {
|
||||
return getLogic().getSession(isCreate);
|
||||
}
|
||||
|
||||
|
||||
public SaSession getSession() {
|
||||
return getLogic().getSession();
|
||||
}
|
||||
|
||||
|
||||
public SaSession getTokenSessionByToken(String tokenValue, boolean isCreate) {
|
||||
return getLogic().getTokenSessionByToken(tokenValue, isCreate);
|
||||
}
|
||||
|
||||
|
||||
public SaSession getTokenSessionByToken(String tokenValue) {
|
||||
return getLogic().getTokenSessionByToken(tokenValue);
|
||||
}
|
||||
|
||||
|
||||
public SaSession getTokenSession(boolean isCreate) {
|
||||
return getLogic().getTokenSession(isCreate);
|
||||
}
|
||||
|
||||
|
||||
public SaSession getTokenSession() {
|
||||
return getLogic().getTokenSession();
|
||||
}
|
||||
|
||||
|
||||
public SaSession getAnonTokenSession(boolean isCreate) {
|
||||
return getLogic().getAnonTokenSession(isCreate);
|
||||
}
|
||||
|
||||
|
||||
public SaSession getAnonTokenSession() {
|
||||
return getLogic().getAnonTokenSession();
|
||||
}
|
||||
|
||||
|
||||
public void deleteTokenSession(String tokenValue) {
|
||||
getLogic().deleteTokenSession(tokenValue);
|
||||
}
|
||||
|
||||
|
||||
public void updateLastActiveToNow(String tokenValue) {
|
||||
getLogic().updateLastActiveToNow(tokenValue);
|
||||
}
|
||||
|
||||
|
||||
public void updateLastActiveToNow() {
|
||||
getLogic().updateLastActiveToNow();
|
||||
}
|
||||
|
||||
|
||||
public void checkActiveTimeout(String tokenValue) {
|
||||
getLogic().checkActiveTimeout(tokenValue);
|
||||
}
|
||||
|
||||
|
||||
public void checkActiveTimeout() {
|
||||
getLogic().checkActiveTimeout();
|
||||
}
|
||||
|
||||
|
||||
public Long getTokenUseActiveTimeout(String tokenValue) {
|
||||
return getLogic().getTokenUseActiveTimeout(tokenValue);
|
||||
}
|
||||
|
||||
|
||||
public long getTokenUseActiveTimeoutOrGlobalConfig(String tokenValue) {
|
||||
return getLogic().getTokenUseActiveTimeoutOrGlobalConfig(tokenValue);
|
||||
}
|
||||
|
||||
|
||||
public long getTokenLastActiveTime(String tokenValue) {
|
||||
return getLogic().getTokenLastActiveTime(tokenValue);
|
||||
}
|
||||
|
||||
|
||||
public long getTokenLastActiveTime() {
|
||||
return getLogic().getTokenLastActiveTime();
|
||||
}
|
||||
|
||||
|
||||
public long getTokenTimeout() {
|
||||
return getLogic().getTokenTimeout();
|
||||
}
|
||||
|
||||
|
||||
public long getTokenTimeout(String token) {
|
||||
return getLogic().getTokenTimeout(token);
|
||||
}
|
||||
|
||||
|
||||
public long getTokenTimeoutByLoginId(Object loginId) {
|
||||
return getLogic().getTokenTimeoutByLoginId(loginId);
|
||||
}
|
||||
|
||||
|
||||
public long getSessionTimeout() {
|
||||
return getLogic().getSessionTimeout();
|
||||
}
|
||||
|
||||
|
||||
public long getSessionTimeoutByLoginId(Object loginId) {
|
||||
return getLogic().getSessionTimeoutByLoginId(loginId);
|
||||
}
|
||||
|
||||
|
||||
public long getTokenSessionTimeout() {
|
||||
return getLogic().getTokenSessionTimeout();
|
||||
}
|
||||
|
||||
|
||||
public long getTokenSessionTimeoutByTokenValue(String tokenValue) {
|
||||
return getLogic().getTokenSessionTimeoutByTokenValue(tokenValue);
|
||||
}
|
||||
|
||||
|
||||
public long getTokenActiveTimeout() {
|
||||
return getLogic().getTokenActiveTimeout();
|
||||
}
|
||||
|
||||
|
||||
public long getTokenActiveTimeoutByToken(String tokenValue) {
|
||||
return getLogic().getTokenActiveTimeoutByToken(tokenValue);
|
||||
}
|
||||
|
||||
|
||||
public void renewTimeout(long timeout) {
|
||||
getLogic().renewTimeout(timeout);
|
||||
}
|
||||
|
||||
|
||||
public void renewTimeout(String tokenValue, long timeout) {
|
||||
getLogic().renewTimeout(tokenValue, timeout);
|
||||
}
|
||||
|
||||
|
||||
public List<String> getRoleList() {
|
||||
return getLogic().getRoleList();
|
||||
}
|
||||
|
||||
|
||||
public List<String> getRoleList(Object loginId) {
|
||||
return getLogic().getRoleList(loginId);
|
||||
}
|
||||
|
||||
|
||||
public boolean hasRole(String role) {
|
||||
return getLogic().hasRole(role);
|
||||
}
|
||||
|
||||
|
||||
public boolean hasRole(Object loginId, String role) {
|
||||
return getLogic().hasRole(loginId, role);
|
||||
}
|
||||
|
||||
|
||||
public boolean hasRoleAnd(String... roleArray) {
|
||||
return getLogic().hasRoleAnd(roleArray);
|
||||
}
|
||||
|
||||
|
||||
public boolean hasRoleOr(String... roleArray) {
|
||||
return getLogic().hasRoleOr(roleArray);
|
||||
}
|
||||
|
||||
|
||||
public void checkRole(String role) {
|
||||
getLogic().checkRole(role);
|
||||
}
|
||||
|
||||
|
||||
public void checkRoleAnd(String... roleArray) {
|
||||
getLogic().checkRoleAnd(roleArray);
|
||||
}
|
||||
|
||||
|
||||
public void checkRoleOr(String... roleArray) {
|
||||
getLogic().checkRoleOr(roleArray);
|
||||
}
|
||||
|
||||
|
||||
public List<String> getPermissionList() {
|
||||
return getLogic().getPermissionList();
|
||||
}
|
||||
|
||||
|
||||
public List<String> getPermissionList(Object loginId) {
|
||||
return getLogic().getPermissionList(loginId);
|
||||
}
|
||||
|
||||
|
||||
public boolean hasPermission(String permission) {
|
||||
return getLogic().hasPermission(permission);
|
||||
}
|
||||
|
||||
|
||||
public boolean hasPermission(Object loginId, String permission) {
|
||||
return getLogic().hasPermission(loginId, permission);
|
||||
}
|
||||
|
||||
|
||||
public boolean hasPermissionAnd(String... permissionArray) {
|
||||
return getLogic().hasPermissionAnd(permissionArray);
|
||||
}
|
||||
|
||||
|
||||
public boolean hasPermissionOr(String... permissionArray) {
|
||||
return getLogic().hasPermissionOr(permissionArray);
|
||||
}
|
||||
|
||||
|
||||
public void checkPermission(String permission) {
|
||||
getLogic().checkPermission(permission);
|
||||
}
|
||||
|
||||
|
||||
public void checkPermissionAnd(String... permissionArray) {
|
||||
getLogic().checkPermissionAnd(permissionArray);
|
||||
}
|
||||
|
||||
|
||||
public void checkPermissionOr(String... permissionArray) {
|
||||
getLogic().checkPermissionOr(permissionArray);
|
||||
}
|
||||
|
||||
|
||||
public String getTokenValueByLoginId(Object loginId) {
|
||||
return getLogic().getTokenValueByLoginId(loginId);
|
||||
}
|
||||
|
||||
|
||||
public String getTokenValueByLoginId(Object loginId, String device) {
|
||||
return getLogic().getTokenValueByLoginId(loginId, device);
|
||||
}
|
||||
|
||||
|
||||
public List<String> getTokenValueListByLoginId(Object loginId) {
|
||||
return getLogic().getTokenValueListByLoginId(loginId);
|
||||
}
|
||||
|
||||
|
||||
public List<String> getTokenValueListByLoginId(Object loginId, String device) {
|
||||
return getLogic().getTokenValueListByLoginId(loginId, device);
|
||||
}
|
||||
|
||||
|
||||
public List<TokenSign> getTokenSignListByLoginId(Object loginId, String device) {
|
||||
return getLogic().getTokenSignListByLoginId(loginId, device);
|
||||
}
|
||||
|
||||
|
||||
public String getLoginDevice() {
|
||||
return getLogic().getLoginDevice();
|
||||
}
|
||||
|
||||
|
||||
public String getLoginDeviceByToken(String tokenValue) {
|
||||
return getLogic().getLoginDeviceByToken(tokenValue);
|
||||
}
|
||||
|
||||
|
||||
public List<String> searchTokenValue(String keyword, int start, int size, boolean sortType) {
|
||||
return getLogic().searchTokenValue(keyword, start, size, sortType);
|
||||
}
|
||||
|
||||
|
||||
public List<String> searchSessionId(String keyword, int start, int size, boolean sortType) {
|
||||
return getLogic().searchSessionId(keyword, start, size, sortType);
|
||||
}
|
||||
|
||||
|
||||
public List<String> searchTokenSessionId(String keyword, int start, int size, boolean sortType) {
|
||||
return getLogic().searchTokenSessionId(keyword, start, size, sortType);
|
||||
}
|
||||
|
||||
|
||||
public void disable(Object loginId, long time) {
|
||||
getLogic().disable(loginId, time);
|
||||
}
|
||||
|
||||
|
||||
public boolean isDisable(Object loginId) {
|
||||
return getLogic().isDisable(loginId);
|
||||
}
|
||||
|
||||
|
||||
public void checkDisable(Object loginId) {
|
||||
getLogic().checkDisable(loginId);
|
||||
}
|
||||
|
||||
|
||||
public long getDisableTime(Object loginId) {
|
||||
return getLogic().getDisableTime(loginId);
|
||||
}
|
||||
|
||||
|
||||
public void untieDisable(Object loginId) {
|
||||
getLogic().untieDisable(loginId);
|
||||
}
|
||||
|
||||
|
||||
public void disable(Object loginId, String service, long time) {
|
||||
getLogic().disable(loginId, service, time);
|
||||
}
|
||||
|
||||
|
||||
public boolean isDisable(Object loginId, String service) {
|
||||
return getLogic().isDisable(loginId, service);
|
||||
}
|
||||
|
||||
|
||||
public void checkDisable(Object loginId, String... services) {
|
||||
getLogic().checkDisable(loginId, services);
|
||||
}
|
||||
|
||||
|
||||
public long getDisableTime(Object loginId, String service) {
|
||||
return getLogic().getDisableTime(loginId, service);
|
||||
}
|
||||
|
||||
|
||||
public void untieDisable(Object loginId, String... services) {
|
||||
getLogic().untieDisable(loginId, services);
|
||||
}
|
||||
|
||||
|
||||
public void disableLevel(Object loginId, int level, long time) {
|
||||
getLogic().disableLevel(loginId, level, time);
|
||||
}
|
||||
|
||||
|
||||
public void disableLevel(Object loginId, String service, int level, long time) {
|
||||
getLogic().disableLevel(loginId, service, level, time);
|
||||
}
|
||||
|
||||
|
||||
public boolean isDisableLevel(Object loginId, int level) {
|
||||
return getLogic().isDisableLevel(loginId, level);
|
||||
}
|
||||
|
||||
|
||||
public boolean isDisableLevel(Object loginId, String service, int level) {
|
||||
return getLogic().isDisableLevel(loginId, service, level);
|
||||
}
|
||||
|
||||
|
||||
public void checkDisableLevel(Object loginId, int level) {
|
||||
getLogic().checkDisableLevel(loginId, level);
|
||||
}
|
||||
|
||||
|
||||
public void checkDisableLevel(Object loginId, String service, int level) {
|
||||
getLogic().checkDisableLevel(loginId, service, level);
|
||||
}
|
||||
|
||||
|
||||
public int getDisableLevel(Object loginId) {
|
||||
return getLogic().getDisableLevel(loginId);
|
||||
}
|
||||
|
||||
|
||||
public int getDisableLevel(Object loginId, String service) {
|
||||
return getLogic().getDisableLevel(loginId, service);
|
||||
}
|
||||
|
||||
|
||||
public void switchTo(Object loginId) {
|
||||
getLogic().switchTo(loginId);
|
||||
}
|
||||
|
||||
|
||||
public void endSwitch() {
|
||||
getLogic().endSwitch();
|
||||
}
|
||||
|
||||
|
||||
public boolean isSwitch() {
|
||||
return getLogic().isSwitch();
|
||||
}
|
||||
|
||||
|
||||
public Object getSwitchLoginId() {
|
||||
return getLogic().getSwitchLoginId();
|
||||
}
|
||||
|
||||
|
||||
public void switchTo(Object loginId, SaFunction function) {
|
||||
getLogic().switchTo(loginId, function);
|
||||
}
|
||||
|
||||
|
||||
public void openSafe(long safeTime) {
|
||||
getLogic().openSafe(safeTime);
|
||||
}
|
||||
|
||||
|
||||
public void openSafe(String service, long safeTime) {
|
||||
getLogic().openSafe(service, safeTime);
|
||||
}
|
||||
|
||||
|
||||
public boolean isSafe() {
|
||||
return getLogic().isSafe();
|
||||
}
|
||||
|
||||
|
||||
public boolean isSafe(String service) {
|
||||
return getLogic().isSafe(service);
|
||||
}
|
||||
|
||||
|
||||
public boolean isSafe(String tokenValue, String service) {
|
||||
return getLogic().isSafe(tokenValue, service);
|
||||
}
|
||||
|
||||
|
||||
public void checkSafe() {
|
||||
getLogic().checkSafe();
|
||||
}
|
||||
|
||||
|
||||
public void checkSafe(String service) {
|
||||
getLogic().checkSafe(service);
|
||||
}
|
||||
|
||||
|
||||
public long getSafeTime() {
|
||||
return getLogic().getSafeTime();
|
||||
}
|
||||
|
||||
|
||||
public long getSafeTime(String service) {
|
||||
return getLogic().getSafeTime(service);
|
||||
}
|
||||
|
||||
|
||||
public void closeSafe() {
|
||||
getLogic().closeSafe();
|
||||
}
|
||||
|
||||
|
||||
public void closeSafe(String service) {
|
||||
getLogic().closeSafe(service);
|
||||
}
|
||||
|
||||
|
||||
public String splicingKeyTokenName() {
|
||||
return getLogic().splicingKeyTokenName();
|
||||
}
|
||||
|
||||
|
||||
public String splicingKeyTokenValue(String tokenValue) {
|
||||
return getLogic().splicingKeyTokenValue(tokenValue);
|
||||
}
|
||||
|
||||
|
||||
public String splicingKeySession(Object loginId) {
|
||||
return getLogic().splicingKeySession(loginId);
|
||||
}
|
||||
|
||||
|
||||
public String splicingKeyTokenSession(String tokenValue) {
|
||||
return getLogic().splicingKeyTokenSession(tokenValue);
|
||||
}
|
||||
|
||||
|
||||
public String splicingKeyLastActiveTime(String tokenValue) {
|
||||
return getLogic().splicingKeyLastActiveTime(tokenValue);
|
||||
}
|
||||
|
||||
|
||||
public String splicingKeySwitch() {
|
||||
return getLogic().splicingKeySwitch();
|
||||
}
|
||||
|
||||
|
||||
public String splicingKeyJustCreatedSave() {
|
||||
return getLogic().splicingKeyJustCreatedSave();
|
||||
}
|
||||
|
||||
|
||||
public String splicingKeyDisable(Object loginId, String service) {
|
||||
return getLogic().splicingKeyDisable(loginId, service);
|
||||
}
|
||||
|
||||
|
||||
public String splicingKeySafe(String tokenValue, String service) {
|
||||
return getLogic().splicingKeySafe(tokenValue, service);
|
||||
}
|
||||
|
||||
|
||||
public SaTokenDao getSaTokenDao() {
|
||||
return getLogic().getSaTokenDao();
|
||||
}
|
||||
|
||||
|
||||
public boolean getConfigOfIsShare() {
|
||||
return getLogic().getConfigOfIsShare();
|
||||
}
|
||||
|
||||
|
||||
public boolean isOpenCheckActiveTimeout() {
|
||||
return getLogic().isOpenCheckActiveTimeout();
|
||||
}
|
||||
|
||||
|
||||
public int getConfigOfCookieTimeout() {
|
||||
return getLogic().getConfigOfCookieTimeout();
|
||||
}
|
||||
|
||||
|
||||
public int getConfigOfMaxTryTimes() {
|
||||
return getLogic().getConfigOfMaxTryTimes();
|
||||
}
|
||||
|
||||
|
||||
public boolean hasElement(List<String> list, String element) {
|
||||
return getLogic().hasElement(list, element);
|
||||
}
|
||||
|
||||
|
||||
public boolean isSupportExtra() {
|
||||
return getLogic().isSupportExtra();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ public class StpKit {
|
|||
/**
|
||||
* User 会话对象,管理 User 表所有账号的登录、权限认证
|
||||
*/
|
||||
public static final MyStpLogic USER = new MyStpLogic("user");
|
||||
public static final MyStpLogic USER = new MyStpLogic();
|
||||
|
||||
|
||||
// public StpKit() {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,75 @@
|
|||
|
||||
package com.czg.account.dto;
|
||||
|
||||
import com.alibaba.fastjson2.annotation.JSONField;
|
||||
import com.czg.validator.group.InsertGroup;
|
||||
import com.czg.validator.group.UpdateGroup;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 活动 实体类。
|
||||
*
|
||||
* @author ww
|
||||
* @since 2025-02-17
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ShopActivateDTO implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@NotNull(message = "主键不能为空", groups = {UpdateGroup.class})
|
||||
private Long id;
|
||||
|
||||
|
||||
private Long shopId;
|
||||
|
||||
/**
|
||||
* 充值金额
|
||||
*/
|
||||
@NotNull(message = "充值金额不能为空", groups = {InsertGroup.class, UpdateGroup.class})
|
||||
private Integer amount;
|
||||
|
||||
/**
|
||||
* 赠送金额
|
||||
*/
|
||||
private Integer giftAmount;
|
||||
|
||||
/**
|
||||
* 赠送积分
|
||||
*/
|
||||
private Integer giftPoints;
|
||||
|
||||
/**
|
||||
* 是否赠送优惠卷 0否 1是
|
||||
*/
|
||||
private Integer isGiftCoupon = 0;
|
||||
|
||||
/**
|
||||
* 优惠卷id
|
||||
*/
|
||||
private Long couponId;
|
||||
|
||||
/**
|
||||
* 优惠卷数量
|
||||
*/
|
||||
private Integer num;
|
||||
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,142 @@
|
|||
|
||||
package com.czg.account.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.Time;
|
||||
import java.time.LocalDateTime;
|
||||
import com.alibaba.fastjson2.annotation.JSONField;
|
||||
import java.io.Serial;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 优惠券 实体类。
|
||||
*
|
||||
* @author ww
|
||||
* @since 2025-02-17
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ShopCouponDTO implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 自增
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 状态0-关闭 1 正常
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 名称(无意义)
|
||||
*/
|
||||
private String title;
|
||||
|
||||
private String shopId;
|
||||
|
||||
/**
|
||||
* 已使用数量
|
||||
*/
|
||||
private Integer useNumber;
|
||||
|
||||
/**
|
||||
* 发放数量
|
||||
*/
|
||||
private Integer number;
|
||||
|
||||
/**
|
||||
* 剩余数量
|
||||
*/
|
||||
private Integer leftNumber;
|
||||
|
||||
/**
|
||||
* 有效期类型,可选值为 fixed(固定时间)/custom(自定义时间)
|
||||
*/
|
||||
private String validityType;
|
||||
|
||||
/**
|
||||
* 有效天数
|
||||
*/
|
||||
private Integer validDays;
|
||||
|
||||
/**
|
||||
* 隔多少天生效
|
||||
*/
|
||||
private Integer daysToTakeEffect;
|
||||
|
||||
/**
|
||||
* 有效开始时间
|
||||
*/
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime validStartTime;
|
||||
|
||||
/**
|
||||
* 有效结束时间
|
||||
*/
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime validEndTime;
|
||||
|
||||
/**
|
||||
* 周 数组["周一","周二"]
|
||||
*/
|
||||
private String userDays;
|
||||
|
||||
/**
|
||||
* all-全时段 custom-指定时段
|
||||
*/
|
||||
private String useTimeType;
|
||||
|
||||
/**
|
||||
* 可用开始时间
|
||||
*/
|
||||
@JSONField(format = "HH:mm:ss")
|
||||
private Time useStartTime;
|
||||
|
||||
/**
|
||||
* 可用结束时间
|
||||
*/
|
||||
@JSONField(format = "HH:mm:ss")
|
||||
private Time useEndTime;
|
||||
|
||||
/**
|
||||
* 1-满减 2-商品
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 满多少金额
|
||||
*/
|
||||
private BigDecimal fullAmount;
|
||||
|
||||
/**
|
||||
* 减多少金额
|
||||
*/
|
||||
private BigDecimal discountAmount;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 发放人
|
||||
*/
|
||||
private String editor;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
package com.czg.account.dto.user.userinfo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
*/
|
||||
@Data
|
||||
public class UserInfoAssetsSummaryDTO {
|
||||
/**
|
||||
* 总余额
|
||||
*/
|
||||
private BigDecimal amount;
|
||||
/**
|
||||
* 总积分
|
||||
*/
|
||||
private Integer points;
|
||||
/**
|
||||
* 可使用优惠券数量
|
||||
*/
|
||||
private Integer couponNum;
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package com.czg.account.dto.user.userinfo;
|
||||
|
||||
import com.czg.account.entity.UserInfo;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class UserInfoDTO extends UserInfo {
|
||||
/**
|
||||
* 用户资产概述
|
||||
*/
|
||||
private UserInfoAssetsSummaryDTO assetsSummary;
|
||||
}
|
||||
|
|
@ -0,0 +1,74 @@
|
|||
package com.czg.account.entity;
|
||||
|
||||
import com.mybatisflex.annotation.Column;
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.KeyType;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 活动 实体类。
|
||||
*
|
||||
* @author ww
|
||||
* @since 2025-02-17
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Table("tb_shop_activate")
|
||||
public class ShopActivate implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id(keyType = KeyType.Auto)
|
||||
private Long id;
|
||||
|
||||
private Long shopId;
|
||||
|
||||
/**
|
||||
* 充值金额
|
||||
*/
|
||||
private Integer amount;
|
||||
|
||||
/**
|
||||
* 赠送金额
|
||||
*/
|
||||
private Integer giftAmount;
|
||||
|
||||
/**
|
||||
* 赠送积分
|
||||
*/
|
||||
private Integer giftPoints;
|
||||
|
||||
/**
|
||||
* 是否赠送优惠卷 0否 1是
|
||||
*/
|
||||
private Integer isGiftCoupon;
|
||||
|
||||
/**
|
||||
* 优惠卷id
|
||||
*/
|
||||
private Long couponId;
|
||||
|
||||
/**
|
||||
* 优惠卷数量
|
||||
*/
|
||||
private Integer num;
|
||||
|
||||
@Column(onInsertValue = "now()")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Column(onInsertValue = "now()", onUpdateValue = "now()")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,117 @@
|
|||
package com.czg.account.entity;
|
||||
|
||||
import com.mybatisflex.annotation.Column;
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.KeyType;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 活动商品赠送记录表 实体类。
|
||||
*
|
||||
* @author ww
|
||||
* @since 2025-02-17
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Table("tb_shop_activate_in_record")
|
||||
public class ShopActivateInRecord implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id(keyType = KeyType.Auto)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 会员id
|
||||
*/
|
||||
private Long vipUserId;
|
||||
|
||||
/**
|
||||
* 卷Id (校验是否可用)
|
||||
*/
|
||||
private Long couponId;
|
||||
|
||||
/**
|
||||
* 卷描述 满10减2/商品卷
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 1-满减 2-商品
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 商品id
|
||||
*/
|
||||
private Long proId;
|
||||
|
||||
/**
|
||||
* 满多少金额
|
||||
*/
|
||||
private BigDecimal fullAmount;
|
||||
|
||||
/**
|
||||
* 减多少金额
|
||||
*/
|
||||
private BigDecimal discountAmount;
|
||||
|
||||
/**
|
||||
* 赠送数量
|
||||
*/
|
||||
private Integer num;
|
||||
|
||||
/**
|
||||
* 未使用数量
|
||||
*/
|
||||
private Integer overNum;
|
||||
|
||||
/**
|
||||
* 店铺id
|
||||
*/
|
||||
private Long shopId;
|
||||
|
||||
/**
|
||||
* 来源活动id
|
||||
*/
|
||||
private Long sourceActId;
|
||||
|
||||
private Long sourceFlowId;
|
||||
|
||||
/**
|
||||
* 可用开始时间
|
||||
*/
|
||||
private LocalDateTime useStartTime;
|
||||
|
||||
/**
|
||||
* 可用结束时间
|
||||
*/
|
||||
private LocalDateTime useEndTime;
|
||||
|
||||
@Column(onInsertValue = "now()")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Column(onInsertValue = "now()", onUpdateValue = "now()")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
private String couponJson;
|
||||
|
||||
/**
|
||||
* invited/activate
|
||||
*/
|
||||
private String source;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
package com.czg.account.entity;
|
||||
|
||||
import com.mybatisflex.annotation.Column;
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.KeyType;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 活动赠送商品使用记录表 实体类。
|
||||
*
|
||||
* @author ww
|
||||
* @since 2025-02-17
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Table("tb_shop_activate_out_record")
|
||||
public class ShopActivateOutRecord implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id(keyType = KeyType.Auto)
|
||||
private Long id;
|
||||
|
||||
private Long shopId;
|
||||
|
||||
/**
|
||||
* 订单id
|
||||
*/
|
||||
private Long orderId;
|
||||
|
||||
/**
|
||||
* 商品赠送Id tb_activate_in_record的id
|
||||
*/
|
||||
private Long giveId;
|
||||
|
||||
/**
|
||||
* 会员id
|
||||
*/
|
||||
private Long vipUserId;
|
||||
|
||||
/**
|
||||
* 1-满减 2-商品
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 使用数量
|
||||
*/
|
||||
private Integer useNum;
|
||||
|
||||
/**
|
||||
* 退单量
|
||||
*/
|
||||
private Integer refNum;
|
||||
|
||||
/**
|
||||
* 新建: create, 完成: closed, 取消:cancel,
|
||||
*/
|
||||
private String status;
|
||||
|
||||
@Column(onInsertValue = "now()")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Column(onInsertValue = "now()", onUpdateValue = "now()")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,145 @@
|
|||
package com.czg.account.entity;
|
||||
|
||||
import com.alibaba.fastjson2.annotation.JSONField;
|
||||
import com.mybatisflex.annotation.Column;
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.KeyType;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.Time;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 优惠券 实体类。
|
||||
*
|
||||
* @author ww
|
||||
* @since 2025-02-17
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Table("tb_shop_coupon")
|
||||
public class ShopCoupon implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 自增
|
||||
*/
|
||||
@Id(keyType = KeyType.Auto)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 状态0-关闭 1 正常
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
@Column(onInsertValue = "now()")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Column(onInsertValue = "now()", onUpdateValue = "now()")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
* 名称(无意义)
|
||||
*/
|
||||
private String title;
|
||||
|
||||
private String shopId;
|
||||
|
||||
/**
|
||||
* 已使用数量
|
||||
*/
|
||||
private Integer useNumber;
|
||||
|
||||
/**
|
||||
* 发放数量
|
||||
*/
|
||||
private Integer number;
|
||||
|
||||
/**
|
||||
* 剩余数量
|
||||
*/
|
||||
private Integer leftNumber;
|
||||
|
||||
/**
|
||||
* 有效期类型,可选值为 fixed(固定时间)/custom(自定义时间)
|
||||
*/
|
||||
private String validityType;
|
||||
|
||||
/**
|
||||
* 有效天数
|
||||
*/
|
||||
private Integer validDays;
|
||||
|
||||
/**
|
||||
* 隔多少天生效
|
||||
*/
|
||||
private Integer daysToTakeEffect;
|
||||
|
||||
/**
|
||||
* 有效开始时间
|
||||
*/
|
||||
private LocalDateTime validStartTime;
|
||||
|
||||
/**
|
||||
* 有效结束时间
|
||||
*/
|
||||
private LocalDateTime validEndTime;
|
||||
|
||||
/**
|
||||
* 周 数组["周一","周二"]
|
||||
*/
|
||||
private String userDays;
|
||||
|
||||
/**
|
||||
* all-全时段 custom-指定时段
|
||||
*/
|
||||
private String useTimeType;
|
||||
|
||||
/**
|
||||
* 可用开始时间
|
||||
*/
|
||||
private Time useStartTime;
|
||||
|
||||
/**
|
||||
* 可用结束时间
|
||||
*/
|
||||
private Time useEndTime;
|
||||
|
||||
/**
|
||||
* 1-满减 2-商品
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 满多少金额
|
||||
*/
|
||||
private BigDecimal fullAmount;
|
||||
|
||||
/**
|
||||
* 减多少金额
|
||||
*/
|
||||
private BigDecimal discountAmount;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 发放人
|
||||
*/
|
||||
private String editor;
|
||||
|
||||
}
|
||||
|
|
@ -106,11 +106,6 @@ public class ShopUser implements Serializable {
|
|||
*/
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 会员码
|
||||
*/
|
||||
private String dynamicCode;
|
||||
|
||||
/**
|
||||
* 最近一次积分变动时间
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -0,0 +1,14 @@
|
|||
package com.czg.account.service;
|
||||
|
||||
import com.mybatisflex.core.service.IService;
|
||||
import com.czg.account.entity.ShopActivateInRecord;
|
||||
|
||||
/**
|
||||
* 活动商品赠送记录表 服务层。
|
||||
*
|
||||
* @author ww
|
||||
* @since 2025-02-17
|
||||
*/
|
||||
public interface ShopActivateInRecordService extends IService<ShopActivateInRecord> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package com.czg.account.service;
|
||||
|
||||
import com.mybatisflex.core.service.IService;
|
||||
import com.czg.account.entity.ShopActivateOutRecord;
|
||||
|
||||
/**
|
||||
* 活动赠送商品使用记录表 服务层。
|
||||
*
|
||||
* @author ww
|
||||
* @since 2025-02-17
|
||||
*/
|
||||
public interface ShopActivateOutRecordService extends IService<ShopActivateOutRecord> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
package com.czg.account.service;
|
||||
|
||||
import com.czg.account.dto.ShopActivateDTO;
|
||||
import com.czg.account.entity.ShopActivate;
|
||||
import com.mybatisflex.core.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 活动 服务层。
|
||||
*
|
||||
* @author ww
|
||||
* @since 2025-02-17
|
||||
*/
|
||||
public interface ShopActivateService extends IService<ShopActivate> {
|
||||
|
||||
List<ShopActivateDTO> getList();
|
||||
|
||||
Boolean add(ShopActivateDTO activateDTO);
|
||||
|
||||
Boolean edit(ShopActivateDTO activateDTO);
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
package com.czg.account.service;
|
||||
|
||||
import com.czg.account.dto.ShopCouponDTO;
|
||||
import com.czg.account.entity.ShopActivateOutRecord;
|
||||
import com.czg.account.entity.ShopCoupon;
|
||||
import com.mybatisflex.core.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 优惠券 服务层。
|
||||
*
|
||||
* @author ww
|
||||
* @since 2025-02-17
|
||||
*/
|
||||
public interface ShopCouponService extends IService<ShopCoupon> {
|
||||
|
||||
/**
|
||||
* 优惠券列表
|
||||
*
|
||||
* @param shopId 店铺id
|
||||
* @param status 状态 0 未使用 1已使用 -1已过期
|
||||
* @return
|
||||
*/
|
||||
List<ShopCoupon> getList(Long shopId, Integer status);
|
||||
ShopCouponDTO getCouponById(ShopCouponDTO couponDTO);
|
||||
|
||||
Boolean add(ShopCouponDTO couponDTO);
|
||||
|
||||
Boolean edit(ShopCouponDTO couponDTO);
|
||||
|
||||
Boolean delete(Long id);
|
||||
Boolean find(Long id);
|
||||
Boolean use(Integer shopId, Integer orderId, Integer vipUserId, List<ShopActivateOutRecord> param);
|
||||
|
||||
Boolean refund(List<ShopActivateOutRecord> param);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
package com.czg.account.service;
|
||||
|
||||
import com.czg.account.dto.user.userinfo.UserInfoDTO;
|
||||
import com.czg.account.entity.UserInfo;
|
||||
import com.mybatisflex.core.service.IService;
|
||||
|
||||
|
|
@ -11,4 +12,5 @@ import com.mybatisflex.core.service.IService;
|
|||
*/
|
||||
public interface UserInfoService extends IService<UserInfo> {
|
||||
|
||||
UserInfoDTO getInfo(long userInfoId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,43 @@
|
|||
package com.czg.account.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class UserCouponVo {
|
||||
private Long id;
|
||||
private BigDecimal fullAmount;
|
||||
private BigDecimal discountAmount;
|
||||
private Long couponId;
|
||||
private Long proId;
|
||||
// 商品名称
|
||||
private String productName;
|
||||
private String productCover;
|
||||
//优惠券名称
|
||||
private String name;
|
||||
|
||||
//优惠券类型 1 满减 2 商品券
|
||||
private Integer type;
|
||||
//数量
|
||||
private Integer num;
|
||||
//到期时间
|
||||
private Date endTime;
|
||||
private Long expireTime;
|
||||
private String useRestrictions;
|
||||
private boolean isUse = false;
|
||||
//当前使用数量
|
||||
private BigDecimal currentUseNum;
|
||||
private Integer finalUseNum;
|
||||
private BigDecimal finalDiscountAmount = new BigDecimal(0);
|
||||
|
||||
|
||||
public void setEndTime(Date endTime) {
|
||||
this.endTime = endTime;
|
||||
if(endTime!=null){
|
||||
expireTime=endTime.getTime();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package com.czg.service.account.mapper;
|
||||
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
import com.czg.account.entity.ShopActivateInRecord;
|
||||
|
||||
/**
|
||||
* 活动商品赠送记录表 映射层。
|
||||
*
|
||||
* @author ww
|
||||
* @since 2025-02-17
|
||||
*/
|
||||
public interface ShopActivateInRecordMapper extends BaseMapper<ShopActivateInRecord> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package com.czg.service.account.mapper;
|
||||
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
import com.czg.account.entity.ShopActivate;
|
||||
|
||||
/**
|
||||
* 活动 映射层。
|
||||
*
|
||||
* @author ww
|
||||
* @since 2025-02-17
|
||||
*/
|
||||
public interface ShopActivateMapper extends BaseMapper<ShopActivate> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package com.czg.service.account.mapper;
|
||||
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
import com.czg.account.entity.ShopActivateOutRecord;
|
||||
|
||||
/**
|
||||
* 活动赠送商品使用记录表 映射层。
|
||||
*
|
||||
* @author ww
|
||||
* @since 2025-02-17
|
||||
*/
|
||||
public interface ShopActivateOutRecordMapper extends BaseMapper<ShopActivateOutRecord> {
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package com.czg.service.account.mapper;
|
||||
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
import com.czg.account.entity.ShopCoupon;
|
||||
|
||||
/**
|
||||
* 优惠券 映射层。
|
||||
*
|
||||
* @author ww
|
||||
* @since 2025-02-17
|
||||
*/
|
||||
public interface ShopCouponMapper extends BaseMapper<ShopCoupon> {
|
||||
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@ package com.czg.service.account.mapper;
|
|||
|
||||
import com.czg.account.dto.shopuser.ShopUserSummaryDTO;
|
||||
import com.czg.account.dto.shopuser.ShopUserVipCardDTO;
|
||||
import com.czg.account.dto.user.userinfo.UserInfoAssetsSummaryDTO;
|
||||
import com.czg.account.entity.ShopUser;
|
||||
import com.mybatisflex.core.BaseMapper;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
|
|
@ -27,4 +28,7 @@ public interface ShopUserMapper extends BaseMapper<ShopUser> {
|
|||
ShopUserSummaryDTO selectUserSummary(@Param("shopId") Long shopId, @Param("isVip") Integer isVip);
|
||||
|
||||
Page<ShopUserVipCardDTO> selectVipCard(@Param("page") Page<Object> objectPage, @Param("userInfoId") long userInfoId);
|
||||
|
||||
UserInfoAssetsSummaryDTO selectAssetsSummary(@Param("userId") Long userInfoId);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,20 @@
|
|||
package com.czg.service.account.service.impl;
|
||||
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import com.czg.account.entity.ShopActivateInRecord;
|
||||
import com.czg.account.service.ShopActivateInRecordService;
|
||||
import com.czg.service.account.mapper.ShopActivateInRecordMapper;
|
||||
import org.apache.dubbo.config.annotation.DubboService;
|
||||
|
||||
|
||||
/**
|
||||
* 活动商品赠送记录表 服务层实现。
|
||||
*
|
||||
* @author ww
|
||||
* @since 2025-02-17
|
||||
*/
|
||||
@DubboService
|
||||
public class ShopActivateInRecordServiceImpl extends ServiceImpl<ShopActivateInRecordMapper, ShopActivateInRecord> implements ShopActivateInRecordService{
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
package com.czg.service.account.service.impl;
|
||||
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import com.czg.account.entity.ShopActivateOutRecord;
|
||||
import com.czg.account.service.ShopActivateOutRecordService;
|
||||
import com.czg.service.account.mapper.ShopActivateOutRecordMapper;
|
||||
import org.apache.dubbo.config.annotation.DubboService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 活动赠送商品使用记录表 服务层实现。
|
||||
*
|
||||
* @author ww
|
||||
* @since 2025-02-17
|
||||
*/
|
||||
@DubboService
|
||||
public class ShopActivateOutRecordServiceImpl extends ServiceImpl<ShopActivateOutRecordMapper, ShopActivateOutRecord> implements ShopActivateOutRecordService{
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
package com.czg.service.account.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.czg.account.dto.ShopActivateDTO;
|
||||
import com.czg.account.entity.ShopActivate;
|
||||
import com.czg.account.service.ShopActivateService;
|
||||
import com.czg.sa.StpKit;
|
||||
import com.czg.service.account.mapper.ShopActivateMapper;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import org.apache.dubbo.config.annotation.DubboService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 活动 服务层实现。
|
||||
*
|
||||
* @author ww
|
||||
* @since 2025-02-17
|
||||
*/
|
||||
@DubboService
|
||||
public class ShopActivateServiceImpl extends ServiceImpl<ShopActivateMapper, ShopActivate> implements ShopActivateService {
|
||||
|
||||
@Override
|
||||
public List<ShopActivateDTO> getList() {
|
||||
return queryChain().select().eq(ShopActivate::getShopId, StpKit.USER.getShopId())
|
||||
.orderBy(ShopActivate::getAmount, true).listAs(ShopActivateDTO.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean add(ShopActivateDTO activateDTO) {
|
||||
ShopActivate shopActivate = new ShopActivate();
|
||||
BeanUtil.copyProperties(activateDTO, shopActivate);
|
||||
return save(shopActivate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean edit(ShopActivateDTO activateDTO) {
|
||||
ShopActivate shopActivate = new ShopActivate();
|
||||
BeanUtil.copyProperties(activateDTO, shopActivate);
|
||||
return updateById(shopActivate);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,109 @@
|
|||
package com.czg.service.account.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.czg.account.dto.ShopCouponDTO;
|
||||
import com.czg.account.entity.ShopActivateInRecord;
|
||||
import com.czg.account.entity.ShopActivateOutRecord;
|
||||
import com.czg.account.service.ShopActivateInRecordService;
|
||||
import com.czg.account.service.ShopActivateOutRecordService;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import com.czg.account.entity.ShopCoupon;
|
||||
import com.czg.account.service.ShopCouponService;
|
||||
import com.czg.service.account.mapper.ShopCouponMapper;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 优惠券 服务层实现。
|
||||
*
|
||||
* @author ww
|
||||
* @since 2025-02-17
|
||||
*/
|
||||
@Service
|
||||
public class ShopCouponServiceImpl extends ServiceImpl<ShopCouponMapper, ShopCoupon> implements ShopCouponService {
|
||||
|
||||
@Resource
|
||||
private ShopActivateInRecordService inService;
|
||||
@Resource
|
||||
private ShopActivateOutRecordService outService;
|
||||
|
||||
@Override
|
||||
public List<ShopCoupon> getList(Long shopId, Integer status) {
|
||||
QueryWrapper queryWrapper = new QueryWrapper();
|
||||
if (shopId != null) {
|
||||
if (status == 1) {
|
||||
queryWrapper.eq(ShopActivateOutRecord::getShopId, shopId);
|
||||
}else {
|
||||
queryWrapper.eq(ShopActivateInRecord::getShopId, shopId);
|
||||
}
|
||||
}
|
||||
return switch (status) {
|
||||
case -1 -> {
|
||||
queryWrapper.ge(ShopActivateInRecord::getUseEndTime, DateUtil.date());
|
||||
yield list(queryWrapper);
|
||||
}
|
||||
case 0 -> {
|
||||
// yield outService.list(queryWrapper);
|
||||
yield null;
|
||||
|
||||
}
|
||||
case 1 -> {
|
||||
yield null;
|
||||
|
||||
}
|
||||
default -> throw new IllegalStateException("Unexpected value: " + status);
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public ShopCouponDTO getCouponById(ShopCouponDTO couponDTO) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean add(ShopCouponDTO couponDTO) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean edit(ShopCouponDTO couponDTO) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean delete(Long id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean find(Long id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean use(Integer shopId, Integer orderId, Integer vipUserId, List<ShopActivateOutRecord> param) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 退还券
|
||||
*
|
||||
* @param param giveId和 refNum 必传
|
||||
*/
|
||||
@Override
|
||||
public Boolean refund(List<ShopActivateOutRecord> param) {
|
||||
// for (ShopActivateOutRecord outRecord : param) {
|
||||
// outService.updateChain()
|
||||
// .set(ShopActivateOutRecord::getRefNum, outRecord.getRefNum())
|
||||
// .eq(ShopActivateOutRecord::getId, outRecord.getId())
|
||||
// .update();
|
||||
// ShopActivateInRecord inRecord = inService.getById(outRecord.getGiveId());
|
||||
// inRecord.setOverNum(inRecord.getOverNum() + outRecord.getRefNum());
|
||||
// inService.updateOverNum(inRecord.getId(), inRecord.getOverNum());
|
||||
// }
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -17,6 +17,7 @@ import com.czg.exception.ApiNotPrintException;
|
|||
import com.czg.sa.StpKit;
|
||||
import com.czg.service.RedisService;
|
||||
import com.czg.service.account.mapper.ShopUserMapper;
|
||||
import com.czg.utils.AssertUtil;
|
||||
import com.czg.utils.PageUtil;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
|
|
@ -131,13 +132,9 @@ public class ShopUserServiceImpl extends ServiceImpl<ShopUserMapper, ShopUser> i
|
|||
@Override
|
||||
public String getCode(long userInfoId, long shopId) {
|
||||
ShopUser shopUser = queryChain().eq(ShopUser::getShopId, shopId).eq(ShopUser::getUserId, userInfoId).one();
|
||||
if (shopUser == null) {
|
||||
throw new ApiNotPrintException("会员信息不存在");
|
||||
}
|
||||
AssertUtil.isNull(shopUser, "会员信息不存在");
|
||||
String dynamicCode = generatePaymentCode(String.valueOf(shopId), String.valueOf(userInfoId));
|
||||
redisService.set(RedisCst.SHOP_USER_DYNAMIC_CODE + shopUser.getId(), dynamicCode, 300);
|
||||
shopUser.setDynamicCode(dynamicCode);
|
||||
updateById(shopUser);
|
||||
redisService.set(RedisCst.SHOP_USER_DYNAMIC_CODE + shopUser.getId() + ":" + dynamicCode, 1, 180);
|
||||
return dynamicCode;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -66,6 +66,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
|||
|
||||
@Override
|
||||
public Boolean add(MenuAddDTO menuAddDTO) {
|
||||
checkExIsis(menuAddDTO.getTitle(), null);
|
||||
if (menuAddDTO.getType() == 2 && menuAddDTO.getPid() == null) {
|
||||
throw new ApiNotPrintException("二级菜单必须传递父id");
|
||||
}
|
||||
|
|
@ -82,6 +83,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
|||
|
||||
@Override
|
||||
public Boolean edit(MenuEditDTO menuEditDTO) {
|
||||
checkExIsis(menuEditDTO.getTitle(), menuEditDTO.getId());
|
||||
SysMenu menu = getById(menuEditDTO.getId());
|
||||
if (menu == null) {
|
||||
throw new ApiNotPrintException("菜单不存在");
|
||||
|
|
@ -90,6 +92,19 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
|
|||
return updateById(menu);
|
||||
}
|
||||
|
||||
|
||||
private void checkExIsis(String title, Integer id) {
|
||||
QueryWrapper queryWrapper = new QueryWrapper();
|
||||
if (id != null) {
|
||||
queryWrapper.ne(SysMenu::getMenuId, id);
|
||||
}
|
||||
queryWrapper.eq(SysMenu::getTitle, title);
|
||||
long count = count(queryWrapper);
|
||||
if (count > 0) {
|
||||
throw new ApiNotPrintException("名称已存在");
|
||||
}
|
||||
}
|
||||
|
||||
private List<MenuVO> buildMenuTree(List<SysMenu> allMenus) {
|
||||
List<MenuVO> menuVos = allMenus.stream()
|
||||
.map(menu -> BeanUtil.copyProperties(menu, MenuVO.class))
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> imp
|
|||
throw new ApiNotPrintException("角色不存在");
|
||||
}
|
||||
|
||||
long roleCount = queryChain().eq(SysRole::getName, roleEditDTO.getName()).count();
|
||||
long roleCount = queryChain().eq(SysRole::getName, roleEditDTO.getName()).ne(SysRole::getId, roleEditDTO.getId()).count();
|
||||
if (roleCount > 0) {
|
||||
throw new ApiNotPrintException("此角色名称已存在");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,16 @@
|
|||
package com.czg.service.account.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.czg.account.dto.user.userinfo.UserInfoAssetsSummaryDTO;
|
||||
import com.czg.account.dto.user.userinfo.UserInfoDTO;
|
||||
import com.czg.account.entity.UserInfo;
|
||||
import com.czg.account.service.ShopUserService;
|
||||
import com.czg.exception.ApiNotPrintException;
|
||||
import com.czg.service.account.mapper.ShopUserMapper;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import com.czg.service.account.mapper.UserInfoMapper;
|
||||
import com.czg.account.service.UserInfoService;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
|
|
@ -14,5 +21,19 @@ import org.springframework.stereotype.Service;
|
|||
*/
|
||||
@Service
|
||||
public class UserInfoServiceImpl extends ServiceImpl<UserInfoMapper, UserInfo> implements UserInfoService{
|
||||
@Resource
|
||||
private ShopUserMapper shopUserMapper;
|
||||
|
||||
@Override
|
||||
public UserInfoDTO getInfo(long userInfoId) {
|
||||
UserInfo userInfo = queryChain().eq(UserInfo::getId, userInfoId).one();
|
||||
if (userInfo == null) {
|
||||
throw new ApiNotPrintException("用户信息不存在");
|
||||
}
|
||||
|
||||
UserInfoAssetsSummaryDTO assetsSummaryDTO = shopUserMapper.selectAssetsSummary(userInfoId);
|
||||
UserInfoDTO userInfoDTO = BeanUtil.copyProperties(userInfo, UserInfoDTO.class);
|
||||
userInfoDTO.setAssetsSummary(assetsSummaryDTO);
|
||||
return userInfoDTO;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.czg.service.account.mapper.ShopActivateInRecordMapper">
|
||||
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.czg.service.account.mapper.ShopActivateMapper">
|
||||
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.czg.service.account.mapper.ShopActivateOutRecordMapper">
|
||||
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.czg.service.account.mapper.ShopCouponMapper">
|
||||
|
||||
</mapper>
|
||||
|
|
@ -31,15 +31,26 @@
|
|||
</if>
|
||||
</select>
|
||||
<select id="selectUserSummary" resultType="com.czg.account.dto.shopuser.ShopUserSummaryDTO">
|
||||
select count(a.id) userTotal, sum(IFNULL(a.amount, 0)) balanceTotal,sum(IFNULL(b.amount,0)) chargeTotal from tb_shop_user as a
|
||||
left join tb_shop_user_flow as b on a.id=b.user_id and b.type='+' and b.biz_code in ('cashIn', 'wechatIn', 'alipayIn')
|
||||
select count(a.id) userTotal, sum(IFNULL(a.amount, 0)) balanceTotal,sum(IFNULL(b.amount,0)) chargeTotal from
|
||||
tb_shop_user as a
|
||||
left join tb_shop_user_flow as b on a.id=b.user_id and b.type='+' and b.biz_code in ('cashIn', 'wechatIn',
|
||||
'alipayIn')
|
||||
where a.shop_id = #{shopId}
|
||||
<if test="isVip !=null">
|
||||
and a.is_vip=#{isVip}
|
||||
</if>
|
||||
</select>
|
||||
<select id="selectVipCard" resultType="com.czg.account.dto.shopuser.ShopUserVipCardDTO">
|
||||
select b.logo, b.shop_name shopName, a.amount, a.shop_id shopId from tb_shop_user as a left join tb_shop_info as b on a.shop_id=b.id
|
||||
where a.user_id=#{userInfoId}
|
||||
select b.logo, b.shop_name shopName, a.amount, a.shop_id shopId
|
||||
from tb_shop_user as a
|
||||
left join tb_shop_info as b on a.shop_id = b.id
|
||||
where a.user_id = #{userInfoId}
|
||||
</select>
|
||||
<select id="selectAssetsSummary" resultType="com.czg.account.dto.user.userinfo.UserInfoAssetsSummaryDTO">
|
||||
select sum(IFNULL(b.amount, 0)) amount, sum(IFNULL(b.account_points, 0)) points, sum(IFNULL(c.over_num, 0)) couponNum
|
||||
from tb_user_info as a
|
||||
left join tb_shop_user as b on a.id = b.user_id
|
||||
left join tb_shop_activate_in_record as c on c.shop_id = b.shop_id
|
||||
where a.id=#{userId}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,44 @@
|
|||
package com.czg.service.order.dto;
|
||||
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 创建订单
|
||||
* @author ww
|
||||
*/
|
||||
@Data
|
||||
public class CreateOrderDTO {
|
||||
@NotBlank(message = "桌号不能为空")
|
||||
private String tableCode;
|
||||
@NotBlank(message = "用餐模式 堂食 dine-in 外带 take-out 外卖 take-away")
|
||||
private String dineMode;
|
||||
/**
|
||||
* 平台类型
|
||||
* 微信小程序 WX
|
||||
* 支付宝小程序 ALI
|
||||
* 收银机客户端 PC
|
||||
* PC管理端 APC
|
||||
* APP管理端 APP
|
||||
*/
|
||||
@NotBlank(message = "平台类型不能为空")
|
||||
private String platformType;
|
||||
|
||||
/**
|
||||
* 是否使用了霸王餐
|
||||
*/
|
||||
private boolean isFreeDine = false;
|
||||
|
||||
private String remark;
|
||||
|
||||
// 使用的积分抵扣数量
|
||||
private Integer pointsNum;
|
||||
|
||||
// 使用的优惠券
|
||||
@Valid
|
||||
private List<UserCouponInfoDTO> userCouponInfos = new ArrayList<>();
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
package com.czg.service.order.dto;
|
||||
|
||||
import jakarta.validation.constraints.Min;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
@Data
|
||||
public class UserCouponInfoDTO {
|
||||
private Long userCouponId;
|
||||
@Min(1)
|
||||
private Integer num;
|
||||
}
|
||||
|
|
@ -57,10 +57,12 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
|||
|
||||
queryWrapper.eq(OrderInfo::getShopId, param.getShopId())
|
||||
.eq(OrderInfo::getStatus, param.getStatus())
|
||||
.eq(OrderInfo::getOrderNo, param.getOrderNo())
|
||||
.eq(OrderInfo::getPayType, param.getPayType())
|
||||
.eq(OrderInfo::getTableCode, param.getTableCode())
|
||||
.eq(OrderInfo::getUserId, param.getUserId())
|
||||
.eq(OrderInfo::getTableCode, param.getTableCode())
|
||||
.eq(OrderInfo::getOrderNo, param.getOrderNo())
|
||||
.gt(OrderInfo::getCreateTime, param.getStartTime())
|
||||
.le(OrderInfo::getCreateTime, param.getEndTime())
|
||||
.in(OrderInfo::getId, like);
|
||||
Page<OrderInfoVo> orderInfoVoPage = pageAs(PageUtil.buildPage(), queryWrapper, OrderInfoVo.class);
|
||||
orderInfoVoPage.getRecords().parallelStream().forEach(s -> {
|
||||
|
|
@ -83,8 +85,8 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
|||
.where(OrderPayment::getId).eq(payment.getId())
|
||||
.update();
|
||||
|
||||
if ("TRADE_SUCCESS" .equals(czgCallBackDto.getState())) {
|
||||
if ("order" .equals(payment.getPayType())) {
|
||||
if ("TRADE_SUCCESS".equals(czgCallBackDto.getState())) {
|
||||
if ("order".equals(payment.getPayType())) {
|
||||
updateChain().of(OrderInfo.class)
|
||||
.set(OrderInfo::getPayAmount, new BigDecimal(czgCallBackDto.getAmount() / 100L))
|
||||
.set(OrderInfo::getStatus, OrderStatusEnums.DONE.getCode())
|
||||
|
|
|
|||
Loading…
Reference in New Issue