From 37bb2aac6fe2d856f06ff447d26163422c56024a Mon Sep 17 00:00:00 2001
From: guoyujie <guoyujie@ng.com>
Date: 星期一, 10 十一月 2025 11:22:19 +0800
Subject: [PATCH] 提交 文件上传代码

---
 north-glass-erp/src/main/java/com/example/erp/controller/sd/OrderFileController.java |   32 ++
 north-glass-erp/northglass-erp/src/components/pp/PrintProcess.vue                    |   22 +
 north-glass-erp/src/main/java/com/example/erp/mapper/sd/OrderFileMapper.java         |    9 
 north-glass-erp/northglass-erp/src/components/sd/order/UpdateAlienEditor.vue         |   10 
 north-glass-erp/northglass-erp/src/components/sd/order/UploadPicture.vue             |  443 +++++++++++++++++++++++++++++++--
 north-glass-erp/src/main/java/com/example/erp/ErpApplication.java                    |    2 
 /dev/null                                                                            |   11 
 north-glass-erp/northglass-erp/src/views/sd/order/CreateOrder.vue                    |   19 +
 north-glass-erp/src/main/resources/application.yml                                   |    4 
 north-glass-erp/northglass-erp/public/config.js                                      |    2 
 north-glass-erp/northglass-erp/src/components/sd/order/PrintSheet4.vue               |    1 
 north-glass-erp/src/main/java/com/example/erp/service/sd/OrderFileService.java       |  101 +++++++
 north-glass-erp/northglass-erp/src/utils/requestByFile.js                            |   56 ++++
 north-glass-erp/pom.xml                                                              |   33 +-
 north-glass-erp/src/main/java/com/example/erp/entity/sd/OrderFile.java               |   22 +
 north-glass-erp/src/main/java/com/example/erp/controller/pp/ReportController.java    |    1 
 16 files changed, 692 insertions(+), 76 deletions(-)

diff --git a/north-glass-erp/northglass-erp/public/config.js b/north-glass-erp/northglass-erp/public/config.js
index ff80fc1..6757edf 100644
--- a/north-glass-erp/northglass-erp/public/config.js
+++ b/north-glass-erp/northglass-erp/public/config.js
@@ -1,4 +1,4 @@
-const ip = 'localhost'
+const ip = '10.153.19.4'
 
 window.ipConfig = {
     serverUrl:`${ip}:8086`,
diff --git a/north-glass-erp/northglass-erp/src/components/pp/PrintProcess.vue b/north-glass-erp/northglass-erp/src/components/pp/PrintProcess.vue
index 29e5774..f401849 100644
--- a/north-glass-erp/northglass-erp/src/components/pp/PrintProcess.vue
+++ b/north-glass-erp/northglass-erp/src/components/pp/PrintProcess.vue
@@ -76,7 +76,9 @@
 let printNumberFc = props.printFc
 data.value.printList = JSON.parse(props.printList)
 let flowCardCount = ''
+const picture = ref([])
 onMounted(() => {
+      //鍒ゆ柇鏄惁鏄伐绋嬫墦鍗�
       if(props.printProject!=null){
         request.post(`/processCard/getSelectPrintProject/${printProject}/${merges}/${props.flashback}/${props.landingSequence}`).then((res) => {
           if (res.code == 200) {
@@ -87,6 +89,7 @@
           }
         })
       }else{
+        //娴佺▼鍗�
         request.post(`/processCard/getSelectPrinting/${merge}/${like}/${merges}/${props.flashback}/${compound}/${props.landingSequence}`, data.value).then((res) => {
           if (res.code == 200) {
             load(res.data.data)
@@ -94,6 +97,10 @@
             ElMessage.warning(res.msg)
             router.push("/login")
           }
+        })
+        //璁㈠崟搴忓彿dwg鍥剧墖鏌ヨ
+        request.post("/orderFile/getOrderFilePicture", data.value.printList).then((res) => {
+          picture.value = res.data
         })
       }
 
@@ -292,7 +299,7 @@
               鎵撳嵃浜猴細{{user.user.userName}} &nbsp;&nbsp;
               鏃堕棿锛歿{formattedTime}}
               &nbsp;&nbsp;
-              <span style="font-weight: bolder;" v-if="name=='閲戝崕绂忓枩澶╂垚鐜荤拑鏈夐檺鍏徃'">
+              <span style="font-weight: bolder;" >
                 鎵撳嵃鎬绘暟閲忥細{{totalQuantity}}
               鎵撳嵃鎬婚潰绉細{{totalArea}}
               </span>
@@ -453,7 +460,14 @@
       </tr>
       </tfoot>
     </table>
-
+    <el-image
+        class="picture"
+        v-for="(item,index) in picture"
+        :src="item.imageBase64"
+        :preview-src-list="[item.imageBase64]"
+        fit="contain"
+        style="max-height: 700px;"
+    />
   </div>
 
 </template>
@@ -545,6 +559,8 @@
   width: 100%;
   height: 100%;
 }
-
+.picture{
+  page-break-before: always;
+}
 
 </style>
\ No newline at end of file
diff --git a/north-glass-erp/northglass-erp/src/components/sd/order/PrintSheet4.vue b/north-glass-erp/northglass-erp/src/components/sd/order/PrintSheet4.vue
index 7ae898c..bc33f26 100644
--- a/north-glass-erp/northglass-erp/src/components/sd/order/PrintSheet4.vue
+++ b/north-glass-erp/northglass-erp/src/components/sd/order/PrintSheet4.vue
@@ -38,7 +38,6 @@
 })
 const getData = () => {
   request.get(`/order/printOrderProductDetail/${props.orderId}/${selectedValues.value}`).then(res => {
-    console.log(res.data)
     data.value= res.data
     productIdData.value=data.value.orderProductDetail
     data.value.orderProductDetail.forEach(item => {
diff --git a/north-glass-erp/northglass-erp/src/components/sd/order/UpdateAlienEditor.vue b/north-glass-erp/northglass-erp/src/components/sd/order/UpdateAlienEditor.vue
index f68c05c..e7849b4 100644
--- a/north-glass-erp/northglass-erp/src/components/sd/order/UpdateAlienEditor.vue
+++ b/north-glass-erp/northglass-erp/src/components/sd/order/UpdateAlienEditor.vue
@@ -40,7 +40,7 @@
 const emits = defineEmits(['getUploadPicture'])
 
 let fileName=ref(null)
-let fileDate=ref(null)
+let fileData=ref(null)
 let fileJson=ref({
   quadrilateral:null,
   polygon:null
@@ -638,7 +638,7 @@
   const base64 = await fileToBase64(blob);
   if(value===1){
     fileName.value="map.dxf"
-    fileDate.value=base64.replace(/^data:.+;base64,/, "")
+    fileData.value=base64.replace(/^data:.+;base64,/, "")
   }
   else if(value===2&&state.value){
     saveAs(blob, 'map.dxf');
@@ -689,7 +689,7 @@
         handleFileUpload()
 
         fileName.value=file.name
-        fileDate.value=base64.replace(/^data:.+;base64,/, "")
+        fileData.value=base64.replace(/^data:.+;base64,/, "")
       } catch (error) {
         console.error('瑙f瀽DXF鏂囦欢鏃跺嚭閿�:', error);
       }
@@ -1025,13 +1025,13 @@
 
 //淇濆瓨鏂规硶
 const save =  () => {
-  if(fileName.value!=null&&fileDate.value!=null){
+  if(fileName.value!=null&&fileData.value!=null){
     fileJson.value.quadrilateral=[parseInt(data5.value),parseInt(data6.value),parseInt(data1.value),parseInt(data2.value),
       parseInt(data3.value),parseInt(data4.value),parseInt(data7.value),parseInt(data8.value)]
     if(fileJson.value.quadrilateral==null&&fileJson.value.polygon==null){
       fileJson.value=null
     }
-    emits('getUploadPicture', fileName.value,fileDate.value,fileJson.value)
+    emits('getUploadPicture', fileName.value,fileData.value,fileJson.value)
   }else{
     ElMessage.warning("鏈弬涓庝慨鏀�")
 
diff --git a/north-glass-erp/northglass-erp/src/components/sd/order/UploadPicture.vue b/north-glass-erp/northglass-erp/src/components/sd/order/UploadPicture.vue
index dac7efb..36e5585 100644
--- a/north-glass-erp/northglass-erp/src/components/sd/order/UploadPicture.vue
+++ b/north-glass-erp/northglass-erp/src/components/sd/order/UploadPicture.vue
@@ -1,46 +1,423 @@
-<script setup lang="ts">
-import { ref } from 'vue'
-import type { UploadProps, UploadUserFile } from 'element-plus'
-const fileList = ref<UploadUserFile[]>([])
-const upload = ref()
+<script setup>
+import { ref, reactive, onMounted } from 'vue'
+import {
+  Document, UploadFilled, MagicStick, RefreshLeft,
+  Download, Plus, Picture, Refresh
+} from '@element-plus/icons-vue'
+import { ElMessage, ElMessageBox } from 'element-plus'
+import request from "@/utils/requestByFile"
 
-const emits = defineEmits(['getUploadPicture'])
+const uploadRef = ref()
+const fileList = ref([])
+const converting = ref(false)
+const progressPercentage = ref(0)
+const progressStatus = ref('')
+const progressText = ref('')
+const conversionResult = ref(null)
+const supportedFormats = ref(['png', 'jpg', 'jpeg', 'bmp'])
+const loadingFormats = ref(false)
+let props = defineProps({
+  rowIndex:null,
+  orderId:null
+})
 
-const handleRemove: UploadProps['onRemove'] = (uploadFile, uploadFiles) => {
-  console.log(uploadFile, uploadFiles)
+const form = reactive({
+  format: 'png'
+})
+
+onMounted(() => {
+  //loadSupportedFormats()
+})
+
+
+
+const loadSupportedFormats = async () => {
+  try {
+    if (fileList.value.length === 0) {
+      ElMessage.warning('璇峰厛閫夋嫨瑕佷笂浼犵殑DWG鏂囦欢')
+      return
+    }
+    loadingFormats.value = true
+
+    converting.value = true
+    progressPercentage.value = 0
+    progressStatus.value = ''
+    progressText.value = '鍑嗗涓婁紶...'
+
+    // 妯℃嫙杩涘害鏇存柊
+    const progressInterval = setInterval(() => {
+      if (progressPercentage.value < 80) {
+        progressPercentage.value += 10
+        progressText.value = `涓婁紶涓�... ${progressPercentage.value}%`
+      }
+    }, 500)
+
+
+    const data ={
+      file:fileList.value[0].raw
+    }
+    request.post(`/orderFile/updateOrderFileByOrderNumber/${props.orderId}/${props.rowIndex.orderNumber}`,data).then(res=>{
+      if (res.code === '200') {
+        conversionResult.value = res.data
+        uploadRef.value.clearFiles()
+        clearInterval(progressInterval)
+        progressPercentage.value = 100
+        progressStatus.value = 'success'
+        progressText.value = '涓婁紶瀹屾垚!'
+        uploadRef.value.clearFiles()
+        fileList.value = []
+        setTimeout(() => {
+
+          converting.value = false
+        },2000)
+      }
+    })
+  } catch (error) {
+    console.error('淇濆瓨澶辫触:', error)
+  } finally {
+    loadingFormats.value = false
+  }
 }
 
-const handlePreview: UploadProps['onPreview'] = (file) => {
-  console.log(file)
-}
-const handleChange = (uploadFile, uploadFiles) => {
-  emits('getUploadPicture', uploadFile.name,uploadFile)
-  upload.value.clearFiles()
+
+
+
+
+const handleFileChange = (file) => {
+  if (!(file.raw.name.toLowerCase().endsWith('.dwg') || file.raw.name.toLowerCase().endsWith('.dxf'))) {
+    ElMessage.error('璇烽�夋嫨DWG鎴朌XF鏍煎紡鐨勬枃浠�')
+    uploadRef.value.clearFiles()
+    return
+  }
+
+  if (file.raw.size > 50 * 1024 * 1024) {
+    ElMessage.error('鏂囦欢澶у皬涓嶈兘瓒呰繃50MB')
+    uploadRef.value.clearFiles()
+    return
+  }
+  fileList.value = [file]
+  ElMessage.success(`宸查�夋嫨鏂囦欢: ${file.name}`)
 }
 
+const handleFileRemove = () => {
+  conversionResult.value = null
+  uploadRef.value.clearFiles()
+}
+
+/*const handleConvert = async () => {
+  if (fileList.value.length === 0) {
+    ElMessage.warning('璇峰厛閫夋嫨瑕佷笂浼犵殑DWG鏂囦欢')
+    return
+  }
+
+  if (!form.format) {
+    ElMessage.warning('璇烽�夋嫨杈撳嚭鏍煎紡')
+    return
+  }
+
+  try {
+    converting.value = true
+    progressPercentage.value = 0
+    progressStatus.value = ''
+    progressText.value = '鍑嗗杞崲...'
+
+    // 妯℃嫙杩涘害鏇存柊
+    const progressInterval = setInterval(() => {
+      if (progressPercentage.value < 80) {
+        progressPercentage.value += 10
+        progressText.value = `杞崲涓�... ${progressPercentage.value}%`
+      }
+    }, 500)
+
+    const file = fileList.value[0].raw
+    //const response = await cadApi.convertDwgToImage(file, form.format)
+    const response = null
+    clearInterval(progressInterval)
+    progressPercentage.value = 100
+    progressStatus.value = 'success'
+    progressText.value = '杞崲瀹屾垚!'
+
+    conversionResult.value = response.data
+
+    ElMessage.success('鏂囦欢杞崲鎴愬姛!')
+
+  } catch (error) {
+    progressStatus.value = 'exception'
+    progressText.value = '杞崲澶辫触'
+    console.error('杞崲澶辫触:', error)
+  } finally {
+    converting.value = false
+  }
+}*/
+
+const handleDownload = () => {
+  if (!conversionResult.value) return
+
+  const link = document.createElement('a')
+  link.href = conversionResult.value.imageData
+  link.download = conversionResult.value.fileName
+  document.body.appendChild(link)
+  link.click()
+  document.body.removeChild(link)
+
+  ElMessage.success('鏂囦欢涓嬭浇寮�濮�')
+}
+
+const handleNewConversion = () => {
+  ElMessageBox.confirm('鏄惁寮�濮嬫柊鐨勬枃浠朵笂浼�?', '鎻愮ず', {
+    confirmButtonText: '纭畾',
+    cancelButtonText: '鍙栨秷',
+    type: 'warning',
+  }).then(() => {
+    handleReset()
+    ElMessage.success('宸查噸缃紝鍙互寮�濮嬫柊鐨勪笂浼�')
+  })
+}
+
+const handleReset = () => {
+  uploadRef.value.clearFiles()
+  fileList.value = []
+  conversionResult.value = null
+  progressPercentage.value = 0
+  progressStatus.value = ''
+  progressText.value = ''
+  form.format = 'png'
+}
+
+const formatFileSize = (bytes) => {
+  if (bytes === 0) return '0 Bytes'
+  const k = 1024
+  const sizes = ['Bytes', 'KB', 'MB', 'GB']
+  const i = Math.floor(Math.log(bytes) / Math.log(k))
+  return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i]
+}
 </script>
-
 <template>
-  <el-upload
-      v-model:file-list="fileList"
-      ref="upload"
-      class="upload-demo"
-      action="https://run.mocky.io/v3/9d059bf9-4660-45f2-925d-ce80ad6c4d15"
-      :on-preview="handlePreview"
-      :on-remove="handleRemove"
-      :on-change="handleChange"
-      list-type="picture"
-      :auto-upload="false"
-  >
-    <el-button type="primary">Click to upload</el-button>
-    <template #tip>
-      <div class="el-upload__tip">
-        DWG files with a size less than 10M
+  <div class="file-upload-container">
+    <el-card class="upload-card" shadow="hover">
+      <template #header>
+        <div class="card-header">
+          <span class="header-title">
+            <el-icon><Document /></el-icon>
+            DWG鏂囦欢涓婁紶
+          </span>
+        </div>
+      </template>
+
+      <!-- 鏂囦欢涓婁紶鍖哄煙 -->
+      <el-upload
+          ref="uploadRef"
+          class="upload-demo"
+          drag
+          action=""
+          :auto-upload="false"
+          :on-change="handleFileChange"
+          :on-remove="handleFileRemove"
+          :file-list="fileList"
+          :limit="1"
+          :accept="'.dwg' || '.dxf' "
+          :disabled="converting"
+      >
+        <el-icon class="el-icon--upload"><UploadFilled /></el-icon>
+        <div class="el-upload__text">
+          鎷栨嫿DWG鏂囦欢鍒版澶勬垨 <em>鐐瑰嚮閫夋嫨鏂囦欢</em>
+        </div>
+        <template #tip>
+          <div class="el-upload__tip">
+            浠呮敮鎸� .dwg 鏍煎紡鏂囦欢锛屼笖鏂囦欢澶у皬涓嶈秴杩�50MB
+          </div>
+        </template>
+      </el-upload>
+
+      <!-- 涓婁紶閫夐」 -->
+      <div  class="conversion-options">
+
+        <div class="action-buttons">
+          <el-button
+              type="primary"
+              :loading="converting"
+              @click="loadSupportedFormats"
+              :disabled="!form.format"
+          >
+            <template #icon>
+              <el-icon><MagicStick /></el-icon>
+            </template>
+            淇濆瓨
+          </el-button>
+
+          <el-button @click="handleReset"
+                     :loading="converting">
+            <template #icon>
+              <el-icon><RefreshLeft /></el-icon>
+            </template>
+            閲嶇疆
+          </el-button>
+        </div>
       </div>
-    </template>
-  </el-upload>
+
+      <!-- 杞崲杩涘害 -->
+      <div v-if="converting" class="conversion-progress">
+        <el-divider content-position="left">涓婁紶杩涘害</el-divider>
+        <el-progress
+            :percentage="progressPercentage"
+            :status="progressStatus"
+            :stroke-width="8"
+        />
+        <div class="progress-text">
+          {{ progressText }}
+        </div>
+      </div>
+
+      <!-- 杞崲缁撴灉 -->
+      <div v-if="conversionResult" class="conversion-result">
+        <el-divider content-position="left">涓婁紶缁撴灉</el-divider>
+
+        <el-result
+            icon="success"
+            :sub-title="`鏂囦欢宸叉垚鍔熻浆鏍煎紡`"
+        >
+          <template #extra>
+            <div class="result-content">
+              <!-- 鍥剧墖棰勮 -->
+              <div class="image-preview">
+                <el-image
+                    :src="conversionResult"
+                    :preview-src-list="[conversionResult]"
+                    fit="contain"
+                    style="max-height: 600px;"
+                >
+<!--                  <template #error>-->
+<!--                    <div class="image-slot">-->
+<!--                      <el-icon><Picture /></el-icon>-->
+<!--                      <div>鍥剧墖鍔犺浇澶辫触</div>-->
+<!--                    </div>-->
+<!--                  </template>-->
+                </el-image>
+              </div>
+
+
+
+              <!-- 鎿嶄綔鎸夐挳 -->
+<!--              <div class="result-actions">
+                <el-button
+                    type="primary"
+                    @click="handleDownload"
+                    :icon="Download"
+                >
+                  涓嬭浇鍥剧墖
+                </el-button>
+                <el-button
+                    @click="handleNewConversion"
+                    :icon="Plus"
+                >
+                  鏂扮殑涓婁紶
+                </el-button>
+              </div>-->
+            </div>
+          </template>
+        </el-result>
+      </div>
+    </el-card>
+  </div>
 </template>
 
-<style scoped>
 
+
+<style scoped>
+.file-upload-container {
+  max-width: 800px;
+  margin: 0 auto;
+  padding: 20px;
+}
+
+.upload-card {
+  min-height: 600px;
+}
+
+.card-header {
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+}
+
+.header-title {
+  display: flex;
+  align-items: center;
+  gap: 8px;
+  font-size: 18px;
+  font-weight: bold;
+}
+
+:deep(.upload-demo) {
+  width: 100%;
+}
+
+:deep(.el-upload-dragger) {
+  width: 100%;
+  padding: 40px;
+}
+
+.conversion-options {
+  margin-top: 20px;
+}
+
+.action-buttons {
+  display: flex;
+  gap: 12px;
+  justify-content: center;
+  margin-top: 20px;
+}
+
+.conversion-progress {
+  margin-top: 20px;
+}
+
+.progress-text {
+  text-align: center;
+  margin-top: 8px;
+  color: #666;
+  font-size: 14px;
+}
+
+.conversion-result {
+  margin-top: 20px;
+}
+
+.result-content {
+  text-align: center;
+}
+
+.image-preview {
+  margin: 20px 0;
+  display: flex;
+  justify-content: center;
+}
+
+.file-info {
+  margin: 20px 0;
+  max-width: 400px;
+  margin-left: auto;
+  margin-right: auto;
+}
+
+.result-actions {
+  display: flex;
+  gap: 12px;
+  justify-content: center;
+  margin-top: 20px;
+}
+
+.image-slot {
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  justify-content: center;
+  height: 200px;
+  color: #909399;
+}
+
+.image-slot .el-icon {
+  font-size: 48px;
+  margin-bottom: 16px;
+}
 </style>
\ No newline at end of file
diff --git a/north-glass-erp/northglass-erp/src/utils/requestByFile.js b/north-glass-erp/northglass-erp/src/utils/requestByFile.js
new file mode 100644
index 0000000..743318b
--- /dev/null
+++ b/north-glass-erp/northglass-erp/src/utils/requestByFile.js
@@ -0,0 +1,56 @@
+import axios from 'axios'
+import useUserInfoStore from '@/stores/userInfo'
+const userStore=useUserInfoStore()
+const request = axios.create({
+    baseURL: `http://${window.ipConfig.serverUrl}`,  // 娉ㄦ剰锛侊紒 杩欓噷鏄叏灞�缁熶竴鍔犱笂浜� 鍚庣鎺ュ彛鍓嶇紑 鍓嶇紑锛屽悗绔繀椤昏繘琛岃法鍩熼厤缃紒
+    timeout: 60000
+})
+
+//
+
+// request 鎷︽埅鍣�
+// 鍙互鑷姹傚彂閫佸墠瀵硅姹傚仛涓�浜涘鐞�
+// 姣斿缁熶竴鍔爐oken锛屽璇锋眰鍙傛暟缁熶竴鍔犲瘑
+request.interceptors.request.use(config => {
+    config.headers['Content-Type'] = 'multipart/form-data';
+    if(userStore.user){
+        config.headers['satoken'] = localStorage.getItem('saToken');
+    }
+    // 璁剧疆璇锋眰澶�
+    return config
+}, error => {
+    return Promise.reject(error)
+});
+
+// response 鎷︽埅鍣�
+// 鍙互鍦ㄦ帴鍙e搷搴斿悗缁熶竴澶勭悊缁撴灉
+request.interceptors.response.use(
+    response => {
+        let res = response.data
+        //浼犻�掓姤閿欎俊鎭紝鎶婃姤閿欎俊鎭紶閫掑埌pinia涓�
+        userStore.setResponseCode(parseInt(res.code),res.msg)
+        if(res.code!=='200' ){
+            if(response.config.responseType !== 'blob'){
+                return Promise.reject(res.code)
+            }
+        }
+
+        // 濡傛灉鏄繑鍥炵殑鏂囦欢
+        if (response.config.responseType === 'blob') {
+            return res
+        }
+        // 鍏煎鏈嶅姟绔繑鍥炵殑瀛楃涓叉暟鎹�
+        if (typeof res === 'string') {
+            res = res ? JSON.parse(res) : res
+        }
+        return res;
+    },
+    error => {
+        console.log('err' + error) // for debug
+        return Promise.reject(error)
+    }
+)
+
+
+export default request
+
diff --git a/north-glass-erp/northglass-erp/src/views/sd/order/CADDraw.vue b/north-glass-erp/northglass-erp/src/views/sd/order/CADDraw.vue
deleted file mode 100644
index 222532e..0000000
--- a/north-glass-erp/northglass-erp/src/views/sd/order/CADDraw.vue
+++ /dev/null
@@ -1,11 +0,0 @@
-<script setup lang="ts">
-import { MlCadViewer } from '@mlightcad/cad-viewer'
-</script>
-
-<template>
-  <MlCadViewer locale="zh" url="Drawing1.dwg" />
-</template>
-
-<style scoped>
-
-</style>
\ No newline at end of file
diff --git a/north-glass-erp/northglass-erp/src/views/sd/order/CreateOrder.vue b/north-glass-erp/northglass-erp/src/views/sd/order/CreateOrder.vue
index 710310f..bdf6b29 100644
--- a/north-glass-erp/northglass-erp/src/views/sd/order/CreateOrder.vue
+++ b/north-glass-erp/northglass-erp/src/views/sd/order/CreateOrder.vue
@@ -1950,7 +1950,7 @@
           style="width: 100%;height: 100%" />
     </el-dialog>
 <!--寮傚舰瀵煎叆-->
-    <el-dialog v-model="alienEditorVisible"
+<!--    <el-dialog v-model="alienEditorVisible"
                :title="$t('')"
                :close-on-click-modal="false"
                :close-on-press-escape="false"
@@ -1961,7 +1961,7 @@
           :rowIndex="rowIndex"
           @getUploadPicture="getUploadPicture"
           style="width: 100%;height: 100%" />
-    </el-dialog>
+    </el-dialog>-->
 
 <!--    灏哄瀹℃牳绐楀彛-->
     <el-dialog
@@ -1997,10 +1997,14 @@
       <order-number-report-transfer :transferData="transferData" @orderNumberTransfer="orderNumberTransfer"/>
     </el-dialog>
 
-    <el-dialog v-model="uploadPictureVisible"
+    <el-dialog id="loadDWG"
+               v-model="alienEditorVisible"
                :close-on-click-modal="false"
-               destroy-on-close width="500">
-      <upload-picture  />
+               destroy-on-close width="800px">
+      <upload-picture
+          :rowIndex="rowIndex"
+          :orderId="titleUploadData.orderId"
+      />
     </el-dialog>
 
 
@@ -2051,4 +2055,9 @@
     /*flex-direction : row;
     justify-content: space-between;*/
   }
+
+  :deep(#loadDWG .el-dialog__body){
+    height: 70vh;
+    overflow-y: auto;
+  }
 </style>
\ No newline at end of file
diff --git a/north-glass-erp/pom.xml b/north-glass-erp/pom.xml
index 5f16c15..c471e60 100644
--- a/north-glass-erp/pom.xml
+++ b/north-glass-erp/pom.xml
@@ -161,7 +161,16 @@
             <version>6.1.5.Final</version>
         </dependency>
 
+        <dependency>
+            <groupId>com.aspose</groupId>
+            <artifactId>aspose-cad</artifactId>
+            <version>23.9</version>
+        </dependency>
+
+
     </dependencies>
+
+
 
     <build>
         <plugins>
@@ -181,19 +190,15 @@
     </build>
 
 
-<!--    <repositories>-->
-<!--        <repository>-->
-<!--            <id>nexus-aliyun</id>-->
-<!--            <name>nexus-aliyun</name>-->
-<!--            <url>http://maven.aliyun.com/nexus/content/groups/public/</url>-->
-<!--            <releases>-->
-<!--                <enabled>true</enabled>-->
-<!--            </releases>-->
-<!--            <snapshots>-->
-<!--                <enabled>false</enabled>-->
-<!--            </snapshots>-->
-<!--        </repository>-->
-<!--    </repositories>-->
+    <repositories>
+        <repository>
+            <id>aspose-maven-repository</id>
+            <url>https://releases.aspose.com/java/repo</url>
+            <snapshots>
+                <enabled>false</enabled>
+            </snapshots>
+        </repository>
+    </repositories>
 
 <!--    <pluginRepositories>-->
 <!--        <pluginRepository>-->
@@ -208,4 +213,4 @@
 <!--            </snapshots>-->
 <!--        </pluginRepository>-->
 <!--    </pluginRepositories>-->
-</project>
\ No newline at end of file
+</project>
diff --git a/north-glass-erp/src/main/java/com/example/erp/ErpApplication.java b/north-glass-erp/src/main/java/com/example/erp/ErpApplication.java
index 7c4967c..984e298 100644
--- a/north-glass-erp/src/main/java/com/example/erp/ErpApplication.java
+++ b/north-glass-erp/src/main/java/com/example/erp/ErpApplication.java
@@ -1,11 +1,9 @@
 package com.example.erp;
 
-import com.example.erp.tools.netty.NettyServer;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.cache.annotation.EnableCaching;
 import org.springframework.transaction.annotation.EnableTransactionManagement;
-import org.springframework.transaction.annotation.Transactional;
 
 //springboot 鍚姩鍏ュ彛
 @SpringBootApplication
diff --git a/north-glass-erp/src/main/java/com/example/erp/controller/pp/ReportController.java b/north-glass-erp/src/main/java/com/example/erp/controller/pp/ReportController.java
index 7af6750..411f170 100644
--- a/north-glass-erp/src/main/java/com/example/erp/controller/pp/ReportController.java
+++ b/north-glass-erp/src/main/java/com/example/erp/controller/pp/ReportController.java
@@ -40,7 +40,6 @@
         return Result.success(reportService.processCardProgressReportSv(orderId, columns));
     }
     @ApiOperation("娴佺▼鍗¤繘搴︽眹鎬�")
-    @SaCheckPermission("selectOrder.search")
     @PostMapping("/processCardProgressCollect/{orderId}")
     public Result processCardProgressCollect(@PathVariable String orderId, @RequestBody List<String> columns) {
         return Result.success(reportService.processCardProgressCollectSv(orderId, columns));
diff --git a/north-glass-erp/src/main/java/com/example/erp/controller/sd/OrderFileController.java b/north-glass-erp/src/main/java/com/example/erp/controller/sd/OrderFileController.java
new file mode 100644
index 0000000..f07cd86
--- /dev/null
+++ b/north-glass-erp/src/main/java/com/example/erp/controller/sd/OrderFileController.java
@@ -0,0 +1,32 @@
+package com.example.erp.controller.sd;
+
+import com.aspose.cad.internal.V.S;
+import com.example.erp.common.Result;
+import com.example.erp.entity.sd.OrderDetail;
+import com.example.erp.service.sd.OrderFileService;
+import io.swagger.annotations.Api;
+import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+
+@RestController
+@Api(value="璁㈠崟鏂囦欢controller",tags={"璁㈠崟鏂囦欢鎿嶄綔鎺ュ彛"})
+@RequestMapping("/orderFile")
+@RequiredArgsConstructor
+public class OrderFileController {
+    private final OrderFileService orderFileService;
+
+    @PostMapping("/updateOrderFileByOrderNumber/{orderId}/{orderNumber}")
+    public Result updateOrderFileByOrderNumber(@RequestParam("file") MultipartFile file, @PathVariable String orderId, @PathVariable String orderNumber) throws IOException {
+
+        return  Result.success(orderFileService.updateOrderFileByOrderNumber(file,orderId,orderNumber));
+    }
+    @PostMapping("/getOrderFilePicture")
+    public Result getOrderFilePicture(@RequestBody List<Map<String,Object>> orderDetails) throws NoSuchFieldException {
+        return Result.success(orderFileService.getOrderFilePicture(orderDetails));
+    }
+}
diff --git a/north-glass-erp/src/main/java/com/example/erp/entity/sd/OrderFile.java b/north-glass-erp/src/main/java/com/example/erp/entity/sd/OrderFile.java
new file mode 100644
index 0000000..ce2ca66
--- /dev/null
+++ b/north-glass-erp/src/main/java/com/example/erp/entity/sd/OrderFile.java
@@ -0,0 +1,22 @@
+package com.example.erp.entity.sd;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+
+@Data
+@TableName("sd.`order_file`")
+public class OrderFile {
+    @TableId(type = IdType.AUTO)
+    private  Integer id;
+    private  String orderId;
+    private  String orderNumber;
+    private  String fileName;
+    private  String fileData;
+    private  String imageBase64;
+    private LocalDateTime createTime;
+
+}
diff --git a/north-glass-erp/src/main/java/com/example/erp/mapper/sd/OrderFileMapper.java b/north-glass-erp/src/main/java/com/example/erp/mapper/sd/OrderFileMapper.java
new file mode 100644
index 0000000..d5141d0
--- /dev/null
+++ b/north-glass-erp/src/main/java/com/example/erp/mapper/sd/OrderFileMapper.java
@@ -0,0 +1,9 @@
+package com.example.erp.mapper.sd;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.example.erp.entity.sd.OrderFile;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface OrderFileMapper extends BaseMapper<OrderFile> {
+}
diff --git a/north-glass-erp/src/main/java/com/example/erp/service/sd/OrderFileService.java b/north-glass-erp/src/main/java/com/example/erp/service/sd/OrderFileService.java
new file mode 100644
index 0000000..5aa1675
--- /dev/null
+++ b/north-glass-erp/src/main/java/com/example/erp/service/sd/OrderFileService.java
@@ -0,0 +1,101 @@
+package com.example.erp.service.sd;
+
+import com.aspose.cad.Image;
+import com.aspose.cad.ImageOptionsBase;
+import com.aspose.cad.imageoptions.CadRasterizationOptions;
+import com.aspose.cad.imageoptions.PngOptions;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.example.erp.common.Result;
+import com.example.erp.entity.sd.OrderDetail;
+import com.example.erp.entity.sd.OrderFile;
+import com.example.erp.mapper.sd.OrderFileMapper;
+import lombok.RequiredArgsConstructor;
+import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.util.*;
+import java.util.stream.Collectors;
+
+@Service
+@RequiredArgsConstructor
+public class OrderFileService {
+    private final OrderFileMapper orderFileMapper;
+    public List<OrderFile> getOrderFilePicture(List<Map<String,Object>> orderDetails) throws NoSuchFieldException {
+        Set<String> seenKeys = new HashSet<>();
+        List<Map<String,Object>> result = new ArrayList<>();
+        // 閬嶅巻璁㈠崟璇︽儏鍒楄〃鍘婚噸
+        result = orderDetails.stream()
+                .collect(Collectors.collectingAndThen(
+                        Collectors.toMap(
+                                map -> map.get("order_id") + "_" + map.get("order_number"),
+                                map -> map,
+                                (existing, replacement) -> existing // 淇濈暀绗竴涓嚭鐜扮殑
+                        ),
+                        map -> new ArrayList<>(map.values())
+                ));
+        //寰幆鑾峰彇鍥剧墖
+        List<OrderFile> orderFiles = new ArrayList<>();
+        for (Map<String,Object> obj : result) {
+            OrderFile orderFile = orderFileMapper.selectOne(new QueryWrapper<OrderFile>()
+                    .select("order_id, order_number, image_base64")
+                    .eq("order_id", obj.get("order_id"))
+                    .eq("order_number", obj.get("order_number"))
+            );
+            if (orderFile != null){
+                orderFiles.add(orderFile);
+            }
+        }
+       return orderFiles;
+    }
+
+    public Object updateOrderFileByOrderNumber(MultipartFile file,String orderId,String orderNumber) throws IOException {
+
+        // 璋冪敤Image绫荤殑Load鏂规硶鏉ュ姞杞借緭鍏ョ殑DWG鏂囦欢銆�
+        Image image = Image.load(file.getInputStream());
+        // 鍒涘缓CadRasterizationOptions瀹炰緥浠ュ惎鐢–AD鏍呮牸鍖栭�夐」銆�
+        CadRasterizationOptions rasterizationOptions = new CadRasterizationOptions();
+        // 璁剧疆瀹藉害
+        rasterizationOptions.setPageWidth(1000);
+        // 璁剧疆楂樺害
+        rasterizationOptions.setPageHeight(1000);
+        // 璋冪敤杩欎釜setEmbedBackground鏂规硶鏉ヨ缃儗鏅壊鏄惁涓嶇瓑浜庤緭鍑烘牸寮忕殑榛樿鑳屾櫙鑹�
+        rasterizationOptions.setEmbedBackground(true);
+        // 涓虹敓鎴愮殑鍥惧儚鍒涘缓涓�涓狿ngOptions鐨勫疄渚嬶紝骞跺皢鍏跺垎閰嶇粰ImageOptionsBase绫荤殑瀹炰緥銆�
+        ImageOptionsBase options = new PngOptions();
+        // 璋冪敤 setVectorRasterizationOptions 鏂规硶鏉ュ畾涔夊厜鏍呭寲閫夐」
+        options.setVectorRasterizationOptions(rasterizationOptions);
+
+        // 淇濆瓨鍒板瓧鑺傛祦
+        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+        image.save(outputStream, options);
+        byte[] imageBytes = outputStream.toByteArray();
+        String base64 = "data:image/png;base64," + Base64.getEncoder().encodeToString(imageBytes);
+        OrderFile orderFile = new OrderFile();
+        orderFile.setImageBase64(base64);
+        orderFile.setFileName(file.getName());
+        orderFile.setOrderId(orderId);
+        orderFile.setOrderNumber(orderNumber);
+        orderFile.setFileData(Arrays.toString(file.getBytes()));
+
+        OrderFile orderFileExist = orderFileMapper
+                .selectOne(new LambdaQueryWrapper<OrderFile>()
+                        .eq(OrderFile::getOrderId, orderId)
+                        .eq(OrderFile::getOrderNumber, orderNumber)
+                );
+        if (orderFileExist == null) {
+            orderFileMapper.insert(orderFile);
+        }else {
+            orderFileMapper.update(orderFile,new LambdaUpdateWrapper<OrderFile>()
+                    .eq(OrderFile::getOrderId, orderId)
+                    .eq(OrderFile::getOrderNumber, orderNumber)
+            );
+        }
+
+
+        return base64;
+    }
+}
diff --git a/north-glass-erp/src/main/resources/application.yml b/north-glass-erp/src/main/resources/application.yml
index 48f46c8..8fb4378 100644
--- a/north-glass-erp/src/main/resources/application.yml
+++ b/north-glass-erp/src/main/resources/application.yml
@@ -14,6 +14,10 @@
 spring:
 #  profiles:
 #    active: prod
+  servlet:
+    multipart:
+      max-file-size: 50MB
+      max-request-size: 50MB
   datasource:
     dynamic:
       primary: user_info #璁剧疆榛樿鐨勬暟鎹簮鎴栬�呮暟鎹簮缁�,榛樿鍊煎嵆涓簃aster

--
Gitblit v1.8.0