Browse Source
- 新增划界管理实体类,包含划界依据、文件名和文件地址字段 - 实现文件上传服务 TransferService,支持单文件和多文件上传 - 添加文件上传接口 uploadFile,支持划界相关文件上传 - 优化 WqLrinfBController,增加文件上传功能并调整接口注释 - 移除原有湖库信息相关字段,适配划界管理需求 - 注释掉部分无用的查询条件代码,简化业务逻辑 - 调整接口文档描述,统一使用划界管理相关术语 - 修复值班管理模块接口文档标题不一致问题 - 优化巡检问题处理接口返回状态逻辑 - 完善文件上传路径配置,支持自定义子目录存储master
17 changed files with 428 additions and 179 deletions
@ -0,0 +1,13 @@
|
||||
package org.springblade.reservoirbase.service; |
||||
|
||||
import org.springframework.web.multipart.MultipartFile; |
||||
|
||||
import java.util.List; |
||||
|
||||
public interface ITransferService { |
||||
|
||||
String addFile(MultipartFile file,String childPath); |
||||
|
||||
List<String> addFiles(MultipartFile[] files,String childPath); |
||||
|
||||
} |
||||
@ -0,0 +1,64 @@
|
||||
package org.springblade.reservoirbase.service.impl; |
||||
|
||||
import org.apache.commons.io.FileUtils; |
||||
import org.springblade.reservoirbase.service.ITransferService; |
||||
import org.springframework.beans.factory.annotation.Value; |
||||
import org.springframework.stereotype.Service; |
||||
import org.springframework.web.multipart.MultipartFile; |
||||
|
||||
import java.io.File; |
||||
import java.io.IOException; |
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
import java.util.UUID; |
||||
|
||||
@Service |
||||
public class TransferServiceImpl implements ITransferService { |
||||
|
||||
@Value("${file.upload.path}") |
||||
private String fileUploadPath; |
||||
|
||||
@Override |
||||
public String addFile(MultipartFile file, String childPath) { |
||||
MultipartFile[] files = new MultipartFile[1]; |
||||
files[0] = file; |
||||
return addFiles(files, childPath).get(0); |
||||
} |
||||
|
||||
@Override |
||||
public List<String> addFiles(MultipartFile[] files, String childPath) { |
||||
List<String> list = new ArrayList<>(); |
||||
String dirName = UUID.randomUUID().toString().replace("-", ""); |
||||
File uploadPath = new File(fileUploadPath, childPath); |
||||
uploadPath = new File(uploadPath, dirName); |
||||
try { |
||||
if (!uploadPath.exists()) { |
||||
uploadPath.mkdirs(); |
||||
} |
||||
for (MultipartFile file : files) { |
||||
saveFile(file, uploadPath); |
||||
list.add(File.separator + childPath + File.separator + dirName + File.separator + file.getOriginalFilename()); |
||||
} |
||||
return list; |
||||
} catch (IOException e) { |
||||
return list; |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 保存文件,如果后期有要求需要处理重名情况 |
||||
* |
||||
* @param file 待保存的文件 |
||||
* @param uploadPath 上传的路径 |
||||
* @throws IOException |
||||
*/ |
||||
private void saveFile(MultipartFile file, File uploadPath) throws IOException { |
||||
String originalName = file.getOriginalFilename(); |
||||
File path = new File(uploadPath, originalName); |
||||
if (!path.exists()) { |
||||
path.createNewFile(); |
||||
} |
||||
FileUtils.copyInputStreamToFile(file.getInputStream(), path); |
||||
} |
||||
|
||||
} |
||||
@ -0,0 +1,184 @@
|
||||
#数据源配置 |
||||
spring: |
||||
datasource: |
||||
dynamic: |
||||
enabled: true |
||||
primary: mysql #设置默认的数据源或者数据源组,默认值即为master |
||||
strict: true #设置严格模式,默认false不启动. 启动后在未匹配到指定数据源时候会抛出异常,不启动则使用默认数据源. |
||||
datasource: |
||||
mysql: |
||||
url: jdbc:mysql://192.168.1.58:3576/hzinfo_ris_pxhd?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true |
||||
username: hzinfo |
||||
password: 1qaz2WSX! |
||||
slave: |
||||
url: jdbc:mysql://192.168.1.58:3576/hzinfo_ris_pxhd?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true |
||||
username: root |
||||
password: 1qaz2WSX! |
||||
tdengine: |
||||
db-type: postgresql |
||||
driver-class-name: com.taosdata.jdbc.rs.RestfulDriver |
||||
url: jdbc:TAOS-RS://192.168.1.202:6041/hzinfo_data?timezone=UTC-8&charset=UTF-8&locale=en_US.UTF-8 |
||||
username: root |
||||
password: taosdata |
||||
redis: |
||||
host: 192.168.1.58 #本地redis |
||||
port: 3577 |
||||
password: L_MM&h=+Nm&p)U9sk.uH |
||||
database: 0 |
||||
ssl: false |
||||
timeout: 3000 |
||||
|
||||
|
||||
jedis: |
||||
pool: |
||||
maxActive: 100 |
||||
maxIdle: 50 |
||||
maxWait: 1500 |
||||
testOnBorrow: true |
||||
testOnReturn: true |
||||
|
||||
blade: |
||||
notCkeckTenantId: "200000" |
||||
sdk: |
||||
signatrue: |
||||
enabled: false |
||||
analyze-data: |
||||
minute-days: 30 |
||||
socond-hour: 6 |
||||
day-day: 365 |
||||
soe-shake: |
||||
open: true |
||||
second: 60 |
||||
data: |
||||
sdk: |
||||
enabled: true |
||||
url: http://127.0.0.1:7502/api/hzinfo-data-config #nignx后台代理端口 |
||||
appId: '1529342971768860673' |
||||
appSecret: 3b599c56a6c6c2d35dcfb7e63d04414f |
||||
backups: true |
||||
yc-batch-number: 50 |
||||
yx-batch-number: 50 |
||||
soe-batch-number: 20 |
||||
stations: |
||||
- stationId: 999999 |
||||
delay: 10 |
||||
- stationId: 12345654321 |
||||
delay: 10 |
||||
- stationId: 999900000002 |
||||
delay: 10 |
||||
datasource: |
||||
socket: |
||||
tdengine: |
||||
url: ${spring.datasource.dynamic.datasource.tdengine.url} |
||||
username: ${spring.datasource.dynamic.datasource.tdengine.username} |
||||
password: ${spring.datasource.dynamic.datasource.tdengine.password} |
||||
mqtt: |
||||
enabled: true |
||||
userName: hzinfo |
||||
password: hz123456 |
||||
urls: tcp://192.168.1.58:1883 |
||||
# urls: tcp://192.168.65.86:1883 |
||||
clientId: hzinfo_boot_mqtt |
||||
topicNames: topic_device_model,topic_hzinfo_props,topic_hzinfo_yx,topic_hzinfo_heart_beat,topic_hzinfo_control_return,topic_hzinfo_events_alarm,topic_hzinfo_events |
||||
|
||||
file: |
||||
upload: |
||||
path: D:\\upload |
||||
excel: |
||||
excelUrl: D:\\upload\\excelResult |
||||
excelImage: D:\\upload\\excelResult\\excelImage |
||||
|
||||
|
||||
|
||||
hzinfo: |
||||
task: |
||||
pdf: |
||||
# pdf模板路径 ,请配置绝对路径 |
||||
# module-path: /data/inspect/pdf/templet/inspectObj.html # linux |
||||
module-path: D:\upload\hzinfo\pdf\templet\inspectObj.html # windows |
||||
# pdf文件存储路径,请配置绝对路径 |
||||
# file-path: /data/inspect/pdf/file # linux |
||||
file-path: D:/upload/hzinfo/file # windows |
||||
|
||||
hzims: |
||||
inspect: |
||||
task: |
||||
templateCode: |
||||
#巡检任务开始前发送短信信息阿里云模板 |
||||
taskBegin: aliyun-task-begin |
||||
#巡检任务结束前发送短信信息阿里云模板 |
||||
taskEnd: aliyun-task-end |
||||
#巡检消息推送模板 - 极光 |
||||
jgPushCode: hzinfo-inspect |
||||
duty: |
||||
file-path: "D:/upload/duty" |
||||
|
||||
sms: |
||||
aliyun: |
||||
templateCode: |
||||
warn: SMS_167050010 |
||||
connectTimeout: 10000 |
||||
readTimeout: 10000 |
||||
accessKeyId: LTAIdaVZqHxfh10d |
||||
accessKeySecret: HLIrI0mGhGdlvnU1h64ewShSF58VGg |
||||
profilePoint: cn-changsha |
||||
endPoint: cn-changsha |
||||
signName: \u534E\u81EA\u79D1\u6280 |
||||
|
||||
emergency: |
||||
plan: |
||||
enable: |
||||
suffix: doc,docx,pdf,xls,xlsx,csv,jpg,png,mkv,mp3,mp4,wmv |
||||
|
||||
|
||||
hz3000: |
||||
runtime: |
||||
setting: D:/HZ3000/runtime/info/factory.fac |
||||
network: |
||||
windows: D:/hz3000/runtime/info/network.xml |
||||
linux: /home/hz3000/info/network.xml |
||||
#====linux==== |
||||
dll: |
||||
path: |
||||
linux: /home/hz3000/dlls/sysdlls/ |
||||
fiveprevention: |
||||
dll: |
||||
linux: libfiveprevention.so |
||||
read: |
||||
dll: |
||||
name: |
||||
linux: libReadData.so |
||||
write: |
||||
dll: |
||||
name: |
||||
linux: libWriteData.so |
||||
|
||||
|
||||
soe: |
||||
wait: |
||||
interval: 500 |
||||
time: 120000 |
||||
interval: 30000 |
||||
show: |
||||
number: 10 |
||||
expire: |
||||
time: 15 |
||||
|
||||
dynamic: |
||||
file: |
||||
path: D:\\nginx-1.18.0\\html\\HZInfo/hz3000data/ |
||||
|
||||
|
||||
|
||||
wd: |
||||
gisUrl: http://175.6.40.67:8053 |
||||
areaCodes: 430225000000 |
||||
areaCode: 430225000000 |
||||
gisCodes: bigemap.bj8061hz |
||||
gisLevel: 2 |
||||
stcd: 360301002 |
||||
|
||||
tencent: |
||||
push: |
||||
appId: 1580011926 |
||||
secretKey: ae7e4b5fd20c3599113b6ebfbf82e7ea |
||||
Loading…
Reference in new issue