Ver Fonte

Merge branch 'channeloff_0518' into dev

chunping há 2 anos atrás
pai
commit
5f09765c88

+ 32 - 10
mp-admin/src/main/java/com/qs/mp/web/controller/api/channel/ChannelController.java

@@ -22,6 +22,7 @@ import com.qs.mp.common.core.domain.AjaxResult;
 import com.qs.mp.common.core.page.TableDataInfo;
 import com.qs.mp.common.enums.ChannelCertifyStatusEnum;
 import com.qs.mp.common.enums.ChannelRoleEnum;
+import com.qs.mp.common.enums.ChannelStatusEnum;
 import com.qs.mp.common.enums.ChannelVerifyStatusEnum;
 import com.qs.mp.common.enums.ErrorCodeEnum;
 import com.qs.mp.common.exception.ServiceException;
@@ -80,10 +81,10 @@ public class ChannelController extends BaseApiController {
 
     @Autowired
     private ISysUserService userService;
-    
+
 	@Autowired
 	private IUserTicketOrderService userTicketOrderService;
-    
+
 	@Autowired
 	private ITicketService ticketService;
 
@@ -163,6 +164,10 @@ public class ChannelController extends BaseApiController {
 			return AjaxResult.error("该代理已存在");
 		}
 		Long channelId = SecurityUtils.getLoginUser().getChannelId();
+		Channel existChannel = channelService.getById(channelId);
+		if (existChannel.getStatus() == ChannelStatusEnum.OFF) {
+			return AjaxResult.error("账号异常");
+		}
 		Channel channel = mapperFacade.map(channelParam, Channel.class);
 		channel.setParentId(channelId);
 		// 1、校验名称是否重复、手机号是否存在(渠道表)
@@ -209,6 +214,7 @@ public class ChannelController extends BaseApiController {
 		if (null == channelParam || null == channelParam.getChannelId()) {
 			return error(ErrorCodeEnum.ERROR_CODE_1001);
 		}
+
 		Channel channel = mapperFacade.map(channelParam, Channel.class);
 		// 1、校验修改子渠道是否为当前用户的子渠道
 		Channel oldChannel = channelService.getById(channel.getChannelId());
@@ -216,6 +222,10 @@ public class ChannelController extends BaseApiController {
 			return AjaxResult.error("代理'" + oldChannel.getName() + "'编辑失败");
 		}
 		Long channelId = SecurityUtils.getLoginUser().getChannelId();
+		Channel existChannel = channelService.getById(channelId);
+		if (existChannel.getStatus() == ChannelStatusEnum.OFF) {
+			return AjaxResult.error("账号异常");
+		}
 		if(!oldChannel.getParentId().equals(channelId)) {
 			return AjaxResult.error("代理'" + oldChannel.getName() + "'编辑失败");
 		}
@@ -360,7 +370,7 @@ public class ChannelController extends BaseApiController {
 				queryWrapper.eq("t1.certify_status", siteParam.getCertifyStatus());
 			}
 			list = channelService.selectChannelVoList(queryWrapper);
-			
+
 			List<Long> channelIds = new ArrayList<Long>();
 			if(null != list && list.size() > 0) {
 				for(ChannelVO channelVO : list) {
@@ -376,13 +386,13 @@ public class ChannelController extends BaseApiController {
 				QueryWrapper<ChannelOrderDetail> ticketQtyCntQueryWrapper = new QueryWrapper<ChannelOrderDetail>();
 				ticketQtyCntQueryWrapper.in("t1.channel_id", channelIds);
 				qtyCntList = ticketService.listTicketQtyCnt(ticketQtyCntQueryWrapper);
-				
+
 		    	QueryWrapper<UserTicketOrder> ticketSaleCntQueryWrapper = new QueryWrapper<UserTicketOrder>();
 		    	ticketSaleCntQueryWrapper.in("t1.channel_id", channelIds);
 		    	ticketSaleCntQueryWrapper.eq("t1.`status`", 1);
 		    	saleCntList = userTicketOrderService.listTicketSaleCnt(ticketSaleCntQueryWrapper);
 			}
-			
+
 			if(null != list && list.size() > 0) {
 				for(ChannelVO channelVO : list) {
 					if(null != channelVO && null != channelVO.getChannelId()
@@ -413,7 +423,7 @@ public class ChannelController extends BaseApiController {
 	 				}
 				}
 			}
-			
+
 		}
 		return getDataTable(list);
 	}
@@ -443,20 +453,20 @@ public class ChannelController extends BaseApiController {
 	    ChannelOperDataVO channelOperDataVO = channelService.getChannelOperData(channelVO.getChannelNo(), 1);
 	    channelVO.setOperData(channelOperDataVO);
 	    if(null != channelVO && null != channelVO.getChannelId()) {
-	    	
+
 	    	LambdaQueryWrapper<ChannelUserRel> userCntQueryWrapper = new LambdaQueryWrapper<ChannelUserRel>();
 			userCntQueryWrapper.eq(ChannelUserRel::getChannelId, channelVO.getChannelId());
 			int userCnt = channelUserRelService.count(userCntQueryWrapper);
 			channelVO.setUserCnt(userCnt);
-	    	
+
 	    	int ticketQtyCnt = ticketService.getTicketQtyCnt(channelVO.getChannelId());
 	    	channelVO.setOffLineQtyCnt(ticketQtyCnt);
-	    	
+
 	    	TicketCntVO ticketSaleCnt = userTicketOrderService.getTicketSaleCnt(channelVO.getChannelId());
 			channelVO.setOffLineSaleCnt(null != ticketSaleCnt?ticketSaleCnt.getOffLineSaleCnt():0);
 			channelVO.setOnLineSaleCnt(null != ticketSaleCnt?ticketSaleCnt.getOnLineSaleCnt():0);
 	    }
-	   
+
 		return AjaxResult.success(channelVO);
 	}
 
@@ -472,6 +482,10 @@ public class ChannelController extends BaseApiController {
 			return AjaxResult.error("该门店已存在");
 		}
 		Long channelId = SecurityUtils.getLoginUser().getChannelId();
+		Channel existChannel = channelService.getById(channelId);
+		if (existChannel.getStatus() == ChannelStatusEnum.OFF) {
+			return AjaxResult.error("账号异常");
+		}
 
 		Channel channel = mapperFacade.map(channelParam, Channel.class);
 		channel.setParentId(channelId);
@@ -526,6 +540,10 @@ public class ChannelController extends BaseApiController {
 			return AjaxResult.error("门店'" + oldChannel.getName() + "'编辑失败");
 		}
 		Long channelId = SecurityUtils.getLoginUser().getChannelId();
+		Channel existChannel = channelService.getById(channelId);
+		if (existChannel.getStatus() == ChannelStatusEnum.OFF) {
+			return AjaxResult.error("账号异常");
+		}
 		if(!oldChannel.getParentId().equals(channelId)) {
 			return AjaxResult.error("门店'" + oldChannel.getName() + "'编辑失败");
 		}
@@ -583,6 +601,10 @@ public class ChannelController extends BaseApiController {
 		}
 
 		Long parentlId = SecurityUtils.getLoginUser().getChannelId();
+		Channel existChannel = channelService.getById(parentlId);
+		if (existChannel.getStatus() == ChannelStatusEnum.OFF) {
+			return AjaxResult.error("账号异常");
+		}
 		Channel queryChannel = channelService.getById(channel.getChannelId());
 		if(null == queryChannel || null == queryChannel.getChannelId()) {
 			return error(ErrorCodeEnum.ERROR_CODE_1001);

+ 4 - 3
mp-admin/src/main/java/com/qs/mp/web/controller/api/channel/ChannelWithdrawController.java

@@ -27,6 +27,7 @@ import com.qs.mp.channel.service.IChannelWithdrawService;
 import com.qs.mp.common.core.domain.AjaxResult;
 import com.qs.mp.common.core.redis.RedisCache;
 import com.qs.mp.common.domain.param.BatchLongIdsParam;
+import com.qs.mp.common.enums.ChannelStatusEnum;
 import com.qs.mp.common.utils.StringUtils;
 import com.qs.mp.system.service.ISysConfigService;
 import com.qs.mp.utils.SecurityUtils;
@@ -92,9 +93,9 @@ public class ChannelWithdrawController extends BaseApiController {
         StringUtils.isNotBlank(feeRateValue) ? feeRateValue : FEE_RATE_DEFAULT_VALUE);
     Long channelId = SecurityUtils.getLoginUser().getChannelId();
     Channel channel = channelService.getById(channelId);
-    /*if (channel.getMoney() < 50000) {
-      return AjaxResult.error("账户余额不足500元");
-    }*/
+    if (channel.getStatus() == ChannelStatusEnum.OFF) {
+      return AjaxResult.error("账号异常");
+    }
     if (param.getMoney() > channel.getMoney() ) {
       return AjaxResult.error("提现金额超出了余额");
     }

+ 4 - 2
mp-admin/src/main/java/com/qs/mp/web/controller/api/channel/mall/ChannelOrderController.java

@@ -200,9 +200,11 @@ public class ChannelOrderController extends BaseApiController {
   public AjaxResult settle(@Valid @RequestBody ChannelOrderParam param) {
     Long userId = SecurityUtils.getLoginUser().getUserId();
     Long channelId = SecurityUtils.getLoginUser().getChannelId();
-
+    Channel channel = channelService.getById(channelId);
+    if (channel.getStatus() == ChannelStatusEnum.OFF) {
+      return AjaxResult.error("账号异常");
+    }
     ChannelOrderSettleVO orderSettleVO = new ChannelOrderSettleVO();
-
     // 收货地址,如果用户选了地址,则此处不做处理
     if (null == param.getAddrId() || 0 == param.getAddrId()) {
       //读取默认地址

+ 6 - 2
mp-admin/src/test/java/com/qs/mp/service/ServiceImplTest.java

@@ -2,11 +2,13 @@ package com.qs.mp.service;
 
 import com.qs.mp.MpApplication;
 import com.qs.mp.admin.service.ITicketBoxSerialService;
+import com.qs.mp.common.utils.DateUtils;
 import com.qs.mp.framework.service.IWxUrlLinkService;
 import com.qs.mp.quartz.task.DayStatTask;
 import com.qs.mp.quartz.task.TicketBoxTask;
 import com.qs.mp.quartz.task.TicketPkgDataTask;
 import java.io.IOException;
+import java.util.Date;
 import org.junit.jupiter.api.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -106,7 +108,7 @@ public class ServiceImplTest {
       System.out.println(randInt);
     }
   */
-    String s = "z";
+    /*String s = "z";
 
     int i = Character.codePointAt(s, 0);
 
@@ -114,7 +116,9 @@ public class ServiceImplTest {
 
     char[] a = Character.toChars(72);
 
-    System.out.println(new String(a));
+    System.out.println(new String(a));*/
+    System.out.println(DateUtils.dateTime());
+    System.out.println(new Date().getTime());
   }
 
   }

+ 16 - 0
mp-framework/src/main/java/com/qs/mp/framework/security/filter/JwtAuthenticationTokenFilter.java

@@ -1,5 +1,10 @@
 package com.qs.mp.framework.security.filter;
 
+import com.qs.mp.channel.domain.Channel;
+import com.qs.mp.channel.service.IChannelService;
+import com.qs.mp.common.enums.ChannelStatusEnum;
+import com.qs.mp.common.enums.UserIdentityEnum;
+import com.qs.mp.common.exception.ServiceException;
 import com.qs.mp.common.utils.StringUtils;
 import com.qs.mp.core.domain.LoginUser;
 import com.qs.mp.framework.security.handle.HostHolder;
@@ -32,6 +37,9 @@ public class JwtAuthenticationTokenFilter extends OncePerRequestFilter
     @Autowired
     private TokenService tokenService;
 
+    @Autowired
+    private IChannelService channelService;
+
     @Autowired
     private HostHolder hostHolder;
 
@@ -40,6 +48,14 @@ public class JwtAuthenticationTokenFilter extends OncePerRequestFilter
             throws ServletException, IOException
     {
         LoginUser loginUser = tokenService.getLoginUser(request);
+        // 票赢天下小程序请求,判断账号的状态
+        if (null != loginUser && loginUser.getIdentity() == UserIdentityEnum.CHANNEL) {
+            Channel channel = channelService.getById(loginUser.getChannelId());
+            if (null == channel || channel.getStatus() == ChannelStatusEnum.OFF) {
+                tokenService.delLoginUser(request);
+                loginUser = null;
+            }
+        }
         if (StringUtils.isNotNull(loginUser) && StringUtils.isNull(SecurityUtils.getAuthentication()))
         {
             tokenService.verifyToken(loginUser);

+ 2 - 1
mp-framework/src/main/java/com/qs/mp/framework/web/service/SysLoginService.java

@@ -6,6 +6,7 @@ import com.qs.mp.channel.service.IChannelService;
 import com.qs.mp.common.constant.Constants;
 import com.qs.mp.common.core.redis.RedisCache;
 import com.qs.mp.common.enums.ChannelRoleEnum;
+import com.qs.mp.common.enums.ChannelStatusEnum;
 import com.qs.mp.common.enums.UserIdentityEnum;
 import com.qs.mp.common.exception.ServiceException;
 import com.qs.mp.common.exception.user.CaptchaException;
@@ -204,7 +205,7 @@ public class SysLoginService
      */
     public ChannelRoleEnum fillChannelInfo(LoginUser loginUser){
     	Channel channel = channelService.getChannelByUserId(loginUser.getUserId());
-        if (null != channel && null != channel.getChannelId()){
+        if (null != channel && ChannelStatusEnum.OFF != channel.getStatus()){
           loginUser.setChannelId(channel.getChannelId());
           loginUser.setChannelNo(channel.getChannelNo());
           if (channel.getLevel() == 0) {

+ 6 - 0
mp-framework/src/main/java/com/qs/mp/framework/web/service/TokenService.java

@@ -99,6 +99,12 @@ public class TokenService
         }
     }
 
+    public void delLoginUser(HttpServletRequest request) {
+        // 获取请求携带的令牌
+        String token = getToken(request);
+        delLoginUser(token);
+    }
+
     /**
      * 创建令牌
      *