feat:个人充值、个人消费明细、个人退款导出
This commit is contained in:
1 parent
6d91b9d6fd
commit
93fe9c7f91
12 files changed
+91
-17
No files matched your search
+6
@@ -76,6 +76,12 @@ public class HardAfterSaleController {
|
||||
}
|
||||
/* ************************************* end app end ************************************* */
|
||||
|
||||
@GetMapping(value = "/refund")
|
||||
@Operation(summary = "查询售后进度")
|
||||
public R<Boolean> refund(@RequestParam Long id) {
|
||||
return R.ok(hardAfterSaleService.refund(id));
|
||||
}
|
||||
|
||||
@GetMapping(value = "/history")
|
||||
@Operation(summary = "查询售后进度")
|
||||
public R<List<HardAfterSaleLogEntity>> history(@RequestParam Long id) {
|
||||
|
||||
Binary file not shown.
+2
@@ -15,6 +15,8 @@ public class WalletRechargeImportDto extends WalletRechargeImportEntity {
|
||||
|
||||
private List<Long> userIds;
|
||||
|
||||
private List<Long> userUniqueIds;
|
||||
|
||||
private Long userDeptId;
|
||||
|
||||
private List<Long> userDeptIds;
|
||||
|
||||
+5
@@ -12,6 +12,11 @@ import java.time.LocalDateTime;
|
||||
@Data
|
||||
public class WalletTransactionVo extends WalletTransactionEntity implements BaseUserInterface, BaseDeptInterface, BaseWalletTypeInterface, BaseWalletInterface {
|
||||
|
||||
/**
|
||||
* 字符串金额用于导出
|
||||
*/
|
||||
private String priceStr;
|
||||
|
||||
/**
|
||||
* 用户相关
|
||||
*/
|
||||
|
||||
@@ -149,4 +149,24 @@
|
||||
<id>boot</id>
|
||||
</profile>
|
||||
</profiles>
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
<excludes>
|
||||
<exclude>**/*.xlsx</exclude>
|
||||
<exclude>**/*.xls</exclude>
|
||||
</excludes>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>false</filtering>
|
||||
<includes>
|
||||
<include>**/*.xlsx</include>
|
||||
<include>**/*.xls</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
</project>
|
||||
+7
-17
@@ -1,11 +1,8 @@
|
||||
package com.bsd.pjcloud.wallet.controller;
|
||||
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.bsd.pjcloud.common.core.util.BeanUtils;
|
||||
import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScope;
|
||||
import com.bsd.pjcloud.common.data.datascope.DataScopeFuncEnum;
|
||||
@@ -17,14 +14,11 @@ import com.bsd.pjcloud.wallet.api.constant.WalletBizEnum;
|
||||
import com.bsd.pjcloud.wallet.api.dto.WalletBalanceTransactionDto;
|
||||
import com.bsd.pjcloud.wallet.api.dto.WalletTransactionDto;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletTransactionEntity;
|
||||
import com.bsd.pjcloud.wallet.api.vo.recharge.excel.WalletTransactionCzExcelVo;
|
||||
import com.bsd.pjcloud.wallet.api.vo.recharge.excel.WalletTransactionTkExcelVo;
|
||||
import com.bsd.pjcloud.wallet.api.vo.recharge.excel.WalletTransactionXfExcelVo;
|
||||
import com.bsd.pjcloud.wallet.api.vo.transaction.WalletTransactionVo;
|
||||
import com.bsd.pjcloud.wallet.service.WalletTransactionService;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import com.bsd.pjcloud.common.excel.annotation.ResponseExcel;
|
||||
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
||||
import org.springdoc.core.annotations.ParameterObject;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
@@ -33,7 +27,6 @@ import io.swagger.v3.oas.annotations.Operation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -153,34 +146,31 @@ public class WalletTransactionController {
|
||||
return R.ok(walletTransactionService.removeBatchByIds(CollUtil.toList(ids)));
|
||||
}
|
||||
|
||||
@ResponseExcel
|
||||
@Operation(summary = "充值导出", description = "充值导出")
|
||||
@GetMapping("/export-cz")
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletTransaction_export')")
|
||||
public List<WalletTransactionCzExcelVo> exportCz(WalletTransactionDto dto) {
|
||||
public void exportCz(HttpServletResponse response, WalletTransactionDto dto) {
|
||||
dto.setBizTypes(List.of(WalletBizEnum.RECHARGE.getCode()));
|
||||
List<WalletTransactionVo> list = walletTransactionService.pageList(dto);
|
||||
return BeanUtils.toBean(list, WalletTransactionCzExcelVo.class);
|
||||
walletTransactionService.exportByTemplate(response, dto, "file/个人充值明细.xlsx", list);
|
||||
}
|
||||
|
||||
@ResponseExcel
|
||||
@Operation(summary = "消费导出", description = "消费导出")
|
||||
@GetMapping("/export-xf")
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletTransaction_export')")
|
||||
public List<WalletTransactionXfExcelVo> exportXf(WalletTransactionDto dto) {
|
||||
public void exportXf(HttpServletResponse response, WalletTransactionDto dto) {
|
||||
dto.setBizTypes(List.of(WalletBizEnum.PAYMENT.getCode()));
|
||||
List<WalletTransactionVo> list = walletTransactionService.pageList(dto);
|
||||
return BeanUtils.toBean(list, WalletTransactionXfExcelVo.class);
|
||||
walletTransactionService.exportByTemplate(response, dto, "file/个人消费明细.xlsx", list);
|
||||
}
|
||||
|
||||
@ResponseExcel
|
||||
@Operation(summary = "退款导出", description = "退款导出")
|
||||
@GetMapping("/export-tk")
|
||||
@PreAuthorize("@pms.hasPermission('wallet_walletTransaction_export')")
|
||||
public List<WalletTransactionTkExcelVo> exportTk(WalletTransactionDto dto) {
|
||||
public void exportTk(HttpServletResponse response, WalletTransactionDto dto) {
|
||||
dto.setBizTypes(List.of(WalletBizEnum.REFUND.getCode()));
|
||||
dto.setIsFindOrder(true);
|
||||
List<WalletTransactionVo> list = walletTransactionService.pageList(dto);
|
||||
return BeanUtils.toBean(list, WalletTransactionTkExcelVo.class);
|
||||
walletTransactionService.exportByTemplate(response, dto, "file/个人退款明细.xlsx", list);
|
||||
}
|
||||
}
|
||||
+4
@@ -7,7 +7,9 @@ import com.bsd.pjcloud.wallet.api.constant.WalletBizEnum;
|
||||
import com.bsd.pjcloud.wallet.api.dto.WalletTransactionDto;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletTransactionEntity;
|
||||
import com.bsd.pjcloud.wallet.api.vo.transaction.WalletTransactionVo;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
public interface WalletTransactionService extends IService<WalletTransactionEntity> {
|
||||
@@ -46,4 +48,6 @@ public interface WalletTransactionService extends IService<WalletTransactionEnti
|
||||
* @return
|
||||
*/
|
||||
Boolean updateWalletBalance(WalletTransactionDto dto);
|
||||
|
||||
void exportByTemplate(HttpServletResponse response, WalletTransactionDto dto, String fileName, List<WalletTransactionVo> list);
|
||||
}
|
||||
+41
@@ -1,7 +1,14 @@
|
||||
package com.bsd.pjcloud.wallet.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import cn.hutool.core.io.resource.ResourceUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.alibaba.excel.ExcelWriter;
|
||||
import com.alibaba.excel.write.metadata.WriteSheet;
|
||||
import com.alibaba.excel.write.metadata.fill.FillConfig;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
@@ -28,6 +35,7 @@ import com.bsd.pjcloud.wallet.mapper.WalletTransactionMapper;
|
||||
import com.bsd.pjcloud.wallet.mapper.WalletTypeMapper;
|
||||
import com.bsd.pjcloud.wallet.service.WalletManageService;
|
||||
import com.bsd.pjcloud.wallet.service.WalletTransactionService;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
@@ -35,7 +43,11 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -239,4 +251,33 @@ public class WalletTransactionServiceImpl extends ServiceImpl<WalletTransactionM
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exportByTemplate(HttpServletResponse response, WalletTransactionDto dto, String fileName, List<WalletTransactionVo> list) {
|
||||
try (ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream()).withTemplate(ResourceUtil.getStream(fileName)).build()) {
|
||||
WriteSheet writeSheet = EasyExcel.writerSheet().build();
|
||||
FillConfig fillConfig = FillConfig.builder().forceNewRow(Boolean.TRUE).build();
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
if (ObjectUtil.isNotEmpty(dto.getCreateTimeList())) {
|
||||
map.put("timeSpan", " 到 ");
|
||||
map.put("startTime", LocalDateTimeUtil.format(dto.getCreateTimeList()[0], DatePattern.NORM_DATETIME_PATTERN));
|
||||
map.put("endTime", LocalDateTimeUtil.format(dto.getCreateTimeList()[0], DatePattern.NORM_DATETIME_PATTERN));
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(list)) {
|
||||
BigDecimal priceTotal = BigDecimal.ZERO;
|
||||
for (WalletTransactionVo v : list) {
|
||||
if (ObjectUtil.isNotEmpty(v.getPrice())) {
|
||||
priceTotal = priceTotal.add(BigDecimal.valueOf(v.getPrice()));
|
||||
v.setPriceStr(BigDecimal.valueOf(v.getPrice()).divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).toString());
|
||||
}
|
||||
}
|
||||
map.put("computeTotalPayPrice", priceTotal.divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).toString());
|
||||
}
|
||||
excelWriter.fill(map, writeSheet);
|
||||
excelWriter.fill(list, fillConfig, writeSheet);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
log.error("|{}|导入错误,dto:|{}|,fileName:|{}|,error:|{}|", TAG, JSON.toJSONString(dto), fileName, e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
+6
@@ -40,6 +40,12 @@
|
||||
#{v}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="dto.userUniqueIds != null and dto.userUniqueIds.size() != 0">
|
||||
and a.user_id in
|
||||
<foreach collection="dto.userUniqueIds" item="v" open="(" close=")" separator=",">
|
||||
#{v}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="dto.userDeptIds != null and dto.userDeptIds.size() != 0">
|
||||
and a.user_dept_id in
|
||||
<foreach collection="dto.userDeptIds" item="v" open="(" close=")" separator=",">
|
||||
|
||||
Reference in new issue
Block a user