Commit 8950f7b3 by huangZW

Merge branch 'developer' of http://115.159.76.241/haoban3.0/haoban-manage3.0.git into developer

parents ad0e5976 b39eb848
......@@ -17,6 +17,7 @@ import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.druid.util.StringUtils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.Page;
import com.gic.commons.util.DateUtil;
import com.gic.enterprise.api.dto.EnterpriseAndUserDTO;
......@@ -28,6 +29,7 @@ import com.gic.enterprise.api.service.StoreService;
import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.common.utils.EntityUtil;
import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.common.utils.StringUtil;
import com.gic.haoban.manage.api.dto.DepartmentDTO;
import com.gic.haoban.manage.api.dto.EnterpriseDetailDTO;
import com.gic.haoban.manage.api.dto.QywxCorpInfoSimpleDTO;
......@@ -45,7 +47,10 @@ 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.haoban.manage.web.vo.StoreVo;
import com.gic.wechat.api.dto.qywx.UserDTO;
import com.gic.wechat.api.service.qywx.QywxCorpApiService;
import com.gic.wechat.api.service.qywx.QywxDepartmentApiService;
import com.gic.wechat.api.service.qywx.QywxUserApiService;
import com.gic.wechat.token.api.dto.QywxCorpInfoDTO;
import com.gic.wechat.token.api.service.QywxTokenManageService;
......@@ -65,9 +70,11 @@ public class WxEnterpriseController extends WebBaseController{
@Autowired
private QywxTokenManageService qywxTokenManageService;
@Autowired
private WxApplicationApiService wxApplicationApiService;
private QywxDepartmentApiService qywxDepartmentApiService;
@Autowired
private Config config;
@Autowired
private QywxUserApiService qywxUserApiService;
//授权企业列表
......@@ -224,18 +231,18 @@ public class WxEnterpriseController extends WebBaseController{
LoginVO login = (LoginVO) AuthRequestUtil.getSessionUser();
wxEnterpriseId = login.getWxEnterpriseId();
WxEnterpriseDTO wxEnterprise = wxEnterpriseApiService.getOne(wxEnterpriseId);
if(wxEnterprise != null && (org.apache.commons.lang3.StringUtils.isBlank(wxEnterprise.getContactSecret()) || org.apache.commons.lang3.StringUtils.isBlank(wxEnterprise.getWxSecretKey()))){
if(wxEnterprise != null && org.apache.commons.lang3.StringUtils.isAnyBlank(wxEnterprise.getContactSecret(),wxEnterprise.getWxSecretKey())){
return resultResponse(HaoBanErrCode.ERR_1,false);
}
return resultResponse(HaoBanErrCode.ERR_1,true);
}
//微信企业绑定接口
//微信企业绑定接口绑定通讯录key
@IgnoreLogin
@RequestMapping("wx-enterprise-secret-set")
public HaobanResponse wxEnterpriseSecretSet(String contactSecret,String wxSecretKey) {
if(org.apache.commons.lang3.StringUtils.isAnyBlank(contactSecret,wxSecretKey)){
@RequestMapping("wx-enterprise-contact-secret-set")
public HaobanResponse wxEnterpriseSecretSet(String contactSecret) {
if(org.apache.commons.lang3.StringUtils.isAnyBlank(contactSecret)){
return resultResponse(HaoBanErrCode.ERR_2);
}
String wxEnterpriseId = "";
......@@ -245,11 +252,64 @@ public class WxEnterpriseController extends WebBaseController{
if(wxEnterprise == null){
return resultResponse(HaoBanErrCode.ERR_10012);
}
wxEnterprise.setContactSecret(contactSecret);
UserDTO user = qywxUserApiService.getSelfWorkWxUser(wxEnterprise.getCorpid(), contactSecret, login.getStaffDTO().getWxUserId());
if(user != null){
return resultResponse(HaoBanErrCode.ERR_1,true);
}else{
return resultResponse(HaoBanErrCode.ERR_1,false);
}
}
//微信企业绑定接口绑定通讯录key
@IgnoreLogin
@RequestMapping("wx-enterprise-wx-secret-set")
public HaobanResponse wxEnterpriseWxSecretSet(String wxSecretKey) {
if(org.apache.commons.lang3.StringUtils.isAnyBlank(wxSecretKey)){
return resultResponse(HaoBanErrCode.ERR_2);
}
String wxEnterpriseId = "";
LoginVO login = (LoginVO) AuthRequestUtil.getSessionUser();
wxEnterpriseId = login.getWxEnterpriseId();
WxEnterpriseDTO wxEnterprise = wxEnterpriseApiService.getOne(wxEnterpriseId);
if(wxEnterprise == null){
return resultResponse(HaoBanErrCode.ERR_10012);
}
String res = qywxUserApiService.listSelfExternalUserid(wxEnterprise.getCorpid(), wxSecretKey, login.getStaffDTO().getWxUserId());
if(org.apache.commons.lang3.StringUtils.isBlank(res)){
return resultResponse(HaoBanErrCode.ERR_1,false);
}
JSONObject json = JSON.parseObject(res);
if("0".equals(json.getString("errcode"))){
wxEnterprise.setWxSecretKey(wxSecretKey);
wxEnterpriseApiService.update(wxEnterprise);
return resultResponse(HaoBanErrCode.ERR_1,true);
}else{
return resultResponse(HaoBanErrCode.ERR_1,false);
}
}
//微信企业会员小程序
@IgnoreLogin
@RequestMapping("wx-enterprise-member-secret-set")
public HaobanResponse wxEnterpriseMemberSecretSet(String memberSecret) {
if(org.apache.commons.lang3.StringUtils.isAnyBlank(memberSecret)){
return resultResponse(HaoBanErrCode.ERR_2);
}
String wxEnterpriseId = "";
LoginVO login = (LoginVO) AuthRequestUtil.getSessionUser();
wxEnterpriseId = login.getWxEnterpriseId();
WxEnterpriseDTO wxEnterprise = wxEnterpriseApiService.getOne(wxEnterpriseId);
if(wxEnterprise == null){
return resultResponse(HaoBanErrCode.ERR_10012);
}
UserDTO user = qywxUserApiService.getSelfWorkWxUser(wxEnterprise.getCorpid(), memberSecret, login.getStaffDTO().getWxUserId());
if(user != null){
return resultResponse(HaoBanErrCode.ERR_1,true);
}else{
return resultResponse(HaoBanErrCode.ERR_1,false);
}
}
......
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