修改 上传文件

master
wangh 1 year ago
parent 7f1846b1e0
commit 09a903bf67

@ -79,6 +79,7 @@ public class CommonController
{
// 上传文件路径
String filePath = Global.getUploadPath();
System.out.println("上传文件大小"+file.getSize());
// 上传并返回新文件名称
String fileName = FileUploadUtils.upload(filePath, file);
String url = serverConfig.getUrl() + fileName;

@ -88,14 +88,14 @@ body {
.winDiv .bg1 {
position: absolute;
font-size: 0.8vw;
left: 10%;
left: 7%;
top: calc(15% + 1.5vw);
color: #4888bf;
width: 80%;
height: 25%;
width: 87%;
height: 45%;
border-radius: 3px;
border: 2px solid #3f65a1;
padding: 5%;
padding: 1%;
overflow: auto;
}
@ -103,21 +103,21 @@ body {
position: absolute;
font-size: 1vw;
left: 10%;
top: 45%;
top: 67%;
color: #fff;
}
.winDiv .bg2 {
position: absolute;
font-size: 0.8vw;
left: 10%;
top: calc(45% + 1.5vw);
left: 7%;
top: calc(67% + 1.5vw);
color: #4888bf;
width: 80%;
height: 28%;
width: 87%;
height: 26%;
border-radius: 3px;
border: 2px solid #3f65a1;
padding: 5%;
padding: 1%;
overflow: auto;
}

@ -23,7 +23,7 @@ public class FileUploadUtils
/**
* 50M
*/
public static final long DEFAULT_MAX_SIZE = 50 * 1024 * 1024;
public static final long DEFAULT_MAX_SIZE = 1000 * 1024 * 1024;
/**
* 100

@ -2,6 +2,7 @@ package com.haiwei.manage.mapper;
import java.util.List;
import com.haiwei.manage.domain.BsaeFile;
import org.springframework.stereotype.Repository;
/**
* Mapper
@ -9,6 +10,7 @@ import com.haiwei.manage.domain.BsaeFile;
* @author wangh
* @date 2023-09-28
*/
@Repository
public interface BsaeFileMapper
{
/**

@ -1,7 +1,13 @@
package com.haiwei.manage.service.impl;
import java.io.File;
import java.util.List;
import com.haiwei.common.config.Global;
import com.haiwei.common.constant.Constants;
import com.haiwei.common.utils.DateUtils;
import com.haiwei.common.utils.StringUtils;
import com.haiwei.common.utils.file.FileUtils;
import com.haiwei.framework.util.ShiroUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -83,7 +89,13 @@ public class BsaeFileServiceImpl implements IBsaeFileService
@Override
public int deleteBsaeFileByIds(String ids)
{
return bsaeFileMapper.deleteBsaeFileByIds(Convert.toStrArray(ids));
String[] objids = Convert.toStrArray(ids);
for (int i = 0; i <objids.length ; i++) {
delectFile(Long.valueOf(objids[i]));
}
return bsaeFileMapper.deleteBsaeFileByIds(objids);
}
/**
@ -95,6 +107,24 @@ public class BsaeFileServiceImpl implements IBsaeFileService
@Override
public int deleteBsaeFileById(Long objid)
{
return bsaeFileMapper.deleteBsaeFileById(objid);
}
private void delectFile(Long id){
try {
BsaeFile bsaeFile = bsaeFileMapper.selectBsaeFileById(id);
// 本地资源路径
String localPath = Global.getProfile();
// 数据库资源地址
String downloadPath = localPath + StringUtils.substringAfter(bsaeFile.getFilePath(), Constants.RESOURCE_PREFIX);
System.out.println(downloadPath);
FileUtils.deleteFile(downloadPath);
}catch (Exception e){
}
}
}

@ -274,11 +274,12 @@
}
function removeRow(ids) {
console.log('删除的ID='+ids)
sub.editColumn();
$("#" + table.options.id).bootstrapTable('remove', {
field: 'index',
values: ids
})
sub.editColumn();
}
</script>
</body>

@ -124,7 +124,8 @@
align: 'center',
title: '采样时间',
formatter: function(value, row, index) {
var html = $.common.sprintf("<input class='form-control' type='text' name='recordTestParamList[%s].recordTime' value='%s'>", index, value);
var html = $.common.sprintf("<input class='form-control' type='text' name='recordTestParamList[%s].recordTime' value='%s' style='width: 150px'>", index, value);
return html;
}
},

Loading…
Cancel
Save