Commit f4f04e51 authored by zhangyingbin's avatar zhangyingbin

修改坐席登录接口

parent bbb7337e
...@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject; ...@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey; import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.common.biz.utils.CommonResponseUtil;
import com.yeejoin.amos.boot.module.tzs.api.dto.CtiDto; import com.yeejoin.amos.boot.module.tzs.api.dto.CtiDto;
import com.yeejoin.amos.boot.module.tzs.api.service.ICtiService; import com.yeejoin.amos.boot.module.tzs.api.service.ICtiService;
import com.yeejoin.amos.boot.module.tzs.biz.utils.HttpUtils; import com.yeejoin.amos.boot.module.tzs.biz.utils.HttpUtils;
...@@ -18,6 +19,7 @@ import org.springframework.web.bind.annotation.RequestBody; ...@@ -18,6 +19,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest; import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import org.typroject.tyboot.core.restful.utils.ResponseHelper;
...@@ -55,6 +57,9 @@ public class CtiController extends BaseController { ...@@ -55,6 +57,9 @@ public class CtiController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "获取坐席登陆信息", notes = "获取坐席登陆信息") @ApiOperation(httpMethod = "GET", value = "获取坐席登陆信息", notes = "获取坐席登陆信息")
public ResponseModel<JSONObject> getCtiInfo() { public ResponseModel<JSONObject> getCtiInfo() {
JSONObject loginData = ctiService.getLoginInfo(); JSONObject loginData = ctiService.getLoginInfo();
if(ValidationUtil.isEmpty(loginData)){
return CommonResponseUtil.failure("当前用户不是坐席人员!");
}
return ResponseHelper.buildResponse(loginData); return ResponseHelper.buildResponse(loginData);
} }
......
...@@ -2,8 +2,10 @@ package com.yeejoin.amos.boot.module.tzs.biz.service.impl; ...@@ -2,8 +2,10 @@ package com.yeejoin.amos.boot.module.tzs.biz.service.impl;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey; import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.tzs.api.entity.TzsCitInfo;
import com.yeejoin.amos.boot.module.tzs.api.service.ICtiService; import com.yeejoin.amos.boot.module.tzs.api.service.ICtiService;
import com.yeejoin.amos.boot.module.tzs.biz.utils.HttpUtils; import com.yeejoin.amos.boot.module.tzs.biz.utils.HttpUtils;
import com.yeejoin.amos.component.feign.model.FeignClientResult; import com.yeejoin.amos.component.feign.model.FeignClientResult;
...@@ -16,6 +18,7 @@ import org.springframework.mock.web.MockMultipartFile; ...@@ -16,6 +18,7 @@ import org.springframework.mock.web.MockMultipartFile;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import org.typroject.tyboot.core.foundation.context.RequestContext; import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest; import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import java.security.MessageDigest; import java.security.MessageDigest;
...@@ -34,6 +37,9 @@ public class CtiServiceImpl implements ICtiService { ...@@ -34,6 +37,9 @@ public class CtiServiceImpl implements ICtiService {
@Autowired @Autowired
RedisUtils redisUtils; RedisUtils redisUtils;
@Autowired
TzsCitInfoServiceImpl ctiInfoService;
/** /**
* token 过期时间, cti 系统为7200 ,tzs 系统小于7200 防止获取到无效token * token 过期时间, cti 系统为7200 ,tzs 系统小于7200 防止获取到无效token
*/ */
...@@ -86,11 +92,17 @@ public class CtiServiceImpl implements ICtiService { ...@@ -86,11 +92,17 @@ public class CtiServiceImpl implements ICtiService {
@Override @Override
public JSONObject getLoginInfo() { public JSONObject getLoginInfo() {
String token = this.getAccessToken(); String token = this.getAccessToken();
// gid code extphone 目前写死 后面根据用户获取 // gid code extphone 根据用户获取
String gid = "61,默认,0";
AgencyUserModel me = Privilege.agencyUserClient.getme().getResult(); AgencyUserModel me = Privilege.agencyUserClient.getme().getResult();
String code = "1001"; LambdaQueryWrapper<TzsCitInfo> wrapper = new LambdaQueryWrapper<>();
String extphone = "10001001"; wrapper.eq(TzsCitInfo::getCtiUserId,me.getUserId());
TzsCitInfo citInfo = ctiInfoService.getOne(wrapper);
if(ValidationUtil.isEmpty(citInfo)){
return null;
}
String gid = citInfo.getGid();
String code = citInfo.getCode();
String extphone = citInfo.getExtphone();
String loginUrl = ctiUrl + "/cti/login" + "?accessToken=" + token; String loginUrl = ctiUrl + "/cti/login" + "?accessToken=" + token;
Map<String,Object> params = new HashMap<>(); Map<String,Object> params = new HashMap<>();
params.put("accessToken",token); params.put("accessToken",token);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment