Commit 99874cac by qwmqiuwenmin

fix

parent fc8e3ad3
......@@ -218,7 +218,7 @@ public class StaffApiServiceImpl implements StaffApiService {
TabHaobanStaff staff = staffService.selectByUserId(userId);
if(staff == null) {
WxEnterpriseDTO enterpriseDTO = wxEnterpriseService.selectById(staff.getWxEnterpriseId());
WxEnterpriseDTO enterpriseDTO = wxEnterpriseService.selectById(wxEnterpriseId);
TabHaobanWxApplication application = wxApplicationService.selectByWxEnterpriseIdAndApplicationType(staff.getWxEnterpriseId(),1);
if(enterpriseDTO != null) {
if(application != null) {
......
......@@ -265,10 +265,7 @@ public class DepartmentContoller extends WebBaseController{
@RequestMapping("unbind-department-list")
public HaobanResponse unbindDepartmentList(String departmentId,String enterpriseId,Integer type) {
List<String> list = new ArrayList<String>();
list.add(departmentId);
List<GicTreeDTO> departmentList = storeGroupService.listGicTree(enterpriseId,type, departmentId);
List<DepartmentDTO> dtoList = new ArrayList<DepartmentDTO>();
for (GicTreeDTO departmentDTO : departmentList) {
DepartmentDTO dto = departmentApiService.selectByRelatedId(departmentDTO.getId());
......
package com.gic.haoban.manage.web.controller;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -11,13 +12,17 @@ import com.alibaba.fastjson.JSON;
import com.gic.commons.web.ResponseThreadLocal;
import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.api.dto.StaffDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseDTO;
import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.api.service.WxEnterpriseApiService;
import com.gic.haoban.manage.web.anno.IgnoreLogin;
import com.gic.haoban.manage.web.auth.AuthRequestUtil;
import com.gic.haoban.manage.web.config.Config;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import com.gic.haoban.manage.web.vo.LoginVO;
import com.gic.wechat.api.dto.qywx.UserDTO;
import com.gic.wechat.api.service.qywx.QywxCorpApiService;
import com.gic.wechat.api.service.qywx.QywxUserApiService;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
......@@ -37,17 +42,31 @@ public class LoginController extends WebBaseController{
@Autowired
private QywxCorpApiService qywxCorpApiService;
@Autowired
private WxEnterpriseApiService wxEnterpriseApiService;
@Autowired
private Config config;
@RequestMapping("login")
public void login(String auth_code,HttpServletResponse response) {
String siteId = config.getSuiteId();
//String userId = qywxCorpApiService.getUserInfoSimple(siteId,auth_code);
String userId = qywxCorpApiService.getLoginUserInfo(config.getCorpid(), auth_code);
logger.info("【企业微信登录】userId={},auth_code={}",userId,auth_code);
StaffDTO loginStaff = staffApiService.selectByUserId(userId);
String userJson = qywxCorpApiService.getLoginUserInfo(config.getCorpid(), auth_code);
if(StringUtils.isBlank(userJson)){
return ;
}
UserDTO user = JSON.parseObject(userJson, UserDTO.class);
logger.info("【企业微信登录】userId={},auth_code={}",user.getUserid(),auth_code);
StaffDTO loginStaff = staffApiService.selectByUserId(user.getUserid());
if(loginStaff == null){
String corpId = user.getCorpid();
WxEnterpriseDTO enterprise = wxEnterpriseApiService.getEnterpriseBycorpId(corpId);
if(enterprise != null){
staffApiService.wxGetAdd(user.getUserid(),enterprise.getWxEnterpriseId());
loginStaff = staffApiService.selectByUserId(user.getUserid());
}
}
LoginVO loginVO = new LoginVO();
StaffDTO staff = staffApiService.selectById("1");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment