feat():添加导出接口

master
zhang chengzhi 2024-08-09 20:22:11 +08:00
parent b2c38d4c11
commit 13b2163d57
2 changed files with 62 additions and 30 deletions

View File

@ -7,9 +7,15 @@ import com.muyu.cloud.pay.domain.req.OrderCustomerUpdReq;
import com.muyu.cloud.pay.domain.resp.CustomerResp;
import com.muyu.cloud.pay.service.OrderPayCustomerService;
import com.muyu.common.core.domain.Result;
import com.muyu.common.core.utils.poi.ExcelUtil;
import com.muyu.common.log.annotation.Log;
import com.muyu.common.log.enums.BusinessType;
import com.muyu.common.security.annotation.RequiresPermissions;
import com.muyu.common.system.domain.SysRole;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletResponse;
import lombok.RequiredArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springframework.validation.annotation.Validated;
@ -47,7 +53,9 @@ public class OrderPayCustomerController {
public Result<List<CustomerResp>> selectList(@Validated @RequestBody CustomerListReq customerListReq) {
return Result.success(orderPayCustomerService.selectList(customerListReq));
};
}
;
/**
*
@ -68,93 +76,116 @@ public class OrderPayCustomerController {
/**
*
*
* @param orderCustomerAddReq
* @return
*/
@PostMapping
@Operation(summary = "客户信息添加",description = "添加支付平台客户信息,添加成功后才可以使用支付类的产品")
public Result<String> save(@Validated @RequestBody OrderCustomerAddReq orderCustomerAddReq){
@Operation(summary = "客户信息添加", description = "添加支付平台客户信息,添加成功后才可以使用支付类的产品")
public Result<String> save(@Validated @RequestBody OrderCustomerAddReq orderCustomerAddReq) {
orderPayCustomerService.save(OrderPayCustomer.addBuild(orderCustomerAddReq));
orderPayCustomerService.save(OrderPayCustomer.addBuild(orderCustomerAddReq));
return Result.success();
}
/**
*
* @param orderCustomerId
*
* @param orderCustomerId
* @param orderCustomerUpdReq
* @return
* @return
*/
@PutMapping("/{orderCustomerId}")
@Operation(summary = "客户信息修改",description = "通过ID修改客户信息")
public Result<String> update(@Schema(title = "客户ID",type = "Long",defaultValue = "1",description = "修改客户信息需要依据的唯一条件")
@PathVariable("orderCustomerId") Long orderCustomerId,
@RequestBody @Validated OrderCustomerUpdReq orderCustomerUpdReq){
@PutMapping("/{orderCustomerId}")
@Operation(summary = "客户信息修改", description = "通过ID修改客户信息")
public Result<String> update(@Schema(title = "客户ID", type = "Long", defaultValue = "1", description = "修改客户信息需要依据的唯一条件")
@PathVariable("orderCustomerId") Long orderCustomerId,
@RequestBody @Validated OrderCustomerUpdReq orderCustomerUpdReq) {
orderPayCustomerService.updateById( OrderPayCustomer.updBuild(orderCustomerUpdReq,() -> orderCustomerId));
return Result.success(null,"操作成功");
}
orderPayCustomerService.updateById(OrderPayCustomer.updBuild(orderCustomerUpdReq, () -> orderCustomerId));
return Result.success(null, "操作成功");
}
/**
*
*
* @param orderCustomerId
* @return
*/
@DeleteMapping("/{orderCustomerId}")
@Operation(summary = "客户信息删除",description = "通过ID删除客户信息,七天内有支付支付记录的客户,不可进行删除")
public Result<String> delete(@PathVariable("orderCustomerId") Long orderCustomerId){
@Operation(summary = "客户信息删除", description = "通过ID删除客户信息,七天内有支付支付记录的客户,不可进行删除")
public Result<String> delete(@PathVariable("orderCustomerId") Long orderCustomerId) {
orderPayCustomerService.removeById(orderCustomerId);
return Result.success(null,"操作成功");
return Result.success(null, "操作成功");
}
/**
* ID
*
* @param orderCustomerId ID
* @return
*/
@GetMapping("/{orderCustomerId}")
@Operation(summary = "通过ID获取客户信息",description = "通过ID获取客户信息")
public Result<OrderPayCustomer> findById(@PathVariable("orderCustomerId") Long orderCustomerId){
log.info("");
return Result.success(orderPayCustomerService.getById(orderCustomerId),"操作成功");
@Operation(summary = "通过ID获取客户信息", description = "通过ID获取客户信息")
public Result<OrderPayCustomer> findById(@PathVariable("orderCustomerId") Long orderCustomerId) {
log.info("");
return Result.success(orderPayCustomerService.getById(orderCustomerId), "操作成功");
}
/**
* ID
*
* @param orderCustomerId ID
* @return
*/
@GetMapping("/disable/{orderCustomerId}")
@Operation(summary = "通过ID禁用客户",description = "通过ID禁用客户,禁用之后禁止调用支付相关接口")
public Result<OrderPayCustomer> disable(@PathVariable("orderCustomerId") Long orderCustomerId){
this.orderPayCustomerService.disable(orderCustomerId);
return Result.success(null,"操作成功");
@Operation(summary = "通过ID禁用客户", description = "通过ID禁用客户,禁用之后禁止调用支付相关接口")
public Result<OrderPayCustomer> disable(@PathVariable("orderCustomerId") Long orderCustomerId) {
this.orderPayCustomerService.disable(orderCustomerId);
return Result.success(null, "操作成功");
}
/**
* ID
*
* @param orderCustomerId ID
* @return
*/
@GetMapping("/enable/{orderCustomerId}")
@Operation(summary = "通过ID启动客户",description = "通过ID启用被禁止的客户,启用后可以调用支付相关的接口")
public Result<OrderPayCustomer> enable(@PathVariable("orderCustomerId") Long orderCustomerId){
this.orderPayCustomerService.enable(orderCustomerId);
return Result.success(null,"操作成功");
@Operation(summary = "通过ID启动客户", description = "通过ID启用被禁止的客户,启用后可以调用支付相关的接口")
public Result<OrderPayCustomer> enable(@PathVariable("orderCustomerId") Long orderCustomerId) {
this.orderPayCustomerService.enable(orderCustomerId);
return Result.success(null, "操作成功");
}
@Log(title = "角色管理", businessType = BusinessType.EXPORT)
@RequiresPermissions("pay:user:export")
@PostMapping("/export")
public void export (HttpServletResponse response, @Validated @RequestBody CustomerListReq customerListReq) {
List<CustomerResp> customerRespList = orderPayCustomerService.selectList(customerListReq);
ExcelUtil<CustomerResp> util = new ExcelUtil<CustomerResp>(CustomerResp.class);
util.exportExcel(response, customerRespList, "角色数据");
}
}

View File

@ -27,6 +27,7 @@ public class OrderPayInfoServiceImpl extends ServiceImpl<OrderPayInfoMapper, Ord
LambdaQueryWrapper<OrderPayInfo> orderPayInfoQueryWrapper = new LambdaQueryWrapper<>();
orderPayInfoQueryWrapper.eq(OrderPayInfo::getAppCode,appCode);
orderPayInfoQueryWrapper.orderBy(true, false, OrderPayInfo::getCreateTime);
orderPayInfoQueryWrapper.last("limit "+limit);