Commit 2e7b61e2 authored by suhuiguang's avatar suhuiguang

Merge branch 'developer' of http://39.98.45.134:8090/moa/amos-boot-biz into developer

parents a819eade 0535e555
......@@ -40,4 +40,8 @@ public class AvicCustomPathService extends BaseService<AvicCustomPathModel,AvicC
public List<AvicCustomPathModel> queryForAvicCustomPathList(String agencyCode) {
return this.queryForList("" , false, agencyCode);
}
public AvicCustomPath queryForAvicCustomPathBySequenceNbr(String path) {
return null;
}
}
......@@ -25,6 +25,10 @@ public class SourceScene extends BaseEntity {
@ApiModelProperty(value = "文件名称")
@TableField("source_name")
private String sourceName;
@ApiModelProperty(value = "数据源类型:building(建筑类),system(系统类)")
@TableField("source_type")
private String sourceType;
@ApiModelProperty(value = "组态工程id")
@TableField("project_id")
......
......@@ -26,6 +26,7 @@ import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.MediaType;
import org.springframework.scheduling.annotation.Async;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
......@@ -46,6 +47,8 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.avic.face.model.AvicCustomPathModel;
import com.yeejoin.amos.avic.face.model.TransferModel;
import com.yeejoin.amos.avic.face.orm.entity.AvicCustomPath;
import com.yeejoin.amos.avic.face.service.AvicCustomPathService;
import com.yeejoin.indicators.feign.IndicatorsManager;
import com.yeejoin.indicators.feign.request.DataFetchRequest;
import com.yeejoin.indicators.feign.request.DataRecordRequest;
......@@ -69,6 +72,9 @@ public class WebServicesFileFransferResource {
@Autowired
WorkflowManager workflowManager;
@Autowired
private AvicCustomPathService simpleService;
@Value(value = "${upload.temp.dir}")
String tempDir;
......@@ -188,17 +194,29 @@ public class WebServicesFileFransferResource {
public ResponseModel postfile(@RequestBody TransferModel transferModel) {
Map<String, Object> task = indicatorsManager.indicatorClient.getTaskByTaskId(transferModel.getTaskId())
.getResult();
syncSendFile(task, transferModel);
DataReportAuditRequest dataReportAuditRequest = new DataReportAuditRequest();
dataReportAuditRequest.setTaskId(transferModel.getTaskId());
dataReportAuditRequest.setInstanceId(task.get("processInstanceId").toString());
dataReportAuditRequest.setRemark(transferModel.getComment());
dataReportAuditRequest.setCondition("0");
indicatorsManager.indicatorClient.auditWorkFlow(dataReportAuditRequest);
return ResponseHelper.buildResponse(null);
}
JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance();
Client client = dcf.createClient(webserviceUrl);
@Async
private void syncSendFile(Map<String, Object> task, TransferModel transferModel) {
AvicCustomPath avicCustomPath = simpleService.getById(transferModel.getPath());
try {
JaxWsDynamicClientFactory dcf = JaxWsDynamicClientFactory.newInstance();
Client client = dcf.createClient(webserviceUrl);
if (ObjectUtils.isEmpty(transferModel.getAvicCode())) {
for (String file : transferModel.getFiles().stream().map(m -> m.getUrl())
.collect(Collectors.toList())) {
String filePath = tempDir;
File dest = new File(filePath + file);
DataHandler handler = new DataHandler(new FileDataSource(dest));
client.invoke("transferFile", handler, dest.getName(), transferModel.getPath());
client.invoke("transferFile", handler, dest.getName(), avicCustomPath.getPath());
}
} else {
for (String file : transferModel.getFiles().stream().map(m -> m.getUrl())
......@@ -206,23 +224,13 @@ public class WebServicesFileFransferResource {
String filePath = tempDir;
File dest = new File(filePath + file);
DataHandler handler = new DataHandler(new FileDataSource(dest));
client.invoke("useCodetransferFile", handler, dest.getName(), transferModel.getPath(),
client.invoke("useCodetransferFile", handler, dest.getName(), avicCustomPath.getPath(),
transferModel.getAvicCode());
}
}
// JSONObject actTask = workflowManager.workflowClient.getTask(task.get("processInstanceId").toString());
// workflowManager.workflowClient.pickupAndCompleteTask(actTask.getJSONObject("data").getString("id"), new HashMap<>());
DataReportAuditRequest dataReportAuditRequest = new DataReportAuditRequest();
dataReportAuditRequest.setTaskId(transferModel.getTaskId());
dataReportAuditRequest.setInstanceId(task.get("processInstanceId").toString());
dataReportAuditRequest.setRemark(transferModel.getComment());
dataReportAuditRequest.setCondition("0");
indicatorsManager.indicatorClient.auditWorkFlow(dataReportAuditRequest);
} catch (java.lang.Exception e) {
e.printStackTrace();
}
return ResponseHelper.buildResponse(null);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
......
......@@ -25,6 +25,8 @@ public class FileFransferServiceImpl implements FileFransferService {
@Autowired
AvicCustomPathService avicCustomPathService;
String baseDir = "E:\\webservice\\";
@Override
public void useCodetransferFile(DataHandler handler, String fileName, String path, String code) {
saveFile(handler, fileName, path);
......@@ -36,8 +38,8 @@ public class FileFransferServiceImpl implements FileFransferService {
FileOutputStream os = null;
try {
is = handler.getInputStream();
File file = new File(String.format("%s%s%s", path, File.separator, fileName));
File dir = new File(String.format("%s%s", path, File.separator));
File file = new File(String.format("%s%s%s%s", baseDir,path.replace(":", ""), File.separator, fileName));
File dir = new File(String.format("%s%s%s", baseDir, path.replace(":", ""), File.separator));
if (!dir.exists()) {
dir.mkdirs();
}
......
......@@ -793,8 +793,15 @@ public class TopographyController extends AbstractBaseController {
lists.add(dataVO);
iotVo.setList(lists);
try {
Date date = DateUtils.dateParse(String.valueOf(timeList.get(j-1).getValue()), DateUtils.DATE_TIME_T_PATTERN);
iotVo.setTime(date);
//Date date = DateUtils.dateParse(String.valueOf(timeList.get(j-1).getValue()), DateUtils.DATE_TIME_T_PATTERN);
SimpleDateFormat sdf = new SimpleDateFormat(DateUtils.DATE_TIME_T_PATTERN);
SimpleDateFormat sdf1 = new SimpleDateFormat(DateUtils.DATE_TIME_PATTERN);
sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
Date date1=sdf.parse(String.valueOf(timeList.get(j-1).getValue()));
String time= DateTimeUtil.format(date1, DateTimeUtil.ISO_DATE_HOUR24_MIN_SEC);
iotVo.setTime(sdf1.parse(time));
} catch (Exception e) {
e.printStackTrace();
}
......
......@@ -238,6 +238,7 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
model.put("id", String.valueOf(System.currentTimeMillis()));
model.put("projectId", String.valueOf(projectSeq));
model.put("creatorId", userId);
model.put("sourceType", "building");
model.put("instanceId", resourceDTO.getCode());
model.put("name", resourceDTO.getName());
this.baseMapper.insetSourceScene(model);
......
......@@ -31,6 +31,11 @@ import com.yeejoin.equipmanage.mapper.*;
import com.yeejoin.equipmanage.remote.RemoteSecurityService;
import com.yeejoin.equipmanage.service.*;
import org.apache.commons.beanutils.BeanUtils;
import com.yeejoin.equipmanage.utils.BeanUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
......@@ -48,7 +53,7 @@ import java.net.SocketException;
import java.util.*;
import java.util.stream.Collectors;
@Slf4j
@Service
public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSystemMapper, FireFightingSystemEntity>
implements IFireFightingSystemService {
......@@ -353,6 +358,7 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
sourceScene.setSourceId(systemId);
sourceScene.setSourceName(resourceDTO.getName());
sourceScene.setSceneId(resourceDTO.getId());
sourceScene.setSourceType("system");
}
// TODO 获取画布下 绑定的装备点、摄像头,目前消防系统只能绑定装备,不能绑定摄像头(树未返回摄像头)
List<Map> children = (List<Map>) parse.get("children");
......@@ -637,26 +643,14 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
}
@Override
@Transactional
public Boolean deleteSystem(Long id) {
// QueryWrapper<FormInstance> fqw = new QueryWrapper<>();
// fqw.eq("field_value",id);
// fqw.groupBy("instance_id");
// List<FormInstance> formInstances = formInstanceMapper.selectList(fqw);
// if (formInstances != null && formInstances.size()>0){
// QueryWrapper<FormInstance> one = new QueryWrapper<>();
// one.eq("instance_id",formInstances.get(0).getInstanceId());
// one.eq("field_name","name");
// List<FormInstance> formInstances1 = formInstanceMapper.selectList(one);
// FormInstance formInstance = formInstances1.get(0);
// String name = formInstance.getFieldValue();
// throw new BadRequest(name+"建筑与该系统存在绑定关系,请清除后再进行删除!");
// }
FireFightingSystemEntity entity = baseMapper.selectById(id);
if (entity.getSceneId() != null) {
try {
FeignUtil.remoteCall(() -> Morphic.morphicSubjectClient.delete(entity.getSceneId()));
} catch (Exception e) {
throw new RuntimeException("远程调用 MORPHIC 服务的删除操作出错");
log.error("远程调用 MORPHIC 服务的删除操作出错:"+e.getMessage().toString(),e);
}
}
formInstanceMapper.clearSystemId(id);
......@@ -667,7 +661,11 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
if (i > 0 && syncSwitch) {
syncDataService.syncDeletedFireFightingSystem(Arrays.asList(id));
}
// 删除动态关联表单实例数据
//删除系统图与设备关系表
QueryWrapper<SourceScene> ssWrapper = new QueryWrapper<SourceScene>();
ssWrapper.lambda().eq(SourceScene::getSourceId, id);
sourceSceneMapper.delete(ssWrapper);
//删除动态关联表单实例数据
if (entity.getInstanceId() != null) {
instanceService.remove(new LambdaQueryWrapper<DynamicFormInstance>().eq(DynamicFormInstance::getInstanceId,
entity.getInstanceId()));
......
......@@ -287,7 +287,7 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
}
@Override
@Transactional(rollbackFor = Exception.class)
// @Transactional(rollbackFor = Exception.class)
public List<EquipmentSpecific> uploadListByTemplate(List<EquipmentDetailDownloadTemplateDto> equipmentDetailDownloadVOS, ReginParams reginParams, AgencyUserModel agencyUserModel) {
StringBuffer fireFightSysIdsBuffer = new StringBuffer();
......
spring.application.name=AMOS-BIZ-AVIC-API
spring.application.name=AMOS-BIZ-AVIC-API-TARGET
server.servlet.context-path=/avic
server.port=8808
spring.profiles.active=dev
......
......@@ -2776,4 +2776,40 @@
</sql>
</changeSet>
<changeSet author="my" id="16504254290001-1">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="wl_source_scene" columnName="source_type"/>
</not>
</preConditions>
<comment>wl_source_scene add column source_type 添加组态页面关系表数据源类型字段</comment>
<sql>
ALTER TABLE `wl_source_scene`
ADD COLUMN `source_type` varchar(255) NULL COMMENT '数据源类型:building(建筑类),system(系统类)' AFTER `source_name`;
UPDATE wl_source_scene ss
SET ss.source_type = 'building'
WHERE
(
SELECT
count(1)
FROM
wl_warehouse_structure ws
WHERE
ws.id = ss.source_id
) > 0;
UPDATE wl_source_scene ss
SET ss.source_type = 'system'
WHERE
(
SELECT
count(1)
FROM
f_fire_fighting_system ffs
WHERE
ffs.id = ss.source_id
) > 0;
</sql>
</changeSet>
</databaseChangeLog>
\ No newline at end of file
......@@ -104,6 +104,7 @@
(id,
source_id,
source_name,
source_type,
project_id,
scene_id,
point_in_scene,
......@@ -114,6 +115,7 @@
#{id},
#{instanceId},
#{name},
#{sourceType},
#{projectId},
#{sceneId},
null,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment