Commit e6605147 by 墨竹

Merge remote-tracking branch 'origin/developer' into developer

parents 36fc2579 eff25174
...@@ -34,4 +34,17 @@ public interface HaobanTimerApiService { ...@@ -34,4 +34,17 @@ public interface HaobanTimerApiService {
*/ */
public ServiceResponse<Void> repairExternalUserId(String wxEnterpriseId) ; public ServiceResponse<Void> repairExternalUserId(String wxEnterpriseId) ;
/**
*
* @Title: repairStaffDepart
* @Description: 修复成员部门
* @author xugh
* @param wxEnterpriseId
* @return
* @throws
*/
public ServiceResponse<Void> repairStaffDepart(String params) ;
} }
package com.gic.haoban.manage.service.dao.mapper; package com.gic.haoban.manage.service.dao.mapper;
import com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated; import java.util.Date;
import java.util.List;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated;
public interface StaffDepartmentRelatedMapper { public interface StaffDepartmentRelatedMapper {
...@@ -39,4 +41,6 @@ public interface StaffDepartmentRelatedMapper { ...@@ -39,4 +41,6 @@ public interface StaffDepartmentRelatedMapper {
@Param("wxEnterpriseId") String wxEnterpriseId, @Param("wxEnterpriseId") String wxEnterpriseId,
@Param("staffId") String staffId @Param("staffId") String staffId
); );
List<String> listNoDepartStaff(@Param("wxEnterpriseId")String wxEnterpriseId , @Param("addDate")Date addDate) ;
} }
\ No newline at end of file
package com.gic.haoban.manage.service.service; package com.gic.haoban.manage.service.service;
import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO; import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO;
import com.gic.haoban.manage.service.entity.TabHaobanStaff;
import com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated; import com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated;
import java.util.List; import java.util.List;
...@@ -33,4 +34,16 @@ public interface StaffDepartmentRelatedService { ...@@ -33,4 +34,16 @@ public interface StaffDepartmentRelatedService {
public int update(TabHaobanStaffDepartmentRelated tab); public int update(TabHaobanStaffDepartmentRelated tab);
/**
*
* @Title: repairAllStaffDepart
* @Description: 定时修复成员部门
* @author xugh
* @param params
* @throws
*/
public void repairAllStaffDepart(String params) ;
public void repairStaffDepart(String staffId) ;
public void staffDepartChange(TabHaobanStaff staff, String wxEnterpriseId, Integer[] departmentIds) ;
} }
package com.gic.haoban.manage.service.service.impl; package com.gic.haoban.manage.service.service.impl;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.gic.commons.util.DateUtil;
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.DepartmentDTO;
import com.gic.haoban.manage.api.dto.SecretSettingDTO;
import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO; import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO;
import com.gic.haoban.manage.api.enums.SecretTypeEnum;
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.entity.TabHaobanStaff;
import com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated; import com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated;
import com.gic.haoban.manage.service.service.DepartmentService;
import com.gic.haoban.manage.service.service.SecretSettingService;
import com.gic.haoban.manage.service.service.StaffDepartmentRelatedService; import com.gic.haoban.manage.service.service.StaffDepartmentRelatedService;
import org.springframework.beans.factory.annotation.Autowired; import com.gic.haoban.manage.service.service.WxEnterpriseService;
import org.springframework.stereotype.Service; import com.gic.haoban.manage.service.service.out.impl.MessageApiServiceImpl;
import com.gic.haoban.manage.service.service.out.impl.StaffApiServiceImpl;
import java.util.Date; import com.gic.wechat.api.dto.qywx.UserDTO;
import java.util.List; import com.gic.wechat.api.service.qywx.QywxUserApiService;
import com.google.common.collect.Sets;
@Service @Service
public class StaffDepartmentRelatedServiceImpl implements StaffDepartmentRelatedService { public class StaffDepartmentRelatedServiceImpl implements StaffDepartmentRelatedService {
private static final Logger logger = LogManager.getLogger(StaffDepartmentRelatedService.class);
@Autowired @Autowired
private StaffDepartmentRelatedMapper mapper; private StaffDepartmentRelatedMapper mapper;
@Autowired
private StaffMapper staffMapper ;
@Autowired
private SecretSettingService secretSettingService ;
@Autowired
private WxEnterpriseService wxEnterpriseService ;
@Autowired
private QywxUserApiService qywxUserApiService ;
@Autowired
private DepartmentService departmentService ;
@Override @Override
public List<TabHaobanStaffDepartmentRelated> listByDepartmentId(String departmentId) { public List<TabHaobanStaffDepartmentRelated> listByDepartmentId(String departmentId) {
...@@ -79,4 +117,110 @@ public class StaffDepartmentRelatedServiceImpl implements StaffDepartmentRelated ...@@ -79,4 +117,110 @@ public class StaffDepartmentRelatedServiceImpl implements StaffDepartmentRelated
return mapper.updateByPrimaryKeySelective(tab); return mapper.updateByPrimaryKeySelective(tab);
} }
@Override
public void repairAllStaffDepart(String params) {
logger.info("修复成员部门={}",params);
int addDay = 0 ;
String wxEnterpriseId = null ;
if(params.contains("#")) {
addDay = Integer.parseInt(params.split("#")[0]) ;
wxEnterpriseId = params.split("#")[1] ;
}else {
addDay = Integer.parseInt(params) ;
}
Date addDate = DateUtil.addDay(DateUtil.getStartTimeOfDay(),-addDay) ;
List<String> list = this.mapper.listNoDepartStaff(wxEnterpriseId, addDate) ;
if(CollectionUtils.isNotEmpty(list)) {
for(String staffId : list) {
this.repairStaffDepart(staffId);
}
}
logger.info("修复成员部门完成={}",params);
}
@Override
public void repairStaffDepart(String staffId) {
TabHaobanStaff staff = this.staffMapper.selectByPrimaryKey(staffId) ;
String wxEnterpriseId = staff.getWxEnterpriseId() ;
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId) ;
String wxUserId = staff.getWxUserId() ;
if(qwDTO.needOpenUserIdDk()) {
wxUserId = staff.getWxOpenUseId() ;
}
SecretSettingDTO secretSetting = secretSettingService.getSecretSetting(qwDTO.getWxEnterpriseId(), SecretTypeEnum.CUSTOMIZED_APP.getVal());
if (null != secretSetting && StringUtils.isNotBlank(secretSetting.getSecretVal())) {
UserDTO user = qywxUserApiService.getSelfWorkWxUser(qwDTO.getDkCorpid(), secretSetting.getSecretVal(), wxUserId);
logger.info("成员详情(代开)={}",JSON.toJSONString(user)) ;
if(null != user.getDepartment()) {
this.staffDepartChange(staff, wxEnterpriseId, user.getDepartment()); ;
}
}
}
public void staffDepartChange(TabHaobanStaff staff, String wxEnterpriseId, Integer[] departmentIds) {
//更新部门
List<String> wxDepartIds = new ArrayList<>();
for (Integer wDId : departmentIds) {
wxDepartIds.add(wDId.toString());
}
//关联部门
List<DepartmentDTO> departmentDTOList = departmentService.listDepartmentByWxDepartIds(wxEnterpriseId, wxDepartIds);
if (CollectionUtils.isEmpty(departmentDTOList)) {
logger.info("部门没有更新或同步:{}", wxEnterpriseId);
return;
}
//已存在部门
List<TabHaobanStaffDepartmentRelated> hasRelation = this.listStaffDepartmentByStaffId(staff.getStaffId());
Map<String, TabHaobanStaffDepartmentRelated> hasRelationMap = new HashMap<>();
if (CollectionUtils.isNotEmpty(hasRelation)) {
hasRelationMap = hasRelation.stream().collect(Collectors.toMap(TabHaobanStaffDepartmentRelated::getDepartmentId, tab -> tab));
}
//新增操作
for (DepartmentDTO departmentDTO : departmentDTOList) {
if (!hasRelationMap.containsKey(departmentDTO.getDepartmentId())) {
StaffDepartmentRelatedDTO dto = new StaffDepartmentRelatedDTO();
dto.setPhoneNumber(staff.getPhoneNumber());
dto.setStaffId(staff.getStaffId());
dto.setStaffName(staff.getStaffName());
dto.setWxEnterpriseId(wxEnterpriseId);
dto.setStatusFlag(1);
dto.setDepartmentId(departmentDTO.getDepartmentId());
dto.setNationCode(staff.getNationCode());
this.add(dto);
}
}
//删除操作
Set<String> newDepartIds = departmentDTOList.stream().map(DepartmentDTO::getDepartmentId).collect(Collectors.toSet());
Set<String> hasDepartIds = hasRelationMap.keySet();
Sets.SetView<String> delDepartIds = Sets.difference(hasDepartIds, newDepartIds);
Sets.SetView<String> updateDepartIds = Sets.intersection(newDepartIds, hasDepartIds);//交集
logger.info("删除部门:{}", JSONObject.toJSONString(delDepartIds));
if (CollectionUtils.isNotEmpty(delDepartIds)) {
for (String delDepartId : delDepartIds) {
TabHaobanStaffDepartmentRelated departmentRelated = hasRelationMap.get(delDepartId);
if (null != departmentRelated) {
StaffDepartmentRelatedDTO relatedDTO = new StaffDepartmentRelatedDTO();
relatedDTO.setStaffDepartmentRelatedId(departmentRelated.getStaffDepartmentRelatedId());
this.del(relatedDTO);
}
}
}
if (CollectionUtils.isNotEmpty(updateDepartIds)) {
for (String updateDeId : updateDepartIds) {
TabHaobanStaffDepartmentRelated departmentRelated = hasRelationMap.get(updateDeId);
if (null != departmentRelated) {
departmentRelated.setPhoneNumber(staff.getPhoneNumber());
departmentRelated.setStaffName(staff.getStaffName());
departmentRelated.setNationCode(staff.getNationCode());
departmentRelated.setUpdateTime(new Date());
this.update(departmentRelated);
}
}
}
}
} }
...@@ -6,6 +6,7 @@ import org.springframework.stereotype.Service; ...@@ -6,6 +6,7 @@ import org.springframework.stereotype.Service;
import com.gic.api.base.commons.ServiceResponse; import com.gic.api.base.commons.ServiceResponse;
import com.gic.haoban.manage.api.service.HaobanTimerApiService; import com.gic.haoban.manage.api.service.HaobanTimerApiService;
import com.gic.haoban.manage.service.service.ExternalClerkRelatedService; import com.gic.haoban.manage.service.service.ExternalClerkRelatedService;
import com.gic.haoban.manage.service.service.StaffDepartmentRelatedService;
import com.gic.haoban.manage.service.service.hm.HmQrcodeTempService; import com.gic.haoban.manage.service.service.hm.HmQrcodeTempService;
@Service("haobanTimerApiService") @Service("haobanTimerApiService")
...@@ -13,10 +14,10 @@ public class HaobanTimerApiServiceImpl implements HaobanTimerApiService { ...@@ -13,10 +14,10 @@ public class HaobanTimerApiServiceImpl implements HaobanTimerApiService {
@Autowired @Autowired
private HmQrcodeTempService hmQrcodeTempService ; private HmQrcodeTempService hmQrcodeTempService ;
@Autowired @Autowired
private ExternalClerkRelatedService externalClerkRelatedService ; private ExternalClerkRelatedService externalClerkRelatedService ;
@Autowired
private StaffDepartmentRelatedService staffDepartmentRelatedService ;
@Override @Override
public ServiceResponse<Void> deleteTempWxHm(String params) { public ServiceResponse<Void> deleteTempWxHm(String params) {
...@@ -30,5 +31,10 @@ public class HaobanTimerApiServiceImpl implements HaobanTimerApiService { ...@@ -30,5 +31,10 @@ public class HaobanTimerApiServiceImpl implements HaobanTimerApiService {
return ServiceResponse.success(); return ServiceResponse.success();
} }
@Override
public ServiceResponse<Void> repairStaffDepart(String params) {
this.staffDepartmentRelatedService.repairAllStaffDepart(params);
return ServiceResponse.success();
}
} }
...@@ -647,6 +647,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA ...@@ -647,6 +647,7 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
qdto.setUserId(externalUserid); qdto.setUserId(externalUserid);
qdto.setSence(2); qdto.setSence(2);
com.gic.api.base.commons.ServiceResponse<MemberSimpleDetailDTO> resp = this.memberEntranceApiService.enterpriseWechatByFriendEntrance(qdto); com.gic.api.base.commons.ServiceResponse<MemberSimpleDetailDTO> resp = this.memberEntranceApiService.enterpriseWechatByFriendEntrance(qdto);
log.info("加好友,创建member,resp={},param={}",JSON.toJSON(resp),JSON.toJSONString(qdto));
if(resp.isSuccess()) { if(resp.isSuccess()) {
MemberSimpleDetailDTO member = resp.getResult() ; MemberSimpleDetailDTO member = resp.getResult() ;
memberId = member.getMemberId() ; memberId = member.getMemberId() ;
......
package com.gic.haoban.manage.service.service.out.impl; package com.gic.haoban.manage.service.service.out.impl;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.Page; import com.gic.api.base.commons.Page;
...@@ -33,7 +49,16 @@ import com.gic.haoban.manage.service.entity.TabHaobanDepartment; ...@@ -33,7 +49,16 @@ import com.gic.haoban.manage.service.entity.TabHaobanDepartment;
import com.gic.haoban.manage.service.entity.TabHaobanStaff; import com.gic.haoban.manage.service.entity.TabHaobanStaff;
import com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated; import com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated;
import com.gic.haoban.manage.service.entity.TabHaobanSyncErrorLog; import com.gic.haoban.manage.service.entity.TabHaobanSyncErrorLog;
import com.gic.haoban.manage.service.service.*; import com.gic.haoban.manage.service.service.DepartmentService;
import com.gic.haoban.manage.service.service.SecretSettingService;
import com.gic.haoban.manage.service.service.StaffClerkRelationService;
import com.gic.haoban.manage.service.service.StaffDepartmentRelatedService;
import com.gic.haoban.manage.service.service.StaffPrivacyUseLogService;
import com.gic.haoban.manage.service.service.StaffService;
import com.gic.haoban.manage.service.service.StoreRangeService;
import com.gic.haoban.manage.service.service.SyncErrorLogService;
import com.gic.haoban.manage.service.service.UserLoginLogService;
import com.gic.haoban.manage.service.service.WxEnterpriseService;
import com.gic.haoban.manage.service.util.EmojiFilterUtil; import com.gic.haoban.manage.service.util.EmojiFilterUtil;
import com.gic.redis.data.util.RedisUtil; import com.gic.redis.data.util.RedisUtil;
import com.gic.thirdparty.api.dto.PicUploadResDTO; import com.gic.thirdparty.api.dto.PicUploadResDTO;
...@@ -43,17 +68,6 @@ import com.gic.wechat.api.dto.qywx.UserDTO; ...@@ -43,17 +68,6 @@ import com.gic.wechat.api.dto.qywx.UserDTO;
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.Sets;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
@Service @Service
public class StaffApiServiceImpl implements StaffApiService { public class StaffApiServiceImpl implements StaffApiService {
...@@ -90,8 +104,6 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -90,8 +104,6 @@ public class StaffApiServiceImpl implements StaffApiService {
@Autowired @Autowired
private StaffPrivacyUseLogService staffPrivacyUseLogService; private StaffPrivacyUseLogService staffPrivacyUseLogService;
@Autowired @Autowired
private WxApplicationService wxApplicationService;
@Autowired
private StoreWidgetService storeWidgetService; private StoreWidgetService storeWidgetService;
@Autowired @Autowired
private PowerService powerService; private PowerService powerService;
...@@ -123,6 +135,10 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -123,6 +135,10 @@ public class StaffApiServiceImpl implements StaffApiService {
@Override @Override
public List<StaffDepartmentRelatedDTO> listStaffDepartmentByStaffId(String staffId) { public List<StaffDepartmentRelatedDTO> listStaffDepartmentByStaffId(String staffId) {
List<TabHaobanStaffDepartmentRelated> list = staffDepartmentRelatedService.listStaffDepartmentByStaffId(staffId); List<TabHaobanStaffDepartmentRelated> list = staffDepartmentRelatedService.listStaffDepartmentByStaffId(staffId);
// 如果成员部门为空,修复部门数据
if(CollectionUtils.isEmpty(list)) {
this.staffDepartmentRelatedService.repairStaffDepart(staffId);
}
return EntityUtil.changeEntityListByJSON(StaffDepartmentRelatedDTO.class, list); return EntityUtil.changeEntityListByJSON(StaffDepartmentRelatedDTO.class, list);
} }
...@@ -250,7 +266,7 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -250,7 +266,7 @@ public class StaffApiServiceImpl implements StaffApiService {
staffService.updateByPrimaryKey(staff); staffService.updateByPrimaryKey(staff);
} }
logger.info("staff变更保存:{}", JSONObject.toJSONString(user)); logger.info("staff变更保存:{}", JSONObject.toJSONString(user));
staffDepartChange(staff, wxEnterpriseId, user); this.staffDepartmentRelatedService.staffDepartChange(staff, wxEnterpriseId, user.getDepartment());
// 返回结果带上员工姓名 // 返回结果带上员工姓名
res.setResult(staff.getStaffName()); res.setResult(staff.getStaffName());
return res; return res;
...@@ -320,74 +336,6 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -320,74 +336,6 @@ public class StaffApiServiceImpl implements StaffApiService {
return arr; return arr;
} }
private void staffDepartChange(TabHaobanStaff staff, String wxEnterpriseId, UserDTO user) {
//更新部门
Integer[] departmentIds = user.getDepartment();
List<String> wxDepartIds = new ArrayList<>();
for (Integer wDId : departmentIds) {
wxDepartIds.add(wDId.toString());
}
//关联部门
List<DepartmentDTO> departmentDTOList = departmentService.listDepartmentByWxDepartIds(wxEnterpriseId, wxDepartIds);
if (CollectionUtils.isEmpty(departmentDTOList)) {
logger.info("部门没有更新或同步:{}", wxEnterpriseId);
return;
}
//已存在部门
List<TabHaobanStaffDepartmentRelated> hasRelation = staffDepartmentRelatedService.listStaffDepartmentByStaffId(staff.getStaffId());
Map<String, TabHaobanStaffDepartmentRelated> hasRelationMap = new HashMap<>();
if (CollectionUtils.isNotEmpty(hasRelation)) {
hasRelationMap = hasRelation.stream().collect(Collectors.toMap(TabHaobanStaffDepartmentRelated::getDepartmentId, tab -> tab));
}
//新增操作
for (DepartmentDTO departmentDTO : departmentDTOList) {
if (!hasRelationMap.containsKey(departmentDTO.getDepartmentId())) {
StaffDepartmentRelatedDTO dto = new StaffDepartmentRelatedDTO();
dto.setPhoneNumber(staff.getPhoneNumber());
dto.setStaffId(staff.getStaffId());
dto.setStaffName(user.getName());
dto.setWxEnterpriseId(wxEnterpriseId);
dto.setStatusFlag(1);
dto.setDepartmentId(departmentDTO.getDepartmentId());
dto.setNationCode(staff.getNationCode());
dto.setStaffName(user.getName());
staffDepartmentRelatedService.add(dto);
}
}
//删除操作
Set<String> newDepartIds = departmentDTOList.stream().map(DepartmentDTO::getDepartmentId).collect(Collectors.toSet());
Set<String> hasDepartIds = hasRelationMap.keySet();
Sets.SetView<String> delDepartIds = Sets.difference(hasDepartIds, newDepartIds);
Sets.SetView<String> updateDepartIds = Sets.intersection(newDepartIds, hasDepartIds);//交集
logger.info("删除部门:{}", JSONObject.toJSONString(delDepartIds));
if (CollectionUtils.isNotEmpty(delDepartIds)) {
for (String delDepartId : delDepartIds) {
TabHaobanStaffDepartmentRelated departmentRelated = hasRelationMap.get(delDepartId);
if (null != departmentRelated) {
StaffDepartmentRelatedDTO relatedDTO = new StaffDepartmentRelatedDTO();
relatedDTO.setStaffDepartmentRelatedId(departmentRelated.getStaffDepartmentRelatedId());
staffDepartmentRelatedService.del(relatedDTO);
}
}
}
if (CollectionUtils.isNotEmpty(updateDepartIds)) {
for (String updateDeId : updateDepartIds) {
TabHaobanStaffDepartmentRelated departmentRelated = hasRelationMap.get(updateDeId);
if (null != departmentRelated) {
departmentRelated.setPhoneNumber(staff.getPhoneNumber());
departmentRelated.setStaffName(staff.getStaffName());
departmentRelated.setNationCode(staff.getNationCode());
departmentRelated.setUpdateTime(new Date());
staffDepartmentRelatedService.update(departmentRelated);
}
}
}
}
@Override @Override
public ServiceResponse wxGetAdd(String userId, String wxEnterpriseId) { public ServiceResponse wxGetAdd(String userId, String wxEnterpriseId) {
RedisUtil.lock("haoban_add_user" + wxEnterpriseId + userId, 2L); RedisUtil.lock("haoban_add_user" + wxEnterpriseId + userId, 2L);
......
...@@ -216,6 +216,7 @@ public class FriendSyncNewOperation implements BaseSyncOperation { ...@@ -216,6 +216,7 @@ public class FriendSyncNewOperation implements BaseSyncOperation {
qdto.setSence(1); qdto.setSence(1);
String memberId = null; String memberId = null;
com.gic.api.base.commons.ServiceResponse<MemberSimpleDetailDTO> resp = this.memberEntranceApiService.enterpriseWechatByFriendEntrance(qdto); com.gic.api.base.commons.ServiceResponse<MemberSimpleDetailDTO> resp = this.memberEntranceApiService.enterpriseWechatByFriendEntrance(qdto);
logger.info("加好友,创建member,resp={},param={}",JSON.toJSON(resp),JSON.toJSONString(qdto));
if(resp.isSuccess()) { if(resp.isSuccess()) {
MemberSimpleDetailDTO member = resp.getResult() ; MemberSimpleDetailDTO member = resp.getResult() ;
memberId = member.getMemberId() ; memberId = member.getMemberId() ;
......
...@@ -189,4 +189,15 @@ ...@@ -189,4 +189,15 @@
and wx_enterprise_id = #{wxEnterpriseId} and staff_id = #{staffId} and wx_enterprise_id = #{wxEnterpriseId} and staff_id = #{staffId}
</select> </select>
<select id="listNoDepartStaff" resultType="String">
SELECT distinct(a.staff_id) FROM `tab_haoban_staff` a LEFT JOIN `tab_haoban_staff_department_related` b ON a.`staff_id` = b.`staff_id` AND b.`status_flag` = 1
WHERE
a.create_time >= #{addDate}
<if test="null != wxEnterpriseId">
and a.wx_enterprise_id = #{wxEnterpriseId}
</if>
AND a.status_flag = 1 AND b.`staff_department_related_id` IS NULL
</select>
</mapper> </mapper>
\ No newline at end of file
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