Commit a440a8c9 by fudahua

Merge remote-tracking branch 'origin/developer' into developer

parents 6b9dfb2b 82034fd2
......@@ -158,5 +158,7 @@ public interface DepartmentApiService {
* @return
*/
ServiceResponse<List<DepartmentDTO>> listStoreListByStaffId(String wxUserId);
void initwxDepartmentMQ(String res);
}
......@@ -38,6 +38,9 @@ import com.gic.haoban.manage.service.dao.mapper.TabHaobanAuditMapper;
import com.gic.haoban.manage.service.entity.TabHaobanAudit;
import com.gic.haoban.manage.service.entity.TabHaobanDepartment;
import com.gic.haoban.manage.service.entity.TabHaobanStaff;
import com.gic.haoban.message.api.dto.MessageDTO;
import com.gic.wechat.api.dto.qywx.QywxXcxSendMessageDTO;
import com.gic.wechat.api.service.qywx.QywxSuiteApiService;
import com.github.pagehelper.PageHelper;
/**
......@@ -55,6 +58,8 @@ public class AuditApiServiceImpl implements AuditApiService{
private StaffMapper staffMapper;
@Autowired
private StoreService storeService;
@Autowired
private QywxSuiteApiService qywxSuiteApiService;
@Override
public Page<AuditDTO> page(Integer auditType, String search,String wxEnterpriseId,
......@@ -112,6 +117,8 @@ public class AuditApiServiceImpl implements AuditApiService{
String newValue = tab.getNewValue();
String changeField = tab.getChangeField();
this.editStoreInfo(storeId, changeField, oldValue, newValue);
// QywxXcxSendMessageDTO messageDTO = new QywxXcxSendMessageDTO();
// qywxSuiteApiService.sendMessage("ww9ede832a84b7ae5f","ww2c34dc56739bb105", messageDTO);
}
@Override
public void refuse(String auditId, String auditReason,String auditName) {
......
......@@ -523,25 +523,29 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
}
}
for(com.gic.wechat.api.dto.qywx.DepartmentDTO departmentDTO : list){
if (parentId.equals(departmentDTO.getParentid())) {
TabHaobanDepartment exist = this.departmentService.getByWxId(departmentDTO.getId() + "", wxEnterpriseId);
logger.info("分组是否存在:{}", JSON.toJSONString(exist));
if(exist == null){
com.gic.haoban.manage.api.dto.DepartmentDTO dto = new com.gic.haoban.manage.api.dto.DepartmentDTO();
dto.setDepartmentName(departmentDTO.getName());
dto.setLevel(level);
dto.setWxEnterpriseId(wxEnterpriseId);
dto.setWxDepartmentId(departmentDTO.getId()+"");
dto.setParentDepartmentId(pId);
dto.setChainId(chainId);
dto.setChainName(chainName);
dto.setSort(departmentDTO.getOrder());
dto.setIsStore(0);
this.departmentService.add(dto);
try {
if (parentId.equals(departmentDTO.getParentid())) {
TabHaobanDepartment exist = this.departmentService.getByWxId(departmentDTO.getId() + "", wxEnterpriseId);
logger.info("分组是否存在:{}", JSON.toJSONString(exist));
if(exist == null){
com.gic.haoban.manage.api.dto.DepartmentDTO dto = new com.gic.haoban.manage.api.dto.DepartmentDTO();
dto.setDepartmentName(departmentDTO.getName());
dto.setLevel(level);
dto.setWxEnterpriseId(wxEnterpriseId);
dto.setWxDepartmentId(departmentDTO.getId()+"");
dto.setParentDepartmentId(pId);
dto.setChainId(chainId);
dto.setChainName(chainName);
dto.setSort(departmentDTO.getOrder());
dto.setIsStore(0);
this.departmentService.add(dto);
}
}
this.addAllDepartment(list, departmentDTO.getId(), wxEnterpriseId, corpid, contactSecret);
this.staffApiService.initWxUser(corpid, contactSecret, wxEnterpriseId, departmentDTO.getId());
} catch (Exception e) {
}
this.addAllDepartment(list, departmentDTO.getId(), wxEnterpriseId, corpid, contactSecret);
this.staffApiService.initWxUser(corpid, contactSecret, wxEnterpriseId, departmentDTO.getId());
}
}
......@@ -620,4 +624,17 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
rer.setResult(departmentList);
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);
}
}
}
}
......@@ -119,8 +119,11 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
log.info("staff关联门店不存在1");
return null;
}
List<String> storeIds = stores.stream().map(s->s.getRelatedId()).collect(Collectors.toList());
List<String> storeIds = stores.stream().filter(s->(s.getRelatedId()!=null || "".equals(s.getRelatedId()))).map(s->s.getRelatedId()).collect(Collectors.toList());
if(CollectionUtil.isEmpty(storeIds)){
log.info("staff关联门店不存在2");
return null;
}
//2、获取member的storeId
for(MemberUnionidRelated tab : list){
String memberId = tab.getMemberId();
......@@ -157,6 +160,12 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
}
String[] memberStoreIds =storeId.split(" ");
List<String> memberStoreIdList = Arrays.asList(memberStoreIds);
if(CollectionUtil.isEmpty(memberStoreIdList)){
log.info("会员门店不存在");
continue;
}
log.info("memberStoreIdList===============>{}",JSONObject.toJSONString(memberStoreIdList));
log.info("storeIds===============>{}",JSONObject.toJSONString(storeIds));
//取交集
memberStoreIdList.retainAll(storeIds);
if(CollectionUtil.isEmpty(memberStoreIdList)){
......
......@@ -11,6 +11,7 @@ import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSON;
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.manage.api.dto.*;
import com.gic.haoban.manage.api.service.ApplicationSettingApiService;
......@@ -35,6 +36,7 @@ import org.springframework.web.bind.annotation.RestController;
import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.api.service.ApplicationApiService;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import com.gic.haoban.manage.web.utils.RouterConstant;
import javax.servlet.http.HttpServletResponse;
......@@ -115,6 +117,31 @@ public class ApplicationController extends WebBaseController{
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")
public HaobanResponse getAuthUrl(){
......
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