Commit 40e45b1f authored by maoying's avatar maoying

合并机场代码

parents 91b78305 592577b1
package com.yeejoin.amos.boot.biz.common.bo;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
......@@ -27,6 +28,7 @@ public class ReginParams implements Serializable {
private String companyId;
private String companyName;
private String bizOrgCode;
private String companyBizOrgCode;
}
public PersonIdentity getPersonIdentity() {
......
package com.yeejoin.amos.boot.module.common.api.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......@@ -22,6 +23,7 @@ public class DutyPersonShiftDto extends BaseDto {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "值班日期")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date dutyDate;
@ApiModelProperty(value = "值班班次id")
......
......@@ -40,5 +40,7 @@ public class UserDto {
@ApiModelProperty(value = "机构类型(部门:DEPARTMENT,单位:COMPANY,人员:PERSON)")
private String bizOrgType;
@ApiModelProperty(value = "所在单位是部门时,获取部门上级公司code")
private String companyBizOrgCode;
}
......@@ -307,6 +307,9 @@ public interface IOrgUsrService {
UserDto getUserParentInfo(String userId);
UserDto selectByIdUser( String userId);
List<OrgUsr> getListById(List<String> ids);
/**
* 根据机构类型获取列表不分页
* @param orgTypes 机构类型(逗号分割)
......
......@@ -353,7 +353,7 @@
SELECT
COUNT(a.id) num
FROM important_companys a
where a.longitude is not null and a.latitude is not null
where a.longitude is not null and a.latitude is not null and a.keySiteCompany = 1
<if test='par.distance!=null'>
and Round(st_distance(point(a.longitude,a.latitude),point(#{par.longitude},#{par.latitude}))*111195,1) &lt;=
#{par.distance}
......@@ -945,7 +945,7 @@ LEFT JOIN (
*
FROM
cb_org_usr
WHERE is_delete = false AND biz_org_code LIKE CONCAT(#{bizOrgCode} '%') AND( biz_org_type = 'COMPANY' || biz_org_type = 'DEPARTMENT')
WHERE is_delete = false AND biz_org_code LIKE CONCAT(#{bizOrgCode}, '%') AND( biz_org_type = 'COMPANY' || biz_org_type = 'DEPARTMENT')
</select>
<select id="companyDeptListWithPersonCount"
......
......@@ -29,6 +29,12 @@ public class BaseTreeNode {
private String companyId;
private String ownerUnitId;
private Integer type;
public BaseTreeNode() {
}
......@@ -52,7 +58,19 @@ public class BaseTreeNode {
public void setParentId(String parentId) {
this.parentId = parentId;
}
public void setOwnerUnitId(String ownerUnitId) {
this.ownerUnitId = ownerUnitId;
}
public String getOwnerUnitId() {
return ownerUnitId;
}
public void setType(Integer type) {
this.type = type;
}
public Integer getType() {
return type;
}
public List<BaseTreeNode> getChildren() {
if (this.children == null) {
return Lists.newArrayList();
......
package com.yeejoin.equipmanage.common.entity.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -65,4 +66,11 @@ public class BuildingVideoListVO {
@ApiModelProperty("机构编码")
private String bizOrgCode;
private String type;
private String ip;
}
......@@ -313,6 +313,7 @@ public class TreeNodeUtil {
// 循环处理子节点数据
for (T t : newTreeNodes) {
//递归
listNodes.removeAll(collect);
assembleTree2(t, listNodes);
}
return newTreeNodes;
......@@ -328,7 +329,7 @@ public class TreeNodeUtil {
if (!CollectionUtils.isEmpty(node.getChildren())) {
for (Object t : node.getChildren()) {
//递归
//listNodes.remove(t);
listNodes.removeAll(node.getChildren());
assembleTreeSon((T) t, listNodes);
}
}
......@@ -339,17 +340,18 @@ public class TreeNodeUtil {
if (node != null && !CollectionUtils.isEmpty(listNodes)) {
// 循环节点数据,如果是子节点则添加起来
listNodes.stream().filter(t -> t.getParentId().equals(node.getId()) && t.getCompanyId().equals(node.getCompanyId() == null ?node.getParentId():node.getCompanyId() ) ).forEachOrdered(node::addChild);
listNodes.stream().filter(t ->t.getOwnerUnitId()!= null && t.getOwnerUnitId().equals(node.getOwnerUnitId()==null?node.getId():node.getOwnerUnitId())&&t.getParentId().equals(node.getId()) && t.getCompanyId().equals(node.getCompanyId() == null ?node.getParentId():node.getCompanyId() )).forEachOrdered(node::addChild);
// 循环处理子节点数据,递归
if (!CollectionUtils.isEmpty(node.getChildren())) {
for (Object t : node.getChildren()) {
//递归
//listNodes.remove(t);
listNodes.removeAll(node.getChildren());
assembleTreeSon((T) t, listNodes);
}
}
}
}
static <T extends BaseTreeNode> void assembleTree_1(T node, List<T> listNodes) {
if (node != null && !CollectionUtils.isEmpty(listNodes)) {
// 循环节点数据,如果是子节点则添加起来
......
......@@ -69,6 +69,9 @@ public interface PowerTransferMapper extends BaseMapper<PowerTransfer> {
Map<String, Integer> getCarNum(@Param("id") Long id);
List< Map<String, Integer>> getCarUserNum(@Param("dutyDate") String dutyDate,@Param("id") Long id);
Map<String, Integer> getCompanyNum(@Param("id") Long id);
List<PowerData> getPowerDataList(@Param("id") Long id);
......@@ -122,4 +125,10 @@ public interface PowerTransferMapper extends BaseMapper<PowerTransfer> {
IPage<PowerTransferResourceDto> getPowerTransferCarResource(Page<PowerTransferResourceDto> page,
@Param("alertCalledId") Long alertCalledId);
/**
* 查询未结案的航空器报警航班号
* @param alertTypeCode
* @return
*/
List<String> selectFlightNumber(@Param("alertTypeCode") String alertTypeCode);
}
......@@ -145,6 +145,58 @@
</select>
<select id="getCarUserNum" resultType="Map">
select * from (
SELECT
MAX(
CASE
WHEN cd.FIELD_CODE ='carId' THEN
cd.FIELD_VALUE
END
) AS 'carId',
MAX(
CASE
WHEN cd.FIELD_CODE = 'userName' THEN
cd.FIELD_VALUE
END
) AS 'userName'
FROM
cb_dynamic_form_instance cd
LEFT JOIN (
SELECT
dp.instance_id,
ds.`name`
FROM
cb_duty_person_shift dp
LEFT JOIN cb_duty_shift ds ON dp.shift_id = ds.sequence_nbr
WHERE
dp.duty_date = #{dutyDate} and dp.is_delete=0
) cds ON cd.instance_id = cds.instance_id
where cd.group_code ='dutyCar' and cds.instance_id is not null and
cd.is_delete=0
group by cd.instance_id
) result
where carId is not null and userName is not null and carId in (
SELECT
c.resources_id
FROM
jc_power_transfer a
LEFT JOIN jc_power_transfer_company b ON a.sequence_nbr = b.power_transfer_id
LEFT JOIN jc_power_transfer_company_resources c ON c.power_transfer_company_id = b.sequence_nbr
WHERE
a.alert_called_id = ${id}
)
</select>
<select id="getCompanyNum" resultType="Map">
select COUNT(*) companyNum from
(SELECT DISTINCT
......@@ -324,5 +376,13 @@
transfer.alert_called_id = #{alertCalledId}
AND is_distribution_agencies = 0
</select>
<select id="selectFlightNumber" resultType="java.lang.String">
SELECT DISTINCT(jaf.field_value) FROM `jc_alert_called` jac
left join jc_alert_form_value jaf on jac.sequence_nbr = jaf.alert_called_id
WHERE jac.alert_status = 0
and jac.alert_type_code = #{alertTypeCode}
and jaf.field_code = "flightNumber"
and jaf.field_value_code is not NULL
</select>
</mapper>
......@@ -33,10 +33,14 @@
<version>3.3.6</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
</exclusions>
<exclusion>
<artifactId>log4j</artifactId>
<groupId>log4j</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.docx4j</groupId>
......
......@@ -39,6 +39,7 @@ class SqlStatement extends BaseSqlCondition {
private static final Map<String, String[]> valueTagFieldSqlMap;
private static final Pattern numberPattern = Pattern.compile("^[-\\+]?[\\d]+[.]?[\\d]*$");
private static final Pattern datePattern = Pattern.compile("^[\\d]{4}-[\\d]{2}-[\\d]{2} [\\d]{2}:[\\d]{2}:[\\d]{2}$");
private static final Pattern datePattern16 = Pattern.compile("^[\\d]{4}/[\\d]{2}/[\\d]{2} [\\d]{2}:[\\d]{2}$");
/**
* 字段类型
......@@ -101,36 +102,48 @@ class SqlStatement extends BaseSqlCondition {
return false;
}
boolean emptyVal = ValidationUtil.isEmpty(values);
if (fieldType != FieldType.textTag) {
if (fieldType != FieldType.textTag && values.size() > 0) {
String val1 = values.get(0);
String val2 = "";
switch (valueType) {
case text:
//格式化
if (!emptyVal && !ValidationUtil.isEmpty(values.get(0))) {
values.add(0, stringParamFormat(values.get(0)));
if (!emptyVal && !ValidationUtil.isEmpty(val1)) {
values.add(0, stringParamFormat(val1));
values.remove(1);
}
break;
case date:
// 校验并格式化
if (!emptyVal && !ValidationUtil.isEmpty((values.get(0)))) {
paramValidate(datePattern, values.get(0));
values.add(0, stringParamFormat(values.get(0)));
if (!emptyVal && !ValidationUtil.isEmpty(val1)) {
if (val1.contains("/") && val1.length() == 16) {
paramValidate(datePattern16, val1);
} else {
paramValidate(datePattern, val1);
}
values.add(0, stringParamFormat(val1));
values.remove(1);
}
if (!emptyVal && values.size() > 1 && !ValidationUtil.isEmpty((values.get(1)))) {
paramValidate(datePattern, values.get(1));
values.add(1, stringParamFormat(values.get(1)));
val2 = values.get(1);
if (!emptyVal && !ValidationUtil.isEmpty(val2)) {
if (val2.contains("/") && val1.length() == 16) {
paramValidate(datePattern16, val2);
} else {
paramValidate(datePattern, val2);
}
values.add(1, stringParamFormat(val2));
values.remove(2);
}
break;
case range:
case single:
// 校验
if (!emptyVal && !ValidationUtil.isEmpty((values.get(0)))) {
paramValidate(numberPattern, values.get(0));
if (!emptyVal && !ValidationUtil.isEmpty(val1)) {
paramValidate(numberPattern, val1);
}
if (!emptyVal && values.size() > 1 && !ValidationUtil.isEmpty((values.get(1)))) {
paramValidate(numberPattern, values.get(1));
val2 = values.get(1);
if (!emptyVal && !ValidationUtil.isEmpty(val2)) {
paramValidate(numberPattern, val2);
}
break;
default:
......
......@@ -170,6 +170,83 @@ public class InputItem extends BasicEntity {
@Column(name = "unit")
private String unit;
/**
* 新加字段
*
* */
//单位code
@Column(name = "biz_org_code")
private String bizOrgCode;
//单位名称
@Column(name = "biz_org_name")
private String bizOrgName;
//消防装备类型
@Column(name = "equipment_type")
private String equipmentType;
//消防设施类型、
@Column(name = "facilities_type")
private String facilitiesType;
// 重点类型
@Column(name = "key_parts_type")
private String keyPartsType;
//自定义类型
@Column(name = "custom_type")
private String customType;
public String getBizOrgCode() {
return bizOrgCode;
}
public void setBizOrgCode(String bizOrgCode) {
this.bizOrgCode = bizOrgCode;
}
public String getBizOrgName() {
return bizOrgName;
}
public void setBizOrgName(String bizOrgName) {
this.bizOrgName = bizOrgName;
}
public String getEquipmentType() {
return equipmentType;
}
public void setEquipmentType(String equipmentType) {
this.equipmentType = equipmentType;
}
public String getFacilitiesType() {
return facilitiesType;
}
public void setFacilitiesType(String facilitiesType) {
this.facilitiesType = facilitiesType;
}
public String getKeyPartsType() {
return keyPartsType;
}
public void setKeyPartsType(String keyPartsType) {
this.keyPartsType = keyPartsType;
}
public String getCustomType() {
return customType;
}
public void setCustomType(String customType) {
this.customType = customType;
}
public String getUnit() {
return unit;
}
......
......@@ -111,6 +111,42 @@ public class Msg extends BasicEntity{
@Column(name="create_by")
private Long createBy;
public String getBizOrgCode() {
return bizOrgCode;
}
public void setBizOrgCode(String bizOrgCode) {
this.bizOrgCode = bizOrgCode;
}
public String getBizOrgName() {
return bizOrgName;
}
public void setBizOrgName(String bizOrgName) {
this.bizOrgName = bizOrgName;
}
//单位code
@Column(name = "biz_org_code")
private String bizOrgCode;
//单位名称
@Column(name = "biz_org_name")
private String bizOrgName;
@Column(name = "biz_user_id")
private String bizUserId;
public String getBizUserId() {
return bizUserId;
}
public void setBizUserId(String bizUserId) {
this.bizUserId = bizUserId;
}
public String getTitle() {
return title;
}
......
......@@ -234,6 +234,26 @@ public class Point extends BasicEntity {
private String ue4Rotation;
public String getBizOrgCode() {
return bizOrgCode;
}
public void setBizOrgCode(String bizOrgCode) {
this.bizOrgCode = bizOrgCode;
}
public String getBizOrgName() {
return bizOrgName;
}
public void setBizOrgName(String bizOrgName) {
this.bizOrgName = bizOrgName;
}
private String bizOrgCode;
private String bizOrgName;
/**
* 物理区域id(数据来源于装备wl_area)
*/
......
......@@ -40,7 +40,11 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
</exclusions>
<exclusion>
<artifactId>log4j</artifactId>
<groupId>log4j</groupId>
</exclusion>
</exclusions>
</dependency>
<!-- https://mvnrepository.com/artifact/org.docx4j/docx4j-ImportXHTML -->
<dependency>
......
......@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.dto.PermissionModelDto;
import com.yeejoin.amos.boot.biz.common.enums.HomePageEnum;
......@@ -35,11 +36,14 @@ import com.yeejoin.amos.boot.module.jcs.api.mapper.PowerTransferCompanyResources
import com.yeejoin.amos.boot.module.jcs.api.mapper.PowerTransferMapper;
import com.yeejoin.amos.boot.module.jcs.api.service.*;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.MessageModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.ResponseEntity;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.RestTemplate;
import org.typroject.tyboot.core.foundation.context.RequestContext;
......@@ -1569,6 +1573,20 @@ public class CommandController extends BaseController {
carTaskDto.getCode(),
carTaskDto.getType(),
carTaskDto.getRemarks());
ReginParams reginParams = getSelectedOrgInfo();
String userId = reginParams.getUserModel().getUserId();
// 执行任务完成反馈,同步修改待办任务状态
if (carTaskDto.getType() == 2 && FireCarStatusEnum.已完成.getCode().equals(carTaskDto.getCode())){
MessageModel model = new MessageModel();
model.setRelationId(String.valueOf(carTaskDto.getAlertCalledId()));
model.setIsRead(true);
model.setMsgType("jcs119");
if (!ObjectUtils.isEmpty(userId)){
model.setUserId(userId);
}
Systemctl.messageClient.update(model);
}
return ResponseHelper.buildResponse(null);
}
......
......@@ -6,6 +6,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
......@@ -76,7 +77,8 @@ public class OrgPersonController extends BaseController {
@Autowired
FireCompanyInfoServiceImpl fireCompanyInfoServiceImpl;
@Autowired
OrgUsrMapper orgUsrMapper;
/**
* 新增人员信息
*
......@@ -146,6 +148,21 @@ public class OrgPersonController extends BaseController {
return ResponseHelper.buildResponse(orgPersonFormDto);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/getUser/{id}", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "获取人员详情", notes = "获取人员详情")
public ResponseModel<UserDto> selectByIdUser(HttpServletRequest request, @PathVariable String id) throws Exception {
UserDto userDto = iOrgUsrService.selectByIdUser(id);
return ResponseHelper.buildResponse(userDto);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/getUserList", method = RequestMethod.POST)
@ApiOperation(httpMethod = "POST", value = "获取人员详情", notes = "获取人员详情")
public ResponseModel<List<OrgUsr> > getUserList(HttpServletRequest request, @RequestBody List<String> id) throws Exception {
List<OrgUsr> userDto = iOrgUsrService.getListById(id);
return ResponseHelper.buildResponse(userDto);
}
/**
* @param request
* @param id
......@@ -204,6 +221,22 @@ public class OrgPersonController extends BaseController {
requestBody));
}
@TycloudOperation( ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/getUserByCode/list", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "列表分页查询", notes = "列表分页查询")
public ResponseModel<List<OrgUsr>> getUserByCode() {
ReginParams reginParams = getSelectedOrgInfo();
LambdaQueryWrapper<OrgUsr> wrapper = new LambdaQueryWrapper<OrgUsr>();
wrapper.eq(OrgUsr::getIsDelete, false);
wrapper.eq(OrgUsr::getBizOrgType, CommonConstant.BIZ_ORG_TYPE_PERSON);
wrapper.likeRight(OrgUsr::getBizOrgCode, reginParams.getPersonIdentity().getBizOrgCode());
List<OrgUsr> orgUsr = orgUsrMapper.selectList(wrapper);
return ResponseHelper.buildResponse(orgUsr);
}
/**
* 根据orgCode查询
*
......@@ -394,4 +427,20 @@ public class OrgPersonController extends BaseController {
public ResponseModel<String> deleteFirefighterPeopleById(@PathVariable Long id) {
return ResponseHelper.buildResponse(iOrgUsrService.deleteFirefighterPeopleById(id));
}
/**
*
* **/
/**
* 根据bizOrgCode查询
* @param bizOrgCode
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/getByBizOrgCode/list", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据bizOrgCode查询", notes = "根据bizOrgCode查询")
public ResponseModel<List<OrgUsr>> personListByBizOrgCode(@RequestParam Map<String, Object> requestBody) {
return ResponseHelper.buildResponse(iOrgUsrService.personListByBizOrgCode( requestBody.containsKey("bizOrgCode") ? requestBody.get("bizOrgCode").toString() : null));
}
}
......@@ -845,6 +845,21 @@ public class OrgUsrController extends BaseController {
@PathVariable String authKey) {
// 获取登陆人角色
ReginParams reginParams = getSelectedOrgInfo();
if(authKey.equals("fire_building_info")){
if (StringUtils.isNotEmpty(orgType) && orgType.equals("COMPANY")){
//查询当前登录人所属单位/部门
OrgUsr orgUsr = orgUsrMapper.selectById(reginParams.getPersonIdentity().getCompanyId());
//判断登陆人是否已经是顶级节点单位
if (orgUsr.getParentId() != null ){
orgUsr =iOrgUsrService.selectParentOrgUsr(orgUsr);
String bizOrgCode = orgUsr.getBizOrgCode() != null? orgUsr.getBizOrgCode() : reginParams.getPersonIdentity().getBizOrgCode();
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
personIdentity.setBizOrgCode(bizOrgCode);
reginParams.setPersonIdentity(personIdentity);
}
}
}
// 权限处理
PermissionInterceptorContext.setDataAuthRule(authKey);
List<OrgMenuDto> menus = iOrgUsrService.companyTreeByUserAndType(reginParams, orgType);
......@@ -919,4 +934,30 @@ public class OrgUsrController extends BaseController {
return ResponseHelper.buildResponse(iOrgUsrService.getByOrgCode(bizOrgCode));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "无权限单位树", notes = "无权限单位树")
@GetMapping(value = "/listCompanyTree")
public ResponseModel<List<OrgUsr>> listCompanyTree(@RequestParam(required = false) String orgType) throws Exception {
ReginParams reginParams = getSelectedOrgInfo();
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
String bizOrgCode = personIdentity.getBizOrgCode();
List<OrgUsr> listByBizOrgTypeCode = iOrgUsrService.getListByBizOrgTypeCode(orgType, bizOrgCode);
return ResponseHelper.buildResponse(listByBizOrgTypeCode);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "根据amosId返回单位code", notes = "根据amosId返回单位code")
@GetMapping(value = "/getBizByAmos")
public ResponseModel<String> getBizByAmos() throws Exception {
ReginParams selectedOrgInfo = getSelectedOrgInfo();
String userId = selectedOrgInfo.getUserModel().getUserId();
String parentId = iOrgUsrService.getParentId(userId);
OrgUsr orgUsr = iOrgUsrService.getById(parentId);
return ResponseHelper.buildResponse(orgUsr.getBizOrgCode());
}
}
\ No newline at end of file
......@@ -12,6 +12,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
......@@ -69,9 +70,12 @@ public class ESOrgUsrService {
public void saveAll(List<OrgUsr> orgUsrs) throws Exception {
if (!ValidationUtil.isEmpty(orgUsrs)) {
for (OrgUsr orgUsr : orgUsrs) {
this.saveAlertCalledToES(orgUsr);
}
// for (OrgUsr orgUsr : orgUsrs) {
// this.saveAlertCalledToES(orgUsr);
// }
this.saveAlertCalledToES(orgUsrs);
}
}
......@@ -90,6 +94,32 @@ public class ESOrgUsrService {
return esOrgUsrDto;
}
public List<ESOrgUsrDto> saveAlertCalledToES(List<OrgUsr> orgUsrs) throws Exception {
List<ESOrgUsrDto> listes=new ArrayList<>();
try {
for (OrgUsr orgUsr : orgUsrs) {
ESOrgUsrDto esOrgUsrDto = new ESOrgUsrDto();
String seqStr = String.valueOf(orgUsr.getSequenceNbr());
Long seq = Long.parseLong(seqStr);
esOrgUsrDto.setSequenceNbr(seq);
esOrgUsrDto.setBizOrgName(orgUsr.getBizOrgName());
listes.add(esOrgUsrDto);
}
esOrgUsrDtoRepository.saveAll(listes);
} catch (Exception e) {
e.printStackTrace();
}
return listes;
}
public ESOrgUsrDto saveAlertCalledToESNew(OrgUsr orgUsr) throws Exception {
ESOrgUsrDto esOrgUsrDto = new ESOrgUsrDto();
String seqStr = String.valueOf(orgUsr.getSequenceNbr());
......
......@@ -1739,23 +1739,9 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
@Override
public List<OrgMenuDto> companyTreeByUserAndType(ReginParams reginParams, String type) {
String authKey = PermissionInterceptorContext.getDataAuthRule();
Map<String, Object> param = new HashMap<>();
String bizOrgCode = reginParams.getPersonIdentity().getBizOrgCode();
PermissionInterceptorContext.clean();
if (StringUtils.isNotEmpty(type) && type.equals("COMPANY")){
//查询当前登录人所属单位/部门
OrgUsr orgUsr = orgUsrMapper.selectById(reginParams.getPersonIdentity().getCompanyId());
if (!ObjectUtils.isEmpty(orgUsr)) {
//判断登陆人是否已经是顶级节点单位
if (orgUsr.getParentId() != null ){
orgUsr =this.selectParentOrgUsr(orgUsr);
bizOrgCode = orgUsr.getBizOrgCode() != null? orgUsr.getBizOrgCode() : reginParams.getPersonIdentity().getBizOrgCode();
}
}
}
PermissionInterceptorContext.setDataAuthRule(authKey);
param.put("bizOrgCode", bizOrgCode);
param.put("type", type);
List<OrgUsr> list = orgUsrMapper.companyTreeByUserAndType(param);
......@@ -2539,16 +2525,15 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
OrgUsr orgUsr = baseMapper.selectOne(wrapper);
OrgUsrDto orgUsrDto = new OrgUsrDto();
if (!orgUsr.getBizOrgType().equals(COMPANY_VALUE)) {
for (int i = 0; i < 10; i++) {
OrgUsr result = baseMapper.selectById(orgUsr.getParentId());
if (result.getBizOrgType().equals(COMPANY_VALUE)) {
BeanUtils.copyProperties(result, orgUsrDto);
break;
}
//查询当前登录人所属单位/部门
orgUsr = orgUsrMapper.selectById(orgUsr.getParentId());
//判断登陆人是否已经是顶级节点单位
if (orgUsr.getParentId() != null ){
orgUsr =iOrgUsrService.selectParentOrgUsr(orgUsr);
}
} else {
BeanUtils.copyProperties(orgUsr, orgUsrDto);
}
BeanUtils.copyProperties(orgUsr, orgUsrDto);
return orgUsrDto;
}
......@@ -2639,6 +2624,63 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
}
}
@Override
public UserDto selectByIdUser(String userId) {
OrgUsr orgUsr = orgUsrMapper.queryByUserId(Long.parseLong(userId));
if (null != orgUsr) {
UserDto userDto = new UserDto();
String parentId = orgUsr.getParentId();
userDto.setPersonSeq(String.valueOf(orgUsr.getSequenceNbr()));
userDto.setPersonName(orgUsr.getBizOrgName());
OrgUsr bizOrg = orgUsrMapper.queryBySequenceNbr(parentId);
if (!ObjectUtils.isEmpty(bizOrg)) {
userDto.setBizOrgType(bizOrg.getBizOrgType());
userDto.setBizOrgCode(bizOrg.getBizOrgCode());
userDto.setCompanyId(String.valueOf(bizOrg.getSequenceNbr()));
userDto.setCompanyName(bizOrg.getBizOrgName());
if(bizOrg.getBizOrgType().equals("COMPANY")){
userDto.setCompanyBizOrgCode(bizOrg.getBizOrgCode());
}else{
userDto.setCompanyBizOrgCode(getCompany(userDto));
}
} else {
throw new RuntimeException("人员所在公司不存在");
}
return userDto;
} else {
return new UserDto();
}
}
@Override
public List<OrgUsr> getListById(List<String> ids) {
LambdaQueryWrapper<OrgUsr> wrapper = new LambdaQueryWrapper<OrgUsr>();
wrapper.eq(OrgUsr::getIsDelete, false);
wrapper.in(OrgUsr::getSequenceNbr, ids);
wrapper.eq(OrgUsr::getBizOrgType, CommonConstant.BIZ_ORG_TYPE_PERSON);
List<OrgUsr> orgUsr = baseMapper.selectList(wrapper);
return orgUsr;
}
public String getCompany(UserDto userDto ){
if(userDto.getBizOrgType().equals("COMPANY")){
return userDto.getBizOrgCode();
}else{
return getCompany(userDto);
}
}
public Object getOrgUserByAmosUserId(String amosUserId) throws Exception {
LambdaQueryWrapper<OrgUsr> wrapper = new LambdaQueryWrapper<OrgUsr>();
wrapper.eq(OrgUsr::getIsDelete, false);
......@@ -3202,4 +3244,12 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
return flag;
}
public List<OrgUsr> personListByBizOrgCode(String bizOrgCode){
QueryWrapper<OrgUsr> wrapper = new QueryWrapper<>();
wrapper.eq("is_delete",false);
wrapper.eq("biz_org_code",bizOrgCode);
wrapper.eq("biz_org_type","PERSON");
return baseMapper.selectList(wrapper);
}
}
\ No newline at end of file
......@@ -10,6 +10,7 @@ import javax.servlet.http.HttpServletResponse;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.MediaType;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -51,8 +52,8 @@ public class EquipmentAlarmController extends AbstractBaseController {
@Autowired
IEquipmentSpecificAlarmService iEquipmentSpecificAlarmService;
@Value("${equip.enabled}")
private Boolean equioEnabled;
/**
* 列表列名
*
......@@ -157,11 +158,17 @@ public class EquipmentAlarmController extends AbstractBaseController {
request12.setName("isRemoveShield");
request12.setValue(StringUtil.isNotEmpty(isRemoveShield) ? StringUtils.trimToNull(isRemoveShield) : null);
queryRequests.add(request12);
if (!ValidationUtil.isEmpty(reginParams.getPersonIdentity())){
if (equioEnabled) {
if (!ValidationUtil.isEmpty(reginParams.getPersonIdentity())) {
CommonRequest request13 = new CommonRequest();
request13.setName("bizOrgCode");
request13.setValue(StringUtil.isNotEmpty(reginParams.getPersonIdentity().getBizOrgCode()) ? reginParams.getPersonIdentity().getBizOrgCode() : null);
queryRequests.add(request13);
}
}else {
CommonRequest request13 = new CommonRequest();
request13.setName("bizOrgCode");
request13.setValue(StringUtil.isNotEmpty(reginParams.getPersonIdentity().getBizOrgCode()) ? reginParams.getPersonIdentity().getBizOrgCode() : null );
queryRequests.add(request13);
request13.setValue("");
}
CommonPageInfoParam param = CommonPageParamUtil.fillCommonPageInfoParam(queryRequests, commonPageable);
Page<Map<String, Object>> list = iEquipmentSpecificAlarmService.listPage(param);
......@@ -279,13 +286,20 @@ public class EquipmentAlarmController extends AbstractBaseController {
request13.setName("isRemovedFire");
request13.setValue(StringUtil.isNotEmpty(isRemovedFire) ? StringUtils.trimToNull(isRemovedFire) : null);
queryRequests.add(request13);
if (!ValidationUtil.isEmpty(reginParams.getPersonIdentity())){
if (equioEnabled){
if (!ValidationUtil.isEmpty(reginParams.getPersonIdentity())){
CommonRequest request14 = new CommonRequest();
request14.setName("bizOrgCode");
request14.setValue(StringUtil.isNotEmpty(reginParams.getPersonIdentity().getBizOrgCode()) ? reginParams.getPersonIdentity().getBizOrgCode() : null );
queryRequests.add(request14);
}
}else {
CommonRequest request14 = new CommonRequest();
request14.setName("bizOrgCode");
request14.setValue(StringUtil.isNotEmpty(reginParams.getPersonIdentity().getBizOrgCode()) ? reginParams.getPersonIdentity().getBizOrgCode() : null );
queryRequests.add(request14);
request14.setValue("");
}
CommonPageInfoParam param = CommonPageParamUtil.fillCommonPageInfoParam(queryRequests, commonPageable);
CommonPageInfoParam param = CommonPageParamUtil.fillCommonPageInfoParam(queryRequests, commonPageable);
org.springframework.data.domain.Page<AlarmListDataVO> list = iEquipmentSpecificAlarmService.listAlarmsPage(param);
return CommonResponseUtil.success(list);
}
......
......@@ -7,6 +7,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletRequest;
......@@ -291,6 +292,71 @@ public class EquipmentCategoryController extends AbstractBaseController {
return list;
}
/**
* 除消防设施全量数据树形结构返回
*
* @return
*/
@RequestMapping(value = "/equip-tree", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "除消防设施全量数据树形结构返回", notes = "除消防设施全量数据树形结构返回")
public List<EquipmentCategory> listEquip() {
List<EquipmentCategory> equipmentCategorys = this.iEquipmentCategoryService
.getEquipmentCategoryListNotFacilities(Integer.valueOf(equipmentCategoryLeftTypeCode));
List<EquipmentCategory> list = new ArrayList<>();
Map<String, List<EquipmentCategory>> tmpMap = new HashMap<String, List<EquipmentCategory>>();
equipmentCategorys.forEach(action -> {
if (action.getParentId() == null) {
list.add(action);
} else {
if (tmpMap.get(action.getParentId().toString()) == null) {
ArrayList<EquipmentCategory> tmplist = new ArrayList<EquipmentCategory>();
tmplist.add(action);
tmpMap.put(action.getParentId().toString(), tmplist);
} else {
if (!tmpMap.get(action.getParentId().toString()).contains(action)) {
tmpMap.get(action.getParentId().toString()).add(action);
}
}
}
});
getChildren(list, tmpMap);
return list;
}
/**
* 消防设施分类定义树
*
* @return
*/
@RequestMapping(value = "/list-tree-fire", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "消防设施分类定义树", notes = "消防设施分类定义树")
public List<EquipmentCategory> listFire() {
List<EquipmentCategory> equipmentCategorys = this.iEquipmentCategoryService
.getEquipmentCategoryListByFacilities(Integer.valueOf(equipmentCategoryLeftTypeCode));
List<EquipmentCategory> list = new ArrayList<>();
Map<String, List<EquipmentCategory>> tmpMap = new HashMap<String, List<EquipmentCategory>>();
equipmentCategorys.forEach(action -> {
if (action.getName().equals("消防设施")) {
list.add(action);
} else {
if (tmpMap.get(action.getParentId().toString()) == null) {
ArrayList<EquipmentCategory> tmplist = new ArrayList<EquipmentCategory>();
tmplist.add(action);
tmpMap.put(action.getParentId().toString(), tmplist);
} else {
if (!tmpMap.get(action.getParentId().toString()).contains(action)) {
tmpMap.get(action.getParentId().toString()).add(action);
}
}
}
});
getChildren(list, tmpMap);
return list;
}
/**
*
* 获取子节点
......
......@@ -333,7 +333,13 @@ public class EquipmentSpecificController extends AbstractBaseController {
public ResponseModel videoOnEquipmentSpecific(@RequestBody VideoOnEquipmentSpecificVo videoOnEquipmentSpecificVo) {
return CommonResponseUtil.success(equipmentSpecificSerivce.videoOnEquipmentSpecific(videoOnEquipmentSpecificVo));
}
@RequestMapping(value = "/delVideoOnEquipmentSpecific/{equipmentSpecificId}/{videoId}", method = RequestMethod.POST)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "摄像头解绑设备", notes = "摄像头绑定设备")
public ResponseModel delVideoOnEquipmentSpecific( @PathVariable Long equipmentSpecificId, @PathVariable Long videoId) {
return CommonResponseUtil.success(equipmentSpecificSerivce.delVideoOnEquipmentSpecific(equipmentSpecificId,videoId));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/{buildingId}/list")
......
......@@ -8,6 +8,8 @@ import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.yeejoin.equipmanage.common.utils.StringUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
......@@ -197,7 +199,17 @@ public class MaintenanceResourceDataController extends AbstractBaseController {
pageBean = new Page<>(0, Long.MAX_VALUE);
}
page = maintenanceResourceDataService.page(pageBean, queryWrapper);
page.getRecords().stream().forEach(e->e.setLocation(e.getBuildingName() == null ? "" : e.getBuildingName()+e.getLocation() == null ? "" : e.getLocation()) );
page.getRecords().stream().forEach(e->{
String add = "";
if (!ValidationUtil.isEmpty(e.getBuildingName())){
add = add+e.getBuildingName();
};
if (!ValidationUtil.isEmpty(e.getLocation())){
add = add+e.getLocation();
}
e.setLocation(add);
}
);
return page;
}
......
......@@ -43,7 +43,7 @@ public interface JcsFeign {
@RequestParam(value = "belongFightingSystemId") Long belongFightingSystemId,
@RequestParam(value = "sequenceNbr") Long sequenceNbr,
@RequestParam(value = "classifyId") String classifyId,
@RequestParam(value = "classifyId") List<String> ids
@RequestParam(value = "ids") List<String> ids
);
@RequestMapping(value = "/equip/fireSystem_waterResource/list", method = RequestMethod.GET, consumes = "application/json")
......@@ -172,4 +172,14 @@ public interface JcsFeign {
ResponseModel<Long> getMaintenanceId(
@RequestParam(value = "userId") String userId);
/**
* 查询有权限的公司部门列表
*
* @param authKey 权限key
* @param orgTypes(多个逗号分隔) 为空默认查询公司和部门,COMPANY: 公司树 DEPARTMENT部门树
* @return ResponseModel<OrgUsrDto>
*/
@GetMapping(value = "/org-usr/listCompanyTree")
FeignClientResult<List<OrgUsrDto>> getlistCompanyTree( @RequestParam(required = false) String orgType);
}
......@@ -53,6 +53,10 @@ public interface EquipmentCategoryMapper extends BaseMapper<EquipmentCategory> {
int checkUsed( String id );
List<EquipmentCategory> getEquipmentCategoryList(Integer head);
List<EquipmentCategory> getEquipmentCategoryListNotFacilities(Integer head);
List<EquipmentCategory> getEquipmentCategoryListByFacilities(Integer head);
List<EquipmentCategory> getEquipmentCategoryCarList();
List<EquipmentCategory> getEquipmentCategoryEquipmentList();
......
......@@ -171,7 +171,9 @@ public interface EquipmentSpecificMapper extends BaseMapper<EquipmentSpecific> {
IPage<MaintenanceResourceDataVo> getEquipClassifyDataPage(Page page, Long fireFightSysId, String fireFacilityName, String classifyId, Long fireFacilityId, List<Long> buildingId,List<String> bandWbCompany);
List<UserDto> getEquipSpecificLocationInfo(Long equipmentSpecificId, String[] fieldName);
Map<String,Double> getEquipLocationInfo(Long equipmentSpecificId);
Map<String, Object> getEquipSpeInfo(@Param("equipmentSpecificId") Long equipmentSpecificId);
/**
......
......@@ -47,6 +47,10 @@ public interface IEquipmentCategoryService extends IService<EquipmentCategory> {
List<EquipmentCategory> getEquipmentCategoryList(Integer head);
List<EquipmentCategory> getEquipmentCategoryListNotFacilities(Integer head) ;
List<EquipmentCategory> getEquipmentCategoryListByFacilities(Integer head) ;
/**
* 根据分类定义id获取对应所有子分类id
*
......
......@@ -16,6 +16,7 @@ import com.yeejoin.equipmanage.common.entity.vo.ComplementCodeVO;
import com.yeejoin.equipmanage.common.entity.vo.EquipmentSpecificVo;
import com.yeejoin.equipmanage.common.entity.vo.SourceNameByEquipSpeIdVO;
import com.yeejoin.equipmanage.common.vo.*;
import org.springframework.web.bind.annotation.PathVariable;
import java.util.LinkedHashMap;
import java.util.List;
......@@ -169,6 +170,7 @@ public interface IEquipmentSpecificSerivce extends IService<EquipmentSpecific> {
EquipmentDetailVo getAirEquipSpecificDetail(Long stockDetailId);
List<UserDto> getEquipSpecificLocationInfo(Long equipmentSpecificId, String[] fieldName);
Map<String,Double> getEquipLocationInfo(Long equipmentSpecificId);
/**
* 根据specificId删除相关数据
......@@ -214,6 +216,7 @@ public interface IEquipmentSpecificSerivce extends IService<EquipmentSpecific> {
* @return
*/
Boolean videoOnEquipmentSpecific(VideoOnEquipmentSpecificVo videoOnEquipmentSpecificVo);
Boolean delVideoOnEquipmentSpecific(Long equipmentSpecificId, Long videoId);
/**
* 根据装备分类code获取装备列表
......
......@@ -1300,7 +1300,7 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
}
Map<String, Long> countMap = iVideoService.getVideoCountMap();
// 1.获取公司list
List<OrgUsrDto> orgUsrLists = jcsRemoteService.getCompanyDeptListWithAuth(authKey, "COMPANY");
List<OrgUsrDto> orgUsrLists = jcsRemoteService.getlistCompanyTree("COMPANY");
if (orgUsrLists.isEmpty()) {
return new ArrayList<>();
}
......
......@@ -451,23 +451,15 @@ public class ConfirmAlarmServiceImpl extends ServiceImpl<ConfirmAlarmMapper, Equ
log.error("查询机场人员为空,检查机场人员是否绑定单位!");
}
confirmAlamVo.setFireLocation(ent.getLocation());
List<UserDto> infoList = equipmentSpecificSerivce.getEquipSpecificLocationInfo(ent.getEquipmentSpecificId(), FIELD_NAME.split(","));
if (CollectionUtils.isNotEmpty(infoList)) {
infoList.stream().forEach(dto -> {
// String name = dto.getPersonName();
// confirmAlamVo.setFireLocation(name);
String code = dto.getFieldCode();
String value = dto.getFieldValue();
switch (code) {
case "longitude":
confirmAlamVo.setFloorLongitude(getVal(value));
break;
case "latitude":
confirmAlamVo.setFloorLatitude(getVal(value));
break;
default:
}
});
Map<String, Double> equipLocationInfo = equipmentSpecificSerivce.getEquipLocationInfo(ent.getEquipmentSpecificId());
if (!ObjectUtils.isEmpty(equipLocationInfo)) {
if (equipLocationInfo.containsKey("longitude")){
confirmAlamVo.setFloorLongitude(equipLocationInfo.get("longitude"));
}
if (equipLocationInfo.containsKey("latitude")){
confirmAlamVo.setFloorLatitude(equipLocationInfo.get("latitude"));
}
}
try {
ruleConfirmAlamService.confirmAlam(confirmAlamVo, appKey, product, token);
......
......@@ -391,6 +391,16 @@ public class EquipmentCategoryServiceImpl extends ServiceImpl<EquipmentCategoryM
return this.baseMapper.getEquipmentCategoryList(head);
}
public List<EquipmentCategory> getEquipmentCategoryListNotFacilities(Integer head) {
return this.baseMapper.getEquipmentCategoryListNotFacilities(head);
}
public List<EquipmentCategory> getEquipmentCategoryListByFacilities(Integer head) {
return this.baseMapper.getEquipmentCategoryListByFacilities(head);
}
@Override
public List<Long> getAllChildCategoryIdList(Long categoryId) {
return this.baseMapper.getAllChildCategoryIdList(categoryId);
......
......@@ -1190,6 +1190,10 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
return equipmentSpecificMapper.getEquipSpecificLocationInfo(equipmentSpecificId, fieldName);
}
public Map<String,Double> getEquipLocationInfo(Long equipmentSpecificId) {
return equipmentSpecificMapper.getEquipLocationInfo(equipmentSpecificId);
}
@Override
@Async("equipAsyncExecutor")
public void equipSpecificDataSync(Long equipmentId) {
......@@ -1757,6 +1761,15 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
}
}
@Override
public Boolean delVideoOnEquipmentSpecific(Long equipmentSpecificId, Long videoId) {
QueryWrapper<VideoEquipmentSpecific> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("equipment_specific_id", equipmentSpecificId);
queryWrapper.eq("video_id", videoId);
videoEquipmentSpecificService.remove(queryWrapper);
return true;
}
private Boolean bingEquipmentRelationshipToVideo(List<Long> videoIdList, Long equipmentSpecificId) {
List<VideoEquipmentSpecific> videoSpecificList = new ArrayList<>();
videoIdList.parallelStream().forEach(x -> {
......
......@@ -41,4 +41,15 @@ public class JCSRemoteService {
return feignClientResult.getResult();
}
/**
*
* 查询无权限的公司部门列表
*
* @param orgTypes(多个逗号分隔) 为空默认查询公司和部门,COMPANY: 公司树 DEPARTMENT部门树
* @return List<OrgUsrDto>
*/
public List<OrgUsrDto> getlistCompanyTree( String orgType) {
FeignClientResult<List<OrgUsrDto>> feignClientResult = jcsFeignClient.getlistCompanyTree( orgType);
return feignClientResult.getResult();
}
}
......@@ -128,6 +128,7 @@ public class MaintenanceResourceServiceImpl extends ServiceImpl<MaintenanceResou
List<MaintenanceResourceData> maintenanceResourceData = maintenanceResourceDataMapper.selectMaintenanceResourceDataListByclassifyId();
//获取第三层分类节点
List<MaintenanceResourceDto> maintenanceResourceDtos = this.baseMapper.selectAllType();
List<MaintenanceResourceDto> list = new ArrayList<>();
maintenanceResourceData.stream().forEach(e-> {
MaintenanceResourceDto e1 = new MaintenanceResourceDto();
......@@ -136,7 +137,7 @@ public class MaintenanceResourceServiceImpl extends ServiceImpl<MaintenanceResou
e1.setCompanyId(e.getMaintenanceCompanyId().toString());
e1.setType(MaintenanceResourceEnum.CLASSIFY.getValue());
e1.setParentId(e.getFireFightSysId().toString());
e1.setCode(e.getClassifyCode());
e1.setOwnerUnitId(e.getOwnerUnitId().toString());
list.add(e1);
});
// List<MaintenanceResourceDto> list = this.selectAll();
......@@ -144,27 +145,6 @@ public class MaintenanceResourceServiceImpl extends ServiceImpl<MaintenanceResou
//获取维保单位和业主单位
List<MaintenanceResourceDto> companyTree = getCompanyList(appKey, product, token);
if (!CollectionUtils.isEmpty(companyTree)) {
/* List<MaintenanceResourceDto> result = new ArrayList<>();
result.addAll(list);
for (int i = 0; i < list.size(); i++) {
for (int j = 0; j < companyTree.size(); j++) {
if (list.get(i).getParentId().equals(companyTree.get(j).getParentId()) && list.get(i).getId().equals(companyTree.get(j).getId()) ){
result.remove(list.get(i));
}
}
}*/
/* result.addAll(companyTree);
result.forEach(e->{if (e.getContractId() == null){
e.setContractId(QRCodeUtil.generateQRCode());
}
});
List<MaintenanceResourceDto> dataList = new ArrayList<>();
Map<String, Optional<MaintenanceResourceDto>> collect = result.stream().collect(groupingBy(MaintenanceResourceDto::getContractId, minBy(Comparator.comparing(MaintenanceResourceDto::getParentId))));
collect.entrySet().forEach(entry -> {
entry.getValue().ifPresent(v -> {
dataList.add(v);
});
});*/
list.addAll(companyTree);
list.addAll(maintenanceResourceDtos);
//避免造成其他代码bug,替换新的组装树
......
......@@ -9,8 +9,13 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.logging.Logger;
import java.util.stream.Collectors;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.equipmanage.common.entity.*;
import com.yeejoin.equipmanage.common.entity.publics.BaseEntity;
import liquibase.pro.packaged.W;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
......@@ -34,12 +39,6 @@ import com.yeejoin.equipmanage.common.datasync.entity.FireEquipmentDefectAlarm;
import com.yeejoin.equipmanage.common.datasync.entity.FireEquipmentFaultAlarm;
import com.yeejoin.equipmanage.common.datasync.entity.FireEquipmentFireAlarm;
import com.yeejoin.equipmanage.common.dto.TemperatureAlarmDto;
import com.yeejoin.equipmanage.common.entity.CarProperty;
import com.yeejoin.equipmanage.common.entity.EquipmentAlarmReportDay;
import com.yeejoin.equipmanage.common.entity.EquipmentSpecificAlarm;
import com.yeejoin.equipmanage.common.entity.EquipmentSpecificAlarmLog;
import com.yeejoin.equipmanage.common.entity.EquipmentSpecificIndex;
import com.yeejoin.equipmanage.common.entity.FireFightingSystemEntity;
import com.yeejoin.equipmanage.common.entity.vo.CarPropertyVo;
import com.yeejoin.equipmanage.common.entity.vo.EquipmentIndexVO;
import com.yeejoin.equipmanage.common.entity.vo.EquipmentSpecificVo;
......@@ -491,6 +490,16 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
}
model.setIsSendWeb(true);
model.setCategory(1);
//告警弹窗需要根据人员单位判断是否展示 后端返回单位Code 前端判断
LambdaQueryWrapper<EquipmentSpecific> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(BaseEntity::getId,equipmentSpecificAlarmLog.getEquipmentSpecificId());
EquipmentSpecific equipmentSpecific = equipmentSpecificMapper.selectOne(wrapper);
if (!ValidationUtil.isEmpty(equipmentSpecific) && !ValidationUtil.isEmpty(equipmentSpecific.getBizOrgCode())){
Map<String, String> equipMap = new HashMap<>();
equipMap.put("bizOrgCode",equipmentSpecific.getBizOrgCode());
model.setExtras(equipMap);
}
model.setRelationId(String.valueOf(equipmentSpecificAlarmLog.getId()));
Token token = remoteSecurityService.getServerToken();
systemctlFeign.create(token.getAppKey(), token.getProduct(), token.getToke(), model);
......
......@@ -508,6 +508,21 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
relationRedisUtil.delSysRedisKey(fireFightSysIdsBuffer.toString());
}
if (redisUtils.hasKey("equipAndCarIotCodes")) {
redisUtils.del("equipAndCarIotCodes");
}
// TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
// @Override
// public void afterCommit() {
// List<EquipmentSpecificVo> data = equipmentSpecificMapper.getEquipOrCarByIotCode(null);
// if (redisUtils.hasKey("equipAndCarIotCodes")) {
// redisUtils.del("equipAndCarIotCodes");
// }
// redisUtils.set("equipAndCarIotCodes", JSONObject.toJSONString(data));
// }
// });
} catch (Exception e) {
//处理异常 返回 成功失败条数
e.printStackTrace();
......@@ -517,7 +532,14 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
return date;
}
String[] split = errBufferName.toString().split(",");
String date="上传成功:"+(equipmentDetailDownloadVOS.size()-(split!=null?split.length:0))+"条---上传失败:"+(split!=null?split.length:0)+"条(失败编号:"+errBufferName+"详情:"+erryy+")";
String date="";
if(split!=null&&split.length>0&&!"".equals(split[0])){
date="上传成功:"+(equipmentDetailDownloadVOS.size()-(split!=null?split.length:0))+"条---上传失败:"+(split!=null?split.length:0)+"条(失败编号:"+errBufferName+"详情:"+erryy+")";
}else{
date="上传成功:"+(equipmentDetailDownloadVOS.size())+"条---上传失败:"+"0条(失败编号:"+errBufferName+"详情:"+erryy+")";
}
log.error(date);
// 刷新redis中iotCode值
List<EquipmentSpecificVo> data = equipmentSpecificMapper.getEquipOrCarByIotCode(null);
......
......@@ -44,7 +44,9 @@ public class RelationRedisUtil {
List<String> collect = list.stream().map(FireFightingSystemEntity::getSystemTypeCode).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(collect)) {
for (String key : collect) {
redisUtil.del(key);
if (key!=null&&redisUtil.hasKey(key)){
redisUtil.del(key);
}
}
return Boolean.TRUE;
}
......
......@@ -10,6 +10,7 @@ import java.util.stream.Stream;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
......@@ -553,4 +554,11 @@ public class AlertCalledController extends BaseController {
public ResponseModel<Object> toCompletePoliceSituationMatch(@RequestParam Long id)throws Exception {
return ResponseHelper.buildResponse(iAlertCalledService.toCompletePoliceSituationMatch(id));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/selectFlightNumber")
@ApiOperation(httpMethod = "GET", value = "查询未结案的航空器报警存在的航班号", notes = "查询未结案的航空器报警存在的航班号")
public ResponseModel<Object> toCompletePoliceSituationMatch() throws MqttException {
return ResponseHelper.buildResponse(iAlertCalledService.selectFlightNumber());
}
}
\ No newline at end of file
......@@ -119,9 +119,9 @@ public class FirestationJacketController extends BaseController {
QueryWrapper<FirestationJacket> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("firefighters_id", sequenceNbr);
queryWrapper.eq("is_delete", 0);
FirestationJacket firestationJacket = iFirestationJacketService.getOne(queryWrapper);
List<FirestationJacket> firestationJacket = iFirestationJacketService.list(queryWrapper);
if(firestationJacket!=null){
if(firestationJacket!=null&&firestationJacket.size()>0){
return CommonResponseUtil2.failure("微型消防站有配装装备,不能删除!");
}
......
package com.yeejoin.amos.boot.module.jcs.biz.controller;
import java.util.Arrays;
import java.util.List;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import com.yeejoin.amos.boot.module.jcs.api.dto.PowerTransferCompanyDto;
import com.yeejoin.amos.boot.module.jcs.api.entity.UserCar;
import com.yeejoin.amos.boot.module.jcs.api.mapper.UserCarMapper;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
......@@ -12,7 +18,9 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
......@@ -49,7 +57,9 @@ public class PowerTransferController extends BaseController {
@Autowired
FireTeamServiceImpl fireTeamService;
@Autowired
EquipFeignClient equipFeignClient;
EquipFeignClient docequipFeignClient;
@Autowired
UserCarMapper userCarMapper;
/**
* 新增力量调派
......@@ -174,6 +184,29 @@ public class PowerTransferController extends BaseController {
@RequestMapping(value = "/create", method = RequestMethod.POST)
@ApiOperation(httpMethod = "POST", value = "力量调派-任务派发", notes = "力量调派-任务派发")
public ResponseModel<Boolean> createPowerTransfer(@RequestBody PowerTransferDto powerTransferDto) {
List<PowerTransferCompanyDto> powerTransferCompanyDotList = powerTransferDto.getPowerTransferCompanyDotList();
StringBuilder content = new StringBuilder();
powerTransferCompanyDotList.forEach(e->{
if (e.getPowerTransferCompanyResourcesDtoList()!=null){
e.getPowerTransferCompanyResourcesDtoList().forEach(
c->
{
LambdaQueryWrapper<UserCar> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(UserCar::getCarId,c.getResourcesId());
wrapper.eq(BaseEntity::getIsDelete, false);
Integer count = userCarMapper.selectCount(wrapper);
if (count < 1){
content.append(c.getResourcesName()+":"+c.getResourcesNum()+" ");
}
}
);
}
});
if (!ValidationUtil.isEmpty(content)){
throw new BadRequest("车辆:"+content+"未绑定人员,无法调派");
}
AgencyUserModel userInfo = getUserInfo();
powerTransferDto.setTaskSenderId(Long.parseLong(userInfo.getUserId()));
powerTransferDto.setTaskSenderName(userInfo.getRealName());
......
......@@ -17,6 +17,7 @@ import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.joda.time.DateTime;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
......@@ -147,6 +148,8 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
@Value("${mqtt.topic.command.knowledgebase.alert.match}")
private String topicMatch;
@Value("${mqtt.topic.command.alert.noticeAviation}")
private String noticeAviation;
@Autowired
private OrgUsrServiceImpl iOrgUsrService;
......@@ -454,6 +457,13 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
emqKeeper.getMqttClient().publish(topicData, json.getBytes(), RuleConfig.DEFAULT_QOS, false);
// 航空报警器报警通知
if (AlertStageEnums.HKJY.getCode().equals(alertCalled.getAlertTypeCode())) {
List<String> flightNumber = powerTransferMapper.selectFlightNumber(AlertStageEnums.HKJY.getCode());
String flightNumIds = JSONObject.toJSONString(flightNumber);
emqKeeper.getMqttClient().publish(noticeAviation, flightNumIds.getBytes(), RuleConfig.DEFAULT_QOS, false);
}
/**
* 同步保存ES
*/
......@@ -479,6 +489,11 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
}
public List<String> selectFlightNumber() throws MqttException {
return powerTransferMapper.selectFlightNumber(AlertStageEnums.HKJY.getCode());
}
......@@ -684,11 +699,31 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
Map<String, Integer> map = powerTransferMapper.getCarNum(id);
// Map<String,Integer> mapc=powerTransferMapper.getCompanyNum(id);
// Map<String,Integer> mapu= alertSubmittedMapper.getUseNum(id);
Date currentTime = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
String dateString = formatter.format(currentTime);
List< Map<String, Integer>> list=powerTransferMapper.getCarUserNum(dateString,id);
AlertCalled al=alertCalledMapper.selectById(id);
// 统计参与人员
List<KeyValueLabel> listdate = new ArrayList<>();
listdate.add(new KeyValueLabel("调动人力", "useNum", "0", "人"));
// if(al.getAlertStatus()){
// listdate.add(new KeyValueLabel("调动人力", "useNum", "0", "人"));
// }
if(list!=null&&list.size()>0){
listdate.add(new KeyValueLabel("调动人力", "useNum", list.size(), "人"));
}else{
listdate.add(new KeyValueLabel("调动人力", "useNum", "0", "人"));
}
// listdate.add(new KeyValueLabel("调动人力", "useNum", "0", "人"));
// 统计参与车辆
listdate.add(new KeyValueLabel("调动人力", "carNum", map.get("carNum"), "辆"));
listdate.add(new KeyValueLabel("调派车辆", "carNum", map.get("carNum"), "辆/次"));
// 统计参与队伍
listdate.add(new KeyValueLabel("调动单位", "companyNum", map.get("companyNum"), "个"));
return listdate;
......
......@@ -36,6 +36,7 @@ import com.yeejoin.amos.boot.module.common.api.service.ISourceFileService;
import com.yeejoin.amos.boot.module.jcs.api.entity.*;
import com.yeejoin.amos.boot.module.jcs.api.mapper.JcSituationDetailMapper;
import com.yeejoin.amos.boot.module.jcs.api.mapper.UserCarMapper;
import com.yeejoin.amos.feign.systemctl.model.MessageModel;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.xwpf.usermodel.XWPFTable;
......@@ -186,6 +187,8 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
@Value("${mqtt.topic.command.power.deployment}")
private String powertopic;
@Value("${mqtt.topic.command.alert.noticeAviation}")
private String noticeAviation;
@Autowired
EquipFeignClient equipFeignClient;
......@@ -348,7 +351,22 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
ruleAlertCalledService.fireAlertCalledRule(alertCalledVo, map.get("alertWay"),map.get("mobiles"), map.get("usIds"), map.get("feedBack"));
//通知实战指挥页面发送mqtt 默认发送 String 类型 0, 新警情 1 警情状态变化
emqKeeper.getMqttClient().publish(powertopic, "0".getBytes(), RuleConfig.DEFAULT_QOS, true);
} catch (MqttException e) {
// 航空报警器警情结案推送
if(AlertBusinessTypeEnum.警情结案.getCode().equals(alertSubmittedDto.getBusinessTypeCode()) && AlertStageEnums.HKJY.getCode().equals(alertCalled.getAlertTypeCode())) {
List<String> list = powerTransferMapper.selectFlightNumber(AlertStageEnums.HKJY.getCode());
emqKeeper.getMqttClient().publish(noticeAviation, JSONObject.toJSONString(list).getBytes(), RuleConfig.DEFAULT_QOS, false);
}
// 警情结案时,修改该警情关联待办任务状态
if(AlertBusinessTypeEnum.警情结案.getCode().equals(alertSubmittedDto.getBusinessTypeCode())) {
MessageModel model = new MessageModel();
model.setRelationId(String.valueOf(alertCalled.getSequenceNbr()));
model.setIsRead(true);
model.setMsgType("jcs119");
Systemctl.messageClient.update(model);
}
} catch (MqttException e) {
throw new RuntimeException();
}
return true;
......@@ -1224,11 +1242,16 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
int listLength = dangerList.size();
for (int i = 0; i < fSizs; i++) {
if(i == 0) {
TableStyle tableStyle = new TableStyle();
tableStyle.setAlign(Enum.forString("center"));
reverseList.get(i).getCellDatas().get(0).setCellStyle(tableStyle);
Style style = new Style();
style.setFontFamily("宋体");
style.setFontSize(12);
style.setBold(true);
reverseList.get(i).getCellDatas().get(0).getRenderData().setStyle(style);
reverseList.get(i).getCellDatas().get(0).getRenderData().setText("增\n援\n力\n量");
} else {
reverseList.get(i).getCellDatas().forEach(cellRenderData -> {
Style style = new Style();
......@@ -1247,13 +1270,15 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
for (int i = fSizs; i < listLength ; i++) {
TableStyle tableStyle = new TableStyle();
tableStyle.setAlign(Enum.forInt(2));
tableStyle.setAlign(Enum.forString("center"));
reverseList.get(i).getCellDatas().get(0).setCellStyle(tableStyle);
reverseList.get(i).getCellDatas().get(0).getRenderData().setText("增\n援\n力\n量");
Style style = new Style();
style.setFontFamily("宋体");
style.setFontSize(12);
style.setBold(true);
reverseList.get(i).getCellDatas().get(0).getRenderData().setStyle(style);
// reverseList.get(i).getCellDatas().forEach(cellRenderData -> {
// Style style = new Style();
......@@ -1696,7 +1721,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
Map<String, String> besidesMap = new HashMap<String, String>();
besidesMap.put("responseLevelString", responseLevelString);
besidesMap.put("alterId", alertCalledId);
if(userList.size()>0) {
if(!ValidationUtil.isEmpty(userList)) {
pushPowerTransferToAppAndWeb(AlertBusinessTypeEnum.力量调派.getCode(),besidesMap,smsParams,userList, null);
}
......
package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
import java.util.ArrayList;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;
......@@ -86,11 +87,14 @@ public class ESAlertCalledService {
List<AlertCalled> alertCalleds = alertCalledService.list(wrapper);
if (!ValidationUtil.isEmpty(alertCalleds))
{
for (AlertCalled alertCalled : alertCalleds)
{
saveAlertCalledToES(alertCalled);
}
// for (AlertCalled alertCalled : alertCalleds)
// {
// saveAlertCalledToES(alertCalled);
// }
saveAlertCalledToES(alertCalleds);
}
return true;
}
......@@ -151,6 +155,44 @@ public class ESAlertCalledService {
return esAlertCalled;
}
public List<ESAlertCalled> saveAlertCalledToES(List<AlertCalled> alertCalleds) throws Exception
{
List<ESAlertCalled> list1=new ArrayList<>();
for (AlertCalled alertCalled : alertCalleds)
{
ESAlertCalled esAlertCalled = new ESAlertCalled();
esAlertCalled.setSequenceNbr(alertCalled.getSequenceNbr());
esAlertCalled.setAlertType(alertCalled.getAlertType());
esAlertCalled.setAlertTypeCode(alertCalled.getAlertTypeCode());
esAlertCalled.setCallTime(alertCalled.getCallTime());
esAlertCalled.setCallTimeLong(alertCalled.getCallTime()!=null?alertCalled.getCallTime().getTime():null);
esAlertCalled.setContactUser(alertCalled.getContactUser());
esAlertCalled.setContactPhone(alertCalled.getContactPhone());
esAlertCalled.setAddress(alertCalled.getAddress());
esAlertCalled.setAlertStage(alertCalled.getAlertStage());
esAlertCalled.setAlertStatus(alertCalled.getAlertStatus());
if (alertCalled.getAlertStatus())
{
esAlertCalled.setAlertStatusStr(AlertStatusEnum.CLOSED.getCode());
}else
{
esAlertCalled.setAlertStatusStr(AlertStatusEnum.UNCLOSED.getCode());
}
esAlertCalled.setResponseLevelCode(alertCalled.getResponseLevelCode());
esAlertCalled.setUnitInvolved(alertCalled.getUnitInvolved());
esAlertCalled.setCoordinateX(alertCalled.getCoordinateX());
esAlertCalled.setCoordinateY(alertCalled.getCoordinateY());
list1.add(esAlertCalled);
}
esAlertCalledRepository.saveAll(list1);
return list1;
}
/**
*
* <pre>
......
......@@ -6,6 +6,7 @@ import java.util.List;
import java.util.Set;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.biz.common.enums.RuleTypeEnum;
import com.yeejoin.amos.component.rule.config.ClazzUtils;
import com.yeejoin.amos.feign.rule.Rule;
......@@ -90,7 +91,10 @@ public class RuleAlertCalledService {
FactBaseModel factBaseModel = new FactBaseModel();
factBaseModel.setPackageId("西咸机场119接处警规则/alertCalledRule");
HashMap<String, byte[]> map = new HashMap<>();
map.put("com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledRo", ClazzUtils.serializableObject(alertCalledRo));
// map.put("com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledRo", ClazzUtils.serializableObject(alertCalledRo));
map.put("com.yeejoin.amos.boot.module.jcs.api.dto.AlertCalledRo", JSONObject.toJSON(alertCalledRo).toString().getBytes());
factBaseModel.setFactMap(map);
Rule.ruleClient.fireRule(factBaseModel);
return true;
......
......@@ -17,6 +17,12 @@
<groupId>com.amosframework.boot</groupId>
<artifactId>amos-boot-module-knowledgebase-api</artifactId>
<version>${amos-biz-boot.version}</version>
<exclusions>
<exclusion>
<artifactId>log4j</artifactId>
<groupId>log4j</groupId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
......
package com.yeejoin.amos.knowledgebase.controller;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.alibaba.fastjson.JSONArray;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
......@@ -212,18 +214,31 @@ public class DocLibraryResource {
docLibraryService.export(id, type, response);
}
// @TycloudOperation(ApiLevel = UserType.AGENCY)
// @ApiOperation(value = "导入excel文档")
// @RequestMapping(value = "/import", method = RequestMethod.POST)
// public ResponseModel importExcel(@RequestPart(value = "file") MultipartFile file,
// @RequestPart(value = "module") String moduleStr) {
// ExcelImportConfig excelConfig;
// try {
// excelConfig = JSON.parseObject(moduleStr, ExcelImportConfig.class);
// } catch (Exception e) {
// throw new BadRequest("模板配置信息格式有误");
// }
// return ResponseHelper.buildResponse(docLibraryService.importExcel(file, excelConfig));
// }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "导入excel文档")
@RequestMapping(value = "/import", method = RequestMethod.POST)
public ResponseModel importExcel(@RequestPart(value = "file") MultipartFile file,
@RequestPart(value = "module") String moduleStr) {
ExcelImportConfig excelConfig;
public ResponseModel importExcel(@RequestPart(value = "file") MultipartFile file, @RequestPart(value = "module") String moduleStr) {
List<ExcelImportConfig> excelConfigList;
try {
excelConfig = JSON.parseObject(moduleStr, ExcelImportConfig.class);
excelConfigList = JSONArray.parseArray(moduleStr, ExcelImportConfig.class);
} catch (Exception e) {
throw new BadRequest("模板配置信息格式有误");
}
return ResponseHelper.buildResponse(docLibraryService.importExcel(file, excelConfig));
return ResponseHelper.buildResponse(docLibraryService.importExcel(file, excelConfigList));
}
}
......@@ -3,12 +3,13 @@ package com.yeejoin.amos.knowledgebase.face.orm.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.knowledgebase.face.orm.entity.KnowlegeStatisticsRecord;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* <p>
* 标签分组 Mapper 接口
* 标签分组 Mapper 接口
* </p>
*
* @author 子杨
......@@ -16,26 +17,43 @@ import java.util.Map;
*/
public interface StatisticsRecordMapper extends BaseMapper<KnowlegeStatisticsRecord> {
/**
* 表清空
* @return
*/
void deleteAll();
/**
* 查询灾情总计
* @return
*/
Map<String, Object> selectDisasterCount();
/**
* 按类型分组查询
*/
List<Map<String, Object>> selectCategoryByName(String recordName);
/**
* 按类型查询/按时间分段总计
*/
List<Map<String, Object>> selectCountByNameAndDateRange(Map<String, Object> queryMap);
/**
* 表清空
*
* @return
*/
void deleteAll();
/**
* 查询灾情总计
*
* @return
*/
Map<String, Object> selectDisasterCount();
/**
* 按类型分组查询
*/
List<Map<String, Object>> selectCategoryByName(String recordName);
/**
* 按类型查询/按时间分段总计
*/
List<Map<String, Object>> selectCountByNameAndDateRange(Map<String, Object> queryMap);
List<Map<String, Object>> tagStatisticsMonth(String tag, Date startDate, Date endDate);
List<Map<String, Object>> tagStatisticsYear(String tag, Date startDate, Date endDate);
List<Map<String, Object>> docStatisticsMonth(String categoryName, Date startDate, Date endDate);
List<Map<String, Object>> docStatisticsYear(String categoryName, Date startDate, Date endDate);
List<Map<String, Object>> tagChartStatistics(String tag, Date startDate, Date endDate,String splitSQL);
List<Map<String, Object>> tagTimeChartStatistics(Date startDate, Date endDate,String splitSQL);
List<Map<String, Object>> docChartStatistics(Date startDate, Date endDate);
List<Map<String, Object>> docBurnChartStatistics(Date startDate, Date endDate);
}
\ No newline at end of file
package com.yeejoin.amos.knowledgebase.face.service;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.SortedSet;
import java.util.TreeSet;
import java.util.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
......@@ -257,4 +250,13 @@ public class DocCategoryService extends BaseService<KnowledgeDocCategoryModel, K
List<KnowledgeDocCategoryModel> categoryModelList = this.queryForList(null, true, categoryName, parentId);
return categoryModelList.isEmpty() ? null : categoryModelList.get(0);
}
public Map<String, Long> getGroupNameValue(List<Long> ids) {
List<KnowledgeDocCategoryModel> list = this.queryBatchSeq(ids);
Map<String, Long> result = new HashMap<>();
for(KnowledgeDocCategoryModel knowledgeDocCategoryModel: list) {
result.put(knowledgeDocCategoryModel.getCategoryName(), knowledgeDocCategoryModel.getSequenceNbr());
}
return result;
}
}
......@@ -96,8 +96,9 @@ public class ESDocService {
}
catch (Exception e)
{
return new AggregatedPageImpl<>(list, PageRequest.of(current, size), 0);
e.printStackTrace();
}
return new AggregatedPageImpl<>(list, PageRequest.of(current, size), 0);
}
/**
......@@ -129,12 +130,12 @@ public class ESDocService {
for (String key : keys) {
boolMust.must(
QueryBuilders.boolQuery().minimumShouldMatch(1)
.should(QueryBuilders.matchQuery("docTitle", key))
.should(QueryBuilders.matchQuery("docInfo", key))
.should(QueryBuilders.matchQuery("author", key))
.should(QueryBuilders.matchQuery("textContent", key))
.should(QueryBuilders.matchQuery("docTags.tagInfo", key))
.should(QueryBuilders.matchQuery("contentTags.tagInfo", key))
.should(QueryBuilders.matchPhraseQuery("docTitle", key))
.should(QueryBuilders.matchPhraseQuery("docInfo", key))
.should(QueryBuilders.matchPhraseQuery("author", key))
.should(QueryBuilders.matchPhraseQuery("textContent", key))
.should(QueryBuilders.matchPhraseQuery("docTags.tagInfo", key))
.should(QueryBuilders.matchPhraseQuery("contentTags.tagInfo", key))
);
}
// 创建查询构造器
......
......@@ -436,4 +436,11 @@ public class LatentDangerController extends BaseController {
}
return ResponseHelper.buildResponse(null);
}
@ApiOperation(value = "隐患跳转巡检任务页面", notes = "隐患跳转巡检任务页面")
@GetMapping(value = "/web/patrol/{id}/{bizId}")
@TycloudOperation(ApiLevel = UserType.AGENCY)
public ResponseModel selectByIdandBizId(@PathVariable String bizId, @PathVariable Long id) {
return ResponseHelper.buildResponse(iLatentDangerService.selectByIdandBizId(id, bizId));
}
}
......@@ -90,4 +90,6 @@ public interface LatentDangerMapper extends BaseMapper<LatentDanger> {
String orgCode);
List<LatentDanger> updateStatusByUserIdAndPlandIdLike(String userId,String planId);
String selectByIdandBizId(Long id,String bizId);
}
......@@ -9,7 +9,9 @@ import java.util.*;
import java.util.stream.Collectors;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.feign.systemctl.model.MessageModel;
import org.apache.commons.lang3.ObjectUtils;
import org.opengis.metadata.acquisition.Plan;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
......@@ -2488,10 +2490,18 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
DangerExecuteSubmitDto executeSubmitDto) throws Exception {
List<String> userIds = workflowExecuteService.getUserIdsByWorkflow(latentDanger.getInstanceId(),
executeSubmitDto.getCheckLeaderId());
// 修改待办任务状态
updateTaskStatus(latentDanger);
ruleDangerService.addDangerSubmitRule(latentDanger, userIds, RuleTypeEnum.隐患审核.getCode(),
ExecuteTypeEnum.getNameByCode(executeType));
}
private void updateTaskStatus(LatentDanger latentDanger){
MessageModel model = new MessageModel();
model.setRelationId(String.valueOf(latentDanger.getId()));
model.setMsgType("danger");
model.setIsRead(true);
Systemctl.messageClient.update(model);
}
@Override
public IPage<LatentDanger> reviewListDanger(PageParam pageParam, String userId) throws Exception {
String type = pageParam.get("type").toString();
......@@ -2707,4 +2717,8 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
this.savePatrol(dangerDtos,userId,userRealName,departmentId,departmentName,companyId,orgCode,role,"1");
}
public String selectByIdandBizId(Long id,String bizId){
return latentDangerMapper.selectByIdandBizId(id,bizId);
}
}
\ No newline at end of file
......@@ -203,4 +203,6 @@ public interface ILatentDangerService {
public Map<String, Integer> currentLandgerCount(String companyId,String loginOrgCode);
void updateStatusByUserIdAndPlandIdLike(String userId, String planId,ReginParams reginParams) throws Exception;
String selectByIdandBizId(Long id,String bizId) ;
}
package com.yeejoin.amos.maintenance.business.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.common.base.Joiner;
......@@ -11,8 +11,11 @@ import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import com.yeejoin.amos.feign.privilege.model.DepartmentModel;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.MessageModel;
import com.yeejoin.amos.maintenance.business.constants.XJConstant;
import com.yeejoin.amos.maintenance.business.dao.mapper.CheckMapper;
import com.yeejoin.amos.maintenance.business.dao.mapper.PlanMapper;
import com.yeejoin.amos.maintenance.business.dao.mapper.PlanTaskDetailMapper;
import com.yeejoin.amos.maintenance.business.dao.mapper.PlanTaskMapper;
import com.yeejoin.amos.maintenance.business.dao.mapper.RouteMapper;
......@@ -115,6 +118,9 @@ public class CheckServiceImpl implements ICheckService {
@Autowired
IRouteDao iRouteDao;
@Autowired
PlanServiceImpl planService;
final String CHECK_UPDATE_TOPIC = "maintenance/date/update";
......@@ -273,6 +279,15 @@ public class CheckServiceImpl implements ICheckService {
jsonObject.put("maintenanceTime", check.getCheckTime());
mqttGateway.publish(CHECK_UPDATE_TOPIC, jsonObject.toJSONString());
}
Plan plan = planService.queryPlanById(planTask.getPlanId());
if (!ObjectUtils.isEmpty(plan) && plan.getIsSingleExecution()){
// 单人执行
updateTaskStatus(plan.getId(), reginParams.getUserModel().getUserId());
}else {
// 多人执行
updateTaskStatus(plan.getId(), null);
}
//7.返回不合格记录
return new CheckDto(check.getId(), unqualifiedCheckItemList);
} catch (Exception e) {
......@@ -280,6 +295,17 @@ public class CheckServiceImpl implements ICheckService {
throw new Exception(e.getMessage(), e);
}
}
private void updateTaskStatus(Long planId, String userId){
MessageModel model = new MessageModel();
model.setRelationId(String.valueOf(planId));
model.setIsRead(true);
model.setMsgType("maintenance");
if (!ObjectUtils.isEmpty(userId)){
model.setUserId(userId);
}
log.info("修改待办任务参数-->{}", JSON.toJSON(model));
Systemctl.messageClient.update(model);
}
private void checkCanFinishTask(String mtUserSeq, PlanTask planTask, Long pointId) throws Exception {
int status;
......
......@@ -273,6 +273,7 @@ public class CheckController extends AbstractBaseController {
//数字换流站页面刷新
try {
webMqttComponent.publish(patrolTopic, "");
}catch (Exception e){
log.error("数字换流站页面推送失败-----------"+e.getMessage());
}
......
......@@ -3,7 +3,10 @@ package com.yeejoin.amos.patrol.business.controller;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.patrol.business.feign.JcsFeignClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
......@@ -42,6 +45,7 @@ import com.yeejoin.amos.patrol.dao.entity.InputItem;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
/**
* 检查项
......@@ -60,6 +64,34 @@ public class InputItemController extends AbstractBaseController {
IInputItemService inputItemService;
@Autowired
IInputItemDao inputItemDao;
@Autowired
JcsFeignClient jcsFeignClient;
/**
* 新加接口*****************************************************************************
* */
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "分页查询检查项", notes = "分页查询检查项")
@RequestMapping(value = "/queryItemByPageNew", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
public CommonResponse queryItemByPageNew(
@ApiParam(value = "组合查询条件", required = false, defaultValue = "[]") @RequestBody(required = false) InputItemPageParam criterias,
@ApiParam(value = "分页参数", required = false, defaultValue = "current=0&pageSize=10或pageNumber0&pageSize=10") CommonPageable pageable) {
ReginParams reginParams = getSelectedOrgInfo();
ResponseModel<Object> companyByBizOrgCodeList = jcsFeignClient.getCompanyByBizOrgCodeList(reginParams.getPersonIdentity().getBizOrgCode());
//登录人可看到单位级别下的所有检查项
//查询向上查询所属单位的bizOrgCode
String bizOrgCode = ((Map<String, Object>) companyByBizOrgCodeList.getResult()).get("bizOrgCode").toString();
criterias.setBizOrgCode(bizOrgCode);
Page<InputItemVo> page = inputItemService.queryInputItemByPageNew(criterias);
return CommonResponseUtil.success(page);
}
/**
* 新加接口*****************************************************************************
* */
/**
* 新增巡检项
......@@ -94,6 +126,7 @@ public class InputItemController extends AbstractBaseController {
}
}
/**
* 查询巡检项详情
*
......@@ -139,7 +172,7 @@ public class InputItemController extends AbstractBaseController {
/**
* 批量删除检查项
*
* @param itemID
* @param
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
......@@ -180,7 +213,7 @@ public class InputItemController extends AbstractBaseController {
/**
* 检查项另存为
*
* @param itemID
* @param
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
......@@ -357,4 +390,51 @@ public class InputItemController extends AbstractBaseController {
public CommonResponse getCheckClassify() {
return CommonResponseUtil.success(inputItemService.getCheckClassify(getToken(), getProduct(), getAppKey(), DictTypeEnum.CHECK_CLASSIFY.getCode()));
}
/*******新增接口************/
/**
* 新增巡检项
*
* @param param
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "新增检查项", notes = "新增检查项")
@RequestMapping(value = "/addItemNew", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
public CommonResponse addNewItemNew(@ApiParam(value = "检查项信息") @RequestBody InputItemParam param) {
AgencyUserModel user = getUserInfo();
if (ObjectUtils.isEmpty(user)) {
return CommonResponseUtil.failure("用户session过期");
}
try {
InputItem inputItem = new InputItem();
ReginParams reginParams = getSelectedOrgInfo();
String loginOrgCode = getOrgCode(reginParams);
BeanUtils.copyProperties(param, inputItem);
inputItem.setDataJson(param.getDataJson() != null ?JSONObject.toJSONString(param.getDataJson()) : null);
inputItem.setPictureJson(param.getPictureJson() != null ?JSONObject.toJSONString(param.getPictureJson()) :null);
///LoginUserParam loginParam = getLoginUserParam();
ResponseModel<Object> companyByBizOrgCodeList = jcsFeignClient.getCompanyByBizOrgCodeList(reginParams.getPersonIdentity().getBizOrgCode());
String bizOrgCode = ((Map<String, Object>) companyByBizOrgCodeList.getResult()).get("bizOrgCode").toString();
inputItem.setBizOrgCode(reginParams.getPersonIdentity().getBizOrgCode() == null? null :reginParams.getPersonIdentity().getBizOrgCode() );
inputItem.setBizOrgName(reginParams.getPersonIdentity().getCompanyName()== null? null :reginParams.getPersonIdentity().getCompanyName());
inputItem.setOrgCode(loginOrgCode);
inputItem.setCreateBy(user.getUserId());
if (!ObjectUtils.isEmpty(param.getId())) {
inputItem.setId(param.getId());
inputItemService.updateInputItem(inputItem);
}else {
inputItemService.addNewInputItem(inputItem);
}
return CommonResponseUtil.success();
} catch (Exception e) {
return CommonResponseUtil.failure("检查项新增失败: " + e.getMessage());
}
}
}
......@@ -139,6 +139,7 @@ public class LatentDangerController extends AbstractBaseController {
}
return iLatentDangerService.detail(id, user.getUserId(),isFinish);
} catch (Exception e) {
e.printStackTrace();
return CommonResponseUtil.failure("系统繁忙,请稍后再试");
}
}
......
......@@ -85,6 +85,97 @@ public class MsgController extends AbstractBaseController {
/*@Autowired
private IUserService iUserService;
*/
/**
* 新接口
*
* **/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "根据条件获取消息列表", notes = "APP 根据条件获取消息列表")
@PostMapping(value = "/listNew", produces = "application/json;charset=UTF-8")
public CommonResponse querylistNew(
@ApiParam(value = "查询条件", required = false) @RequestBody(required = false) MsgInfoPageParam param,
@ApiParam(value = "分页参数", required = true, defaultValue = "pageNumber=0&pageSize=10") CommonPageable commonPageable) {
try {
ReginParams reginParams = getSelectedOrgInfo();
param.setBizOrgCode(reginParams.getPersonIdentity().getCompanyBizOrgCode());
Page<MsgVo> dataList = iMsgService.queryMsgInfoList(param);
return CommonResponseUtil.success(dataList);
} catch (Exception e) {
log.error(e.getMessage(),e);
return CommonResponseUtil.failure("件获取消息列表失败");
}
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "通知发布", notes = "通知发布")
@PostMapping(value = "/noticePublishNew", produces = "application/json;charset=UTF-8")
public CommonResponse noticePublishNew(@ApiParam(value = "通知信息", required = true) @RequestBody NoticePublishParam msg) {
try {
AgencyUserModel user = getUserInfo();
msg.setCreateBy(user.getUserId());
ReginParams reginParams = getSelectedOrgInfo();
msg.setUserName(user.getRealName());
String loginOrgCode = getOrgCode(reginParams);
msg.setOrgCode(loginOrgCode);
msg.setBizOrgCode(reginParams.getPersonIdentity().getBizOrgCode());
msg.setBizOrgName(reginParams.getPersonIdentity().getCompanyName());
List<Msg> msgList = iMsgService.publishNotice(null,null,null,msg);
msgList.forEach(m->{
jobService.msgAddJob(m);
});
return CommonResponseUtil.success();
} catch (Exception e) {
return CommonResponseUtil.failure("通知发布失败!");
}
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value="APP获取消息类型", notes="APP获取消息类型")
@GetMapping(value="/MsgTypeNew",produces = "application/json;charset=UTF-8")
public CommonResponse getMsgTypeNew() {
try {
List<Map<String,String>> list = new ArrayList<>();
for(MsgTypeEnum e : MsgTypeEnum.values()) {
Map<String,String> msgType = new HashMap<>();
msgType.put("name",e.getName());
msgType.put("value",e.getCode());
list.add(msgType);
}
return CommonResponseUtil.success(list);
} catch (Exception e) {
return CommonResponseUtil.failure("获取消息类型失败");
}
}
/**
* 新接口
*
* **/
/**
* 获取用户当前所选择公司的消息订阅信息
......@@ -358,7 +449,7 @@ public class MsgController extends AbstractBaseController {
* @param commonPageable
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "根据条件获取消息列表", notes = "APP 根据条件获取消息列表")
@PostMapping(value = "/list", produces = "application/json;charset=UTF-8")
public CommonResponse querylist(
......@@ -404,7 +495,7 @@ public class MsgController extends AbstractBaseController {
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "通知发布", notes = "通知发布")
@PostMapping(value = "/noticePublish", produces = "application/json;charset=UTF-8")
public CommonResponse noticePublish(@ApiParam(value = "通知信息", required = true) @RequestBody NoticePublishParam msg) {
......
......@@ -16,6 +16,19 @@ import org.springframework.stereotype.Repository;
@Repository
public interface InputItemMapper extends BaseMapper {
/**
* 新接口
* */
public long countInputItemInfoDataNew(InputItemPageParam param);
public List<InputItemVo> getInputItemInfoNew(InputItemPageParam param);
/**
* 新接口
* */
public void updateInputItem(InputItem item);
public List<HashMap<String, Object>> countByCatalogId(HashMap<String, Object> paramMap);
......
......@@ -48,4 +48,7 @@ public class LatentDangerPatrolBo extends LatentDangerPatrolBoExtend {
* 记录修改时间
*/
private Date updateDate;
//input id
private Long inputId;
}
package com.yeejoin.amos.patrol.business.feign;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.ws.rs.POST;
import java.util.List;
import java.util.Map;
......@@ -44,6 +46,19 @@ public interface JcsFeignClient {
@GetMapping(value = "/org-usr/find/getByOrgCode")
ResponseModel<Object> getByOrgCode(@RequestParam String bizOrgCode);
@GetMapping(value = "/org-usr/company/bizOrgCode/list")
ResponseModel<Object> getCompanyByBizOrgCodeList(@RequestParam String bizOrgCode);
/**
* 查询用户单位信息
* @param userId 用户id
* @return ResponseModel<ReginParams.PersonIdentity>
*/
@GetMapping(value = "/org-person/getUser/{id}")
FeignClientResult selectById(@PathVariable String id);
@PostMapping (value = "/org-person/getUserList")
FeignClientResult<List<Map<String, Object>>> selectByIdList(@RequestBody List<String> id);
}
......@@ -6,19 +6,31 @@ import java.util.List;
public class InputItemPageParam extends CommonPageable{
private String isScore;
private String itemType;
//检查项名称
private String name;
//检查项等级
private String level;
//检查项编号
private String itemNo;
/**
* 机构
*/
//机场单位code
private String bizOrgCode;
//平台code
private String orgCode;
private int catalogId;
private String isScore;
private String itemType;
private List<Long> catalogIds;
public String getBizOrgCode() {
return bizOrgCode;
}
public void setBizOrgCode(String bizOrgCode) {
this.bizOrgCode = bizOrgCode;
}
public String getItemNo() {
return itemNo;
}
......
package com.yeejoin.amos.patrol.business.param;
import javax.persistence.Column;
public class InputItemParam {
private long id;
private long catalogId;
private String dataJson;
private Object dataJson;
private String defaultValue;
private String inputJson;
private String isMultiline;
......@@ -15,7 +17,7 @@ public class InputItemParam {
private String name;
private int orderNo;
private String orgCode;
private String pictureJson;
private Object pictureJson;
private String remark;
private String level;
private String itemNo;
......@@ -24,6 +26,62 @@ public class InputItemParam {
private String checkMethod;
private String unit;
/**
* 新加字段
*
* */
//单位code
private String bizOrgCode;
//单位名称
private String bizOrgName;
public String getBizOrgCode() {
return bizOrgCode;
}
public void setBizOrgCode(String bizOrgCode) {
this.bizOrgCode = bizOrgCode;
}
public String getBizOrgName() {
return bizOrgName;
}
public void setBizOrgName(String bizOrgName) {
this.bizOrgName = bizOrgName;
}
public String getEquipmentType() {
return equipmentType;
}
public void setEquipmentType(String equipmentType) {
this.equipmentType = equipmentType;
}
public String getFacilitiesType() {
return facilitiesType;
}
public void setFacilitiesType(String facilitiesType) {
this.facilitiesType = facilitiesType;
}
public String getKeyPartsType() {
return keyPartsType;
}
public void setKeyPartsType(String keyPartsType) {
this.keyPartsType = keyPartsType;
}
//消防装备类型
private String equipmentType;
//消防设施类型、
private String facilitiesType;
// 重点类型
private String keyPartsType;
public String getUnit() {
return unit;
}
......@@ -66,10 +124,10 @@ public class InputItemParam {
public void setCatalogId(long catalogId) {
this.catalogId = catalogId;
}
public String getDataJson() {
public Object getDataJson() {
return dataJson;
}
public void setDataJson(String dataJson) {
public void setDataJson(Object dataJson) {
this.dataJson = dataJson;
}
public String getDefaultValue() {
......@@ -126,10 +184,10 @@ public class InputItemParam {
public void setOrgCode(String orgCode) {
this.orgCode = orgCode;
}
public String getPictureJson() {
public Object getPictureJson() {
return pictureJson;
}
public void setPictureJson(String pictureJson) {
public void setPictureJson(Object pictureJson) {
this.pictureJson = pictureJson;
}
public String getRemark() {
......
......@@ -35,6 +35,30 @@ public class MsgInfoPageParam extends CommonPageable{
*/
private String userId;
/**
* biz_org_code
*/
private String bizOrgCode;
private String bizOrgName;
public String getBizOrgName() {
return bizOrgName;
}
public void setBizOrgName(String bizOrgName) {
this.bizOrgName = bizOrgName;
}
public String getBizOrgCode() {
return bizOrgCode;
}
public void setBizOrgCode(String bizOrgCode) {
this.bizOrgCode = bizOrgCode;
}
public String getUserId() {
return userId;
}
......
......@@ -6,6 +6,8 @@ import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yeejoin.amos.patrol.common.enums.MsgTypeEnum;
import javax.persistence.Column;
public class NoticePublishParam {
/**
......@@ -46,6 +48,29 @@ public class NoticePublishParam {
private String orgCode;
//单位code
private String bizOrgCode;
//单位名称
private String bizOrgName;
public String getBizOrgCode() {
return bizOrgCode;
}
public void setBizOrgCode(String bizOrgCode) {
this.bizOrgCode = bizOrgCode;
}
public String getBizOrgName() {
return bizOrgName;
}
public void setBizOrgName(String bizOrgName) {
this.bizOrgName = bizOrgName;
}
public String getUserName() {
return userName;
}
......
......@@ -15,6 +15,11 @@ import java.util.stream.Collectors;
import javax.annotation.Resource;
import javax.transaction.Transactional;
import com.alibaba.fastjson.JSON;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.MessageModel;
import com.yeejoin.amos.patrol.dao.entity.Plan;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.assertj.core.util.Sets;
......@@ -137,6 +142,9 @@ public class CheckServiceImpl implements ICheckService {
@Autowired
private IPointClassifyDao iPointClassifyDao;
@Autowired
private PlanServiceImpl planService;
// @Value("${file.ip}")
// private String fileIp;
//
......@@ -211,6 +219,7 @@ public class CheckServiceImpl implements ICheckService {
PlanTask planTask = null;
Check check = new Check();
HashMap<String, Object> routeParam = new HashMap<String, Object>();
Map detail = null;
Boolean isOffline = requestParam.getIsOffline();
......@@ -343,7 +352,15 @@ public class CheckServiceImpl implements ICheckService {
}else{
check.setScore(Integer.parseInt(XJConstant.POINT_NOT_SCORE));
}
check = checkDao.save(check);
// check = checkDao.save(check);
try {
check = checkDao.save(check);
}catch (Exception e) {
e.printStackTrace();
}
List<CheckShot> imgList = new ArrayList<>();
......@@ -409,6 +426,15 @@ public class CheckServiceImpl implements ICheckService {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
planTaskMapper.reformStatistics(user.getUserId(), sdf.format(new Date()), requestParam.getOrgCode());
}
// 任务完成、同步修改待办任务状态
Plan plan = planService.queryPlanById(check.getPlanId());
if (!ObjectUtils.isEmpty(plan) && plan.getIsSingleExecution()){
// 单人执行
updateTaskStatus(plan.getId(), user.getUserId());
}else {
// 多人执行
updateTaskStatus(plan.getId(), null);
}
return new CheckDto(check.getId(), unqualifiedcheckItemList);
} catch (Exception e) {
......@@ -416,7 +442,21 @@ public class CheckServiceImpl implements ICheckService {
return null;
}
}
private void updateTaskStatus(Long id, String userId){
try {
MessageModel model = new MessageModel();
model.setRelationId(String.valueOf(id));
model.setIsRead(true);
model.setMsgType("patrolSystem");
if (!ObjectUtils.isEmpty(userId)){
model.setUserId(userId);
}
FeignClientResult<MessageModel> update = Systemctl.messageClient.update(model);
}catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void delCheckById(List<Long> list) {
// List<Long> pointIdList = checkDao.getPointIdList(list);
......
......@@ -49,6 +49,34 @@ public class InputItemServiceImpl implements IInputItemService {
@Autowired
private RemoteSecurityService remoteSecurityService;
/**
* 新接口
* **/
@Override
public Page<InputItemVo> queryInputItemByPageNew(InputItemPageParam criterias) {
long total = inputItemMapper.countInputItemInfoDataNew(criterias);
List<InputItemVo> content = inputItemMapper.getInputItemInfoNew(criterias);
Page<InputItemVo> result = new PageImpl<InputItemVo>(content, criterias, total);
return result;
}
/**
* 新接口
* **/
@Override
@Transactional
public long addNewInputItem(InputItem param) {
......
......@@ -602,6 +602,9 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
}
Date startDate1 = new Date();;
int dangerListSize = latentDangerMapper.countByBathBusinessKeys(bussinessKeys, latentDangerListParam);
if (latentDangerListParam.getBelongType().equals(1)){
latentDangerListParam.setUserId(user.getUserId());
}
List<LatentDangerBo> dangerList = latentDangerMapper.getByBathBusinessKeys(bussinessKeys, latentDangerListParam);
Date endDate1 = new Date();
logger.info("-------------------------sql时间" +(endDate1.getTime()-startDate1.getTime()));
......@@ -835,6 +838,7 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
// detailVo.setCurrentUserCanExcute(true);
// }
// }
detailVo.setCurrentFlowRecordId(latentDangerBo.getCurrentFlowRecordId());
detailVo.setCurrentFlowRecordIdWeb(String.valueOf(latentDangerBo.getCurrentFlowRecordId()));
if (!StringUtils.isEmpty(latentDangerBo.getReformJson())) {
......@@ -851,8 +855,8 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
}
private void buildOfDifferentDangerType(LatentDangerBo latentDangerBo, LatentDangerDetailVo detailVo) {
if (latentDangerBo.getDangerType().equals(LatentDangerTypeEnum.计划检查.getCode())
|| latentDangerBo.getDangerType().equals(LatentDangerTypeEnum.无计划检查.getCode())) {
if (latentDangerBo.getDangerType().equals(LatentDangerTypeEnum.计划检查.getCode().toString())
|| latentDangerBo.getDangerType().equals(LatentDangerTypeEnum.无计划检查.getCode().toString())) {
LatentDangerPatrolBo patrolBo = latentDangerPatrolMapper.getByDangerId(latentDangerBo.getId());
if (patrolBo != null) {
LatentDangerDetailRiskVo riskVo = new LatentDangerDetailRiskVo();
......@@ -870,19 +874,23 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
if (StringUtil.isNotEmpty(checkUser)) {
riskVo.setCheckUser(checkUser.getRealName());
}
RiskFactorBo riskFactorBo = StringUtil.isNotEmpty(patrolBo.getClassifyOriginalId()) ? riskFactorMapper.getById(Long.valueOf(patrolBo.getClassifyOriginalId())) : null;
if (riskFactorBo != null && riskFactorBo.getEquipmentDepartmentId() != null) {
DepartmentModel department = remoteSecurityService.getDepartmentByDeptId(RequestContext.getToken(), getProduct(),RequestContext.getAppKey(),riskFactorBo.getEquipmentDepartmentId().toString());
if (department != null) {
riskVo.setBelongDepartmentName(department.getDepartmentName());
}
}
// RiskFactorBo riskFactorBo = StringUtil.isNotEmpty(patrolBo.getClassifyOriginalId()) ? riskFactorMapper.getById(Long.valueOf(patrolBo.getClassifyOriginalId())) : null;
// if (riskFactorBo != null && riskFactorBo.getEquipmentDepartmentId() != null) {
// DepartmentModel department = remoteSecurityService.getDepartmentByDeptId(RequestContext.getToken(), getProduct(),RequestContext.getAppKey(),riskFactorBo.getEquipmentDepartmentId().toString());
// if (department != null) {
// riskVo.setBelongDepartmentName(department.getDepartmentName());
// }
// }
// List<CheckShot> checkShots = iCheckShotDao.findAllByCheckIdAndCheckInputId(patrolBo.getCheckId(),
// latentDangerBo.getBizId());
List<CheckShot> checkShots = iCheckShotDao.findAllByCheckIdAndCheckInputId(patrolBo.getCheckId(),
latentDangerBo.getBizId());
patrolBo.getInputId());
if (!CollectionUtils.isEmpty(checkShots)) {
List<String> photos = Lists.transform(checkShots, e -> {
if (e != null) {
return fileServerAddress + e.getPhotoData().replaceAll("\\\\", "/");
// return fileServerAddress + e.getPhotoData().replaceAll("\\\\", "/");
return e.getPhotoData().replaceAll("\\\\", "/");
} else {
return "";
}
......@@ -1264,9 +1272,12 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
latentDangerBo.setReformType(LatentDangerReformTypeEnum.常规整改.getCode().toString());
JSONObject reformJsonObj = JSONObject.parseObject(latentDangerBo.getReformJson());
if (ValidationUtil.isEmpty(reformJsonObj)) {
reformJsonObj = executeParam.getFlowJson();
// reformJsonObj = executeParam.getFlowJson();
reformJsonObj.put("governPhotoObj",executeParam.getFlowJson().get("photoUrls"));
} else {
reformJsonObj.putAll(executeParam.getFlowJson());
// reformJsonObj.putAll(executeParam.getFlowJson());
reformJsonObj.put("governPhotoObj",executeParam.getFlowJson().get("photoUrls"));
}
latentDangerBo.setReformJson(reformJsonObj.toJSONString());
latentDangerBo.setInferOtherThings(executeParam.getInferOtherThings());
......@@ -1290,6 +1301,7 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
reformJsonObject = new JSONObject();
}
reformJsonObject.put("governUserId", governUserId);
reformJsonObject.put("reviewPhotoObj",reformJsonObject.get("photoUrls"));
latentDangerBo.setReformJson(reformJsonObject.toJSONString());
// 消防巡查需求:评审通过后指定治理人
......
......@@ -17,13 +17,17 @@ import java.util.stream.Collectors;
import javax.transaction.Transactional;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.patrol.business.feign.EquipFeign;
import com.yeejoin.amos.patrol.business.feign.JcsFeignClient;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
......@@ -61,6 +65,7 @@ import com.yeejoin.amos.patrol.email.IEmailService;
import com.yeejoin.amos.patrol.feign.PushFeignServer;
import com.yeejoin.amos.patrol.feign.RemoteSecurityService;
import com.yeejoin.amos.patrol.jpush.AppMessagePushService;
import org.typroject.tyboot.core.foundation.utils.Bean;
/**
......@@ -108,6 +113,11 @@ public class MessageServiceImpl implements IMessageService {
@Autowired
private EquipFeign equipFeign;
@Autowired
private JcsFeignClient jcsFeignClient;
@Override
public void pushCheckMessage(String toke,String product,String appKey,Long checkId) {
try{
......@@ -347,31 +357,44 @@ public class MessageServiceImpl implements IMessageService {
List<String> userIds = notice.getUserId();
boolean isImmediately = notice.getIsImmediately();
List<Msg> msgList = new ArrayList<>();
List<AgencyUserModel> users = remoteSecurityService.listUserByUserIds(toke, product, appKey,Joiner.on(",").join(userIds));
for (AgencyUserModel user : users) {
String targetTel = user.getUserName();
Msg msg = new Msg();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss");
String start = sdf.format(notice.getFixedTime());
msg.setBody(notice.getBody()+"\r\n发送时间:"+start);
msg.setIsImmediately(isImmediately);
msg.setMsgType(MsgTypeEnum.NOTIFY.getCode());
// List<AgencyUserModel> users = remoteSecurityService.listUserByUserIds(toke, product, appKey,Joiner.on(",").join(userIds));
FeignClientResult<List<Map<String, Object>>> responseModel= jcsFeignClient.selectByIdList(userIds);
if (ObjectUtils.isEmpty(responseModel.getResult()) || responseModel.getStatus() != HttpStatus.OK.value()) {
throw new RuntimeException(responseModel.getDevMessage());
}
List<Map<String, Object>> personList = responseModel.getResult();
if(personList!=null&&personList.size()>0){
for (Map<String, Object> user : personList) {
//
Msg msg = new Msg();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss");
String start = sdf.format(notice.getFixedTime());
msg.setBody(notice.getBody()+"\r\n发送时间:"+start);
msg.setIsImmediately(isImmediately);
msg.setMsgType(MsgTypeEnum.NOTIFY.getCode());
msg.setOrgCode(notice.getOrgCode());
msg.setTargetTel(targetTel);
// msg.setTargetTel(targetTel);
msg.setTitle(MsgTypeEnum.NOTIFY.getName());
msg.setUserId(user.getUserId());
msg.setReciverName(user.getRealName());
if (isImmediately) { //立即发送
msg = pushMsgAndSave( toke, product, appKey,msg);
} else { //定时发送
msg.setStatus(0);
msg.setFixedTime(notice.getFixedTime());
iMsgDao.save(msg);
msgList.add(msg);
}
}
msg.setUserId(user.get("amosOrgId")!=null?user.get("amosOrgId").toString():"");
msg.setReciverName(user.get("bizOrgName").toString());
msg.setBizOrgCode(notice.getBizOrgCode());
msg.setBizOrgName(notice.getBizOrgName());
if (isImmediately) { //立即发送
msg = pushMsgAndSave( toke, product, appKey,msg);
} else { //定时发送
msg.setStatus(0);
msg.setFixedTime(notice.getFixedTime());
iMsgDao.save(msg);
msgList.add(msg);
}
}
}
return msgList;
}
......
......@@ -16,6 +16,38 @@ import com.yeejoin.amos.patrol.dao.entity.InputItem;
*
*/
public interface IInputItemService {
/**
* 新接口
*
* */
/**
* 分页列表条件查询检查项
* @param criterias
* @return
*/
public Page<InputItemVo> queryInputItemByPageNew(InputItemPageParam criterias);
/**
* 新接口
*
* */
/**
* 新增检查项
* @param inputItem 检查项
......
......@@ -93,7 +93,33 @@ public class InputItemVo {
* 风险描述
*/
private String riskDesc;
/**
* 新加字段
*
* */
//单位code
private String bizOrgCode;
//单位名称
private String bizOrgName;
public String getBizOrgCode() {
return bizOrgCode;
}
public void setBizOrgCode(String bizOrgCode) {
this.bizOrgCode = bizOrgCode;
}
public String getBizOrgName() {
return bizOrgName;
}
public void setBizOrgName(String bizOrgName) {
this.bizOrgName = bizOrgName;
}
public String getItemNo() {
return itemNo;
}
......
......@@ -2,6 +2,8 @@ package com.yeejoin.amos.patrol.business.vo;
import java.util.Date;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yeejoin.amos.patrol.common.enums.MsgTypeEnum;
public class MsgVo {
......@@ -29,6 +31,7 @@ public class MsgVo {
/**
* 发送时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date sendTime;
/**
......@@ -39,6 +42,7 @@ public class MsgVo {
/**
* 定点发送时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date fixedTime;
public long getId() {
......
package com.yeejoin.amos.patrol.config;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.patrol.business.feign.JcsFeignClient;
import com.yeejoin.amos.patrol.exception.PermissionException;
import org.apache.commons.lang3.StringUtils;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.annotation.Order;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.ResponseBody;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.Bean;
import java.util.Map;
/**
* @author DELL
*/
@Aspect
@Component
@ResponseBody
@Order(value = 1)
public class PersonIdentifyAspect {
@Autowired
RedisUtils redisUtils;
@Autowired
private JcsFeignClient jcsFeignClient;
@Pointcut("execution(public * com.yeejoin.amos.*.business.controller..*(..))")
public void userDate() {
}
@Before("userDate()")
public void personIdentity(JoinPoint joinPoint) throws PermissionException {
ReginParams reginParam = JSON.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
if (reginParam != null ) {
if(reginParam.getPersonIdentity()==null){
String userId = reginParam.getUserModel().getUserId();
if(userId!=null){
FeignClientResult responseModel = jcsFeignClient.selectById(userId);
if (ObjectUtils.isEmpty(responseModel.getResult()) || responseModel.getStatus() != HttpStatus.OK.value()) {
throw new RuntimeException(responseModel.getDevMessage());
}
ReginParams.PersonIdentity personIdentity = (ReginParams.PersonIdentity) Bean.mapToBean((Map<String, Object>) responseModel.getResult(), ReginParams.PersonIdentity.class);
reginParam.setPersonIdentity(personIdentity);
redisUtils.set(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken()), JSONObject.toJSONString(reginParam));
}
}
}
}
}
package com.yeejoin.amos.supervision.business.controller;
import com.alibaba.fastjson.JSON;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.MessageModel;
import com.yeejoin.amos.supervision.business.constants.XJConstant;
import com.yeejoin.amos.supervision.business.dao.mapper.PlanTaskDetailMapper;
import com.yeejoin.amos.supervision.business.dto.CheckDto;
import com.yeejoin.amos.supervision.business.dto.CheckInputItemDto;
import com.yeejoin.amos.supervision.business.param.*;
......@@ -19,6 +23,7 @@ import com.yeejoin.amos.supervision.core.common.response.AppPointCheckRespone;
import com.yeejoin.amos.supervision.core.common.response.GraphInitDataResponse;
import com.yeejoin.amos.supervision.core.framework.PersonIdentify;
import com.yeejoin.amos.supervision.core.util.StringUtil;
import com.yeejoin.amos.supervision.dao.entity.PlanTask;
import com.yeejoin.amos.supervision.mqtt.WebMqttComponent;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -82,6 +87,10 @@ public class CheckController extends AbstractBaseController {
@Value("${amosRefresh.patrol.topic}")
private String patrolTopic;
@Autowired
PlanTaskDetailMapper planTaskDetailMapper;
@Autowired
private WebMqttComponent webMqttComponent;
......@@ -557,6 +566,20 @@ public class CheckController extends AbstractBaseController {
String orgCode = getOrgCode(reginParams);
requestParam.setOrgCode(orgCode);
List<CheckInputItemDto> checkInputItemDtoList = checkService.saveCheckRecord(requestParam, reginParams);
// 查询检查计划任务信息
PlanTask planTasks = planTaskDetailMapper.selectById(requestParam.getPlanTaskId());
log.info("检查任务信息-->{}", JSON.toJSON(planTasks));
if (!ObjectUtils.isEmpty(planTasks)){
// 如果计划已超时或者已结束-----更新待办任务状态
if (XJConstant.TASK_STATUS_TIMEOUT == planTasks.getFinishStatus() || XJConstant.TASK_STATUS_FINISH == planTasks.getFinishStatus()){
MessageModel model = new MessageModel();
model.setRelationId(String.valueOf(planTasks.getPlanId()));
model.setMsgType("supervision");
model.setIsRead(true);
log.info("修改待办任务参数-->{}", JSON.toJSON(model));
Systemctl.messageClient.update(model);
}
}
return ResponseHelper.buildResponse(checkInputItemDtoList);
} catch (Exception e) {
log.error(e.getMessage(), e);
......
......@@ -3,6 +3,7 @@ package com.yeejoin.amos.supervision.business.dao.mapper;
import java.util.List;
import java.util.Map;
import com.yeejoin.amos.supervision.dao.entity.PlanTask;
import com.yeejoin.amos.supervision.dao.entity.PlanTaskDetail;
import org.apache.ibatis.annotations.Param;
......@@ -19,4 +20,11 @@ public interface PlanTaskDetailMapper extends BaseMapper {
* @param planTaskDetailId 主键id
*/
void updateDanger(@Param(value="planTaskDetailId") long planTaskDetailId);
/**
* 任务id查询任务信息
* @param id
* @return
*/
PlanTask selectById(@Param("id") Long id);
}
......@@ -22,6 +22,11 @@ public interface IPlanDao extends BaseDao<Plan, Long> {
@Modifying
@Transactional
@Query(value = "select * from p_plan WHERE status NOT IN (0,5,6,7,8)", nativeQuery = true)
List<Plan> queryOutTimePlan();
@Modifying
@Transactional
@Query(value = "select * from p_plan WHERE route_id = ?1 and status = ?2", nativeQuery = true)
List<Plan> queryPlanByRouteId(long routeId, String status);
......
......@@ -2,6 +2,7 @@ package com.yeejoin.amos.supervision.business.service.impl;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.service.IWorkflowExcuteService;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.biz.common.workflow.feign.WorkflowFeignService;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.supervision.business.dao.repository.IPlanAuditDao;
......@@ -26,10 +27,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.*;
@Service("planAuditService")
public class PlanAuditServiceImpl implements IPlanAuditService {
......@@ -77,6 +75,8 @@ public class PlanAuditServiceImpl implements IPlanAuditService {
workflowExcuteService.CompleteTask(instanceId, conditionValue, reginParams);
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
String userId = reginParams.getUserModel().getUserId();
plan.setNextGenDate(DateUtils.dateTimeToDate(new Date()));
planService.updateGenDate(plan);
// 更新计划状态,指定执行人
updatePlanStatus(condition,plan,instanceId, conditionValue);
// 更新流水表
......
......@@ -12,12 +12,16 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.biz.common.workflow.feign.WorkflowFeignService;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.client.MessageClient;
import com.yeejoin.amos.feign.systemctl.model.MessageModel;
import com.yeejoin.amos.supervision.business.constants.XJConstant;
import com.yeejoin.amos.supervision.business.dao.mapper.PlanMapper;
import com.yeejoin.amos.supervision.business.dao.mapper.PointMapper;
import com.yeejoin.amos.supervision.business.dao.repository.*;
import com.yeejoin.amos.supervision.business.param.PlanInfoPageParam;
import com.yeejoin.amos.supervision.business.service.intfc.IPlanService;
import com.yeejoin.amos.supervision.business.util.Toke;
import com.yeejoin.amos.supervision.common.enums.*;
import com.yeejoin.amos.boot.biz.common.enums.RuleTypeEnum;
import com.yeejoin.amos.supervision.core.async.AsyncTask;
......@@ -238,6 +242,11 @@ public class PlanServiceImpl implements IPlanService {
}
}
public void updateGenDate(Plan plan){
planMapper.updateById(plan);
}
/**
* 根据工作流获取下一审核人角色下的所有用户ID =》规则推送消息
* @return
......@@ -260,9 +269,13 @@ public class PlanServiceImpl implements IPlanService {
rulePlanService.addPlanRule(plan, userIds, RuleTypeEnum.计划提交, null); // 计划提交
} else {
if (PlanStatusEnum.EXAMINE_THREE.getValue() != status){
// 待办任务状态更新
updateTaskStatus(plan);
// rulePlanService.addPlanAuditRule(plan, userIds, RuleTypeEnum.计划审核, ExecuteStateNameEnum.getNameByCode(excuteState)); // 计划审核
rulePlanService.addPlanAuditRule(plan, userIds, RuleTypeEnum.计划审核任务, ExecuteStateNameEnum.getNameByCode(excuteState)); // 计划审核任务通知
} else {
// 待办任务状态更新
updateTaskStatus(plan);
rulePlanService.addPlanAuditRule(plan, userIds, RuleTypeEnum.计划审核完成, ExecuteStateNameEnum.getNameByCode(excuteState)); // 计划审核完成
}
}
......@@ -273,6 +286,19 @@ public class PlanServiceImpl implements IPlanService {
return userIds;
}
private void updateTaskStatus(Plan plan){
Toke toke= remoteSecurityService.getServerToken();
RequestContext.setToken(toke.getToke());
RequestContext.setProduct(toke.getProduct());
RequestContext.setAppKey(toke.getAppKey());
MessageModel model = new MessageModel();
model.setRelationId(String.valueOf(plan.getId()));
model.setMsgType("supervision");
model.setIsRead(true);
log.info("修改待办任务参数-->{}", JSON.toJSON(model));
Systemctl.messageClient.update(model);
}
private void insertAuditLog(ReginParams reginParams, Plan param, ReginParams.PersonIdentity personIdentity, PlanAudit audit) {
PlanAuditLog planAuditLog = new PlanAuditLog();
planAuditLog.setPlanAuditId(audit.getId());
......
......@@ -377,6 +377,31 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
String strDate = df.format(now);
String tomorrow = DateUtil.getIntervalDateStr(now, 1, "yyyy-MM-dd");// 下一天
//除草稿状态外其他状态过了计划结束时间都需要根据任务状态更新计划状态。
List<Plan> planLists = iplanDao.queryOutTimePlan();
if (CollectionUtils.isNotEmpty(planLists)){
for (Plan plan : planLists) {
// 当前时间在计划结束时间之前,则计划还未超时
Date date = new Date();
Time time = new Time(date.getTime());
String planEndTime = plan.getPlanEnd() + " " + plan.getDayEnd().toString();
try {
Date parse = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(planEndTime);
if (time.before(new Time(parse.getTime()))){
continue;
}
} catch (ParseException e) {
e.printStackTrace();
}
HashMap<String, Object> param= new HashMap<String, Object>();
param.put("id", plan.getId());
param.put("status", PlanStatusEnum.COMPLETED.getValue());
planMapper.updPlanStatusOrGenDate(param);
}
}
// 根据计划状态5,6和next_gen_date查询需要生成任务的计划
List<Plan> planList = iplanDao.queryScheduledPlan(strDate,
String.valueOf(PlanStatusEnum.EXAMINE_DEVELOPED.getValue()),
......@@ -414,6 +439,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
int num = 0;
//根据计划id查询关联的任务
List<PlanTask> planTaskByRouteId = planTaskMapper.getPlanTaskByRouteId(plan.getId());
if (!ValidationUtil.isEmpty(planTaskByRouteId)){
HashMap<String, Object> param = new HashMap<String, Object>();
param.put("pointId",plan.getId());
......@@ -427,6 +453,10 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
}else {
paramMap.put("status", PlanStatusEnum.COMPLETED.getValue());
}
}else {
paramMap.put("status", PlanStatusEnum.OUT_TIME.getValue());
planMapper.updPlanStatusOrGenDate(paramMap);
continue;
}
if (plan.getIsFixedDate().equals("2")){
paramMap.put("status", PlanStatusEnum.OUT_TIME.getValue());
......@@ -437,7 +467,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
planTaskMapper.updateTaskDetailStatusByPlanId(plan.getId());
continue;
}
planMapper.updPlanStatusOrGenDate(paramMap);
if (!ObjectUtils.isEmpty(paramMap.get("status")) && paramMap.get("status").equals(PlanStatusEnum.OUT_TIME.getValue())){
// 计划超时,修改计划下任务状态
......@@ -854,13 +884,17 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
}
}
log.info(String.format("计划对象:%s", JSON.toJSON(plan)));
// 规则推送消息
rulePlanService.addPlanRule(plan, null, RuleTypeEnum.消息型计划生成, extraUserIds);// 根据bug4150 将此处的计划生成的枚举值变成了消息,既TASK ->
// NOTIFY
String userIdString = plan.getUserId();
FeignClientResult amosIdListByUserIds = jcsFeignClient.getAmosIdListByUserIds(userIdString);
List<String> result = (List<String>) amosIdListByUserIds.getResult();
// 规则推送消息
extraUserIds.removeAll(result);//给执行人只发送待办 不发通知
rulePlanService.addPlanRule(plan, null, RuleTypeEnum.消息型计划生成, extraUserIds);// 根据bug4150 将此处的计划生成的枚举值变成了消息,既TASK ->
// NOTIFY
if (org.apache.commons.lang3.ObjectUtils.isNotEmpty(result)) {
// String[] userIdArr = userIdString.split(",");
// List<String> userIdList = Arrays.asList(userIdArr);
......
......@@ -39,7 +39,11 @@
<artifactId>servlet-api</artifactId>
<groupId>javax.servlet</groupId>
</exclusion>
</exclusions>
<exclusion>
<artifactId>log4j</artifactId>
<groupId>log4j</groupId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
......
......@@ -14,7 +14,13 @@
<groupId>com.amosframework.boot</groupId>
<artifactId>amos-boot-module-equip-biz</artifactId>
<version>${amos-biz-boot.version}</version>
</dependency>
<exclusions>
<exclusion>
<artifactId>log4j-to-slf4j</artifactId>
<groupId>org.apache.logging.log4j</groupId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
<plugins>
......
......@@ -85,6 +85,11 @@ dcs.token-key=dcs_token_key
dcs.client.secret=fire_system
dcs.x.hw.id=NR_REST_APP
dcs.x.hw.appKey=s+YkvQhwilx91TRJHhNDmw==
# 故障告警/消防告警/跑马灯权限标识 true 机场 / false 电力
equip.enabled =true
management.endpoints.enabled-by-default=false
# 权限标识-物联区域
auth-key-area=area_info
......
......@@ -304,6 +304,48 @@
left join wl_industry i on ec.industry_code = i.code
</select>
<select id="getEquipmentCategoryListNotFacilities" resultMap="Category">
SELECT ec.id,
ec.parent_id,
ec.CODE,
ec.NAME,
ec.is_consumptive,
ec.description,
ec.industry_code,
ec.remark,
ec.create_date,
i.`name` as industryName,
-- industry_code = 2代表消防设备
IF(LEFT(ec.CODE, 1) = #{head} and ec.industry_code = 2, 'car', 'equipment')
AS type
FROM wl_equipment_category ec
left join wl_industry i on ec.industry_code = i.code
WHERE
ec.code NOT LIKE CONCAT ('930','%')
</select>
<select id="getEquipmentCategoryListByFacilities" resultMap="Category">
SELECT ec.id,
ec.parent_id,
ec.CODE,
ec.NAME,
ec.is_consumptive,
ec.description,
ec.industry_code,
ec.remark,
ec.create_date,
i.`name` as industryName,
-- industry_code = 2代表消防设备
IF(LEFT(ec.CODE, 1) = #{head} and ec.industry_code = 2, 'car', 'equipment')
AS type
FROM wl_equipment_category ec
left join wl_industry i on ec.industry_code = i.code
WHERE
ec.code LIKE CONCAT ('930','%')
</select>
<select id="getEquipmentCategoryCarList" resultMap="Category">
SELECT
id,
......
......@@ -1240,7 +1240,7 @@
'其他' AS fireFightSysName,
'equip' AS fireFacilityType,
ws.source_id AS buildingId,
ws.`name` AS buildingName,
ws.full_name AS buildingName,
ed.area AS location
FROM
wl_equipment_specific es
......@@ -1299,6 +1299,20 @@
</if>
</where>
</select>
<select id="getEquipLocationInfo" resultType="map">
SELECT
wed.longitude as longitude,
wed.latitude as latitude
FROM
wl_stock_detail sd
LEFT JOIN wl_equipment_detail wed ON sd.equipment_detail_id = wed.id
<where>
<if test="equipmentSpecificId != null">
sd.equipment_specific_id = #{equipmentSpecificId}
</if>
</where>
</select>
<select id="getEquipSpeInfo" resultType="Map">
SELECT
......
......@@ -59,7 +59,7 @@
create_date
FROM
mt_maintenance_resource_data
GROUP BY maintenance_company_id,classify_id
GROUP BY maintenance_company_id,classify_id,owner_unit_id,fire_fight_sys_id
</select>
<select id="selectMaintenanceResourceDataList"
......@@ -252,7 +252,17 @@
m.maintenance_company_name,
m.owner_unit_id,
m.owner_unit_name,
m.fire_fight_sys_id,
<choose>
<when test="fireFightSysId != null and fireFightSysId != '' ">
m.fire_fight_sys_id,
</when>
<otherwise>
'' as fire_fight_sys_id,
</otherwise>
</choose>
m.fire_fight_sys_name,
m.classify_id,
m.classify_name,
......@@ -279,7 +289,8 @@
</if>
</where>
GROUP BY
m.classify_code
-- m.classify_code
m.classify_id
</select>
<select id="getFireFacilityPage" resultType="com.yeejoin.equipmanage.common.dto.MaintenanceResourceDataDto">
SELECT
......@@ -316,7 +327,7 @@
<if test="ownerUnitId != null">
AND m.owner_unit_id = #{ownerUnitId}
</if>
<if test="fireFightSysId != null">
<if test="fireFightSysId != null and fireFightSysId != '' ">
AND m.fire_fight_sys_id = #{fireFightSysId}
</if>
<if test="classifyId != null">
......
......@@ -132,6 +132,7 @@
fire_fight_sys_id AS id,
fire_fight_sys_name name ,
owner_unit_id as parentId,
owner_unit_id as ownerUnitId,
IFNULL(classify_type,3) as type
FROM
`mt_maintenance_resource_data`
......
......@@ -50,6 +50,13 @@
<if test="video!=null and video.bizOrgCode!=null and video.bizOrgCode!=''">
and wlv.biz_org_code LIKE CONCAT(#{video.bizOrgCode}, '%')
</if>
<if test="video!=null and video.ip!=null and video.ip!=''">
and wlv.ip like concat('%',#{video.ip},'%')
</if>
<if test="video!=null and video.type!=null and video.type!=''">
and wlv.type=#{video.type}
</if>
group by wlv.id
order by wlv.create_date desc
</select>
......@@ -108,10 +115,19 @@
<if test="dto.code!=null and dto.code!=''">
and v.code like concat('%',#{dto.code},'%')
</if>
<if test=" dto.ip!=null and dto.ip!=''">
and v.ip like concat('%',#{dto.ip},'%')
</if>
<if test="dto.type!=null and dto.type!=''">
and v.type = #{dto.type}
</if>
GROUP BY id
order by v.create_date
</when>
<when test="dto.buildingId == null || dto.buildingId ==''">
<when test='dto.buildingId == null || dto.buildingId ==""'>
<where>
<if test="dto.bizOrgCode!=null and dto.bizOrgCode!=''">
v.biz_org_code LIKE CONCAT(#{dto.bizOrgCode}, '%')
......@@ -122,6 +138,16 @@
<if test="dto.equipmentName!=null and dto.equipmentName!=''">
and v.name like concat('%',#{dto.equipmentName},'%')
</if>
<if test=" dto.ip!=null and dto.ip!=''">
and v.ip like concat('%',#{dto.ip},'%')
</if>
<if test="dto.type!=null and dto.type!=''">
and v.type =#{dto.type}
</if>
</where>
GROUP BY id
order by v.create_date
......@@ -160,7 +186,7 @@
select
vid.id,
vid.token,
vid.remark,
vid.name as name,
vid.url,
vid.code,
vid.preset_position as presetPosition,
......
......@@ -199,9 +199,29 @@
<if test="equipmentName!=null">
AND d.equipmentName LIKE '%${equipmentName}%'
</if>
<if test="startTime!=null">
AND d.create_date BETWEEN '${startTime}' AND '${endTime}'
</if>
<!-- <if test="startTime!=null and endTime!=null ">-->
<!-- AND d.create_date BETWEEN '${startTime}' AND '${endTime}'-->
<!-- </if>-->
<choose>
<when test="startTime!=null and endTime!=null ">
AND d.create_date BETWEEN '${startTime}' AND '${endTime}'
</when>
<otherwise>
<if test="startTime!=null">
AND d.create_date &gt;= '${startTime}'
</if>
<if test="endTime!=null ">
AND d.create_date &lt;= '${endTime}'
</if>
</otherwise>
</choose>
<if test="buildId!=null">
AND d.buildId in (#{buildId})
<!-- AND d.buildId in
......
......@@ -26,10 +26,7 @@
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-starter-security</artifactId>-->
<!-- </dependency>-->
</dependencies>
<build>
......
......@@ -29,11 +29,7 @@ spring.datasource.hikari.max-lifetime=120000
spring.datasource.hikari.connection-timeout=30000
spring.datasource.hikari.connection-test-query=SELECT 1
endpoints.enabled = false
management.security.enabled=true
security.user.name=admin
security.user.password=admin
##liquibase
......@@ -79,6 +75,8 @@ mqtt.topic.alert.iot=iot-system-alarm
mqtt.topic.alert.iot.web=iot-system-alarm-web
#警情预案匹配的消息topic名称
mqtt.topic.command.knowledgebase.alert.match=knowledgeAlertMatch
#航空报警器警情通知
mqtt.topic.command.alert.noticeAviation=aviationAlarm
security.systemctl.name=AMOS-API-SYSTEMCTL
......@@ -122,6 +120,7 @@ mybatis.interceptor.enabled = false
## 消防救援保障部ID
fire-rescue=1432549862557130753
management.endpoints.enabled-by-default=false
#阿里云实时语音识别参数
speech-config.access-key-id=LTAI5t62oH95jgbjRiNXPsho
speech-config.access-key-secret=shy9SpogYgcdDoyTB3bvP21VSRmz8n
......
......@@ -3223,6 +3223,7 @@
</sql>
</changeSet>
<changeSet author="xixinzhao" id="20220714-xxz-1">
<preConditions onFail="MARK_RAN">
<not>
......@@ -3250,5 +3251,42 @@
INSERT INTO `cb_data_dictionary`(`sequence_nbr`, `code`, `name`, `type`, `type_desc`, `parent`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `sort_num`) VALUES (1557, 'industryPool', '工业水池', 'XFSYLX', NULL, NULL, NULL, NULL, NULL, 0, 1);
</sql>
</changeSet>
<changeSet author="chenzhao" id="2022-07-1-1">
<preConditions onFail="MARK_RAN">
<tableExists tableName="cb_data_dictionary" />
</preConditions>
<comment>修改数据字典parent</comment>
<sql>
ALTER TABLE cb_data_dictionary MODIFY COLUMN parent VARCHAR(100) </sql>
</changeSet>
<changeSet author="chenzhao" id="2022-07-4-1">
<preConditions onFail="MARK_RAN">
<tableExists tableName="cb_data_dictionary" />
</preConditions>
<comment>修改数据字典</comment>
<sql>
UPDATE `cb_data_dictionary` SET `code` = '1210', `name` = '消防指挥员', `type` = 'GWMC', `type_desc` = '消防人员岗位', `parent` = NULL, `rec_user_name` = NULL, `rec_user_id` = NULL, `rec_date` = NULL, `is_delete` = b'0', `sort_num` = 1 WHERE `sequence_nbr` = 1210;
UPDATE `cb_data_dictionary` SET `code` = '141', `name` = '消防战斗员', `type` = 'GWMC', `type_desc` = NULL, `parent` = '140', `rec_user_name` = NULL, `rec_user_id` = NULL, `rec_date` = NULL, `is_delete` = b'0', `sort_num` = 1 WHERE `sequence_nbr` = 141;
</sql>
</changeSet>
<changeSet author="chenzhao" id="2022-07-4-2">
<preConditions onFail="MARK_RAN">
<tableExists tableName="cb_data_dictionary" />
</preConditions>
<comment>增加数据字典数据</comment>
<sql>
REPLACE INTO `cb_data_dictionary`(`sequence_nbr`, `code`, `name`, `type`, `type_desc`, `parent`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `sort_num`) VALUES (1353, 1, '急救类', 'GWMC', NULL, NULL, NULL, NULL, NULL, b'0', 1);
REPLACE INTO `cb_data_dictionary`(`sequence_nbr`, `code`, `name`, `type`, `type_desc`, `parent`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `sort_num`) VALUES (1354, 2, '医生', 'GWMC', NULL, '1353', NULL, NULL, NULL, b'0', 1);
REPLACE INTO `cb_data_dictionary`(`sequence_nbr`, `code`, `name`, `type`, `type_desc`, `parent`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `sort_num`) VALUES (1355, 3, '公卫医生', 'GWMC', NULL, '1353', NULL, NULL, NULL, b'0', 1);
REPLACE INTO `cb_data_dictionary`(`sequence_nbr`, `code`, `name`, `type`, `type_desc`, `parent`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `sort_num`) VALUES (1356, 4, '护士长', 'GWMC', NULL, '1353', NULL, NULL, NULL, b'0', 1);
REPLACE INTO `cb_data_dictionary`(`sequence_nbr`, `code`, `name`, `type`, `type_desc`, `parent`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `sort_num`) VALUES (1357, 5, '护士', 'GWMC', NULL, '1353', NULL, NULL, NULL, b'0', 1);
REPLACE INTO `cb_data_dictionary`(`sequence_nbr`, `code`, `name`, `type`, `type_desc`, `parent`, `rec_user_name`, `rec_user_id`, `rec_date`, `is_delete`, `sort_num`) VALUES (1358, 6, '急救驾驶员', 'GWMC', NULL, '1353', NULL, NULL, NULL, b'0', 1);
</sql>
</changeSet>
</databaseChangeLog>
......@@ -14,11 +14,13 @@
<groupId>com.amosframework.boot</groupId>
<artifactId>amos-boot-module-knowledgebase-biz</artifactId>
<version>${amos-biz-boot.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<exclusions>
<exclusion>
<artifactId>log4j</artifactId>
<groupId>log4j</groupId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<build>
......
......@@ -22,8 +22,4 @@ mybatis-plus.mapper-locations=classpath:mapper/*
## redis失效时间
redis.cache.failure.time=10800
endpoints.enabled = false
management.security.enabled=true
security.user.name=admin
security.user.password=admin
management.endpoints.enabled-by-default=false
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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