1
This commit is contained in:
1 parent
2a6b9517d5
commit
45e41f955f
7 files changed
+105
-4
No files matched your search
+29
@@ -0,0 +1,29 @@
|
||||
package com.bsd.pjcloud.wallet.api.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class WalletExportCzTotalPerson {
|
||||
|
||||
private Long lineNumber;
|
||||
|
||||
private String mchName;
|
||||
|
||||
private String deptName;
|
||||
|
||||
private String name;
|
||||
|
||||
private String phone;
|
||||
|
||||
private Long price;
|
||||
|
||||
private String priceStr;
|
||||
|
||||
private LocalDateTime createTime;
|
||||
|
||||
private String createTimeStr;
|
||||
|
||||
}
|
||||
+14
@@ -130,6 +130,20 @@ public class WalletTransactionController {
|
||||
walletTransactionService.exportCzTotal(response, dto, null);
|
||||
}
|
||||
|
||||
@Operation(summary = "后台充值统计按照个人(导出)", description = "后台充值统计按照个人(导出)")
|
||||
@PostMapping("/export-cz-total-person")
|
||||
public void exportCzTotalPerson(HttpServletResponse response, @RequestBody WalletTransactionDto dto) {
|
||||
dto.setBizTypes(WalletBizEnum.getTopUpCodes());
|
||||
dto.setType(WalletTransactionDto.TYPE_INCOME);
|
||||
if (ObjectUtil.isNotEmpty(dto.getPrice())) {
|
||||
dto.setPrice(dto.getPrice() * 100);
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(dto.getPriceList())) {
|
||||
dto.setPriceList(dto.getPriceList().stream().map(item -> item * 100).toList());
|
||||
}
|
||||
walletTransactionService.exportCzTotalPerson(response, dto, null);
|
||||
}
|
||||
|
||||
@Operation(summary = "后台充值统计", description = "后台充值统计")
|
||||
@PostMapping("/page-cz-dept-total")
|
||||
public R<List<WalletCzTotalVo>> listDeptCzTotal(@RequestBody WalletTransactionDto dto) {
|
||||
|
||||
+3
@@ -12,6 +12,7 @@ import com.bsd.pjcloud.wallet.api.dto.WalletTransactionSumAndCountDto;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletManageEntity;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletTransactionEntity;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletTypeEntity;
|
||||
import com.bsd.pjcloud.wallet.api.vo.WalletExportCzTotalPerson;
|
||||
import com.bsd.pjcloud.wallet.api.vo.WalletTransactionSumAndCountVo;
|
||||
import com.bsd.pjcloud.wallet.api.vo.WalletTypeCountVo;
|
||||
import com.bsd.pjcloud.wallet.api.vo.WalletTypeTotalVo;
|
||||
@@ -94,4 +95,6 @@ public interface WalletTransactionMapper extends PjcloudBaseMapper<WalletTransac
|
||||
WalletTransactionSumAndCountVo sumAndCountUser(@Param("dto") WalletTransactionSumAndCountDto dto);
|
||||
|
||||
List<WalletTransactionSumAndCountVo> sumAndCount(@Param("dto") WalletTransactionSumAndCountDto dto);
|
||||
|
||||
List<WalletExportCzTotalPerson> exportCzTotalPerson();
|
||||
}
|
||||
+5
@@ -73,4 +73,9 @@ public interface WalletTransactionService extends IService<WalletTransactionEnti
|
||||
* 后台充值统计(导出)
|
||||
*/
|
||||
void exportCzTotal(HttpServletResponse response, WalletTransactionDto dto, DataScope dataScope);
|
||||
|
||||
/**
|
||||
* 后台充值统计按照个人(导出)
|
||||
*/
|
||||
void exportCzTotalPerson(HttpServletResponse response, WalletTransactionDto dto, Object o);
|
||||
}
|
||||
+38
-4
@@ -35,10 +35,7 @@ import com.bsd.pjcloud.wallet.api.entity.WalletManageEntity;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletTransactionEntity;
|
||||
import com.bsd.pjcloud.wallet.api.entity.WalletTypeEntity;
|
||||
import com.bsd.pjcloud.wallet.api.utils.WalletDataUtil;
|
||||
import com.bsd.pjcloud.wallet.api.vo.MchManageVo;
|
||||
import com.bsd.pjcloud.wallet.api.vo.WalletCzTotalVo;
|
||||
import com.bsd.pjcloud.wallet.api.vo.WalletTypeCountVo;
|
||||
import com.bsd.pjcloud.wallet.api.vo.WalletTypeTotalVo;
|
||||
import com.bsd.pjcloud.wallet.api.vo.*;
|
||||
import com.bsd.pjcloud.wallet.api.vo.mch.WalletMchDeptViewVo;
|
||||
import com.bsd.pjcloud.wallet.api.vo.transaction.WalletTransactionVo;
|
||||
import com.bsd.pjcloud.wallet.mapper.WalletManageMapper;
|
||||
@@ -404,6 +401,43 @@ public class WalletTransactionServiceImpl extends ServiceImpl<WalletTransactionM
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 后台充值统计按照个人(导出)
|
||||
*/
|
||||
@Override
|
||||
public void exportCzTotalPerson(HttpServletResponse response, WalletTransactionDto dto, Object o) {
|
||||
String fileName = "file/个人充值统计800、1600、2400.xlsx";
|
||||
try (ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream()).withTemplate(ResourceUtil.getStream(fileName)).build()) {
|
||||
// 查询导出数据
|
||||
List<WalletExportCzTotalPerson> list = baseMapper.exportCzTotalPerson();
|
||||
|
||||
WriteSheet writeSheet = EasyExcel.writerSheet().build();
|
||||
FillConfig fillConfig = FillConfig.builder().forceNewRow(Boolean.TRUE).build();
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
Long lineNumber = 1L;
|
||||
BigDecimal priceTotal = BigDecimal.ZERO;
|
||||
if (ObjectUtil.isNotEmpty(list)) {
|
||||
for (WalletExportCzTotalPerson v : list) {
|
||||
v.setLineNumber(lineNumber);
|
||||
lineNumber++;
|
||||
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());
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(v.getCreateTime())) {
|
||||
v.setCreateTimeStr(LocalDateTimeUtil.format(v.getCreateTime(), DatePattern.NORM_DATETIME_PATTERN));
|
||||
}
|
||||
}
|
||||
map.put("priceTotal", priceTotal.divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).toString());
|
||||
}
|
||||
excelWriter.fill(map, writeSheet);
|
||||
excelWriter.fill(new ArrayList<>(list), fillConfig, writeSheet);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
log.error("|{}|后台充值统计(导出),dto:|{}|,fileName:|{}|,error:|{}|", TAG, JSON.toJSONString(dto), fileName, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private void disposeList(List<WalletTransactionVo> list, WalletTransactionDto dto) {
|
||||
if (ObjectUtil.isNotEmpty(list)) {
|
||||
// 用户
|
||||
|
||||
Binary file not shown.
+16
@@ -265,4 +265,20 @@
|
||||
</where>
|
||||
group by a.dept_id
|
||||
</select>
|
||||
|
||||
<select id="exportCzTotalPerson" resultType="com.bsd.pjcloud.wallet.api.vo.WalletExportCzTotalPerson">
|
||||
select v.mchName,
|
||||
v.deptName,
|
||||
u.name,
|
||||
u.phone,
|
||||
t.price,
|
||||
t.create_time as createTime
|
||||
from pjcloudx_wallet.wallet_transaction t
|
||||
inner join pjcloudx_wallet.v_mch_dept_tree v on v.deptId = t.dept_id
|
||||
inner join pjcloudx.sys_user u on u.user_id = t.user_id
|
||||
where t.del_flag = '0'
|
||||
and t.biz_type in ('1', '2', '3')
|
||||
and t.dept_id not in (1875013738914156546, 1910218102049226753, 1910218128624336898, 1942046316044144642)
|
||||
order by v.mchId, v.deptId
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in new issue
Block a user