Commit 2c475469 by jinxin

Merge branch 'bugfix/好办mq拆分'

parents 02eaee7a 6f23fbff
...@@ -23,6 +23,14 @@ public interface DealSyncOperationApiService { ...@@ -23,6 +23,14 @@ public interface DealSyncOperationApiService {
* @param params * @param params
*/ */
void departmentDealMq(String params); void departmentDealMq(String params);
/**
* mq拆分
* 部门同步处理
* "routerName": "departmentSyncDealMq2"
*
* @param params
*/
void departmentDealMq2(String params);
/** /**
* 处理前端数据 * 处理前端数据
......
...@@ -63,7 +63,12 @@ public class WxUserAddLogServiceImpl implements WxUserAddLogService { ...@@ -63,7 +63,12 @@ public class WxUserAddLogServiceImpl implements WxUserAddLogService {
entity.setAddChannel(0); entity.setAddChannel(0);
entity.setStatusFlag(1); entity.setStatusFlag(1);
entity.setStaffId(qdto.getStaffId()); entity.setStaffId(qdto.getStaffId());
entity.setStaffName(qdto.getStaffName()); //截取成员name
String staffName = qdto.getStaffName();
if (null != staffName && staffName.length()>32){
staffName = staffName.substring(0, 32);
}
entity.setStaffName(staffName);
entity.setAllDelFlag(0); entity.setAllDelFlag(0);
if (qdto.isDelFlag()) { if (qdto.isDelFlag()) {
TabWxUserAddLog logUser = this.wxUserAddLogMapper.selectNewLog(externalUserid, qdto.getStaffId()); TabWxUserAddLog logUser = this.wxUserAddLogMapper.selectNewLog(externalUserid, qdto.getStaffId());
......
...@@ -158,7 +158,9 @@ public class WelcomeSendServiceImpl implements WelcomeSendService { ...@@ -158,7 +158,9 @@ public class WelcomeSendServiceImpl implements WelcomeSendService {
String content = welcomeBO.getWelcomeContent(); String content = welcomeBO.getWelcomeContent();
if (content.contains("<微信昵称>")) { if (content.contains("<微信昵称>")) {
String nickName = this.getExternalUserName(qwDTO, externalUserId); String nickName = this.getExternalUserName(qwDTO, externalUserId);
nickName = nickName.replaceAll("\\$","RDS_CHAR_DOLLAR");// encode replacement;
content = content.replaceAll("<微信昵称>", nickName); content = content.replaceAll("<微信昵称>", nickName);
content = content.replaceAll("RDS_CHAR_DOLLAR","\\$");// decode replacement;
} }
QywxWelcomeMsgDTO qywxWelcomeMsgDTO = new QywxWelcomeMsgDTO(); QywxWelcomeMsgDTO qywxWelcomeMsgDTO = new QywxWelcomeMsgDTO();
// 欢迎语内容 // 欢迎语内容
......
...@@ -133,6 +133,45 @@ public class DealSyncOperationApiServiceImpl implements DealSyncOperationApiServ ...@@ -133,6 +133,45 @@ public class DealSyncOperationApiServiceImpl implements DealSyncOperationApiServ
} }
} }
@Override
public void departmentDealMq2(String params) {
DealParamMqDTO dealParamMqDTO = JSONObject.parseObject(params, DealParamMqDTO.class);
TabHaobanPreDealLog dataPre = preDealService.getByDataId(dealParamMqDTO.getTaskId(), dealParamMqDTO.getData(), dealParamMqDTO.getType() - 1, PreDealStatusEnum.all.getVal());
logger.info("好办同步处理mq处理开始:{},dataPre={}", params,JSON.toJSONString(dataPre));
if (dataPre == null) {
return;
}
Integer dataType = dataPre.getDataType();
logger.info("同步类型,dataType:{}",dataType);
if (dataType.equals(PreDealTypeEnum.dept.getVal())) {
logger.info("0 部门处理:{}", params);
operationMap.get("qywxDeptSyncOperation").dealSingleByMq(dealParamMqDTO, dataPre);
} else if (dataType.equals(PreDealTypeEnum.clerk.getVal())) {
logger.info("2 成员处理:{}", params);
operationMap.get("qywxStaffSyncOperation").dealSingleByMq(dealParamMqDTO, dataPre);
} else if (dataType.equals(PreDealTypeEnum.friend_clerk.getVal())) {
logger.info("6 好友导购处理:{}", params);
operationMap.get("friendClerkSyncNewOperation").dealSingleByMq(dealParamMqDTO, dataPre);
} else if (dataType.equals(PreDealTypeEnum.friend.getVal())) {
logger.info("8 第三方好友处理:{}", params);
operationMap.get("friendSyncNewOperation").dealSingleByMq(dealParamMqDTO, dataPre);
} else if (dataType.equals(PreDealTypeEnum.self_friend.getVal())) {
logger.info("7 自建好友处理:{}", params);
operationMap.get("selfFriendSyncNewOperation").dealSingleByMq(dealParamMqDTO, dataPre);
} else if (dataType.equals(PreDealTypeEnum.tag.getVal())) {
logger.info("10 会员标签处理:{}", params);
operationMap.get("friendTagSyncOperation").dealSingleByMq(dealParamMqDTO, dataPre);
} else if (dataType.equals(PreDealTypeEnum.tag_member.getVal())) {
logger.info("11 会员标签处理标签项:{}", params);
operationMap.get("friendMemberTagSyncOperation").dealSingleByMq(dealParamMqDTO, dataPre);
} else if(dataType.equals(PreDealTypeEnum.modify_hm.getVal())) {
logger.info("20 活码批量修改");
operationMap.get("qwHmOperation").dealSingleByMq(dealParamMqDTO, dataPre);
}else {
logger.info("不是正常数据类型:{}", params);
}
}
@Override @Override
public void dealDepartment(String taskId, String wxEnterpriseId public void dealDepartment(String taskId, String wxEnterpriseId
......
...@@ -37,7 +37,6 @@ import com.gic.haoban.manage.service.config.Config; ...@@ -37,7 +37,6 @@ import com.gic.haoban.manage.service.config.Config;
import com.gic.haoban.manage.service.dao.mapper.StaffDepartmentRelatedMapper; import com.gic.haoban.manage.service.dao.mapper.StaffDepartmentRelatedMapper;
import com.gic.haoban.manage.service.dao.mapper.StaffMapper; import com.gic.haoban.manage.service.dao.mapper.StaffMapper;
import com.gic.haoban.manage.service.entity.*; import com.gic.haoban.manage.service.entity.*;
import com.gic.haoban.manage.service.errorcode.HaoBanErrCode;
import com.gic.haoban.manage.service.errorcode.QywxErrCode; import com.gic.haoban.manage.service.errorcode.QywxErrCode;
import com.gic.haoban.manage.service.pojo.bo.StaffListBO; import com.gic.haoban.manage.service.pojo.bo.StaffListBO;
import com.gic.haoban.manage.service.service.*; import com.gic.haoban.manage.service.service.*;
...@@ -55,6 +54,7 @@ import com.gic.wechat.api.service.qywx.QywxOrderApiService; ...@@ -55,6 +54,7 @@ import com.gic.wechat.api.service.qywx.QywxOrderApiService;
import com.gic.wechat.api.service.qywx.QywxUserApiService; import com.gic.wechat.api.service.qywx.QywxUserApiService;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.google.common.collect.Lists;
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.slf4j.Logger; import org.slf4j.Logger;
...@@ -283,11 +283,29 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -283,11 +283,29 @@ public class StaffApiServiceImpl implements StaffApiService {
phoneNumber = arr[1]; phoneNumber = arr[1];
} }
String openUserid = getOpenUserid(wxUserId, dkCorpid, qwDTO); String openUserid = getOpenUserid(wxUserId, dkCorpid, qwDTO);
TabHaobanStaff staff = staffService.selectByUserIdAndEnterpriseId(wxUserId, openUserid, wxEnterpriseId); TabHaobanStaff staff = new TabHaobanStaff();
if (staff != null) { List<StaffDTO> staffDTOList = staffService.listByUserIdsAndWxEnterpriseId(Lists.newArrayList(wxUserId,openUserid), wxEnterpriseId);
staffService.delOtherStaffByWxUserId(staff.getWxUserId(), staff.getStaffId(), wxEnterpriseId); if (CollUtil.isNotEmpty(staffDTOList) && staffDTOList.size()>1) {
//只保留一个staff
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)){
staff = JSONObject.parseObject(JSONObject.toJSONString(staffDTOList.get(0)), TabHaobanStaff.class);
} }
staff = (staff == null ? new TabHaobanStaff() : staff);
staff.setWxUserId(wxUserId); staff.setWxUserId(wxUserId);
if (StringUtils.isNotBlank(openUserid)) { if (StringUtils.isNotBlank(openUserid)) {
staff.setWxOpenUseId(openUserid); staff.setWxOpenUseId(openUserid);
......
...@@ -170,12 +170,19 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -170,12 +170,19 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
@Override @Override
public ServiceResponse bindStaffClerk(StaffClerkRelationDTO staffClerkRelationDTO, String optStaffId, int channelCode) { public ServiceResponse bindStaffClerk(StaffClerkRelationDTO staffClerkRelationDTO, String optStaffId, int channelCode) {
//加锁防止并发问题
String clerkId = staffClerkRelationDTO.getClerkId();
String storeId = staffClerkRelationDTO.getStoreId();
String key = "haoban_bind_staff:" + clerkId+":"+storeId;
RedisUtil.lock(key, 6L);
ServiceResponse resp = this.bindCheck(staffClerkRelationDTO, optStaffId, channelCode); ServiceResponse resp = this.bindCheck(staffClerkRelationDTO, optStaffId, channelCode);
if (resp != null && !resp.isSuccess()) { if (resp != null && !resp.isSuccess()) {
logger.error("不允许绑定:{}", resp.getMessage()); logger.error("不允许绑定:{}", resp.getMessage());
RedisUtil.unlock(key);
return resp; return resp;
} }
String relationId = staffClerkRelationService.bind(staffClerkRelationDTO, optStaffId, channelCode); String relationId = staffClerkRelationService.bind(staffClerkRelationDTO, optStaffId, channelCode);
RedisUtil.unlock(key);
return ServiceResponse.success(relationId); return ServiceResponse.success(relationId);
} }
......
...@@ -260,7 +260,7 @@ public class QywxDeptSyncOperation implements BaseSyncOperation { ...@@ -260,7 +260,7 @@ public class QywxDeptSyncOperation implements BaseSyncOperation {
dealParamMqDTO.setType(syncTaskStatusEnum.getVal()); dealParamMqDTO.setType(syncTaskStatusEnum.getVal());
GicMQClient clientInstance = GICMQClientUtil.getClientInstance(); GicMQClient clientInstance = GICMQClientUtil.getClientInstance();
try { try {
clientInstance.sendMessage("departmentSyncDealMq", JSONObject.toJSONString(dealParamMqDTO)); clientInstance.sendMessage("departmentSyncDealMq2", JSONObject.toJSONString(dealParamMqDTO));
} catch (Exception e) { } catch (Exception e) {
logger.info("发送失败:{},{}", taskId, relationId); logger.info("发送失败:{},{}", taskId, relationId);
e.printStackTrace(); e.printStackTrace();
......
...@@ -213,7 +213,7 @@ public class SelfFriendSyncNewOperation implements BaseSyncOperation { ...@@ -213,7 +213,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("departmentSyncDealMq", ret); clientInstance.sendBatchMessages("departmentSyncDealMq2", ret);
} catch (Exception e) { } catch (Exception e) {
logger.info("发送失败:{},{}", taskId); logger.info("发送失败:{},{}", taskId);
e.printStackTrace(); e.printStackTrace();
......
...@@ -144,7 +144,7 @@ ...@@ -144,7 +144,7 @@
select select
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
from tab_haoban_audit from tab_haoban_audit
where wx_enterprise_id=#{wxEnterpriseId} and enterprise_id = #{enterpriseId,jdbcType=VARCHAR} where wx_enterprise_id=#{wxEnterpriseId} and enterprise_id = #{enterpriseId,jdbcType=VARCHAR} and status_flag = 1
<if test="auditType != null"> <if test="auditType != null">
and audit_type = #{auditType,jdbcType=INTEGER} and audit_type = #{auditType,jdbcType=INTEGER}
</if> </if>
......
...@@ -527,6 +527,11 @@ public class StaffController extends WebBaseController { ...@@ -527,6 +527,11 @@ public class StaffController extends WebBaseController {
vo.setPosition(staffDTO.getPostion()); vo.setPosition(staffDTO.getPostion());
vo.setDepartmentName(departmentMap.get(staffDTO.getDepartmentIds()) == null ? null : departmentMap.get(staffDTO.getDepartmentIds()).getDepartmentName()); vo.setDepartmentName(departmentMap.get(staffDTO.getDepartmentIds()) == null ? null : departmentMap.get(staffDTO.getDepartmentIds()).getDepartmentName());
vo.setRelationFlag((Objects.isNull(staffDTO.getRelationFlag()) || staffDTO.getRelationFlag() == 0) ? "未关联" : "已关联"); vo.setRelationFlag((Objects.isNull(staffDTO.getRelationFlag()) || staffDTO.getRelationFlag() == 0) ? "未关联" : "已关联");
vo.setWxUserId(staffDTO.getWxUserId());
vo.setWxOpenUseId(staffDTO.getWxOpenUseId());
vo.setActiveTime(staffDTO.getActiveTime() == null ? null : DateUtil.dateToStr(staffDTO.getActiveTime(),DateUtil.FORMAT_DATETIME_19));
vo.setExpireTime(staffDTO.getExpireTime() == null ? null : DateUtil.dateToStr(staffDTO.getExpireTime(),DateUtil.FORMAT_DATETIME_19));
vo.setPermitState(staffDTO.getPermitState());
if (flag){ if (flag){
List<String> enterpriseNameList = staffDTO.getEnterpriseNameList(); List<String> enterpriseNameList = staffDTO.getEnterpriseNameList();
if (CollUtil.isNotEmpty(enterpriseNameList)){ if (CollUtil.isNotEmpty(enterpriseNameList)){
...@@ -546,14 +551,24 @@ public class StaffController extends WebBaseController { ...@@ -546,14 +551,24 @@ public class StaffController extends WebBaseController {
} }
mergeClerkInfo(voList, wxEnterpriseId); mergeClerkInfo(voList, wxEnterpriseId);
String fileName = wxEnterpriseName + "通讯录" + DateUtil.dateToStr(new Date(), DateUtil.FORMAT_DATE_8); String fileName = wxEnterpriseName + "通讯录" + DateUtil.dateToStr(new Date(), DateUtil.FORMAT_DATE_8);
List<String> titleList =new ArrayList<>(); List<String> titleList =Lists.newArrayList("姓名", "职务", "部门", "手机号", "关联状态", "关联导购");
List<String> fileList = new ArrayList<>(); List<String> fileList = Lists.newArrayList("staffName", "position", "departmentName", "phoneNumber", "relationFlag", "clerkName");
if (flag){ if (flag){
titleList = Arrays.asList("姓名", "职务", "部门", "手机号", "关联状态", "关联导购","所属商户"); titleList.add("所属商户");
fileList = Arrays.asList("staffName", "position", "departmentName", "phoneNumber", "relationFlag", "clerkName","enterpriseName"); fileList.add("enterpriseName");
}else { }
titleList = Arrays.asList("姓名", "职务", "部门", "手机号", "关联状态", "关联导购"); //针对未升级好办独立应用的企业,导出表格增加导出字段:成员明文userid、成员加密userid、许可状态、许可激活时间、许可到期时间
fileList = Arrays.asList("staffName", "position", "departmentName", "phoneNumber", "relationFlag", "clerkName"); if(enterprise != null && enterprise.getWxSecurityType() != 5){
titleList.add("成员明文userid");
titleList.add("成员加密userid");
titleList.add("许可状态");
titleList.add("许可激活时间");
titleList.add("许可到期时间");
fileList.add("wxUserId");
fileList.add("wxOpenUseId");
fileList.add("status");
fileList.add("activeTime");
fileList.add("expireTime");
} }
try { try {
ExcelUtils.xls(response, request, fileName, voList, fileList, titleList); ExcelUtils.xls(response, request, fileName, voList, fileList, titleList);
......
...@@ -31,6 +31,87 @@ public class StaffExportVO implements Serializable{ ...@@ -31,6 +31,87 @@ public class StaffExportVO implements Serializable{
* gic品牌名称 * gic品牌名称
*/ */
private String enterpriseName; private String enterpriseName;
/**
* 微信用户id
*/
private String wxUserId;
/**
* 微信用户加密id
*/
private String wxOpenUseId;
/**
* 许可激活时间
*/
private String activeTime;
/**
* 许可过期时间
*/
private String expireTime;
/**
* 许可状态 0 未激活,1 正常有效,2 即将过期,3 已过期
*/
private Integer permitState;
/**
* 许可状态 0 未激活,1 正常有效,2 即将过期,3 已过期
*/
private String status;
public Integer getPermitState() {
return permitState;
}
public void setPermitState(Integer permitState) {
this.permitState = permitState;
}
public String getStatus() {
if (this.permitState == 0){
status = "未激活";
}else if (this.permitState == 1){
status = "正常有效";
}else if (this.permitState == 2){
status = "即将过期";
}else if (this.permitState == 3){
status = "已过期";
}
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getWxUserId() {
return wxUserId;
}
public void setWxUserId(String wxUserId) {
this.wxUserId = wxUserId;
}
public String getWxOpenUseId() {
return wxOpenUseId;
}
public void setWxOpenUseId(String wxOpenUseId) {
this.wxOpenUseId = wxOpenUseId;
}
public String getActiveTime() {
return activeTime;
}
public void setActiveTime(String activeTime) {
this.activeTime = activeTime;
}
public String getExpireTime() {
return expireTime;
}
public void setExpireTime(String expireTime) {
this.expireTime = expireTime;
}
public String getEnterpriseName() { public String getEnterpriseName() {
return enterpriseName; return enterpriseName;
......
...@@ -922,7 +922,13 @@ public class WxStaffController extends WebBaseController { ...@@ -922,7 +922,13 @@ public class WxStaffController extends WebBaseController {
AuditDTO auditDTO = auditApiService.findByBindRelatedIdAndAuditType(clerkId, AuditType.CLERK_BIND.getCode(), AuditDTO auditDTO = auditApiService.findByBindRelatedIdAndAuditType(clerkId, AuditType.CLERK_BIND.getCode(),
wxEnterpriseId, clerk.getEnterpriseId()); wxEnterpriseId, clerk.getEnterpriseId());
if (auditDTO != null) { if (auditDTO != null) {
return resultResponse(HaoBanErrCode.ERR_10018); // 验证码登录不需要管理员审核,需要删除该记录
if(auditType == 2){
auditDTO.setStatusFlag(0);
auditApiService.update(auditDTO);
}else {
return resultResponse(HaoBanErrCode.ERR_10018);
}
} }
String storeId = ""; String storeId = "";
String storeName = ""; String storeName = "";
......
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