Commit bb5b0d31 authored by chenhao's avatar chenhao

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

parents 04c5f577 54a2dcd6
......@@ -68,14 +68,25 @@ public class FireExpertsDto extends BaseDto {
private String politicalOutlook;
// @ExplicitConstraint(indexNum = 9, sourceClass = RoleNameExplicitConstraint.class, method = "getAdministrativeDivisions") //固定下拉内容
@ExcelProperty(value = "现居住地", index = 9)
@ExplicitConstraint(indexNum = 9,sourceClass = CommonExplicitConstraint.class,method ="getCitys")
@ApiModelProperty(value = "现居住地")
@ExcelProperty(value = "现居住地", index = 9)
private String residence;
@ExcelProperty(value = "居住地详情", index = 10)
@ExcelProperty(value = "籍贯/户口所在地详细地址", index = 17)
@ApiModelProperty(value = "籍贯/户口所在地详细地址")
private String nativePlaceVal;
@ExplicitConstraint(indexNum =10,sourceClass = CommonExplicitConstraint.class,method ="getCitys")
@ExcelProperty(value = "现居住地", index = 10)
@ApiModelProperty(value = "居住地详情")
private String residenceDetails;
@ExcelProperty(value = "现居住地详细地址", index = 18)
@ApiModelProperty(value = "现居住地详细地址")
private String residenceDetailVal;
@ExcelProperty(value = "办公电话", index = 11)
@ApiModelProperty(value = "办公电话")
private String officePhone;
......
......@@ -106,4 +106,10 @@ public class FireExperts extends BaseEntity {
@ApiModelProperty(value = "出生日期")
private Date birthdayTime;
@ApiModelProperty(value = "现居住地详细地址")
private String residenceDetailVal;
@ApiModelProperty(value = "户籍所在地详细地址")
private String nativePlaceVal;
}
package com.yeejoin.amos.boot.module.jcs.api.feign;
import org.springframework.http.HttpStatus;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
public class CommonResponseUtil2 {
public static ResponseModel success() {
ResponseModel res = new ResponseModel();
res.setDevMessage(Constant.RESULT_SUCCESS);
res.setStatus(HttpStatus.OK.value());
return res;
}
public static ResponseModel success(Object obj) {
ResponseModel res = new ResponseModel();
res.setResult(obj);
res.setDevMessage(Constant.RESULT_SUCCESS);
res.setStatus(HttpStatus.OK.value());
return res;
}
public static ResponseModel success(Object obj, String message) {
ResponseModel res = new ResponseModel();
res.setResult(obj);
res.setDevMessage(message);
res.setStatus(HttpStatus.OK.value());
return res;
}
public static ResponseModel failure() {
ResponseModel res = new ResponseModel();
res.setDevMessage(Constant.RESULT_FAILURE);
res.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value());
return res;
}
public static ResponseModel failure(String message) {
ResponseModel res = new ResponseModel();
res.setDevMessage(Constant.RESULT_FAILURE);
res.setMessage(message);
res.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value());
return res;
}
public static ResponseModel failure(Object obj, String message) {
ResponseModel res = new ResponseModel();
res.setResult(obj);
res.setDevMessage(Constant.RESULT_FAILURE);
res.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value());
return res;
}
}
package com.yeejoin.amos.boot.module.jcs.api.feign;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.time.format.DateTimeFormatter;
/**
* @Description: 常量类
* @Author: duanwei
* @Date: 2019/7/29
*/
public interface Constant {
String SMALL_PRO_PRCODE = "SMALL_PRO_PRCODE_";
String RESULT_SUCCESS = "SUCCESS";
String RESULT_FAILURE = "FAILURE";
/**
* 任务-作业交底
*/
Integer JOB_TYPE = 0;
/**
* 任务-三交三查
*/
Integer HAND_QUERY = 1;
/**
* 违规管理
*/
Integer BAD_MANAGEMENT = 2;
Charset DEFAULT_CHARSET = StandardCharsets.UTF_8;
String FILE_SEPARATOR = System.getProperty("file.separator");
DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
String PAGE_NUM = "0";
String SIZE_NUM = "20";
String PAGE = "page";
String SIZE = "size";
String ZERO = "0";
String ONE = "1";
String TWO = "2";
String THREE = "3";
String FOUR = "4";
String FIVE = "5";
String NULL = "";
String JSON_NULL = "[]";
/**
* 请求成功
*/
String SUCCESS = "200";
/**
* 请求错误
*/
String ERROR = "300";
/**
* 无权限
*/
String PERMISSION = "401";
/**
* 请求成功,其他错误
*/
String DATA_NULL = "402";
/**
* 请求失败
*/
String FAILED = "999";
/**
* 最大值
*/
Integer MAX = 32767;
/**
* 数据请求返回码
*/
public static final int RESCODE_SUCCESS = 1000; //成功
public static final int RESCODE_SUCCESS_MSG = 1001; //成功(有返回信息)
public static final int RESCODE_EXCEPTION = 1002; //请求抛出异常
public static final int RESCODE_NOLOGIN = 1003; //未登陆状态
public static final int RESCODE_NOEXIST = 1004; //查询结果为空
public static final int RESCODE_NOAUTH = 1005; //无操作权限
public static final int RESCODE_LOGINEXPIRE = 1006; //登录过期
/**
* token
*/
public static final int JWT_ERRCODE_EXPIRE = 1007;//Token过期
public static final int JWT_ERRCODE_FAIL = 1008;//验证不通过
/**
* jwt
*/
public static final String JWT_ID = "jwt-black";//jwt签发者
public static final String JWT_SECRET = "Isi5Ob9OfvJt+4IHoMJlHkS1ttg=";//密匙
public static final int JWT_TTL = 60 * 60 * 1000; // 60*60*1000; //millisecond
public static final int JWT_REFRESH_INTERVAL = 18 * 1000; //55*60*1000; //millisecond
public static final int JWT_REFRESH_TTL = 60 * 1000; // 12*60*60*1000; //millisecond
}
......@@ -128,10 +128,16 @@
<if test="alertSourceCode!= null ">
and alert_source_code = #{alertSourceCode}
</if>
<if test="data != null and lift == 'ascend'">
<if test="data == 'address' and data != null and lift == 'ascend'">
order by CONVERT(address USING 'gbk') ASC limit #{current},#{size}
</if>
<if test="data == 'address' and data != null and lift == 'descend'">
order by CONVERT(address USING 'gbk') DESC limit #{current},#{size}
</if>
<if test="data != null and data != 'address' and lift == 'ascend'">
order by #{data} ASC limit #{current},#{size}
</if>
<if test="data != null and lift == 'descend'">
<if test="data != null and data != 'address' and lift == 'descend'">
order by #{data} DESC limit #{current},#{size}
</if>
<if test="data == null ">
......
......@@ -70,7 +70,7 @@ public enum DangerCheckTypeLevelEnum {
this.condition = condition;
}
public String getCondition() {
public String getCondition() {
return condition;
}
}
......@@ -6,6 +6,7 @@ import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* @author xixinzhao
......@@ -149,4 +150,10 @@ public class DangerDto implements Serializable {
* 隐患类型描述
*/
private String dangerTypeName;
/**
* 业务信息
*/
private Map bizInfo;
}
package com.yeejoin.amos.boot.module.tzs.api.dto;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
import java.util.List;
/**
* 警情接警填报记录
......@@ -147,10 +149,13 @@ public class AlertCalledDto extends BaseDto {
@ApiModelProperty(value = "投诉描述/故障报修描述")
private String describe;
@ApiModelProperty(value = "图片")
private String images;
//
// @ApiModelProperty(value = "图片")
// private String images;
@ApiModelProperty(value = "设备id")
private Long equipmentId;
@ApiModelProperty(value = "现场照片")
private List<AttachmentDto> images;
}
package com.yeejoin.amos.boot.module.tzs.api.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* @author litw
* @date 2021-09-27.
*/
@Data
public class AlertHandlerDto {
@ApiModelProperty(value = "处置时间")
Map<String, Date> handlerTime;
@ApiModelProperty(value = "处置信息")
List<AlertHandlerInfoDto> alertHandlerInfoDto;
}
package com.yeejoin.amos.boot.module.tzs.api.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author litw
* @date 2021-09-27.
*/
@Data
public class AlertHandlerInfoDto {
@ApiModelProperty(value = "处置流程")
String process;
@ApiModelProperty(value = "接警")
String answerThePolice;
@ApiModelProperty(value = "上报")
String report;
@ApiModelProperty(value = "派遣/通知")
String notice;
@ApiModelProperty(value = "到达")
String arrive;
@ApiModelProperty(value = "完成")
String complete;
@ApiModelProperty(value = "回访")
String returnVisit;
}
package com.yeejoin.amos.boot.module.tzs.api.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author litw
* @date 2021-09-26.
*/
@Data
@ApiModel(value="EsElevatorDto", description="ES电梯信息")
public class EsElevatorDto {
/**
*
*/
private static final long serialVersionUID = 1L;
/**
* 注册编码
*/
@ApiModelProperty(value = "注册编码")
private String registerCode;
/**
* 所属省
*/
@ApiModelProperty(value = "所属省")
private String province;
/**
* 所属地市
*/
@ApiModelProperty(value = "所属地市")
private String city;
/**
* 所属区县
*/
@ApiModelProperty(value = "所属区县")
private String district;
/**
* 所属区域代码
*/
@ApiModelProperty(value = "所属区域代码")
private String regionCode;
/**
* 电梯识别码
*/
@ApiModelProperty(value = "电梯识别码")
private Integer rescueCode;
/**
* 电梯经度
*/
@ApiModelProperty(value = "电梯经度")
private String longitude;
/**
* 电梯纬度
*/
@ApiModelProperty(value = "电梯纬度")
private String latitude;
/**
* 地址
*/
@ApiModelProperty(value = "地址")
private String address;
/**
* 警情类型code
*/
@ApiModelProperty(value = "警情类型")
private String alarmTypeCode;
/**
* 警情id
*/
@ApiModelProperty(value = "警情id")
private String alertId;
}
......@@ -3,12 +3,14 @@ package com.yeejoin.amos.boot.module.tzs.api.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.Date;
import java.util.List;
/**
* 警情接警填报记录
......@@ -225,8 +227,9 @@ public class AlertCalled extends BaseEntity {
@ApiModelProperty(value = "设备id")
private Long equipmentId;
@TableField("images")
@ApiModelProperty(value = "图片")
private String images;
@TableField(exist=false)
@ApiModelProperty(value = "现场照片")
private List<AttachmentDto> images;
}
package com.yeejoin.amos.boot.module.tzs.api.entity;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
/**
* @author litw
* @date 2021-09-26.
*/
@Data
@Accessors(chain = true)
@Document(indexName = "elev", type = "tzsElevator", shards = 1, replicas = 0)
public class EsElevator {
/** 主键 */
@Id
private Long sequenceNbr;
/**
* 注册编码
*/
@Field(type = FieldType.Text)
private String registerCode;
/**
* 所属省
*/
@Field(type = FieldType.Text)
private String province;
/**
* 所属地市
*/
@Field(type = FieldType.Text)
private String city;
/**
* 所属区县
*/
@Field(type = FieldType.Text)
private String district;
/**
* 所属区域代码
*/
@Field(type = FieldType.Text)
private String regionCode;
/**
* 电梯识别码
*/
@Field(type = FieldType.Text)
private Integer rescueCode;
/**
* 电梯经度
*/
@Field(type = FieldType.Text)
private String longitude;
/**
* 电梯纬度
*/
@Field(type = FieldType.Text)
private String latitude;
/**
* 地址
*/
@Field(type = FieldType.Text, searchAnalyzer = "ik_max_word", analyzer = "ik_max_word")
private String address;
}
......@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledFormDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledQueryDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertHandlerDto;
import com.yeejoin.amos.boot.module.tzs.api.enums.DispatchPaperEnums;
import org.typroject.tyboot.core.rdbms.annotation.Condition;
import org.typroject.tyboot.core.rdbms.annotation.Operator;
......@@ -58,4 +59,8 @@ public interface IAlertCalledService {
* @return
*/
Boolean updateAlertStage(AlertCalledDto alertCalledVo, DispatchPaperEnums stage);
AlertHandlerDto getHandlerInfo(String alertId);
}
......@@ -4,6 +4,7 @@ import java.util.List;
import com.yeejoin.amos.boot.module.common.api.entity.FailureMaintain;
import com.yeejoin.amos.boot.module.common.biz.service.impl.SourceFileServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
......@@ -62,7 +63,7 @@ public class FailureMaintainController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "维修列表记录查询", notes = "维修列表记录查询")
@GetMapping(value = "/list/{faultId}")
public ResponseModel<List<FailureMaintain>> findByFaultIDFotList(@PathVariable long faultId) {
public ResponseModel<List<FailureMaintainDto>> findByFaultIDFotList(@PathVariable long faultId) {
return ResponseHelper.buildResponse(failureMaintainServiceImpl.findByfaultId(faultId));
}
......
......@@ -444,7 +444,7 @@ public class OrgUsrController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/getParentBuilding/{id}", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "获取最上级建筑信息", notes = "获取最上级建筑信息")
@ApiOperation(httpMethod = "GET", value = "获取最上级station", notes = "获取最上级建筑信息")
public ResponseModel<JSONObject> getBuliding(@PathVariable Long id) {
JSONObject equipjSONObject = this.getBulid(id);
return ResponseHelper.buildResponse(equipjSONObject);
......
package com.yeejoin.amos.boot.module.common.biz.service.impl;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
......@@ -7,9 +8,11 @@ import java.util.List;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr;
import com.yeejoin.amos.boot.module.common.api.entity.SourceFile;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -175,10 +178,19 @@ public class FailureMaintainServiceImpl extends BaseService<FailureMaintainDto,
/**
* 根据FaultId查询
*/
public List<FailureMaintain> findByfaultId(Long faultId) {
public List<FailureMaintainDto> findByfaultId(Long faultId) {
LambdaQueryWrapper<FailureMaintain> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(FailureMaintain::getFaultId, faultId).orderByDesc(FailureMaintain::getMaintainTime);
return baseMapper.selectList(lambdaQueryWrapper);
List<FailureMaintain> failureMaintains = baseMapper.selectList(lambdaQueryWrapper);
List<FailureMaintainDto> failureMaintainDtos = new ArrayList<>();
for (FailureMaintain failureMaintain : failureMaintains) {
FailureMaintainDto failureMaintainDto = new FailureMaintainDto();
BeanUtils.copyProperties(failureMaintain,failureMaintainDto);
List<SourceFile> attachment = sourceFileServiceImpl.findBySourceId(failureMaintain.getSequenceNbr());
failureMaintainDto.setAttachment(attachment);
failureMaintainDtos.add(failureMaintainDto);
}
return failureMaintainDtos;
}
/**
......
......@@ -132,7 +132,7 @@ public class FirefightersController extends BaseController {
List<FirefightersJacket> firefightersJacket = iFirefightersJacketService.list(queryWrapper);
if (firefightersJacket != null && firefightersJacket.size() > 0) {
// BUG 2222 by litw start 2021年9月10日
throw new BadRequest("该消防还有在装装备!");
return ResponseHelper.buildResponse("-2");
}
try {
iFirefightersService.update(new UpdateWrapper<Firefighters>().eq("sequence_nbr", id).set("is_delete", 1));
......
......@@ -6,8 +6,10 @@ 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.NameUtils;
import com.yeejoin.amos.boot.module.common.api.entity.FirestationJacket;
import com.yeejoin.amos.boot.module.common.biz.service.impl.FireStationServiceImpl;
import com.yeejoin.amos.boot.module.jcs.api.dto.EquipSpecificDto;
import com.yeejoin.amos.boot.module.jcs.api.dto.EquipmentOnCarDto;
import com.yeejoin.amos.boot.module.jcs.api.feign.CommonResponseUtil2;
import com.yeejoin.amos.boot.module.jcs.biz.service.impl.FirestationJacketServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -40,7 +42,8 @@ public class FirestationJacketController extends BaseController {
@Autowired
FirestationJacketServiceImpl iFirestationJacketService;
@Autowired
FireStationServiceImpl fireStationServiceImpl;
/**
* 新增消防人员配装记录
*
......@@ -100,11 +103,33 @@ public class FirestationJacketController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "根据id查询", notes = "根据id查询")
public ResponseModel<FirestationJacket> selectById(HttpServletRequest request, @PathVariable Long id) {
QueryWrapper<FirestationJacket> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("firestation_id", id);
queryWrapper.eq("firefighters_id", id);
FirestationJacket firestationJacket = iFirestationJacketService.getOne(queryWrapper);
return ResponseHelper.buildResponse(firestationJacket);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@DeleteMapping(value = "/Firestation/{sequenceNbr}")
@ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除微型消防站", notes = "根据sequenceNbr删除微型消防站")
public ResponseModel deleteBySequenceNbr(HttpServletRequest request,
@PathVariable(value = "sequenceNbr") Long sequenceNbr) {
QueryWrapper<FirestationJacket> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("firefighters_id", sequenceNbr);
FirestationJacket firestationJacket = iFirestationJacketService.getOne(queryWrapper);
if(firestationJacket!=null){
return CommonResponseUtil2.failure("微型消防站有配装装备,不能删除!");
}
return ResponseHelper.buildResponse(fireStationServiceImpl.updateisDelete(sequenceNbr));
}
/**
* 列表分页查询
*
......
......@@ -125,7 +125,7 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire
}
t.setCarNum(carNum);
t.setFighterNum(fighterNum);
/*//递归查找全部战备人数 BUG2217 bykongfm
/*//递归查找全部战备人数 BUG2217 bykongfmfirefighters/1435850387868385282
t.setFighterNum(getFightNumByTeamId(t.getSequenceNbr()));*/
});
fireTeamListPage.setRecords(fireTeamList);
......
......@@ -65,7 +65,7 @@ public class HiddenDangerController extends AbstractBaseController {
@PutMapping(value = "/{latentDangerId}")
public ResponseModel updateDanger(
@RequestBody DangerDto dangerDto,
@PathVariable Long latentDangerId) {
@PathVariable Long latentDangerId) throws Exception {
dangerDto = iHiddenDangerService.updateDanger(latentDangerId, dangerDto);
return ResponseHelper.buildResponse(dangerDto);
}
......
......@@ -37,6 +37,11 @@ public class HiddenDangerDto {
*/
private Long pointId;
/**
* 点名称
*/
private String pointName;
/**
* 隐患类型(1-防火监督检查;2-自行检查)
......@@ -69,10 +74,6 @@ public class HiddenDangerDto {
*/
private String checkUserName;
/**
* 责任单位
*/
private String pointName;
/**
* 状态
......
......@@ -3,7 +3,6 @@ package com.yeejoin.amos.supervision.business.service.impl;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.util.BeanUtil;
import com.google.common.base.Joiner;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
......@@ -18,28 +17,26 @@ import com.yeejoin.amos.supervision.business.dao.mapper.*;
import com.yeejoin.amos.supervision.business.dao.repository.*;
import com.yeejoin.amos.supervision.business.dto.CheckInputItemDto;
import com.yeejoin.amos.supervision.business.dto.CheckRecordDto;
import com.yeejoin.amos.supervision.business.feign.DangerFeignClient;
import com.yeejoin.amos.supervision.core.common.dto.DangerDto;
import com.yeejoin.amos.supervision.business.dto.HiddenDangerDto;
import com.yeejoin.amos.supervision.business.entity.mybatis.*;
import com.yeejoin.amos.supervision.business.feign.DangerFeignClient;
import com.yeejoin.amos.supervision.business.feign.EquipFeign;
import com.yeejoin.amos.supervision.business.param.*;
import com.yeejoin.amos.supervision.business.service.intfc.ICheckService;
import com.yeejoin.amos.supervision.business.service.intfc.IEquipmentHandlerService;
import com.yeejoin.amos.supervision.business.service.intfc.IPlanTaskService;
import com.yeejoin.amos.supervision.business.service.intfc.IPointService;
import com.yeejoin.amos.supervision.business.service.intfc.*;
import com.yeejoin.amos.supervision.business.util.CheckDetailInputPageParam;
import com.yeejoin.amos.supervision.business.util.ToolUtils;
import com.yeejoin.amos.supervision.business.vo.CheckAnalysisVo;
import com.yeejoin.amos.supervision.business.vo.CheckInfoVo;
import com.yeejoin.amos.supervision.business.vo.CheckVo;
import com.yeejoin.amos.supervision.common.enums.*;
import com.yeejoin.amos.supervision.core.common.dto.DangerDto;
import com.yeejoin.amos.supervision.core.common.request.CommonPageable;
import com.yeejoin.amos.supervision.core.common.response.*;
import com.yeejoin.amos.supervision.core.util.DateUtil;
import com.yeejoin.amos.supervision.core.util.StringUtil;
import com.yeejoin.amos.supervision.dao.entity.*;
import com.yeejoin.amos.supervision.feign.RemoteSecurityService;
import org.apache.commons.beanutils.BeanUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.cxf.common.util.CollectionUtils;
import org.assertj.core.util.Sets;
......@@ -58,15 +55,13 @@ import java.util.*;
import java.util.stream.Collectors;
@Service("checkService")
@Slf4j
public class CheckServiceImpl implements ICheckService {
@Autowired
private CheckMapper checkMapper;
@Autowired
private ICheckService checkService;
@Autowired
private IPointService iPointService;
@Autowired
......@@ -74,8 +69,7 @@ public class CheckServiceImpl implements ICheckService {
@Resource
ICheckShotDao checkShotDao;
@Resource
IPlanTaskDao planTaskDao;
@Autowired
PlanTaskMapper planTaskMapper;
......@@ -97,9 +91,6 @@ public class CheckServiceImpl implements ICheckService {
IEquipmentHandlerService equipmentHandlerService;
@Autowired
private IPointClassifyDao iPointClassifyDao;
@Autowired
IPointDao iPointDao;
@Autowired
......@@ -116,17 +107,15 @@ public class CheckServiceImpl implements ICheckService {
private final int HTTP_OK_STATUS = 200;
// @Value("${file.ip}")
// private String fileIp;
//
// @Value("${file.port}")
// private String filePort;
@Value("${file.url}")
private String fileUrl;
@Value("${server.servlet.context-path}")
private String contextPath;
@Autowired
IHiddenDangerService iHiddenDangerService;
@Override
public Page<CheckInfoVo> getCheckInfo(String toke, String product, String appKey, CheckInfoPageParam param) {
long total = checkMapper.countCheckInfoData(param);
......@@ -1357,7 +1346,7 @@ public class CheckServiceImpl implements ICheckService {
@Override
@Transactional
public List<CheckInputItemDto> saveCheckRecord(CheckRecordParam recordParam, ReginParams reginParams) throws Exception {
public List<CheckInputItemDto> saveCheckRecord(CheckRecordParam recordParam, ReginParams reginParams) throws Exception {
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
if (ObjectUtils.isEmpty(reginParams.getUserModel()) && ObjectUtils.isEmpty(reginParams.getCompany()) && ObjectUtils.isEmpty(personIdentity)) {
throw new RuntimeException("获取用户信息失败");
......@@ -1584,16 +1573,27 @@ public class CheckServiceImpl implements ICheckService {
/**
* 保存隐患数据
*/
private void saveDanger (List<DangerDto> allDanger, PlanTask planTask, Check check, CheckRecordParam recordParam ) {
private void saveDanger(List<DangerDto> allDanger, PlanTask planTask, Check check, CheckRecordParam recordParam) {
if (!ObjectUtils.isEmpty(allDanger)) {
// 根据bizId删除关系表
List<Long> collect = allDanger.stream().map(DangerDto::getId).collect(Collectors.toList());
hiddenDangerDao.deleteByDangerIdIn(collect);
allDanger.forEach(dangerDto -> {
HiddenDangerDto hiddenDangerDto = new HiddenDangerDto();
hiddenDangerDto.setPlanId(planTask.getPlanId());
hiddenDangerDto.setPointId(recordParam.getPointId());
hiddenDangerDto.setCheckInputId(dangerDto.getBizId());
hiddenDangerDto.setDangerType(DangerHandleTypeEnum.SUPERVISION.getCode());
try {
dangerDto.setBizInfo(iHiddenDangerService.buildBizInfo(hiddenDangerDto));
} catch (Exception e) {
log.error(e.getMessage(), e);
throw new RuntimeException("组织基本数据失败");
}
});
// 1.feign调用保存隐患
FeignClientResult<List<DangerDto>> listFeignClientResult = DangerFeignClient.saveOrUpdateBatch(allDanger);
if (ObjectUtils.isEmpty(listFeignClientResult.getResult()) || listFeignClientResult.getStatus() != HTTP_OK_STATUS) {
throw new RuntimeException(listFeignClientResult.getDevMessage());
}
......
package com.yeejoin.amos.supervision.business.service.impl;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Sequence;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
......@@ -10,15 +11,19 @@ import com.yeejoin.amos.boot.biz.common.excel.DataSources;
import com.yeejoin.amos.boot.biz.common.excel.ExcelUtil;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.supervision.business.dao.mapper.HiddenDangerMapper;
import com.yeejoin.amos.supervision.business.dao.repository.IHiddenDangerDao;
import com.yeejoin.amos.supervision.business.dao.repository.*;
import com.yeejoin.amos.supervision.business.dto.HiddenDangerDto;
import com.yeejoin.amos.supervision.business.dto.HiddenDangerExportDataDto;
import com.yeejoin.amos.supervision.business.dto.HiddenDangerImportDto;
import com.yeejoin.amos.supervision.business.dto.HiddenDangerTemplateDto;
import com.yeejoin.amos.supervision.business.feign.DangerFeignClient;
import com.yeejoin.amos.supervision.business.service.intfc.IHiddenDangerService;
import com.yeejoin.amos.supervision.common.enums.CheckTypeSuEnum;
import com.yeejoin.amos.supervision.common.enums.DangerCheckTypeLevelEnum;
import com.yeejoin.amos.supervision.common.enums.DangerHandleTypeEnum;
import com.yeejoin.amos.supervision.core.common.dto.DangerDto;
import com.yeejoin.amos.supervision.dao.entity.HiddenDanger;
import com.yeejoin.amos.supervision.dao.entity.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
......@@ -35,6 +40,7 @@ import java.util.stream.Collectors;
* @author DELL
*/
@Service
@Slf4j
public class HiddenDangerServiceImpl implements IHiddenDangerService {
@Autowired
......@@ -55,6 +61,18 @@ public class HiddenDangerServiceImpl implements IHiddenDangerService {
@Autowired
DataSources dataSources;
@Autowired
IPlanDao iPlanDao;
@Autowired
ICheckInputDao iCheckInputDao;
@Autowired
ICheckShotDao iCheckShotDao;
@Autowired
IPointDao iPointDao;
@Override
public List<HiddenDangerExportDataDto> listAll(String planId, Long pointId, String level, String status) {
//1.查询指定计划和公司的关联隐患数据
......@@ -94,12 +112,19 @@ public class HiddenDangerServiceImpl implements IHiddenDangerService {
}
@Override
public DangerDto updateDanger(Long latentDangerId, DangerDto dangerDto) {
public DangerDto updateDanger(Long latentDangerId, DangerDto dangerDto) throws Exception {
HiddenDanger hiddenDanger = iHiddenDangerDao.findByLatentDangerId(latentDangerId);
if (hiddenDanger == null) {
throw new DataNotFound("该隐患数据不存在");
}
//组织业务数据,字段为bizInfo
HiddenDangerDto hiddenDangerDto = new HiddenDangerDto();
Bean.copyExistPropertis(hiddenDanger, hiddenDangerDto);
Map<String, Object> bizInfo = this.buildBizInfo(hiddenDangerDto);
dangerDto.setBizInfo(JSON.parseObject(JSON.toJSONString(bizInfo)));
//feign 调用保存
FeignClientResult<List<DangerDto>> feignClientResult = feignClient.saveOrUpdateBatch(Collections.singletonList(dangerDto));
//更新隐患
List<DangerDto> saveDangers = feignClientResult.getResult();
if (!saveDangers.isEmpty()) {
hiddenDanger.setUpdateDate(new Date());
......@@ -146,18 +171,32 @@ public class HiddenDangerServiceImpl implements IHiddenDangerService {
//1.调用创建隐患
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
List<DangerDto> dtoList = list.stream().map(s -> {
Long seq = sequence.nextId();
String[] dangerArray = s.getDangerLevelName().split("@");
String[] reformTypeArray = s.getReformTypeName().split("@");
String[] pointArray = s.getPointName().split("@");
DangerDto dangerDto = new DangerDto();
Bean.copyExistPropertis(s, dangerDto);
dangerDto.setBizType(contextPath.substring(1));
dangerDto.setBizId(sequence.nextId());
dangerDto.setBizId(seq);
dangerDto.setDangerLevel(dangerArray.length > 1 ? dangerArray[1] : "");
dangerDto.setDangerLevelName(dangerArray.length > 1 ? dangerArray[0] : "");
dangerDto.setReformType(reformTypeArray.length > 1 ? reformTypeArray[1] : "");
dangerDto.setReformTypeName(reformTypeArray.length > 1 ? reformTypeArray[0] : "");
//自行检查
dangerDto.setCheckMode("1");
//导入的为自行检查
dangerDto.setCheckMode(DangerHandleTypeEnum.SELF.getCode());
//组织业务基本数据 对应bizInfo
HiddenDangerDto hiddenDangerDto = new HiddenDangerDto();
hiddenDangerDto.setPlanId(planId);
hiddenDangerDto.setPointId(pointArray.length > 1 ? Long.parseLong(pointArray[1]) : null);
hiddenDangerDto.setCheckInputId(seq);
hiddenDangerDto.setDangerType(DangerHandleTypeEnum.SELF.getCode());
try {
dangerDto.setBizInfo(this.buildBizInfo(hiddenDangerDto));
} catch (Exception e) {
log.error(e.getMessage(),e);
throw new RuntimeException("组织数据失败");
}
return dangerDto;
}).collect(Collectors.toList());
FeignClientResult<List<DangerDto>> feignClientResult = feignClient.saveOrUpdateBatch(dtoList);
......@@ -169,8 +208,8 @@ public class HiddenDangerServiceImpl implements IHiddenDangerService {
hiddenDanger.setPlanId(planId);
hiddenDanger.setLatentDangerId(d.getId());
hiddenDanger.setCheckInputId(d.getBizId());
hiddenDanger.setDangerType("1");
hiddenDanger.setDangerTypeName("自行检查");
hiddenDanger.setDangerType(DangerHandleTypeEnum.SELF.getCode());
hiddenDanger.setDangerTypeName((DangerHandleTypeEnum.SELF.getName()));
hiddenDanger.setCreateDate(new Date());
return hiddenDanger;
}).collect(Collectors.toList());
......@@ -206,4 +245,41 @@ public class HiddenDangerServiceImpl implements IHiddenDangerService {
}
return false;
}
@Override
public Map<String, Object> buildBizInfo(HiddenDangerDto hiddenDangerDto) throws Exception {
Map<String, Object> result = new HashMap<>(32);
Optional<Plan> op = iPlanDao.findById(hiddenDangerDto.getPlanId());
Plan plan = op.orElseThrow((() -> new RuntimeException("计划不存在")));
Point point = iPointDao.findById(hiddenDangerDto.getPointId()).orElseThrow(() -> new RuntimeException("单位不存在"));
//检查级别
DangerCheckTypeLevelEnum dangerCheckTypeLevelEnum = DangerCheckTypeLevelEnum.getEumByCode(plan.getCheckLevel());
//检查类型
CheckTypeSuEnum checkTypeSuEnum = CheckTypeSuEnum.getEumByCode(plan.getCheckTypeId());
String branch = PlanServiceImpl.workFlowExcuteBranch(dangerCheckTypeLevelEnum.getCondition(), checkTypeSuEnum.getCondition());
result.put("planType", branch);
result.put("checkMode", hiddenDangerDto.getDangerType());
result.put("planId", plan.getId());
result.put("planName", plan.getName());
result.put("pointId", point.getId());
result.put("pointName", point.getName());
result.put("bizId", hiddenDangerDto.getCheckInputId());
result.put("bizName", hiddenDangerDto.getInputItemName());
result.put("accompanyingUserId", plan.getLeadPeopleIds());
result.put("accompanyingUserName", plan.getLeadPeopleNames());
this.buildCheckInfo(result, hiddenDangerDto.getCheckInputId());
return result;
}
private void buildCheckInfo(Map<String, Object> result, Long checkInputId) {
CheckInput checkInput = iCheckInputDao.findById(checkInputId).orElse(null);
if (checkInput == null) {
return;
}
List<CheckShot> shotList = iCheckShotDao.findAllByCheckIdAndCheckInputId(checkInput.getCheckId(), checkInput.getId());
result.put("checkUserId", checkInput.getUserId());
result.put("checkUserName", checkInput.getUserName());
result.put("planExecuteTime", checkInput.getCreateDate());
result.put("checkPhotoUrl", shotList.stream().map(CheckShot::getPhotoData).toString());
}
}
......@@ -201,7 +201,7 @@ public class PlanServiceImpl implements IPlanService {
/**
* 判断走哪一种工作流WorkFlowBranchEnum
*/
public String workFlowExcuteBranch (String dangerCheckTypeLevel, String checkType) {
public static String workFlowExcuteBranch (String dangerCheckTypeLevel, String checkType) {
String branch = "";
List<Map<String, String>> enumList = WorkFlowBranchEnum.getEnumList();
if (!ObjectUtils.isEmpty(enumList)){
......
......@@ -3,12 +3,14 @@ package com.yeejoin.amos.supervision.business.service.intfc;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.supervision.business.dto.HiddenDangerDto;
import com.yeejoin.amos.supervision.business.dto.HiddenDangerExportDataDto;
import com.yeejoin.amos.supervision.business.dto.HiddenDangerImportDto;
import com.yeejoin.amos.supervision.core.common.dto.DangerDto;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
* @author DELL
......@@ -41,7 +43,7 @@ public interface IHiddenDangerService {
* @param dangerDto 隐患对象
* @return DangerDto
*/
DangerDto updateDanger(Long dangerId, DangerDto dangerDto);
DangerDto updateDanger(Long dangerId, DangerDto dangerDto) throws Exception;
/**
* 分页查询
......@@ -90,4 +92,11 @@ public interface IHiddenDangerService {
* @return Boolean
*/
Boolean deleteBatch(List<Long> ids);
/**
* 组织业务数据
* @param hiddenDangerDto 隐患信息
* @return Map<String,Object>
*/
Map<String,Object> buildBizInfo(HiddenDangerDto hiddenDangerDto) throws Exception;
}
......@@ -22,6 +22,7 @@ import com.yeejoin.amos.boot.module.tzs.api.dto.ESAlertCalledRequestDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.AlertCalled;
import com.yeejoin.amos.boot.module.tzs.api.entity.Elevator;
import com.yeejoin.amos.boot.module.tzs.api.entity.WechatRelation;
import com.yeejoin.amos.boot.module.tzs.api.enums.AlertStageEnums;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.AlertCalledServiceImpl;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.AlertFormValueServiceImpl;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.DispatchPaperServiceImpl;
......@@ -117,15 +118,19 @@ public class AlertCalledController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@PostMapping(value = "/saveMobile")
@ApiOperation(httpMethod = "POST", value = "新增警情接警填报记录", notes = "新增警情接警填报记录")
public ResponseModel<AlertCalledDto> saveMobile(@RequestBody AlertCalledDto alertCalledDto,
@RequestParam String phone) {
public ResponseModel<AlertCalledDto> saveMobile(@RequestBody AlertCalledDto alertCalledDto
) {
if (ValidationUtil.isEmpty(alertCalledDto)) {
throw new BadRequest("参数校验失败.");
}
if (ValidationUtil.isEmpty(alertCalledDto.getEmergencyCall())) {
throw new BadRequest("参数校验失败.");
}
// 校验手机号 是否存在
LambdaQueryWrapper<WechatRelation> queryWrapper = new LambdaQueryWrapper();
queryWrapper.eq(WechatRelation::getPhone, phone);
queryWrapper.eq(WechatRelation::getPhone, alertCalledDto.getEmergencyCall());
WechatRelation wechatRelation = wechatRelationService.getOne(queryWrapper);
if (null == wechatRelation) {
throw new BadRequest("手机号未注册");
......@@ -144,6 +149,7 @@ public class AlertCalledController extends BaseController {
alertCalledDto.setDeviceId(String.valueOf(elevator.getRescueCode()));
alertCalledDto.setUseStatus(elevator.getUseStatus());
alertCalledDto.setUseSiteCategory(elevator.getUseSiteCategory());
alertCalledDto.setAlarmType(AlertStageEnums.getEnumById(alertCalledDto.getAlarmTypeCode()).getValue());
AlertCalledDto alertCalledDtoReturn = iAlertCalledService.createAlertCalled(alertCalledDto);
return ResponseHelper.buildResponse(alertCalledDtoReturn);
......@@ -478,4 +484,15 @@ public class AlertCalledController extends BaseController {
return ResponseHelper.buildResponse(iAlertCalledService.getImportantEventOrTodayEmergencyCount(type));
}
/**
* 警情处置流程信息
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getHandlerInfo")
@ApiOperation(httpMethod = "GET", value = "警情处置流程信息", notes = "警情处置流程信息")
public ResponseModel<Object> getHandlerInfo(@RequestParam String alertId) {
return ResponseHelper.buildResponse(iAlertCalledService.getHandlerInfo(alertId));
}
}
......@@ -12,10 +12,12 @@ import com.yeejoin.amos.boot.module.tzs.api.dto.ElevatorInfoDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.ElevatorMaintenanceInfoDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.ElevatorNewDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.ElevatorTestInfoDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.EsElevatorDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.Elevator;
import com.yeejoin.amos.boot.module.tzs.api.entity.MaintainInfo;
import com.yeejoin.amos.boot.module.tzs.api.entity.TestInfo;
import com.yeejoin.amos.boot.module.tzs.api.service.IElevatorService;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.ESElevatorServiceImpl;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.ElevatorServiceImpl;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.MaintainInfoServiceImpl;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.TestInfoServiceImpl;
......@@ -72,6 +74,9 @@ public class ElevatorController extends BaseController {
@Autowired
private TestInfoServiceImpl testInfoService;
@Autowired
ESElevatorServiceImpl esElevatorService;
/**
* 新增电梯
*
......@@ -339,5 +344,45 @@ public class ElevatorController extends BaseController {
return ResponseHelper.buildResponse(elevatorInfoDto);
}
/**
*
* @return
*/
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/init", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "电梯信息放入es", notes = "电梯信息放入es")
public void init() {
IPage<Elevator> elevatorPage = new Page<>();
Integer count = elevatorService.count();
for(int i = 0; i <= count % 500 ; i ++ ) {
elevatorPage.setCurrent(i);
elevatorPage.setSize(500);
elevatorPage = elevatorService.page(elevatorPage);
for (Elevator el:elevatorPage.getRecords()
) {
esElevatorService.saveEsElevatorToES(el);
}
}
}
/**
* ES分页查询电梯信息
*
* @param current 当前页
* @param size 每页大小
* @param elevatorDto 查询参数
* @return 查询结果
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/query_elevator_list_es", method = RequestMethod.POST)
@ApiOperation(httpMethod = "POST", value = "ES分页查询电梯信息", notes = "ES分页查询电梯信息")
public ResponseModel<IPage<EsElevatorDto>> queryElevatorListEs(@RequestParam(value = "current") int current, @RequestParam(value = "size") int size,
@RequestBody EsElevatorDto elevatorDto){
Page<EsElevatorDto> page = esElevatorService.queryByKeys(elevatorDto,current,size);
return ResponseHelper.buildResponse(page);
}
}
......@@ -738,15 +738,19 @@ public class WechatController extends BaseController {
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/uploadImage")
@ApiOperation(httpMethod = "POST", value = "微信公众号上传图片", notes = "微信公众号上传图片")
public ResponseModel<String> uploadImage(@ApiParam(value = "图片", required = true)@RequestParam MultipartFile file
) {
public ResponseModel<String> uploadImage(@ApiParam(value = "图片", required = true)@RequestParam MultipartFile file,
String appKey, String product, String token ) {
if (ValidationUtil.isEmpty(file)){
throw new BadRequest("参数校验失败.");
}
// RequestContext.setProduct(product);
// RequestContext.setAppKey(appKey);
// RequestContext.setToken(token);
FeignClientResult<Map<String, String>> date = Systemctl.fileStorageClient.updateCommonFile(file);
String urlString="";
if (date != null) {
......
package com.yeejoin.amos.boot.module.tzs.biz.dao;
import com.yeejoin.amos.boot.module.tzs.api.entity.EsElevator;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Repository;
/**
* @author fengwang
* @date 2021-09-26.
*/
@Repository
public interface ESElavtorRepository extends PagingAndSortingRepository<EsElevator, Long> {
}
......@@ -7,17 +7,22 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Maps;
import com.itextpdf.text.pdf.PdfStructTreeController.returnType;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto;
import com.yeejoin.amos.boot.module.common.api.service.ISourceFileService;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledFormDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledObjsDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledQueryDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertHandlerDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertHandlerInfoDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.FormValue;
import com.yeejoin.amos.boot.module.tzs.api.entity.AlertCalled;
import com.yeejoin.amos.boot.module.tzs.api.entity.AlertFormValue;
import com.yeejoin.amos.boot.module.tzs.api.entity.DispatchPaper;
import com.yeejoin.amos.boot.module.tzs.api.entity.DispatchTask;
import com.yeejoin.amos.boot.module.tzs.api.entity.Elevator;
import com.yeejoin.amos.boot.module.tzs.api.enums.AlertStageEnums;
import com.yeejoin.amos.boot.module.tzs.api.enums.DispatchPaperEnums;
......@@ -35,12 +40,15 @@ import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.core.rdbms.annotation.Condition;
import org.typroject.tyboot.core.rdbms.annotation.Operator;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 警情接警填报记录服务实现类
......@@ -78,6 +86,15 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
@Autowired
RepairConsultServiceImpl repairConsultServiceImpl;
@Autowired
DispatchPaperServiceImpl dispatchPaperService;
@Autowired
DispatchTaskServiceImpl dispatchTaskService;
@Autowired
ISourceFileService ISourceFileService;
private final Logger logger = LogManager.getLogger(AlertCalledServiceImpl.class);
......@@ -218,6 +235,84 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
return this.update(updateWrapper);
}
/**
* 警情处置流程信息
*/
@Override
public AlertHandlerDto getHandlerInfo(String alertId) {
AlertHandlerDto alertHandlerDto = new AlertHandlerDto();
Map<String,Date> map = new HashMap<>();
List<AlertHandlerInfoDto> list = new ArrayList<>();
AlertHandlerInfoDto alertHandlerInfoDtoHead = new AlertHandlerInfoDto();
alertHandlerInfoDtoHead.setProcess("处置流程");
alertHandlerInfoDtoHead.setAnswerThePolice("接警");
alertHandlerInfoDtoHead.setReport("上报");
alertHandlerInfoDtoHead.setNotice("派遣/通知");
alertHandlerInfoDtoHead.setArrive("到达");
alertHandlerInfoDtoHead.setComplete("完成");
alertHandlerInfoDtoHead.setReturnVisit("回访");
list.add(alertHandlerInfoDtoHead);
AlertCalled called = this.getById(Long.valueOf(alertId));
if(null == called) {
throw new BadRequest("警情不存在");
}
map.put("接警",called.getCallTime());
map.put("上报",called.getRecDate());
LambdaQueryWrapper<DispatchPaper> queryWrapper = new LambdaQueryWrapper();
queryWrapper.eq(DispatchPaper::getAlertId,Long.valueOf(alertId));
DispatchPaper dispatchPaper = dispatchPaperService.getOne(queryWrapper);
LambdaQueryWrapper<DispatchTask> queryWrapper1 = new LambdaQueryWrapper();
queryWrapper1.eq(DispatchTask::getPaperId,Long.valueOf(dispatchPaper.getSequenceNbr()));
List<DispatchTask> dispatchTask = dispatchTaskService.list(queryWrapper1);
String [] str = new String[]{"使用单位","一级响应","二级响应","三级响应","市级监督"};
if(null != dispatchPaper) {
for(String s:str) {
AlertHandlerInfoDto alertHandlerInfoDto = new AlertHandlerInfoDto();
if(null != dispatchTask &&dispatchTask.size() > 0 ) {
List<DispatchTask> taskList = dispatchTask.stream().filter(e->e.getOrgType().equals(s)).collect(Collectors.toList());
if(taskList.size() > 0) {
map.put("派遣/通知",called.getRecDate());
map.put("到达",dispatchTask.get(0).getArriveTime());
map.put("完成",dispatchTask.get(0).getSaveTime());
dataInit(alertHandlerInfoDto,s,"", "","已派遣",
dispatchTask.get(0).getArriveTime() == null ? "" : "已到达" ,dispatchTask.get(0).getSaveTime() == null ? "" : "已完成",
dispatchPaper.getFeedbackTime() != null || dispatchPaper.getFeedbackFinishTime() != null ? "已回访" : "");
} else {
dataInit(alertHandlerInfoDto,s,"","","","","","");
}
}
list.add(alertHandlerInfoDto);
}
map.put("回访",dispatchPaper.getFeedbackTime());
} else {
for(String s:str) {
AlertHandlerInfoDto alertHandlerInfoDto = new AlertHandlerInfoDto();
dataInit(alertHandlerInfoDto,s,"","","","","","");
list.add(alertHandlerInfoDto);
}
}
alertHandlerDto.setAlertHandlerInfoDto(list);
alertHandlerDto.setHandlerTime(map);
return alertHandlerDto;
}
private void dataInit(AlertHandlerInfoDto alertHandlerInfoDto, String process,String answerThePolice, String report, String notice, String arrive, String complete,String returnVisit) {
alertHandlerInfoDto.setProcess(process);
alertHandlerInfoDto.setAnswerThePolice(answerThePolice);
alertHandlerInfoDto.setReport(report);
alertHandlerInfoDto.setNotice(notice);
alertHandlerInfoDto.setArrive(arrive);
alertHandlerInfoDto.setComplete(complete);
alertHandlerInfoDto.setReturnVisit(returnVisit);
}
/**
*
......@@ -330,6 +425,11 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
alertCalled.setTypeCode(AlertStageEnums.JQCB.getId());
this.save(alertCalled);
// 保存照片
Map<String, List<AttachmentDto>> attachmentMap = new HashMap<>();
attachmentMap.put("imgs",alertCalledDto.getImages());
ISourceFileService.saveAttachments(alertCalled.getSequenceNbr(),attachmentMap);
// 动态表单
AlertFormValue alertFormValue = new AlertFormValue();
// 填充警情主键
......
package com.yeejoin.amos.boot.module.tzs.biz.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.module.tzs.api.dto.EsElevatorDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.AlertCalled;
import com.yeejoin.amos.boot.module.tzs.api.entity.Elevator;
import com.yeejoin.amos.boot.module.tzs.api.entity.EsElevator;
import com.yeejoin.amos.boot.module.tzs.biz.dao.ESElavtorRepository;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate;
import org.springframework.data.elasticsearch.core.SearchHit;
import org.springframework.data.elasticsearch.core.SearchHits;
import org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilder;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import java.util.ArrayList;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;
/**
*
* <pre>
* 电梯信息ES检索服务
* </pre>
*
* @authorlitw
* @version 2021年9月26日
*/
@Service
public class ESElevatorServiceImpl {
@Autowired
private ElasticsearchRestTemplate elasticsearchTemplate;
@Autowired
private ESElavtorRepository esElavtorRepository;
@Autowired
AlertCalledServiceImpl iAlertCalledService;
@Value("${alertcall.es.synchrony.time}")
private Long time;
/**
*
* <pre>
* 电梯信息
* </pre>
*
* @param elevator 电梯信息
*/
public EsElevator saveEsElevatorToES(Elevator elevator)
{
EsElevator esElevator = new EsElevator();
esElevator.setSequenceNbr(elevator.getSequenceNbr());
esElevator.setProvince(elevator.getProvince());
esElevator.setAddress(elevator.getAddress());
esElevator.setCity(elevator.getCity());
esElevator.setDistrict(elevator.getDistrict());
esElevator.setLatitude(elevator.getLatitude());
esElevator.setRegisterCode(elevator.getRegisterCode());
esElevator.setRegionCode(elevator.getRegionCode());
esElavtorRepository.save(esElevator);
return esElevator;
}
/**
* 根据关键字查询文档,关键字不为空时按相关性从大到小排序
*
* @param elevatorDto 关键字
* @param current 当前页码
* @param size 页面大小
* @return
*/
@SuppressWarnings({ "rawtypes" })
public Page<EsElevatorDto> queryByKeys(EsElevatorDto elevatorDto, int current, int size) {
Page<EsElevatorDto> result = new Page<>(current, size);
String alarmTypeCode = elevatorDto.getAlarmTypeCode();
String address = elevatorDto.getAddress();
String regionCode = elevatorDto.getRegionCode();
/**
* 通用匹配规则,条件构建
*/
BoolQueryBuilder boolMust = QueryBuilders.boolQuery();
if(!ValidationUtil.isEmpty(alarmTypeCode)) {
BoolQueryBuilder qb0 = QueryBuilders.boolQuery();
LambdaQueryWrapper<AlertCalled> queryWrapper = new LambdaQueryWrapper();
queryWrapper.eq(AlertCalled::getAlarmTypeCode,alarmTypeCode);
queryWrapper.ge(AlertCalled::getCallTime, DateUtils.stampToDate(System.currentTimeMillis(),DateUtils.DATE_PATTERN));
queryWrapper.le(AlertCalled::getCallTime, DateUtils.stampToDate(DateUtils.dateAddDays(new Date(),1).getTime(),DateUtils.DATE_PATTERN));
List<AlertCalled> alertCalleds = iAlertCalledService.list(queryWrapper);
List<Long> stringList = new ArrayList<>();
for (AlertCalled al: alertCalleds
) {
stringList.add(al.getEquipmentId());
}
qb0.must(QueryBuilders.termsQuery("sequenceNbr", stringList.toArray()));
boolMust.must(qb0);
}
if(!ValidationUtil.isEmpty(address)) {
BoolQueryBuilder boolMustAddress = QueryBuilders.boolQuery();
BoolQueryBuilder qb1 = QueryBuilders.boolQuery()
.should(QueryBuilders.matchPhraseQuery("address", address));
boolMustAddress.should(qb1);
boolMust.must(boolMustAddress);
}
if(!ValidationUtil.isEmpty(regionCode)) {
BoolQueryBuilder qb2= QueryBuilders.boolQuery().
filter(QueryBuilders. termQuery("regionCode", regionCode));
boolMust.must(qb2);
}
// 创建查询构造器
NativeSearchQueryBuilder queryBuilder = new NativeSearchQueryBuilder()
// 分页
.withPageable(PageRequest.of(current, size))
// 排序
// .withSort(SortBuilders.fieldSort("callTimeLong").order(SortOrder.DESC))
//过滤条件
.withQuery(boolMust);
List<EsElevatorDto> list = new LinkedList<>();
long totle = 0;
try
{
SearchHits<EsElevator> searchHits =elasticsearchTemplate.search(queryBuilder.build(), EsElevator.class);
for (SearchHit searchHit : searchHits.getSearchHits())
{
JSONObject jsonObject = (JSONObject) JSONObject.toJSON(searchHit.getContent());
EsElevatorDto esElevatorDto =JSONObject.toJavaObject(jsonObject, EsElevatorDto.class);
list.add(esElevatorDto);
}
totle =searchHits.getTotalHits();
}
catch (Exception e)
{
// TODO: handle exception
}
result.setRecords(list);
result.setTotal(totle);
return result;
}
}
......@@ -1546,4 +1546,32 @@
update cb_data_dictionary set type_desc = null where sequence_nbr = 1188 ;
</sql>
</changeSet>
<changeSet id="2021-09-272" author="chenzhao">
<preConditions onFail="MARK_RAN">
<tableExists tableName="cb_data_dictionary"/>
</preConditions>
<comment>删除无用数据</comment>
<sql>
update cb_data_dictionary set parent = null where sequence_nbr = 1237 ;
update cb_data_dictionary set parent = null where sequence_nbr = 1238 ;
update cb_data_dictionary set parent = null where sequence_nbr = 1239 ;
update cb_data_dictionary set parent = null where sequence_nbr = 1240 ;
update cb_data_dictionary set parent = null where sequence_nbr = 1241 ;
</sql>
</changeSet>
<changeSet author="chenzhao" id="2021-09-27-cz-1">
<preConditions onFail="MARK_RAN">
<tableExists tableName="cb_fire_experts"/>
</preConditions>
<comment>BUG 2928 表中新增两个字段用来保存详细地址值 </comment>
<sql>
ALTER TABLE `cb_fire_experts` add native_place_val varchar(255) COMMENT '户籍所在地详细地址';
ALTER TABLE `cb_fire_experts` add residence_detail_val varchar(255) COMMENT '现居住地详细地址';
</sql>
</changeSet>
</databaseChangeLog>
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