Browse Source

fix : 客服新增自动回复

bilingfeng 1 year ago
parent
commit
b82301f3e3

+ 1 - 1
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/ManageApplication.java

@@ -23,7 +23,7 @@ public class ManageApplication {
 
     public static void main(String[] args) {
         SpringApplication.run(ManageApplication.class, args);
-        System.out.println("赞象Manage服务启动成功 <CP推送消息调试修改 ( ´・・)ノ(._.`) \n" +
+        System.out.println("赞象Manage服务启动成功 <CP推送消息调试修改, 客服系统新增自动回复 ( ´・・)ノ(._.`) \n" +
                 "___  ___  ___   _   _   ___  _____  _____ \n" +
                 "|  \\/  | / _ \\ | \\ | | / _ \\|  __ \\|  ___|\n" +
                 "| .  . |/ /_\\ \\|  \\| |/ /_\\ \\ |  \\/| |__  \n" +

+ 6 - 7
game-module/game-module-manage/src/main/java/com/zanxiang/game/module/manage/service/impl/KfAppletMsgServiceImpl.java

@@ -137,7 +137,7 @@ public class KfAppletMsgServiceImpl implements IKfAppletMsgService {
             kfRoomMsgService.save(kfRoomMsg);
             return;
         }
-        //客服休息时间, 发送自动回复
+        //发送自动回复
         this.systemReplyHandle(gameApplet.getGameId(), kfAppletMsgDTO.getFromUserName(), kfRoom);
         //消息报警监测
         this.monitorWordHandle(gameApplet, kfAppletMsgDTO);
@@ -188,12 +188,11 @@ public class KfAppletMsgServiceImpl implements IKfAppletMsgService {
         LocalTime nowTime = LocalTime.now();
         LocalTime startTime = LocalTime.parse(kfSystemReply.getStartTime());
         LocalTime endTime = LocalTime.parse(kfSystemReply.getEndTime());
-        if (nowTime.isAfter(startTime) && nowTime.isBefore(endTime)) {
-            return;
-        }
-        //休息时间, 发送指定消息
+        //判断要发送的消息内容
+        String content = nowTime.isAfter(startTime) && nowTime.isBefore(endTime) ? kfSystemReply.getWorkSysReply() : kfSystemReply.getSysReply();
+        //发送消息
         Map<String, Object> textMap = new HashMap<>(1);
-        textMap.put("content", kfSystemReply.getSysReply());
+        textMap.put("content", content);
         Map<String, Object> msgParamMap = new HashMap<>(3);
         msgParamMap.put("touser", openId);
         msgParamMap.put("msgtype", KfRoomMsgTypeEnum.KF_MSG_TYPE_TEXT.getValue());
@@ -201,7 +200,7 @@ public class KfAppletMsgServiceImpl implements IKfAppletMsgService {
         kfWxApiService.sendCustomMessageApi(gameId, msgParamMap);
         //保存消息
         Map<String, Object> kfRoomMsgMap = new HashMap<>(1);
-        kfRoomMsgMap.put("text", kfSystemReply.getSysReply());
+        kfRoomMsgMap.put("text", content);
         kfRoomMsgService.save(this.transform(openId, gameId, kfRoom, KfRoomMsgTypeEnum.KF_MSG_TYPE_TEXT, JsonUtil.toString(kfRoomMsgMap)));
     }
 

+ 6 - 1
game-module/game-module-mybatis/src/main/java/com/zanxiang/game/module/mybatis/entity/KfSystemReply.java

@@ -32,10 +32,15 @@ public class KfSystemReply {
     private String appId;
 
     /**
-     * 回复
+     * 下班回复
      */
     private String sysReply;
 
+    /**
+     * 上班回复
+     */
+    private String workSysReply;
+
     /**
      * 开始时间
      */