提交 b53aa524 作者: 张小凤

RequirementsController(update)

上级 a25f0ccf
package com.mmc.csf.release.config;
import com.alibaba.fastjson.JSONObject;
import com.mmc.csf.common.util.web.ResultBody;
import com.mmc.csf.common.util.web.ResultEnum;
import com.mmc.csf.infomation.dto.PilotCertificationInteriorDTO;
import com.sun.org.glassfish.gmbal.NameValue;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.*;
import org.springframework.web.client.RestClientException;
import org.springframework.web.client.RestTemplate;
import javax.servlet.http.HttpServletRequest;
/**
* @Author small
* @Date 2023/8/18 10:35
* @Version 1.0
*/
public class RestTemplateConfig {
@Autowired
private RestTemplate restTemplate;
@Value("${iuav.pmsapp.url}")
@NameValue()
private String pmsApp;
@Value("${iuav.userapp.url}")
private String userApp;
public ResultBody releaseOrder(Integer id, HttpServletRequest request) {
String token = request.getHeader("token");
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
headers.add("token", token);
HttpEntity<String> entity = new HttpEntity<>(JSONObject.toJSONString(id), headers);
ResponseEntity<Object> exchange = null;
try {
exchange = restTemplate.exchange(pmsApp + "/pms/industry/getIndustryTypeById?id=" + id, HttpMethod.GET, entity, Object.class);
} catch (RestClientException e) {
return ResultBody.error(ResultEnum.THE_THIRD_PARTY_INTERFACE_IS_BEING_UPDATED);
}
return ResultBody.success();
}
public PilotCertificationInteriorDTO feignInteriorDetailPilot(Integer userAccountId, HttpServletRequest request) {
String token = request.getHeader("token");
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
headers.add("token", token);
HttpEntity<String> entity = new HttpEntity<>(JSONObject.toJSONString(userAccountId), headers);
ResponseEntity<Object> exchange = null;
System.out.println(userApp);
try {
ResponseEntity<PilotCertificationInteriorDTO> exchange1 = restTemplate.exchange("http://localhost:35150" + "/userapp/pilot/interiorDetailPilot?userAccountId=" + userAccountId, HttpMethod.GET, entity, PilotCertificationInteriorDTO.class);
PilotCertificationInteriorDTO body = exchange1.getBody();
System.out.println(body);
} catch (RestClientException e) {
// return ResultBody.error(ResultEnum.THE_THIRD_PARTY_INTERFACE_IS_BEING_UPDATED);
}
// return ResultBody.success();
return null;
}
}
......@@ -117,7 +117,6 @@ public class RequirementsController extends BaseController {
return requirementsService.myPreempt(this.getUserLoginInfoFromRedis(request).getUserAccountId());
}
@ApiOperation(value = "new——小程序-—飞手端--抵达现场")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@PostMapping("arriveAtTheScene")
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论