zwhui 1 년 전
부모
커밋
c61667356b

+ 0 - 3
wholesale/src/main/java/com/yhlxj/service/order/impl/WebWholesaleOrderDonServiceImpl.java

@@ -81,9 +81,6 @@ public class WebWholesaleOrderDonServiceImpl implements WebWholesaleOrderDonServ
 		WebWholesaleOrderDon orderDon = new WebWholesaleOrderDon();
 		orderDon.setNum(payNum);
 
-		User user = userMapper.selectById(userId);
-		if (user == null) throw BusinessRuntimeException.getGatewayApiCode(GatewayApiCode.CMS_TOKEN_VALID);
-		if (user.getIsBlack()) throw BusinessRuntimeException.getInstance("系统检测操作异常,请稍后再试");
 		/* 生成订单 */
 		String donNo = SEQUENCE.nextId().toString();
 		orderDon.setOrderNo(donNo);

+ 1 - 1
wholesale/src/main/java/com/yhlxj/service/wholesale/impl/WebInfoServiceImpl.java

@@ -146,7 +146,7 @@ public class WebInfoServiceImpl extends ServiceImpl<WebInfoMapper, WebInfo> impl
             req.setDomain("galaxydvd.com");
             req.setRecordType("A");
             req.setRecordLine("默认");
-            req.setSubDomain("jj");
+            req.setSubDomain(prefix);
             req.setValue("147.79.20.183");
             // 返回的resp是一个CreateRecordResponse的实例,与请求对象对应
             CreateRecordResponse resp = client.CreateRecord(req);

+ 4 - 6
wholesale/src/main/java/com/yhlxj/web/controller/login/WholesaleUserController.java

@@ -3,7 +3,6 @@ package com.yhlxj.web.controller.login;
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.lang.Validator;
 import cn.hutool.core.util.StrUtil;
-import com.baomidou.mybatisplus.core.toolkit.BeanUtils;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.cyksj.common.exception.BusinessRuntimeException;
 import com.cyksj.enums.GatewayApiCode;
@@ -18,7 +17,6 @@ import com.yhlxj.service.wholesale.WebInfoService;
 import com.yhlxj.service.wholesale.WholesaleNoticeService;
 import com.yhlxj.service.wholesale.WholesaleUserService;
 import com.yhlxj.web.util.StpUserUtil;
-import com.yhlxj.web.util.StpWholesaleUtil;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
@@ -67,9 +65,9 @@ public class WholesaleUserController {
 
         //写回登陆信息
         StpUserUtil.login(login.getId());
-        response.addHeader("satoken-user", StpUserUtil.getTokenValue());
+        response.addHeader("satoken-wholesale-web", StpUserUtil.getTokenValue());
 
-        Cookie cookie = new Cookie("satoken-user", StpUserUtil.getTokenValue());
+        Cookie cookie = new Cookie("satoken-wholesale-web", StpUserUtil.getTokenValue());
         cookie.setMaxAge(31536000);
         cookie.setPath("/");
         response.addCookie(cookie);
@@ -89,9 +87,9 @@ public class WholesaleUserController {
 
         //写回登陆信息
         StpUserUtil.login(login.getId());
-        response.addHeader("satoken-user", StpUserUtil.getTokenValue());
+        response.addHeader("satoken-wholesale-web", StpUserUtil.getTokenValue());
 
-        Cookie cookie = new Cookie("satoken-user", StpUserUtil.getTokenValue());
+        Cookie cookie = new Cookie("satoken-wholesale-web", StpUserUtil.getTokenValue());
         cookie.setMaxAge(31536000);
         cookie.setPath("/");
         response.addCookie(cookie);

+ 4 - 5
wholesale/src/main/java/com/yhlxj/web/controller/manage/WholesaleCodeController.java

@@ -1,5 +1,6 @@
 package com.yhlxj.web.controller.manage;
 
+import cn.dev33.satoken.stp.StpUtil;
 import com.cyksj.common.exception.BusinessRuntimeException;
 import com.ejlchina.searcher.BeanSearcher;
 import com.ejlchina.searcher.SearchResult;
@@ -13,8 +14,6 @@ import com.yhlxj.dao.model.response.AliPayTradeStatus;
 import com.yhlxj.dao.model.view.WebWholesaleCodeDetailView;
 import com.yhlxj.dao.model.view.WebWholesaleOrderView;
 import com.yhlxj.service.order.WebWholesaleOrderDonService;
-import com.yhlxj.web.util.StpUserUtil;
-import com.yhlxj.web.util.StpWholesaleUtil;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.validation.annotation.Validated;
@@ -59,7 +58,7 @@ public class WholesaleCodeController {
 	 */
 	@GetMapping("/get/order")
 	public Result<SearchResult<WebWholesaleOrderView>> getOrders() {
-		long wholesaleId = StpWholesaleUtil.getLoginIdAsLong();
+		long wholesaleId = StpUtil.getLoginIdAsLong();
 		SearchResult<WebWholesaleOrderView> search = beanSearcher.search(WebWholesaleOrderView.class, MapUtils.flatBuilder(request.getParameterMap())
 				.field(WebWholesaleOrderView::getWholesaleId, wholesaleId)
 				.field(WebWholesaleOrderView::getStatus, WebWholesaleOrderDon.Status.complete.name())
@@ -74,8 +73,8 @@ public class WholesaleCodeController {
 	@PostMapping("/post/submit")
 	public Result<WebWholesaleOrderDon> submit(@Validated @RequestBody WebOrderPayRequest payRequest) throws Exception {
 		final String methodName = "吊起兑换码预支付";
-		long userId = StpWholesaleUtil.getLoginIdAsLong();
-		payRequest.setUserId(userId);
+		long wholesaleId = StpUtil.getLoginIdAsLong();
+		payRequest.setUserId(wholesaleId);
 		log.info("{}[start] params:{}", methodName, payRequest);
 		WebWholesaleOrderDon orderDon = webWholesaleOrderDonService.submit(payRequest);
 		return GatewayResponse.SUCCESS.newBuilder().toResult(orderDon);

+ 6 - 5
wholesale/src/main/java/com/yhlxj/web/controller/manage/WholesaleController.java

@@ -1,5 +1,6 @@
 package com.yhlxj.web.controller.manage;
 
+import cn.dev33.satoken.stp.StpUtil;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.cyksj.common.exception.BusinessRuntimeException;
@@ -9,7 +10,6 @@ import com.yhlxj.dao.model.entity.WholesaleUser;
 import com.yhlxj.dao.model.enums.GatewayResponse;
 import com.yhlxj.service.wholesale.WebInfoService;
 import com.yhlxj.service.wholesale.WholesaleUserService;
-import com.yhlxj.web.util.StpWholesaleUtil;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
@@ -115,10 +115,10 @@ public class WholesaleController {
         WebInfo login = webInfoService.login(webInfo.getAccount(), webInfo.getPassword());
 
         //写回登陆信息
-        StpWholesaleUtil.login(login.getId());
-        response.addHeader("satoken-wholesale", StpWholesaleUtil.getTokenValue());
+        StpUtil.login(login.getId());
+        response.addHeader("satoken-wholesale", StpUtil.getTokenValue());
 
-        Cookie cookie = new Cookie("satoken-wholesale", StpWholesaleUtil.getTokenValue());
+        Cookie cookie = new Cookie("satoken-wholesale", StpUtil.getTokenValue());
         cookie.setMaxAge(31536000);
         cookie.setPath("/");
         response.addCookie(cookie);
@@ -131,8 +131,9 @@ public class WholesaleController {
      */
     @GetMapping("/user/list")
     public Result<Page<WholesaleUser>> listUser(String username, @RequestParam(defaultValue = "1") Integer start, @RequestParam(defaultValue = "10") Integer limit) {
+        long wholesaleId = StpUtil.getLoginIdAsLong();
         return GatewayResponse.SUCCESS.newBuilder().toResult(wholesaleUserService.page(new Page<>(start, limit),
-                Wrappers.lambdaQuery(WholesaleUser.class).like(WholesaleUser::getUsername, username)));
+                Wrappers.lambdaQuery(WholesaleUser.class).eq(WholesaleUser::getWholesaleId, wholesaleId).like(WholesaleUser::getUsername, username)));
     }
 
 }

+ 5 - 5
wholesale/src/main/java/com/yhlxj/web/controller/manage/WholesaleNoticeController.java

@@ -1,5 +1,6 @@
 package com.yhlxj.web.controller.manage;
 
+import cn.dev33.satoken.stp.StpUtil;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.cyksj.common.util.StringUtil;
@@ -7,7 +8,6 @@ import com.yhlxj.dao.model.dto.Result;
 import com.yhlxj.dao.model.entity.WholesaleNotice;
 import com.yhlxj.dao.model.enums.GatewayResponse;
 import com.yhlxj.service.wholesale.WholesaleNoticeService;
-import com.yhlxj.web.util.StpWholesaleUtil;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.web.bind.annotation.*;
@@ -32,7 +32,7 @@ public class WholesaleNoticeController {
     @PostMapping("/save")
     public Result<WholesaleNotice> save(@RequestBody WholesaleNotice wholesaleNotice) {
         log.info("保存公告:{}", wholesaleNotice);
-        long wholesaleId = StpWholesaleUtil.getLoginIdAsLong();
+        long wholesaleId = StpUtil.getLoginIdAsLong();
         wholesaleNotice.setWholesaleId(wholesaleId);
         wholesaleNoticeService.saveOrUpdate(wholesaleNotice);
         return GatewayResponse.SUCCESS.newBuilder().toResult(wholesaleNotice);
@@ -44,7 +44,7 @@ public class WholesaleNoticeController {
     @PutMapping("/put/status/{id}")
     public Result<String> putStatus(@PathVariable Long id) {
         log.info("上下架公告:{}", id);
-        long wholesaleId = StpWholesaleUtil.getLoginIdAsLong();
+        long wholesaleId = StpUtil.getLoginIdAsLong();
         WholesaleNotice wholesaleNotice = wholesaleNoticeService.getById(id);
         if (wholesaleNotice == null || !wholesaleNotice.getWholesaleId().equals(wholesaleId)) {
             throw new RuntimeException("公告不存在");
@@ -60,7 +60,7 @@ public class WholesaleNoticeController {
     @DeleteMapping("/del/{id}")
     public Result<String> del(@PathVariable Long id) {
         log.info("删除公告:{}", id);
-        long wholesaleId = StpWholesaleUtil.getLoginIdAsLong();
+        long wholesaleId = StpUtil.getLoginIdAsLong();
         WholesaleNotice wholesaleNotice = wholesaleNoticeService.getById(id);
         if (wholesaleNotice == null || !wholesaleNotice.getWholesaleId().equals(wholesaleId)) {
             throw new RuntimeException("公告不存在");
@@ -75,7 +75,7 @@ public class WholesaleNoticeController {
     @GetMapping("/list")
     public Result<Page<WholesaleNotice>> list(String platform,String description,Boolean status, @RequestParam(defaultValue = "1") Integer start, @RequestParam(defaultValue = "10") Integer limit) {
         log.info("查询公告列表平台:{},描述:{},状态:{}", platform,description,status);
-        long wholesaleId = StpWholesaleUtil.getLoginIdAsLong();
+        long wholesaleId = StpUtil.getLoginIdAsLong();
         Page<WholesaleNotice> page = wholesaleNoticeService.page(new Page<>(start, limit), Wrappers.lambdaQuery(WholesaleNotice.class)
                 .eq(WholesaleNotice::getWholesaleId, wholesaleId)
                 .like(StringUtil.isNotBlank(platform),WholesaleNotice::getPlatform, platform)

+ 0 - 334
wholesale/src/main/java/com/yhlxj/web/util/StpWholesaleUtil.java

@@ -1,334 +0,0 @@
-package com.yhlxj.web.util;
-
-import cn.dev33.satoken.fun.SaFunction;
-import cn.dev33.satoken.session.SaSession;
-import cn.dev33.satoken.stp.SaLoginModel;
-import cn.dev33.satoken.stp.SaTokenInfo;
-import cn.dev33.satoken.stp.StpLogic;
-import org.springframework.stereotype.Component;
-
-import java.util.List;
-
-/**
- * @author chan
- * @date 2021/10/12 下午5:59
- */
-@Component
-public class StpWholesaleUtil {
-    public static final String TYPE = "admin";
-
-    // 使用匿名子类 重写`stpLogic对象`的一些方法
-    public static StpLogic stpLogic = new StpLogic("admin") {
-        // 重写 StpLogic 类下的 `splicingKeyTokenName` 函数,返回一个与 `StpUtil` 不同的token名称, 防止冲突
-        @Override
-        public String splicingKeyTokenName() {
-            return super.splicingKeyTokenName() + "-admin";
-        }
-        // 同理你可以按需重写一些其它方法 ...
-    };
-
-    public StpWholesaleUtil() {
-    }
-
-    public static String getLoginType() {
-        return stpLogic.getLoginType();
-    }
-
-    public static String getTokenName() {
-        return stpLogic.getTokenName();
-    }
-
-    public static void setTokenValue(String tokenValue, int cookieTimeout) {
-        stpLogic.setTokenValue(tokenValue, cookieTimeout);
-    }
-
-    public static String getTokenValue() {
-        return stpLogic.getTokenValue();
-    }
-
-    public static SaTokenInfo getTokenInfo() {
-        return stpLogic.getTokenInfo();
-    }
-
-    public static void login(Object id) {
-        stpLogic.login(id);
-    }
-
-    public static void login(Object id, String device) {
-        stpLogic.login(id, device);
-    }
-
-    public static void login(Object id, boolean isLastingCookie) {
-        stpLogic.login(id, isLastingCookie);
-    }
-
-    public static void login(Object id, SaLoginModel loginModel) {
-        stpLogic.login(id, loginModel);
-    }
-
-    public static void logout() {
-        stpLogic.logout();
-    }
-
-    public static void logoutByTokenValue(String tokenValue) {
-        stpLogic.logoutByTokenValue(tokenValue);
-    }
-
-    public static void logoutByLoginId(Object loginId) {
-        stpLogic.logoutByLoginId(loginId);
-    }
-
-    public static void logoutByLoginId(Object loginId, String device) {
-        stpLogic.logoutByLoginId(loginId, device);
-    }
-
-    public static boolean isLogin() {
-        return stpLogic.isLogin();
-    }
-
-    public static Long getUserIdAfterLogin() {
-        if (isLogin()) {
-            return StpWholesaleUtil.getLoginIdAsLong();
-        }
-        return null;
-    }
-
-    public static void checkLogin() {
-        stpLogic.checkLogin();
-    }
-
-    public static Object getLoginId() {
-        return stpLogic.getLoginId();
-    }
-
-    public static <T> T getLoginId(T defaultValue) {
-        return stpLogic.getLoginId(defaultValue);
-    }
-
-    public static Object getLoginIdDefaultNull() {
-        return stpLogic.getLoginIdDefaultNull();
-    }
-
-    public static String getLoginIdAsString() {
-        return stpLogic.getLoginIdAsString();
-    }
-
-    public static int getLoginIdAsInt() {
-        return stpLogic.getLoginIdAsInt();
-    }
-
-    public static long getLoginIdAsLong() {
-        return stpLogic.getLoginIdAsLong();
-    }
-
-    public static Object getLoginIdByToken(String tokenValue) {
-        return stpLogic.getLoginIdByToken(tokenValue);
-    }
-
-    public static SaSession getSessionByLoginId(Object loginId, boolean isCreate) {
-        return stpLogic.getSessionByLoginId(loginId, isCreate);
-    }
-
-    public static SaSession getSessionBySessionId(String sessionId) {
-        return stpLogic.getSessionBySessionId(sessionId);
-    }
-
-    public static SaSession getSessionByLoginId(Object loginId) {
-        return stpLogic.getSessionByLoginId(loginId);
-    }
-
-    public static SaSession getSession(boolean isCreate) {
-        return stpLogic.getSession(isCreate);
-    }
-
-    public static SaSession getSession() {
-        return stpLogic.getSession();
-    }
-
-    public static SaSession getTokenSessionByToken(String tokenValue) {
-        return stpLogic.getTokenSessionByToken(tokenValue);
-    }
-
-    public static SaSession getTokenSession() {
-        return stpLogic.getTokenSession();
-    }
-
-    public static void checkActivityTimeout() {
-        stpLogic.checkActivityTimeout();
-    }
-
-    public static void updateLastActivityToNow() {
-        stpLogic.updateLastActivityToNow();
-    }
-
-    public static long getTokenTimeout() {
-        return stpLogic.getTokenTimeout();
-    }
-
-    public static long getSessionTimeout() {
-        return stpLogic.getSessionTimeout();
-    }
-
-    public static long getTokenSessionTimeout() {
-        return stpLogic.getTokenSessionTimeout();
-    }
-
-    public static long getTokenActivityTimeout() {
-        return stpLogic.getTokenActivityTimeout();
-    }
-
-    public static boolean hasRole(Object loginId, String role) {
-        return stpLogic.hasRole(loginId, role);
-    }
-
-    public static boolean hasRole(String role) {
-        return stpLogic.hasRole(role);
-    }
-
-    public static void checkRole(String role) {
-        stpLogic.checkRole(role);
-    }
-
-    public static void checkRoleAnd(String... roleArray) {
-        stpLogic.checkRoleAnd(roleArray);
-    }
-
-    public static void checkRoleOr(String... roleArray) {
-        stpLogic.checkRoleOr(roleArray);
-    }
-
-    public static boolean hasPermission(Object loginId, String permission) {
-        return stpLogic.hasPermission(loginId, permission);
-    }
-
-    public static boolean hasPermission(String permission) {
-        return stpLogic.hasPermission(permission);
-    }
-
-    public static void checkPermission(String permission) {
-        stpLogic.checkPermission(permission);
-    }
-
-    public static void checkPermissionAnd(String... permissionArray) {
-        stpLogic.checkPermissionAnd(permissionArray);
-    }
-
-    public static void checkPermissionOr(String... permissionArray) {
-        stpLogic.checkPermissionOr(permissionArray);
-    }
-
-    public static String getTokenValueByLoginId(Object loginId) {
-        return stpLogic.getTokenValueByLoginId(loginId);
-    }
-
-    public static String getTokenValueByLoginId(Object loginId, String device) {
-        return stpLogic.getTokenValueByLoginId(loginId, device);
-    }
-
-    public static List<String> getTokenValueListByLoginId(Object loginId) {
-        return stpLogic.getTokenValueListByLoginId(loginId);
-    }
-
-    public static List<String> getTokenValueListByLoginId(Object loginId, String device) {
-        return stpLogic.getTokenValueListByLoginId(loginId, device);
-    }
-
-    public static String getLoginDevice() {
-        return stpLogic.getLoginDevice();
-    }
-
-    public static List<String> searchTokenValue(String keyword, int start, int size) {
-        return stpLogic.searchTokenValue(keyword, start, size);
-    }
-
-    public static List<String> searchSessionId(String keyword, int start, int size) {
-        return stpLogic.searchSessionId(keyword, start, size);
-    }
-
-    public static List<String> searchTokenSessionId(String keyword, int start, int size) {
-        return stpLogic.searchTokenSessionId(keyword, start, size);
-    }
-
-    public static void disable(Object loginId, long disableTime) {
-        stpLogic.disable(loginId, disableTime);
-    }
-
-    public static boolean isDisable(Object loginId) {
-        return stpLogic.isDisable(loginId);
-    }
-
-    public static long getDisableTime(Object loginId) {
-        return stpLogic.getDisableTime(loginId);
-    }
-
-    public static void untieDisable(Object loginId) {
-        stpLogic.untieDisable(loginId);
-    }
-
-    public static void switchTo(Object loginId) {
-        stpLogic.switchTo(loginId);
-    }
-
-    public static void endSwitch() {
-        stpLogic.endSwitch();
-    }
-
-    public static boolean isSwitch() {
-        return stpLogic.isSwitch();
-    }
-
-    public static void switchTo(Object loginId, SaFunction function) {
-        stpLogic.switchTo(loginId, function);
-    }
-
-    public static void openSafe(long safeTime) {
-        stpLogic.openSafe(safeTime);
-    }
-
-    public static boolean isSafe() {
-        return stpLogic.isSafe();
-    }
-
-    public static void checkSafe() {
-        stpLogic.checkSafe();
-    }
-
-    public static long getSafeTime() {
-        return stpLogic.getSafeTime();
-    }
-
-    public static void closeSafe() {
-        stpLogic.closeSafe();
-    }
-
-    /** @deprecated */
-    @Deprecated
-    public static String getLoginKey() {
-        return stpLogic.getLoginType();
-    }
-
-    /** @deprecated */
-    @Deprecated
-    public static void setLoginId(Object loginId) {
-        stpLogic.login(loginId);
-    }
-
-    /** @deprecated */
-    @Deprecated
-    public static void setLoginId(Object loginId, String device) {
-        stpLogic.login(loginId, device);
-    }
-
-    /** @deprecated */
-    @Deprecated
-    public static void setLoginId(Object loginId, boolean isLastingCookie) {
-        stpLogic.login(loginId, isLastingCookie);
-    }
-
-    /** @deprecated */
-    @Deprecated
-    public static void setLoginId(Object loginId, SaLoginModel loginModel) {
-        stpLogic.login(loginId, loginModel);
-    }
-
-}