|
@@ -26,9 +26,7 @@ import me.chanjar.weixin.cp.bean.WxCpBaseResp;
|
|
|
import me.chanjar.weixin.cp.bean.WxCpDepart;
|
|
import me.chanjar.weixin.cp.bean.WxCpDepart;
|
|
|
import me.chanjar.weixin.cp.bean.WxCpUser;
|
|
import me.chanjar.weixin.cp.bean.WxCpUser;
|
|
|
import me.chanjar.weixin.cp.bean.kf.*;
|
|
import me.chanjar.weixin.cp.bean.kf.*;
|
|
|
-import org.springframework.data.redis.core.StringRedisTemplate;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
-import org.springframework.util.CollectionUtils;
|
|
|
|
|
import org.springframework.util.ObjectUtils;
|
|
import org.springframework.util.ObjectUtils;
|
|
|
import org.springframework.util.StringUtils;
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
|
@@ -100,12 +98,28 @@ public class SysWechatCustomerBusinessServiceImpl implements SysWechatCustomerBu
|
|
|
// 设置值班时间
|
|
// 设置值班时间
|
|
|
sysWechatCustomerVoPageInfo.getList().forEach(sysWechatCustomerVo -> {
|
|
sysWechatCustomerVoPageInfo.getList().forEach(sysWechatCustomerVo -> {
|
|
|
List<SysWechatCustomerDuty> sysWechatCustomerDuties = dutyMap.get(Long.valueOf(sysWechatCustomerVo.getId()));
|
|
List<SysWechatCustomerDuty> sysWechatCustomerDuties = dutyMap.get(Long.valueOf(sysWechatCustomerVo.getId()));
|
|
|
- if (!CollectionUtils.isEmpty(sysWechatCustomerDuties)) {
|
|
|
|
|
- List<String> collect = sysWechatCustomerDuties.stream()
|
|
|
|
|
|
|
+ Map<Long, List<SysWechatCustomerDuty>> collect = sysWechatCustomerDuties.stream()
|
|
|
|
|
+ .collect(Collectors.groupingBy(SysWechatCustomerDuty::getDutyCustomerId));
|
|
|
|
|
+
|
|
|
|
|
+ Map<Long, SysWechatCustomer> collect2 = sysWechatCustomerService.lambdaQuery()
|
|
|
|
|
+ .in(SysWechatCustomer::getId, collect.keySet())
|
|
|
|
|
+ .list()
|
|
|
|
|
+ .stream()
|
|
|
|
|
+ .collect(Collectors.toMap(SysWechatCustomer::getId, x -> x));
|
|
|
|
|
+
|
|
|
|
|
+ collect.keySet().forEach(sysWechatCustomerVoId -> {
|
|
|
|
|
+ SysWechatCustomerVo.DutyCustomerDTO dutyCustomerDTO = new SysWechatCustomerVo.DutyCustomerDTO();
|
|
|
|
|
+ List<SysWechatCustomerDuty> sysWechatCustomerDuties1 = collect.get(sysWechatCustomerVoId);
|
|
|
|
|
+ List<String> collect1 = sysWechatCustomerDuties1.stream()
|
|
|
.map(x -> DateTimeUtil.startAndEndTimeFormatting(x.getStartTime(), x.getEndTime()))
|
|
.map(x -> DateTimeUtil.startAndEndTimeFormatting(x.getStartTime(), x.getEndTime()))
|
|
|
.collect(Collectors.toList());
|
|
.collect(Collectors.toList());
|
|
|
- sysWechatCustomerVo.setDutyDatetime(collect);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ SysWechatCustomer sysWechatCustomer = collect2.get(sysWechatCustomerVoId);
|
|
|
|
|
+ if(!ObjectUtils.isEmpty(sysWechatCustomer)) {
|
|
|
|
|
+ dutyCustomerDTO.setDutyCustomer(sysWechatCustomer.getNickname());
|
|
|
|
|
+ }
|
|
|
|
|
+ dutyCustomerDTO.setDutyDatetime(collect1);
|
|
|
|
|
+ sysWechatCustomerVo.setDutyCustomerDTO(dutyCustomerDTO);
|
|
|
|
|
+ });
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -158,7 +172,7 @@ public class SysWechatCustomerBusinessServiceImpl implements SysWechatCustomerBu
|
|
|
@Override
|
|
@Override
|
|
|
public void deleteWechatCustomer(String customerId) throws WxErrorException {
|
|
public void deleteWechatCustomer(String customerId) throws WxErrorException {
|
|
|
SysWechatCustomer sysWechatCustomer = sysWechatCustomerService.getByIdExist(customerId, "客服不存在");
|
|
SysWechatCustomer sysWechatCustomer = sysWechatCustomerService.getByIdExist(customerId, "客服不存在");
|
|
|
- sysWechatCustomerService.isDutyCustomerId(sysWechatCustomer.getId());
|
|
|
|
|
|
|
+ sysWechatCustomerDutyService.isDutyCustomerId(sysWechatCustomer.getId());
|
|
|
WxCpKfAccountDel wxCpKfAccountDel = new WxCpKfAccountDel();
|
|
WxCpKfAccountDel wxCpKfAccountDel = new WxCpKfAccountDel();
|
|
|
wxCpKfAccountDel.setOpenKfid(sysWechatCustomer.getOpenKfId());
|
|
wxCpKfAccountDel.setOpenKfid(sysWechatCustomer.getOpenKfId());
|
|
|
WxCpBaseResp wxCpBaseResp;
|
|
WxCpBaseResp wxCpBaseResp;
|
|
@@ -172,7 +186,7 @@ public class SysWechatCustomerBusinessServiceImpl implements SysWechatCustomerBu
|
|
|
@Override
|
|
@Override
|
|
|
public void updateWechatCustomer(String customerId, SysWechatCustomerAddVo sysWechatCustomerAddVo) throws WxErrorException {
|
|
public void updateWechatCustomer(String customerId, SysWechatCustomerAddVo sysWechatCustomerAddVo) throws WxErrorException {
|
|
|
SysWechatCustomer sysWechatCustomer = sysWechatCustomerService.getByIdExist(customerId, "客服不存在");
|
|
SysWechatCustomer sysWechatCustomer = sysWechatCustomerService.getByIdExist(customerId, "客服不存在");
|
|
|
- if(!sysWechatCustomer.getNickname().equals(sysWechatCustomerAddVo.getNickname())){
|
|
|
|
|
|
|
+ if (!sysWechatCustomer.getNickname().equals(sysWechatCustomerAddVo.getNickname())) {
|
|
|
sysWechatCustomerService.isNicknameRepeat(sysWechatCustomerAddVo.getNickname());
|
|
sysWechatCustomerService.isNicknameRepeat(sysWechatCustomerAddVo.getNickname());
|
|
|
}
|
|
}
|
|
|
WxCpKfAccountUpd wxCpKfAccountUpd = new WxCpKfAccountUpd();
|
|
WxCpKfAccountUpd wxCpKfAccountUpd = new WxCpKfAccountUpd();
|
|
@@ -256,8 +270,9 @@ public class SysWechatCustomerBusinessServiceImpl implements SysWechatCustomerBu
|
|
|
.le(SysWechatCustomerDuty::getStartTime, LocalDateTime.now())
|
|
.le(SysWechatCustomerDuty::getStartTime, LocalDateTime.now())
|
|
|
.ge(SysWechatCustomerDuty::getEndTime, LocalDateTime.now())
|
|
.ge(SysWechatCustomerDuty::getEndTime, LocalDateTime.now())
|
|
|
.list();
|
|
.list();
|
|
|
- if (sysWechatCustomer.getDutyCustomerId() > 0 && list != null && !list.isEmpty()) {
|
|
|
|
|
- sysWechatCustomer = sysWechatCustomerService.getById(sysWechatCustomer.getDutyCustomerId());
|
|
|
|
|
|
|
+ if (list != null && !list.isEmpty()) {
|
|
|
|
|
+ SysWechatCustomerDuty sysWechatCustomerDuty = list.get(0);
|
|
|
|
|
+ sysWechatCustomer = sysWechatCustomerService.getById(sysWechatCustomerDuty.getDutyCustomerId());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (ObjectUtils.isEmpty(sysWechatCustomer)) {
|
|
if (ObjectUtils.isEmpty(sysWechatCustomer)) {
|