bug修复
This commit is contained in:
@@ -39,8 +39,6 @@ public class UserAuthorizationController {
|
|||||||
|
|
||||||
@PostMapping("/test")
|
@PostMapping("/test")
|
||||||
public CzgResult<String> test() {
|
public CzgResult<String> test() {
|
||||||
StpKit.USER.login(15114L, "or1l867go4WD5DYBT1iejr1DqGIw", null, null, null, MyStpLogic.LoginType.USER, false, "userMini");
|
|
||||||
|
|
||||||
return CzgResult.success(StpKit.USER.getTokenValue());
|
return CzgResult.success(StpKit.USER.getTokenValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import com.czg.market.vo.MemberConfigVO;
|
|||||||
import com.czg.market.vo.MemberLevelVO;
|
import com.czg.market.vo.MemberLevelVO;
|
||||||
import com.czg.resp.CzgResult;
|
import com.czg.resp.CzgResult;
|
||||||
import com.czg.sa.StpKit;
|
import com.czg.sa.StpKit;
|
||||||
|
import com.czg.utils.AssertUtil;
|
||||||
import com.czg.validator.group.UpdateGroup;
|
import com.czg.validator.group.UpdateGroup;
|
||||||
import com.mybatisflex.core.query.QueryWrapper;
|
import com.mybatisflex.core.query.QueryWrapper;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
@@ -48,6 +49,7 @@ public class MemberController {
|
|||||||
// @SaAdminCheckPermission(value = "member:edit", name = "会员配置列表")
|
// @SaAdminCheckPermission(value = "member:edit", name = "会员配置列表")
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public CzgResult<Boolean> edit(@Validated @RequestBody MemberConfigDTO memberDTO) {
|
public CzgResult<Boolean> edit(@Validated @RequestBody MemberConfigDTO memberDTO) {
|
||||||
|
AssertUtil.isTrue(!StpKit.USER.isMainShop(), "无权限操作");
|
||||||
return CzgResult.success(memberConfigService.edit(StpKit.USER.getShopId(), memberDTO));
|
return CzgResult.success(memberConfigService.edit(StpKit.USER.getShopId(), memberDTO));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -59,6 +61,7 @@ public class MemberController {
|
|||||||
// @SaAdminCheckPermission(value = "member:edit", name = "会员配置列表")
|
// @SaAdminCheckPermission(value = "member:edit", name = "会员配置列表")
|
||||||
@PostMapping("/level")
|
@PostMapping("/level")
|
||||||
public CzgResult<Boolean> addLevel(@Validated @RequestBody MemberLevelDTO levelDTO) throws ApiNotPrintException {
|
public CzgResult<Boolean> addLevel(@Validated @RequestBody MemberLevelDTO levelDTO) throws ApiNotPrintException {
|
||||||
|
AssertUtil.isTrue(!StpKit.USER.isMainShop(), "无权限操作");
|
||||||
return CzgResult.success(memberConfigService.addLevel(StpKit.USER.getShopId(), levelDTO));
|
return CzgResult.success(memberConfigService.addLevel(StpKit.USER.getShopId(), levelDTO));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,6 +72,7 @@ public class MemberController {
|
|||||||
// @SaAdminCheckPermission(value = "member:edit", name = "会员配置列表")
|
// @SaAdminCheckPermission(value = "member:edit", name = "会员配置列表")
|
||||||
@PutMapping("/level")
|
@PutMapping("/level")
|
||||||
public CzgResult<Boolean> editLevel(@Validated({UpdateGroup.class, Default.class}) @RequestBody MemberLevelDTO levelDTO) throws ApiNotPrintException {
|
public CzgResult<Boolean> editLevel(@Validated({UpdateGroup.class, Default.class}) @RequestBody MemberLevelDTO levelDTO) throws ApiNotPrintException {
|
||||||
|
AssertUtil.isTrue(!StpKit.USER.isMainShop(), "无权限操作");
|
||||||
return CzgResult.success(memberConfigService.editLevel(StpKit.USER.getShopId(), levelDTO));
|
return CzgResult.success(memberConfigService.editLevel(StpKit.USER.getShopId(), levelDTO));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,6 +83,7 @@ public class MemberController {
|
|||||||
// @SaAdminCheckPermission(value = "member:edit", name = "会员配置列表")
|
// @SaAdminCheckPermission(value = "member:edit", name = "会员配置列表")
|
||||||
@DeleteMapping("/level/{id}")
|
@DeleteMapping("/level/{id}")
|
||||||
public CzgResult<Boolean> deleteLevel(@PathVariable Long id) {
|
public CzgResult<Boolean> deleteLevel(@PathVariable Long id) {
|
||||||
|
AssertUtil.isTrue(!StpKit.USER.isMainShop(), "无权限操作");
|
||||||
return CzgResult.success(memberLevelConfigService.remove(new QueryWrapper().eq(MemberLevelConfig::getId, id).eq(MemberLevelConfig::getShopId, StpKit.USER.getShopId())));
|
return CzgResult.success(memberLevelConfigService.remove(new QueryWrapper().eq(MemberLevelConfig::getId, id).eq(MemberLevelConfig::getShopId, StpKit.USER.getShopId())));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,6 +105,7 @@ public class MemberController {
|
|||||||
// @SaAdminCheckPermission(value = "member:edit", name = "会员配置列表")
|
// @SaAdminCheckPermission(value = "member:edit", name = "会员配置列表")
|
||||||
@PutMapping("/level/detail")
|
@PutMapping("/level/detail")
|
||||||
public CzgResult<ArrayList<MemberLevelVO>> levelList(@RequestParam Integer id) {
|
public CzgResult<ArrayList<MemberLevelVO>> levelList(@RequestParam Integer id) {
|
||||||
|
AssertUtil.isTrue(!StpKit.USER.isMainShop(), "无权限操作");
|
||||||
return CzgResult.success(memberConfigService.listLevel(StpKit.USER.getShopId()));
|
return CzgResult.success(memberConfigService.listLevel(StpKit.USER.getShopId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ public class MyStpLogic {
|
|||||||
* @param loginType 登录类型枚举
|
* @param loginType 登录类型枚举
|
||||||
* @param isAdmin 是否为管理员账号
|
* @param isAdmin 是否为管理员账号
|
||||||
*/
|
*/
|
||||||
public void login(Long id, String account, Long shopId, Long headShopId, String shopName, LoginType loginType, boolean isAdmin, String platForm) {
|
public void login(Long id, String account, Long shopId, Long headShopId, String shopName, LoginType loginType, boolean isAdmin, String platForm, boolean isMainShop) {
|
||||||
StpLogic logic = getLogic();
|
StpLogic logic = getLogic();
|
||||||
logic.login(id);
|
logic.login(id);
|
||||||
if (loginType.equals(LoginType.MANAGER) && shopId == null) {
|
if (loginType.equals(LoginType.MANAGER) && shopId == null) {
|
||||||
@@ -117,6 +117,13 @@ public class MyStpLogic {
|
|||||||
if (shopName != null) {
|
if (shopName != null) {
|
||||||
session.set("shopName", shopName);
|
session.set("shopName", shopName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
session.set("isMainShop", isMainShop);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isMainShop() {
|
||||||
|
StpLogic logic = getLogic();
|
||||||
|
return (Boolean) logic.getSession().get("isMainShop");
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPlatForm() {
|
public String getPlatForm() {
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import java.io.Serial;
|
|||||||
|
|
||||||
import jakarta.validation.constraints.NotBlank;
|
import jakarta.validation.constraints.NotBlank;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 支付详情 实体类。
|
* 支付详情 实体类。
|
||||||
@@ -21,6 +22,7 @@ import lombok.*;
|
|||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@Table("tb_order_payment")
|
@Table("tb_order_payment")
|
||||||
|
@Accessors(chain = true)
|
||||||
public class OrderPayment implements Serializable {
|
public class OrderPayment implements Serializable {
|
||||||
|
|
||||||
@Serial
|
@Serial
|
||||||
@@ -32,13 +34,22 @@ public class OrderPayment implements Serializable {
|
|||||||
@Id(keyType = KeyType.Auto)
|
@Id(keyType = KeyType.Auto)
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 店铺Id
|
* 店铺Id
|
||||||
*/
|
*/
|
||||||
private Long shopId;
|
private Long shopId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 来源Id 订单Id或充值id
|
* 来源Id 订单Id或充值id
|
||||||
*/
|
*/
|
||||||
private Long sourceId;
|
private Long sourceId;
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -148,7 +148,8 @@ public class AuthorizationServiceImpl implements AuthorizationService {
|
|||||||
if (!isAllowAccountLogin) {
|
if (!isAllowAccountLogin) {
|
||||||
throw new ApiNotPrintException("当前分店账号被禁止登录");
|
throw new ApiNotPrintException("当前分店账号被禁止登录");
|
||||||
}
|
}
|
||||||
StpKit.USER.login(user.getId(), user.getAccount(), shopInfo.getId(), shopInfo.getMainId(), shopInfo.getShopName(), isStaff ? MyStpLogic.LoginType.STAFF : MyStpLogic.LoginType.MANAGER, user.getIsAdmin(), platType);
|
StpKit.USER.login(user.getId(), user.getAccount(), shopInfo.getId(), shopInfo.getMainId(), shopInfo.getShopName(),
|
||||||
|
isStaff ? MyStpLogic.LoginType.STAFF : MyStpLogic.LoginType.MANAGER, user.getIsAdmin(), platType, shopInfo.getMainId() == null);
|
||||||
// 查询角色
|
// 查询角色
|
||||||
List<SysRole> roleList = sysRoleService.getByUserId(user.getId());
|
List<SysRole> roleList = sysRoleService.getByUserId(user.getId());
|
||||||
List<String> roleNames = roleList.stream().map(SysRole::getName).collect(Collectors.toList());
|
List<String> roleNames = roleList.stream().map(SysRole::getName).collect(Collectors.toList());
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ public class UserAuthorizationServiceImpl implements UserAuthorizationService {
|
|||||||
userInfo.setLastLoginTime(DateUtil.date().toLocalDateTime());
|
userInfo.setLastLoginTime(DateUtil.date().toLocalDateTime());
|
||||||
userInfoService.saveOrUpdate(userInfo);
|
userInfoService.saveOrUpdate(userInfo);
|
||||||
// StpKit.USER.login(userInfo.getId());
|
// StpKit.USER.login(userInfo.getId());
|
||||||
StpKit.USER.login(userInfo.getId(), openId, null, null, null, MyStpLogic.LoginType.USER, false, "userMini");
|
StpKit.USER.login(userInfo.getId(), openId, null, null, null, MyStpLogic.LoginType.USER, false, "userMini", false);
|
||||||
return new LoginTokenDTO(StpKit.USER.getTokenValue(), userInfo);
|
return new LoginTokenDTO(StpKit.USER.getTokenValue(), userInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user