Commit 4aad8761 by 徐高华

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

parents 96cd844a 9b8a0a30
......@@ -310,8 +310,11 @@ public class MaterialApiServiceImpl implements MaterialApiService {
(a, b) -> a
));
result.forEach(dto -> {
TabMiniprogramSetting miniprogramSetting = settingMap.get(dto.getAppId());
dto.setMaterialDesc(miniprogramSetting == null ? "--" : miniprogramSetting.getMiniprogramName());
//小程序去判断逻辑
if (dto.getMaterialType() != null && dto.getMaterialType() == 6) {
TabMiniprogramSetting miniprogramSetting = settingMap.get(dto.getAppId());
dto.setMaterialDesc(miniprogramSetting == null ? "--" : miniprogramSetting.getMiniprogramName());
}
});
}
return PageUtil.changePageHelperToCurrentPage(page, MaterialDTO.class);
......
......@@ -293,7 +293,7 @@ public class MessageApiServiceImpl implements MessageApiService {
if (null != user) {
Integer status = user.getStatus();
// 1=已激活,2=已禁用,4=未激活,5=退出企业。
log.info("企业微信用户状态:{}",status);
log.info("企业微信用户状态:{}", status);
if (status == 1) {
log.info("企业微信用户存在,并且已激活无需删除:{}:{}", wxEnterpriseId, userid);
return;
......@@ -316,7 +316,7 @@ public class MessageApiServiceImpl implements MessageApiService {
List<StaffClerkRelationDTO> staffClerkRelationDTOS = staffClerkRelationApiService.listByStaffId(wxEnterpriseId, staffId);
if (CollectionUtils.isNotEmpty(staffClerkRelationDTOS)) {
for (StaffClerkRelationDTO staffClerkRelationDTO : staffClerkRelationDTOS) {
staffClerkRelationApiService.unbindByStaffAndClerkId(staffId,staffClerkRelationDTO.getClerkId());
staffClerkRelationApiService.unbindByStaffAndClerkId(staffId, staffClerkRelationDTO.getClerkId());
}
}
}
......@@ -475,13 +475,13 @@ public class MessageApiServiceImpl implements MessageApiService {
log.info("clerkId未绑定:clerkId={}", clerkId);
return false;
}
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(relation.getWxEnterpriseId()) ;
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(relation.getWxEnterpriseId());
if (qwDTO == null) {
log.info("企业为空");
return false;
}
StaffDTO staffDTO = staffApiService.selectById(relation.getStaffId());
String corpid = qwDTO.getThirdCorpid() ;
String corpid = qwDTO.getThirdCorpid();
String wxUserId = "";
if (qwDTO.needOpenUserId3th()) {
wxUserId = staffDTO.getWxOpenUseId();
......@@ -560,7 +560,7 @@ public class MessageApiServiceImpl implements MessageApiService {
String title = jsonObject.getString("title");
String content = jsonObject.getString("content");
String memberName = jsonObject.getString("memberName");
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId) ;
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId);
if (qwDTO == null) {
log.info("企业为空");
return;
......@@ -583,7 +583,8 @@ public class MessageApiServiceImpl implements MessageApiService {
@Override
public String getNewWxUserIdByStaffId(String wxEnterpriseId, String staffId) {
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId) ;
log.info("请求wxEnterpriseId:{},staffId:{}", wxEnterpriseId, staffId);
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId);
if (qwDTO == null) {
return "";
}
......
package com.gic.haoban.manage.service.service.out.impl;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.Page;
......@@ -27,12 +14,7 @@ import com.gic.enterprise.api.service.EnterpriseService;
import com.gic.enterprise.api.service.StoreService;
import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.base.api.common.ServiceResponse;
import com.gic.haoban.manage.api.dto.AuditDTO;
import com.gic.haoban.manage.api.dto.StaffClerkBindLogDetailDTO;
import com.gic.haoban.manage.api.dto.StaffClerkBindLogInfoDTO;
import com.gic.haoban.manage.api.dto.StaffClerkInfoDTO;
import com.gic.haoban.manage.api.dto.StaffClerkRelationDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO;
import com.gic.haoban.manage.api.dto.*;
import com.gic.haoban.manage.api.dto.qdto.ClerkSyncQDTO;
import com.gic.haoban.manage.api.enums.AuditType;
import com.gic.haoban.manage.api.enums.BindTypeEnum;
......@@ -46,21 +28,22 @@ import com.gic.haoban.manage.service.entity.MemberClerkChatConfig;
import com.gic.haoban.manage.service.entity.TabHaobanStaff;
import com.gic.haoban.manage.service.entity.TabHaobanStaffClerkBindLog;
import com.gic.haoban.manage.service.entity.TabHaobanStaffClerkRelation;
import com.gic.haoban.manage.service.service.ClerkMainStoreRelatedService;
import com.gic.haoban.manage.service.service.ExternalClerkRelatedService;
import com.gic.haoban.manage.service.service.SecretSettingService;
import com.gic.haoban.manage.service.service.StaffClerkBindLogService;
import com.gic.haoban.manage.service.service.StaffClerkRelationService;
import com.gic.haoban.manage.service.service.StaffService;
import com.gic.haoban.manage.service.service.WxEnterpriseService;
import com.gic.haoban.manage.service.service.*;
import com.gic.haoban.manage.service.service.hm.HmQrcodeService;
import com.gic.haoban.manage.service.task.RouterConstant;
import com.gic.haoban.task.api.dto.MqMessageQo;
import com.gic.wechat.api.dto.qywx.welcome.QywxExternalcontactDTO;
import com.gic.wechat.api.dto.qywx.welcome.QywxExternalcontactResultDTO;
import com.gic.wechat.api.service.qywx.QywxUserApiService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import cn.hutool.core.collection.CollectionUtil;
import java.util.*;
import java.util.stream.Collectors;
@Service
public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiService {
......@@ -96,9 +79,9 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
@Autowired
private HmClerkRelationApiService hmClerkRelationApiService;
@Autowired
private HmQrcodeService hmQrcodeService ;
private HmQrcodeService hmQrcodeService;
@Autowired
private Config config ;
private Config config;
@Override
public void bindLogMq(String params) {
......@@ -118,13 +101,13 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
String clerkName = null;
if (null != clerkDTO) {
phoneNumber = clerkDTO.getPhoneNumber();
clerkName = clerkDTO.getClerkName() ;
clerkName = clerkDTO.getClerkName();
}
String operClerkId = infoDTO.getOptStaffId() ;
String operClerkId = infoDTO.getOptStaffId();
clerkDTO = clerkService.getClerkByClerkIdNoStatus(clerkRelation.getClerkId());
String operName = null ;
String operName = null;
if (null != clerkDTO) {
operName = clerkDTO.getClerkName() ;
operName = clerkDTO.getClerkName();
}
TabHaobanStaffClerkBindLog enity = new TabHaobanStaffClerkBindLog();
enity.setClerkId(clerkRelation.getClerkId());
......@@ -169,7 +152,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
infoDTO.setBrandName(enterpriseDTO.getBrandName());
infoDTO.setEnterpriseName(enterpriseDTO.getEnterpriseName());
}
ClerkDTO clerkDTO = clerkService.getClerkByClerkId(infoDTO.getClerkId(),-1);
ClerkDTO clerkDTO = clerkService.getClerkByClerkId(infoDTO.getClerkId(), -1);
if (null != clerkDTO) {
infoDTO.setClerkPhoneNumber(clerkDTO.getPhoneNumber());
infoDTO.setClerkName(clerkDTO.getClerkName());
......@@ -233,7 +216,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
//删除绑定关系
tabHaobanStaffClerkRelationMapper.delByStoreIdAndCode(storeId, clerkCode);
//删除主门店
delSetMainStore(staffClerkRelation,ChannelCodeEnum.SELF_UNBIND.getCode());
delSetMainStore(staffClerkRelation, ChannelCodeEnum.SELF_UNBIND.getCode());
}
@Override
......@@ -271,7 +254,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
StaffClerkRelationDTO staffRelation = staffClerkRelationService.getByClerkId(clerkId);
return staffRelation;
}
@Override
public StaffClerkRelationDTO getByClerkIdForWxUserId(String clerkId) {
return staffClerkRelationService.getByClerkIdForWxUserId(clerkId);
......@@ -295,14 +278,14 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
staffClerkBindLogService.pushToMq(oldStaffClerkRelation.getStaffId(), optStaffId, BindTypeEnum.UNBIND.getVal(), chanelCode, staffClerkRelation.getStaffClerkRelationId());
clerkMainStoreRelatedService.delMainStore(oldStaffClerkRelation.getStaffId(), oldStaffClerkRelation.getStoreId(), oldStaffClerkRelation.getWxEnterpriseId());
}
staffClerkRelationService.bind(staffClerkRelation,optStaffId,chanelCode);
staffClerkRelationService.bind(staffClerkRelation, optStaffId, chanelCode);
}
@Override
public void delByClerkId(String clerkId) {
TabHaobanStaffClerkRelation staffClerkRelation = tabHaobanStaffClerkRelationMapper.getOneByClerkId(clerkId);
tabHaobanStaffClerkRelationMapper.delByClerkId(clerkId);
delSetMainStore(staffClerkRelation,ChannelCodeEnum.AUDIT_UNBIND.getCode());
delSetMainStore(staffClerkRelation, ChannelCodeEnum.AUDIT_UNBIND.getCode());
}
@Override
......@@ -325,13 +308,13 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
}
if ("-1".equals(item.getOptStaffId())) {
item.setOptStaffName("系统");
}else {
} else {
item.setOptStaffName(item.getOperName());
}
if(StringUtils.isBlank(item.getOptStaffName())) {
if (StringUtils.isBlank(item.getOptStaffName())) {
item.setOptStaffName("未知成员");
}
if(StringUtils.isBlank(item.getClerkName())) {
if (StringUtils.isBlank(item.getClerkName())) {
ClerkDTO clerkDTO = clerkService.getClerkByClerkIdNoStatus(item.getClerkId());
if (null != clerkDTO) {
item.setClerkName(clerkDTO.getClerkName());
......@@ -361,13 +344,13 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
}
if ("-1".equals(item.getOptStaffId())) {
item.setOptStaffName("系统");
}else {
} else {
item.setOptStaffName(item.getOperName());
}
if(StringUtils.isBlank(item.getOptStaffName())) {
if (StringUtils.isBlank(item.getOptStaffName())) {
item.setOptStaffName("未知成员");
}
if(StringUtils.isBlank(item.getClerkName())) {
if (StringUtils.isBlank(item.getClerkName())) {
ClerkDTO clerkDTO = clerkService.getClerkByClerkIdNoStatus(item.getClerkId());
if (null != clerkDTO) {
item.setClerkName(clerkDTO.getClerkName());
......@@ -384,7 +367,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
staffClerkBindLogService.pushToMq(staffId, optStaffId, optType, channelCode, relationId);
}
private void delSetMainStore(TabHaobanStaffClerkRelation staffClerkRelation,Integer channelCode) {
private void delSetMainStore(TabHaobanStaffClerkRelation staffClerkRelation, Integer channelCode) {
if (staffClerkRelation == null) {
logger.info("staffClerkRelation为空");
return;
......@@ -396,7 +379,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
//删除主门店
clerkMainStoreRelatedService.delMainStore(staffId, staffClerkRelation.getStoreId(), wxEnterpriseId);
//废弃活码
hmClerkRelationApiService.delByClerkId(clerkId,staffClerkRelation.getEnterpriseId(),wxEnterpriseId,channelCode);
hmClerkRelationApiService.delByClerkId(clerkId, staffClerkRelation.getEnterpriseId(), wxEnterpriseId, channelCode);
}
@Override
......@@ -423,15 +406,15 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
List<String> userIds = new ArrayList<>();
send.setUser(userIds);
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(relationDTO.getWxEnterpriseId()) ;
if(qwDTO.needOpenUserId3th()) {
userIds.add(relationDTO.getOpenUserId()) ;
}else {
userIds.add(relationDTO.getQwUserId()) ;
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(relationDTO.getWxEnterpriseId());
if (qwDTO.needOpenUserId3th()) {
userIds.add(relationDTO.getOpenUserId());
} else {
userIds.add(relationDTO.getQwUserId());
}
QywxExternalcontactResultDTO configResp = qywxUserApiService.addContactWay(qwDTO.getDkCorpid() , config.getWxSuiteid() , send);
QywxExternalcontactResultDTO configResp = qywxUserApiService.addContactWay(qwDTO.getDkCorpid(), config.getWxSuiteid(), send);
logger.info("configId:{}", JSON.toJSONString(configResp));
String configId = configResp.getConfig_id() ;
String configId = configResp.getConfig_id();
if (StringUtils.isBlank(configId)) {
logger.info("staff:{}", configId, JSONObject.toJSONString(relationDTO));
response.setCode(4);
......@@ -455,8 +438,8 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
}
@Override
public List<StaffClerkRelationDTO> listByStaffId(String wxEnterpriseId,String staffId) {
return staffClerkRelationService.listByStaffId(wxEnterpriseId,staffId);
public List<StaffClerkRelationDTO> listByStaffId(String wxEnterpriseId, String staffId) {
return staffClerkRelationService.listByStaffId(wxEnterpriseId, staffId);
}
@Override
......@@ -466,7 +449,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
@Override
public void clerkStoreMoveDel(String param) {
logger.info("导购转移删除修改:{}",param);
logger.info("导购转移删除修改:{}", param);
if (StringUtils.isBlank(param)) {
logger.error("参数为空");
return;
......@@ -475,25 +458,29 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
Integer type = clerkSyncQDTO.getType();
String clerkId = clerkSyncQDTO.getClerkId();
String enterpriseId = clerkSyncQDTO.getEnterpriseId();
ClerkDTO clerkDTO = clerkService.getClerkByClerkId(clerkId,-1);
ClerkDTO clerkDTO = clerkService.getClerkByClerkId(clerkId, -1);
if (clerkDTO == null) {
logger.error("导购为空");
return;
}
if (type == 1) {
Integer status = clerkDTO.getStatus();
logger.info("导购删除解绑,clerkId:{},status:{}", clerkId, status);
//导购删除解绑
if (!clerkDTO.getStatus().equals(1)) {
if (!status.equals(1)) {
//解绑
staffClerkRelationService.delBind(clerkId, "-1", ChannelCodeEnum.GIC_CLERK_DEL_UNBIND.getCode());
}
} else if (type == 2) {
logger.info("门店转移、重新绑定,clerkId:{}", clerkId);
//门店转移、重新绑定
StaffClerkRelationDTO relationDTO = staffClerkRelationService.getOneBindCodeNoStatus(clerkDTO.getEnterpriseId(), clerkDTO.getClerkCode());
moveOrAddClerk(clerkSyncQDTO,relationDTO);
moveOrAddClerk(clerkSyncQDTO, relationDTO);
} else if (type == 3) {
//店长任务重新分配
Integer clerkType = clerkDTO.getClerkType();
logger.info("店长任务重新分配,clerkId:{},clerkType:{}", clerkId, clerkType);
if (clerkType != null && clerkType == 1) {
//发消息处理新增店长,任务重新分配问题
try {
......@@ -506,10 +493,10 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
GICMQClientUtil.getClientInstance().sendCommonMessage(RouterConstant.ROUTERTYPE, s,
"com.gic.haoban.task.api.service.MqAsynApiService", "run");
} catch (Exception e) {
logger.error("任务重新分配问题发送消息队列出错",e);
logger.error("任务重新分配问题发送消息队列出错", e);
}
}
hmQrcodeService.updateClerkNameByClerkId(enterpriseId,clerkId,clerkDTO.getClerkName(),clerkDTO.getClerkCode());
hmQrcodeService.updateClerkNameByClerkId(enterpriseId, clerkId, clerkDTO.getClerkName(), clerkDTO.getClerkCode());
}
}
......@@ -526,13 +513,13 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
ServiceResponse response = bindStaffClerk(relationDTO, "-1", ChannelCodeEnum.SYNC_BIND.getCode());
logger.info("绑定结果正常:{},{}", JSONObject.toJSONString(response), relationDTO.getClerkId());
}
@Override
public int getCanAddHmCount(String wxEnterpriseId, String enterpriseId, String clerkId) {
int count = this.hmQrcodeService.getCanAddCount(wxEnterpriseId, enterpriseId, clerkId);
return count;
}
@Override
public List<String> listStaffIdByWxEnterpriseId(String wxEnterpriseId) {
return this.staffClerkRelationService.listByWxEnterpriseId(wxEnterpriseId);
......
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