Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
a7e58f12e5
1 file changed
+73
+73
@@ -12,6 +12,7 @@ import com.bsd.pjcloud.common.core.util.R;
|
||||
import com.bsd.pjcloud.common.log.annotation.SysLog;
|
||||
import com.bsd.pjcloud.hard.api.constant.HardTypeEnum;
|
||||
import com.bsd.pjcloud.hard.api.constant.order.HardOrderStatusEnum;
|
||||
import com.bsd.pjcloud.hard.api.constant.order.HardPayTypeEnum;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.HardDeptTotalDto;
|
||||
import com.bsd.pjcloud.hard.api.dto.order.HardOrderDto;
|
||||
import com.bsd.pjcloud.hard.api.vo.order.HardDeptTotalVo;
|
||||
@@ -220,6 +221,78 @@ public class HardOrderTotalController {
|
||||
}
|
||||
}
|
||||
|
||||
@Operation(summary = "支付方式交易记录", description = "支付方式交易记录")
|
||||
@GetMapping("/export-payType")
|
||||
@SysLog("支付方式交易记录")
|
||||
@PreAuthorize("@pms.hasPermission('hard_hardTotal_export_payType')")
|
||||
public void exportPayType(HttpServletResponse response, HardOrderDto dto) throws IOException {
|
||||
List<HardOrderPayTypeVo> list = HardOrderTotalService.listPayType(dto);
|
||||
try (ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream()).withTemplate(ResourceUtil.getStream("file/支付方式交易汇总.xlsx")).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.getPayTimeList())) {
|
||||
map.put("timeSpan", " 到 ");
|
||||
map.put("startTime", LocalDateTimeUtil.format(dto.getPayTimeList()[0], DatePattern.NORM_DATETIME_PATTERN));
|
||||
map.put("endTime", LocalDateTimeUtil.format(dto.getPayTimeList()[1], DatePattern.NORM_DATETIME_PATTERN));
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(list)) {
|
||||
// 总消费
|
||||
BigDecimal totalPayPrice = BigDecimal.ZERO;
|
||||
BigDecimal totalPayCount = BigDecimal.ZERO;
|
||||
// 总退款
|
||||
BigDecimal totalRefundPrice = BigDecimal.ZERO;
|
||||
BigDecimal totalRefundCount = BigDecimal.ZERO;
|
||||
// 总盈利
|
||||
BigDecimal totalProfitPrice = BigDecimal.ZERO;
|
||||
BigDecimal totalProfitCount = BigDecimal.ZERO;
|
||||
Long lineNumber = 1L;
|
||||
for (HardOrderPayTypeVo v : list) {
|
||||
v.setLineNumber(lineNumber);
|
||||
lineNumber++;
|
||||
if (ObjectUtil.isNotEmpty(v.getPayType())) {
|
||||
v.setPayType(HardPayTypeEnum.valueOfByType(v.getPayType()).getDescription());
|
||||
// 总消费
|
||||
if (ObjectUtil.isNotEmpty(v.getTotalPayPrice())) {
|
||||
totalPayPrice = totalPayPrice.add(v.getTotalPayPrice());
|
||||
v.setTotalPayPrice(v.getTotalPayPrice().divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP));
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(v.getTotalPayCount())) {
|
||||
totalPayCount = totalPayCount.add(v.getTotalPayCount());
|
||||
}
|
||||
// 总退款
|
||||
if (ObjectUtil.isNotEmpty(v.getTotalRefundPrice())) {
|
||||
totalRefundPrice = totalRefundPrice.add(v.getTotalRefundPrice());
|
||||
v.setTotalRefundPrice(v.getTotalRefundPrice().divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP));
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(v.getTotalRefundCount())) {
|
||||
totalRefundCount = totalRefundCount.add(v.getTotalRefundCount());
|
||||
}
|
||||
// 总盈利
|
||||
if (ObjectUtil.isNotEmpty(v.getTotalProfitPrice())) {
|
||||
totalProfitPrice = totalProfitPrice.add(v.getTotalProfitPrice());
|
||||
v.setTotalProfitPrice(v.getTotalProfitPrice().divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP));
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(v.getTotalProfitCount())) {
|
||||
totalProfitCount = totalProfitCount.add(v.getTotalProfitCount());
|
||||
}
|
||||
}
|
||||
}
|
||||
// 总消费
|
||||
map.put("computeTotalPayPrice", totalPayPrice.divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).toString());
|
||||
map.put("computeTotalPayCount", totalPayCount.toString());
|
||||
// 总退款
|
||||
map.put("computeTotalRefundPrice", totalRefundPrice.divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).toString());
|
||||
map.put("computeTotalRefundCount", totalRefundCount.toString());
|
||||
// 总盈利
|
||||
map.put("computeTotalProfitPrice", totalProfitPrice.divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).toString());
|
||||
map.put("computeTotalProfitCount", totalProfitCount.toString());
|
||||
}
|
||||
excelWriter.fill(map, writeSheet);
|
||||
excelWriter.fill(list, fillConfig, writeSheet);
|
||||
}
|
||||
}
|
||||
|
||||
@Operation(summary = "部门交易记录导出", description = "部门交易记录导出")
|
||||
@PostMapping("/export-dept")
|
||||
@SysLog("部门交易记录导出")
|
||||
|
||||
Reference in new issue
Block a user