jiangbiao 2 жил өмнө
parent
commit
88e988cd1c

+ 6 - 1
master/src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java

@@ -111,7 +111,7 @@ public class FileUploadUtils
 
         assertAllowed(file, allowedExtension);
 
-        String fileName = extractFilename(file);
+        String fileName = extractFilenameNoDateSeq(file);
 
         String absPath = getAbsoluteFile(baseDir, fileName).getAbsolutePath();
         file.transferTo(Paths.get(absPath));
@@ -127,6 +127,11 @@ public class FileUploadUtils
                 FilenameUtils.getBaseName(file.getOriginalFilename()), Seq.getId(Seq.uploadSeqType), getExtension(file));
     }
 
+    public static final String extractFilenameNoDateSeq(MultipartFile file)
+    {
+        return StringUtils.format("{}.{}", FilenameUtils.getBaseName(file.getOriginalFilename()), getExtension(file));
+    }
+
     public static final File getAbsoluteFile(String uploadDir, String fileName) throws IOException
     {
         File desc = new File(uploadDir + File.separator + fileName);

+ 6 - 0
master/src/main/java/com/ruoyi/project/base/controller/TBasePointController.java

@@ -72,6 +72,10 @@ public class TBasePointController extends BaseController {
     public TableDataInfo list(TBasePoint tBasePoint) {
         startPage();
         List<TBasePoint> list = tBasePointService.selectTBasePointList(tBasePoint);
+        list.forEach(item->{
+            item.setPicUrl(item.getPicUrl()+item.getPicNo());
+            item.setPidUrl(item.getPidUrl()+item.getPidNo());
+        });
         return getDataTable(list);
     }
 
@@ -183,6 +187,8 @@ public class TBasePointController extends BaseController {
     @Log(title = "密封点上传文件修改", businessType = BusinessType.UPDATE)
     public AjaxResult handleUpload(@RequestBody TBasePoint tBasePoint) {
         tBasePoint.setUpdaterCode(getUserId());
+        tBasePoint.setPicUrl("/profile/point/");
+        tBasePoint.setPidUrl("/profile/point/");
         if ((tBasePointService.updateTBasePointByUploadFile(tBasePoint) > 0))
             return AjaxResult.success();
         else

+ 4 - 4
ui/src/views/base/point/index.vue

@@ -268,24 +268,24 @@
       <el-table-column label="PID图号" align="center" prop="pidNo" :show-overflow-tooltip="true">
         <template slot-scope="scope">
           <el-button
-            v-if="scope.row.pidUrl"
             size="mini"
+            v-if="scope.row.pidNo"
             type="text"
             icon="el-icon-view"
             @click="handleSee(scope.row,true)"
-          >{{ $t('预览') }}
+          >{{ scope.row.pidNo }}
           </el-button>
         </template>
       </el-table-column>
       <el-table-column label="群组照片号" align="center" prop="picNo" width="110" :show-overflow-tooltip="true">
         <template slot-scope="scope">
           <el-button
-            v-if="scope.row.picUrl"
             size="mini"
+            v-if="scope.row.picNo"
             type="text"
             icon="el-icon-view"
             @click="handleSee(scope.row,false)"
-          >{{ $t('预览') }}
+          >{{ scope.row.picNo }}
           </el-button>
         </template>
       </el-table-column>