Browse Source

#离线巡检文件下载

zhongwei
yang_shj 2 years ago
parent
commit
6d09b67d6c
  1. 7
      hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/offline/OfflineConstant.java
  2. 2
      hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmInfoServiceImpl.java
  3. 10
      hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/offline/service/impl/InspectOfflineServiceImpl.java
  4. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AbnormalAlarmServiceImpl.java
  5. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/OperFaultServiceImpl.java
  6. 2
      hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/DangerSourceServiceImpl.java

7
hzims-service-api/inspect-api/src/main/java/com/hnac/hzinfo/inspect/offline/OfflineConstant.java

@ -1,6 +1,7 @@
package com.hnac.hzinfo.inspect.offline; package com.hnac.hzinfo.inspect.offline;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections;
import java.util.List; import java.util.List;
/** /**
@ -37,11 +38,11 @@ public interface OfflineConstant {
"HZ_OFFLINE_TASK"); "HZ_OFFLINE_TASK");
// 危险源表 // 危险源表
List<String> DANGER_TABKLE_NAMES = Arrays.asList("HZIMS_SAFE_DANGER_SOURCE"); List<String> DANGER_TABKLE_NAMES = Collections.singletonList("HZIMS_SAFE_DANGER_SOURCE");
// 设备表 // 设备表
List<String> EMINFO_TABKLE_NAMES = Arrays.asList("HZIMS_EM_INFO"); List<String> EMINFO_TABKLE_NAMES = Collections.singletonList("HZIMS_EM_INFO");
// 故障表 // 故障表
List<String> FAULT_TABKLE_NAMES = Arrays.asList("HZIMS_OPER_FAULT"); List<String> FAULT_TABKLE_NAMES = Collections.singletonList("HZIMS_OPER_FAULT");
} }

2
hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/service/impl/EmInfoServiceImpl.java

@ -400,7 +400,7 @@ public class EmInfoServiceImpl extends BaseServiceImpl<EmInfoMapper, EmInfoEntit
tableNames.forEach(table -> { tableNames.forEach(table -> {
CreateTableVO item = new CreateTableVO(); CreateTableVO item = new CreateTableVO();
// 获取表结构sql语句 // 获取表结构sql语句
String show_table_sql = "show create table " + databaseName + "." + table; String show_table_sql = "show create table `" + databaseName + "`." + table;
Map<String, Object> result = jdbcTemplate.queryForMap(show_table_sql); Map<String, Object> result = jdbcTemplate.queryForMap(show_table_sql);
if (MapUtils.isEmpty(result)) { if (MapUtils.isEmpty(result)) {
return; return;

10
hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/offline/service/impl/InspectOfflineServiceImpl.java

@ -32,6 +32,7 @@ import com.hnac.hzinfo.inspect.task.vo.TaskObjectProjectOfflineVO;
import com.hnac.hzinfo.inspect.task.vo.TaskOfflineVO; import com.hnac.hzinfo.inspect.task.vo.TaskOfflineVO;
import com.hnac.hzinfo.inspect.utils.JsonFileUtil; import com.hnac.hzinfo.inspect.utils.JsonFileUtil;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.MapUtils; import org.apache.commons.collections4.MapUtils;
import org.apache.commons.fileupload.FileItem; import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.FileItemFactory; import org.apache.commons.fileupload.FileItemFactory;
@ -82,10 +83,9 @@ import java.util.stream.Collectors;
@Service @Service
@Primary @Primary
@RequiredArgsConstructor @RequiredArgsConstructor
@Slf4j
public class InspectOfflineServiceImpl implements IOfflineDataService { public class InspectOfflineServiceImpl implements IOfflineDataService {
private static Logger logger = LoggerFactory.getLogger(InspectOfflineServiceImpl.class);
private final ITaskUserService taskUserService; private final ITaskUserService taskUserService;
private final ITaskService taskService; private final ITaskService taskService;
@ -166,7 +166,6 @@ public class InspectOfflineServiceImpl implements IOfflineDataService {
*/ */
@Override @Override
public void syncOfflineDataToOnline(Map<String,Object> paramMap) { public void syncOfflineDataToOnline(Map<String,Object> paramMap) {
logger.error("sync_offline_data_to_online : 进入离线结束方法");
String fileUrl = (String) paramMap.get("fileUrl"); String fileUrl = (String) paramMap.get("fileUrl");
if(StringUtil.isBlank(fileUrl)){ if(StringUtil.isBlank(fileUrl)){
return; return;
@ -284,7 +283,7 @@ public class InspectOfflineServiceImpl implements IOfflineDataService {
tableNames.forEach(table -> { tableNames.forEach(table -> {
CreateTableVO item = new CreateTableVO(); CreateTableVO item = new CreateTableVO();
// 获取表结构sql语句 // 获取表结构sql语句
String show_table_sql = "show create table " + databaseName + "." + table; String show_table_sql = "show create table `" + databaseName + "`." + table;
Map<String, Object> result = jdbcTemplate.queryForMap(show_table_sql); Map<String, Object> result = jdbcTemplate.queryForMap(show_table_sql);
if (MapUtils.isEmpty(result)) { if (MapUtils.isEmpty(result)) {
return; return;
@ -413,7 +412,6 @@ public class InspectOfflineServiceImpl implements IOfflineDataService {
for (int i=0; i < fileJson.size();i++){ for (int i=0; i < fileJson.size();i++){
TableJsonUtils.createJsonFile(fileJson.get(i), download, tableNames.get(i)); TableJsonUtils.createJsonFile(fileJson.get(i), download, tableNames.get(i));
} }
logger.error("file_list: {}",fileList);
// 视频、图片下载 // 视频、图片下载
if(CollectionUtil.isEmpty(fileList)){ if(CollectionUtil.isEmpty(fileList)){
return; return;
@ -894,7 +892,6 @@ public class InspectOfflineServiceImpl implements IOfflineDataService {
if (CollectionUtil.isEmpty(bo.getFiles())) { if (CollectionUtil.isEmpty(bo.getFiles())) {
return; return;
} }
logger.info(">>>>>>>>>>>>>>files: " + JSONObject.toJSONString(bo.getFiles()));
List<String> urls = bo.getFiles().stream().map(o -> { List<String> urls = bo.getFiles().stream().map(o -> {
if (StringUtils.isBlank(o) || o.contains("http")) { if (StringUtils.isBlank(o) || o.contains("http")) {
return null; return null;
@ -909,7 +906,6 @@ public class InspectOfflineServiceImpl implements IOfflineDataService {
try { try {
MultipartFile multipartFile = this.getMultipartFile(file); MultipartFile multipartFile = this.getMultipartFile(file);
r = ossClient.putFile(multipartFile); r = ossClient.putFile(multipartFile);
logger.info(">>>>>>>>>>>>>>上传文件返回结果:" + r.toString());
if (!r.isSuccess()) { if (!r.isSuccess()) {
throw new RuntimeException("上传文件["+fileName+"]失败,bladex-resource报错:" + r.toString()); throw new RuntimeException("上传文件["+fileName+"]失败,bladex-resource报错:" + r.toString());
} }

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AbnormalAlarmServiceImpl.java

@ -224,7 +224,7 @@ public class AbnormalAlarmServiceImpl extends BaseServiceImpl<AbnormalAlarmMappe
} }
User admin = userClient.userByAccount("200000", "admin").getData(); User admin = userClient.userByAccount("200000", "admin").getData();
message.setCreateDept(admin.getCreateDept()); message.setCreateDept(admin.getCreateDept());
message.setCreateUser(admin.getCreateUser()); message.setCreateUser(admin.getId());
result.getData().forEach(user->{ result.getData().forEach(user->{
message.setPusher(String.valueOf(user.getId())); message.setPusher(String.valueOf(user.getId()));
message.setPusherName(user.getName()); message.setPusherName(user.getName());

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/OperFaultServiceImpl.java

@ -108,7 +108,7 @@ public class OperFaultServiceImpl extends BaseServiceImpl<OperFaultMapper, OperF
tableNames.forEach(table -> { tableNames.forEach(table -> {
CreateTableVO item = new CreateTableVO(); CreateTableVO item = new CreateTableVO();
// 获取表结构sql语句 // 获取表结构sql语句
String show_table_sql = "show create table " + databaseName + "." + table; String show_table_sql = "show create table `" + databaseName + "`." + table;
Map<String, Object> result = jdbcTemplate.queryForMap(show_table_sql); Map<String, Object> result = jdbcTemplate.queryForMap(show_table_sql);
if (MapUtils.isEmpty(result)) { if (MapUtils.isEmpty(result)) {
return; return;

2
hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/DangerSourceServiceImpl.java

@ -292,7 +292,7 @@ public class DangerSourceServiceImpl extends BaseServiceImpl<DangerSourceMapper,
tableNames.forEach(table -> { tableNames.forEach(table -> {
CreateTableVO item = new CreateTableVO(); CreateTableVO item = new CreateTableVO();
// 获取表结构sql语句 // 获取表结构sql语句
String show_table_sql = "show create table " + databaseName + "." + table; String show_table_sql = "show create table `" + databaseName + "`." + table;
Map<String, Object> result = jdbcTemplate.queryForMap(show_table_sql); Map<String, Object> result = jdbcTemplate.queryForMap(show_table_sql);
if (MapUtils.isEmpty(result)) { if (MapUtils.isEmpty(result)) {
return; return;

Loading…
Cancel
Save