Commit 34db97f6 by qwmqiuwenmin

fix

parent 5bd36f54
......@@ -4,14 +4,15 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.alibaba.fastjson.JSON;
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.ApplicationApiService;
import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.api.service.WxEnterpriseApiService;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import com.gic.haoban.manage.web.vo.InfoVo;
import com.gic.wechat.api.dto.qywx.UserDTO;
import com.gic.wechat.api.service.qywx.QywxCorpApiService;
@RestController
......@@ -19,17 +20,27 @@ public class InfoController extends WebBaseController{
public static final String siteId = "ww7d6566614055cf27";
@Autowired
private ApplicationApiService applicationApiService;
@Autowired
private QywxCorpApiService qywxCorpApiService;
@Autowired
private StaffApiService staffApiService;
@Autowired
private WxEnterpriseApiService wxEnterpriseApiService;
@RequestMapping("get-info-by-code")
public HaobanResponse getInfoByCode(String code) {
String userId = qywxCorpApiService.getUserInfoSimple(siteId,code);
String userDTOJson = qywxCorpApiService.getUserInfoSimple(siteId,code);
UserDTO user = JSON.parseObject(userDTOJson, UserDTO.class);
String userId = user.getUserid();
StaffDTO loginStaff = staffApiService.selectByUserId(userId);
if(loginStaff == null){
String corpId = user.getCorpid();
WxEnterpriseDTO enterprise = wxEnterpriseApiService.getEnterpriseBycorpId(corpId);
if(enterprise != null){
staffApiService.wxGetAdd(userId,enterprise.getWxEnterpriseId());
loginStaff = staffApiService.selectByUserId(userId);
}
}
String wxEnterpriseId = loginStaff.getWxEnterpriseId();
WxEnterpriseDTO wxEnterpriseDTO = wxEnterpriseApiService.getOne(wxEnterpriseId);
String accesstoken = qywxCorpApiService.getCorpAccessToken(wxEnterpriseDTO.getCorpid(), siteId);
......
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