|
|
@@ -57,8 +57,6 @@ public class SysWechatCustomerBusinessServiceImpl implements SysWechatCustomerBu
|
|
|
|
|
|
private final SysWechatCustomerRecordingService sysWechatCustomerRecordingService;
|
|
|
|
|
|
- private final StringRedisTemplate redisTemplate;
|
|
|
-
|
|
|
@Override
|
|
|
public List<SysWechatCustomerDeptVo> getDeptByDeptId() throws WxErrorException {
|
|
|
List<WxCpDepart> list = wxCpDepartmentService.list(null);
|
|
|
@@ -160,6 +158,7 @@ public class SysWechatCustomerBusinessServiceImpl implements SysWechatCustomerBu
|
|
|
@Override
|
|
|
public void deleteWechatCustomer(String customerId) throws WxErrorException {
|
|
|
SysWechatCustomer sysWechatCustomer = sysWechatCustomerService.getByIdExist(customerId, "客服不存在");
|
|
|
+ sysWechatCustomerService.isDutyCustomerId(sysWechatCustomer.getId());
|
|
|
WxCpKfAccountDel wxCpKfAccountDel = new WxCpKfAccountDel();
|
|
|
wxCpKfAccountDel.setOpenKfid(sysWechatCustomer.getOpenKfId());
|
|
|
WxCpBaseResp wxCpBaseResp;
|
|
|
@@ -172,8 +171,10 @@ public class SysWechatCustomerBusinessServiceImpl implements SysWechatCustomerBu
|
|
|
|
|
|
@Override
|
|
|
public void updateWechatCustomer(String customerId, SysWechatCustomerAddVo sysWechatCustomerAddVo) throws WxErrorException {
|
|
|
- sysWechatCustomerService.isNicknameRepeat(sysWechatCustomerAddVo.getNickname());
|
|
|
SysWechatCustomer sysWechatCustomer = sysWechatCustomerService.getByIdExist(customerId, "客服不存在");
|
|
|
+ if(!sysWechatCustomer.getNickname().equals(sysWechatCustomerAddVo.getNickname())){
|
|
|
+ sysWechatCustomerService.isNicknameRepeat(sysWechatCustomerAddVo.getNickname());
|
|
|
+ }
|
|
|
WxCpKfAccountUpd wxCpKfAccountUpd = new WxCpKfAccountUpd();
|
|
|
wxCpKfAccountUpd.setOpenKfid(sysWechatCustomer.getOpenKfId());
|
|
|
boolean isAvatarSame = StringUtils.hasLength(sysWechatCustomer.getAvatar()) && !sysWechatCustomer.getAvatar()
|
|
|
@@ -234,25 +235,15 @@ public class SysWechatCustomerBusinessServiceImpl implements SysWechatCustomerBu
|
|
|
.last("limit 1")
|
|
|
.one();
|
|
|
if (ObjectUtils.isEmpty(sysWechatCustomerRecording)) {
|
|
|
- String s = redisTemplate.opsForValue().get("sys:wechat:customer");
|
|
|
- String s1 = Optional.ofNullable(s)
|
|
|
- .orElse("0");
|
|
|
- sysWechatCustomer = sysWechatCustomerService.lambdaQuery()
|
|
|
- .gt(StringUtils.hasLength(s1), SysWechatCustomer::getId, s1)
|
|
|
- .orderByAsc(SysWechatCustomer::getId)
|
|
|
- .last("limit 1")
|
|
|
- .one();
|
|
|
- if (ObjectUtils.isEmpty(sysWechatCustomer)) {
|
|
|
- sysWechatCustomer = sysWechatCustomerService.lambdaQuery()
|
|
|
- .orderByAsc(SysWechatCustomer::getId)
|
|
|
- .last("limit 1")
|
|
|
- .one();
|
|
|
- }
|
|
|
+ sysWechatCustomerService.getCacheCustomerId(sysWechatCustomer);
|
|
|
} else {
|
|
|
// 使用上一次的客服
|
|
|
sysWechatCustomer = sysWechatCustomerService.lambdaQuery()
|
|
|
.eq(SysWechatCustomer::getId, sysWechatCustomerRecording.getCustomerId())
|
|
|
.one();
|
|
|
+ if (ObjectUtils.isEmpty(sysWechatCustomer)) {
|
|
|
+ sysWechatCustomerService.getCacheCustomerId(sysWechatCustomer);
|
|
|
+ }
|
|
|
}
|
|
|
SysWechatCustomerRecording customerRecording = new SysWechatCustomerRecording();
|
|
|
customerRecording.setCustomerId(sysWechatCustomer.getId());
|
|
|
@@ -281,5 +272,4 @@ public class SysWechatCustomerBusinessServiceImpl implements SysWechatCustomerBu
|
|
|
return accountLink.getUrl();
|
|
|
}
|
|
|
|
|
|
-
|
|
|
}
|