Bläddra i källkod

导出调整,添加可选导出

jichaobo 2 år sedan
förälder
incheckning
0e9d3fecb9

+ 3 - 3
service-fire/service-fire-biz/src/main/java/com/usky/fire/controller/web/PatrolInspectionContentController.java

@@ -89,14 +89,14 @@ public class PatrolInspectionContentController {
      * 巡查自检-巡检内容-导出
      * @param response
      * @param contentTitle 内容标题
-     * @param id 巡检内容ID
+     * @param idList 巡检内容ID
      * @throws IOException
      */
     @GetMapping("/contentListExport")
     public void export(HttpServletResponse response,
                        @RequestParam(value = "contentTitle",required = false) String contentTitle,
-                       @RequestParam(value = "id",required = false, defaultValue = "0") Integer id) throws IOException {
-        List<PatrolInspectionContentExportVo> list = patrolInspectionContentService.contentListExport(contentTitle, id);
+                       @RequestParam(value = "id",required = false) String idList) throws IOException {
+        List<PatrolInspectionContentExportVo> list = patrolInspectionContentService.contentListExport(contentTitle, idList);
         ExcelUtil<PatrolInspectionContentExportVo> util = new ExcelUtil<PatrolInspectionContentExportVo>(PatrolInspectionContentExportVo.class);
         util.exportExcel(response, list, "巡检内容列表", "巡检内容列表");
     }

+ 11 - 8
service-fire/service-fire-biz/src/main/java/com/usky/fire/controller/web/PatrolInspectionRecordController.java

@@ -84,13 +84,15 @@ public class PatrolInspectionRecordController {
 
     /**
      * 巡查自检-巡检记录-导出
+     *
      * @param response
-     * @param areaName        区域名称
-     * @param siteName        地点名称
-     * @param name            人员名称
-     * @param planType        计划类型
-     * @param startDateTime   开始时间
-     * @param endDateTime     结束时间
+     * @param areaName      区域名称
+     * @param siteName      地点名称
+     * @param name          人员名称
+     * @param planType      计划类型
+     * @param startDateTime 开始时间
+     * @param endDateTime   结束时间
+     * @param idList        记录ID
      * @throws IOException
      */
     @GetMapping("/recordLsitExport")
@@ -100,8 +102,9 @@ public class PatrolInspectionRecordController {
                        @RequestParam(value = "name", required = false) String name,
                        @RequestParam(value = "planType", required = false) Integer planType,
                        @RequestParam(value = "startDateTime", required = false) String startDateTime,
-                       @RequestParam(value = "endDateTime", required = false) String endDateTime) throws IOException {
-        List<PatrolInspectionRecordExportVo> list = patrolInspectionRecordService.recordLsitExport(areaName, siteName, name, planType, startDateTime, endDateTime);
+                       @RequestParam(value = "endDateTime", required = false) String endDateTime,
+                       @RequestParam(value = "idList", required = false) String idList) throws IOException {
+        List<PatrolInspectionRecordExportVo> list = patrolInspectionRecordService.recordLsitExport(areaName, siteName, name, planType, startDateTime, endDateTime,idList);
         ExcelUtil<PatrolInspectionRecordExportVo> util = new ExcelUtil<PatrolInspectionRecordExportVo>(PatrolInspectionRecordExportVo.class);
         util.exportExcel(response, list, "巡检记录", "巡检记录");
     }

+ 4 - 4
service-fire/service-fire-biz/src/main/java/com/usky/fire/controller/web/PatrolInspectionSiteController.java

@@ -143,14 +143,14 @@ public class PatrolInspectionSiteController {
      *
      * @param areaId   区域id
      * @param siteName 地点名称
-     * @param id       地点ID
+     * @param idList   地点ID
      * @return
      */
     @GetMapping("/patrolInspectionSiteListExport")
     public void export(HttpServletResponse response, @RequestParam(required = false) Integer areaId,
-                       @RequestParam(value = "id", required = false) String siteName,
-                       @RequestParam(value = "id", required = false, defaultValue = "0") Integer id) throws IOException {
-        List<PatrolInspectionSiteExportVo> list = patrolInspectionSiteService.patrolInspectionSiteListExport(areaId, siteName, id);
+                       @RequestParam(value = "siteName", required = false) String siteName,
+                       @RequestParam(value = "idList", required = false) String idList) throws IOException {
+        List<PatrolInspectionSiteExportVo> list = patrolInspectionSiteService.patrolInspectionSiteListExport(areaId, siteName, idList);
         ExcelUtil<PatrolInspectionSiteExportVo> util = new ExcelUtil<PatrolInspectionSiteExportVo>(PatrolInspectionSiteExportVo.class);
         util.exportExcel(response, list, "巡检地点列表", "巡检地点列表");
     }

+ 1 - 1
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/PatrolInspectionContentService.java

@@ -26,5 +26,5 @@ public interface PatrolInspectionContentService extends CrudService<PatrolInspec
 
     CommonPage<PatrolInspectionContentVo> patrolInspectionContentList(String contentTitle, Integer pageNum, Integer pageSize, Integer id);
 
-    List<PatrolInspectionContentExportVo> contentListExport(String contentTitle, Integer id);
+    List<PatrolInspectionContentExportVo> contentListExport(String contentTitle, String idList);
 }

+ 1 - 1
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/PatrolInspectionRecordService.java

@@ -39,5 +39,5 @@ public interface PatrolInspectionRecordService extends CrudService<PatrolInspect
 
     List<PatrolInspectionRecordExportVo> recordLsitExport(String areaName, String siteName, String name,
                                                           Integer planType, String startDateTime,
-                                                          String endDateTime);
+                                                          String endDateTime,String idList);
 }

+ 1 - 1
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/PatrolInspectionSiteService.java

@@ -33,7 +33,7 @@ public interface PatrolInspectionSiteService extends CrudService<PatrolInspectio
 
     Integer[] siteContentList(Integer siteId);
 
-    List<PatrolInspectionSiteExportVo> patrolInspectionSiteListExport(Integer areaId, String siteName, Integer id);
+    List<PatrolInspectionSiteExportVo> patrolInspectionSiteListExport(Integer areaId, String siteName, String idList);
 //
 //    String correspondDeviceExport(Integer areaId, String siteName, Integer id);
 }

+ 12 - 6
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PatrolInspectionContentServiceImpl.java

@@ -1,6 +1,7 @@
 package com.usky.fire.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.usky.common.core.bean.CommonPage;
 import com.usky.common.core.exception.BusinessException;
@@ -211,7 +212,7 @@ public class PatrolInspectionContentServiceImpl extends AbstractCrudService<Patr
 
 
     @Override
-    public List<PatrolInspectionContentExportVo> contentListExport(String contentTitle, Integer id) {
+    public List<PatrolInspectionContentExportVo> contentListExport(String contentTitle, String idList) {
         DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
         LoginUser loginUser = SecurityUtils.getLoginUser();
         String userType = null;
@@ -227,20 +228,25 @@ public class PatrolInspectionContentServiceImpl extends AbstractCrudService<Patr
         if (contentTitle != null && !"".equals(contentTitle)) {
             queryWrapper.like(PatrolInspectionContent::getContentTitle, contentTitle);
         }
-        if (id != 0 && id != null) {
-            queryWrapper.eq(PatrolInspectionContent::getId, id);
+        if (StringUtils.isNotBlank(idList)) {
+            List<Integer> listId = new ArrayList<>();
+            String[] idArray = idList.split(",");
+            for (int i = 0; i < idArray.length; i++) {
+                listId.add(Integer.parseInt(idArray[i]));
+            }
+            queryWrapper.in(PatrolInspectionContent::getId, listId);
         }
         queryWrapper.orderByDesc(PatrolInspectionContent::getId);
         List<PatrolInspectionContent> patrolInspectionContentList = this.list(queryWrapper);
         List<PatrolInspectionContentExportVo> patrolInspectionContentVoList = new ArrayList<>();
         if (patrolInspectionContentList.size() > 0) {
-            List<Integer> idList = new ArrayList<>();
+            List<Integer> contentIdList = new ArrayList<>();
             for (int i = 0; i < patrolInspectionContentList.size(); i++) {
-                idList.add(patrolInspectionContentList.get(i).getId());
+                contentIdList.add(patrolInspectionContentList.get(i).getId());
             }
             LambdaQueryWrapper<PatrolInspectionContentOption> queryWrapperOne = Wrappers.lambdaQuery();
             queryWrapperOne.eq(PatrolInspectionContentOption::getEnable, 1)
-                    .in(PatrolInspectionContentOption::getContentId, idList);
+                    .in(PatrolInspectionContentOption::getContentId, contentIdList);
             List<PatrolInspectionContentOption> contentOptionList = contentOptionService.list(queryWrapperOne);
             for (int i = 0; i < patrolInspectionContentList.size(); i++) {
                 PatrolInspectionContentExportVo patrolInspectionContentVo = new PatrolInspectionContentExportVo();

+ 14 - 5
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PatrolInspectionRecordServiceImpl.java

@@ -1,6 +1,7 @@
 package com.usky.fire.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.usky.common.core.bean.CommonPage;
 import com.usky.common.mybatis.core.AbstractCrudService;
@@ -315,7 +316,7 @@ public class PatrolInspectionRecordServiceImpl extends AbstractCrudService<Patro
     @Override
     public List<PatrolInspectionRecordExportVo> recordLsitExport(String areaName, String siteName, String name,
                                                                  Integer planType, String startDateTime,
-                                                                 String endDateTime) {
+                                                                 String endDateTime, String idList) {
         DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
         LoginUser loginUser = SecurityUtils.getLoginUser();
         String userType = null;
@@ -327,21 +328,29 @@ public class PatrolInspectionRecordServiceImpl extends AbstractCrudService<Patro
         if ("00".equals(userType)) {
             queryWrapper.eq(PatrolInspectionRecord::getCreator, SecurityUtils.getUsername());
         }
-        if (areaName != null && "".equals(areaName)) {
+        if (StringUtils.isNotBlank(areaName)) {
             queryWrapper.like(PatrolInspectionRecord::getAreaName, areaName);
         }
-        if (siteName != null && "".equals(siteName)) {
+        if (StringUtils.isNotBlank(siteName)) {
             queryWrapper.like(PatrolInspectionRecord::getSiteName, siteName);
         }
-        if (name != null && "".equals(name)) {
+        if (StringUtils.isNotBlank(name)) {
             queryWrapper.like(PatrolInspectionRecord::getName, name);
         }
         if (planType != null && planType != 0) {
             queryWrapper.eq(PatrolInspectionRecord::getPlanType, planType);
         }
-        if (startDateTime != null && "".equals(startDateTime) && endDateTime != null && "".equals(endDateTime)) {
+        if (StringUtils.isNotBlank(startDateTime) && StringUtils.isNotBlank(endDateTime)) {
             queryWrapper.between(PatrolInspectionRecord::getCreateTime, startDateTime, endDateTime);
         }
+        if (StringUtils.isNotBlank(idList)) {
+            List<Integer> listId = new ArrayList<>();
+            String[] idArray = idList.split(",");
+            for (int i = 0; i < idArray.length; i++) {
+                listId.add(Integer.parseInt(idArray[i]));
+            }
+            queryWrapper.in(PatrolInspectionRecord::getId, listId);
+        }
         queryWrapper.orderByDesc(PatrolInspectionRecord::getId);
         List<PatrolInspectionRecord> patrolInspectionRecordList = this.list(queryWrapper);
         List<PatrolInspectionRecordExportVo> list = new ArrayList<>();

+ 11 - 4
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PatrolInspectionSiteServiceImpl.java

@@ -1,5 +1,6 @@
 package com.usky.fire.service.impl;
 
+import com.alibaba.nacos.common.utils.CollectionUtils;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.usky.common.core.bean.CommonPage;
@@ -17,6 +18,7 @@ import com.usky.fire.service.vo.DataCountVo;
 import com.usky.fire.service.vo.PatrolInspectionAreaVo;
 import com.usky.fire.service.vo.PatrolInspectionSiteExportVo;
 import com.usky.system.model.LoginUser;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -222,7 +224,7 @@ public class PatrolInspectionSiteServiceImpl extends AbstractCrudService<PatrolI
 
 
     @Override
-    public List<PatrolInspectionSiteExportVo> patrolInspectionSiteListExport(Integer areaId, String siteName, Integer id) {
+    public List<PatrolInspectionSiteExportVo> patrolInspectionSiteListExport(Integer areaId, String siteName, String idList) {
         DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
         LoginUser loginUser = SecurityUtils.getLoginUser();
         String userType = null;
@@ -238,10 +240,15 @@ public class PatrolInspectionSiteServiceImpl extends AbstractCrudService<PatrolI
         if (areaId != null) {
             queryWrapper.eq(PatrolInspectionSite::getAreaId, areaId);
         }
-        if (id != null && id != 0) {
-            queryWrapper.eq(PatrolInspectionSite::getId, id);
+        if (StringUtils.isNotBlank(idList)) {
+            List<Integer> siteidList = new ArrayList<>();
+            String[] siteIdArray = idList.split(",");
+            for (int i = 0; i < siteIdArray.length; i++) {
+                siteidList.add(Integer.parseInt(siteIdArray[i]));
+            }
+            queryWrapper.in(PatrolInspectionSite::getId, siteidList);
         }
-        if (siteName != null && !"".equals(siteName)) {
+        if (StringUtils.isNotBlank(siteName)) {
             queryWrapper.like(PatrolInspectionSite::getSiteName, siteName);
         }
         queryWrapper.orderByDesc(PatrolInspectionSite::getId);