Commit 174a1699 by 墨竹

feat:转换userid

parent 0b8048af
...@@ -315,4 +315,23 @@ public interface MemberUnionidRelatedApiService { ...@@ -315,4 +315,23 @@ public interface MemberUnionidRelatedApiService {
*/ */
void updateSelfExternalUseridById(String selfExternalUserid, String memberUnionidRelatedId); void updateSelfExternalUseridById(String selfExternalUserid, String memberUnionidRelatedId);
/**
* 更新新userid corpid
*
* @param wxEnterpriseId wx企业标识
* @return {@link ServiceResponse }
* @author mozhu
* @date 2022-06-30 13:54:12
*/
ServiceResponse updateNewUseridCorpid(String wxEnterpriseId);
/**
* 更新新userid corpid mq
*
* @param params 参数个数
* @author mozhu
* @date 2022-06-30 13:56:27
*/
void updateNewUseridCorpidMq(String params);
} }
package com.gic.haoban.manage.web.controller; package com.gic.haoban.manage.web.controller;
import java.io.IOException; import cn.hutool.core.collection.CollectionUtil;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
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.authcenter.commons.dto.AuthcenterUserDetails; import com.gic.authcenter.commons.dto.AuthcenterUserDetails;
...@@ -43,19 +20,9 @@ import com.gic.haoban.base.api.common.ServiceResponse; ...@@ -43,19 +20,9 @@ import com.gic.haoban.base.api.common.ServiceResponse;
import com.gic.haoban.common.utils.EntityUtil; import com.gic.haoban.common.utils.EntityUtil;
import com.gic.haoban.common.utils.HaobanResponse; import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.common.utils.UuidUtil; import com.gic.haoban.common.utils.UuidUtil;
import com.gic.haoban.manage.api.dto.BindStoreInfoDTO; import com.gic.haoban.manage.api.dto.*;
import com.gic.haoban.manage.api.dto.DepartmentDTO;
import com.gic.haoban.manage.api.dto.EnterpriseDetailDTO;
import com.gic.haoban.manage.api.dto.StoreOrGroupInfoDTO;
import com.gic.haoban.manage.api.dto.StoreRangeInfoDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseRelationDetailDTO;
import com.gic.haoban.manage.api.dto.YwWxEnterpriseDTO;
import com.gic.haoban.manage.api.enums.ChannelCodeEnum; import com.gic.haoban.manage.api.enums.ChannelCodeEnum;
import com.gic.haoban.manage.api.service.DepartmentApiService; import com.gic.haoban.manage.api.service.*;
import com.gic.haoban.manage.api.service.ExternalClerkRelatedApiService;
import com.gic.haoban.manage.api.service.WxEnterpriseApiService;
import com.gic.haoban.manage.api.service.WxEnterpriseRelatedApiService;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode; import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import com.gic.haoban.manage.web.qo.WxEnterpriseBindQo; import com.gic.haoban.manage.web.qo.WxEnterpriseBindQo;
import com.gic.haoban.manage.web.vo.EnterpriseDetailVo; import com.gic.haoban.manage.web.vo.EnterpriseDetailVo;
...@@ -66,8 +33,20 @@ import com.gic.redis.data.util.RedisUtil; ...@@ -66,8 +33,20 @@ import com.gic.redis.data.util.RedisUtil;
import com.gic.wechat.api.service.qywx.QywxUserApiService; import com.gic.wechat.api.service.qywx.QywxUserApiService;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import cn.hutool.core.collection.CollectionUtil; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.*;
import java.util.stream.Collectors;
@RestController @RestController
public class EnterpriseController extends WebBaseController { public class EnterpriseController extends WebBaseController {
...@@ -96,6 +75,8 @@ public class EnterpriseController extends WebBaseController { ...@@ -96,6 +75,8 @@ public class EnterpriseController extends WebBaseController {
private GroupSendOperateApiService groupSendOperateApiService; private GroupSendOperateApiService groupSendOperateApiService;
@Autowired @Autowired
private StoreGroupService storeGroupService ; private StoreGroupService storeGroupService ;
@Autowired
private MemberUnionidRelatedApiService memberUnionidRelatedApiService;
private static final String QYWX_TAG_OPRN_KEY = "qywx-tag-open"; private static final String QYWX_TAG_OPRN_KEY = "qywx-tag-open";
private static final String QYWX_TAG_OPRN_KEY_LOCK = "qywx-tag-open-lock"; private static final String QYWX_TAG_OPRN_KEY_LOCK = "qywx-tag-open-lock";
...@@ -644,4 +625,18 @@ public class EnterpriseController extends WebBaseController { ...@@ -644,4 +625,18 @@ public class EnterpriseController extends WebBaseController {
WxEnterpriseRelationDetailDTO bindInfo = wxEnterpriseRelatedApiService.getEnterpriseBindInfo(wxEnterpriseId, enterpriseId); WxEnterpriseRelationDetailDTO bindInfo = wxEnterpriseRelatedApiService.getEnterpriseBindInfo(wxEnterpriseId, enterpriseId);
return resultResponse(HaoBanErrCode.ERR_1, bindInfo); return resultResponse(HaoBanErrCode.ERR_1, bindInfo);
} }
@RequestMapping("/updateNewUseridCorpid")
public HaobanResponse updateNewUseridCorpid(String wxEnterpriseId) {
ServiceResponse serviceResponse = memberUnionidRelatedApiService.updateNewUseridCorpid(wxEnterpriseId);
int code = serviceResponse.getCode();
if (HaoBanErrCode.ERR_1.getCode() == code) {
return resultResponse(HaoBanErrCode.ERR_1);
} else {
String message = serviceResponse.getMessage();
return resultResponse(HaoBanErrCode.ERR_0, message);
}
}
} }
...@@ -68,4 +68,28 @@ public interface MemberUnionidRelatedMapper { ...@@ -68,4 +68,28 @@ public interface MemberUnionidRelatedMapper {
int updateExternalUserIdByOldExternalUserId(@Param("newExternalUserId") String new_external_userid, int updateExternalUserIdByOldExternalUserId(@Param("newExternalUserId") String new_external_userid,
@Param("oldExternalUserId") String external_userid, @Param("oldExternalUserId") String external_userid,
@Param("wxEnterpriseId") String wxEnterpriseId); @Param("wxEnterpriseId") String wxEnterpriseId);
/**
* 更新用户id wx企业id
*
* @param wxEnterpriseId wx企业标识
* @return int
* @author mozhu
* @date 2022-06-30 16:32:46
*/
int updateUserIdByWxEnterpriseId(@Param("wxEnterpriseId")String wxEnterpriseId);
/**
* 更新自建外部用户id
*
* @param new_external_userid 新外部标识
* @param external_userid 外部用户标识
* @param wxEnterpriseId wx企业标识
* @return int
* @author mozhu
* @date 2022-06-30 16:35:21
*/
int updateSelfExternalUserIdByOldSelfExternalUserId(@Param("newExternalUserId") String new_external_userid,
@Param("oldExternalUserId") String external_userid,
@Param("wxEnterpriseId") String wxEnterpriseId);
} }
\ No newline at end of file
package com.gic.haoban.manage.service.dao.mapper; package com.gic.haoban.manage.service.dao.mapper;
import java.util.List;
import com.gic.api.base.commons.Page;
import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO;
import com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated; import com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface StaffDepartmentRelatedMapper { public interface StaffDepartmentRelatedMapper {
int deleteByPrimaryKey(String staffDepartmentRelatedId); int deleteByPrimaryKey(String staffDepartmentRelatedId);
...@@ -58,4 +56,14 @@ public interface StaffDepartmentRelatedMapper { ...@@ -58,4 +56,14 @@ public interface StaffDepartmentRelatedMapper {
@Param("wxEnterpriseId") String wxEnterpriseId, @Param("wxEnterpriseId") String wxEnterpriseId,
@Param("staffId") String staffId @Param("staffId") String staffId
); );
/**
* 更新用户id wx企业id
*
* @param wxEnterpriseId wx企业标识
* @return int
* @author mozhu
* @date 2022-06-30 16:25:33
*/
int updateUserIdByWxEnterpriseId(@Param("wxEnterpriseId") String wxEnterpriseId);
} }
\ No newline at end of file
...@@ -148,4 +148,28 @@ public interface StaffMapper { ...@@ -148,4 +148,28 @@ public interface StaffMapper {
@Param("staffId") String staffId, @Param("staffId") String staffId,
@Param("wxEnterpriseId") String wxEnterpriseId); @Param("wxEnterpriseId") String wxEnterpriseId);
/**
* wx企业id员工列表
*
* @param wxEnterpriseId wx企业标识
* @return {@link List }<{@link TabHaobanStaff }>
* @author mozhu
* @date 2022-06-30 14:04:05
*/
List<TabHaobanStaff> listByWxEnterpriseId(@Param("wxEnterpriseId") String wxEnterpriseId);
/**
* 更新wx用户id通过员工id
*
* @param wxEnterpriseId wx企业标识
* @param newWxUserId 新wx用户id
* @param oldWxUserId 老wx用户id
* @return int
* @author mozhu
* @date 2022-06-30 15:53:13
*/
int updateUserIdByUserId(@Param("wxEnterpriseId") String wxEnterpriseId,
@Param("newWxUserId") String newWxUserId,
@Param("oldWxUserId") String oldWxUserId);
} }
\ No newline at end of file
...@@ -370,4 +370,13 @@ public interface TabHaobanExternalClerkRelatedMapper { ...@@ -370,4 +370,13 @@ public interface TabHaobanExternalClerkRelatedMapper {
int countByMemberId(@Param("memberId") String memberId, int countByMemberId(@Param("memberId") String memberId,
@Param("enterpriseId") String enterpriseId); @Param("enterpriseId") String enterpriseId);
/**
* 更新用户id wx企业id
*
* @param wxEnterpriseId wx企业标识
* @return int
* @author mozhu
* @date 2022-06-30 16:36:11
*/
int updateUserIdByWxEnterpriseId(@Param("wxEnterpriseId") String wxEnterpriseId);
} }
\ No newline at end of file
...@@ -178,4 +178,14 @@ public interface TabHaobanStaffClerkRelationMapper { ...@@ -178,4 +178,14 @@ public interface TabHaobanStaffClerkRelationMapper {
@Param("memberIdList") List<String> memberIdList, @Param("memberIdList") List<String> memberIdList,
@Param("clerkIdList") List<String> clerkIdList, @Param("clerkIdList") List<String> clerkIdList,
@Param("enterpriseId") String enterpriseId); @Param("enterpriseId") String enterpriseId);
/**
* 更新用户id wx企业id
*
* @param wxEnterpriseId wx企业标识
* @return int
* @author mozhu
* @date 2022-06-30 16:21:31
*/
int updateUserIdByWxEnterpriseId(@Param("wxEnterpriseId") String wxEnterpriseId);
} }
\ No newline at end of file
...@@ -5,7 +5,9 @@ package com.gic.haoban.manage.service.errorcode; ...@@ -5,7 +5,9 @@ package com.gic.haoban.manage.service.errorcode;
*/ */
public enum HaoBanErrCode { public enum HaoBanErrCode {
ERR_0001("10100001", "参数没有传"),; ERR_0001("10100001", "参数没有传"),
ERR_10012("10012","企业微信不存在"),
;
private String code; private String code;
private String msg; private String msg;
......
package com.gic.haoban.manage.service.service; package com.gic.haoban.manage.service.service;
import java.util.Collection;
import java.util.List;
import com.gic.haoban.manage.api.dto.ExternalClerkRelatedDTO; import com.gic.haoban.manage.api.dto.ExternalClerkRelatedDTO;
import com.gic.haoban.manage.api.dto.MemberUnionidRelatedDTO; import com.gic.haoban.manage.api.dto.MemberUnionidRelatedDTO;
import com.gic.haoban.manage.service.entity.TabHaobanExternalClerkRelated; import com.gic.haoban.manage.service.entity.TabHaobanExternalClerkRelated;
import java.util.Collection;
import java.util.List;
public interface ExternalClerkRelatedService { public interface ExternalClerkRelatedService {
void insert(TabHaobanExternalClerkRelated related); void insert(TabHaobanExternalClerkRelated related);
...@@ -66,4 +66,14 @@ public interface ExternalClerkRelatedService { ...@@ -66,4 +66,14 @@ public interface ExternalClerkRelatedService {
* @return * @return
*/ */
String checkAndUpdateMemberByUnonId(String enterpriseId, String memberId, String unionId); String checkAndUpdateMemberByUnonId(String enterpriseId, String memberId, String unionId);
/**
* 更新用户id wx企业id
*
* @param wxEnterpriseId wx企业标识
* @return int
* @author mozhu
* @date 2022-06-30 16:35:47
*/
int updateUserIdByWxEnterpriseId(String wxEnterpriseId);
} }
...@@ -68,4 +68,14 @@ public interface MemberUnionRelatedService { ...@@ -68,4 +68,14 @@ public interface MemberUnionRelatedService {
* @return * @return
*/ */
List<MemberUnionidRelatedDTO> listBySelfExternalUserId(String wxUserId, String wxEnterpriseId, String selfExternalUserId); List<MemberUnionidRelatedDTO> listBySelfExternalUserId(String wxUserId, String wxEnterpriseId, String selfExternalUserId);
/**
* 更新用户id wx企业id
*
* @param wxEnterpriseId wx企业标识
* @return int
* @author mozhu
* @date 2022-06-30 16:32:21
*/
int updateUserIdByWxEnterpriseId(String wxEnterpriseId);
} }
...@@ -140,4 +140,15 @@ public interface StaffClerkRelationService { ...@@ -140,4 +140,15 @@ public interface StaffClerkRelationService {
* @return {@link Set<String>} * @return {@link Set<String>}
*/ */
List<String> listRelationsStaffId(Set<String> staffIdList); List<String> listRelationsStaffId(Set<String> staffIdList);
/**
* 更新用户id wx企业id
*
* @param wxEnterpriseId wx企业标识
* @return int
* @author mozhu
* @date 2022-06-30 16:21:06
*/
int updateUserIdByWxEnterpriseId(String wxEnterpriseId);
} }
...@@ -46,4 +46,15 @@ public interface StaffDepartmentRelatedService { ...@@ -46,4 +46,15 @@ public interface StaffDepartmentRelatedService {
public int update(TabHaobanStaffDepartmentRelated tab); public int update(TabHaobanStaffDepartmentRelated tab);
/**
* 更新用户id wx企业id
*
* @param wxEnterpriseId wx企业标识
* @return int
* @author mozhu
* @date 2022-06-30 16:24:59
*/
int updateUserIdByWxEnterpriseId(String wxEnterpriseId);
} }
package com.gic.haoban.manage.service.service; package com.gic.haoban.manage.service.service;
import com.gic.haoban.base.api.common.BasePageInfo;
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;
...@@ -15,7 +17,7 @@ public interface StaffService { ...@@ -15,7 +17,7 @@ public interface StaffService {
String add(TabHaobanStaff tab); String add(TabHaobanStaff tab);
Page<TabHaobanStaff> pageStaff(List<String> staffIds, Integer activeFlag, Page<TabHaobanStaff> pageStaff(List<String> staffIds, Integer activeFlag,
String keyword,List<String> departmentIds,String wxEnterpriseId,Integer relationFlag); String keyword, List<String> departmentIds, String wxEnterpriseId, Integer relationFlag);
void updateByPrimaryKey(TabHaobanStaff tab); void updateByPrimaryKey(TabHaobanStaff tab);
...@@ -53,7 +55,7 @@ public interface StaffService { ...@@ -53,7 +55,7 @@ public interface StaffService {
* @author mozhu * @author mozhu
* @date 2022-01-12 17:19:28 * @date 2022-01-12 17:19:28
*/ */
TabHaobanStaff selectByPhoneNumberOrUserIdAndEnterpriseId(String phoneNumber,String userId, String wxEnterpriseId); TabHaobanStaff selectByPhoneNumberOrUserIdAndEnterpriseId(String phoneNumber, String userId, String wxEnterpriseId);
List<StaffDTO> listByUserIdsAndWxEnterpriseId(List<String> userIds, String wxEnterpriseId); List<StaffDTO> listByUserIdsAndWxEnterpriseId(List<String> userIds, String wxEnterpriseId);
...@@ -117,4 +119,27 @@ public interface StaffService { ...@@ -117,4 +119,27 @@ public interface StaffService {
*/ */
void delOtherStaffByWxUserId(String wxUserId, String staffId, String wxEnterpriseId); void delOtherStaffByWxUserId(String wxUserId, String staffId, String wxEnterpriseId);
/**
* 分页获取staff
*
* @param wxEnterpriseId wx企业标识
* @param basePageInfo 基本信息页
* @return {@link List }<{@link StaffDTO }>
* @author mozhu
* @date 2022-06-30 13:58:48
*/
com.gic.api.base.commons.Page<StaffDTO> getPageStaffIdsByWxEnterpriseId(String wxEnterpriseId, BasePageInfo basePageInfo);
/**
* 更新wx用户id通过员工id
*
* @param wxEnterpriseId wx企业标识
* @param newWxUserId 新wx用户id
* @param oldWxUserId 老wx用户id
* @return int
* @author mozhu
* @date 2022-06-30 15:54:34
*/
int updateUserIdByUserId(String wxEnterpriseId, String newWxUserId, String oldWxUserId);
} }
...@@ -208,4 +208,9 @@ public class ExternalClerkRelatedServiceImpl implements ExternalClerkRelatedServ ...@@ -208,4 +208,9 @@ public class ExternalClerkRelatedServiceImpl implements ExternalClerkRelatedServ
} }
return null; return null;
} }
@Override
public int updateUserIdByWxEnterpriseId(String wxEnterpriseId) {
return mapper.updateUserIdByWxEnterpriseId(wxEnterpriseId);
}
} }
...@@ -99,4 +99,9 @@ public class MemberUnionRelatedServiceImpl implements MemberUnionRelatedService ...@@ -99,4 +99,9 @@ public class MemberUnionRelatedServiceImpl implements MemberUnionRelatedService
List<MemberUnionidRelated> retList = mapper.listBySelfExternalUserId(wxUserId, wxEnterpriseId, selfExternalUserId); List<MemberUnionidRelated> retList = mapper.listBySelfExternalUserId(wxUserId, wxEnterpriseId, selfExternalUserId);
return EntityUtil.changeEntityListNew(MemberUnionidRelatedDTO.class, retList); return EntityUtil.changeEntityListNew(MemberUnionidRelatedDTO.class, retList);
} }
@Override
public int updateUserIdByWxEnterpriseId(String wxEnterpriseId) {
return mapper.updateUserIdByWxEnterpriseId(wxEnterpriseId);
}
} }
...@@ -295,4 +295,9 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService ...@@ -295,4 +295,9 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
public List<String> listRelationsStaffId(Set<String> staffIdList) { public List<String> listRelationsStaffId(Set<String> staffIdList) {
return mapper.listRelationsStaffId(staffIdList); return mapper.listRelationsStaffId(staffIdList);
} }
@Override
public int updateUserIdByWxEnterpriseId(String wxEnterpriseId) {
return mapper.updateUserIdByWxEnterpriseId(wxEnterpriseId);
}
} }
...@@ -99,4 +99,8 @@ public class StaffDepartmentRelatedServiceImpl implements StaffDepartmentRelated ...@@ -99,4 +99,8 @@ public class StaffDepartmentRelatedServiceImpl implements StaffDepartmentRelated
return mapper.updateByPrimaryKeySelective(tab); return mapper.updateByPrimaryKeySelective(tab);
} }
@Override
public int updateUserIdByWxEnterpriseId(String wxEnterpriseId) {
return mapper.updateUserIdByWxEnterpriseId(wxEnterpriseId);
}
} }
package com.gic.haoban.manage.service.service.impl; package com.gic.haoban.manage.service.service.impl;
import com.gic.commons.util.EntityUtil; import com.gic.commons.util.EntityUtil;
import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.common.utils.PageUtil;
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;
import com.gic.haoban.manage.service.dao.mapper.StaffMapper; import com.gic.haoban.manage.service.dao.mapper.StaffMapper;
...@@ -9,6 +12,8 @@ import com.gic.haoban.manage.service.service.MemberUnionRelatedService; ...@@ -9,6 +12,8 @@ import com.gic.haoban.manage.service.service.MemberUnionRelatedService;
import com.gic.haoban.manage.service.service.StaffClerkRelationService; import com.gic.haoban.manage.service.service.StaffClerkRelationService;
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 com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
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.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
...@@ -163,4 +168,16 @@ public class StaffServiceImpl implements StaffService { ...@@ -163,4 +168,16 @@ public class StaffServiceImpl implements StaffService {
public void delOtherStaffByWxUserId(String wxUserId, String staffId, String wxEnterpriseId) { public void delOtherStaffByWxUserId(String wxUserId, String staffId, String wxEnterpriseId) {
mapper.delOtherStaffByWxUserId(wxUserId, staffId, wxEnterpriseId); mapper.delOtherStaffByWxUserId(wxUserId, staffId, wxEnterpriseId);
} }
@Override
public com.gic.api.base.commons.Page<StaffDTO> getPageStaffIdsByWxEnterpriseId(String wxEnterpriseId, BasePageInfo basePageInfo) {
PageHelper.startPage(basePageInfo);
List<TabHaobanStaff> tabHaobanStaffs = mapper.listByWxEnterpriseId(wxEnterpriseId);
return PageUtil.changePageHelperToCurrentPage(new PageInfo<>(tabHaobanStaffs),StaffDTO.class);
}
@Override
public int updateUserIdByUserId(String wxEnterpriseId, String newWxUserId, String oldWxUserId) {
return mapper.updateUserIdByUserId(wxEnterpriseId, newWxUserId, oldWxUserId);
}
} }
...@@ -142,6 +142,8 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA ...@@ -142,6 +142,8 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
private MemberStoreService memberStoreService; private MemberStoreService memberStoreService;
@Autowired @Autowired
private ImageService imageService; private ImageService imageService;
@Autowired
private StaffDepartmentRelatedService staffDepartmentRelatedService;
@Override @Override
public void dealQywxExternalUser(String params) { public void dealQywxExternalUser(String params) {
...@@ -1977,6 +1979,71 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA ...@@ -1977,6 +1979,71 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
return EntityUtil.changeEntityNew(MemberUnionidRelatedDTO.class, memberUnionidRelated); return EntityUtil.changeEntityNew(MemberUnionidRelatedDTO.class, memberUnionidRelated);
} }
@Override
public ServiceResponse updateNewUseridCorpid(String wxEnterpriseId) {
WxEnterpriseDTO wxEnterpriseDTO = wxEnterpriseService.selectById(wxEnterpriseId);
ServiceResponse serviceResponse = new ServiceResponse();
if (wxEnterpriseDTO == null) {
serviceResponse.setCode(-1);
serviceResponse.setMessage("企微不存在");
return serviceResponse;
}
SecretSettingDTO secretSetting = secretSettingService.getSecretSetting(wxEnterpriseId, SecretTypeEnum.CUSTOMIZED_APP.getVal());
if (secretSetting == null) {
serviceResponse.setCode(-1);
serviceResponse.setMessage("代开发密钥不存在");
return serviceResponse;
}
String corpid = wxEnterpriseDTO.getCorpid();
// 限流器
RRateLimiter rateLimiter = RedisUtil.getRedisClient().getRateLimiter("haoban:manage3:updateNewUseridCorpid:limit");
// 每1秒产生5个令牌
rateLimiter.trySetRate(RateType.OVERALL, 5, 1, RateIntervalUnit.SECONDS);
BasePageInfo basePageInfo = new BasePageInfo();
int pageNum = 1;
while (true){
rateLimiter.acquire();
basePageInfo.setPageNum(pageNum);
basePageInfo.setPageSize(1000);
Page<StaffDTO> staffDTOPage = staffService.getPageStaffIdsByWxEnterpriseId(wxEnterpriseId, basePageInfo);
List<StaffDTO> staffDTOList = staffDTOPage.getResult();
if (CollectionUtil.isEmpty(staffDTOList)) {
break;
}
pageNum ++;
List<String> stringList = staffDTOList.stream().map(StaffDTO::getWxUserId).distinct().collect(Collectors.toList());
List<QywxNewUseridDTO> qywxNewUseridDTOList = qywxUserApiService.getSelfUseridToOpenuserid(corpid, secretSetting.getSecretVal(), stringList);
if (CollectionUtils.isEmpty(qywxNewUseridDTOList)) {
log.error("调用企微无权限");
continue;
}
for (QywxNewUseridDTO qywxNewUseridDTO : qywxNewUseridDTOList) {
String userid = qywxNewUseridDTO.getUserid();
String openUserid = qywxNewUseridDTO.getOpen_userid();
log.info("转换新的userid,userid:{},openUserid:{}",userid,openUserid);
staffService.updateUserIdByUserId(wxEnterpriseId,openUserid,userid);
}
}
//更新导购员工关联关系表
staffClerkRelationService.updateUserIdByWxEnterpriseId(wxEnterpriseId);
//更新员工部门关联关系表
staffDepartmentRelatedService.updateUserIdByWxEnterpriseId(wxEnterpriseId);
//更新好友关系表
memberUnionRelatedService.updateUserIdByWxEnterpriseId(wxEnterpriseId);
//更新会员好友关系表
externalClerkRelatedService.updateUserIdByWxEnterpriseId(wxEnterpriseId);
serviceResponse.setCode(0);
return serviceResponse;
}
@Override
public void updateNewUseridCorpidMq(String params) {
}
/** /**
* 获取客户详情列表 * 获取客户详情列表
* *
......
...@@ -251,4 +251,22 @@ ...@@ -251,4 +251,22 @@
where external_userid = #{oldExternalUserId} where external_userid = #{oldExternalUserId}
and wx_enterprise_id = #{wxEnterpriseId} and wx_enterprise_id = #{wxEnterpriseId}
</update> </update>
<update id="updateUserIdByWxEnterpriseId">
UPDATE tab_haoban_member_unionid_related a
LEFT JOIN tab_haoban_external_clerk_related b ON a.member_unionid_related_id = b.member_unionid_related_id
SET a.wx_user_id = b.wx_user_id,update_time= now()
WHERE
a.wx_enterprise_id = #{wxEnterpriseId}
AND b.status_flag IN ( 1, 3, 4 )
</update>
<update id="updateSelfExternalUserIdByOldSelfExternalUserId">
UPDATE
tab_haoban_member_unionid_related
SET self_external_userid = #{newExternalUserId},
update_time = now()
where self_external_userid = #{oldExternalUserId}
and wx_enterprise_id = #{wxEnterpriseId}
</update>
</mapper> </mapper>
\ No newline at end of file
...@@ -347,4 +347,13 @@ ...@@ -347,4 +347,13 @@
where status_flag = 1 where status_flag = 1
and wx_enterprise_id = #{wxEnterpriseId} and staff_id = #{staffId} and wx_enterprise_id = #{wxEnterpriseId} and staff_id = #{staffId}
</select> </select>
<update id="updateUserIdByWxEnterpriseId" parameterType="java.lang.String">
UPDATE tab_haoban_staff_department_related a
LEFT JOIN tab_haoban_staff b ON a.staff_id = b.staff_id
SET a.wx_user_id = b.wx_user_id,update_time= now()
WHERE
a.wx_enterprise_id = #{wxEnterpriseId}
AND a.status_flag = 1 and b.status_flag = 1;
</update>
</mapper> </mapper>
\ No newline at end of file
...@@ -507,4 +507,21 @@ ...@@ -507,4 +507,21 @@
and staff_id != #{staffId} and staff_id != #{staffId}
</update> </update>
<select id="listByWxEnterpriseId" resultMap="BaseResultMap" parameterType="java.lang.String">
select
<include refid="Base_Column_List"/>
from tab_haoban_staff
and wx_enterprise_id = #{wxEnterpriseId}
and status_flag = 1
</select>
<update id="updateUserIdByUserId" parameterType="java.lang.String">
update tab_haoban_staff
set wx_user_id = #{newWxUserId},
update_time = now()
where wx_enterprise_id = #{wxEnterpriseId}
and wx_user_id = #{oldWxUserId}
</update>
</mapper> </mapper>
\ No newline at end of file
...@@ -570,7 +570,8 @@ ...@@ -570,7 +570,8 @@
SET member_id=#{memberId}, SET member_id=#{memberId},
status_flag = 1, status_flag = 1,
update_time = now() update_time = now()
where member_id = #{oldMemberId} and enterprise_id = #{enterpriseId} where member_id = #{oldMemberId}
and enterprise_id = #{enterpriseId}
</update> </update>
<update id="updateStatusByMemberId"> <update id="updateStatusByMemberId">
...@@ -601,7 +602,8 @@ ...@@ -601,7 +602,8 @@
external_user_id external_user_id
from tab_haoban_external_clerk_related from tab_haoban_external_clerk_related
where wx_enterprise_id = #{wxEnterpriseId} where wx_enterprise_id = #{wxEnterpriseId}
AND status_flag = 1 and external_user_id is not null AND status_flag = 1
and external_user_id is not null
</select> </select>
...@@ -674,10 +676,19 @@ ...@@ -674,10 +676,19 @@
order by create_time desc limit 1 order by create_time desc limit 1
</select> </select>
<select id="countByMemberId" resultType="int"> <select id="countByMemberId" resultType="int">
select select count(*)
count(*)
from tab_haoban_external_clerk_related from tab_haoban_external_clerk_related
where enterprise_id = #{enterpriseId} and member_id = #{memberId} where enterprise_id = #{enterpriseId}
and member_id = #{memberId}
and status_flag = 1 and status_flag = 1
</select> </select>
<update id="updateUserIdByWxEnterpriseId">
UPDATE tab_haoban_external_clerk_related a
LEFT JOIN tab_haoban_staff b ON a.staff_id = b.staff_id
SET a.wx_user_id = b.wx_user_id,update_time= now()
WHERE
a.wx_enterprise_id = #{wxEnterpriseId}
AND a.status_flag IN ( 1, 3, 4 );
</update>
</mapper> </mapper>
\ No newline at end of file
...@@ -440,4 +440,13 @@ ...@@ -440,4 +440,13 @@
</foreach>; </foreach>;
</select> </select>
<update id="updateUserIdByWxEnterpriseId" parameterType="java.lang.String">
UPDATE tab_haoban_staff_clerk_relation a
LEFT JOIN tab_haoban_staff b ON a.staff_id = b.staff_id
SET a.wx_user_id = b.wx_user_id,update_time= now()
WHERE
a.wx_enterprise_id = #{wxEnterpriseId}
AND a.status_flag = 1 and b.status_flag = 1
</update>
</mapper> </mapper>
\ No newline at end of file
...@@ -7,6 +7,7 @@ import com.gic.haoban.common.utils.EntityUtil; ...@@ -7,6 +7,7 @@ import com.gic.haoban.common.utils.EntityUtil;
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.*; import com.gic.haoban.manage.api.service.*;
import com.gic.haoban.manage.web.config.Config;
import com.gic.haoban.manage.web.errCode.HaoBanErrCode; import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import com.gic.haoban.manage.web.qo.QywxXcxSendMessageQo; import com.gic.haoban.manage.web.qo.QywxXcxSendMessageQo;
import com.gic.redis.data.util.GicRateLimiter; import com.gic.redis.data.util.GicRateLimiter;
...@@ -28,6 +29,7 @@ import org.springframework.web.bind.annotation.RequestParam; ...@@ -28,6 +29,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
...@@ -77,6 +79,8 @@ public class TestController extends WebBaseController { ...@@ -77,6 +79,8 @@ public class TestController extends WebBaseController {
private StaffApiService staffApiService; private StaffApiService staffApiService;
@Autowired @Autowired
private WxApplicationApiService wxApplicationApiService; private WxApplicationApiService wxApplicationApiService;
@Autowired
private Config config;
@RequestMapping("/send-message-test") @RequestMapping("/send-message-test")
public HaobanResponse testSendMessage(QywxXcxSendMessageQo qo) { public HaobanResponse testSendMessage(QywxXcxSendMessageQo qo) {
...@@ -289,4 +293,32 @@ public class TestController extends WebBaseController { ...@@ -289,4 +293,32 @@ public class TestController extends WebBaseController {
} }
return qywxNewUseridDTOS.get(0).getOpen_userid(); return qywxNewUseridDTOS.get(0).getOpen_userid();
} }
/**
* 代开发完成升级
* @param corpid
* @param agentid
* @param openidType
* @return
*/
@RequestMapping("/finishOpenidMigration")
public HaobanResponse finishOpenidMigration(String corpid, String agentid, String openidType) {
String[] openidTypeSplit = openidType.split(",");
boolean flag = qywxUserApiService.finishOpenidMigration(corpid, config.getCorpid(), agentid, openidTypeSplit);
return resultResponse(HaoBanErrCode.ERR_1, flag);
}
/**
* 转自建userid
* @param corpid
* @param secret
* @param userIds
* @return
*/
@RequestMapping("/getSelfUseridToOpenuserid")
public HaobanResponse getSelfUseridToOpenuserid(String corpid, String secret, String userIds) {
String[] split = userIds.split(",");
List<QywxNewUseridDTO> list = qywxUserApiService.getSelfUseridToOpenuserid(corpid, secret, Arrays.asList(split));
return resultResponse(HaoBanErrCode.ERR_1, list);
}
} }
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