From e6353524bed0f4b50284ca49c133d52c615fb361 Mon Sep 17 00:00:00 2001
From: YYC <1833023622@qq.com>
Date: 星期二, 15 八月 2023 18:57:05 +0800
Subject: [PATCH] 设备管理优化

---
 igds-manager/src/main/java/com/ld/igds/oa/view/DeptDevice.view.xml        |   77 +++++++++++++++++++++++++++++---------
 igds-manager/src/main/java/com/ld/igds/oa/service/HDeptDeviceService.java |    8 ++++
 igds-manager/src/main/java/com/ld/igds/oa/view/OfficeAutoPR.java          |   24 +++++++++--
 3 files changed, 85 insertions(+), 24 deletions(-)

diff --git a/igds-manager/src/main/java/com/ld/igds/oa/service/HDeptDeviceService.java b/igds-manager/src/main/java/com/ld/igds/oa/service/HDeptDeviceService.java
index 16c11a5..37a7a54 100644
--- a/igds-manager/src/main/java/com/ld/igds/oa/service/HDeptDeviceService.java
+++ b/igds-manager/src/main/java/com/ld/igds/oa/service/HDeptDeviceService.java
@@ -77,7 +77,15 @@
     public String delData(DeptDevice data) {
         Session session = this.getSessionFactory().openSession();
         try {
+            Map<String, Object> param = new HashMap<>();
+            param.put("code", data.getSbbh());
+            List<DeviceCheckup> list = this.listCheck(param);
+            for (DeviceCheckup checkup : list) {
+                session.delete(checkup);
+            }
             session.delete(data);
+        } catch (Exception e) {
+            e.printStackTrace();
         } finally {
             session.flush();
             session.close();
diff --git a/igds-manager/src/main/java/com/ld/igds/oa/view/DeptDevice.view.xml b/igds-manager/src/main/java/com/ld/igds/oa/view/DeptDevice.view.xml
index c34851b..d005b9c 100644
--- a/igds-manager/src/main/java/com/ld/igds/oa/view/DeptDevice.view.xml
+++ b/igds-manager/src/main/java/com/ld/igds/oa/view/DeptDevice.view.xml
@@ -170,7 +170,8 @@
     </DataType>
   </Model>
   <View layout="regionPadding:10">
-    <ClientEvent name="onReady">view.get(&quot;#dsParam&quot;).insert({});</ClientEvent>
+    <ClientEvent name="onReady">view.get(&quot;#dsParam&quot;).insert({});&#xD;
+view.get(&quot;#dsParamCheck&quot;).insert({});</ClientEvent>
     <Property name="packages">font-awesome,css-common</Property>
     <DataSet id="dsMain">
       <Property name="dataType">[dtMain]</Property>
@@ -178,6 +179,9 @@
       <Property name="pageSize">15</Property>
     </DataSet>
     <DataSet id="dsParam">
+      <Property name="dataType">dtParam</Property>
+    </DataSet>
+    <DataSet id="dsParamCheck">
       <Property name="dataType">dtParam</Property>
     </DataSet>
     <DataSet id="dsCheck">
@@ -449,6 +453,7 @@
       <Property name="height">90%</Property>
       <Property name="caption">璁惧妫�淇褰�</Property>
       <Property name="closeable">false</Property>
+      <Property name="background">crey</Property>
       <Buttons>
         <Button layoutConstraint="center">
           <ClientEvent name="onClick">self.get(&quot;parent&quot;).hide();</ClientEvent>
@@ -459,8 +464,15 @@
       <Children>
         <Container layout="regionPadding:10" layoutConstraint="top">
           <Property name="exClassName">bg-color</Property>
-          <Button layoutConstraint="left">
-            <ClientEvent name="onClick">var data = view.get(&quot;#dsMain.data:#&quot;)&#xD;
+          <AutoForm>
+            <Property name="dataSet">dsParamCheck</Property>
+            <Property name="cols">*,*,*,*</Property>
+            <Property name="labelAlign">right</Property>
+            <Property name="labelSeparator">:</Property>
+            <Property name="labelWidth">140</Property>
+            <Container layout="regionPadding:10">
+              <Button layoutConstraint="left">
+                <ClientEvent name="onClick">var data = view.get(&quot;#dsMain.data:#&quot;)&#xD;
 view.get(&quot;#dsCheck&quot;).insert({&#xD;
 	sbbh:data.get(&quot;sbbh&quot;),&#xD;
 	kqdm:data.get(&quot;kqdm&quot;),&#xD;
@@ -469,19 +481,19 @@
 	sbyqdm:data.get(&quot;sbyqdm&quot;)&#xD;
 });&#xD;
 view.get(&quot;#addCheck&quot;).show();</ClientEvent>
-            <Property name="caption">鏂板</Property>
-            <Property name="exClassName">btn-normal</Property>
-            <Property name="iconClass">fa fa-plus</Property>
-          </Button>
-          <Button layoutConstraint="left">
-            <ClientEvent name="onClick">var dialog= view.get(&quot;#addCheck&quot;);&#xD;
+                <Property name="caption">鏂板</Property>
+                <Property name="exClassName">btn-normal</Property>
+                <Property name="iconClass">fa fa-plus</Property>
+              </Button>
+              <Button layoutConstraint="left">
+                <ClientEvent name="onClick">var dialog= view.get(&quot;#addCheck&quot;);&#xD;
 dialog.show();</ClientEvent>
-            <Property name="caption">缂栬緫</Property>
-            <Property name="exClassName">btn-warm</Property>
-            <Property name="iconClass">fa fa-pencil</Property>
-          </Button>
-          <Button layoutConstraint="left">
-            <ClientEvent name="onClick">var cur = view.get(&quot;#dsCheck.data:#&quot;);&#xD;
+                <Property name="caption">缂栬緫</Property>
+                <Property name="exClassName">btn-warm</Property>
+                <Property name="iconClass">fa fa-pencil</Property>
+              </Button>
+              <Button layoutConstraint="left">
+                <ClientEvent name="onClick">var cur = view.get(&quot;#dsCheck.data:#&quot;);&#xD;
 if(!cur) return;&#xD;
 view.get(&quot;#ajaxDelCheck&quot;).set(&quot;parameter&quot;,cur).execute(function(result){&#xD;
 	if(result){&#xD;
@@ -491,10 +503,37 @@
 		cur.remove();&#xD;
 	}&#xD;
 });</ClientEvent>
-            <Property name="caption">鍒犻櫎</Property>
-            <Property name="exClassName">btn-warn</Property>
-            <Property name="iconClass">fa fa-trash-o</Property>
-          </Button>
+                <Property name="caption">鍒犻櫎</Property>
+                <Property name="exClassName">btn-warn</Property>
+                <Property name="iconClass">fa fa-trash-o</Property>
+              </Button>
+            </Container>
+            <AutoFormElement>
+              <Property name="name">start</Property>
+              <Property name="property">start</Property>
+              <Editor/>
+            </AutoFormElement>
+            <AutoFormElement>
+              <Property name="name">end</Property>
+              <Property name="property">end</Property>
+              <Editor/>
+            </AutoFormElement>
+            <Container layout="regionPadding:10">
+              <Button layoutConstraint="left">
+                <ClientEvent name="onClick">var param = view.get(&quot;#dsParamCheck.data&quot;);&#xD;
+view.get(&quot;#dsCheck&quot;).set(&quot;parameter&quot;,param).flushAsync();</ClientEvent>
+                <Property name="caption">鏌ヨ</Property>
+                <Property name="exClassName">btn-normal</Property>
+                <Property name="iconClass">fa fa-search</Property>
+              </Button>
+              <Button layoutConstraint="left">
+                <ClientEvent name="onClick">view.get(&quot;#dsParamCheck&quot;).flushAsync();</ClientEvent>
+                <Property name="caption">閲嶇疆</Property>
+                <Property name="iconClass">fa fa-refresh</Property>
+                <Property name="exClassName">btn-default</Property>
+              </Button>
+            </Container>
+          </AutoForm>
         </Container>
         <Container layout="regionPadding:10" layoutConstraint="center">
           <Property name="exClassName">bg-color</Property>
diff --git a/igds-manager/src/main/java/com/ld/igds/oa/view/OfficeAutoPR.java b/igds-manager/src/main/java/com/ld/igds/oa/view/OfficeAutoPR.java
index ebb442d..a9e7d86 100644
--- a/igds-manager/src/main/java/com/ld/igds/oa/view/OfficeAutoPR.java
+++ b/igds-manager/src/main/java/com/ld/igds/oa/view/OfficeAutoPR.java
@@ -2,10 +2,9 @@
 
 import java.io.File;
 import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
+import java.util.*;
 
 import com.bstek.dorado.uploader.UploadFile;
 import com.bstek.dorado.uploader.annotation.FileResolver;
@@ -209,7 +208,22 @@
      * @return
      */
     @Expose
-    public String delArchives(OAArchives data) {
+    public String delArchives(OAArchives data) throws Exception {
+        List<FileInfo> list = data.getFileData();
+        if (list.isEmpty()) {
+            String fileId = list.get(0).getFileId();
+            Date createTime = list.get(0).getCreateTime();
+            if (null == createTime) createTime = new Date();
+
+            File file = new File(fileService.getCommonFilePath(createTime), fileId);
+
+            if (!file.exists()) {
+                return "鍒犻櫎澶辫触锛岀郴缁熸湭鎵惧埌褰撳墠闄勪欢";
+            }
+
+            file.delete();
+            fileService.delFile(fileId);
+        }
         return service.delArchives(data);
     }
 

--
Gitblit v1.9.3