修改查询交易记录接口

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() { public Response<Boolean> unbindGoogle() {
return Response.success(accountService.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){ public Response<PageBaseResponse<PaymentInfoVO>> queryTransactionRecords(@Valid @RequestBody QueryPaymentInfoDTO queryPaymentInfoDTO){
return Response.success(convenientInquiryService.queryTransactionRecords(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 com.baomidou.mybatisplus.core.mapper.BaseMapper;
import java.util.List; import java.util.List;
import java.util.Map;
public interface PaymentInfoMapper extends BaseMapper<PaymentInfo> { 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, List<PaymentInfoVO> queryPaymentInfo(String paymentType,String payerTotal, String type, String status,
String country, String city, String startTime, String endTime, 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, Long queryPaymentInfoCount(String paymentType,String payerTotal, String type, String status,
String country, String city, String startTime, String endTime 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; private String country;
@ApiModelProperty("付款人所在城市") @ApiModelProperty("付款人所在城市")
private String city; 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 updateAccountValidity(Long accountId, Long currentPeriodEnd);
void updateUserRoleAndCredits(Long accountId, String type); 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(); List<Map<String, Object>> getAllUserIdList();
PageBaseResponse<PaymentInfoVO> queryTransactionRecords(QueryPaymentInfoDTO queryPaymentInfoDTO); 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) { public PageBaseResponse<PaymentInfoVO> queryTransactionRecords(QueryPaymentInfoDTO queryPaymentInfoDTO) {
Integer size = queryPaymentInfoDTO.getSize(); Integer size = queryPaymentInfoDTO.getSize();
int offset = (queryPaymentInfoDTO.getPage() - 1) * size; 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(), List<PaymentInfoVO> paymentInfoVOS = paymentInfoMapper.queryPaymentInfo(queryPaymentInfoDTO.getPlatform(), queryPaymentInfoDTO.getPayerTotal(),
queryPaymentInfoDTO.getType(), queryPaymentInfoDTO.getStatus(), queryPaymentInfoDTO.getType(), queryPaymentInfoDTO.getStatus(),
queryPaymentInfoDTO.getCountry(), queryPaymentInfoDTO.getCity(), queryPaymentInfoDTO.getCountry(), queryPaymentInfoDTO.getCity(),
queryPaymentInfoDTO.getStartTime(), queryPaymentInfoDTO.getEndTime(), queryPaymentInfoDTO.getStartTime(), queryPaymentInfoDTO.getEndTime(),
size, offset); size, offset, order);
// 查询数据总量 // 查询数据总量
Long total = paymentInfoMapper.queryPaymentInfoCount(queryPaymentInfoDTO.getPlatform(), queryPaymentInfoDTO.getPayerTotal(), Long total = paymentInfoMapper.queryPaymentInfoCount(queryPaymentInfoDTO.getPlatform(), queryPaymentInfoDTO.getPayerTotal(),
queryPaymentInfoDTO.getType(), queryPaymentInfoDTO.getStatus(), queryPaymentInfoDTO.getType(), queryPaymentInfoDTO.getStatus(),
@@ -643,5 +647,20 @@ public class ConvenientInquiryServiceImpl extends ServiceImpl<QuestionnaireMappe
return response; 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);
}};
}
} }

View File

@@ -91,7 +91,7 @@
AND create_time BETWEEN #{startTime} AND #{endTime} AND create_time BETWEEN #{startTime} AND #{endTime}
</if> </if>
ORDER BY ORDER BY
id DESC id ${order}
LIMIT ${limit} OFFSET ${offset} LIMIT ${limit} OFFSET ${offset}
</select> </select>
@@ -130,5 +130,18 @@
</if> </if>
</select> </select>
<select id="getCities" resultType="java.util.Map">
SELECT DISTINCT city
FROM t_payment_info
WHERE city IS NOT NULL
AND TRIM(city) != ''
</select>
<select id="getCountries" resultType="java.util.Map">
SELECT DISTINCT country
FROM t_payment_info
WHERE country IS NOT NULL
AND TRIM(country) != ''
</select>
</mapper> </mapper>