Commit 792b8f12 by 徐高华

Merge branch 'master' into 'feature/订单中台'

# Conflicts:
#   haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/MessageApiServiceImpl.java
parents 514de758 6ca3def8
...@@ -23,7 +23,8 @@ public interface TabHaobanStaffClerkRelationMapper { ...@@ -23,7 +23,8 @@ public interface TabHaobanStaffClerkRelationMapper {
StaffClerkRelationDTO getOneByClerkId(@Param("clerkId") String clerkId,@Param("wxEnterpriseId") String wxEnterpriseId); StaffClerkRelationDTO getOneByClerkId(@Param("clerkId") String clerkId,@Param("wxEnterpriseId") String wxEnterpriseId);
StaffClerkRelationDTO getByCodeAndEnterpriseId(@Param("clerkCode") String clerkCode, @Param("enterpriseId") String enterpriseId); StaffClerkRelationDTO getByCodeAndEnterpriseId(@Param("clerkCode") String clerkCode, @Param("enterpriseId") String enterpriseId);
StaffClerkRelationDTO getStaffClerkRelationDTO(@Param("clerkCode") String clerkCode, @Param("enterpriseId") String enterpriseId);
List<StaffClerkRelationDTO> listByClerkIds(@Param("clerkIds") List<String> clerkIds, @Param("wxEnterpriseId") String wxEnterpriseId); List<StaffClerkRelationDTO> listByClerkIds(@Param("clerkIds") List<String> clerkIds, @Param("wxEnterpriseId") String wxEnterpriseId);
StaffClerkRelationDTO getOneByStoreIdAndStaffId(@Param("storeId") String storeId, @Param("staffId") String staffId); StaffClerkRelationDTO getOneByStoreIdAndStaffId(@Param("storeId") String storeId, @Param("staffId") String staffId);
......
...@@ -43,6 +43,7 @@ public interface StaffClerkRelationService { ...@@ -43,6 +43,7 @@ public interface StaffClerkRelationService {
StaffClerkRelationDTO getBindByClerkId(String clerkId, String wxEnterpriseId); StaffClerkRelationDTO getBindByClerkId(String clerkId, String wxEnterpriseId);
StaffClerkRelationDTO getByCodeAndEnterpriseId(String clerkCode, String enterpriseId); StaffClerkRelationDTO getByCodeAndEnterpriseId(String clerkCode, String enterpriseId);
StaffClerkRelationDTO getStaffClerkRelationDTO(String clerkCode, String enterpriseId);
String insert(StaffClerkRelationDTO staffClerkRelation); String insert(StaffClerkRelationDTO staffClerkRelation);
......
...@@ -45,6 +45,7 @@ public class StaffClerkBindLogServiceImpl implements StaffClerkBindLogService { ...@@ -45,6 +45,7 @@ public class StaffClerkBindLogServiceImpl implements StaffClerkBindLogService {
@Override @Override
public void pushToMq(String staffId, String optStaffId, int optType, int channelCode, String relationId) { public void pushToMq(String staffId, String optStaffId, int optType, int channelCode, String relationId) {
StaffClerkBindLogInfoDTO infoDTO = new StaffClerkBindLogInfoDTO(); StaffClerkBindLogInfoDTO infoDTO = new StaffClerkBindLogInfoDTO();
infoDTO.setChannelCode(channelCode); infoDTO.setChannelCode(channelCode);
infoDTO.setOptStaffId(optStaffId); infoDTO.setOptStaffId(optStaffId);
......
...@@ -216,6 +216,11 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService ...@@ -216,6 +216,11 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
return mapper.getByCodeAndEnterpriseId(clerkCode, enterpriseId); return mapper.getByCodeAndEnterpriseId(clerkCode, enterpriseId);
} }
@Override
public StaffClerkRelationDTO getStaffClerkRelationDTO(String clerkCode, String enterpriseId) {
return mapper.getStaffClerkRelationDTO(clerkCode, enterpriseId);
}
@Override @Override
public String insert(StaffClerkRelationDTO staffClerkRelation) { public String insert(StaffClerkRelationDTO staffClerkRelation) {
......
package com.gic.haoban.manage.service.service.out.impl; package com.gic.haoban.manage.service.service.out.impl;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
...@@ -17,6 +18,9 @@ import org.apache.logging.log4j.Logger; ...@@ -17,6 +18,9 @@ import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.gic.clerk.api.dto.ClerkDTO; import com.gic.clerk.api.dto.ClerkDTO;
...@@ -68,6 +72,7 @@ import com.gic.thirdparty.cloudfile.enums.CloudFileBusinessOptEnum; ...@@ -68,6 +72,7 @@ import com.gic.thirdparty.cloudfile.enums.CloudFileBusinessOptEnum;
import com.gic.thirdparty.cloudfile.enums.CloudFileTypeEnum; import com.gic.thirdparty.cloudfile.enums.CloudFileTypeEnum;
import com.gic.thirdparty.cloudfile.pojo.CloudFileInfo; import com.gic.thirdparty.cloudfile.pojo.CloudFileInfo;
import com.gic.wechat.api.dto.qywx.ItemDTO; import com.gic.wechat.api.dto.qywx.ItemDTO;
import com.gic.wechat.api.dto.qywx.QywxNewUseridDTO;
import com.gic.wechat.api.dto.qywx.QywxXcxSendMessageDTO; import com.gic.wechat.api.dto.qywx.QywxXcxSendMessageDTO;
import com.gic.wechat.api.dto.qywx.UserDTO; import com.gic.wechat.api.dto.qywx.UserDTO;
import com.gic.wechat.api.service.qywx.QywxDepartmentApiService; import com.gic.wechat.api.service.qywx.QywxDepartmentApiService;
...@@ -256,10 +261,24 @@ public class MessageApiServiceImpl implements MessageApiService { ...@@ -256,10 +261,24 @@ public class MessageApiServiceImpl implements MessageApiService {
// 修改 // 修改
TabHaobanStaff oldStaff = this.staffService.selectByUserIdAndEnterpriseId(userid, wxEnterpriseId); TabHaobanStaff oldStaff = this.staffService.selectByUserIdAndEnterpriseId(userid, wxEnterpriseId);
if (oldStaff == null) { if (oldStaff == null) {
//员工可能修改userId,需要拿到openUserId再去查询一次
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId);
if (qwDTO != null && (qwDTO.getWxSecurityType() == 1 || qwDTO.getWxSecurityType() == 3)){
String openUserid = getOpenUserid(userid, qwDTO);
if (StringUtils.isNotBlank(openUserid)){
oldStaff = this.staffService.selectByUserIdAndEnterpriseId(openUserid, wxEnterpriseId);
}
}
}
if (oldStaff == null){
log.error("成员同步更新失败,无历史员工数据:userid:{},wxEnterpriseId:{}", userid, wxEnterpriseId); log.error("成员同步更新失败,无历史员工数据:userid:{},wxEnterpriseId:{}", userid, wxEnterpriseId);
return; return;
} }
TabHaobanStaff staff = new TabHaobanStaff(); TabHaobanStaff staff = new TabHaobanStaff();
if (!userid.equals(oldStaff.getWxUserId())){
//userId可能也会更新
staff.setWxUserId(userid);
}
staff.setStaffId(oldStaff.getStaffId()); staff.setStaffId(oldStaff.getStaffId());
staff.setPhoneNumber(qywxCallBackDTO.getMobile()); staff.setPhoneNumber(qywxCallBackDTO.getMobile());
staff.setNickName(qywxCallBackDTO.getAlias()); staff.setNickName(qywxCallBackDTO.getAlias());
...@@ -356,6 +375,14 @@ public class MessageApiServiceImpl implements MessageApiService { ...@@ -356,6 +375,14 @@ public class MessageApiServiceImpl implements MessageApiService {
} }
log.error("成员同步结束"); log.error("成员同步结束");
} }
private String getOpenUserid(String userId,WxEnterpriseQwDTO qwDTO) {
List<QywxNewUseridDTO> list = qywxUserApiService.useridToOpenuserid(qwDTO.getThirdCorpid(), config.getWxSuiteid(), Collections.singletonList(userId));
log.info("明文userId转密文={},{}", userId, JSON.toJSONString(list));
if (CollectionUtils.isEmpty(list)) {
return "";
}
return list.get(0).getOpen_userid();
}
/** /**
* 处理部门 * 处理部门
......
...@@ -98,10 +98,12 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -98,10 +98,12 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
clerkName = clerkDTO.getClerkName(); clerkName = clerkDTO.getClerkName();
} }
String operClerkId = infoDTO.getOptStaffId(); String operClerkId = infoDTO.getOptStaffId();
clerkDTO = clerkService.getClerkByClerkIdNoStatus(clerkRelation.getClerkId()); //操作人只有staffId,operName字段存储成员名称
TabHaobanStaff tabHaobanStaff = staffService.selectById(operClerkId);
// clerkDTO = clerkService.getClerkByClerkIdNoStatus(clerkRelation.getClerkId());
String operName = null; String operName = null;
if (null != clerkDTO) { if (null != tabHaobanStaff) {
operName = clerkDTO.getClerkName(); operName = tabHaobanStaff.getStaffName();
} }
TabHaobanStaffClerkBindLog enity = new TabHaobanStaffClerkBindLog(); TabHaobanStaffClerkBindLog enity = new TabHaobanStaffClerkBindLog();
enity.setClerkId(clerkRelation.getClerkId()); enity.setClerkId(clerkRelation.getClerkId());
...@@ -491,7 +493,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -491,7 +493,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
} }
} else if (type == 2) { } else if (type == 2) {
logger.info("导购门店转移,新的导购和门店,clerkId={},storeId={}", clerkId, clerkSyncQDTO.getStoreId()); logger.info("导购门店转移,新的导购和门店,clerkId={},storeId={}", clerkId, clerkSyncQDTO.getStoreId());
StaffClerkRelationDTO oldRelationDTO = staffClerkRelationService.getByCodeAndEnterpriseId(clerkCode, enterpriseId); StaffClerkRelationDTO oldRelationDTO = staffClerkRelationService.getStaffClerkRelationDTO(clerkCode, enterpriseId);
if (null == oldRelationDTO) { if (null == oldRelationDTO) {
logger.info("导购未关联成员,clerkCode={}", clerkCode); logger.info("导购未关联成员,clerkCode={}", clerkCode);
return; return;
...@@ -528,8 +530,10 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -528,8 +530,10 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
hmQrcodeService.updateClerkNameByClerkId(enterpriseId, clerkId, clerkDTO.getClerkName(), clerkDTO.getClerkCode()); hmQrcodeService.updateClerkNameByClerkId(enterpriseId, clerkId, clerkDTO.getClerkName(), clerkDTO.getClerkCode());
} else if (clerkType == 2) { } else if (clerkType == 2) {
logger.info("区经变更为导购,解绑:{}", clerkId); logger.info("区经变更为导购,解绑:{}", clerkId);
//解绑 //解绑,判断当前区经是否开启好办权限,不开启则解绑
staffClerkRelationService.delBind(clerkId, "-1", ChannelCodeEnum.GIC_CLERK_DEL_UNBIND.getCode(), null,null); if (clerkDTO.getEnableHaoban() == null || clerkDTO.getEnableHaoban()==false){
staffClerkRelationService.delBind(clerkId, "-1", ChannelCodeEnum.GIC_CLERK_DEL_UNBIND.getCode(), null,null);
}
} }
} }
} }
......
...@@ -598,7 +598,7 @@ ...@@ -598,7 +598,7 @@
wx_user_id in wx_user_id in
</if> </if>
<if test="mixFlag==1"> <if test="mixFlag==1">
open_concat_flag in wx_open_user_id in
</if> </if>
<foreach collection="wxUserIdList" index="index" item="id" close=")" open="(" separator=","> <foreach collection="wxUserIdList" index="index" item="id" close=")" open="(" separator=",">
#{id} #{id}
......
...@@ -89,6 +89,14 @@ ...@@ -89,6 +89,14 @@
and a.enterprise_id = #{enterpriseId} and a.enterprise_id = #{enterpriseId}
and a.clerk_code = #{clerkCode} order by a.create_time desc limit 1 and a.clerk_code = #{clerkCode} order by a.create_time desc limit 1
</select> </select>
<select id="getStaffClerkRelationDTO" resultType="com.gic.haoban.manage.api.dto.StaffClerkRelationDTO">
<include refid="leftJoinStaffSQL"/>
where a.status_flag = 1 and b.status_flag = 1
and a.manage_flag = 0
and a.enterprise_id = #{enterpriseId}
and a.clerk_code = #{clerkCode} order by a.create_time desc limit 1
</select>
<update id="changeStatusByClerkId"> <update id="changeStatusByClerkId">
......
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