|
@@ -827,20 +827,20 @@ public class CorpServiceImpl implements CorpService {
|
|
|
* 会话状态为待处理 则分配接待人员
|
|
* 会话状态为待处理 则分配接待人员
|
|
|
*/
|
|
*/
|
|
|
public void assignKfSession(String corpId, String openKfId, String externalUserid, CorpKfAccountSessionConfig corpKfAccountSessionConfig, Date sendDate, String msgid) throws Exception {
|
|
public void assignKfSession(String corpId, String openKfId, String externalUserid, CorpKfAccountSessionConfig corpKfAccountSessionConfig, Date sendDate, String msgid) throws Exception {
|
|
|
- //查询用户会话状态 0待处理就进行处理
|
|
|
|
|
|
|
+ //查询用户会话状态 0待处理 1智能助手接待
|
|
|
ServiceStateResponse serviceStateResponse = wxCorpOps.getCorpKfSessionStatus(corpId, openKfId, externalUserid);
|
|
ServiceStateResponse serviceStateResponse = wxCorpOps.getCorpKfSessionStatus(corpId, openKfId, externalUserid);
|
|
|
Integer state = serviceStateResponse.getService_state();
|
|
Integer state = serviceStateResponse.getService_state();
|
|
|
- if (state != 0) {
|
|
|
|
|
|
|
+ if (state != 0 && state != 1) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
//用户是否已有会话
|
|
//用户是否已有会话
|
|
|
- Integer selectCount = corpKfServicerSessionRecordMapper.selectCount(Wrappers.lambdaQuery(CorpKfServicerSessionRecord.class)
|
|
|
|
|
|
|
+ CorpKfServicerSessionRecord corpKfServicerSessionRecord = corpKfServicerSessionRecordMapper.selectOne(Wrappers.lambdaQuery(CorpKfServicerSessionRecord.class)
|
|
|
.eq(CorpKfServicerSessionRecord::getOpenKfId, openKfId)
|
|
.eq(CorpKfServicerSessionRecord::getOpenKfId, openKfId)
|
|
|
.eq(CorpKfServicerSessionRecord::getExternalUserid, externalUserid)
|
|
.eq(CorpKfServicerSessionRecord::getExternalUserid, externalUserid)
|
|
|
.eq(CorpKfServicerSessionRecord::getServiceState, 0));
|
|
.eq(CorpKfServicerSessionRecord::getServiceState, 0));
|
|
|
- if (selectCount > 0) {
|
|
|
|
|
- log.info("external_userid:{}已有未结束的会话,无需分配", externalUserid);
|
|
|
|
|
- return;
|
|
|
|
|
|
|
+ if (corpKfServicerSessionRecord != null) {
|
|
|
|
|
+ corpKfServicerSessionRecord.setServiceState(1);
|
|
|
|
|
+ corpKfServicerSessionRecordMapper.updateById(corpKfServicerSessionRecord);
|
|
|
}
|
|
}
|
|
|
DateTime now = DateTime.now();
|
|
DateTime now = DateTime.now();
|
|
|
String thisHourDate = DateUtil.format(now, "HH:mm");
|
|
String thisHourDate = DateUtil.format(now, "HH:mm");
|
|
@@ -950,7 +950,7 @@ public class CorpServiceImpl implements CorpService {
|
|
|
.last("limit 1"));
|
|
.last("limit 1"));
|
|
|
if (corpKfServicerSessionRecord != null) {
|
|
if (corpKfServicerSessionRecord != null) {
|
|
|
corpKfServicerSessionRecord.setCloseTime(sendDate);
|
|
corpKfServicerSessionRecord.setCloseTime(sendDate);
|
|
|
- corpKfServicerSessionRecord.setServiceState(changeType);
|
|
|
|
|
|
|
+ corpKfServicerSessionRecord.setServiceState(changeType != 2 ? 1 : changeType);
|
|
|
if (changeType != 2) {
|
|
if (changeType != 2) {
|
|
|
try {
|
|
try {
|
|
|
wxCorpOps.sendSatisfactionMsg(corpKfServicerSessionRecord.getMsgid(), openKfId, externalUserId, msgCode);
|
|
wxCorpOps.sendSatisfactionMsg(corpKfServicerSessionRecord.getMsgid(), openKfId, externalUserId, msgCode);
|