Commit db3d9e2d by qwmqiuwenmin

fix

parent 6887849e
......@@ -485,26 +485,26 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
@Override
public void initwxDepartment(String corpid, String contactSecret, String wxEnterpriseId) {
// logger.info("【同步企业微信】wxEnterpriseId={}","init-enterprise-" + wxEnterpriseId);
// String key = "init-enterprise-" + wxEnterpriseId;
// if(RedisUtil.getCache(key) == null){
// RedisUtil.setCache(key,1, 60 * 60L);
// String taskId = StringUtil.randomUUID();
// List<com.gic.wechat.api.dto.qywx.DepartmentDTO> list = this.qywxDepartmentApiService.listSelfDepartment(corpid, contactSecret, null);
// logger.info("企业所有部门数据:{}", JSON.toJSONString(list));
// if(CollectionUtils.isNotEmpty(list)){
// this.addAllDepartment(list, 0, wxEnterpriseId, corpid, contactSecret,taskId);
// }
// }else{
// RedisUtil.delCache(key);
// }
String taskId = StringUtil.randomUUID();
List<com.gic.wechat.api.dto.qywx.DepartmentDTO> list = this.qywxDepartmentApiService.listSelfDepartment(corpid, contactSecret, null);
logger.info("企业所有部门数据:{}", JSON.toJSONString(list));
if(CollectionUtils.isNotEmpty(list)){
this.addAllDepartment(list, 0, wxEnterpriseId, corpid, contactSecret,taskId);
logger.info("【同步企业微信】wxEnterpriseId={}","init-enterprise-" + wxEnterpriseId);
String key = "init-enterprise-" + wxEnterpriseId;
if(RedisUtil.getCache(key) == null){
RedisUtil.setCache(key,1, 60 * 60L);
String taskId = StringUtil.randomUUID();
List<com.gic.wechat.api.dto.qywx.DepartmentDTO> list = this.qywxDepartmentApiService.listSelfDepartment(corpid, contactSecret, null);
logger.info("企业所有部门数据:{}", JSON.toJSONString(list));
if(CollectionUtils.isNotEmpty(list)){
this.addAllDepartment(list, 0, wxEnterpriseId, corpid, contactSecret,taskId);
}
}else{
RedisUtil.delCache(key);
}
// String taskId = StringUtil.randomUUID();
// List<com.gic.wechat.api.dto.qywx.DepartmentDTO> list = this.qywxDepartmentApiService.listSelfDepartment(corpid, contactSecret, null);
// logger.info("企业所有部门数据:{}", JSON.toJSONString(list));
// if(CollectionUtils.isNotEmpty(list)){
// this.addAllDepartment(list, 0, wxEnterpriseId, corpid, contactSecret,taskId);
// }
}
......
......@@ -109,9 +109,16 @@ public class ApplicationController extends WebBaseController{
WxEnterpriseDTO enterpriseDTO = this.wxEnterpriseApiService.getOne(wxEnterpriseId);
if(enterpriseDTO != null){
if(StringUtils.isNotBlank(enterpriseDTO.getContactSecret()) && enterpriseDTO.getContactFlag() != null && enterpriseDTO.getContactFlag() == 0){
this.departmentApiService.initwxDepartmentMQ(enterpriseDTO.getWxEnterpriseId());
enterpriseDTO.setContactFlag(1);
wxEnterpriseApiService.update(enterpriseDTO);
// this.departmentApiService.initwxDepartmentMQ(enterpriseDTO.getWxEnterpriseId());
// enterpriseDTO.setContactFlag(1);
// wxEnterpriseApiService.update(enterpriseDTO);
log.info("【初始化部门调用】{},{},{}",RouterConstant.INIT_WX_DEPARTMENT_SERVICENAME,RouterConstant.INIT_WX_DEPARTMENT_METHODNAME,wxEnterpriseId);
try {
GICMQClientUtil.getClientInstance().sendCommonMessage(RouterConstant.ROUTERTYPE, wxEnterpriseId,
RouterConstant.INIT_WX_DEPARTMENT_SERVICENAME, RouterConstant.INIT_WX_DEPARTMENT_METHODNAME);
} catch (Exception e) {
log.info(e.getMessage(),e);
}
}
}
......@@ -126,14 +133,14 @@ public class ApplicationController extends WebBaseController{
if(enterpriseDTO != null){
if(StringUtils.isNotBlank(enterpriseDTO.getContactSecret()) && enterpriseDTO.getContactFlag() != null){
//
// log.info("【初始化部门调用】{},{},{}",RouterConstant.INIT_WX_DEPARTMENT_SERVICENAME,RouterConstant.INIT_WX_DEPARTMENT_METHODNAME,wxEnterpriseId);
// try {
// GICMQClientUtil.getClientInstance().sendCommonMessage(RouterConstant.ROUTERTYPE, wxEnterpriseId,
// RouterConstant.INIT_WX_DEPARTMENT_SERVICENAME, RouterConstant.INIT_WX_DEPARTMENT_METHODNAME);
// } catch (Exception e) {
// log.info(e.getMessage(),e);
// }
this.departmentApiService.initwxDepartment(enterpriseDTO.getCorpid(), enterpriseDTO.getContactSecret(), enterpriseDTO.getWxEnterpriseId());
log.info("【初始化部门调用】{},{},{}",RouterConstant.INIT_WX_DEPARTMENT_SERVICENAME,RouterConstant.INIT_WX_DEPARTMENT_METHODNAME,wxEnterpriseId);
try {
GICMQClientUtil.getClientInstance().sendCommonMessage(RouterConstant.ROUTERTYPE, wxEnterpriseId,
RouterConstant.INIT_WX_DEPARTMENT_SERVICENAME, RouterConstant.INIT_WX_DEPARTMENT_METHODNAME);
} catch (Exception e) {
log.info(e.getMessage(),e);
}
// this.departmentApiService.initwxDepartment(enterpriseDTO.getCorpid(), enterpriseDTO.getContactSecret(), enterpriseDTO.getWxEnterpriseId());
}
}
......
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