You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
81 lines
3.0 KiB
81 lines
3.0 KiB
package com.example.demo.serviceImpl.bean;
|
|
|
|
import com.example.demo.domain.vo.bean.BeanAuditInfo;
|
|
import com.example.demo.domain.vo.bean.BeanRechargeInfo;
|
|
import com.example.demo.domain.vo.coin.Result;
|
|
import com.example.demo.mapper.coin.BeanAuditMapper;
|
|
import com.example.demo.service.bean.BeanAuditService;
|
|
import com.github.pagehelper.PageHelper;
|
|
import com.github.pagehelper.PageInfo;
|
|
import lombok.RequiredArgsConstructor;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.http.ResponseEntity;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.web.client.RestTemplate;
|
|
import org.springframework.web.util.UriComponentsBuilder;
|
|
|
|
import java.util.List;
|
|
import java.util.UUID;
|
|
|
|
/**
|
|
* @program: gold-java
|
|
* @ClassName BeanAuditServiceImpl
|
|
* @description:
|
|
* @author: Double
|
|
* @create: 2025−08-01 11:37
|
|
* @Version 1.0
|
|
**/
|
|
|
|
@Service
|
|
@RequiredArgsConstructor
|
|
public class BeanAuditServiceImpl implements BeanAuditService {
|
|
|
|
@Autowired
|
|
private BeanAuditMapper beanAuditMapper;
|
|
|
|
@Autowired
|
|
private RestTemplate restTemplate;
|
|
|
|
//查找审核信息
|
|
@Override
|
|
public PageInfo<BeanAuditInfo> selectBy(Integer pageNum, Integer pageSize, BeanAuditInfo beanAuditInfo) {
|
|
PageHelper.startPage(pageNum, pageSize);
|
|
List<BeanAuditInfo> beanAuditInfos = beanAuditMapper.selectBy(beanAuditInfo);
|
|
return new PageInfo<>(beanAuditInfos);
|
|
}
|
|
|
|
@Transactional
|
|
@Override
|
|
public Result updateStatus1(Long id) {
|
|
BeanAuditInfo beanAuditInfo = beanAuditMapper.selectById(id);
|
|
String jwcode = beanAuditInfo.getJwcode().toString();
|
|
String op = "recharge"; // 操作类型(根据实际业务定义,例如"recharge"表示充值)
|
|
String content = beanAuditInfo.getRemark(); // 备注作为content参数
|
|
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)
|
|
.queryParam("jwcode", jwcode)
|
|
.queryParam("op", op)
|
|
.queryParam("gold", beanAuditInfo.getPermanentBean())
|
|
.queryParam("content", content)
|
|
.queryParam("order_no", orderNo);
|
|
|
|
// 3. 发送GET请求
|
|
ResponseEntity<String> response = restTemplate.getForEntity(urlBuilder.toUriString(), String.class);
|
|
|
|
// 4. 处理响应结果
|
|
if (!response.getStatusCode().is2xxSuccessful()) {
|
|
return Result.error("远程接口调用失败,状态码:" + response.getStatusCodeValue());
|
|
}
|
|
beanAuditMapper.updateStatus1(id);
|
|
return Result.success();
|
|
}
|
|
|
|
@Override
|
|
public void updateStatus2(Long id) {
|
|
beanAuditMapper.updateStatus2(id);
|
|
}
|
|
}
|