|
|
@@ -16,6 +16,8 @@
|
|
|
*/
|
|
|
package org.springblade.ldt.bills.controller;
|
|
|
|
|
|
+import cn.hutool.core.date.DateUtil;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
|
@@ -23,9 +25,12 @@ import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import io.swagger.annotations.ApiParam;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.lang3.ObjectUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springblade.common.aop.core.TenantAop;
|
|
|
import org.springblade.common.constant.Salesman;
|
|
|
+import org.springblade.common.utils.ExcelWriteUtil;
|
|
|
import org.springblade.core.boot.ctrl.BladeController;
|
|
|
import org.springblade.core.mp.support.Condition;
|
|
|
import org.springblade.core.mp.support.Query;
|
|
|
@@ -39,6 +44,7 @@ import org.springblade.ldt.shop.service.IShopService;
|
|
|
import org.springblade.ldt.user.service.ILoginUserService;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
import javax.validation.Valid;
|
|
|
import java.util.Date;
|
|
|
import java.util.Map;
|
|
|
@@ -53,6 +59,7 @@ import java.util.Map;
|
|
|
@AllArgsConstructor
|
|
|
@RequestMapping("ldt_bills/withdrawrec")
|
|
|
@Api(value = "", tags = "接口")
|
|
|
+@Slf4j
|
|
|
public class WithdrawRecController extends BladeController {
|
|
|
|
|
|
private final IWithdrawRecService withdrawRecService;
|
|
|
@@ -65,9 +72,9 @@ public class WithdrawRecController extends BladeController {
|
|
|
@GetMapping("/detail")
|
|
|
@ApiOperationSupport(order = 1)
|
|
|
@ApiOperation(value = "详情", notes = "传入withdrawRec")
|
|
|
- @TenantAop(salesman=Salesman.roleName)
|
|
|
+ @TenantAop(salesman = Salesman.roleName)
|
|
|
public R<WithdrawRecVO> detail(WithdrawRec withdrawRec) {
|
|
|
- return R.data(WithdrawRecWrapper.build(userService,shopService).entityVO(withdrawRecService.getOne(Condition.getQueryWrapper(withdrawRec))));
|
|
|
+ return R.data(WithdrawRecWrapper.build(userService, shopService).entityVO(withdrawRecService.getOne(Condition.getQueryWrapper(withdrawRec))));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -76,21 +83,51 @@ public class WithdrawRecController extends BladeController {
|
|
|
@GetMapping("/list")
|
|
|
@ApiOperationSupport(order = 2)
|
|
|
@ApiOperation(value = "分页", notes = "传入withdrawRec")
|
|
|
- @TenantAop(salesman=Salesman.roleName)
|
|
|
- public R<IPage<WithdrawRecVO>> list(WithdrawRec withdrawRec, Query query, Date createTimeStart, Date createTimeEnd,String key) {
|
|
|
+ @TenantAop(salesman = Salesman.roleName)
|
|
|
+ public R<IPage<WithdrawRecVO>> list(WithdrawRec withdrawRec, Query query, Date createTimeStart, Date createTimeEnd, String key) {
|
|
|
QueryWrapper<WithdrawRec> queryWrapper = Condition.getQueryWrapper(withdrawRec);
|
|
|
//添加创建时间条件
|
|
|
- if(createTimeStart!=null && createTimeEnd!=null){
|
|
|
- queryWrapper.lambda().between(WithdrawRec::getCreateTime,createTimeStart,createTimeEnd);
|
|
|
+ if (createTimeStart != null && createTimeEnd != null) {
|
|
|
+ queryWrapper.lambda().between(WithdrawRec::getCreateTime, createTimeStart, createTimeEnd);
|
|
|
}
|
|
|
//添加关键字key查询条件
|
|
|
- if(StringUtils.isNotBlank(key)){
|
|
|
- queryWrapper.lambda().and(wq->{
|
|
|
- wq.eq(WithdrawRec::getReceiverAccountName,key);
|
|
|
+ if (StringUtils.isNotBlank(key)) {
|
|
|
+ queryWrapper.lambda().and(wq -> {
|
|
|
+ wq.eq(WithdrawRec::getReceiverAccountName, key)
|
|
|
+ .or().eq(WithdrawRec::getReceiverAccountNo, key)
|
|
|
+ .or().eq(WithdrawRec::getOrderId, key);
|
|
|
});
|
|
|
}
|
|
|
queryWrapper.lambda().orderByDesc(WithdrawRec::getCreateTime);
|
|
|
- return R.data(WithdrawRecWrapper.build(userService,shopService).pageVO(withdrawRecService.page(Condition.getPage(query), queryWrapper)));
|
|
|
+ return R.data(WithdrawRecWrapper.build(userService, shopService).pageVO(withdrawRecService.page(Condition.getPage(query), queryWrapper)));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 生成列表
|
|
|
+ */
|
|
|
+ @PostMapping("/generateList")
|
|
|
+ @ApiOperationSupport(order = 2)
|
|
|
+ @ApiOperation(value = "生成列表", notes = "传入withdrawRec")
|
|
|
+ @TenantAop(salesman = Salesman.roleName)
|
|
|
+ public void generateList(WithdrawRec withdrawRec,Query query,Date createTimeStart,Date createTimeEnd,
|
|
|
+ String key,
|
|
|
+ @RequestParam String keyValue,
|
|
|
+ HttpServletResponse response) {
|
|
|
+ try {
|
|
|
+ R<IPage<WithdrawRecVO>> page = this.list(withdrawRec, query, createTimeStart, createTimeEnd, key);
|
|
|
+ //判断是否为空
|
|
|
+ if (ObjectUtils.isNotEmpty(page) && ObjectUtils.isNotEmpty(page.getData()) && ObjectUtils.isNotEmpty(page.getData().getRecords())) {
|
|
|
+ //键值对
|
|
|
+ Map<String, String> titleMap = JSONObject.parseObject(keyValue, Map.class);
|
|
|
+ if (ObjectUtils.isNotEmpty(titleMap)) {
|
|
|
+ //写入到Excel
|
|
|
+ ExcelWriteUtil.writeToResponse(response, DateUtil.now(), "提现记录表", titleMap, page.getData().getRecords(), WithdrawRecVO.class);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error(e.getMessage());
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -150,7 +187,7 @@ public class WithdrawRecController extends BladeController {
|
|
|
@GetMapping("/amount-statistical")
|
|
|
@ApiOperationSupport(order = 8)
|
|
|
@ApiOperation(value = "提现金额统计", notes = "提现金额统计")
|
|
|
- public R<Map<String,Object>> amountStatistical() {
|
|
|
+ public R<Map<String, Object>> amountStatistical() {
|
|
|
return R.data(withdrawRecService.amountStatistical());
|
|
|
}
|
|
|
|