Jelajahi Sumber

导出原始数据导入列表

bihuisong 7 bulan lalu
induk
melakukan
93a9d4718b

+ 1 - 1
songhua-admin/src/main/java/com/songhua/web/controller/system/PzRawDataController.java

@@ -108,7 +108,7 @@ public class PzRawDataController extends BaseController {
      * 导出原始数据导入列表
      */
     @Log(title = "导出原始数据导入列表", businessType = BusinessType.EXPORT)
-    @GetMapping("/export")
+    @PostMapping("/export")
     public AjaxResult export(PzRawData pzRawData) {
         pzRawDataService.export(pzRawData);
         return AjaxResult.success();

+ 12 - 0
songhua-system/src/main/java/com/songhua/system/enums/TicketRulesEnum.java

@@ -113,6 +113,12 @@ public enum TicketRulesEnum {
     private String key;
     private List<Long> value;
 
+    /**
+     * 统计导出计算总价公式(票种只存在一个规则中)
+     *
+     * @param value
+     * @return
+     */
     public static String getKeyByValue(Long value) {
         for (TicketRulesEnum ticketRulesEnum : TicketRulesEnum.values()) {
             if (ticketRulesEnum.value.contains(value)) {
@@ -122,6 +128,12 @@ public enum TicketRulesEnum {
         return "未知门票";
     }
 
+    /**
+     * 统计导出计算总价公式(票种存在多个规则中)
+     *
+     * @param value
+     * @return
+     */
     public static List<String> getKeyByValues(Long value) {
         List<String> returnList = new ArrayList<>();
         for (TicketRulesEnum ticketRulesEnum : TicketRulesEnum.values()) {

+ 11 - 3
songhua-system/src/main/java/com/songhua/system/service/impl/PzRawDataServiceImpl.java

@@ -20,6 +20,7 @@ import org.springframework.stereotype.Service;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.math.BigDecimal;
+import java.nio.file.Paths;
 import java.text.SimpleDateFormat;
 import java.util.*;
 
@@ -156,7 +157,7 @@ public class PzRawDataServiceImpl implements IPzRawDataService {
         List<ShhTicketRulesReqVO> list = calculateTotalPrices(pzRawDataMapper.selectPzRawDataList(pzRawData));
         // 创建
         Workbook workbook = new XSSFWorkbook();
-        Sheet sheet = workbook.createSheet("票务数据");
+        Sheet sheet = workbook.createSheet("销售汇总表统计");
         sheet.setColumnWidth(0, 20 * 260);//设置单元格宽度 ,X代表第几列
         Row headerRow = sheet.createRow(0);
         CellStyle style = workbook.createCellStyle(); // 创建单元格样式
@@ -189,7 +190,8 @@ public class PzRawDataServiceImpl implements IPzRawDataService {
             dataRow.createCell(2).setCellValue(String.valueOf(data.getAmount()));
         }
         // 写入
-        try (FileOutputStream fileOut = new FileOutputStream("C:\\Users\\Administrator\\Desktop\\出票数据" + new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()) + ".xlsx")) {
+        String desktopPath = Paths.get(System.getProperty("user.home"), "Desktop").toString();
+        try (FileOutputStream fileOut = new FileOutputStream(desktopPath + "\\销售汇总表统计" + new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()) + ".xlsx")) {
             workbook.write(fileOut);
             log.info("Excel 文件已成功导出!");
         } catch (IOException e) {
@@ -205,7 +207,7 @@ public class PzRawDataServiceImpl implements IPzRawDataService {
     }
 
     /**
-     * 统计导出计算总价公式
+     * 统计导出计算总价公式(票种存在多个规则中)
      *
      * @param list
      * @return
@@ -236,6 +238,12 @@ public class PzRawDataServiceImpl implements IPzRawDataService {
     }
 
 
+    /**
+     * 统计导出计算总价公式(票种只存在一个规则中)
+     *
+     * @param list
+     * @return
+     */
     public List<ShhTicketRulesReqVO> calculateTotalPrice(List<PzRawDataVo> list) {
         List<ShhTicketRulesReqVO> returnList = new ArrayList<>();
         Map<String, PzRawDataVo> map = new HashMap<>();

+ 21 - 11
songhua-ui/src/views/system/data/index.vue

@@ -77,6 +77,16 @@
         >导入
         </el-button>
       </el-col>
+      <el-col :span="1.5">
+        <el-button
+          icon="el-icon-download"
+          plain
+          size="mini"
+          type="info"
+          @click="handleExport"
+        >导出
+        </el-button>
+      </el-col>
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
 
@@ -90,8 +100,8 @@
           <dict-tag :options="dict.type.pay_type" :value="scope.row.payType"/>
         </template>
       </el-table-column>
-      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
-        <template slot-scope="scope">
+<!--      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">-->
+<!--        <template slot-scope="scope">-->
 <!--          <el-button-->
 <!--            size="mini"-->
 <!--            type="text"-->
@@ -99,15 +109,15 @@
 <!--            @click="handleUpdate(scope.row)"-->
 <!--            v-hasPermi="['system:data:edit']"-->
 <!--          >修改</el-button>-->
-          <el-button
-            size="mini"
-            type="text"
-            icon="el-icon-delete"
-            @click="handleDelete(scope.row)"
-            v-hasPermi="['system:data:remove']"
-          >删除</el-button>
-        </template>
-      </el-table-column>
+<!--          <el-button-->
+<!--            size="mini"-->
+<!--            type="text"-->
+<!--            icon="el-icon-delete"-->
+<!--            @click="handleDelete(scope.row)"-->
+<!--            v-hasPermi="['system:data:remove']"-->
+<!--          >删除</el-button>-->
+<!--        </template>-->
+<!--      </el-table-column>-->
     </el-table>
 
     <pagination