Commit 0935869c by 墨竹

feat:增加微信userid转换

parent c9d7d331
...@@ -73,26 +73,28 @@ public class StaffDTO implements Serializable { ...@@ -73,26 +73,28 @@ public class StaffDTO implements Serializable {
private String clerkCode; private String clerkCode;
private String staffDepartmentRelatedId; private String staffDepartmentRelatedId;
private int clerkType; private int clerkType;
private Integer syncPostionFlag; private Integer syncPostionFlag;
private Integer superManagerFlag; private Integer superManagerFlag;
private Boolean weixinPush; private Boolean weixinPush;
private long memberCount; private long memberCount;
private String clerkId; private String clerkId;
/** /**
* 关联状态 1 已关联 0 未关联 * 关联状态 1 已关联 0 未关联
* 关联状态为 员工是否关联某门店导购 * 关联状态为 员工是否关联某门店导购
*/ */
private Integer relationFlag; private Integer relationFlag;
public String getClerkId() { private String wxOpenUseId;
public String getClerkId() {
return clerkId; return clerkId;
} }
...@@ -318,4 +320,12 @@ public class StaffDTO implements Serializable { ...@@ -318,4 +320,12 @@ public class StaffDTO implements Serializable {
public void setRelationFlag(Integer relationFlag) { public void setRelationFlag(Integer relationFlag) {
this.relationFlag = relationFlag; this.relationFlag = relationFlag;
} }
public String getWxOpenUseId() {
return wxOpenUseId;
}
public void setWxOpenUseId(String wxOpenUseId) {
this.wxOpenUseId = wxOpenUseId;
}
} }
...@@ -24,14 +24,6 @@ public interface MessageApiService { ...@@ -24,14 +24,6 @@ public interface MessageApiService {
void wxMessageReceive(QywxCallBackDTO qywxCallBackDTO); void wxMessageReceive(QywxCallBackDTO qywxCallBackDTO);
/** /**
* 队列消费gic推送数据
*
* @param param
*/
@Deprecated
void dealGicMessage(String param);
/**
* 队列消费企业微信推送数据 * 队列消费企业微信推送数据
* @param param * @param param
*/ */
......
...@@ -40,8 +40,6 @@ public interface StaffApiService { ...@@ -40,8 +40,6 @@ public interface StaffApiService {
void staffEdit(StaffDTO staffDTO, String departmentIds); void staffEdit(StaffDTO staffDTO, String departmentIds);
void syscGicClerk(String fieldListString);
StaffDTO selectByUserIdAndEnterpriseId(String userId, String wxEnterpriseId); StaffDTO selectByUserIdAndEnterpriseId(String userId, String wxEnterpriseId);
StaffDepartmentRelatedDTO getDepartmentIdAndStaffId(String departmentId, String staffId); StaffDepartmentRelatedDTO getDepartmentIdAndStaffId(String departmentId, String staffId);
...@@ -123,4 +121,27 @@ public interface StaffApiService { ...@@ -123,4 +121,27 @@ public interface StaffApiService {
* @date 2021-12-16 19:53:48 * @date 2021-12-16 19:53:48
*/ */
StaffPrivacyUseLogDTO getStaffPrivacyByStaffId(String staffId); StaffPrivacyUseLogDTO getStaffPrivacyByStaffId(String staffId);
/**
* 用户id wx企业id列表
*
* @param wxEnterpriseId wx企业标识
* @return {@link List<String> }
* @author mozhu
* @date 2021-12-21 17:05:33
*/
List<StaffDTO> listUserIdByWxEnterpriseId(String wxEnterpriseId);
/**
* 通过开放用户id和wx企业id列表
*
* @param openUserIds 开放的用户id
* @param wxEnterpriseId wx企业标识
* @return {@link List<StaffDTO> }
* @author mozhu
* @date 2021-12-21 17:23:36
*/
List<StaffDTO> listByOpenUserIdsAndWxEnterpriseId(List<String> openUserIds, String wxEnterpriseId);
} }
package com.gic.haoban.manage.service.dao.mapper; package com.gic.haoban.manage.service.dao.mapper;
import java.util.List;
import java.util.Set;
import org.apache.ibatis.annotations.Param;
import com.gic.haoban.manage.service.entity.TabHaobanStaff; import com.gic.haoban.manage.service.entity.TabHaobanStaff;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Set;
public interface StaffMapper { public interface StaffMapper {
int deleteByPrimaryKey(String staffId); int deleteByPrimaryKey(String staffId);
int insert(TabHaobanStaff record);
int insertSelective(TabHaobanStaff record); int insertSelective(TabHaobanStaff record);
TabHaobanStaff selectByPrimaryKey(String staffId); TabHaobanStaff selectByPrimaryKey(String staffId);
int updateByPrimaryKeySelective(TabHaobanStaff record); int updateByPrimaryKeySelective(TabHaobanStaff record);
TabHaobanStaff selectByNationcodeAndPhoneNumber(@Param("wxEnterpriseId") String wxEnterpriseId, @Param("nationCode") String nationcode, @Param("phoneNumber") String phoneNumber);
List<TabHaobanStaff> listByIds(@Param("staffIds") List<String> staffIds);
List<TabHaobanStaff> listByWxUserId(@Param("wxUserId") String wxUserId);
List<TabHaobanStaff> listLikeName(@Param("staffName") String staffName);
Page<TabHaobanStaff> pageStaff(@Param("staffIds") Set<String> staffIds, @Param("activeFlag") Integer activeFlag, @Param("keyword") String keyword);
int updateByPrimaryKey(TabHaobanStaff record); TabHaobanStaff selectByUserIdAndEnterpriseId(@Param("userId") String userId, @Param("wxEnterpriseId") String wxEnterpriseId);
TabHaobanStaff selectByNationcodeAndPhoneNumber(@Param("wxEnterpriseId")String wxEnterpriseId, @Param("nationCode")String nationcode, @Param("phoneNumber")String phoneNumber); TabHaobanStaff selectSuperByWxEnterpriseId(@Param("wxEnterpriseId") String wxEnterpriseId);
List<TabHaobanStaff> listByIds(@Param("staffIds")List<String> staffIds);
List<TabHaobanStaff> listByWxUserId(@Param("wxUserId")String wxUserId);
List<TabHaobanStaff> listLikeName(@Param("staffName")String staffName);
Page<TabHaobanStaff> pageStaff(@Param("staffIds")Set<String> staffIds, @Param("activeFlag")Integer activeFlag, @Param("keyword")String keyword); List<TabHaobanStaff> listByPhoneNumber(@Param("phoneNumber") String phoneNumber);
TabHaobanStaff selectByUserIdAndEnterpriseId(@Param("userId")String userId,@Param("wxEnterpriseId")String wxEnterpriseId); List<TabHaobanStaff> listByUserIdsAndWxEnterpriseId(@Param("userIds") List<String> userIds, @Param("wxEnterpriseId") String wxEnterpriseId);
TabHaobanStaff selectSuperByWxEnterpriseId(@Param("wxEnterpriseId")String wxEnterpriseId);
List<TabHaobanStaff> listByPhoneNumber(@Param("phoneNumber")String phoneNumber); int cleanStaff(@Param("wxEnterpriseId") String wxEnterpriseId, @Param("staffIds") List<String> staffIds);
List<TabHaobanStaff> listByUserIdsAndWxEnterpriseId(@Param("userIds")List<String> userIds, @Param("wxEnterpriseId")String wxEnterpriseId); TabHaobanStaff getWxStaffByOne(@Param("wxEnterpriseId") String wxEnterpriseId);
public int cleanStaff(@Param("wxEnterpriseId")String wxEnterpriseId,@Param("staffIds")List<String> staffIds); List<String> listUserStaffId(@Param("wxEnterpriseId") String wxEnterpriseId, @Param("staffIds") List<String> staffIds);
TabHaobanStaff getWxStaffByOne(@Param("wxEnterpriseId")String wxEnterpriseId); List<TabHaobanStaff> listNoStatusStaffIds(@Param("wxEnterpriseId") String wxEnterpriseId, @Param("staffIds") List<String> staffIds);
public List<String> listUserStaffId(@Param("wxEnterpriseId") String wxEnterpriseId, @Param("staffIds") List<String> staffIds); TabHaobanStaff getNoStatusByWxUserIds(@Param("wxEnterpriseId") String wxEnterpriseId, @Param("wxUserId") String wxUserId);
public List<TabHaobanStaff> listNoStatusStaffIds(@Param("wxEnterpriseId") String wxEnterpriseId, @Param("staffIds") List<String> staffIds); /**
* 通过开放用户id和wx企业id列表
*
* @param openUserIds 开放的用户id
* @param wxEnterpriseId wx企业标识
* @return {@link List<TabHaobanStaff> }
* @author mozhu
* @date 2021-12-21 16:35:35
*/
List<TabHaobanStaff> listByOpenUserIdsAndWxEnterpriseId(@Param("openUserIds") List<String> openUserIds,
@Param("wxEnterpriseId") String wxEnterpriseId);
public TabHaobanStaff getNoStatusByWxUserIds(@Param("wxEnterpriseId") String wxEnterpriseId, @Param("wxUserId") String wxUserId); /**
* 用户id wx企业id列表
*
* @param wxEnterpriseId wx企业标识
* @return {@link List<String> }
* @author mozhu
* @date 2021-12-21 17:05:58
*/
List<TabHaobanStaff> listUserIdByWxEnterpriseId(@Param("wxEnterpriseId") String wxEnterpriseId);
/**
* 更新开放用户id,用户id
*
* @param wxEnterpriseId wx企业标识
* @param wxUserId wx用户id
* @param wxOpenUseId 开放的用户id
* @return int
* @author mozhu
* @date 2021-12-21 17:17:51
*/
int updateOpenUserIdsByUserId(@Param("wxEnterpriseId") String wxEnterpriseId,
@Param("wxUserId") String wxUserId,
@Param("wxOpenUseId") String wxOpenUseId);
} }
\ No newline at end of file
...@@ -4,6 +4,9 @@ import java.io.Serializable; ...@@ -4,6 +4,9 @@ import java.io.Serializable;
import java.util.Date; import java.util.Date;
public class TabHaobanStaff implements Serializable { public class TabHaobanStaff implements Serializable {
private static final long serialVersionUID = 1L;
private String staffId; private String staffId;
private String wxUserId; private String wxUserId;
...@@ -40,7 +43,7 @@ public class TabHaobanStaff implements Serializable { ...@@ -40,7 +43,7 @@ public class TabHaobanStaff implements Serializable {
private Integer superManagerFlag; private Integer superManagerFlag;
private static final long serialVersionUID = 1L; private String wxOpenUseId;
public String getStaffId() { public String getStaffId() {
return staffId; return staffId;
...@@ -168,23 +171,29 @@ public class TabHaobanStaff implements Serializable { ...@@ -168,23 +171,29 @@ public class TabHaobanStaff implements Serializable {
public void setSort(Integer sort) { public void setSort(Integer sort) {
this.sort = sort; this.sort = sort;
} }
public Integer getSyncPostionFlag() { public Integer getSyncPostionFlag() {
return syncPostionFlag; return syncPostionFlag;
} }
public void setSyncPostionFlag(Integer syncPostionFlag) { public void setSyncPostionFlag(Integer syncPostionFlag) {
this.syncPostionFlag = syncPostionFlag; this.syncPostionFlag = syncPostionFlag;
} }
public Integer getSuperManagerFlag() { public Integer getSuperManagerFlag() {
return superManagerFlag; return superManagerFlag;
} }
public void setSuperManagerFlag(Integer superManagerFlag) { public void setSuperManagerFlag(Integer superManagerFlag) {
this.superManagerFlag = superManagerFlag; this.superManagerFlag = superManagerFlag;
} }
public String getWxOpenUseId() {
return wxOpenUseId;
}
public void setWxOpenUseId(String wxOpenUseId) {
this.wxOpenUseId = wxOpenUseId;
}
} }
\ No newline at end of file
package com.gic.haoban.manage.service.service; package com.gic.haoban.manage.service.service;
import java.util.List;
import java.util.Set;
import com.gic.haoban.manage.api.dto.StaffDTO; import com.gic.haoban.manage.api.dto.StaffDTO;
import com.gic.haoban.manage.service.entity.TabHaobanStaff; import com.gic.haoban.manage.service.entity.TabHaobanStaff;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Param;
public interface StaffService {
TabHaobanStaff selectById(String staffId);
TabHaobanStaff selectByNationcodeAndPhoneNumber(String wxEnterpriseId,String nationcode, String phoneNumber);
String add(TabHaobanStaff tab);
Page<TabHaobanStaff> pageStaff(Set<String> staffIds, Integer activeFlag, String keyword);
void updateByPrimaryKey(TabHaobanStaff tab); import java.util.List;
import java.util.Set;
int delByuserid(String staffId);
TabHaobanStaff selectByUserIdAndEnterpriseId(String userId, String wxEnterpriseId);
List<StaffDTO> listByUserIdsAndWxEnterpriseId(List<String> userIds, String wxEnterpriseId);
/**
* 清楚微信信息
* @param wxEnterpriseId
* @return
*/
public int cleanStaff(String wxEnterpriseId, List<String> staffIds);
TabHaobanStaff getWxStaffByOne( String wxEnterpriseId);
/** public interface StaffService {
* 获取需要删除的staff列表
* @param wxEnterpriseId
* @param staffIds
* @return
*/
public List<String> listDelUserStaffId(String wxEnterpriseId,List<String> staffIds);
/** TabHaobanStaff selectById(String staffId);
* 获取无状态的staff列表
* TabHaobanStaff selectByNationcodeAndPhoneNumber(String wxEnterpriseId, String nationcode, String phoneNumber);
* @param wxEnterpriseId
* @param staffIds String add(TabHaobanStaff tab);
* @return
*/ Page<TabHaobanStaff> pageStaff(Set<String> staffIds, Integer activeFlag, String keyword);
public List<TabHaobanStaff> listNoStatusByStaffIds(String wxEnterpriseId, List<String> staffIds);
void updateByPrimaryKey(TabHaobanStaff tab);
int delByuserid(String staffId);
TabHaobanStaff selectByUserIdAndEnterpriseId(String userId, String wxEnterpriseId);
List<StaffDTO> listByUserIdsAndWxEnterpriseId(List<String> userIds, String wxEnterpriseId);
/**
* 清楚微信信息
*
* @param wxEnterpriseId
* @return
*/
int cleanStaff(String wxEnterpriseId, List<String> staffIds);
TabHaobanStaff getWxStaffByOne(String wxEnterpriseId);
/**
* 获取需要删除的staff列表
*
* @param wxEnterpriseId
* @param staffIds
* @return
*/
List<String> listDelUserStaffId(String wxEnterpriseId, List<String> staffIds);
/**
* 获取无状态的staff列表
*
* @param wxEnterpriseId
* @param staffIds
* @return
*/
List<TabHaobanStaff> listNoStatusByStaffIds(String wxEnterpriseId, List<String> staffIds);
/**
* 通过开放用户id和wx企业id列表
*
* @param openUserIds 开放的用户id
* @param wxEnterpriseId wx企业标识
* @return {@link List<StaffDTO> }
* @author mozhu
* @date 2021-12-21 16:32:50
*/
List<StaffDTO> listByOpenUserIdsAndWxEnterpriseId(List<String> openUserIds, String wxEnterpriseId);
/**
* 更新开放用户id,用户id
*
* @param wxEnterpriseId wx企业标识
* @param wxUserId wx用户id
* @param wxOpenUseId wx开放使用id
* @return int
* @author mozhu
* @date 2021-12-21 17:19:33
*/
int updateOpenUserIdsByUserId(String wxEnterpriseId, String wxUserId, String wxOpenUseId);
} }
package com.gic.haoban.manage.service.service.impl; package com.gic.haoban.manage.service.service.impl;
import java.util.Date;
import java.util.List;
import java.util.Set;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.gic.commons.util.EntityUtil; import com.gic.commons.util.EntityUtil;
import com.gic.haoban.common.utils.StringUtil; import com.gic.haoban.common.utils.StringUtil;
import com.gic.haoban.manage.api.dto.StaffDTO; import com.gic.haoban.manage.api.dto.StaffDTO;
...@@ -16,6 +8,13 @@ import com.gic.haoban.manage.service.entity.TabHaobanStaff; ...@@ -16,6 +8,13 @@ import com.gic.haoban.manage.service.entity.TabHaobanStaff;
import com.gic.haoban.manage.service.service.MemberUnionRelatedService; import com.gic.haoban.manage.service.service.MemberUnionRelatedService;
import com.gic.haoban.manage.service.service.StaffService; import com.gic.haoban.manage.service.service.StaffService;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.Set;
@Service @Service
public class StaffServiceImpl implements StaffService { public class StaffServiceImpl implements StaffService {
...@@ -100,11 +99,21 @@ public class StaffServiceImpl implements StaffService { ...@@ -100,11 +99,21 @@ public class StaffServiceImpl implements StaffService {
@Override @Override
public List<String> listDelUserStaffId(String wxEnterpriseId, List<String> staffIds) { public List<String> listDelUserStaffId(String wxEnterpriseId, List<String> staffIds) {
return mapper.listUserStaffId(wxEnterpriseId,staffIds); return mapper.listUserStaffId(wxEnterpriseId, staffIds);
}
@Override
public List<TabHaobanStaff> listNoStatusByStaffIds(String wxEnterpriseId, List<String> staffIds) {
return mapper.listNoStatusStaffIds(wxEnterpriseId, staffIds);
} }
@Override @Override
public List<TabHaobanStaff> listNoStatusByStaffIds(String wxEnterpriseId, List<String> staffIds) { public List<StaffDTO> listByOpenUserIdsAndWxEnterpriseId(List<String> openUserIds, String wxEnterpriseId) {
return mapper.listNoStatusStaffIds(wxEnterpriseId, staffIds); return EntityUtil.changeEntityListByJSON(StaffDTO.class, mapper.listByOpenUserIdsAndWxEnterpriseId(openUserIds, wxEnterpriseId));
} }
@Override
public int updateOpenUserIdsByUserId(String wxEnterpriseId, String wxUserId, String wxOpenUseId) {
return mapper.updateOpenUserIdsByUserId(wxEnterpriseId, wxUserId, wxOpenUseId);
}
} }
...@@ -119,7 +119,6 @@ public class DealSyncOperationApiServiceImpl implements DealSyncOperationApiServ ...@@ -119,7 +119,6 @@ public class DealSyncOperationApiServiceImpl implements DealSyncOperationApiServ
} else if (dataPre.getDataType().equals(PreDealTypeEnum.store.getVal())) { } else if (dataPre.getDataType().equals(PreDealTypeEnum.store.getVal())) {
logger.info("门店处理:{}", params); logger.info("门店处理:{}", params);
operationMap.get("storeSyncOperation").dealSingleByMq(dealParamMqDTO, dataPre); operationMap.get("storeSyncOperation").dealSingleByMq(dealParamMqDTO, dataPre);
//成员处理 //成员处理
} else if (dataPre.getDataType().equals(PreDealTypeEnum.clerk.getVal())) { } else if (dataPre.getDataType().equals(PreDealTypeEnum.clerk.getVal())) {
logger.info("店员处理:{}", params); logger.info("店员处理:{}", params);
...@@ -142,14 +141,12 @@ public class DealSyncOperationApiServiceImpl implements DealSyncOperationApiServ ...@@ -142,14 +141,12 @@ public class DealSyncOperationApiServiceImpl implements DealSyncOperationApiServ
} else if (dataPre.getDataType().equals(PreDealTypeEnum.friend_merge.getVal())) { } else if (dataPre.getDataType().equals(PreDealTypeEnum.friend_merge.getVal())) {
operationMap.get("friendMergeSyncOperation").dealSingleByMq(dealParamMqDTO, dataPre); operationMap.get("friendMergeSyncOperation").dealSingleByMq(dealParamMqDTO, dataPre);
logger.info("好友合并处理:{}", params); logger.info("好友合并处理:{}", params);
} else if (dataPre.getDataType().equals(PreDealTypeEnum.tag.getVal())) { } else if (dataPre.getDataType().equals(PreDealTypeEnum.tag.getVal())) {
operationMap.get("friendTagSyncOperation").dealSingleByMq(dealParamMqDTO, dataPre); operationMap.get("friendTagSyncOperation").dealSingleByMq(dealParamMqDTO, dataPre);
logger.info("会员标签处理:{}", params); logger.info("会员标签处理:{}", params);
} else if (dataPre.getDataType().equals(PreDealTypeEnum.tag_member.getVal())) { } else if (dataPre.getDataType().equals(PreDealTypeEnum.tag_member.getVal())) {
operationMap.get("friendMemberTagSyncOperation").dealSingleByMq(dealParamMqDTO, dataPre); operationMap.get("friendMemberTagSyncOperation").dealSingleByMq(dealParamMqDTO, dataPre);
logger.info("会员标签处理标签项:{}", params); logger.info("会员标签处理标签项:{}", params);
} else { } else {
logger.info("不是正常数据:{}", params); logger.info("不是正常数据:{}", params);
} }
......
...@@ -115,10 +115,6 @@ public class MessageApiServiceImpl implements MessageApiService { ...@@ -115,10 +115,6 @@ public class MessageApiServiceImpl implements MessageApiService {
} }
@Override @Override
public void dealGicMessage(String param) {
}
@Override
public void dealWxMessage(String param) { public void dealWxMessage(String param) {
if (true) { if (true) {
log.info("不出发更新企业微信变更"); log.info("不出发更新企业微信变更");
......
...@@ -25,6 +25,7 @@ import com.gic.haoban.manage.api.dto.*; ...@@ -25,6 +25,7 @@ import com.gic.haoban.manage.api.dto.*;
import com.gic.haoban.manage.api.enums.SecretTypeEnum; import com.gic.haoban.manage.api.enums.SecretTypeEnum;
import com.gic.haoban.manage.api.service.DepartmentApiService; import com.gic.haoban.manage.api.service.DepartmentApiService;
import com.gic.haoban.manage.api.service.StaffApiService; import com.gic.haoban.manage.api.service.StaffApiService;
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.TabHaobanDepartment; import com.gic.haoban.manage.service.entity.TabHaobanDepartment;
...@@ -99,6 +100,8 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -99,6 +100,8 @@ public class StaffApiServiceImpl implements StaffApiService {
private SecretSettingService secretSettingService; private SecretSettingService secretSettingService;
@Autowired @Autowired
private StaffPrivacyUseLogService staffPrivacyUseLogService; private StaffPrivacyUseLogService staffPrivacyUseLogService;
@Autowired
private Config config;
@Override @Override
public StaffDTO selectById(String staffId) { public StaffDTO selectById(String staffId) {
...@@ -903,11 +906,6 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -903,11 +906,6 @@ public class StaffApiServiceImpl implements StaffApiService {
staffEditDeal(staffDTO, departmentIds, false); staffEditDeal(staffDTO, departmentIds, false);
} }
@Override
public void syscGicClerk(String fieldListString) {
// TODO Auto-generated method stub
}
@Override @Override
public StaffDTO selectByUserIdAndEnterpriseId(String userId, String wxEnterpriseId) { public StaffDTO selectByUserIdAndEnterpriseId(String userId, String wxEnterpriseId) {
...@@ -1475,4 +1473,14 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -1475,4 +1473,14 @@ public class StaffApiServiceImpl implements StaffApiService {
return EntityUtil.changeEntity(StaffPrivacyUseLogDTO.class, staffPrivacyUseLogService.getByStaffId(staffId)); return EntityUtil.changeEntity(StaffPrivacyUseLogDTO.class, staffPrivacyUseLogService.getByStaffId(staffId));
} }
@Override
public List<StaffDTO> listUserIdByWxEnterpriseId(String wxEnterpriseId) {
return EntityUtil.changeEntityListNew(StaffDTO.class, staffMapper.listUserIdByWxEnterpriseId(wxEnterpriseId));
}
@Override
public List<StaffDTO> listByOpenUserIdsAndWxEnterpriseId(List<String> openUserIds, String wxEnterpriseId) {
return EntityUtil.changeEntityListNew(StaffDTO.class, staffMapper.listByOpenUserIdsAndWxEnterpriseId(openUserIds, wxEnterpriseId));
}
} }
package com.gic.haoban.manage.service.task; package com.gic.haoban.manage.service.task;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.gic.clerk.api.dto.ClerkDTO;
import com.gic.clerk.api.service.ClerkService;
import com.gic.dubbo.entity.ProviderLocalTag;
import com.gic.enterprise.api.service.StoreGroupService;
import com.gic.enterprise.api.service.StoreService;
import com.gic.haoban.base.api.common.ServiceResponse; import com.gic.haoban.base.api.common.ServiceResponse;
import com.gic.haoban.manage.api.dto.DealParamMqDTO; import com.gic.haoban.manage.api.dto.DealParamMqDTO;
import com.gic.haoban.manage.api.dto.GicClerkDTO; import com.gic.haoban.manage.api.dto.StaffDTO;
import com.gic.haoban.manage.api.enums.PreDealStatusEnum; import com.gic.haoban.manage.api.enums.PreDealStatusEnum;
import com.gic.haoban.manage.api.enums.PreDealTypeEnum; import com.gic.haoban.manage.api.enums.PreDealTypeEnum;
import com.gic.haoban.manage.api.enums.SyncTaskStatusEnum; import com.gic.haoban.manage.api.enums.SyncTaskStatusEnum;
import com.gic.haoban.manage.api.service.DealSyncOperationApiService; import com.gic.haoban.manage.api.service.DealSyncOperationApiService;
import com.gic.haoban.manage.api.service.DepartmentApiService;
import com.gic.haoban.manage.api.service.StaffApiService; import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.service.config.Config;
import com.gic.haoban.manage.service.entity.TabHaobanPreDealLog; import com.gic.haoban.manage.service.entity.TabHaobanPreDealLog;
import com.gic.haoban.manage.service.entity.TabHaobanSyncTask; import com.gic.haoban.manage.service.entity.TabHaobanSyncTask;
import com.gic.haoban.manage.service.service.DepartmentService;
import com.gic.haoban.manage.service.service.PreDealService; import com.gic.haoban.manage.service.service.PreDealService;
import com.gic.haoban.manage.service.service.StaffService;
import com.gic.haoban.manage.service.service.SyncTaskService; import com.gic.haoban.manage.service.service.SyncTaskService;
import com.gic.redis.data.util.RedisUtil; import com.gic.redis.data.util.RedisUtil;
import org.apache.commons.lang.StringUtils; import com.gic.wechat.api.dto.qywx.QywxNewUseridDTO;
import com.gic.wechat.api.service.qywx.QywxUserApiService;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
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 java.util.Arrays;
import java.util.List;
/** /**
* Created 2020/4/13. * Created 2020/4/13.
* *
...@@ -37,44 +36,34 @@ public class QywxClerkSyncOperation implements BaseSyncOperation { ...@@ -37,44 +36,34 @@ public class QywxClerkSyncOperation implements BaseSyncOperation {
private static final Logger logger = LoggerFactory.getLogger(QywxClerkSyncOperation.class); private static final Logger logger = LoggerFactory.getLogger(QywxClerkSyncOperation.class);
@Autowired @Autowired
private DepartmentService departmentService;
@Autowired
private StoreGroupService storeGroupService;
@Autowired
private PreDealService preDealService; private PreDealService preDealService;
@Autowired @Autowired
private DepartmentApiService departmentApiService;
@Autowired
private SyncTaskService syncTaskService; private SyncTaskService syncTaskService;
@Autowired @Autowired
private StoreService storeService;
@Autowired
private ClerkService clerkService;
@Autowired
private StaffApiService staffApiService; private StaffApiService staffApiService;
@Autowired @Autowired
private DealSyncOperationApiService dealSyncOperationApiService; private DealSyncOperationApiService dealSyncOperationApiService;
@Autowired
private QywxUserApiService qywxUserApiService;
@Autowired
private Config config;
@Autowired
private StaffService staffService;
@Override @Override
public void dealSingleByMq(DealParamMqDTO dealParamMqDTO, TabHaobanPreDealLog dataPre) { public void dealSingleByMq(DealParamMqDTO dealParamMqDTO, TabHaobanPreDealLog dataPre) {
logger.info("微信成员处理:{}", JSONObject.toJSONString(dealParamMqDTO)); logger.info("微信成员处理:{}", JSONObject.toJSONString(dealParamMqDTO));
boolean dealFlag = true; boolean dealFlag = true;
String reason=""; String reason = "";
//处理clerk //处理clerk
try { try {
ServiceResponse response = staffApiService.getWxSaveNew(dealParamMqDTO.getData(), dataPre.getWxEnterpriseId()); ServiceResponse response = staffApiService.getWxSaveNew(dealParamMqDTO.getData(), dataPre.getWxEnterpriseId());
if (response.getCode()!=1) { if (response.getCode() != 1) {
dealFlag=false; dealFlag = false;
reason=response.getMessage(); reason = response.getMessage();
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
...@@ -125,16 +114,23 @@ public class QywxClerkSyncOperation implements BaseSyncOperation { ...@@ -125,16 +114,23 @@ public class QywxClerkSyncOperation implements BaseSyncOperation {
String key = "haoban_sync_clerk_task_" + taskId; String key = "haoban_sync_clerk_task_" + taskId;
RedisUtil.lock(key, 3L); RedisUtil.lock(key, 3L);
TabHaobanSyncTask syncTask = syncTaskService.getSyncTask(taskId); TabHaobanSyncTask syncTask = syncTaskService.getSyncTask(taskId);
String wxEnterpriseId = syncTask.getWxEnterpriseId();
//同步成功 进入门店处理 //同步成功 进入门店处理
if (syncTask.getStatusFlag().equals(SyncTaskStatusEnum.clerk_sync.getVal())) { if (syncTask.getStatusFlag().equals(SyncTaskStatusEnum.clerk_sync.getVal())) {
int errCount = preDealService.countByTaskId(taskId, -1, PreDealStatusEnum.exception.getVal()); int errCount = preDealService.countByTaskId(taskId, -1, PreDealStatusEnum.exception.getVal());
if (errCount > 0) { if (errCount > 0) {
syncTaskService.updateTaskStatus(taskId, SyncTaskStatusEnum.exception_compute.getVal()); syncTaskService.updateTaskStatus(taskId, SyncTaskStatusEnum.exception_compute.getVal());
dealSyncOperationApiService.unlockTask(syncTask.getWxEnterpriseId()); dealSyncOperationApiService.unlockTask(wxEnterpriseId);
} else { } else {
syncTaskService.updateTaskStatus(taskId, SyncTaskStatusEnum.compute.getVal()); syncTaskService.updateTaskStatus(taskId, SyncTaskStatusEnum.compute.getVal());
dealSyncOperationApiService.unlockTask(syncTask.getWxEnterpriseId()); dealSyncOperationApiService.unlockTask(wxEnterpriseId);
dealSyncOperationApiService.cleanDiffrence(syncTask.getWxEnterpriseId(),taskId); dealSyncOperationApiService.cleanDiffrence(wxEnterpriseId, taskId);
//批量处理wx_user_id to wx_open_user_id
List<StaffDTO> staffDTOS = staffApiService.listUserIdByWxEnterpriseId(wxEnterpriseId);
List<QywxNewUseridDTO> qywxNewUseridDTOS = qywxUserApiService.useridToOpenuserid(config.getCorpid(), config.getWxSuiteid(), Arrays.toString(staffDTOS.stream().map(StaffDTO::getWxUserId).toArray()));
for (QywxNewUseridDTO qywxNewUseridDTO : qywxNewUseridDTOS) {
staffService.updateOpenUserIdsByUserId(wxEnterpriseId, qywxNewUseridDTO.getUserid(), qywxNewUseridDTO.getOpen_userid());
}
} }
} }
RedisUtil.unlock(key); RedisUtil.unlock(key);
......
...@@ -6,7 +6,6 @@ import com.alibaba.fastjson.JSONObject; ...@@ -6,7 +6,6 @@ import com.alibaba.fastjson.JSONObject;
import com.gic.haoban.common.utils.HaobanResponse; import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.api.dto.*; import com.gic.haoban.manage.api.dto.*;
import com.gic.haoban.manage.api.service.StaffApiService; import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.api.service.StaffDepartmentRelatedApiService;
import com.gic.haoban.manage.api.service.WxApplicationApiService; import com.gic.haoban.manage.api.service.WxApplicationApiService;
import com.gic.haoban.manage.api.service.WxEnterpriseApiService; import com.gic.haoban.manage.api.service.WxEnterpriseApiService;
import com.gic.haoban.manage.web.auth.AuthRequestUtil; import com.gic.haoban.manage.web.auth.AuthRequestUtil;
...@@ -14,6 +13,7 @@ import com.gic.haoban.manage.web.errCode.HaoBanErrCode; ...@@ -14,6 +13,7 @@ import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import com.gic.haoban.manage.web.vo.AdminRoleVO; import com.gic.haoban.manage.web.vo.AdminRoleVO;
import com.gic.haoban.manage.web.vo.AdminVO; import com.gic.haoban.manage.web.vo.AdminVO;
import com.gic.wechat.api.service.qywx.QywxSuiteApiService; import com.gic.wechat.api.service.qywx.QywxSuiteApiService;
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;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -25,60 +25,63 @@ import java.util.ArrayList; ...@@ -25,60 +25,63 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
@RestController @RestController
public class AdminController extends WebBaseController{ public class AdminController extends WebBaseController {
private static Logger logger = LoggerFactory.getLogger(AdminController.class); private static final Logger logger = LoggerFactory.getLogger(AdminController.class);
@Autowired @Autowired
private QywxSuiteApiService qywxSuiteApiService; private QywxSuiteApiService qywxSuiteApiService;
@Autowired @Autowired
private StaffApiService staffApiService; private StaffApiService staffApiService;
@Autowired
private StaffDepartmentRelatedApiService staffDepartmentRelatedApiService;
@Autowired @Autowired
private WxApplicationApiService wxApplicationApiService; private WxApplicationApiService wxApplicationApiService;
@Autowired @Autowired
private WxEnterpriseApiService wxEnterpriseApiService; private WxEnterpriseApiService wxEnterpriseApiService;
@RequestMapping("admin-list") @RequestMapping("admin-list")
public HaobanResponse adminList() { public HaobanResponse adminList() {
LoginDTO login = (LoginDTO) AuthRequestUtil.getLoginUser(); LoginDTO login = (LoginDTO) AuthRequestUtil.getLoginUser();
String wxEnterpriseId = login.getWxEnterpriseId(); String wxEnterpriseId = login.getWxEnterpriseId();
WxApplicationDTO application = wxApplicationApiService.selectByWxEnterpriseIdAndApplicationType(wxEnterpriseId, 2); WxApplicationDTO application = wxApplicationApiService.selectByWxEnterpriseIdAndApplicationType(wxEnterpriseId, 2);
WxEnterpriseDTO enterprise = wxEnterpriseApiService.getOne(wxEnterpriseId); WxEnterpriseDTO enterprise = wxEnterpriseApiService.getOne(wxEnterpriseId);
logger.info("【管理员查询】corpid={},siteId={},agentId={}",enterprise.getCorpid(),application.getSiteId(),application.getAgentId()); String corpid = enterprise.getCorpid();
String adminList = qywxSuiteApiService.getAdminList(enterprise.getCorpid(), application.getSiteId(), Integer.parseInt(application.getAgentId())); logger.info("【管理员查询】corpid={},siteId={},agentId={}", corpid, application.getSiteId(), application.getAgentId());
logger.info("【管理员查询】userIds={}",JSON.toJSONString(adminList)); String adminList = qywxSuiteApiService.getAdminList(corpid, application.getSiteId(), Integer.parseInt(application.getAgentId()));
List<String> userIds = new ArrayList<String>(); logger.info("【管理员查询】userIds={}", JSON.toJSONString(adminList));
if(StringUtils.isNotBlank(adminList)){ List<String> openUserIds = new ArrayList<>();
JSONArray jsonArr = JSON.parseArray(adminList); if (StringUtils.isNotBlank(adminList)) {
for (Object object : jsonArr) { JSONArray jsonArr = JSON.parseArray(adminList);
JSONObject json = JSON.parseObject(JSON.toJSONString(object)); for (Object object : jsonArr) {
userIds.add(json.getString("userid")); JSONObject json = JSON.parseObject(JSON.toJSONString(object));
} openUserIds.add(json.getString("userid"));
} }
List<StaffDTO> list = new ArrayList<>(); }
List<AdminVO> resultList = new ArrayList<>(); List<StaffDTO> list = new ArrayList<>();
if(!userIds.isEmpty()){ List<AdminVO> resultList = new ArrayList<>();
list = staffApiService.listByUserIdsAndWxEnterpriseId(userIds,wxEnterpriseId); if (CollectionUtils.isNotEmpty(openUserIds)) {
for (StaffDTO staffDTO : list) { if (corpid.length() > 20) {
AdminVO vo = new AdminVO(); list = staffApiService.listByOpenUserIdsAndWxEnterpriseId(openUserIds, wxEnterpriseId);
vo.setRoleId(staffDTO.getStaffId()); } else {
vo.setRoleName("管理员"); list = staffApiService.listByUserIdsAndWxEnterpriseId(openUserIds, wxEnterpriseId);
List<AdminRoleVO> roleList = new ArrayList<>(); }
List<DepartmentDTO> departmentList = staffDTO.getDepartmentList(); for (StaffDTO staffDTO : list) {
for (DepartmentDTO departmentDTO : departmentList) { AdminVO vo = new AdminVO();
AdminRoleVO role = new AdminRoleVO(); vo.setRoleId(staffDTO.getStaffId());
role.setDepartmentName(departmentDTO.getDepartmentName()); vo.setRoleName("管理员");
role.setUserName(staffDTO.getStaffName()); List<AdminRoleVO> roleList = new ArrayList<>();
role.setUserPhone(staffDTO.getPhoneNumber()); List<DepartmentDTO> departmentList = staffDTO.getDepartmentList();
roleList.add(role); for (DepartmentDTO departmentDTO : departmentList) {
} AdminRoleVO role = new AdminRoleVO();
vo.setRoleUser(roleList); role.setDepartmentName(departmentDTO.getDepartmentName());
resultList.add(vo); role.setUserName(staffDTO.getStaffName());
} role.setUserPhone(staffDTO.getPhoneNumber());
} roleList.add(role);
return resultResponse(HaoBanErrCode.ERR_1,resultList); }
} vo.setRoleUser(roleList);
resultList.add(vo);
}
}
return resultResponse(HaoBanErrCode.ERR_1, resultList);
}
} }
...@@ -249,8 +249,12 @@ public class ApplicationController extends WebBaseController { ...@@ -249,8 +249,12 @@ public class ApplicationController extends WebBaseController {
return resultResponse(HaoBanErrCode.ERR_0, this.qywxUserApiService.getExternalUseridByUnionid(corpid, suiteid, unionid)); return resultResponse(HaoBanErrCode.ERR_0, this.qywxUserApiService.getExternalUseridByUnionid(corpid, suiteid, unionid));
} }
/**
* 通讯录同步
*
* @return
*/
@RequestMapping("sync-qywx") @RequestMapping("sync-qywx")
@IgnoreLogin
public Object syncQywx() { public Object syncQywx() {
LoginDTO login = (LoginDTO) AuthRequestUtil.getLoginUser(); LoginDTO login = (LoginDTO) AuthRequestUtil.getLoginUser();
String wxEnterpriseId = login.getWxEnterpriseId(); String wxEnterpriseId = login.getWxEnterpriseId();
......
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