From 05683f2b2bdbdbe21cf17ad523c21ab338bd1c54 Mon Sep 17 00:00:00 2001
From: wuxw <928255095@qq.com>
Date: 星期二, 19 七月 2022 21:49:55 +0800
Subject: [PATCH] 优化添加设备 功能

---
 service-report/src/main/java/com/java110/report/smo/impl/ReportCustomComponentV1InnerServiceSMOImpl.java |   54 ++++++++++++++++++++++++++++++++++++------------------
 1 files changed, 36 insertions(+), 18 deletions(-)

diff --git a/service-report/src/main/java/com/java110/report/smo/impl/ReportCustomComponentV1InnerServiceSMOImpl.java b/service-report/src/main/java/com/java110/report/smo/impl/ReportCustomComponentV1InnerServiceSMOImpl.java
index bb9cbb5..33afdef 100644
--- a/service-report/src/main/java/com/java110/report/smo/impl/ReportCustomComponentV1InnerServiceSMOImpl.java
+++ b/service-report/src/main/java/com/java110/report/smo/impl/ReportCustomComponentV1InnerServiceSMOImpl.java
@@ -16,19 +16,19 @@
 package com.java110.report.smo.impl;
 
 
-import com.java110.report.dao.IReportCustomComponentV1ServiceDao;
-import com.java110.intf.report.IReportCustomComponentV1InnerServiceSMO;
-import com.java110.dto.reportCustomComponent.ReportCustomComponentDto;
-import com.java110.po.reportCustomComponent.ReportCustomComponentPo;
-import com.java110.utils.util.BeanConvertUtil;
 import com.java110.core.base.smo.BaseServiceSMO;
-import com.java110.dto.user.UserDto;
 import com.java110.dto.PageDto;
+import com.java110.dto.reportCustomComponent.ReportCustomComponentDto;
+import com.java110.intf.report.IReportCustomComponentV1InnerServiceSMO;
+import com.java110.po.reportCustomComponent.ReportCustomComponentPo;
+import com.java110.report.dao.IReportCustomComponentV1ServiceDao;
+import com.java110.utils.util.Base64Convert;
+import com.java110.utils.util.BeanConvertUtil;
+import com.java110.utils.util.StringUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RestController;
 
-import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -47,26 +47,26 @@
 
 
     @Override
-    public int saveReportCustomComponent(@RequestBody  ReportCustomComponentPo reportCustomComponentPo) {
+    public int saveReportCustomComponent(@RequestBody ReportCustomComponentPo reportCustomComponentPo) {
         int saveFlag = reportCustomComponentV1ServiceDaoImpl.saveReportCustomComponentInfo(BeanConvertUtil.beanCovertMap(reportCustomComponentPo));
         return saveFlag;
     }
 
-     @Override
-    public int updateReportCustomComponent(@RequestBody  ReportCustomComponentPo reportCustomComponentPo) {
+    @Override
+    public int updateReportCustomComponent(@RequestBody ReportCustomComponentPo reportCustomComponentPo) {
         int saveFlag = reportCustomComponentV1ServiceDaoImpl.updateReportCustomComponentInfo(BeanConvertUtil.beanCovertMap(reportCustomComponentPo));
         return saveFlag;
     }
 
-     @Override
-    public int deleteReportCustomComponent(@RequestBody  ReportCustomComponentPo reportCustomComponentPo) {
-       reportCustomComponentPo.setStatusCd("1");
-       int saveFlag = reportCustomComponentV1ServiceDaoImpl.updateReportCustomComponentInfo(BeanConvertUtil.beanCovertMap(reportCustomComponentPo));
-       return saveFlag;
+    @Override
+    public int deleteReportCustomComponent(@RequestBody ReportCustomComponentPo reportCustomComponentPo) {
+        reportCustomComponentPo.setStatusCd("1");
+        int saveFlag = reportCustomComponentV1ServiceDaoImpl.updateReportCustomComponentInfo(BeanConvertUtil.beanCovertMap(reportCustomComponentPo));
+        return saveFlag;
     }
 
     @Override
-    public List<ReportCustomComponentDto> queryReportCustomComponents(@RequestBody  ReportCustomComponentDto reportCustomComponentDto) {
+    public List<ReportCustomComponentDto> queryReportCustomComponents(@RequestBody ReportCustomComponentDto reportCustomComponentDto) {
 
         //鏍¢獙鏄惁浼犱簡 鍒嗛〉淇℃伅
 
@@ -77,13 +77,31 @@
         }
 
         List<ReportCustomComponentDto> reportCustomComponents = BeanConvertUtil.covertBeanList(reportCustomComponentV1ServiceDaoImpl.getReportCustomComponentInfo(BeanConvertUtil.beanCovertMap(reportCustomComponentDto)), ReportCustomComponentDto.class);
-
+        desCode(reportCustomComponents);
         return reportCustomComponents;
     }
 
 
     @Override
     public int queryReportCustomComponentsCount(@RequestBody ReportCustomComponentDto reportCustomComponentDto) {
-        return reportCustomComponentV1ServiceDaoImpl.queryReportCustomComponentsCount(BeanConvertUtil.beanCovertMap(reportCustomComponentDto));    }
+        return reportCustomComponentV1ServiceDaoImpl.queryReportCustomComponentsCount(BeanConvertUtil.beanCovertMap(reportCustomComponentDto));
+    }
+
+    private void desCode(List<ReportCustomComponentDto> reportCustomComponentDtos) {
+        if (reportCustomComponentDtos == null || reportCustomComponentDtos.size() < 1) {
+            return;
+        }
+        for (ReportCustomComponentDto reportCustomComponentDto : reportCustomComponentDtos) {
+            try {
+                if (!StringUtil.isEmpty(reportCustomComponentDto.getComponentSql())) {
+                    reportCustomComponentDto.setComponentSql(new String(Base64Convert.base64ToByte(reportCustomComponentDto.getComponentSql()), "UTF-8"));
+                }
+                if (!StringUtil.isEmpty(reportCustomComponentDto.getJavaScript())) {
+                    reportCustomComponentDto.setJavaScript(new String(Base64Convert.base64ToByte(reportCustomComponentDto.getJavaScript()), "UTF-8"));
+                }
+            } catch (Exception e) {
+            }
+        }
+    }
 
 }

--
Gitblit v1.8.0