Explorar o código

app IM 扫一扫 客户加客户的问题

三七 hai 5 días
pai
achega
b6d358c61a

+ 19 - 1
fs-qwhook-sop/src/main/java/com/fs/app/controller/ApisQwUserController.java

@@ -5,6 +5,7 @@ import com.fs.common.BeanCopyUtils;
 import com.fs.common.annotation.Log;
 import com.fs.common.annotation.Log;
 import com.fs.common.core.controller.BaseController;
 import com.fs.common.core.controller.BaseController;
 import com.fs.common.core.domain.R;
 import com.fs.common.core.domain.R;
+import com.fs.common.core.page.TableDataInfo;
 import com.fs.common.enums.BusinessType;
 import com.fs.common.enums.BusinessType;
 import com.fs.common.exception.CustomException;
 import com.fs.common.exception.CustomException;
 import com.fs.common.exception.base.BaseException;
 import com.fs.common.exception.base.BaseException;
@@ -18,6 +19,7 @@ import com.fs.company.service.ICompanyService;
 import com.fs.company.service.ICompanyUserService;
 import com.fs.company.service.ICompanyUserService;
 import com.fs.course.param.FsCourseListBySidebarParam;
 import com.fs.course.param.FsCourseListBySidebarParam;
 import com.fs.qw.domain.QwExternalContactInfo;
 import com.fs.qw.domain.QwExternalContactInfo;
+import com.fs.qw.domain.QwSopTempVoiceGroup;
 import com.fs.qw.domain.QwTagGroup;
 import com.fs.qw.domain.QwTagGroup;
 import com.fs.qw.domain.QwUser;
 import com.fs.qw.domain.QwUser;
 import com.fs.qw.param.ExternalContactDetailsParam;
 import com.fs.qw.param.ExternalContactDetailsParam;
@@ -26,6 +28,7 @@ import com.fs.qw.param.sidebar.TagGroupListParam;
 import com.fs.qw.param.sidebar.TagGroupUpdateParam;
 import com.fs.qw.param.sidebar.TagGroupUpdateParam;
 import com.fs.qw.service.IQwExternalContactInfoService;
 import com.fs.qw.service.IQwExternalContactInfoService;
 import com.fs.qw.service.IQwExternalContactService;
 import com.fs.qw.service.IQwExternalContactService;
+import com.fs.qw.service.IQwSopTempVoiceGroupService;
 import com.fs.qw.service.IQwTagGroupService;
 import com.fs.qw.service.IQwTagGroupService;
 import com.fs.qw.vo.ExternalContactDetailsVO;
 import com.fs.qw.vo.ExternalContactDetailsVO;
 import com.fs.qw.vo.QwExternalListByHeavyVO;
 import com.fs.qw.vo.QwExternalListByHeavyVO;
@@ -41,6 +44,7 @@ import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
 import io.swagger.annotations.ApiParam;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
 
 
@@ -82,6 +86,9 @@ public class ApisQwUserController extends BaseController {
     @Autowired
     @Autowired
     private IQwSopTempVoiceService sopTempVoiceService;
     private IQwSopTempVoiceService sopTempVoiceService;
 
 
+    @Autowired
+    private IQwSopTempVoiceGroupService qwSopTempVoiceGroupService;
+
 
 
     @GetMapping("/details")
     @GetMapping("/details")
     @ApiOperation("会员看课详情")
     @ApiOperation("会员看课详情")
@@ -246,9 +253,20 @@ public class ApisQwUserController extends BaseController {
         }
         }
 
 
         PageHelper.startPage(param.getPageNum(), param.getPageSize());
         PageHelper.startPage(param.getPageNum(), param.getPageSize());
-        List<QwSopTempVoice> voiceList = sopTempVoiceService.selectQwSopTempVoiceByCompanyUserId(qwUser.getCompanyUserId(),param.getKeyword());
+        List<QwSopTempVoice> voiceList = sopTempVoiceService.selectQwSopTempVoiceByCompanyUserId(qwUser.getCompanyUserId(),param.getKeyword(),param.getGroupId());
         PageInfo<QwSopTempVoice> result = new PageInfo<>(voiceList);
         PageInfo<QwSopTempVoice> result = new PageInfo<>(voiceList);
         return R.ok().put("data", result);
         return R.ok().put("data", result);
     }
     }
 
 
+    /**
+     * 查询语音分类-主要是区分侧边栏语音类型列表
+     */
+
+    @PostMapping("/voiceGroupList")
+    public TableDataInfo list(@RequestBody QwSopTempVoiceGroup qwSopTempVoiceGroup)
+    {
+        startPage();
+        List<QwSopTempVoiceGroup> list = qwSopTempVoiceGroupService.selectQwSopTempVoiceGroupList(qwSopTempVoiceGroup);
+        return getDataTable(list);
+    }
 }
 }

+ 68 - 9
fs-user-app/src/main/java/com/fs/app/controller/AppBaseController.java

@@ -15,6 +15,8 @@ import com.fs.common.utils.StringUtils;
 import com.fs.common.utils.sql.SqlUtil;
 import com.fs.common.utils.sql.SqlUtil;
 import com.fs.company.domain.CompanyUserUser;
 import com.fs.company.domain.CompanyUserUser;
 import com.fs.company.service.ICompanyUserUserService;
 import com.fs.company.service.ICompanyUserUserService;
+import com.fs.his.domain.FsUser;
+import com.fs.his.service.IFsUserService;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.github.pagehelper.PageInfo;
 import io.jsonwebtoken.Claims;
 import io.jsonwebtoken.Claims;
@@ -33,6 +35,9 @@ public class AppBaseController {
 	@Autowired
 	@Autowired
 	private ICompanyUserUserService companyUserUserService;
 	private ICompanyUserUserService companyUserUserService;
 
 
+	@Autowired
+	private IFsUserService userService;
+
 	/**
 	/**
 	* 用户token
 	* 用户token
 	*/
 	*/
@@ -49,18 +54,65 @@ public class AppBaseController {
 	 */
 	 */
 	public String getUserId()
 	public String getUserId()
 	{
 	{
-		String headValue =  ServletUtils.getRequest().getHeader("APPToken");
-		if (StringUtils.isNotEmpty(headValue)){
-			Claims claims=jwtUtils.getClaimByToken(headValue);
-			if(claims!=null){
-				String userId = claims.getSubject().toString();
+//		String headValue =  ServletUtils.getRequest().getHeader("APPToken");
+//		if (StringUtils.isNotEmpty(headValue)){
+//			Claims claims=jwtUtils.getClaimByToken(headValue);
+//			if(claims!=null){
+//				String userId = claims.getSubject().toString();
+//				return userId;
+//			}
+//			else{
+//				return null;
+//			}
+//		}
+//		return null;
+		// 1. 获取请求头
+		String headValue = ServletUtils.getRequest().getHeader("APPToken");
+		if (StringUtils.isEmpty(headValue)) {
+			return null;
+		}
+
+		// 2. 解析 Token
+		Claims claims;
+		try {
+			claims = jwtUtils.getClaimByToken(headValue);
+		} catch (Exception e) {
+			return null;
+		}
+		if (claims == null) {
+			return null;
+		}
+
+		// 3. 获取用户ID
+		String userId = claims.getSubject();
+		if (StringUtils.isEmpty(userId)) {
+			return null;
+		}
+
+		// 4. 校验用户状态(带异常保护)
+		try {
+			FsUser user = userService.selectFsUserByUserId(Long.parseLong(userId));
+			if (user != null && user.getStatus() == 1) {
 				return userId;
 				return userId;
+			}else {
+				throw new CustomException("用户不存在或被禁用", 403);
 			}
 			}
-			else{
-				return null;
-			}
+		} catch (NumberFormatException e) {
+			return null;
 		}
 		}
-		return null;
+	}
+
+
+	/**
+	 * 获取销售用户ID;未携带/无效 companyUserToken 时返回 null(不抛异常,用于身份判断)
+	 */
+	public Long getCompanyUserIdOrNull()
+	{
+		String companyUserToken = ServletUtils.getRequest().getHeader("companyUserToken");
+		if (StringUtils.isEmpty(companyUserToken)) {
+			return null;
+		}
+		return redisCache.getCacheObject("company-user-token:" + companyUserToken);
 	}
 	}
 
 
 	/**
 	/**
@@ -193,6 +245,13 @@ public class AppBaseController {
 	}
 	}
 
 
 
 
+	protected R denyIfNotCurrentUser(Long userId) {
+		if (!isCurrentUser(userId)) {
+			return R.error("非法操作");
+		}
+		return null;
+	}
+
 	/**
 	/**
 	* 互医 客服登录(问诊 套餐包订单版)
 	* 互医 客服登录(问诊 套餐包订单版)
 	*/
 	*/

+ 2 - 2
fs-user-app/src/main/java/com/fs/app/controller/AppLoginController.java

@@ -605,9 +605,9 @@ public class AppLoginController extends AppBaseController{
                 update.setUserId(user.getUserId());
                 update.setUserId(user.getUserId());
                 userService.updateFsUser(update);
                 userService.updateFsUser(update);
             }
             }
-            /*if (user.getStatus()==0){
+            if (user.getStatus()==0){
                 return R.error("登录失败,账户被禁用");
                 return R.error("登录失败,账户被禁用");
-            }*/
+            }
             int isFirstLogin = userNewTaskService.performTaskOne(user.getUserId());
             int isFirstLogin = userNewTaskService.performTaskOne(user.getUserId());
             String token = jwtUtils.generateToken(user.getUserId());
             String token = jwtUtils.generateToken(user.getUserId());
             redisCache.setCacheObject("userToken:" + user.getUserId(), token, 604800, TimeUnit.SECONDS);
             redisCache.setCacheObject("userToken:" + user.getUserId(), token, 604800, TimeUnit.SECONDS);