|
@ -9,6 +9,7 @@ import com.github.pagehelper.PageHelper; |
|
|
import com.github.pagehelper.PageInfo; |
|
|
import com.github.pagehelper.PageInfo; |
|
|
import lombok.RequiredArgsConstructor; |
|
|
import lombok.RequiredArgsConstructor; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
import org.springframework.http.ResponseEntity; |
|
|
import org.springframework.http.ResponseEntity; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
@ -37,6 +38,11 @@ public class BeanAuditServiceImpl implements BeanAuditService { |
|
|
@Autowired |
|
|
@Autowired |
|
|
private RestTemplate restTemplate; |
|
|
private RestTemplate restTemplate; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 2. 构建接口URL及参数 |
|
|
|
|
|
@Value("${file.upload.url}") |
|
|
|
|
|
String apiUrl; |
|
|
|
|
|
|
|
|
//查找审核信息 |
|
|
//查找审核信息 |
|
|
@Override |
|
|
@Override |
|
|
public PageInfo<BeanAuditInfo> selectBy(Integer pageNum, Integer pageSize, BeanAuditInfo beanAuditInfo) { |
|
|
public PageInfo<BeanAuditInfo> selectBy(Integer pageNum, Integer pageSize, BeanAuditInfo beanAuditInfo) { |
|
@ -54,21 +60,32 @@ public class BeanAuditServiceImpl implements BeanAuditService { |
|
|
String content = beanAuditInfo.getRemark(); // 备注作为content参数 |
|
|
String content = beanAuditInfo.getRemark(); // 备注作为content参数 |
|
|
String orderNo = UUID.randomUUID().toString().replace("-", ""); // 生成唯一订单号(去除横线) |
|
|
String orderNo = UUID.randomUUID().toString().replace("-", ""); // 生成唯一订单号(去除横线) |
|
|
|
|
|
|
|
|
// 2. 构建接口URL及参数 |
|
|
|
|
|
String apiUrl = "http://47.92.148.30:3003/mock/61/hljw/api/user/gold"; |
|
|
|
|
|
UriComponentsBuilder urlBuilder = UriComponentsBuilder.fromHttpUrl(apiUrl) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UriComponentsBuilder urlBuilder1 = UriComponentsBuilder.fromHttpUrl(apiUrl) |
|
|
|
|
|
.queryParam("jwcode", jwcode) |
|
|
|
|
|
.queryParam("op", op) |
|
|
|
|
|
.queryParam("gold", beanAuditInfo.getFreeBean()) |
|
|
|
|
|
.queryParam("content", content); |
|
|
|
|
|
|
|
|
|
|
|
UriComponentsBuilder urlBuilder2 = UriComponentsBuilder.fromHttpUrl(apiUrl) |
|
|
.queryParam("jwcode", jwcode) |
|
|
.queryParam("jwcode", jwcode) |
|
|
.queryParam("op", op) |
|
|
.queryParam("op", op) |
|
|
.queryParam("gold", beanAuditInfo.getPermanentBean()) |
|
|
.queryParam("gold", beanAuditInfo.getPermanentBean()) |
|
|
.queryParam("content", content) |
|
|
.queryParam("content", content) |
|
|
.queryParam("order_no", orderNo); |
|
|
.queryParam("order_no", orderNo); |
|
|
|
|
|
// 3. 发送GET请求 |
|
|
|
|
|
ResponseEntity<String> response1 = restTemplate.getForEntity(urlBuilder1.toUriString(), String.class); |
|
|
|
|
|
|
|
|
|
|
|
// 4. 处理响应结果 |
|
|
|
|
|
if (!response1.getStatusCode().is2xxSuccessful()) { |
|
|
|
|
|
return Result.error("免费远程接口调用失败,状态码:" + response1.getStatusCodeValue()); |
|
|
|
|
|
} |
|
|
// 3. 发送GET请求 |
|
|
// 3. 发送GET请求 |
|
|
ResponseEntity<String> response = restTemplate.getForEntity(urlBuilder.toUriString(), String.class); |
|
|
|
|
|
|
|
|
ResponseEntity<String> response2 = restTemplate.getForEntity(urlBuilder2.toUriString(), String.class); |
|
|
|
|
|
|
|
|
// 4. 处理响应结果 |
|
|
// 4. 处理响应结果 |
|
|
if (!response.getStatusCode().is2xxSuccessful()) { |
|
|
|
|
|
return Result.error("远程接口调用失败,状态码:" + response.getStatusCodeValue()); |
|
|
|
|
|
|
|
|
if (!response2.getStatusCode().is2xxSuccessful()) { |
|
|
|
|
|
return Result.error("付费远程接口调用失败,状态码:" + response2.getStatusCodeValue()); |
|
|
} |
|
|
} |
|
|
beanAuditMapper.updateStatus1(id); |
|
|
beanAuditMapper.updateStatus1(id); |
|
|
return Result.success(); |
|
|
return Result.success(); |
|
|