|
|
@@ -660,50 +660,32 @@ public class CorpServiceImpl implements CorpService {
|
|
|
//会话状态为待处理 则分配接待人员
|
|
|
assignKfSession(corpId, openKfId, externalUserId, corpKfAccountSessionConfig);
|
|
|
}
|
|
|
+ syncSessionSatisfaction(openKfId, item);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void syncSessionSatisfaction(String openKfId, List<WxCpKfMsgListResp.WxCpKfMsgItem> textList, String corpId, CorpKfAccountSessionConfig corpKfAccountSessionConfig) throws Exception {
|
|
|
- if (textList == null) {
|
|
|
- return;
|
|
|
- }
|
|
|
+ private void syncSessionSatisfaction(String openKfId, WxCpKfMsgListResp.WxCpKfMsgItem item) throws Exception {
|
|
|
Integer satisfaction = null;
|
|
|
- for (WxCpKfMsgListResp.WxCpKfMsgItem item : textList) {
|
|
|
- WxCorpTextMsg text = item.getText();
|
|
|
- //自定义菜单id
|
|
|
- if (text.getMenu_id() != null) {
|
|
|
- //满意
|
|
|
- if ("101".equals(text.getMenu_id())) {
|
|
|
- satisfaction = 1;
|
|
|
- }
|
|
|
- //一般
|
|
|
- if ("102".equals(text.getMenu_id())) {
|
|
|
- satisfaction = 2;
|
|
|
- }
|
|
|
- //不满意
|
|
|
- if ("103".equals(text.getMenu_id())) {
|
|
|
- satisfaction = 3;
|
|
|
- }
|
|
|
- if (satisfaction != null) {
|
|
|
- corpKfServicerSessionRecordMapper.update(null, Wrappers.lambdaUpdate(CorpKfServicerSessionRecord.class)
|
|
|
- .set(CorpKfServicerSessionRecord::getSatisfaction, satisfaction)
|
|
|
- .eq(CorpKfServicerSessionRecord::getOpenKfId, openKfId)
|
|
|
- .eq(CorpKfServicerSessionRecord::getMsgId, item.getMsgId()));
|
|
|
- }
|
|
|
+ WxCorpTextMsg text = item.getText();
|
|
|
+ //自定义菜单id
|
|
|
+ if (text.getMenu_id() != null) {
|
|
|
+ //满意
|
|
|
+ if ("101".equals(text.getMenu_id())) {
|
|
|
+ satisfaction = 1;
|
|
|
}
|
|
|
- try {
|
|
|
- //查询用户是否有会话 无会话发文本消息 分配会话
|
|
|
- Integer state = wxCorpOps.getCorpKfSessionStatus(corpId, openKfId, item.getExternalUserId());
|
|
|
- if (state == 0) {
|
|
|
- //接入等待池 分配会话
|
|
|
- if (corpKfAccountSessionConfig != null) {
|
|
|
- String queueTips = corpKfAccountSessionConfig.getQueueTips();
|
|
|
- sendCorpKfTextTips(corpId, item.getExternalUserId(), openKfId, queueTips);
|
|
|
- }
|
|
|
- moveWaitingQueue(corpId, openKfId, item.getExternalUserId());
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
-
|
|
|
+ //一般
|
|
|
+ if ("102".equals(text.getMenu_id())) {
|
|
|
+ satisfaction = 2;
|
|
|
+ }
|
|
|
+ //不满意
|
|
|
+ if ("103".equals(text.getMenu_id())) {
|
|
|
+ satisfaction = 3;
|
|
|
+ }
|
|
|
+ if (satisfaction != null) {
|
|
|
+ corpKfServicerSessionRecordMapper.update(null, Wrappers.lambdaUpdate(CorpKfServicerSessionRecord.class)
|
|
|
+ .set(CorpKfServicerSessionRecord::getSatisfaction, satisfaction)
|
|
|
+ .eq(CorpKfServicerSessionRecord::getOpenKfId, openKfId)
|
|
|
+ .eq(CorpKfServicerSessionRecord::getMsgId, item.getMsgId()));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -935,7 +917,7 @@ public class CorpServiceImpl implements CorpService {
|
|
|
/**
|
|
|
* 设置会话记录状态
|
|
|
*/
|
|
|
- public void setDbSessionState(String openKfId, String externalUserId, Long sendTime) {
|
|
|
+ public void setDbSessionState(String openKfId, String externalUserId, Long sendTime) throws Exception {
|
|
|
CorpKfServicerSessionRecord corpKfServicerSessionRecord = corpKfServicerSessionRecordMapper.selectOne(Wrappers.lambdaQuery(CorpKfServicerSessionRecord.class)
|
|
|
.eq(CorpKfServicerSessionRecord::getOpenKfId, openKfId)
|
|
|
.eq(CorpKfServicerSessionRecord::getExternalUserid, externalUserId)
|
|
|
@@ -943,6 +925,8 @@ public class CorpServiceImpl implements CorpService {
|
|
|
if (corpKfServicerSessionRecord != null) {
|
|
|
corpKfServicerSessionRecord.setCloseTime(DateTime.of(sendTime * 1000));
|
|
|
corpKfServicerSessionRecord.setServiceState(1);
|
|
|
+ wxCorpOps.sendSatisfactionMsg(corpKfServicerSessionRecord.getMsgId());
|
|
|
+ corpKfServicerSessionRecord.setSendSatisfaction(true);
|
|
|
corpKfServicerSessionRecordMapper.updateById(corpKfServicerSessionRecord);
|
|
|
}
|
|
|
}
|