Commit 2060a721 authored by tangwei's avatar tangwei

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

parents d426904a 8f34b909
......@@ -7,6 +7,8 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
import java.util.List;
/**
* 消防队伍
*
......@@ -59,4 +61,15 @@ public class FireTeamDto extends BaseDto {
@ApiModelProperty(value = "操作人名称")
private String recUserName;
@ApiModelProperty(value = "消防队类型(专职消防队,监控大队)")
private String type;
@ApiModelProperty(value = "执勤车辆数")
private String onDutyCount;
@ApiModelProperty(value = "出动车辆数")
private String outCount;
@ApiModelProperty(value = "队伍下车辆")
private List<FireCarDto> children;
}
package com.yeejoin.amos.boot.module.jcs.api.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 消防队伍类型枚举
*
* @author DELL
*/
@Getter
@AllArgsConstructor
public enum FireBrigadeTypeEnum {
专职消防队("fullTime", "116", "专职消防队"),
监控大队("monitorTeam", "118", "监控大队");
private String key;
private String code;
private String name;
}
......@@ -58,4 +58,12 @@ public interface EquipFeignClient {
*/
@RequestMapping(value = "/equipSpecific/getAirEquipSpecificDetail", method = RequestMethod.GET)
ResponseModel<Object> getAirEquipSpecificDetail(@RequestParam Long stockDetailId) throws InnerInvokException;
/**
* 获取车辆列表
*
* @return
*/
@RequestMapping(value = "/car/list-all", method = RequestMethod.GET)
ResponseModel<Object> getFireCarListAll();
}
package com.yeejoin.amos.boot.module.jcs.api.service;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
/**
* 装备服务feign
*
* @author Dell
*/
@FeignClient(name = "AMOS-EQUIPMANAGE", path = "equip")
//@FeignClient(name = "AMOS-AUTOSYS", url = "http://172.16.10.66:8085", path = "fireAutoSys")
public interface EquipFeignService {
/**
* 获取车辆列表
*
* @return
*/
@RequestMapping(value = "/car/list-all", method = RequestMethod.GET)
ResponseModel<Object> getFireCarListAll();
}
......@@ -79,13 +79,13 @@ public class AlertCalledController extends BaseController {
@PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增警情接警记录", notes = "新增警情接警记录")
@Transactional
public ResponseModel<AlertCalledVo> saveAlertCalled(HttpServletRequest request,
public ResponseModel<AlertCalledVo> saveAlertCalled(HttpServletRequest request,
@RequestBody AlertCalledVo alertCalledVo) throws Exception{
if (ValidationUtil.isEmpty(alertCalledVo)
|| ValidationUtil.isEmpty(alertCalledVo.getAlertCalled()))
throw new BadRequest("参数校验失败.");
return ResponseHelper.buildResponse(iAlertCalledService.createAlertCalled(alertCalledVo));
}
......@@ -124,7 +124,7 @@ public class AlertCalledController extends BaseController {
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据id查询", notes = "根据id查询")
public ResponseModel<Object> selectById(HttpServletRequest request, @PathVariable Long id) {
if(redisUtils.hasKey(RedisKey.ALERTCALLED_ID+id)){
Object obj= redisUtils.get(RedisKey.ALERTCALLED_ID+id);
return ResponseHelper.buildResponse(obj);
......@@ -140,10 +140,10 @@ public class AlertCalledController extends BaseController {
for (AlertFormValue alertFormValue : list) {
FormValue value = new FormValue(alertFormValue.getFieldCode(), alertFormValue.getFieldName(), "text", alertFormValue.getFieldValue(),alertFormValue.isBlock());
formValue.add(value);
}
}
}
AlertCalledFormVo alertCalledFormVo = new AlertCalledFormVo(alertCalled, formValue);
redisUtils.set(RedisKey.ALERTCALLED_ID+id,JSON.toJSON(alertCalledFormVo),time);
return ResponseHelper.buildResponse(alertCalledFormVo);
}
......@@ -161,7 +161,7 @@ public class AlertCalledController extends BaseController {
Page<AlertCalled> pageBean;
IPage<AlertCalled> page;
QueryWrapper<AlertCalled> alertCalledQueryWrapper = new QueryWrapper<>();
setQueryWrapper(alertCalledQueryWrapper, alertCalled,sort);
if (StringUtils.isBlank(pageNum) || StringUtils.isBlank(pageSize)) {
......@@ -172,9 +172,9 @@ public class AlertCalledController extends BaseController {
page = iAlertCalledService.page(pageBean, alertCalledQueryWrapper);
return ResponseHelper.buildResponse(page);
}
/**
*
*
* <pre>
* 相似警情分页查询
* </pre>
......@@ -196,7 +196,7 @@ public class AlertCalledController extends BaseController {
}
/**
*
*
* <pre>
* 初始化ES
* </pre>
......@@ -209,7 +209,7 @@ public class AlertCalledController extends BaseController {
public ResponseModel<Boolean> initEs() throws Exception {
return ResponseHelper.buildResponse(eSAlertCalledService.initEs());
}
/**
* 列表无分页查询
*
......@@ -228,18 +228,18 @@ public class AlertCalledController extends BaseController {
private QueryWrapper<AlertCalled> setQueryWrapper(QueryWrapper<AlertCalled> queryWrapper, AlertCalled alertCalled,String sort){
Class<? extends AlertCalled> aClass = alertCalled.getClass();
queryWrapper.eq("is_delete", 0);
if(sort!=null) {
String[] date= sort.split(",");
if(date[1].equals("ascend")) {
queryWrapper.orderByAsc(RedisKey.humpToLine(date[0]));
}else {
}else {
queryWrapper.orderByDesc(RedisKey.humpToLine(date[0]));
}
}
}else {
queryWrapper.orderByDesc("call_time");
}
if (alertCalled.getCallTimeStart() != null && alertCalled.getCallTimeEnd() != null) {
queryWrapper.between("call_time", alertCalled.getCallTimeStart(), alertCalled.getCallTimeEnd());
}
......
......@@ -4,6 +4,7 @@ import java.util.Arrays;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -180,7 +181,7 @@ public class PowerTransferController extends BaseController {
@GetMapping(value = "/power/tree")
@ApiOperation(value = "力量调派资源树", notes = "力量调派资源树")
public ResponseModel<Object> getPowerTree() {
iPowerTransferService.getPowerTree();
powerTransferService.getPowerTree();
return ResponseHelper.buildResponse("");
}
}
......
......@@ -79,7 +79,7 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
/**
* 同步保存ES
*/
eSAlertCalledService.saveAlertCalledToES(alertCalled);
// eSAlertCalledService.saveAlertCalledToES(alertCalled);
return alertCalledVo;
}
......
......@@ -28,7 +28,7 @@ import com.yeejoin.amos.boot.module.jcs.api.enums.AlertStatusEnum;
import com.yeejoin.amos.boot.module.jcs.biz.dao.ESAlertCalledRepository;
/**
*
*
* <pre>
* 警情信息ES检索服务
* </pre>
......@@ -41,22 +41,22 @@ public class ESAlertCalledService {
@Autowired
private ElasticsearchRestTemplate elasticsearchTemplate;
@Autowired
private ESAlertCalledRepository esAlertCalledRepository;
@Autowired
private AlertCalledServiceImpl alertCalledService;
@PostConstruct
public void init() throws Exception
{
//初始化ES,重建索引
initEs();
}
/**
* 重建索引
*/
......@@ -66,26 +66,26 @@ public class ESAlertCalledService {
* 同步历史48小时以内的警情处置记录
*/
QueryWrapper<AlertCalled> wrapper = new QueryWrapper<>();
long currentTime = System.currentTimeMillis() ;
currentTime = currentTime - 480*60*60*1000;
Date date=new Date(currentTime);
wrapper.ge("call_time", date);
List<AlertCalled> alertCalleds = alertCalledService.list(wrapper);
if (!ValidationUtil.isEmpty(alertCalleds))
{
for (AlertCalled alertCalled : alertCalleds)
for (AlertCalled alertCalled : alertCalleds)
{
saveAlertCalledToES(alertCalled);
}
}
return true;
}
/**
*
*
* <pre>
* 批量保存
* </pre>
......@@ -93,18 +93,18 @@ public class ESAlertCalledService {
* @param list 警情信息列表
*/
public void saveAll(List<AlertCalled> alertCalleds) throws Exception{
if (!ValidationUtil.isEmpty(alertCalleds))
{
for (AlertCalled alertCalled : alertCalleds)
{
this.saveAlertCalledToES(alertCalled);
}
}
}
}
/**
*
*
* <pre>
* 根据警情记录批量保存
* </pre>
......@@ -127,7 +127,7 @@ public class ESAlertCalledService {
if (alertCalled.getAlertStatus())
{
esAlertCalled.setAlertStatusStr(AlertStatusEnum.CLOSED.getCode());
}else
}else
{
esAlertCalled.setAlertStatusStr(AlertStatusEnum.UNCLOSED.getCode());
}
......@@ -135,14 +135,14 @@ public class ESAlertCalledService {
esAlertCalled.setUnitInvolved(alertCalled.getUnitInvolved());
esAlertCalled.setCoordinateX(alertCalled.getCoordinateX());
esAlertCalled.setCoordinateY(alertCalled.getCoordinateY());
esAlertCalledRepository.save(esAlertCalled);
return esAlertCalled;
}
/**
*
*
* <pre>
* 从ES库批量删除
* </pre>
......@@ -162,7 +162,7 @@ public class ESAlertCalledService {
return true;
}
/**
* 根据id查询ES存储对象
*
......@@ -182,16 +182,16 @@ public class ESAlertCalledService {
* @return
*/
@SuppressWarnings({ "rawtypes" })
public Page<ESAlertCalledDto> queryByKeys(ESAlertCalledRequestDto alertCalledVo, int current, int size)
public Page<ESAlertCalledDto> queryByKeys(ESAlertCalledRequestDto alertCalledVo, int current, int size)
{
Page<ESAlertCalledDto> result = new Page<ESAlertCalledDto>(current, size);
String[] alertStatus = alertCalledVo.getAlertStatus();
if (ValidationUtil.isEmpty(alertStatus))
{
return result;
}
AlertCalled alertCalled = alertCalledVo.getAlertCalled();
if (ValidationUtil.isEmpty(alertCalled))
{
......@@ -244,13 +244,13 @@ public class ESAlertCalledService {
.must(QueryBuilders.matchQuery("unitInvolved", alertCalled.getUnitInvolved()));
boolMust.should(qb5);
}
/**
* 一般火灾,条件构造
*/
// 创建查询构造器
NativeSearchQueryBuilder queryBuilder = new NativeSearchQueryBuilder()
// 分页
......@@ -262,7 +262,7 @@ public class ESAlertCalledService {
// 对高亮词条进行操作
SearchHits<ESAlertCalled> searchHits =elasticsearchTemplate.search(queryBuilder.build(), ESAlertCalled.class);
List<ESAlertCalledDto> list = new LinkedList<>();
for (SearchHit searchHit : searchHits.getSearchHits())
{
......@@ -272,8 +272,8 @@ public class ESAlertCalledService {
}
result.setRecords(list);
result.setTotal(searchHits.getTotalHits());
return result;
}
}
......@@ -2,7 +2,9 @@ package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.google.common.collect.Lists;
import com.yeejoin.amos.boot.biz.common.utils.TreeParser;
import com.yeejoin.amos.boot.module.jcs.api.dto.FireCarDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.FireTeamDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.PowerTransferCompanyDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.PowerTransferCompanyResourcesDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.PowerTransferDto;
......@@ -13,15 +15,11 @@ import com.yeejoin.amos.boot.module.jcs.api.entity.PowerTransfer;
import com.yeejoin.amos.boot.module.jcs.api.entity.PowerTransferCompany;
import com.yeejoin.amos.boot.module.jcs.api.entity.PowerTransferCompanyResources;
import com.yeejoin.amos.boot.module.jcs.api.entity.Template;
import com.yeejoin.amos.boot.module.jcs.api.enums.FireBrigadeTypeEnum;
import com.yeejoin.amos.boot.module.jcs.api.enums.FireCarStatusEnum;
import com.yeejoin.amos.boot.module.jcs.api.feign.EquipFeignClient;
import com.yeejoin.amos.boot.module.jcs.api.mapper.PowerTransferMapper;
import com.yeejoin.amos.boot.module.jcs.api.service.EquipFeignService;
import com.yeejoin.amos.boot.module.jcs.api.service.IAlertCalledService;
import com.yeejoin.amos.boot.module.jcs.api.service.IAlertFormValueService;
import com.yeejoin.amos.boot.module.jcs.api.service.IPowerTransferCompanyResourcesService;
import com.yeejoin.amos.boot.module.jcs.api.service.IPowerTransferCompanyService;
import com.yeejoin.amos.boot.module.jcs.api.service.IPowerTransferService;
import com.yeejoin.amos.boot.module.jcs.api.service.ITemplateService;
import com.yeejoin.amos.boot.module.jcs.api.vo.PowerTransferCompanyResourcesVo;
import com.yeejoin.amos.boot.module.jcs.api.vo.PowerTransferCompanyVo;
import com.yeejoin.amos.boot.module.jcs.api.vo.PowerTransferVo;
......@@ -31,6 +29,7 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
......@@ -66,11 +65,12 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe
AlertFormValueServiceImpl alertFormValueService;
@Autowired
EquipFeignService equipFeignService;
EquipFeignClient equipFeignService;
@Autowired
FireTeamServiceImpl fireTeamService;
@Override
public PowerTransferVo getPowerTransferList(Long alertCalledId) {
List<PowerTransferCompanyResourcesVo> powerTransferList =
this.baseMapper.getPowerTransferList(alertCalledId);
......@@ -132,7 +132,29 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe
});
}
// 2.查询消防队伍列表
List<FireTeam> fullTimeFireBrigadeList = fireTeamService.list(new QueryWrapper<FireTeam>().eq("type_code", ""));
List<FireTeam> fullTimeFireBrigadeList = fireTeamService.list(new QueryWrapper<FireTeam>().eq("type_code",
FireBrigadeTypeEnum.专职消防队.getCode()));
List<FireTeam> monitorFireBrigadeList = fireTeamService.list(new QueryWrapper<FireTeam>().eq("type_code",
FireBrigadeTypeEnum.监控大队.getCode()));
// 3.组装专职消防队伍车辆
// List<FireTeamDto> fireTeamDtoList = Lists.newArrayList();
// if (!CollectionUtils.isEmpty(fullTimeFireBrigadeList)) {
// fullTimeFireBrigadeList.forEach(brigade -> {
// FireTeamDto teamDto = new FireTeamDto();
// BeanUtils.copyProperties(brigade, teamDto);
// teamDto.setType(FireBrigadeTypeEnum.专职消防队.getKey());
//
//// teamDto.setChildren();
// });
// }
fireCarDtoList.stream().collect(Collectors.groupingBy(FireCarDto::getTeamId));
try {
TreeParser.getTree(null, monitorFireBrigadeList, FireTeam.class.getName(), "getSequenceNbr", 2, "getName",
"getParent");
} catch (Exception e) {
e.printStackTrace();
}
}
private List<PowerTransferCompanyResources> DtoEntityBatchConvert(List<PowerTransferCompanyResourcesDto> powerTransferCompanyResourcesDtoList, Long powerTransferCompanySequenceNbr) {
......@@ -207,6 +229,7 @@ public class PowerTransferServiceImpl extends BaseService<PowerTransferDto, Powe
}
}
@Override
public List<PowerTransferCompanyVo> getLastPowerTransferCompany(Long alertCalledId) {
return this.baseMapper.getLastPowerTransferCompany(alertCalledId);
}
......
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