Browse Source

chore: 修复checkmax

Marko552 3 years ago
parent
commit
36a9f5991f

+ 1 - 6
abi-cloud-qr-platform-common/src/main/java/com/abi/task/common/excel/ExcelOutputFactory.java

@@ -222,12 +222,7 @@ public class ExcelOutputFactory {
                     continue;
                 }
                 //反射调用拿到结果
-                Object value = null;
-                if (obj instanceof String){
-                    value = method.invoke(StrUtils.filterHtml(obj.toString().replaceAll(" ","")));
-                }else{
-                    value = method.invoke(obj);
-                }
+                Object value = method.invoke(obj);
                 map.put(fieldName, value);
             }catch (Exception e){
                 log.info("toMapList error",e);

+ 6 - 4
abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/controller/console/QrBoxCodeUnityController.java

@@ -7,6 +7,7 @@ import com.abi.qms.platform.dto.res.QrBoxCodeUploadRes;
 import com.abi.qms.platform.service.QrBoxMappingService;
 import com.abi.task.common.api.base.BaseResponse;
 import com.abi.task.common.excel.ExcelInputFactory;
+import com.abi.task.common.excel.ExcelOutputFactory;
 import com.abi.task.common.excel.preperties.QrBoxExportProperty;
 import com.abi.task.common.excel.preperties.QrBoxMappingProperty;
 import io.swagger.annotations.Api;
@@ -95,17 +96,18 @@ public class QrBoxCodeUnityController {
     @ResponseBody
     @ApiOperation(value = "导出模板")
     @GetMapping("downloadExcelModel")
-    public void downloadExcelModel(HttpServletResponse response) throws Exception {
+    public void downloadExcelModel(HttpServletResponse response){
         ExcelInputFactory.downloadExcelModel("箱码合一", response, QrBoxMappingProperty.class);
     }
 
     @ResponseBody
     @ApiOperation(value = "导出数据")
     @GetMapping("downloadExcelData")
-    public void downloadExcelData(ListQrBoxCodeMappingExportReq req, HttpServletResponse response) throws Exception {
+    public void downloadExcelData(ListQrBoxCodeMappingExportReq req, HttpServletResponse response) {
         List<QrBoxExportProperty> res = qrBoxMappingService.downloadExcelData(req);
-
-        ExcelInputFactory.downloadExcelData("箱码合一", response, res, QrBoxExportProperty.class);
+//
+//        ExcelInputFactory.downloadExcelData("箱码合一", response, res, QrBoxExportProperty.class);
+        qrBoxMappingService.downloadExcelData(req,response);
     }
 
 }

+ 5 - 0
abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/service/QrBoxMappingService.java

@@ -10,6 +10,7 @@ import com.abi.qms.platform.dto.res.QueryWxQrBoxMappingDetailsWxRes;
 import com.abi.task.common.excel.preperties.QrBoxExportProperty;
 import org.springframework.web.multipart.MultipartFile;
 
+import javax.servlet.http.HttpServletResponse;
 import java.util.List;
 import java.util.Map;
 
@@ -119,4 +120,8 @@ public interface QrBoxMappingService {
      * @return
      */
     List<QrBoxExportProperty> downloadExcelData(ListQrBoxCodeMappingExportReq req);
+
+    void downloadExcelData(ListQrBoxCodeMappingExportReq req, HttpServletResponse response);
+
+    List<QrBoxExportProperty>  downloadExcelData(Integer activeStatus, Long packageId);
 }

+ 35 - 0
abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/service/impl/QrBoxMappingServiceImpl.java

@@ -19,6 +19,8 @@ import com.abi.qms.platform.infrastructure.util.UserUtil;
 import com.abi.qms.platform.service.QrBoxMappingService;
 import com.abi.task.common.api.exception.BusinessException;
 import com.abi.task.common.api.exception.ErrorCodeEnum;
+import com.abi.task.common.excel.ExcelInputFactory;
+import com.abi.task.common.excel.ExcelOutputFactory;
 import com.abi.task.common.excel.preperties.QrBoxExportProperty;
 import com.abi.task.common.tablestore.TableStorePlusUtils;
 import com.abi.task.common.utils.PojoConverterUtils;
@@ -34,6 +36,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.web.multipart.MultipartFile;
 
+import javax.servlet.http.HttpServletResponse;
 import java.io.BufferedReader;
 import java.io.InputStream;
 import java.io.InputStreamReader;
@@ -58,6 +61,9 @@ public class QrBoxMappingServiceImpl implements QrBoxMappingService {
     @Autowired
     private TableStorePlusUtils tableStorePlusUtils;
 
+    @Autowired
+    private QrBoxMappingService qrBoxMappingService;
+
     @Autowired
     private UserUtil userUtil;
 
@@ -355,6 +361,35 @@ public class QrBoxMappingServiceImpl implements QrBoxMappingService {
         return qrBoxExportProperties;
     }
 
+    @Override
+    public void downloadExcelData(ListQrBoxCodeMappingExportReq req, HttpServletResponse response) {
+        List<QrBoxExportProperty>  properties = qrBoxMappingService.downloadExcelData(req.getActiveStatus(),req.getPackageId());
+        //调用导出方法
+        ExcelOutputFactory.outputStreamExcel("箱码合一", response, properties, QrBoxExportProperty.class);
+    }
+
+    @Override
+    public List<QrBoxExportProperty> downloadExcelData(Integer activeStatus, Long packageId) {
+        List<QrBoxMappingVO> qrBoxMappingVOList = qrBoxMappingMapper.listQrBoxCodeMappingForExcel(activeStatus,packageId);
+        List<QrBoxExportProperty> qrBoxExportProperties = new ArrayList<>();
+        if(CollectionUtils.isNotEmpty(qrBoxMappingVOList)){
+            for (QrBoxMappingVO qrBoxMappingVO:qrBoxMappingVOList) {
+                QrBoxExportProperty qrBoxExportProperty = PojoConverterUtils.copy(qrBoxMappingVO, QrBoxExportProperty.class);
+                if(InvalidEnum.INVALID.is(qrBoxMappingVO.getInvalid())){
+                    qrBoxExportProperty.setActiveStatus(InvalidEnum.INVALID.getName());
+                }else{
+                    if(BoxMappingActiveStatusEnum.NOT_ACTIVE.is(qrBoxMappingVO.getActiveStatus())){
+                        qrBoxExportProperty.setActiveStatus(BoxMappingActiveStatusEnum.NOT_ACTIVE.getName());
+                    }else if(BoxMappingActiveStatusEnum.ACTIVATED.is(qrBoxMappingVO.getActiveStatus())){
+                        qrBoxExportProperty.setActiveStatus(BoxMappingActiveStatusEnum.ACTIVATED.getName());
+                    }
+                }
+                qrBoxExportProperties.add(qrBoxExportProperty);
+            }
+        }
+        return qrBoxExportProperties;
+    }
+
     /**
      * 组装激活公共所需参数
      *