Commit 209b0386 authored by tangwei's avatar tangwei

灾情详情接口编写

parent 08a25f4b
package com.yeejoin.amos.boot.module.jcs.api.dto;
import lombok.Data;
@Data
public class KeyValueLabel {
private String key;
private String label;
private Object value;
public KeyValueLabel( String label,String key, Object value) {
super();
this.label = label;
this.key = key;
this.value = value;
}
public KeyValueLabel() {
super();
}
}
\ No newline at end of file
......@@ -2,10 +2,12 @@ package com.yeejoin.amos.boot.module.jcs.api.service;
import com.yeejoin.amos.boot.module.common.api.dto.RequestData;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledZhDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.KeyValueLabel;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertCalled;
import org.springframework.web.bind.annotation.PathVariable;
import java.util.List;
import java.util.Map;
/**
* 警情接警记录 服务类
......@@ -34,4 +36,7 @@ public interface IAlertCalledService {
*
* **/
Object selectAlertCalledById( Long id);
Map<String,Object> selectAlertCalledKeyValueLabelById( Long id);
}
package com.yeejoin.amos.boot.module.command.biz.controller;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.biz.common.utils.MenuFrom;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.TreeParser;
import com.yeejoin.amos.boot.module.command.api.dao.SeismometeorologyDtoDao;
import com.yeejoin.amos.boot.module.command.api.dto.SeismometeorologyDto;
import com.yeejoin.amos.boot.module.common.api.dto.*;
import com.yeejoin.amos.boot.module.common.api.entity.DataDictionary;
import com.yeejoin.amos.boot.module.common.api.entity.FireTeam;
import com.yeejoin.amos.boot.module.common.api.service.*;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledZhDto;
......@@ -20,14 +13,10 @@ import com.yeejoin.amos.boot.module.jcs.api.dto.InstructionsZHDto;
import com.yeejoin.amos.boot.module.jcs.api.enums.AlertStageEnums;
import com.yeejoin.amos.boot.module.jcs.api.service.IAlertCalledService;
import com.yeejoin.amos.boot.module.jcs.api.service.IAlertSubmittedService;
import com.yeejoin.amos.component.rule.config.RuleConfig;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.DateUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
......@@ -286,7 +275,7 @@ public class CommandController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "根据id查询灾情详情", notes = "根据id查询灾情详情")
public ResponseModel<Object> selectById(@PathVariable Long id) {
return ResponseHelper.buildResponse(iAlertCalledService.selectAlertCalledById(id));
return ResponseHelper.buildResponse(iAlertCalledService.selectAlertCalledKeyValueLabelById(id));
}
......
package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
......@@ -15,6 +16,7 @@ import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledFormDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledObjsDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledZhDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.KeyValueLabel;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertCalled;
import com.yeejoin.amos.boot.module.jcs.api.entity.AlertFormValue;
import com.yeejoin.amos.boot.module.jcs.api.entity.Template;
......@@ -37,10 +39,7 @@ import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
......@@ -340,4 +339,33 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
}
return StringUtils.replaceEach(tempContent, keys, strList.toArray(new String[strList.size()]));
}
@Override
public Map<String,Object> selectAlertCalledKeyValueLabelById(Long id) {
// 警情基本信息
AlertCalled alertCalled = this.getById(id);
QueryWrapper<AlertFormValue> queryWrapper = new QueryWrapper<>();
Map<String,Object> map=new HashMap();
map.put("title","【"+alertCalled.getAlertType()+"】"+alertCalled.getAddress());
queryWrapper.eq("alert_called_id", id);
// 警情动态表单数据
List<KeyValueLabel> listdate =new ArrayList<>();
List<AlertFormValue> list = iAlertFormValueService.list(queryWrapper);
listdate.add(new KeyValueLabel("接警时间","callTime",alertCalled.getCallTime()));
listdate.add(new KeyValueLabel("警情地点","address",alertCalled.getAddress()));
listdate.add(new KeyValueLabel("警情类型","alertType",alertCalled.getAlertType()));
listdate.add(new KeyValueLabel("警情阶段","alertStage",alertCalled.getAlertStage()));
listdate.add(new KeyValueLabel("警情等级","responseLevel","无"));
listdate.add(new KeyValueLabel("被困人数","trappedNum",alertCalled.getTrappedNum()));
listdate.add(new KeyValueLabel("伤亡人数","casualtiesNum",alertCalled.getCasualtiesNum()));
listdate.add(new KeyValueLabel("联系人","contactUser",alertCalled.getContactUser()));
listdate.add(new KeyValueLabel("联系电话","contactPhone",alertCalled.getContactPhone()));
listdate.add(new KeyValueLabel("联系人电话","contactPhone",alertCalled.getContactPhone()));
list.stream().forEach(AlertFormValue->{
listdate.add(new KeyValueLabel(AlertFormValue.getFieldName(),AlertFormValue.getFieldCode(), AlertFormValue.getFieldValue()));
});
map.put("data",listdate);
return map;
}
}
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