lrf 8 maanden geleden
bovenliggende
commit
54b053d39b

+ 1 - 0
src/main/java/com/free/config/ExceptionEnum.java

@@ -16,6 +16,7 @@ public enum ExceptionEnum {
   CHAT_APPLY_NOT_AGREE("4009", "转人工申请未通过受理"),
   CHAT_APPLY_IS_CLOSE("40010", "转人工申请已结束"),
   CHAT_SPEAKER_NOT_IN_APPLY("40011", "当前用户无法发言"),
+  ACCPET_USER_TYPE_FAULT("40012", "当前用户不是客服人员,无法受理转人工申请"),
   ACCOUNT_IS_EXIST("4011", "账号已存在"),
   ACCOUNT_NOT_FOUND("4012", "未找到账号信息"),
   PASSWORD_ERROR("4013", "密码错误"),

+ 2 - 2
src/main/java/com/free/controller/LoginController.java

@@ -46,9 +46,9 @@ public class LoginController {
   /** 超级管理员编码 */
   private String isSuperAdminCode = "0";
   /** 管理员登录类型 */
-  private String adminLoginType = "Admin";
+  public static String adminLoginType = "Admin";
   /** 客服人员登录类型 */
-  private String csLoginType = "Customer";
+  public static String csLoginType = "Customer";
 
   @Autowired
   private AdminService adminService;

+ 13 - 1
src/main/java/com/free/controller/TransferApplyController.java

@@ -28,6 +28,7 @@ import com.free.dto.TransferApplyCreateDTO;
 import com.free.entity.TransferApply;
 import com.free.mq.MqService;
 import com.free.service.TransferApplyService;
+import com.free.utils.JwtUtil;
 
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -112,7 +113,18 @@ public class TransferApplyController {
     if (num <= 0) {
       throw new CustomizationException(ExceptionEnum.NOT_FOUND);
     }
-    data.setId(id);
+    TransferApply updateData = new TransferApply();
+    updateData.setId(id);
+    // 从token获取信息, 只有客服人员能处理
+    Map userMap = JwtUtil.getDetails(null);
+    String type = (String) userMap.get("type");
+    if (!LoginController.csLoginType.equals(type)) {
+      throw new CustomizationException(ExceptionEnum.ACCPET_USER_TYPE_FAULT);
+
+    }
+    // 获取客服人员id
+    Long customer_id = Long.valueOf(String.valueOf(userMap.get("id")));
+    updateData.setCustomer_id(customer_id);
     this.service.updateById(data);
     TransferApply newData = this.service.getById(id);
     // 如果审核通过了, 则需要给申请人发送mq消息.申请人需要知道是谁跟自己对话