Browse Source

年日月导出调整

lzm 2 years ago
parent
commit
db17fdaa01

+ 6 - 5
sp-admin/sa-view/tb-fee-statistics/dayStatsPrint.html

@@ -161,11 +161,12 @@
         )
         $("#dp").append(html.join(''));
 
-        if(data.data.time != null){
-          $("#time").html("期间:" + data.data.time);
-        }else {
-          $("#time").html("期间:所有时间" );
-        }
+        $("#time").html("期间:" + data.data.time);
+        // if(data.data.time != null){
+        //   $("#time").html("期间:" + data.data.time);
+        // }else {
+        //   $("#time").html("期间:所有时间" );
+        // }
 
 
 

+ 53 - 4
sp-admin/sa-view/tb-fee-statistics/month-statistcs-list.html

@@ -52,7 +52,8 @@
 				<div class="fast-btn">
 					<el-button size="mini" type="info" @click="sa.f5()">刷新</el-button>
 <!--					<el-button type="warning"  @click="exportFn()">导出(月统计)</el-button>-->
-					<el-button class="c-btn" type="success" icon="el-icon" @click="print()">打印(月报表)</el-button>
+					<el-button class="c-btn" type="warning" icon="el-icon" @click="exportStats()">导出</el-button>
+					<el-button class="c-btn" type="success" icon="el-icon" @click="print()">打印</el-button>
 
 				</div>
 				<!-- ------------- 数据列表 ------------- -->
@@ -128,10 +129,11 @@
 						taxMoney: '',		// 税款 
 						taxRate: '',		// 税率 
 						noTaxMoney: '',		// 不含税款 
-						payType: '',		// 支付方式(1=微信支付) 
+						payType: '',		// 支付方式(1=微信支付)
+						isMonth: 1,
 						pageNo: 1,		// 当前页 
 						pageSize: 10,	// 页大小 
-						sortType: 0		// 排序方式 
+						sortType: 0		// 排序方式
 					},
 					dataCount: 0,
 					dataList: [], // 数据集合
@@ -255,9 +257,56 @@
 							type: 'warning'
 						}).then(() => {
 
+							sa.showIframe('打印月报表', 'dayStatsPrint.html?beginMonth='+beginMonth+"&endMonth="+endMonth+"&feeType="+feeType+"&isMonth=1" , '1000px', '100%');
+						}).catch(() => {
 
+						});
+					},
+					exportStats(){
+						if ( this.selectMonth != null && this.selectMonth.length != 0) {
+							this.selectMonthRange.beginMonth = this.selectMonth[0];
+							this.selectMonthRange.endMonth = this.selectMonth[1];
+						}
 
-							sa.showIframe('打印月报表', 'dayStatsPrint.html?beginMonth='+beginMonth+"&endMonth="+endMonth+"&feeType="+feeType+"&isMonth=1" , '1000px', '100%');
+						var beginMonth = this.selectMonthRange.beginMonth;
+						var endMonth = this.selectMonthRange.endMonth;
+						var feeType = this.p.feeType;
+						var str = '';
+						if(beginMonth === '' && endMonth === ''){
+							str += '所有月份';
+						}else {
+							str += beginMonth + "至" + endMonth
+						}
+						if(feeType === ''){
+							str += "、所有收费项目";
+						}else{
+							var feeTypeName = '';
+							if(feeType == 1){
+								feeTypeName = "核酸检测";
+							}else if(feeType == 2){
+								feeTypeName = "消杀作业";
+							}else if(feeType == 3){
+								feeTypeName = "装卸作业";
+							}else if(feeType == 4){
+								feeTypeName = "停车费";
+							}else if(feeType == 5){
+								feeTypeName = "过磅费";
+							}else if(feeType == 6){
+								feeTypeName = "入场管理费";
+							}else if(feeType == 7){
+								feeTypeName = "充电打冷作业";
+							}
+							str += "、收费项目为" + feeTypeName;
+						}
+						this.$confirm('确定导出'+str+'的数据?', '提示', {
+							confirmButtonText: '确定',
+							cancelButtonText: '取消',
+							type: 'warning'
+						}).then(() => {
+							sa.ajax('/TbFeeStatistics/export/stats?beginMonth='+beginMonth+'&endMonth='+endMonth
+									, sa.removeNull(this.p),  function(resp) {
+										window.open(resp.data);
+									}.bind(this));
 						}).catch(() => {
 
 						});

+ 1 - 1
sp-admin/sa-view/tb-fee-statistics/tb-fee-details-list.html

@@ -495,7 +495,7 @@
 							str += "、业务类型为" + itemTypeName;
 						}
 
-						this.$confirm('确定打印'+str+'的数据?', '提示', {
+						this.$confirm('确定导出'+str+'的数据?', '提示', {
 							confirmButtonText: '确定',
 							cancelButtonText: '取消',
 							type: 'warning'

+ 50 - 1
sp-admin/sa-view/tb-fee-statistics/tb-fee-statistics-list.html

@@ -58,6 +58,7 @@
 				<!-- ------------- 快捷按钮 ------------- -->
 				<div class="fast-btn">
 					<el-button size="mini" type="info" @click="sa.f5()">刷新</el-button>
+					<el-button class="c-btn" type="warning" icon="el-icon" @click="exportStats()">导出</el-button>
 					<el-button class="c-btn" type="success" icon="el-icon" @click="print()">打印</el-button>
 				</div>
 				<!-- ------------- 数据列表 ------------- -->
@@ -248,9 +249,57 @@
 							type: 'warning'
 						}).then(() => {
 
+							sa.showIframe('打印日报表', 'dayStatsPrint.html?beginDay='+beginDay+"&endDay="+endDay+"&feeType="+feeType , '1000px', '100%');
+						}).catch(() => {
 
+						});
+					},
+					exportStats(){
+						if ( this.selectDay != null && this.selectDay.length != 0) {
+							this.selectDayRange.beginDay = this.selectDay[0];
+							this.selectDayRange.endDay = this.selectDay[1];
+						}
 
-							sa.showIframe('打印日报表', 'dayStatsPrint.html?beginDay='+beginDay+"&endDay="+endDay+"&feeType="+feeType , '1000px', '100%');
+						var beginDay = this.selectDayRange.beginDay;
+						var endDay = this.selectDayRange.endDay;
+						var feeType = this.p.feeType;
+
+						var str = '';
+						if(beginDay === '' && endDay === ''){
+							str += '所有时间';
+						}else {
+							str += beginDay + "至" + endDay
+						}
+						if(feeType === ''){
+							str += "、所有收费项目";
+						}else{
+							var feeTypeName = '';
+							if(feeType == 1){
+								feeTypeName = "核酸检测";
+							}else if(feeType == 2){
+								feeTypeName = "消杀作业";
+							}else if(feeType == 3){
+								feeTypeName = "装卸作业";
+							}else if(feeType == 4){
+								feeTypeName = "停车费";
+							}else if(feeType == 5){
+								feeTypeName = "过磅费";
+							}else if(feeType == 6){
+								feeTypeName = "入场管理费";
+							}else if(feeType == 7){
+								feeTypeName = "充电打冷作业";
+							}
+							str += "、收费项目为" + feeTypeName;
+						}
+						this.$confirm('确定导出'+str+'的数据?', '提示', {
+							confirmButtonText: '确定',
+							cancelButtonText: '取消',
+							type: 'warning'
+						}).then(() => {
+							sa.ajax('/TbFeeStatistics/export/stats?beginDay='+beginDay+'&endDay='+endDay
+									, sa.removeNull(this.p),  function(resp) {
+										window.open(resp.data);
+									}.bind(this));
 						}).catch(() => {
 
 						});

+ 45 - 1
sp-admin/sa-view/tb-fee-statistics/year-statistcs-list.html

@@ -43,6 +43,7 @@
 				<!-- ------------- 快捷按钮 ------------- -->
 				<div class="fast-btn">
 					<el-button size="mini" type="info" @click="sa.f5()">刷新</el-button>
+					<el-button class="c-btn" type="warning" icon="el-icon" @click="exportStats()">导出</el-button>
 					<el-button class="c-btn" type="success" icon="el-icon" @click="print()">打印</el-button>
 				</div>
 				<!-- ------------- 数据列表 ------------- -->
@@ -107,7 +108,8 @@
 						taxMoney: '',		// 税款 
 						taxRate: '',		// 税率 
 						noTaxMoney: '',		// 不含税款 
-						payType: '',		// 支付方式(1=微信支付) 
+						payType: '',		// 支付方式(1=微信支付)
+						isYear: 1,
 						pageNo: 1,		// 当前页 
 						pageSize: 10,	// 页大小 
 						sortType: 0		// 排序方式 
@@ -218,6 +220,48 @@
 
 						});
 					},
+					exportStats(){
+						var year = this.p.year;
+						var feeType = this.p.feeType;
+						var str = '';
+						if(year === ''){
+							str += '所有年份';
+						}else {
+							str += year + '年'
+						}
+						if(feeType === ''){
+							str += "、所有收费项目";
+						}else{
+							var feeTypeName = '';
+							if(feeType == 1){
+								feeTypeName = "核酸检测";
+							}else if(feeType == 2){
+								feeTypeName = "消杀作业";
+							}else if(feeType == 3){
+								feeTypeName = "装卸作业";
+							}else if(feeType == 4){
+								feeTypeName = "停车费";
+							}else if(feeType == 5){
+								feeTypeName = "过磅费";
+							}else if(feeType == 6){
+								feeTypeName = "入场管理费";
+							}else if(feeType == 7){
+								feeTypeName = "充电打冷作业";
+							}
+							str += "、收费项目为" + feeTypeName;
+						}
+						this.$confirm('确定导出'+str+'的数据?', '提示', {
+							confirmButtonText: '确定',
+							cancelButtonText: '取消',
+							type: 'warning'
+						}).then(() => {
+							sa.ajax('/TbFeeStatistics/export/stats', sa.removeNull(this.p),  function(resp) {
+										window.open(resp.data);
+									}.bind(this));
+						}).catch(() => {
+
+						});
+					},
 					// 刷新
 					f5: function() {
 						sa.ajax('/TbFeeStatistics/getYear', sa.removeNull(this.p), function(res) {

+ 7 - 0
sp-server/src/main/java/com/pj/project/tb_fee_statistics/TbFeeStatisticsController.java

@@ -113,6 +113,13 @@ public class TbFeeStatisticsController {
     }
 
     /** 准备打印的数据 */
+    @RequestMapping("export/stats")
+    public AjaxJson export() throws Exception{
+        SoMap so = SoMap.getRequestSoMap();
+        return AjaxJson.getSuccessData(tbFeeStatisticsService.export(so));
+    }
+
+    /** 准备打印的数据 */
     @RequestMapping("getSum")
     public AjaxJson getSum(){
         SoMap so = SoMap.getRequestSoMap();

+ 105 - 1
sp-server/src/main/java/com/pj/project/tb_fee_statistics/TbFeeStatisticsService.java

@@ -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);
     }

BIN
sp-server/src/main/resources/static/stats.xlsx