| 
														
															@@ -5,11 +5,14 @@ import cn.binarywang.wx.miniapp.bean.WxMaJscode2SessionResult; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo; 
														 | 
														
														 | 
														
															 import cn.binarywang.wx.miniapp.bean.WxMaPhoneNumberInfo; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import cn.binarywang.wx.miniapp.bean.WxMaUserInfo; 
														 | 
														
														 | 
														
															 import cn.binarywang.wx.miniapp.bean.WxMaUserInfo; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import cn.hutool.core.date.DateTime; 
														 | 
														
														 | 
														
															 import cn.hutool.core.date.DateTime; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+import com.fs.app.annotation.Login; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.fs.app.param.LoginMaWxParam; 
														 | 
														
														 | 
														
															 import com.fs.app.param.LoginMaWxParam; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.fs.app.utils.JwtUtils; 
														 | 
														
														 | 
														
															 import com.fs.app.utils.JwtUtils; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.fs.common.core.domain.R; 
														 | 
														
														 | 
														
															 import com.fs.common.core.domain.R; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+import com.fs.common.core.redis.RedisCache; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.fs.common.exception.CustomException; 
														 | 
														
														 | 
														
															 import com.fs.common.exception.CustomException; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.fs.common.utils.IpUtil; 
														 | 
														
														 | 
														
															 import com.fs.common.utils.IpUtil; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+import com.fs.common.utils.ServletUtils; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.fs.company.domain.CompanyDept; 
														 | 
														
														 | 
														
															 import com.fs.company.domain.CompanyDept; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.fs.company.domain.CompanyUser; 
														 | 
														
														 | 
														
															 import com.fs.company.domain.CompanyUser; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.fs.company.service.ICompanyDeptService; 
														 | 
														
														 | 
														
															 import com.fs.company.service.ICompanyDeptService; 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -18,6 +21,7 @@ import com.fs.core.security.SecurityUtils; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.fs.store.service.IFsUserService; 
														 | 
														
														 | 
														
															 import com.fs.store.service.IFsUserService; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.fs.wx.miniapp.config.WxMaConfiguration; 
														 | 
														
														 | 
														
															 import com.fs.wx.miniapp.config.WxMaConfiguration; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import com.fs.wx.miniapp.config.WxMaProperties; 
														 | 
														
														 | 
														
															 import com.fs.wx.miniapp.config.WxMaProperties; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+import io.jsonwebtoken.Claims; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import io.swagger.annotations.Api; 
														 | 
														
														 | 
														
															 import io.swagger.annotations.Api; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import io.swagger.annotations.ApiOperation; 
														 | 
														
														 | 
														
															 import io.swagger.annotations.ApiOperation; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import me.chanjar.weixin.common.error.WxErrorException; 
														 | 
														
														 | 
														
															 import me.chanjar.weixin.common.error.WxErrorException; 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -25,10 +29,7 @@ import org.apache.commons.lang3.StringUtils; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import org.slf4j.Logger; 
														 | 
														
														 | 
														
															 import org.slf4j.Logger; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import org.slf4j.LoggerFactory; 
														 | 
														
														 | 
														
															 import org.slf4j.LoggerFactory; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import org.springframework.beans.factory.annotation.Autowired; 
														 | 
														
														 | 
														
															 import org.springframework.beans.factory.annotation.Autowired; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-import org.springframework.web.bind.annotation.PostMapping; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-import org.springframework.web.bind.annotation.RequestBody; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-import org.springframework.web.bind.annotation.RequestMapping; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-import org.springframework.web.bind.annotation.RestController; 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+import org.springframework.web.bind.annotation.*; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import java.util.Date; 
														 | 
														
														 | 
														
															 import java.util.Date; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 import java.util.Objects; 
														 | 
														
														 | 
														
															 import java.util.Objects; 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -45,14 +46,17 @@ public class WxCompanyUserController extends AppBaseController { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     @Autowired 
														 | 
														
														 | 
														
															     @Autowired 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     JwtUtils jwtUtils; 
														 | 
														
														 | 
														
															     JwtUtils jwtUtils; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    @Autowired 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    RedisCache redisCache; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     @Autowired 
														 | 
														
														 | 
														
															     @Autowired 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     private ICompanyUserService companyUserService; 
														 | 
														
														 | 
														
															     private ICompanyUserService companyUserService; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															     @Autowired 
														 | 
														
														 | 
														
															     @Autowired 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     private ICompanyDeptService companyDeptService; 
														 | 
														
														 | 
														
															     private ICompanyDeptService companyDeptService; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    @ApiOperation("授权登录") 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															-    @PostMapping("/login") 
														 | 
														
														 | 
														
															 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    @ApiOperation("小程序-销售授权登录") 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    @PostMapping("/loginByMa") 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     public R login(@RequestBody LoginMaWxParam param) { 
														 | 
														
														 | 
														
															     public R login(@RequestBody LoginMaWxParam param) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         if (StringUtils.isBlank(param.getCode())) { 
														 | 
														
														 | 
														
															         if (StringUtils.isBlank(param.getCode())) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															             return R.error("code不存在"); 
														 | 
														
														 | 
														
															             return R.error("code不存在"); 
														 | 
													
												
											
										
											
												
													
														 | 
														
															@@ -126,5 +130,32 @@ public class WxCompanyUserController extends AppBaseController { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															         } 
														 | 
														
														 | 
														
															         } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															     } 
														 | 
														
														 | 
														
															     } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    @Login(isMiniLogin = true) 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    @ApiOperation("获取销售通过小程序登录后的用户信息") 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    @GetMapping("/getMaUser") 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    public R getUserInfo() { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        try { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            CompanyUser companyUser = companyUserService.selectCompanyUserById(Long.parseLong(getUserId())); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            if (companyUser == null) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+                return R.error(401, "用户信息不存在"); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            return R.ok().put("user", companyUser); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        } catch (Exception e) { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+            return R.error("操作异常"); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    /** 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+     * 特殊要求:销售小程序临时登录,登录后页面中还有一个之前常用的登录,所以为了区分,token名称不能跟之前的一样 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+     * 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+     * @return 用户id 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+     */ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    public String getUserId() { 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        String headValue = ServletUtils.getRequest().getHeader("UserToken"); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        Claims claims = jwtUtils.getClaimByToken(headValue); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        String userId = claims.getSubject().toString(); 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+        return userId; 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+    } 
														 | 
													
												
											
												
													
														| 
														 | 
														
															 
														 | 
														
														 | 
														
															+ 
														 | 
													
												
											
												
													
														| 
														 | 
														
															  
														 | 
														
														 | 
														
															  
														 | 
													
												
											
												
													
														| 
														 | 
														
															 } 
														 | 
														
														 | 
														
															 } 
														 |