From 096f6025e0212b23df8485b56818c3f0b019aa26 Mon Sep 17 00:00:00 2001
From: yijiusmile <253281376@qq.com>
Date: 星期二, 20 四月 2021 10:40:31 +0800
Subject: [PATCH] 修复导入空行的问题

---
 febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/controller/EmpLaborTroubleController.java |  143 +++++++++++++++++++++++++----------------------
 1 files changed, 75 insertions(+), 68 deletions(-)

diff --git a/febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/controller/EmpLaborTroubleController.java b/febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/controller/EmpLaborTroubleController.java
index 8f90516..8c88d47 100644
--- a/febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/controller/EmpLaborTroubleController.java
+++ b/febs-server/febs-server-hr/src/main/java/cc/mrbird/febs/server/hr/controller/EmpLaborTroubleController.java
@@ -1,6 +1,7 @@
 package cc.mrbird.febs.server.hr.controller;
 
 import cc.mrbird.febs.server.hr.annotation.ControllerEndpoint;
+import cc.mrbird.febs.server.hr.constant.MyConstant;
 import cc.mrbird.febs.server.hr.entity.EmpJobChange;
 import cc.mrbird.febs.server.hr.entity.EmpLaborTrouble;
 import cc.mrbird.febs.server.hr.service.IEmpLaborTroubleService;
@@ -8,6 +9,7 @@
 import cc.mrbird.febs.common.core.entity.QueryRequest;
 import cc.mrbird.febs.common.core.exception.FebsException;
 import cc.mrbird.febs.common.core.utils.FebsUtil;
+import cn.hutool.core.util.StrUtil;
 import com.wuwenze.poi.ExcelKit;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -24,15 +26,14 @@
 import java.util.Map;
 
 /**
-*
-* name:EmpLabortrouble
-* package:cc.mrbird.febs.server.hr.controller
-* description:员工劳资案件控制器
-*
-* @author luoyibo
-* @date 2021-01-31 11:26:36
-* @since JDK1.8
-*/
+ * name:EmpLabortrouble
+ * package:cc.mrbird.febs.server.hr.controller
+ * description:员工劳资案件控制器
+ *
+ * @author luoyibo
+ * @date 2021-01-31 11:26:36
+ * @since JDK1.8
+ */
 @Api(tags = "人员劳资案件信息录入接口")
 @Slf4j
 @Validated
@@ -41,80 +42,86 @@
 @RequiredArgsConstructor
 public class EmpLaborTroubleController {
 
-private final IEmpLaborTroubleService empLabortroubleService;
+    private final IEmpLaborTroubleService empLabortroubleService;
 
-@GetMapping
-@PreAuthorize("hasAuthority('empLabortrouble:list')")
-public FebsResponse getAllEmpLabortroubles(EmpLaborTrouble empLabortrouble) {
-return new FebsResponse().data(empLabortroubleService.findEmpLabortroubles(empLabortrouble));
-}
+    @GetMapping
+    @PreAuthorize("hasAuthority('empLabortrouble:list')")
+    public FebsResponse getAllEmpLabortroubles(EmpLaborTrouble empLabortrouble) {
+        return new FebsResponse().data(empLabortroubleService.findEmpLabortroubles(empLabortrouble));
+    }
 
-@GetMapping("list")
-@PreAuthorize("hasAuthority('empLabortrouble:list')")
-public FebsResponse empLabortroubleList(QueryRequest request, EmpLaborTrouble empLabortrouble) {
-Map<String, Object> dataTable = FebsUtil.getDataTable(this.empLabortroubleService.findEmpLabortroubles(request, empLabortrouble));
-return new FebsResponse().data(dataTable);
-}
+    @GetMapping("list")
+    public FebsResponse empLabortroubleList(QueryRequest request, EmpLaborTrouble empLabortrouble) {
+        Map<String, Object> dataTable = FebsUtil.getDataTable(this.empLabortroubleService.findEmpLabortroubles(request, empLabortrouble));
+        return new FebsResponse().data(dataTable);
+    }
+
     @ApiOperation(value = "导出员工")
-    @RequestMapping(value = "export",method= RequestMethod.POST)
+    @RequestMapping(value = "export", method = RequestMethod.POST)
     @ControllerEndpoint(operation = "导出用户数据", exceptionMessage = "导出Excel失败")
     public void export(QueryRequest request, EmpLaborTrouble empBaseinfo, HttpServletResponse response) {
-
+        request.setPageSize(this.empLabortroubleService.count());
         List<EmpLaborTrouble> records = this.empLabortroubleService.findEmpLabortroubles(request, empBaseinfo).getRecords();
         ExcelKit.$Export(EmpLaborTrouble.class, response).downXlsx(records, false);
     }
-@PostMapping
-@PreAuthorize("hasAuthority('empLabortrouble:add')")
-public void addEmpLabortrouble(@Valid EmpLaborTrouble empLabortrouble) throws FebsException {
-try {
-this.empLabortroubleService.createEmpLabortrouble(empLabortrouble);
-} catch (Exception e) {
-String message = "新增员工劳资案件失败";
-log.error(message, e);
-throw new FebsException(message);
-}
-}
 
-@DeleteMapping
-@PreAuthorize("hasAuthority('empLabortrouble:delete')")
-public void deleteEmpLabortrouble(EmpLaborTrouble empLabortrouble) throws FebsException {
-try {
-this.empLabortroubleService.deleteEmpLabortrouble(empLabortrouble);
-} catch (Exception e) {
-String message = "删除员工劳资案件失败";
-log.error(message, e);
-throw new FebsException(message);
-}
-}
+    @PostMapping
+    @PreAuthorize("hasAuthority('empLabortrouble:add')")
+    public void addEmpLabortrouble(@Valid EmpLaborTrouble empLabortrouble) throws FebsException {
+        try {
+            this.empLabortroubleService.createEmpLabortrouble(empLabortrouble);
+        } catch (Exception e) {
+            String message = "新增员工劳资案件失败";
+            if (StrUtil.equals(e.getMessage(), MyConstant.MESSAGE)){
+                message = e.getMessage();
+            }
+            log.error(message, e);
+            throw new FebsException(message);
+        }
+    }
 
-@DeleteMapping("{ids}")
-@PreAuthorize("hasAuthority('empLabortrouble:delete')")
-public void logicDeleteEmpLabortrouble(@PathVariable("ids") String ids) throws FebsException {
-try {
-this.empLabortroubleService.logicDelEmpLabortrouble(ids);
-} catch (Exception e) {
-String message = "逻辑删除员工劳资案件失败";
-log.error(message, e);
-throw new FebsException(message);
-}
-}
+    @DeleteMapping
+    @PreAuthorize("hasAuthority('empLabortrouble:delete')")
+    public void deleteEmpLabortrouble(EmpLaborTrouble empLabortrouble) throws FebsException {
+        try {
+            this.empLabortroubleService.deleteEmpLabortrouble(empLabortrouble);
+        } catch (Exception e) {
+            String message = "删除员工劳资案件失败";
+            log.error(message, e);
+            throw new FebsException(message);
+        }
+    }
 
-@PutMapping
-@PreAuthorize("hasAuthority('empLabortrouble:update')")
-public void updateEmpLabortrouble(EmpLaborTrouble empLabortrouble) throws FebsException {
-try {
-this.empLabortroubleService.updateEmpLabortrouble(empLabortrouble);
-} catch (Exception e) {
-String message = "修改员工劳资案件失败";
-log.error(message, e);
-throw new FebsException(message);
-}
-}
+    @DeleteMapping("{ids}")
+    public void logicDeleteEmpLabortrouble(@PathVariable("ids") String ids) throws FebsException {
+        try {
+            this.empLabortroubleService.logicDelEmpLabortrouble(ids);
+        } catch (Exception e) {
+            String message = "逻辑删除员工劳资案件失败";
+            log.error(message, e);
+            throw new FebsException(message);
+        }
+    }
+
+    @PutMapping
+    @PreAuthorize("hasAuthority('empLabortrouble:update')")
+    public void updateEmpLabortrouble(EmpLaborTrouble empLabortrouble) throws FebsException {
+        try {
+            this.empLabortroubleService.updateEmpLabortrouble(empLabortrouble);
+        } catch (Exception e) {
+            String message = "修改员工劳资案件失败";
+            if (StrUtil.equals(e.getMessage(), MyConstant.MESSAGE)){
+                message = e.getMessage();
+            }
+            log.error(message, e);
+            throw new FebsException(message);
+        }
+    }
 
     @ApiOperation(value = "劳资案件信息提交")
     @DeleteMapping("toNormal/{ids}")
     @PreAuthorize("hasAuthority('empLabortrouble:delete')")
-    public void momentToNormal(@NotBlank(message = "{required}")  @PathVariable("ids") String ids) throws FebsException {
+    public void momentToNormal(@NotBlank(message = "{required}") @PathVariable("ids") String ids) throws FebsException {
         try {
             this.empLabortroubleService.momentToNormal(ids);
         } catch (Exception e) {

--
Gitblit v1.8.0