|
@@ -455,7 +455,9 @@ public class TbFeeStatisticsService extends ServiceImpl<TbFeeStatisticsMapper, T
|
|
|
}else if(StrUtil.isNotEmpty(isYear)){
|
|
|
time = so.getString("year");
|
|
|
}
|
|
|
-
|
|
|
+ if(StrUtil.isEmpty(time)){
|
|
|
+ time = "所有时间";
|
|
|
+ }
|
|
|
|
|
|
BigDecimal totalFee = new BigDecimal(0);
|
|
|
BigDecimal totalTaxes = new BigDecimal(0);
|
|
@@ -502,6 +504,108 @@ public class TbFeeStatisticsService extends ServiceImpl<TbFeeStatisticsMapper, T
|
|
|
return printData;
|
|
|
}
|
|
|
|
|
|
+ public String export(SoMap so) throws Exception{
|
|
|
+ so.clearNull();
|
|
|
+
|
|
|
+ String beginTimeStr = "";
|
|
|
+ String endTimeStr = "";
|
|
|
+ String isMonth = so.getString("isMonth");
|
|
|
+ String isYear = so.getString("isYear");
|
|
|
+ beginTimeStr = so.getString("beginDay");
|
|
|
+ endTimeStr = so.getString("endDay");
|
|
|
+ if(StrUtil.isNotEmpty(isMonth)){
|
|
|
+ beginTimeStr = so.getString("beginMonth");
|
|
|
+ endTimeStr = so.getString("endMonth");
|
|
|
+ }
|
|
|
+ String time = "所有时间";
|
|
|
+ if(StrUtil.isNotEmpty(beginTimeStr) && StrUtil.isNotEmpty(endTimeStr)){
|
|
|
+ time = beginTimeStr + "至" + endTimeStr;
|
|
|
+ }else if(StrUtil.isNotEmpty(isYear)){
|
|
|
+ time = so.getString("year");
|
|
|
+ }
|
|
|
+ if(StrUtil.isEmpty(time)){
|
|
|
+ time = "所有时间";
|
|
|
+ }
|
|
|
+ Map<String, String> head = new HashMap<>();
|
|
|
+ head.put("time", time);
|
|
|
+
|
|
|
+ BigDecimal totalFee = new BigDecimal(0);
|
|
|
+ BigDecimal totalTaxes = new BigDecimal(0);
|
|
|
+ BigDecimal totalNoTaxFee = new BigDecimal(0);
|
|
|
+ BigDecimal totalWxPrice = new BigDecimal(0);
|
|
|
+
|
|
|
+ List<TbFeeStatistics> statsList = this.getList(so);
|
|
|
+ if(StrUtil.isNotEmpty(isMonth)){
|
|
|
+ statsList = this.getMonth(so);
|
|
|
+ }
|
|
|
+ if(StrUtil.isNotEmpty(isYear)){
|
|
|
+ statsList = this.getYear(so);
|
|
|
+ }
|
|
|
+
|
|
|
+ List<ExportDayStatsDTO> exportList = new ArrayList<>();
|
|
|
+ for (TbFeeStatistics stats : statsList) {
|
|
|
+ String feeType = TbFeeDetails.fee.getDesc(stats.getFeeType());
|
|
|
+ ExportDayStatsDTO dayStatsDTO = new ExportDayStatsDTO();
|
|
|
+ dayStatsDTO.setDayTime(stats.getDay())
|
|
|
+ .setFeeType(feeType).setNum(stats.getNum())
|
|
|
+ .setTaxMoney(stats.getTaxMoney())
|
|
|
+ .setTaxRate(stats.getTaxRate())
|
|
|
+ .setTaxes(stats.getTaxes())
|
|
|
+ .setNoTaxMoney(stats.getNoTaxMoney())
|
|
|
+ .setWxPrice(stats.getTaxMoney());
|
|
|
+ if(StrUtil.isNotEmpty(isMonth)){
|
|
|
+ dayStatsDTO.setDayTime(stats.getMonth());
|
|
|
+ }
|
|
|
+ if(StrUtil.isNotEmpty(isYear)){
|
|
|
+ dayStatsDTO.setDayTime(stats.getYear());
|
|
|
+ }
|
|
|
+ exportList.add(dayStatsDTO);
|
|
|
+ totalFee = totalFee.add(stats.getTaxMoney());
|
|
|
+ totalTaxes = totalTaxes.add(stats.getTaxes());
|
|
|
+ totalNoTaxFee = totalNoTaxFee.add(stats.getNoTaxMoney());
|
|
|
+ totalWxPrice = totalWxPrice.add(stats.getTaxMoney());
|
|
|
+ }
|
|
|
+ head.put("totalMoney", totalFee.toString());
|
|
|
+ head.put("totalTaxes", totalTaxes.toString());
|
|
|
+ head.put("totalNoTaxMoney", totalNoTaxFee.toString());
|
|
|
+ head.put("totalWxPrice", totalWxPrice.toString());
|
|
|
+
|
|
|
+ String separator = File.separator;
|
|
|
+ String today = DateUtil.today();
|
|
|
+ String rootPath = UploadUtil.uploadConfig.rootFolder + separator + UploadUtil.uploadConfig.httpPrefix;
|
|
|
+ String prefix = myConfig.getDomain() + UploadUtil.uploadConfig.httpPrefix;
|
|
|
+ String extPath = "feeStats" + separator + today + separator;
|
|
|
+ String fileName = time + ".xlsx";
|
|
|
+ String headName = "";
|
|
|
+ if(StrUtil.isNotEmpty(isMonth)){
|
|
|
+ fileName = "月统计报表_" + fileName;
|
|
|
+ headName = "月";
|
|
|
+ }else if(StrUtil.isNotEmpty(isYear)){
|
|
|
+ fileName = "年统计报表_" + fileName;
|
|
|
+ headName = "年";
|
|
|
+ }else {
|
|
|
+ fileName = "日统计报表_" + fileName;
|
|
|
+ headName = "日";
|
|
|
+ }
|
|
|
+ head.put("name", headName);
|
|
|
+ String savePath = rootPath + separator + extPath;
|
|
|
+ File saveFIle = new File(savePath);
|
|
|
+ if (!saveFIle.exists()) {
|
|
|
+ saveFIle.mkdirs();
|
|
|
+ }
|
|
|
+
|
|
|
+ ClassPathResource classPathResource = new ClassPathResource("static/stats.xlsx");
|
|
|
+ InputStream tempInputStream =classPathResource.getInputStream();
|
|
|
+ ExcelWriter excelWriter = EasyExcel.write(savePath + fileName, ExportFeeDetailDTO.class)
|
|
|
+ .withTemplate(tempInputStream).build();
|
|
|
+ WriteSheet writeSheet = EasyExcel.writerSheet().build();
|
|
|
+ FillConfig fillConfig = FillConfig.builder().forceNewRow(true).build();//换行
|
|
|
+ excelWriter.fill(head, writeSheet);
|
|
|
+ excelWriter.fill(exportList, fillConfig, writeSheet);
|
|
|
+ excelWriter.finish();
|
|
|
+ return prefix + "/feeStats/" + today + "/" + fileName;
|
|
|
+ }
|
|
|
+
|
|
|
public StatsSumDTO getSum(SoMap so){
|
|
|
return tbFeeStatisticsMapper.getSum(so);
|
|
|
}
|