|
@@ -2,8 +2,11 @@ package com.sooka.sponest.event.centereventteventcatalogue.service.impl;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.ruoyi.common.core.utils.DateUtils;
|
|
|
+import com.ruoyi.common.core.utils.SpringUtils;
|
|
|
import com.ruoyi.common.core.utils.StringUtils;
|
|
|
-import com.ruoyi.common.security.utils.SecurityUtils;
|
|
|
+import com.ruoyi.common.core.utils.file.FilePrefixUtils;
|
|
|
+import com.ruoyi.system.api.RemoteFileService;
|
|
|
+import com.ruoyi.system.api.domain.SysFile;
|
|
|
import com.ruoyi.system.api.model.LoginUser;
|
|
|
import com.sooka.sponest.event.centereventteventcatalogue.domain.CentereventTEventcatalogue;
|
|
|
import com.sooka.sponest.event.centereventteventcatalogue.domain.RemoteFireVO;
|
|
@@ -16,6 +19,7 @@ import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.ArrayList;
|
|
@@ -38,18 +42,13 @@ public class FireInsidentServiceImpl implements IFireIncidentService {
|
|
|
* 119平台上报事件
|
|
|
*
|
|
|
* @param remoteFireVO
|
|
|
+ * @param loginUser
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
- public String insertFireIncident(RemoteFireVO remoteFireVO) {
|
|
|
- // 增加判断,防止没有token时空指针异常。
|
|
|
- LoginUser loginUser = SecurityUtils.getLoginUser();
|
|
|
- StringBuilder userId = new StringBuilder();
|
|
|
- StringBuilder nickName = new StringBuilder();
|
|
|
- if (null != loginUser) {
|
|
|
- userId.append(loginUser.getSysUser().getUserId());
|
|
|
- nickName.append(loginUser.getSysUser().getNickName());
|
|
|
- }
|
|
|
+ public String insertFireIncident(RemoteFireVO remoteFireVO, LoginUser loginUser) {
|
|
|
+ String userId = new StringBuilder().append(loginUser.getSysUser().getUserId()).toString();
|
|
|
+ String nickName = new StringBuilder().append(loginUser.getSysUser().getNickName()).toString();
|
|
|
// 事件目录
|
|
|
CentereventTEventcatalogue eventcatalogue = new CentereventTEventcatalogue(
|
|
|
remoteFireVO.getEventSubType(),
|
|
@@ -61,19 +60,24 @@ public class FireInsidentServiceImpl implements IFireIncidentService {
|
|
|
remoteFireVO.getEventReporter(),
|
|
|
remoteFireVO.getEventReportTime(),
|
|
|
remoteFireVO.getEventLocation(),
|
|
|
- REPORTING_SOURCE_5, "确认", FOREST_EVENT_STATUS_7, userId.toString(), nickName.toString(), DateUtils.getNowDate());
|
|
|
+ REPORTING_SOURCE_5, "签收", FOREST_EVENT_STATUS_2, userId, nickName, DateUtils.getNowDate());
|
|
|
//后续应该修改为调用接口获取部门信息
|
|
|
- List<CenterdataTAidevicedept> listDept = new ArrayList();
|
|
|
- listDept.add(new CenterdataTAidevicedept(3777L, "市消防救援支队"));
|
|
|
+ List<CenterdataTAidevicedept> listDept = new ArrayList<>();
|
|
|
+ listDept.add(new CenterdataTAidevicedept(loginUser.getSysUser().getDeptId(), loginUser.getSysUser().getDeptNames()));
|
|
|
String logId = alarmEventService.getFunction(eventcatalogue, listDept);
|
|
|
- if (StringUtils.isNotBlank(remoteFireVO.getEventPicture())) {
|
|
|
- String[] pictures = remoteFireVO.getEventPicture().split(",");
|
|
|
- // 添加新附件
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ if(StringUtils.isNotEmpty(remoteFireVO.getEventPicture())){
|
|
|
List<CenterdataTAttach> attachList = new ArrayList<>();
|
|
|
- for (String picture : pictures) {
|
|
|
+ for (String picture : remoteFireVO.getEventPicture()) {
|
|
|
+
|
|
|
+ MultipartFile multipartFile = FilePrefixUtils.urlToMultipartFile(picture, System.currentTimeMillis() + ".jpg");
|
|
|
+ SysFile sysFile = SpringUtils.getBean(RemoteFileService.class).upload(multipartFile).getData();
|
|
|
+
|
|
|
CenterdataTAttach tAttach = new CenterdataTAttach();
|
|
|
tAttach.setBusId(logId);
|
|
|
- tAttach.setAttachPath(picture);
|
|
|
+ tAttach.setAttachPath(sysFile.getUrl());
|
|
|
tAttach.setBusIndx(BUS_INDEX_1);
|
|
|
tAttach.setBusSource("platform - 119");
|
|
|
tAttach.setFileType(FILE_TYPE_1);
|