Commit 1a46a4e5 by qwmqiuwenmin

fix

parent 2e1f6cab
...@@ -159,4 +159,6 @@ public interface DepartmentApiService { ...@@ -159,4 +159,6 @@ public interface DepartmentApiService {
*/ */
ServiceResponse<List<DepartmentDTO>> listStoreListByStaffId(String wxUserId); ServiceResponse<List<DepartmentDTO>> listStoreListByStaffId(String wxUserId);
void initwxDepartmentMQ(String res);
} }
...@@ -523,6 +523,7 @@ public class DepartmentApiServiceImpl implements DepartmentApiService { ...@@ -523,6 +523,7 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
} }
} }
for(com.gic.wechat.api.dto.qywx.DepartmentDTO departmentDTO : list){ for(com.gic.wechat.api.dto.qywx.DepartmentDTO departmentDTO : list){
try {
if (parentId.equals(departmentDTO.getParentid())) { if (parentId.equals(departmentDTO.getParentid())) {
TabHaobanDepartment exist = this.departmentService.getByWxId(departmentDTO.getId() + "", wxEnterpriseId); TabHaobanDepartment exist = this.departmentService.getByWxId(departmentDTO.getId() + "", wxEnterpriseId);
logger.info("分组是否存在:{}", JSON.toJSONString(exist)); logger.info("分组是否存在:{}", JSON.toJSONString(exist));
...@@ -539,11 +540,14 @@ public class DepartmentApiServiceImpl implements DepartmentApiService { ...@@ -539,11 +540,14 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
dto.setIsStore(0); dto.setIsStore(0);
this.departmentService.add(dto); this.departmentService.add(dto);
} }
}
} catch (Exception e) {
}
this.addAllDepartment(list, departmentDTO.getId(), wxEnterpriseId, corpid, contactSecret); this.addAllDepartment(list, departmentDTO.getId(), wxEnterpriseId, corpid, contactSecret);
this.staffApiService.initWxUser(corpid, contactSecret, wxEnterpriseId, departmentDTO.getId()); this.staffApiService.initWxUser(corpid, contactSecret, wxEnterpriseId, departmentDTO.getId());
} }
} }
}
@Override @Override
public Integer departmentRecycleCount(String wxEnterpriseId) { public Integer departmentRecycleCount(String wxEnterpriseId) {
...@@ -620,4 +624,17 @@ public class DepartmentApiServiceImpl implements DepartmentApiService { ...@@ -620,4 +624,17 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
rer.setResult(departmentList); rer.setResult(departmentList);
return rer; return rer;
} }
@Override
public void initwxDepartmentMQ(String res) {
WxEnterpriseDTO enterpriseDTO = this.wxEnterpriseService.selectById(res);
if(enterpriseDTO != null){
if(StringUtils.isNotBlank(enterpriseDTO.getContactSecret()) && enterpriseDTO.getContactFlag() != null && enterpriseDTO.getContactFlag() == 0){
this.initwxDepartment(enterpriseDTO.getCorpid(), enterpriseDTO.getContactSecret(), enterpriseDTO.getWxEnterpriseId());
enterpriseDTO.setContactFlag(1);
this.wxEnterpriseService.update(enterpriseDTO);
}
}
}
} }
...@@ -11,6 +11,7 @@ import cn.hutool.core.collection.CollectionUtil; ...@@ -11,6 +11,7 @@ import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.ctrip.framework.apollo.spring.annotation.ApolloConfig; import com.ctrip.framework.apollo.spring.annotation.ApolloConfig;
import com.gic.commons.util.GICMQClientUtil;
import com.gic.haoban.common.utils.GlobalVar; import com.gic.haoban.common.utils.GlobalVar;
import com.gic.haoban.manage.api.dto.*; import com.gic.haoban.manage.api.dto.*;
import com.gic.haoban.manage.api.service.ApplicationSettingApiService; import com.gic.haoban.manage.api.service.ApplicationSettingApiService;
...@@ -35,6 +36,7 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -35,6 +36,7 @@ import org.springframework.web.bind.annotation.RestController;
import com.gic.haoban.common.utils.HaobanResponse; import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.api.service.ApplicationApiService; import com.gic.haoban.manage.api.service.ApplicationApiService;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode; import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import com.gic.haoban.manage.web.utils.RouterConstant;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
...@@ -116,6 +118,31 @@ public class ApplicationController extends WebBaseController{ ...@@ -116,6 +118,31 @@ public class ApplicationController extends WebBaseController{
return resultResponse(HaoBanErrCode.ERR_1, true); return resultResponse(HaoBanErrCode.ERR_1, true);
} }
@RequestMapping("init-wx-department")
public HaobanResponse initWxDepartment(){
LoginVO login = (LoginVO) AuthRequestUtil.getLoginUser();
String wxEnterpriseId = login.getWxEnterpriseId();
WxEnterpriseDTO enterpriseDTO = this.wxEnterpriseApiService.getOne(wxEnterpriseId);
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.initwxDepartmentMQ(enterpriseDTO.getCorpid(), enterpriseDTO.getContactSecret(), enterpriseDTO.getWxEnterpriseId());
// enterpriseDTO.setContactFlag(1);
// wxEnterpriseApiService.update(enterpriseDTO);
}
}
return resultResponse(HaoBanErrCode.ERR_1, true);
}
@RequestMapping("get-auth-url") @RequestMapping("get-auth-url")
public HaobanResponse getAuthUrl(){ public HaobanResponse getAuthUrl(){
String suiteId = config.getSuiteId(); String suiteId = config.getSuiteId();
......
package com.gic.haoban.manage.web.utils;
/**
* @author
*/
public class RouterConstant {
/**
* 分配_服务名
*/
public final static String INIT_WX_DEPARTMENT_SERVICENAME = "com.gic.haoban.manage.api.service.DepartmentApiService";
/**
*
*/
public final static String INIT_WX_DEPARTMENT_METHODNAME = "initwxDepartmentMQ";
/**
* 路由类型(通用)
*/
public final static String ROUTERTYPE = "commonRouter";
public final static String INIT_WX_DEPARTMENT_APP_CODE = "INIT_WX_DEPARTMENT";
/**
* 默认的数据状态
*/
public final static int DEFAULT_STATUS = 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