升级log4j版本防止漏洞;修复在职继承bug;修复通讯录列表查询bug;

1 parent 857f9129
Showing 20 changed files with 247 additions and 40 deletions
...@@ -14,6 +14,7 @@ import com.linkwechat.wecom.constants.SynchRecordConstants; ...@@ -14,6 +14,7 @@ import com.linkwechat.wecom.constants.SynchRecordConstants;
import com.linkwechat.wecom.domain.*; import com.linkwechat.wecom.domain.*;
import com.linkwechat.wecom.domain.vo.WeLeaveUserInfoAllocateVo; import com.linkwechat.wecom.domain.vo.WeLeaveUserInfoAllocateVo;
import com.linkwechat.wecom.domain.vo.WeMakeCustomerTag; import com.linkwechat.wecom.domain.vo.WeMakeCustomerTag;
import com.linkwechat.wecom.domain.vo.WeOnTheJobCustomerVo;
import com.linkwechat.wecom.service.IWeCustomerService; import com.linkwechat.wecom.service.IWeCustomerService;
import com.linkwechat.wecom.service.IWeCustomerTrajectoryService; import com.linkwechat.wecom.service.IWeCustomerTrajectoryService;
import com.linkwechat.wecom.service.IWeSynchRecordService; import com.linkwechat.wecom.service.IWeSynchRecordService;
...@@ -124,17 +125,21 @@ public class WeCustomerController extends BaseController ...@@ -124,17 +125,21 @@ public class WeCustomerController extends BaseController
/** /**
* 在职继承 * 在职继承
* @param weLeaveUserInfoAllocateVo * @param weOnTheJobCustomerVo
* @return * @return
*/ */
@Log(title="在职继承",businessType = BusinessType.UPDATE) @Log(title="在职继承",businessType = BusinessType.UPDATE)
@PostMapping("/jobExtends") @PostMapping("/jobExtends")
public AjaxResult jobExtends(@RequestBody WeLeaveUserInfoAllocateVo weLeaveUserInfoAllocateVo){ public AjaxResult jobExtends(@RequestBody WeOnTheJobCustomerVo weOnTheJobCustomerVo){
weLeaveUserInfoAllocateVo.setExtentType(new Integer(1)); try {
weCustomerService.allocateWeCustomer( weCustomerService.allocateOnTheJobCustomer(
weLeaveUserInfoAllocateVo weOnTheJobCustomerVo
); );
}catch (Exception e){
return AjaxResult.error(e.getMessage());
}
return AjaxResult.success(); return AjaxResult.success();
} }
...@@ -198,14 +203,17 @@ public class WeCustomerController extends BaseController ...@@ -198,14 +203,17 @@ public class WeCustomerController extends BaseController
* @return * @return
*/ */
@GetMapping("/followUpRecord") @GetMapping("/followUpRecord")
public TableDataInfo followUpRecord(String externalUserid,String userId){ public TableDataInfo followUpRecord(String externalUserid,String userId,Integer trajectoryType){
startPage(); startPage();
List<WeCustomerTrajectory> weCustomerTrajectories = iWeCustomerTrajectoryService List<WeCustomerTrajectory> weCustomerTrajectories = iWeCustomerTrajectoryService
.list(new LambdaQueryWrapper<WeCustomerTrajectory>() .list(new LambdaQueryWrapper<WeCustomerTrajectory>()
.eq(trajectoryType !=null,WeCustomerTrajectory::getTrajectoryType,trajectoryType)
.eq(StringUtils.isNotEmpty(externalUserid),WeCustomerTrajectory::getExternalUserid, externalUserid) .eq(StringUtils.isNotEmpty(externalUserid),WeCustomerTrajectory::getExternalUserid, externalUserid)
.eq(StringUtils.isNotEmpty(userId),WeCustomerTrajectory::getUserId, userId)); .eq(StringUtils.isNotEmpty(userId),WeCustomerTrajectory::getUserId, userId)
.orderByDesc(WeCustomerTrajectory::getTrackTime)
);
return getDataTable(weCustomerTrajectories); return getDataTable(weCustomerTrajectories);
} }
......
...@@ -20,6 +20,8 @@ import com.linkwechat.wecom.service.IWeMessagePushService; ...@@ -20,6 +20,8 @@ import com.linkwechat.wecom.service.IWeMessagePushService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.text.MessageFormat;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import java.util.stream.IntStream; import java.util.stream.IntStream;
...@@ -63,6 +65,7 @@ public class WeCustomerSeasController extends BaseController { ...@@ -63,6 +65,7 @@ public class WeCustomerSeasController extends BaseController {
public AjaxResult importData(MultipartFile file, WeCustomerSeas weCustomerSea) throws Exception { public AjaxResult importData(MultipartFile file, WeCustomerSeas weCustomerSea) throws Exception {
ExcelUtil<WeCustomerSeas> util = new ExcelUtil<WeCustomerSeas>(WeCustomerSeas.class); ExcelUtil<WeCustomerSeas> util = new ExcelUtil<WeCustomerSeas>(WeCustomerSeas.class);
List<WeCustomerSeas> weCustomerSeas = util.importExcel(file.getInputStream()); List<WeCustomerSeas> weCustomerSeas = util.importExcel(file.getInputStream());
String tip=new String("成功导入{0}条,去重复{1}条");
if(CollectionUtil.isNotEmpty(weCustomerSeas)){ if(CollectionUtil.isNotEmpty(weCustomerSeas)){
if(StringUtils.isEmpty(weCustomerSea.getAddUserName())&&StringUtils.isEmpty(weCustomerSea.getAddUserId())){ if(StringUtils.isEmpty(weCustomerSea.getAddUserName())&&StringUtils.isEmpty(weCustomerSea.getAddUserId())){
...@@ -124,17 +127,20 @@ public class WeCustomerSeasController extends BaseController { ...@@ -124,17 +127,20 @@ public class WeCustomerSeasController extends BaseController {
} }
} tip = MessageFormat.format(tip, new Object[]{new Integer(deduplicationSeasNoRepeat.size()).toString(),
new Integer( weCustomerSeas.size()-deduplicationSeasNoRepeat.size()).toString()});
}else{
tip = MessageFormat.format(tip, new Object[] { "0",weCustomerSeas.size() });
}
;
}else{ }else{
return AjaxResult.error("导入用户数据不能为空!"); return AjaxResult.error("导入用户数据不能为空!");
} }
return AjaxResult.success(); return AjaxResult.success(tip);
} }
......
...@@ -6,6 +6,7 @@ import com.linkwechat.common.core.controller.BaseController; ...@@ -6,6 +6,7 @@ import com.linkwechat.common.core.controller.BaseController;
import com.linkwechat.common.core.domain.AjaxResult; import com.linkwechat.common.core.domain.AjaxResult;
import com.linkwechat.common.core.page.TableDataInfo; import com.linkwechat.common.core.page.TableDataInfo;
import com.linkwechat.common.enums.BusinessType; import com.linkwechat.common.enums.BusinessType;
import com.linkwechat.common.exception.CustomException;
import com.linkwechat.wecom.domain.WeUser; import com.linkwechat.wecom.domain.WeUser;
import com.linkwechat.wecom.domain.vo.*; import com.linkwechat.wecom.domain.vo.*;
import com.linkwechat.wecom.service.IWeUserService; import com.linkwechat.wecom.service.IWeUserService;
...@@ -173,8 +174,12 @@ public class WeUserController extends BaseController { ...@@ -173,8 +174,12 @@ public class WeUserController extends BaseController {
@Log(title = "同步成员", businessType = BusinessType.OTHER) @Log(title = "同步成员", businessType = BusinessType.OTHER)
@GetMapping({"/synchWeUser"}) @GetMapping({"/synchWeUser"})
public AjaxResult synchWeUser() { public AjaxResult synchWeUser() {
try {
weUserService.synchWeUser(); weUserService.synchWeUser();
}catch (CustomException e){
return AjaxResult.error(e.getMessage());
}
return AjaxResult.success(WeConstans.SYNCH_TIP); return AjaxResult.success(WeConstans.SYNCH_TIP);
} }
......
linkwechat.nacos.host=
linkwechat.nacos.port=
linkwechat.nacos.namespace=
linkwechat.nacos.username=
linkwechat.nacos.password=
\ No newline at end of file \ No newline at end of file
linkwechat.nacos.host=119.45.28.29
linkwechat.nacos.port=10848
linkwechat.nacos.namespace=627a666a-76b2-42ad-a1b0-70a12d2c73fd
linkwechat.nacos.username=nacos
linkwechat.nacos.password=jerryjin666
\ No newline at end of file \ No newline at end of file
package com.linkwechat.common.enums;
import java.util.stream.Stream;
/**
* 客户分配的状态
*/
public enum AllocateCustomerStatus {
JOB_EXTENDS_SUCCESS(0,"成功发起转接"),
JOB_EXTENDS_JTWB(1,"接替完毕"),
JOB_EXTENDS_DDJT(2,"等待接替"),
JOB_EXTENDS_KHJJ(3,"客户拒绝"),
JOB_EXTENDS_DDSX(4,"接替成员客户达到上限"),
JOB_EXTENDS_WJTJL(5,"无接替记录"),
JOB_EXTENDS_BKJC(6,"当前客户已被继承");
private final Integer code;
private final String info;
AllocateCustomerStatus(Integer code, String info)
{
this.code = code;
this.info = info;
}
public Integer getCode() {
return code;
}
public String getInfo() {
return info;
}
public static AllocateCustomerStatus of(Integer type){
return Stream.of(values()).filter(s->s.getCode().equals(type)).findFirst().orElseGet(null);
}
}
...@@ -3,6 +3,8 @@ package com.linkwechat.common.utils; ...@@ -3,6 +3,8 @@ package com.linkwechat.common.utils;
import java.lang.management.ManagementFactory; import java.lang.management.ManagementFactory;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
...@@ -388,5 +390,15 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils ...@@ -388,5 +390,15 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
} }
/**
* 当前时间向推N天
* @param day 小时
* @return String
*/
public static String getBeforeByDayTime(int day){
LocalDateTime now = LocalDateTime.now();
now = now.minus(-day, ChronoUnit.DAYS);
return now.toString();
}
} }
...@@ -44,7 +44,7 @@ public class SynchRecordAop { ...@@ -44,7 +44,7 @@ public class SynchRecordAop {
.eq(WeSynchRecord::getSynchType,annotationLog.synchType()) .eq(WeSynchRecord::getSynchType,annotationLog.synchType())
.between(WeSynchRecord::getSynchTime,DateUtils.getBeforeByHourTime(2) .between(WeSynchRecord::getSynchTime,DateUtils.getBeforeByHourTime(2)
,DateUtils.getBeforeByHourTime(0))); ,DateUtils.getBeforeByHourTime(0)));
if(CollectionUtil.isEmpty(weSynchRecords)||weSynchRecords.size()<=1){ if(CollectionUtil.isEmpty(weSynchRecords)||weSynchRecords.size()<1){
joinPoint.proceed(); joinPoint.proceed();
}else{ }else{
throw new CustomException("由于企业微信开放平台的限制,两小时内不得重复同步操作"); throw new CustomException("由于企业微信开放平台的限制,两小时内不得重复同步操作");
......
...@@ -2,6 +2,7 @@ package com.linkwechat.wecom.client; ...@@ -2,6 +2,7 @@ package com.linkwechat.wecom.client;
import com.dtflys.forest.annotation.*; import com.dtflys.forest.annotation.*;
import com.linkwechat.wecom.domain.dto.*; import com.linkwechat.wecom.domain.dto.*;
import com.linkwechat.wecom.domain.dto.customer.JobExtendsCustomer;
import com.linkwechat.wecom.interceptor.WeAccessTokenInterceptor; import com.linkwechat.wecom.interceptor.WeAccessTokenInterceptor;
import com.linkwechat.wecom.interceptor.WeAppAccessTokenInterceptor; import com.linkwechat.wecom.interceptor.WeAppAccessTokenInterceptor;
import com.linkwechat.wecom.interceptor.WeCommonAccessTokenInterceptor; import com.linkwechat.wecom.interceptor.WeCommonAccessTokenInterceptor;
...@@ -86,7 +87,16 @@ public interface WeUserClient { ...@@ -86,7 +87,16 @@ public interface WeUserClient {
* @return * @return
*/ */
@Request(url = "/externalcontact/transfer_customer", type = "POST") @Request(url = "/externalcontact/transfer_customer", type = "POST")
WeResultDto transferCustomer(@JSONBody AllocateWeCustomerDto allocateWeCustomerDto); JobExtendsCustomer transferCustomer(@JSONBody AllocateWeCustomerDto allocateWeCustomerDto);
/**
* 查询客户接替状态
* @param jobExtendsParam
* @return
*/
@Post(url = "externalcontact/transfer_result")
JobExtendsCustomer transferResult(@JSONBody JobExtendsCustomer.JobExtendsParam jobExtendsParam);
......
...@@ -99,6 +99,9 @@ public class WeCustomer extends BaseEntity { ...@@ -99,6 +99,9 @@ public class WeCustomer extends BaseEntity {
private String state; private String state;
private String takeoverUserId;
......
...@@ -59,6 +59,9 @@ public class WeCustomerDetail { ...@@ -59,6 +59,9 @@ public class WeCustomerDetail {
private List<CompanyOrPersonTag> personTags; private List<CompanyOrPersonTag> personTags;
private List<TrackStates> trackStates;
@Data @Data
...@@ -99,6 +102,12 @@ public class WeCustomerDetail { ...@@ -99,6 +102,12 @@ public class WeCustomerDetail {
//群主 //群主
private String leaderName; private String leaderName;
//入群方式入群方式。
//1 - 由群成员邀请入群(直接邀请入群)
//2 - 由群成员邀请入群(通过邀请链接入群)
//3 - 通过扫描群二维码入群
private Integer joinScene;
} }
...@@ -120,6 +129,7 @@ public class WeCustomerDetail { ...@@ -120,6 +129,7 @@ public class WeCustomerDetail {
} }
@Data @Data
@Builder
public static class TrackStates{ public static class TrackStates{
//跟进人 //跟进人
private String userName; private String userName;
......
...@@ -23,7 +23,7 @@ import java.util.Date; ...@@ -23,7 +23,7 @@ import java.util.Date;
public class WeCustomerTrajectory extends BaseEntity { public class WeCustomerTrajectory extends BaseEntity {
@TableId @TableId
private String id; private String id;
//轨迹类型(1:信息动态;2:社交动态;3:活动规则;4:待办动态) //轨迹类型(1:信息动态;2:社交动态;3:跟进动态;4:待办动态)
private Integer trajectoryType; private Integer trajectoryType;
//外部联系人id //外部联系人id
private String externalUserid; private String externalUserid;
......
package com.linkwechat.wecom.domain.dto; package com.linkwechat.wecom.domain.dto;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.experimental.SuperBuilder; import lombok.experimental.SuperBuilder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
...@@ -28,4 +29,6 @@ public class AllocateWeCustomerDto{ ...@@ -28,4 +29,6 @@ public class AllocateWeCustomerDto{
/**转移成功后发给客户的消息,最多200个字符,不填则使用默认文案,目前只对在职成员分配客户的情况生效*/ /**转移成功后发给客户的消息,最多200个字符,不填则使用默认文案,目前只对在职成员分配客户的情况生效*/
private String transfer_success_msg; private String transfer_success_msg;
} }
package com.linkwechat.wecom.domain.dto.customer;
import com.linkwechat.wecom.domain.dto.WeResultDto;
import lombok.Builder;
import lombok.Data;
import java.util.List;
/**
* 在职继承客户
*/
@Data
public class JobExtendsCustomer extends WeResultDto {
private List<ExtendsCustomer> customer;
private String next_cursor;
@Data
public static class ExtendsCustomer{
//客户id
private String external_userid;
//接替状态, 1-接替完毕 2-等待接替 3-客户拒绝 4-接替成员客户达到上限 5-无接替记录
private Integer status;
//接替客户的时间,如果是等待接替状态,则为未来的自动接替时间
private Long takeover_time;
private Integer errcode;
}
@Data
@Builder
public static class JobExtendsParam{
private String handover_userid;
private String takeover_userid;
private String cursor;
}
}
package com.linkwechat.wecom.domain.vo;
import lombok.Data;
/**
* 在职员工客户分配
*/
@Data
public class WeOnTheJobCustomerVo {
//客户id
private String externalUserid;
//原有人id
private String handoverUserId;
//接手人id
private String takeoverUserId;
}
...@@ -6,6 +6,8 @@ import com.linkwechat.wecom.domain.dto.WeWelcomeMsg; ...@@ -6,6 +6,8 @@ import com.linkwechat.wecom.domain.dto.WeWelcomeMsg;
import com.linkwechat.wecom.domain.vo.WeCustomerDetailVo; import com.linkwechat.wecom.domain.vo.WeCustomerDetailVo;
import com.linkwechat.wecom.domain.vo.WeLeaveUserInfoAllocateVo; import com.linkwechat.wecom.domain.vo.WeLeaveUserInfoAllocateVo;
import com.linkwechat.wecom.domain.vo.WeMakeCustomerTag; import com.linkwechat.wecom.domain.vo.WeMakeCustomerTag;
import com.linkwechat.wecom.domain.vo.WeOnTheJobCustomerVo;
import java.util.List; import java.util.List;
/** /**
...@@ -34,6 +36,15 @@ public interface IWeCustomerService extends IService<WeCustomer> ...@@ -34,6 +36,15 @@ public interface IWeCustomerService extends IService<WeCustomer>
/** /**
* 在职员工客户分配
* @param weOnTheJobCustomerVo
*/
void allocateOnTheJobCustomer(WeOnTheJobCustomerVo weOnTheJobCustomerVo);
/**
* 客户打标签 * 客户打标签
* @param weMakeCustomerTag * @param weMakeCustomerTag
*/ */
...@@ -42,12 +53,6 @@ public interface IWeCustomerService extends IService<WeCustomer> ...@@ -42,12 +53,6 @@ public interface IWeCustomerService extends IService<WeCustomer>
// /**
// * 根据员工ID获取客户
// * @param externalUserid
// * @return
// */
// List<WeUser> getCustomersByUserId(String externalUserid);
/** /**
* 获取客户详情并同步客户数据 * 获取客户详情并同步客户数据
......
...@@ -14,13 +14,17 @@ import com.linkwechat.common.core.redis.RedisCache; ...@@ -14,13 +14,17 @@ import com.linkwechat.common.core.redis.RedisCache;
import com.linkwechat.common.exception.wecom.WeComException; import com.linkwechat.common.exception.wecom.WeComException;
import com.linkwechat.common.utils.SecurityUtils; import com.linkwechat.common.utils.SecurityUtils;
import com.linkwechat.common.utils.StringUtils; import com.linkwechat.common.utils.StringUtils;
import com.linkwechat.common.utils.Threads;
import com.linkwechat.common.utils.spring.SpringUtils; import com.linkwechat.common.utils.spring.SpringUtils;
import com.linkwechat.wecom.annotation.SynchRecord;
import com.linkwechat.wecom.client.WeCustomerClient; import com.linkwechat.wecom.client.WeCustomerClient;
import com.linkwechat.wecom.client.WeMsgAuditClient; import com.linkwechat.wecom.client.WeMsgAuditClient;
import com.linkwechat.wecom.client.WeUserClient; import com.linkwechat.wecom.client.WeUserClient;
import com.linkwechat.wecom.constants.SynchRecordConstants;
import com.linkwechat.wecom.domain.WeCustomerAddUser; import com.linkwechat.wecom.domain.WeCustomerAddUser;
import com.linkwechat.wecom.domain.WeUser; import com.linkwechat.wecom.domain.WeUser;
import com.linkwechat.wecom.domain.dto.WeUserInfoDto; import com.linkwechat.wecom.domain.dto.WeUserInfoDto;
import com.linkwechat.wecom.domain.dto.customer.ExternalUserDetail;
import com.linkwechat.wecom.domain.dto.customer.FollowUserList; import com.linkwechat.wecom.domain.dto.customer.FollowUserList;
import com.linkwechat.wecom.domain.dto.msgaudit.WeMsgAuditDto; import com.linkwechat.wecom.domain.dto.msgaudit.WeMsgAuditDto;
import com.linkwechat.wecom.domain.vo.*; import com.linkwechat.wecom.domain.vo.*;
...@@ -31,6 +35,8 @@ import com.linkwechat.wecom.service.IWeGroupService; ...@@ -31,6 +35,8 @@ import com.linkwechat.wecom.service.IWeGroupService;
import com.linkwechat.wecom.service.IWeUserService; import com.linkwechat.wecom.service.IWeUserService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -88,6 +94,7 @@ public class WeUserServiceImpl extends ServiceImpl<WeUserMapper, WeUser> impleme ...@@ -88,6 +94,7 @@ public class WeUserServiceImpl extends ServiceImpl<WeUserMapper, WeUser> impleme
.like(StringUtils.isNotEmpty(weUser.getName()),WeUser::getName,weUser.getName()) .like(StringUtils.isNotEmpty(weUser.getName()),WeUser::getName,weUser.getName())
.eq(weUser.getIsActivate() !=null,WeUser::getIsActivate,weUser.getIsActivate()) .eq(weUser.getIsActivate() !=null,WeUser::getIsActivate,weUser.getIsActivate())
.eq(weUser.getIsConfigCustomerContact() != null,WeUser::getIsConfigCustomerContact,weUser.getIsConfigCustomerContact()) .eq(weUser.getIsConfigCustomerContact() != null,WeUser::getIsConfigCustomerContact,weUser.getIsConfigCustomerContact())
.apply(StringUtils.isNotEmpty(weUser.getDepartment()),"FIND_IN_SET('"+weUser.getDepartment()+"',department)")
.apply(StringUtils.isNotBlank( weUser.getBeginTime()), .apply(StringUtils.isNotBlank( weUser.getBeginTime()),
"date_format (create_time,'%Y-%m-%d') >= date_format('" + weUser.getBeginTime() + "','%Y-%m-%d')") "date_format (create_time,'%Y-%m-%d') >= date_format('" + weUser.getBeginTime() + "','%Y-%m-%d')")
.apply(StringUtils.isNotBlank(weUser.getEndTime()), .apply(StringUtils.isNotBlank(weUser.getEndTime()),
...@@ -209,8 +216,17 @@ public class WeUserServiceImpl extends ServiceImpl<WeUserMapper, WeUser> impleme ...@@ -209,8 +216,17 @@ public class WeUserServiceImpl extends ServiceImpl<WeUserMapper, WeUser> impleme
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Async @SynchRecord(synchType = SynchRecordConstants.SYNCH_MAIL_LIST)
public void synchWeUser() { public void synchWeUser() {
SecurityContext securityContext = SecurityContextHolder.getContext();
//异步同步一下标签库,解决标签不同步问题
Threads.SINGLE_THREAD_POOL.execute(new Runnable() {
@Override
public void run() {
SecurityContextHolder.setContext(securityContext);
//同步部门 //同步部门
SpringUtils.getBean(IWeDepartmentService.class).synchWeDepartment(); SpringUtils.getBean(IWeDepartmentService.class).synchWeDepartment();
//获取通讯录成员列表 //获取通讯录成员列表
...@@ -218,7 +234,7 @@ public class WeUserServiceImpl extends ServiceImpl<WeUserMapper, WeUser> impleme ...@@ -218,7 +234,7 @@ public class WeUserServiceImpl extends ServiceImpl<WeUserMapper, WeUser> impleme
WeConstans.DEPARTMENT_SUB_WEUSER).getWeUsers(); WeConstans.DEPARTMENT_SUB_WEUSER).getWeUsers();
if (CollectionUtil.isNotEmpty(weUsers)) { if (CollectionUtil.isNotEmpty(weUsers)) {
//不存在的客户设置为离职未分配状态 //不存在的客户设置为离职未分配状态
this.update(WeUser.builder() update(WeUser.builder()
.isActivate(WeConstans.WE_USER_IS_LEAVE) .isActivate(WeConstans.WE_USER_IS_LEAVE)
.isAllocate(WeConstans.LEAVE_NO_ALLOCATE_STATE) .isAllocate(WeConstans.LEAVE_NO_ALLOCATE_STATE)
.dimissionTime(new Date()) .dimissionTime(new Date())
...@@ -226,14 +242,9 @@ public class WeUserServiceImpl extends ServiceImpl<WeUserMapper, WeUser> impleme ...@@ -226,14 +242,9 @@ public class WeUserServiceImpl extends ServiceImpl<WeUserMapper, WeUser> impleme
.notIn(WeUser::getUserId,weUsers.stream().map(WeUser::getUserId).collect(Collectors.toList()))); .notIn(WeUser::getUserId,weUsers.stream().map(WeUser::getUserId).collect(Collectors.toList())));
String[] noSyncWeUser = ruoYiConfig.getNoSyncWeUser();
if(ArrayUtil.isNotEmpty(noSyncWeUser)){
weUsers=weUsers.stream().filter(o -> !ListUtil.toList(noSyncWeUser).contains(o.getUserId())).collect(Collectors.toList());
}
List<List<WeUser>> lists = Lists.partition(weUsers, 500); List<List<WeUser>> lists = Lists.partition(weUsers, 500);
for(List<WeUser> list : lists){ for(List<WeUser> list : lists){
this.weUserMapper.insertBatch(list); weUserMapper.insertBatch(list);
} }
...@@ -243,7 +254,7 @@ public class WeUserServiceImpl extends ServiceImpl<WeUserMapper, WeUser> impleme ...@@ -243,7 +254,7 @@ public class WeUserServiceImpl extends ServiceImpl<WeUserMapper, WeUser> impleme
&& ArrayUtil.isNotEmpty(followUserList.getFollow_user())) { && ArrayUtil.isNotEmpty(followUserList.getFollow_user())) {
//设置员工是否开启外部联系人功能 //设置员工是否开启外部联系人功能
this.update(WeUser.builder() update(WeUser.builder()
.isConfigCustomerContact(new Integer(1)) .isConfigCustomerContact(new Integer(1))
.build(),new LambdaQueryWrapper<WeUser>() .build(),new LambdaQueryWrapper<WeUser>()
.eq(WeUser::getUserId,ListUtil.toList(followUserList.getFollow_user()))); .eq(WeUser::getUserId,ListUtil.toList(followUserList.getFollow_user())));
...@@ -256,6 +267,12 @@ public class WeUserServiceImpl extends ServiceImpl<WeUserMapper, WeUser> impleme ...@@ -256,6 +267,12 @@ public class WeUserServiceImpl extends ServiceImpl<WeUserMapper, WeUser> impleme
} }
} }
});
}
/** /**
...@@ -267,13 +284,27 @@ public class WeUserServiceImpl extends ServiceImpl<WeUserMapper, WeUser> impleme ...@@ -267,13 +284,27 @@ public class WeUserServiceImpl extends ServiceImpl<WeUserMapper, WeUser> impleme
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void deleteUser(String[] userIds) { public void deleteUser(String[] userIds) {
List<WeUser> weUsers=new ArrayList<>(); List<WeUser> weUsers=new ArrayList<>();
CollectionUtil.newArrayList(userIds).forEach(userId-> weUsers.add( CollectionUtil.newArrayList(userIds).forEach(userId-> {
String[] noSyncWeUser = ruoYiConfig.getNoSyncWeUser();
if(ArrayUtil.isNotEmpty(noSyncWeUser)){
if(CollectionUtil.toList(noSyncWeUser).contains(userId)){
throw new WeComException("当前员工不可删除");
}
}
weUsers.add(
WeUser.builder() WeUser.builder()
.userId(userId) .userId(userId)
.isActivate(WeConstans.corpUserEnum.ACTIVE_STATE_FIVE.getKey()) .isActivate(WeConstans.corpUserEnum.ACTIVE_STATE_FIVE.getKey())
.dimissionTime(new Date()) .dimissionTime(new Date())
.build() .build()
)); );
}
);
if(this.updateBatchById(weUsers)){ if(this.updateBatchById(weUsers)){
weUsers.forEach(k-> weUserClient.deleteUserByUserId(k.getUserId())); weUsers.forEach(k-> weUserClient.deleteUserByUserId(k.getUserId()));
} }
......
...@@ -207,7 +207,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -207,7 +207,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ON DUPLICATE KEY UPDATE ON DUPLICATE KEY UPDATE
NAME=IF(we_customer.NAME != null,we_customer.NAME, VALUES(NAME)), NAME=IF(we_customer.NAME != null,we_customer.NAME, VALUES(NAME)),
avatar=IF(we_customer.avatar != null, VALUES(avatar), we_customer.avatar), avatar=IF(we_customer.avatar != null, VALUES(avatar), we_customer.avatar),
customer_type=IF(we_customer.customer_type != null, VALUES(customer_type), we_customer.customer_type), customer_type=IF(we_customer.customer_type != null, we_customer.customer_type,VALUES(customer_type)),
gender=IF(we_customer.gender != null, VALUES(gender), we_customer.gender), gender=IF(we_customer.gender != null, VALUES(gender), we_customer.gender),
unionid=IF(we_customer.unionid != null, VALUES(unionid), we_customer.unionid), unionid=IF(we_customer.unionid != null, VALUES(unionid), we_customer.unionid),
birthday=IF(we_customer.birthday != null,VALUES(birthday), we_customer.birthday), birthday=IF(we_customer.birthday != null,VALUES(birthday), we_customer.birthday),
...@@ -220,7 +220,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -220,7 +220,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
email=IF(we_customer.email != null, VALUES(email), we_customer.email), email=IF(we_customer.email != null, VALUES(email), we_customer.email),
address=IF(we_customer.address != null, VALUES(address), we_customer.address), address=IF(we_customer.address != null, VALUES(address), we_customer.address),
phone=IF(we_customer.phone != null, VALUES(phone), we_customer.phone), phone=IF(we_customer.phone != null, VALUES(phone), we_customer.phone),
add_method=IF(we_customer.add_method != null, VALUES(add_method), we_customer.add_method); add_method=IF(we_customer.add_method != null, we_customer.add_method, VALUES(add_method));
</insert> </insert>
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
<where> <where>
<if test="delFlag !=null"> wg.del_flag=#{delFlag}</if> <if test="delFlag !=null"> wg.del_flag=#{delFlag}</if>
<if test="groupName != null and groupName != ''"> and wg.group_name like concat('%', #{groupName}, '%')</if> <if test="groupName != null and groupName != ''"> and wg.group_name like concat('%', #{groupName}, '%')</if>
<if test="groupLeader != null and groupLeader != ''"> and wu.user_name like concat('%', #{groupLeaderName}, '%')</if> <if test="groupLeaderName != null and groupLeaderName != ''"> and wu.user_name like concat('%', #{groupLeaderName}, '%')</if>
<if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 --> <if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
AND date_format(wg.create_time,'%y%m%d') &gt;= date_format(#{beginTime},'%y%m%d') AND date_format(wg.create_time,'%y%m%d') &gt;= date_format(#{beginTime},'%y%m%d')
</if> </if>
......
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
<jsqlparser.version>4.0</jsqlparser.version> <jsqlparser.version>4.0</jsqlparser.version>
<nacos.starter.version>1.0.2</nacos.starter.version> <nacos.starter.version>1.0.2</nacos.starter.version>
<protobuf.vaersion>3.18.0</protobuf.vaersion> <protobuf.vaersion>3.18.0</protobuf.vaersion>
<log4j2.version>2.16.0</log4j2.version>
</properties> </properties>
<!-- 依赖声明 --> <!-- 依赖声明 -->
...@@ -308,6 +309,21 @@ ...@@ -308,6 +309,21 @@
</dependency> </dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-to-slf4j</artifactId>
<version>${log4j2.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j2.version}</version>
</dependency>
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!