修改查询交易记录接口

1、添加按id排序
2、添加查询所有国家
3、添加接口,更新用户国家、职业信息
This commit is contained in:
2025-01-10 16:13:45 +08:00
parent 698fca8787
commit ef70598180
8 changed files with 59 additions and 4 deletions

View File

@@ -341,4 +341,11 @@ public class AccountController {
public Response<Boolean> unbindGoogle() {
return Response.success(accountService.unbindGoogle());
}
@GetMapping("/updateUserInfo")
@ApiOperation(value = "更新用户国家、职业信息")
public Response<String> updateUserInfo(@RequestParam(value = "country", required = false) String country, @RequestParam(value = "occupation", required = false) String occupation) {
accountService.updateUserInfo(country, occupation);
return Response.success();
}
}

View File

@@ -202,4 +202,10 @@ public class ConvenientInquiryController {
public Response<PageBaseResponse<PaymentInfoVO>> queryTransactionRecords(@Valid @RequestBody QueryPaymentInfoDTO queryPaymentInfoDTO){
return Response.success(convenientInquiryService.queryTransactionRecords(queryPaymentInfoDTO));
}
@ApiOperation("获取所有国家、城市")
@GetMapping("/getCities")
public Response<Map<String, List<String>>> getCities(){
return Response.success(convenientInquiryService.getCities());
}
}

View File

@@ -6,6 +6,7 @@ import com.ai.da.model.vo.PaymentInfoVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import java.util.List;
import java.util.Map;
public interface PaymentInfoMapper extends BaseMapper<PaymentInfo> {
@@ -15,10 +16,14 @@ public interface PaymentInfoMapper extends BaseMapper<PaymentInfo> {
List<PaymentInfoVO> queryPaymentInfo(String paymentType,String payerTotal, String type, String status,
String country, String city, String startTime, String endTime,
int limit, int offset
int limit, int offset, String order
);
Long queryPaymentInfoCount(String paymentType,String payerTotal, String type, String status,
String country, String city, String startTime, String endTime
);
List<Map<String, String>> getCities();
List<Map<String, String>> getCountries();
}

View File

@@ -23,5 +23,6 @@ public class QueryPaymentInfoDTO extends QueryPageByTimeDTO {
private String country;
@ApiModelProperty("付款人所在城市")
private String city;
@ApiModelProperty("按id排序 DESC || ASC")
private String order = "DESC";
}

View File

@@ -222,4 +222,6 @@ public interface AccountService extends IService<Account> {
void updateAccountValidity(Long accountId, Long currentPeriodEnd);
void updateUserRoleAndCredits(Long accountId, String type);
void updateUserInfo(String country, String occupation);
}

View File

@@ -48,4 +48,6 @@ public interface ConvenientInquiryService extends IService<Questionnaire> {
List<Map<String, Object>> getAllUserIdList();
PageBaseResponse<PaymentInfoVO> queryTransactionRecords(QueryPaymentInfoDTO queryPaymentInfoDTO);
Map<String, List<String>> getCities();
}

View File

@@ -620,11 +620,15 @@ public class ConvenientInquiryServiceImpl extends ServiceImpl<QuestionnaireMappe
public PageBaseResponse<PaymentInfoVO> queryTransactionRecords(QueryPaymentInfoDTO queryPaymentInfoDTO) {
Integer size = queryPaymentInfoDTO.getSize();
int offset = (queryPaymentInfoDTO.getPage() - 1) * size;
String order = "DESC";
if (!StringUtil.isNullOrEmpty(queryPaymentInfoDTO.getOrder()) && queryPaymentInfoDTO.getOrder().equals("ASC")) {
order = "ASC";
}
List<PaymentInfoVO> paymentInfoVOS = paymentInfoMapper.queryPaymentInfo(queryPaymentInfoDTO.getPlatform(), queryPaymentInfoDTO.getPayerTotal(),
queryPaymentInfoDTO.getType(), queryPaymentInfoDTO.getStatus(),
queryPaymentInfoDTO.getCountry(), queryPaymentInfoDTO.getCity(),
queryPaymentInfoDTO.getStartTime(), queryPaymentInfoDTO.getEndTime(),
size, offset);
size, offset, order);
// 查询数据总量
Long total = paymentInfoMapper.queryPaymentInfoCount(queryPaymentInfoDTO.getPlatform(), queryPaymentInfoDTO.getPayerTotal(),
queryPaymentInfoDTO.getType(), queryPaymentInfoDTO.getStatus(),
@@ -643,5 +647,20 @@ public class ConvenientInquiryServiceImpl extends ServiceImpl<QuestionnaireMappe
return response;
}
public Map<String, List<String>> getCities(){
List<Map<String, String>> cities = paymentInfoMapper.getCities();
List<Map<String, String>> countries = paymentInfoMapper.getCountries();
List<String> cityCollect = cities.stream()
.map(cityEntry -> cityEntry.get("city"))
.collect(Collectors.toList());
List<String> countryCollect = countries.stream()
.map(cityEntry -> cityEntry.get("country"))
.collect(Collectors.toList());
return new HashMap<String, List<String>>() {{
put("city", cityCollect);
put("country", countryCollect);
}};
}
}