Commit 4356f9be by shenjunjie

Merge branch 'feature' into 'dev'

上线登录优化流程

See merge request !138
parents 07cb9bac 172d28b8
......@@ -10,11 +10,13 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;
import javax.annotation.Resource;
......@@ -34,6 +36,15 @@ public class LoginController extends BaseController {
@Value("${jwt.hour}")
private int jwtHour;
@Value("${qbjc.userCenter.url}")
private String yuqingInterface;
@Value("${qbjc.userCenter.token}")
private String token;
@Autowired
private RestTemplate restTemplate;
@Resource(name = "userServiceImpl")
private UserService UserService;
......@@ -91,6 +102,40 @@ public class LoginController extends BaseController {
return ResponseResult.success(ProjectService.getLoginUserAllProjects());
}
@ApiOperation("第三方接入-验证External-Token")
@GetMapping("/user/login/verify/token")
public ResponseResult verifyToken() {
HttpHeaders httpHeaders = new HttpHeaders();
httpHeaders.set("External-Origin", "BRANDKBS");
httpHeaders.set("External-Service", "BRANDKBS");
httpHeaders.set("External-Token", token);
HttpEntity<String> requestEntity = new HttpEntity<>(httpHeaders);
HttpEntity<JSONObject> entity = restTemplate.exchange(yuqingInterface + "/thirdPart/external/verify/token", HttpMethod.GET,
requestEntity, JSONObject.class);
if (null != entity.getBody() || !entity.getBody().getBoolean("status")) {
String ticket = entity.getBody().getJSONObject("data").getString("ticket");
return ResponseResult.success(ticket);
}
return ResponseResult.failure("ticket获取失败");
}
@ApiOperation("第三方接入-验证External-Ticket")
@GetMapping("/user/login/verify/ticket")
public ResponseResult verifyTicket(@RequestParam String ticket) {
HttpHeaders httpHeaders = new HttpHeaders();
httpHeaders.set("External-Origin", "BRANDKBS");
httpHeaders.set("External-Token", token);
httpHeaders.set("External-Ticket", ticket);
HttpEntity<String> requestEntity = new HttpEntity<>(httpHeaders);
HttpEntity<JSONObject> entity = restTemplate.exchange(yuqingInterface + "/thirdPart/external/verify/ticket", HttpMethod.GET,
requestEntity, JSONObject.class);
if (null != entity.getBody()) {
JSONObject userInfo = entity.getBody().getJSONObject("data");
return ResponseResult.success(userInfo);
}
return ResponseResult.failure("用户信息获取失败");
}
@ApiOperation("测试接口")
@GetMapping("/test")
public ResponseResult test() {
......
......@@ -182,5 +182,12 @@ public class AppArticleController extends BaseController {
return ResponseResult.success(reportService.getPcReportAnalyze(id, true));
}
@ApiOperation("舆情简报-更新报告结果")
@ApiImplicitParam(name = "id", value = "报告ID", required = true, paramType = "path", dataType = "String")
@PutMapping("/update/{id}")
public ResponseResult updateReportAnalyze(@PathVariable String id) {
reportService.getPcReportAnalyze(id, false);
return ResponseResult.success();
}
}
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