Commit 09c79440 by songyinghui

Merge remote-tracking branch 'origin/master' into feature-content4-3

parents 7eef80bd c1cf7d20
...@@ -28,7 +28,6 @@ public interface DealSyncOperationApiService { ...@@ -28,7 +28,6 @@ public interface DealSyncOperationApiService {
/** /**
* mq拆分 * mq拆分
* 部门同步处理 * 部门同步处理
* "routerName": "departmentSyncDealMq2"
* *
* @param params * @param params
*/ */
......
...@@ -30,6 +30,9 @@ public interface StaffApiService { ...@@ -30,6 +30,9 @@ public interface StaffApiService {
*/ */
ServiceResponse getWxSaveNew(String userId, String wxEnterpriseId); ServiceResponse getWxSaveNew(String userId, String wxEnterpriseId);
// 是否是同步通讯录,如果是不用每次都查询开启联系我的列表
ServiceResponse getWxSaveNew(String userId, String wxEnterpriseId ,boolean isSyncDepart);
/** /**
* 新增成员 * 新增成员
* *
......
...@@ -113,4 +113,6 @@ public interface StoreRangeService { ...@@ -113,4 +113,6 @@ public interface StoreRangeService {
List<String> listStoreIdByName( String wxEnterpriseId, String enterpriseId, String storeName) ; List<String> listStoreIdByName( String wxEnterpriseId, String enterpriseId, String storeName) ;
public boolean hasStore(String wxEnterpriseId , String enterpriseId, String storeId) ;
} }
...@@ -91,11 +91,7 @@ public class MaterialDataAdaptor { ...@@ -91,11 +91,7 @@ public class MaterialDataAdaptor {
if (result.get("data") == null) { if (result.get("data") == null) {
return null; return null;
} }
List<JSONObject> dataList = DataApiUtils.getDataList(result); JSONObject jsonObject = DataApiUtils.getPageOne(result);
if (CollectionUtils.isEmpty(dataList)) {
return null;
}
JSONObject jsonObject = dataList.get(0);
if (jsonObject.isEmpty()) { if (jsonObject.isEmpty()) {
return null; return null;
} }
......
...@@ -3,6 +3,8 @@ package com.gic.haoban.manage.service.service.impl; ...@@ -3,6 +3,8 @@ package com.gic.haoban.manage.service.service.impl;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.Page; import com.gic.api.base.commons.Page;
import com.gic.commons.util.ToolUtil; import com.gic.commons.util.ToolUtil;
import com.gic.enterprise.api.dto.StoreGroupDTO;
import com.gic.enterprise.api.service.StoreGroupService;
import com.gic.haoban.base.api.common.BasePageInfo; import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.common.utils.PageUtil; import com.gic.haoban.common.utils.PageUtil;
import com.gic.haoban.manage.api.dto.StaffClerkRelationDTO; import com.gic.haoban.manage.api.dto.StaffClerkRelationDTO;
...@@ -45,6 +47,8 @@ public class StoreRangeServiceImpl implements StoreRangeService { ...@@ -45,6 +47,8 @@ public class StoreRangeServiceImpl implements StoreRangeService {
@Autowired @Autowired
private StaffClerkRelationService staffClerkRelationService; private StaffClerkRelationService staffClerkRelationService;
@Autowired
private StoreGroupService storeGroupService;
@Override @Override
...@@ -267,4 +271,24 @@ public class StoreRangeServiceImpl implements StoreRangeService { ...@@ -267,4 +271,24 @@ public class StoreRangeServiceImpl implements StoreRangeService {
public List<String> listStoreIdByName(String wxEnterpriseId, String enterpriseId, String storeName) { public List<String> listStoreIdByName(String wxEnterpriseId, String enterpriseId, String storeName) {
return tabHaobanStoreRelationMapper.listStoreIdByName(wxEnterpriseId,enterpriseId,storeName); return tabHaobanStoreRelationMapper.listStoreIdByName(wxEnterpriseId,enterpriseId,storeName);
} }
@Override
public boolean hasStore(String wxEnterpriseId , String enterpriseId, String storeId) {
List<String> storeGroupIds = this.listStoreGroupIdByWxEnterpriseId(wxEnterpriseId, enterpriseId);
if (CollectionUtils.isEmpty(storeGroupIds)) {
logger.info("好办门店分组id为空");
return false ;
}
String[] array = storeGroupIds.toArray(new String[0]);
List<StoreGroupDTO> storeGroupDTOS = storeGroupService.listStoreGroup(array, enterpriseId);
List<String> parentGroupIds = storeGroupDTOS.stream().map(StoreGroupDTO::getParentGroupId).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(parentGroupIds) && parentGroupIds.contains("0")) {
logger.info("企微包含所有门店",wxEnterpriseId);
return true ;
}
if(isFlagByStoreId(storeId,wxEnterpriseId,enterpriseId)) {
return true ;
}
return false ;
}
} }
...@@ -95,7 +95,6 @@ public class AuditApiServiceImpl implements AuditApiService { ...@@ -95,7 +95,6 @@ public class AuditApiServiceImpl implements AuditApiService {
return PageUtil.changePageHelperToCurrentPage(page, AuditDTO.class); return PageUtil.changePageHelperToCurrentPage(page, AuditDTO.class);
} }
@Transactional
@Override @Override
public String audit(String batchId, String auditId, String auditName, String optStaffId) { public String audit(String batchId, String auditId, String auditName, String optStaffId) {
TabHaobanAudit tab = auditMapper.selectByPrimaryKey(auditId); TabHaobanAudit tab = auditMapper.selectByPrimaryKey(auditId);
......
...@@ -526,9 +526,10 @@ public class DealSyncOperationApiServiceImpl implements DealSyncOperationApiServ ...@@ -526,9 +526,10 @@ public class DealSyncOperationApiServiceImpl implements DealSyncOperationApiServ
return page; return page;
} }
// 同步通讯录
@Override @Override
public String dealQywxDepartment(String taskId, String wxEnterpriseId) { public String dealQywxDepartment(String taskId, String wxEnterpriseId) {
logger.info("同步通讯录开始={},taskId={}",wxEnterpriseId,taskId);
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId) ; WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId) ;
SecretSettingDTO secretSetting = secretSettingService.getSecretSetting(qwDTO.getWxEnterpriseId(), SecretTypeEnum.CUSTOMIZED_APP.getVal()); SecretSettingDTO secretSetting = secretSettingService.getSecretSetting(qwDTO.getWxEnterpriseId(), SecretTypeEnum.CUSTOMIZED_APP.getVal());
if (null == secretSetting || secretSetting.getCheckFlag() == 0) { if (null == secretSetting || secretSetting.getCheckFlag() == 0) {
...@@ -732,7 +733,7 @@ public class DealSyncOperationApiServiceImpl implements DealSyncOperationApiServ ...@@ -732,7 +733,7 @@ public class DealSyncOperationApiServiceImpl implements DealSyncOperationApiServ
GicMQClient clientInstance = GICMQClientUtil.getClientInstance(); GicMQClient clientInstance = GICMQClientUtil.getClientInstance();
try { try {
logger.info("放入mq={},{}",mqName,JSON.toJSONString(listRet)); logger.info("放入mq={},{}",mqName,JSON.toJSONString(listRet));
clientInstance.sendBatchMessages(mqName, listRet, 1); clientInstance.sendBatchMessages(mqName, listRet, 10);
} catch (Exception e) { } catch (Exception e) {
logger.info("发送失败:{},{}", taskId, JSONObject.toJSONString(listRet)); logger.info("发送失败:{},{}", taskId, JSONObject.toJSONString(listRet));
e.printStackTrace(); e.printStackTrace();
...@@ -894,8 +895,9 @@ public class DealSyncOperationApiServiceImpl implements DealSyncOperationApiServ ...@@ -894,8 +895,9 @@ public class DealSyncOperationApiServiceImpl implements DealSyncOperationApiServ
this.syncTaskService.updateTaskStatus(taskId,4) ; this.syncTaskService.updateTaskStatus(taskId,4) ;
} }
if(task.getCreateTime().getTime()+1000*60*60*3< System.currentTimeMillis()) { if(task.getCreateTime().getTime()+1000*60*60*3< System.currentTimeMillis()) {
logger.info("超过3小时taskId={},{}",taskId); logger.info("超过3小时taskId={}",taskId);
it.remove(); it.remove();
RedisUtil.delLocalCache("department-list-cache-" + task.getWxEnterpriseId());
continue; continue;
} }
boolean flag = this.syncDepartmentStaffTask(taskId,type) ; boolean flag = this.syncDepartmentStaffTask(taskId,type) ;
...@@ -934,7 +936,10 @@ public class DealSyncOperationApiServiceImpl implements DealSyncOperationApiServ ...@@ -934,7 +936,10 @@ public class DealSyncOperationApiServiceImpl implements DealSyncOperationApiServ
TabHaobanSyncTask syncTask = syncTaskService.getSyncTask(taskId); TabHaobanSyncTask syncTask = syncTaskService.getSyncTask(taskId);
String wxEnterpriseId = syncTask.getWxEnterpriseId(); String wxEnterpriseId = syncTask.getWxEnterpriseId();
this.unlockTask(wxEnterpriseId) ; this.unlockTask(wxEnterpriseId) ;
this.cleanDiffrence(wxEnterpriseId, taskId);
logger.info("同步通讯录完成"); logger.info("同步通讯录完成");
String conectkey = "get_follow_user_list:"+wxEnterpriseId ;
RedisUtil.delCache(conectkey) ;
RedisUtil.unlock(key); RedisUtil.unlock(key);
} }
return true ; return true ;
...@@ -970,6 +975,8 @@ public class DealSyncOperationApiServiceImpl implements DealSyncOperationApiServ ...@@ -970,6 +975,8 @@ public class DealSyncOperationApiServiceImpl implements DealSyncOperationApiServ
List<String> dataIds = preDealService.listReDataIdByPDataId(taskId, stffId, PreDealTypeEnum.friend.getVal()); List<String> dataIds = preDealService.listReDataIdByPDataId(taskId, stffId, PreDealTypeEnum.friend.getVal());
if (CollectionUtils.isEmpty(dataIds)) { if (CollectionUtils.isEmpty(dataIds)) {
logger.info("无第三方的数据/自建"); logger.info("无第三方的数据/自建");
String staffLockKey = DealSyncOperationApiServiceImpl.FRIEND_LOCK + stffId;
RedisUtil.delCache(staffLockKey);
preDealService.updateStatusByDataId(taskId, stffId, PreDealTypeEnum.friend_clerk.getVal(), PreDealStatusEnum.computed.getVal(), "成功"); preDealService.updateStatusByDataId(taskId, stffId, PreDealTypeEnum.friend_clerk.getVal(), PreDealStatusEnum.computed.getVal(), "成功");
} else { } else {
sendToMq(taskId, new HashSet<>(dataIds), SyncTaskStatusEnum.friend_sync,null); sendToMq(taskId, new HashSet<>(dataIds), SyncTaskStatusEnum.friend_sync,null);
......
...@@ -205,9 +205,9 @@ public class MessageApiServiceImpl implements MessageApiService { ...@@ -205,9 +205,9 @@ public class MessageApiServiceImpl implements MessageApiService {
Set<String> wxSet = Sets.newHashSet( Set<String> wxSet = Sets.newHashSet(
// 鸿星尔克 // 鸿星尔克
"e034e2bd5d0b44d3bf553c9f8204094c", "e034e2bd5d0b44d3bf553c9f8204094c",
// 润臣测试环境 // 达摩科技
"b18ffdc9d0644912865a248859914d80", "b18ffdc9d0644912865a248859914d80",
// 尊兴 // 达摩科技-生产
"fb40256db41142a196b21ccf03e58507", "fb40256db41142a196b21ccf03e58507",
// 金华悦行 // 金华悦行
"ac451a350eed4a96958dd5c7377f8bd9"); "ac451a350eed4a96958dd5c7377f8bd9");
...@@ -243,7 +243,15 @@ public class MessageApiServiceImpl implements MessageApiService { ...@@ -243,7 +243,15 @@ public class MessageApiServiceImpl implements MessageApiService {
log.info("职务名称:position:{}", position); log.info("职务名称:position:{}", position);
clerkQwDTO.setClerkType(StringUtils.isBlank(position) ? 0 : position.contains("店长") ? 1 : 0); clerkQwDTO.setClerkType(StringUtils.isBlank(position) ? 0 : position.contains("店长") ? 1 : 0);
clerkQwDTO.setClerkGener(dto.getGender()); clerkQwDTO.setClerkGener(dto.getGender());
clerkQwDTO.setPhoneNumber(dto.getMobile()); if(StringUtils.isBlank(dto.getMobile()) && dto.getUserid().startsWith("51") && dto.getUserid().length()==12) {
clerkQwDTO.setPhoneNumber(dto.getUserid().substring(1));
}else {
clerkQwDTO.setPhoneNumber(dto.getMobile());
}
if(StringUtils.isBlank(clerkQwDTO.getPhoneNumber())) {
log.info("导购手机号不存在{}",dto.getUserid());
return ;
}
clerkQwDTO.setNationcode(dto.getTelephone()); clerkQwDTO.setNationcode(dto.getTelephone());
// 调用换导购接口逻辑 // 调用换导购接口逻辑
clerkService.syncClerkForQw(clerkQwDTO); clerkService.syncClerkForQw(clerkQwDTO);
......
...@@ -25,6 +25,7 @@ import com.gic.haoban.manage.service.util.DingUtils; ...@@ -25,6 +25,7 @@ import com.gic.haoban.manage.service.util.DingUtils;
import com.gic.member.api.dto.MemberTagDTO; import com.gic.member.api.dto.MemberTagDTO;
import com.gic.member.api.service.MemberTagService; import com.gic.member.api.service.MemberTagService;
import com.gic.member.tag.api.dto.MemberTagItemDTO; import com.gic.member.tag.api.dto.MemberTagItemDTO;
import com.gic.member.tag.api.service.MemberTagApiService;
import com.gic.member.tag.api.service.MemberTagItemApiService; import com.gic.member.tag.api.service.MemberTagItemApiService;
import com.gic.mq.sdk.GicMQClient; import com.gic.mq.sdk.GicMQClient;
import com.gic.redis.data.util.RedisUtil; import com.gic.redis.data.util.RedisUtil;
...@@ -89,6 +90,8 @@ public class QywxTagApiServiceImpl implements QywxTagApiService { ...@@ -89,6 +90,8 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
private MemberTagItemApiService memberTagItemApiService; private MemberTagItemApiService memberTagItemApiService;
@Autowired @Autowired
private QywxTagRelationMapper qywxTagRelationMapper; private QywxTagRelationMapper qywxTagRelationMapper;
@Autowired
private MemberTagApiService memberTagApiService;
@Override @Override
public void pullQywxTag(String wxEnterpriseId) { public void pullQywxTag(String wxEnterpriseId) {
...@@ -111,13 +114,42 @@ public class QywxTagApiServiceImpl implements QywxTagApiService { ...@@ -111,13 +114,42 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
@Override @Override
public ServiceResponse syncTagToQywx(String wxEnterpriseId, String enterpriseId, QywxTagInfoDTO infoDTO, List<QywxTagItemDTO> items) { public ServiceResponse syncTagToQywx(String wxEnterpriseId, String enterpriseId, QywxTagInfoDTO infoDTO, List<QywxTagItemDTO> items) {
logger.info("保存标签同步"); String memberTagId = infoDTO.getMemberTagId() ;
logger.info("标签同步到企业微信,wxEnterpriseId={},memberTagId={}",wxEnterpriseId,memberTagId);
List<MemberTagItemDTO> tagItems = memberTagApiService.queryMemberTagItem(memberTagId);
items = tagItems.stream().map(item -> {
QywxTagItemDTO mid = new QywxTagItemDTO();
mid.setMemberTagItemId(item.getTagItemId());
mid.setQywxTagKey(item.getTagItemId());
mid.setQywxTagName(item.getTagItemName());
return mid;
}).collect(Collectors.toList());
ServiceResponse ret = new ServiceResponse(); ServiceResponse ret = new ServiceResponse();
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId) ; WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId) ;
// 如果 // 判断更新
List<TabQywxTagRelation> list = this.qywxTagRelationMapper.listByMemberTagId(wxEnterpriseId,infoDTO.getMemberTagId()) ; List<QywxTagItemDTO> needAddList = new ArrayList<>() ;
if(CollectionUtils.isNotEmpty(list) && list.size() >= items.size()) { List<TabQywxTagRelation> relationList = this.qywxTagRelationMapper.listByMemberTagId(wxEnterpriseId,memberTagId) ;
logger.info("标签已存在,直接处理会员"); if(CollectionUtils.isNotEmpty(relationList)) {
String hbTagId = relationList.get(0).getQywxTagId() ;
TabQywxTag tag = this.qywxTagService.getQywxTagByQywxTagId(wxEnterpriseId,hbTagId) ;
String qwGroupKey = tag.getQywxGroupKey() ;
logger.info("已经存在企微标签,进行更新处理={}",qwGroupKey);
QywxGetCorpTagListDTO tagListDTO = this.qywxSuiteApiService.getCorpTagList(qwDTO.getThirdCorpid(),qwDTO.getSelf3thSecret(),Arrays.asList(qwGroupKey),0,qwDTO.isSelf(),qwDTO.getUrlHost()) ;
logger.info("企微侧标签={}",JSONObject.toJSONString(tagListDTO));
// 更新赋值
infoDTO.setQywxGroupKey(qwGroupKey);
// 需要添加的标签值
List<String> existMemberTagIdList = relationList.stream().map(o->o.getTagItemId()).collect(Collectors.toList());
for(QywxTagItemDTO memberTag : items) {
if(!existMemberTagIdList.contains(memberTag.getMemberTagItemId())) {
needAddList.add(memberTag) ;
}
}
items = needAddList ;
logger.info("更新标签,新增={}",needAddList);
}
if(CollectionUtils.isEmpty(items)) {
logger.info("没有需要处理的标签");
return ret ; return ret ;
} }
//调用企业微信接口保存 //调用企业微信接口保存
...@@ -140,7 +172,7 @@ public class QywxTagApiServiceImpl implements QywxTagApiService { ...@@ -140,7 +172,7 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
return ret; return ret;
} }
//保存关联关系 //保存关联关系
saveRelation(wxEnterpriseId, enterpriseId, infoDTO, items, savePair); this.saveRelation(wxEnterpriseId, enterpriseId, infoDTO, items, savePair);
return ret; return ret;
} }
...@@ -183,7 +215,7 @@ public class QywxTagApiServiceImpl implements QywxTagApiService { ...@@ -183,7 +215,7 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
itemRelation.setMemberTagId(infoDTO.getMemberTagId()); itemRelation.setMemberTagId(infoDTO.getMemberTagId());
itemRelation.setEnterpriseId(enterpriseId); itemRelation.setEnterpriseId(enterpriseId);
itemRelation.setQywxTagItemId(tab.getQywxTagItemId()); itemRelation.setQywxTagItemId(tab.getQywxTagItemId());
itemRelation.setTagItemId(orgItem.getQywxTagKey()); itemRelation.setTagItemId(orgItem.getMemberTagItemId());
return itemRelation; return itemRelation;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
saveRelationList.addAll(itemList); saveRelationList.addAll(itemList);
...@@ -192,8 +224,6 @@ public class QywxTagApiServiceImpl implements QywxTagApiService { ...@@ -192,8 +224,6 @@ public class QywxTagApiServiceImpl implements QywxTagApiService {
/** /**
* 调用企业微信接口 保存标签 * 调用企业微信接口 保存标签
*
* @param wxEnterpriseDTO
* @param infoDTO * @param infoDTO
* @param items * @param items
* @return * @return
......
...@@ -46,6 +46,7 @@ import com.gic.haoban.manage.service.service.*; ...@@ -46,6 +46,7 @@ import com.gic.haoban.manage.service.service.*;
import com.gic.haoban.manage.service.service.chat.GroupChatService; import com.gic.haoban.manage.service.service.chat.GroupChatService;
import com.gic.haoban.manage.service.service.fee.HaobanQywxFeeOrderAccountService; import com.gic.haoban.manage.service.service.fee.HaobanQywxFeeOrderAccountService;
import com.gic.haoban.manage.service.service.fee.HaobanQywxFeeOrderService; import com.gic.haoban.manage.service.service.fee.HaobanQywxFeeOrderService;
import com.gic.haoban.manage.service.util.DingUtils;
import com.gic.haoban.manage.service.util.EmojiFilterUtil; import com.gic.haoban.manage.service.util.EmojiFilterUtil;
import com.gic.redis.data.util.RedisUtil; import com.gic.redis.data.util.RedisUtil;
import com.gic.thirdparty.cloudfile.CloudFileUtil; import com.gic.thirdparty.cloudfile.CloudFileUtil;
...@@ -248,8 +249,12 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -248,8 +249,12 @@ public class StaffApiServiceImpl implements StaffApiService {
} }
} }
@Override
public ServiceResponse getWxSaveNew(String wxUserId, String wxEnterpriseId) { public ServiceResponse getWxSaveNew(String wxUserId, String wxEnterpriseId) {
return this.getWxSaveNew(wxUserId,wxEnterpriseId,false) ;
}
@Override
public ServiceResponse getWxSaveNew(String wxUserId, String wxEnterpriseId,boolean isSyncDepart) {
ServiceResponse res = new ServiceResponse(); ServiceResponse res = new ServiceResponse();
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId); WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId);
if (null == qwDTO) { if (null == qwDTO) {
...@@ -299,22 +304,7 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -299,22 +304,7 @@ public class StaffApiServiceImpl implements StaffApiService {
TabHaobanStaff staff = new TabHaobanStaff(); TabHaobanStaff staff = new TabHaobanStaff();
List<StaffDTO> staffDTOList = staffService.listByUserIdsAndWxEnterpriseId(Lists.newArrayList(wxUserId,openUserid), wxEnterpriseId); List<StaffDTO> staffDTOList = staffService.listByUserIdsAndWxEnterpriseId(Lists.newArrayList(wxUserId,openUserid), wxEnterpriseId);
if (CollUtil.isNotEmpty(staffDTOList) && staffDTOList.size()>1) { if (CollUtil.isNotEmpty(staffDTOList) && staffDTOList.size()>1) {
//只保留一个staff com.gic.haoban.common.utils.DingUtils.send("告警【多条重复staff】,企业ID"+wxEnterpriseId,true);
for (int i =0;i<staffDTOList.size()-1;i++){
StaffDTO dto = staffDTOList.get(i);
String staffId = dto.getStaffId();
// 员工解绑
List<StaffClerkRelationDTO> staffClerkRelationDTOS = staffClerkRelationService
.listByStaffId(wxEnterpriseId, staffId);
if (CollectionUtils.isNotEmpty(staffClerkRelationDTOS)) {
for (StaffClerkRelationDTO staffClerkRelationDTO : staffClerkRelationDTOS) {
staffClerkRelationService.delBind(staffId, staffClerkRelationDTO.getClerkId(),
ChannelCodeEnum.ADMIN_UNBIND.getCode(),null, wxEnterpriseId);
}
}
this.staffService.delByStaffId(staffId);
staffDTOList.remove(i);
}
} }
if (CollUtil.isNotEmpty(staffDTOList)){ if (CollUtil.isNotEmpty(staffDTOList)){
staff = JSONObject.parseObject(JSONObject.toJSONString(staffDTOList.get(0)), TabHaobanStaff.class); staff = JSONObject.parseObject(JSONObject.toJSONString(staffDTOList.get(0)), TabHaobanStaff.class);
...@@ -348,8 +338,7 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -348,8 +338,7 @@ public class StaffApiServiceImpl implements StaffApiService {
staff.setQrCode(qr_code); staff.setQrCode(qr_code);
} }
//判断成员是否开启联系我 //判断成员是否开启联系我
if (this.openConcatFlag(wxEnterpriseId,wxUserId)) { if (this.openConcatFlag(wxEnterpriseId,wxUserId,isSyncDepart,qwDTO)) {
logger.info("成员开启联系我");
staff.setOpenConcatFlag(1); staff.setOpenConcatFlag(1);
} }
//成员更改或更新 //成员更改或更新
...@@ -369,15 +358,27 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -369,15 +358,27 @@ public class StaffApiServiceImpl implements StaffApiService {
res.setResult(staff.getStaffName()); res.setResult(staff.getStaffName());
return res; return res;
} }
private Boolean openConcatFlag(String wxEnterpriseId,String userId){ private Boolean openConcatFlag(String wxEnterpriseId,String userId , boolean isSyncDepart,WxEnterpriseQwDTO qwDTO){
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId);
//企微已经开启联系我
List<String> wxUserIdsList = null ; List<String> wxUserIdsList = null ;
//企微已经开启联系我
Boolean flag = false; Boolean flag = false;
if(qwDTO.isSelf()) { String key = "get_follow_user_list:"+wxEnterpriseId ;
wxUserIdsList = qywxUserApiService.listCorpExternalUserSelf(qwDTO.getDkCorpid(), qwDTO.getSelfSecret(),qwDTO.getUrlHost()); if(isSyncDepart) {
}else { Object o = RedisUtil.getCache(key) ;
wxUserIdsList = qywxUserApiService.listCorpExternalUser(qwDTO.getThirdCorpid(), config.getWxSuiteid()); if(null != o) {
logger.info("从缓存中获取联系我列表={}",wxEnterpriseId);
wxUserIdsList = (List<String>) o ;
}
}
if(null == wxUserIdsList) {
if(qwDTO.isSelf()) {
wxUserIdsList = qywxUserApiService.listCorpExternalUserSelf(qwDTO.getDkCorpid(), qwDTO.getSelfSecret(),qwDTO.getUrlHost());
}else {
wxUserIdsList = qywxUserApiService.listCorpExternalUser(qwDTO.getThirdCorpid(), config.getWxSuiteid());
}
if(isSyncDepart) {
RedisUtil.setCache(key,wxUserIdsList,60*60L);
}
} }
if (CollUtil.isNotEmpty(wxUserIdsList) && wxUserIdsList.contains(userId)) { if (CollUtil.isNotEmpty(wxUserIdsList) && wxUserIdsList.contains(userId)) {
logger.info("成员开启联系我"); logger.info("成员开启联系我");
......
...@@ -75,7 +75,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -75,7 +75,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
@Autowired @Autowired
private HmQrcodeService hmQrcodeService; private HmQrcodeService hmQrcodeService;
@Autowired @Autowired
private Config config; private StoreRangeService storeRangeService;
@Override @Override
public void bindLogMq(String params) { public void bindLogMq(String params) {
...@@ -513,11 +513,13 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -513,11 +513,13 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
logger.info("导购未关联成员,oldClerkId={}", oldClerkId); logger.info("导购未关联成员,oldClerkId={}", oldClerkId);
return; return;
} }
/* StaffClerkRelationDTO oldRelationDTO = staffClerkRelationService.getByClerkId(oldClerkId); // 如果新门店未关联好办,进行解绑
if (null == oldRelationDTO) { boolean hasFlag = this.storeRangeService.hasStore(oldRelationDTO.getWxEnterpriseId(),enterpriseId,clerkDTO.getStoreId()) ;
logger.info("导购未关联成员,clerkCode={}", clerkCode); if(!hasFlag) {
return; logger.info("新门店未关联好办,storeId={}",clerkDTO.getStoreId());
}*/ staffClerkRelationService.delBind(oldClerkId, "-1", ChannelCodeEnum.STORE_CHANGE_UNBIND.getCode(), null,null);
return ;
}
logger.info("导购门店转移,老的绑定导购id={}", oldRelationDTO.getClerkId()); logger.info("导购门店转移,老的绑定导购id={}", oldRelationDTO.getClerkId());
this.moveOrAddClerk(clerkSyncQDTO, oldRelationDTO); this.moveOrAddClerk(clerkSyncQDTO, oldRelationDTO);
} else if (type == 3) { } else if (type == 3) {
......
...@@ -61,7 +61,7 @@ public class QywxStaffSyncOperation implements BaseSyncOperation { ...@@ -61,7 +61,7 @@ public class QywxStaffSyncOperation implements BaseSyncOperation {
try { try {
String taskId = dataPre.getTaskId() ; String taskId = dataPre.getTaskId() ;
String wxUserId = dealParamMqDTO.getData() ; String wxUserId = dealParamMqDTO.getData() ;
ServiceResponse response = staffApiService.getWxSaveNew(wxUserId, dataPre.getWxEnterpriseId()); ServiceResponse response = staffApiService.getWxSaveNew(wxUserId, dataPre.getWxEnterpriseId(),true);
if (response.getCode() != 1) { if (response.getCode() != 1) {
dealFlag = false; dealFlag = false;
reason = response.getMessage(); reason = response.getMessage();
......
...@@ -169,7 +169,7 @@ public class SelfFriendSyncNewOperation implements BaseSyncOperation { ...@@ -169,7 +169,7 @@ public class SelfFriendSyncNewOperation implements BaseSyncOperation {
GicMQClient clientInstance = GICMQClientUtil.getClientInstance(); GicMQClient clientInstance = GICMQClientUtil.getClientInstance();
try { try {
Log.info("发送队列SelfFriendSyncNewOperation={}",JSON.toJSONString(ret)); Log.info("发送队列SelfFriendSyncNewOperation={}",JSON.toJSONString(ret));
clientInstance.sendBatchMessages("departmentSyncDealMq2", ret); clientInstance.sendBatchMessages("departmentSyncDealMq", ret);
} catch (Exception e) { } catch (Exception e) {
logger.info("发送失败:{},{}", taskId); logger.info("发送失败:{},{}", taskId);
e.printStackTrace(); e.printStackTrace();
......
...@@ -27,10 +27,11 @@ ...@@ -27,10 +27,11 @@
<!-- from tab_haoban_qywx_tag_relation--> <!-- from tab_haoban_qywx_tag_relation-->
<!-- where qywx_tag_relation_id = #{qywxTagRelationId,jdbcType=VARCHAR}--> <!-- where qywx_tag_relation_id = #{qywxTagRelationId,jdbcType=VARCHAR}-->
<!-- </select>--> <!-- </select>-->
<delete id="deleteByPrimaryKey" parameterType="java.lang.String"> <update id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from tab_haoban_qywx_tag_relation update tab_haoban_qywx_tag_relation set status_flag = 0 , update_time =now()
where qywx_tag_relation_id = #{qywxTagRelationId,jdbcType=VARCHAR} where qywx_tag_relation_id = #{qywxTagRelationId,jdbcType=VARCHAR}
</delete> </update>
<insert id="insert" parameterType="com.gic.haoban.manage.service.entity.TabQywxTagRelation"> <insert id="insert" parameterType="com.gic.haoban.manage.service.entity.TabQywxTagRelation">
insert into tab_haoban_qywx_tag_relation (qywx_tag_relation_id, wx_enterprise_id, insert into tab_haoban_qywx_tag_relation (qywx_tag_relation_id, wx_enterprise_id,
enterprise_id, member_tag_id, tag_item_id, enterprise_id, member_tag_id, tag_item_id,
......
...@@ -92,7 +92,7 @@ ...@@ -92,7 +92,7 @@
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
from tab_haoban_qywx_fee_order_account from tab_haoban_qywx_fee_order_account
where wx_enterprise_id = #{wxEnterpriseId} where wx_enterprise_id = #{wxEnterpriseId}
and status in (1,4) and status in (1)
</select> </select>
<update id="updateByActiveCode"> <update id="updateByActiveCode">
......
import com.alibaba.fastjson.JSON;
import com.gic.commons.util.GICMQClientUtil;
import com.gic.haoban.manage.api.dto.QywxTagInfoDTO;
import com.gic.haoban.manage.api.dto.QywxTagItemDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO;
import com.gic.haoban.manage.api.service.ExternalClerkRelatedApiService;
import com.gic.haoban.manage.api.service.QywxTagApiService;
import com.gic.haoban.manage.service.config.Config;
import com.gic.haoban.manage.service.pojo.bo.hm.HmQrcodeBO;
import com.gic.haoban.manage.service.service.StaffClerkRelationService;
import com.gic.haoban.manage.service.service.WxEnterpriseService;
import com.gic.haoban.manage.service.service.hm.HmClerkRelationService;
import com.gic.haoban.manage.service.service.hm.HmQrcodeService;
import com.gic.mq.sdk.GicMQClient;
import com.gic.redis.data.util.RedisUtil;
import com.gic.wechat.api.dto.qywx.welcome.QywxExternalcontactDTO;
import org.apache.commons.collections.CollectionUtils;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import java.util.ArrayList;
import java.util.List;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:applicationContext-conf.xml"})
public class TagTest3 {
@Autowired
private QywxTagApiService qywxTagApiService ;
@Autowired
private HmQrcodeService hmQrcodeService ;
@Autowired
private WxEnterpriseService wxEnterpriseService ;
@Autowired
private Config config ;
@Autowired
private HmClerkRelationService hmClerkRelationService ;
@Autowired
private ExternalClerkRelatedApiService externalClerkRelatedApiService ;
@Test
public void tt() throws InterruptedException {
// String wxEnterpriseId, String enterpriseId, QywxTagInfoDTO infoDTO, List<QywxTagItemDTO> items
String wxEnterpriseId = "ca66a01b79474c40b3e7c7f93daf1a3b" ;
String enterpriseId = "ff8080815dacd3a2015dacd3ef5c0000" ;
QywxTagInfoDTO infoDTO = new QywxTagInfoDTO() ;
infoDTO.setWxEnterpriseId(wxEnterpriseId);
infoDTO.setMemberTagId("5b1db406e21748e88737a4cbe194d24f");
List<QywxTagItemDTO> items = new ArrayList<>() ;
QywxTagItemDTO mid = new QywxTagItemDTO();
mid.setMemberTagItemId("0f08ddb354654638bc8f71ce39fce688");
mid.setQywxTagName("企微1");
items.add(mid) ;
QywxTagItemDTO mid2 = new QywxTagItemDTO();
mid2.setMemberTagItemId("1e3f324af76842a0a3b7697f95419414");
mid2.setQywxTagName("企微2");
items.add(mid2) ;
QywxTagItemDTO mid3 = new QywxTagItemDTO();
mid3.setMemberTagItemId("qw5");
mid3.setQywxTagKey("qw5");
mid3.setQywxTagName("企微5");
items.add(mid3) ;
this.qywxTagApiService.syncTagToQywx(wxEnterpriseId,enterpriseId,infoDTO,items) ;
}
}
...@@ -336,7 +336,7 @@ public class DepartmentContoller extends WebBaseController { ...@@ -336,7 +336,7 @@ public class DepartmentContoller extends WebBaseController {
Object cache = RedisUtil.getLocalCache("department-list-cache-" + wxEnterpriseId); Object cache = RedisUtil.getLocalCache("department-list-cache-" + wxEnterpriseId);
if (null == cache) { if (null == cache) {
List<DepartmentShortDTO> list = departmentApiService.listAllDepartment(wxEnterpriseId); List<DepartmentShortDTO> list = departmentApiService.listAllDepartment(wxEnterpriseId);
RedisUtil.setLocalCache("department-list-cache-" + wxEnterpriseId, list, -1L); RedisUtil.setLocalCache("department-list-cache-" + wxEnterpriseId, list, 60*60*24L);
return resultResponse(HaoBanErrCode.ERR_1, list); return resultResponse(HaoBanErrCode.ERR_1, list);
} else { } else {
return resultResponse(HaoBanErrCode.ERR_1, cache); return resultResponse(HaoBanErrCode.ERR_1, cache);
......
...@@ -20,6 +20,7 @@ import java.util.concurrent.Executors; ...@@ -20,6 +20,7 @@ import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.gic.haoban.manage.api.service.*;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.redisson.api.RRateLimiter; import org.redisson.api.RRateLimiter;
...@@ -48,13 +49,6 @@ import com.gic.haoban.manage.api.dto.WxApplicationDTO; ...@@ -48,13 +49,6 @@ import com.gic.haoban.manage.api.dto.WxApplicationDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseDTO; import com.gic.haoban.manage.api.dto.WxEnterpriseDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO; import com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO;
import com.gic.haoban.manage.api.enums.SecretTypeEnum; import com.gic.haoban.manage.api.enums.SecretTypeEnum;
import com.gic.haoban.manage.api.service.MaidianLogApiService;
import com.gic.haoban.manage.api.service.QwFriendApiService;
import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.api.service.TestApiService;
import com.gic.haoban.manage.api.service.WxApplicationApiService;
import com.gic.haoban.manage.api.service.WxEnterpriseApiService;
import com.gic.haoban.manage.api.service.WxEnterpriseRelatedApiService;
import com.gic.haoban.manage.api.service.hm.HmQrcodeApiService; import com.gic.haoban.manage.api.service.hm.HmQrcodeApiService;
import com.gic.haoban.manage.api.service.out.SecretSettingApiService; import com.gic.haoban.manage.api.service.out.SecretSettingApiService;
import com.gic.haoban.manage.web.config.Config; import com.gic.haoban.manage.web.config.Config;
...@@ -103,8 +97,7 @@ public class TestController extends WebBaseController { ...@@ -103,8 +97,7 @@ public class TestController extends WebBaseController {
private QywxCorpApiService qywxCorpApiService; private QywxCorpApiService qywxCorpApiService;
@Autowired @Autowired
private QwFriendApiService qwFriendApiService ; private QwFriendApiService qwFriendApiService ;
@RequestMapping("/qwcode") @RequestMapping("/qwcode")
public HaobanResponse qwcode(String enterpriseId, String unionid,String openid,String wxaUnionid ,String code) { public HaobanResponse qwcode(String enterpriseId, String unionid,String openid,String wxaUnionid ,String code) {
return this.resultResponse(HaoBanErrCode.ERR_0,code); return this.resultResponse(HaoBanErrCode.ERR_0,code);
......
...@@ -166,6 +166,12 @@ public class GroupChatController { ...@@ -166,6 +166,12 @@ public class GroupChatController {
qdto.setEnterpriseId(loginUser.getEnterpriseId()); qdto.setEnterpriseId(loginUser.getEnterpriseId());
qdto.setSearchParams(searchParams); qdto.setSearchParams(searchParams);
qdto.setUserType(userType); qdto.setUserType(userType);
if(null == startDate || null == endDate) {
return RestResponse.failure("9999","时间不能为空");
}
if(DateUtil.daysBetween(startDate,endDate) >= 32) {
return RestResponse.failure("9999","导出区间不能超过一个月");
}
qdto.setStartDate(startDate); qdto.setStartDate(startDate);
qdto.setEndDate(endDate); qdto.setEndDate(endDate);
qdto.setStatus(status); qdto.setStatus(status);
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
<dubbo:application name="haoban-manage3-web"/> <dubbo:application name="haoban-manage3-web"/>
<dubbo:protocol name="dubbo" port="30009"/> <dubbo:protocol name="dubbo" port="30009"/>
<dubbo:reference interface="com.gic.haoban.manage.api.service.WxEnterpriseActiveDataApiService" id="wxEnterpriseActiveDataApiService" timeout="10000"/> <dubbo:reference interface="com.gic.haoban.manage.api.service.WxEnterpriseActiveDataApiService" id="wxEnterpriseActiveDataApiService" timeout="10000"/>
<dubbo:reference interface="com.gic.enterprise.api.service.DownloadReportService" id="downloadReportService" timeout="10000"/> <dubbo:reference interface="com.gic.enterprise.api.service.DownloadReportService" id="downloadReportService" timeout="10000"/>
<dubbo:reference interface="com.gic.haoban.manage.api.service.chat.GroupChatDataApiService" id="groupChatDataApiService" timeout="10000"/> <dubbo:reference interface="com.gic.haoban.manage.api.service.chat.GroupChatDataApiService" id="groupChatDataApiService" timeout="10000"/>
......
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