Commit 544b386e authored by KeYong's avatar KeYong

消防监督更新

parent 2421c6f5
......@@ -12,5 +12,15 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-elasticsearch</artifactId>
</dependency>
<dependency>
<groupId>com.yeejoin</groupId>
<artifactId>amos-component-rule</artifactId>
<exclusions>
<exclusion>
<groupId>org.typroject</groupId>
<artifactId>tyboot-core-auth</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</project>
package com.yeejoin.amos.boot.module.common.api.feign;
import com.yeejoin.amos.boot.module.common.api.dto.OrgUsrFormDto;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
// 消防监督调用
@FeignClient(name = "${supervision.feign.name}", path = "supervision", configuration = {MultipartSupportConfig.class})
public interface SupervisionFeign {
@RequestMapping(value = "/api/point/teamInput", method = RequestMethod.POST, consumes = "application/json")
ResponseModel asyncOwner(@RequestBody OrgUsrFormDto orgUsrFormDto);
@RequestMapping(value = "/api/point/delete", method = RequestMethod.POST, consumes = "application/json")
ResponseModel deleteOwner(@RequestBody Long id);
}
......@@ -5,13 +5,15 @@ import com.yeejoin.amos.boot.biz.common.constants.CommonConstant;
import com.yeejoin.amos.boot.module.common.api.dto.*;
import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr;
import com.yeejoin.amos.boot.module.common.api.excel.ExcelUtil;
import com.yeejoin.amos.boot.module.common.api.feign.SupervisionFeign;
import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
......@@ -36,8 +38,9 @@ public class OrgPersonController {
@Autowired
OrgUsrServiceImpl iOrgUsrService;
@Autowired
SupervisionFeign supervisionFeign;
EmqKeeper emqKeeper;
@Value("${jcs.company.topic.delete}")
private String airportDeleteTopic;
/**
* 新增人员信息
......@@ -66,7 +69,11 @@ public class OrgPersonController {
// 删除时,只作逻辑删除
iOrgUsrService.update(new UpdateWrapper<OrgUsr>().eq("sequence_nbr", id).set("is_delete",
CommonConstant.IS_DELETE_01));
supervisionFeign.deleteOwner(id);
try {
emqKeeper.getMqttClient().publish(airportDeleteTopic, String.valueOf(id).getBytes(), 2, true);
} catch (Exception e) {
e.getMessage();
}
return ResponseHelper.buildResponse(null);
}
......
......@@ -14,7 +14,6 @@ import com.yeejoin.amos.boot.module.common.api.entity.OrgUsr;
import com.yeejoin.amos.boot.module.common.api.enums.OrgPersonEnum;
import com.yeejoin.amos.boot.module.common.api.enums.UserRolesEnum;
import com.yeejoin.amos.boot.module.common.api.enums.UserUnitTypeEnum;
import com.yeejoin.amos.boot.module.common.api.feign.SupervisionFeign;
import com.yeejoin.amos.boot.module.common.api.mapper.OrgUsrMapper;
import com.yeejoin.amos.boot.module.common.api.service.IMaintenanceCompanyService;
import com.yeejoin.amos.boot.module.common.api.service.IOrgUsrService;
......@@ -24,11 +23,13 @@ import com.yeejoin.amos.feign.privilege.model.RoleModel;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.component.emq.EmqKeeper;
import javax.annotation.Resource;
import java.lang.reflect.Method;
......@@ -52,7 +53,9 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
@Resource
OrgUsrMapper orgUsrMapper;
@Autowired
SupervisionFeign supervisionFeign;
EmqKeeper emqKeeper;
@Value("${jcs.company.topic.add}")
private String airportAddTopic;
@Autowired
ESOrgUsrService eSOrgUsrService;
@Autowired
......@@ -423,7 +426,11 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
alertFormValueServiceImpl.saveBatch(alertFromValuelist);
OrgUsrFormDto formDto = this.selectCompanyById(orgUsr.getSequenceNbr());
if (OrgPersonEnum.公司.getKey().equals(orgUsr.getBizOrgType())) {
supervisionFeign.asyncOwner(formDto);
try {
emqKeeper.getMqttClient().publish(airportAddTopic, formDto.toString().getBytes(), 2, true);
} catch (Exception e) {
e.getMessage();
}
}
}
......
......@@ -803,22 +803,20 @@ public class PointController extends AbstractBaseController {
return CommonResponseUtil.success(iPointService.getRegionTress());
}
/**
* 同步点
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "机场单位同步", notes = "机场单位同步")
@RequestMapping(value = "/teamInput", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
public CommonResponse syncSavePoint(
@ApiParam(value = "同步请求参数") @RequestBody OrgUsrFormDto orgUsrFormDto) {
ReginParams reginParams = getSelectedOrgInfo();
AgencyUserModel model = getUserInfo();
String orgCode = getOrgCode(reginParams);
iPointService.syncSavePoint(orgUsrFormDto, orgCode, model.getUserId());
return CommonResponseUtil.success();
}
// /**
// * 同步点
// *
// * @return
// */
// @TycloudOperation(ApiLevel = UserType.AGENCY)
// @ApiOperation(value = "机场单位同步", notes = "机场单位同步")
// @RequestMapping(value = "/teamInput", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
// public CommonResponse syncSavePoint(
// @ApiParam(value = "同步请求参数") @RequestBody OrgUsrFormDto orgUsrFormDto) {
// ReginParams reginParams = getSelectedOrgInfo();
// iPointService.syncSavePoint(orgUsrFormDto);
// return CommonResponseUtil.success();
// }
/**
* 删除巡检点
......
......@@ -27,7 +27,7 @@ public interface InputItemMapper {
List<InputItemVo> getInputItemListByitemNos(@Param("itemNos") String[] itemNos);
List<InputItem> getInputItemByEquipmentName(@Param("equipmentName") String equipmentName, @Param("orgCode") String orgCode);
List<InputItem> getInputItemByEquipmentName(@Param("equipmentName") String equipmentName);
List<PointInputItemVo> queryCustomInputItemByPointId(@Param("pointId") Long pointId, @Param("equipmentId") String equipmentName);
......
......@@ -25,6 +25,60 @@ public class InputItemParam {
private String unit;
private String maintenanceContent;
private String testRequirement;
private String checkType;
private String itemParent;
private String itemClassify;
private String itemTypeClassify;
private String itemLevel;
private String itemStart;
public String getItemStart() {
return itemStart;
}
public void setItemStart(String itemStart) {
this.itemStart = itemStart;
}
public String getCheckType() {
return checkType;
}
public void setCheckType(String checkType) {
this.checkType = checkType;
}
public String getItemParent() {
return itemParent;
}
public void setItemParent(String itemParent) {
this.itemParent = itemParent;
}
public String getItemClassify() {
return itemClassify;
}
public void setItemClassify(String itemClassify) {
this.itemClassify = itemClassify;
}
public String getItemTypeClassify() {
return itemTypeClassify;
}
public void setItemTypeClassify(String itemTypeClassify) {
this.itemTypeClassify = itemTypeClassify;
}
public String getItemLevel() {
return itemLevel;
}
public void setItemLevel(String itemLevel) {
this.itemLevel = itemLevel;
}
public void setMaintenanceContent(String maintenanceContent) {
this.maintenanceContent = maintenanceContent;
......
......@@ -3,9 +3,11 @@ package com.yeejoin.amos.supervision.business.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Sequence;
import com.google.common.base.Joiner;
import com.google.common.collect.Lists;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.supervision.business.constants.XJConstant;
import com.yeejoin.amos.supervision.business.dao.mapper.InputItemMapper;
......@@ -59,9 +61,12 @@ import com.yeejoin.amos.supervision.dao.entity.PointClassify;
import com.yeejoin.amos.supervision.dao.entity.PointInputItem;
import com.yeejoin.amos.supervision.dao.entity.PointPhoto;
import org.apache.commons.lang.StringUtils;
import org.apache.poi.ss.formula.functions.T;
import org.assertj.core.util.Sets;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.*;
import org.springframework.data.domain.Sort.Direction;
import org.springframework.data.domain.Sort.Order;
......@@ -1121,21 +1126,19 @@ public class PointServiceImpl implements IPointService {
}
@Override
public void syncSavePoint(OrgUsrFormDto orgUsrFormDto, String orgCode, String userId) {
List<Point> points = new ArrayList<>();
public void syncSavePoint(OrgUsrFormDto orgUsrFormDto) {
List<PointInputItem> inputItems = new ArrayList<>();
List<Long> ids = new ArrayList<Long>();
Point point = new Point();
String pointNo = StringUtil.isNotEmpty(orgUsrFormDto.getSequenceNbr()) ? String.valueOf(orgUsrFormDto.getSequenceNbr()) : String.valueOf(sequence.nextId());
String id = StringUtil.isNotEmpty(orgUsrFormDto.getSequenceNbr()) ? String.valueOf(orgUsrFormDto.getSequenceNbr()) : String.valueOf(sequence.nextId());
point.setName(orgUsrFormDto.getBizOrgName());
point.setPointNo(pointNo);
point.setOrgCode(orgUsrFormDto.getBizOrgCode());
point.setBuildingId(orgUsrFormDto.getBuildId());
point.setBuildingName(orgUsrFormDto.getBuildName());
point.setOriginalId(orgUsrFormDto.getParentId());
point.setOriginalId(id);
String data = JSON.toJSONString(orgUsrFormDto.getMap());
point.setExtendJson(data);
point.setOwnerId(pointNo);
point.setOwnerId(id);
point.setOwnerName(orgUsrFormDto.getBizOrgName());
if (0 < orgUsrFormDto.getDynamicFormAlert().size()) {
for (FormValue formValue : orgUsrFormDto.getDynamicFormAlert()) {
......@@ -1151,14 +1154,13 @@ public class PointServiceImpl implements IPointService {
}
}
point.setOrgCode(orgUsrFormDto.getAmosOrgCode());
points.add(point);
Long id = iPointDao.findPointByEquipmentIdAndFireFacilityId(pointNo, point.getOriginalId());
if (null != id) {
ids.add(id);
iPointDao.delPointBIds(id);
Long pointId = iPointDao.findPointByEquipmentIdAndFireFacilityId(id, point.getOriginalId());
if (null != pointId) {
ids.add(pointId);
iPointDao.delPointBIds(pointId);
}
iPointDao.save(point);
List<InputItem> inputItemVos = inputItemMapper.getInputItemByEquipmentName(point.getName(), orgCode);
List<InputItem> inputItemVos = inputItemMapper.getInputItemByEquipmentName(point.getName());
if (0 < inputItemVos.size()) {
inputItemVos.forEach(y -> {
PointInputItem inputItem = new PointInputItem();
......
......@@ -310,7 +310,7 @@ public interface IPointService {
LinkedHashMap<String,Object> getRegionTress ();
void syncSavePoint(OrgUsrFormDto orgUsrFormDto, String orgCode, String userId);
void syncSavePoint(OrgUsrFormDto orgUsrFormDto);
/**
* 查询巡检点及点及点的项
* @param queryRequests 请求参数
......@@ -323,7 +323,7 @@ public interface IPointService {
/**
* 删除巡检点
*
* @param ids
* @param
*/
void delPointByPointNo(Long id);
......
......@@ -121,6 +121,61 @@ public class InputItemVo {
*/
private String inputClassify;
private String checkType;
private String itemParent;
private String itemClassify;
private String itemTypeClassify;
private String itemLevel;
private String itemStart;
public String getCheckType() {
return checkType;
}
public void setCheckType(String checkType) {
this.checkType = checkType;
}
public String getItemParent() {
return itemParent;
}
public void setItemParent(String itemParent) {
this.itemParent = itemParent;
}
public String getItemClassify() {
return itemClassify;
}
public void setItemClassify(String itemClassify) {
this.itemClassify = itemClassify;
}
public String getItemTypeClassify() {
return itemTypeClassify;
}
public void setItemTypeClassify(String itemTypeClassify) {
this.itemTypeClassify = itemTypeClassify;
}
public String getItemLevel() {
return itemLevel;
}
public void setItemLevel(String itemLevel) {
this.itemLevel = itemLevel;
}
public String getItemStart() {
return itemStart;
}
public void setItemStart(String itemStart) {
this.itemStart = itemStart;
}
public String getInputClassify() {
return inputClassify;
}
......
package com.yeejoin.amos.supervision.mqtt;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.supervision.business.service.intfc.IPointService;
import lombok.extern.slf4j.Slf4j;
import org.eclipse.paho.client.mqttv3.MqttMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.typroject.tyboot.component.emq.EmqxListener;
/**
* @author keyong
* @title: AmosMqttListener
* <pre>
* @description: TODO
* </pre>
* @date 2021/8/20 15:31
*/
@Component
@Slf4j
public class AmosMqttListener extends EmqxListener {
@Autowired
private IPointService iPointService;
@Override
public void processMessage(String topic, MqttMessage message) {
JSONObject jsonObject = JSONObject.parseObject(message.toString());
if ("jcs/company/topic/add".equals(topic)) {
} else {
}
JSONObject result = jsonObject.getJSONObject("result");
String methodName = jsonObject.getString("methodName");
String path = result.getString("path");
try {
// iPointService.syncSavePoint();
} catch (Exception e) {
log.info("同步机场单位消息失败:{}", e.getMessage());
}
log.info("机场单位消息同步完成");
}
}
......@@ -66,6 +66,9 @@ security.systemctl.name=AMOS-API-SYSTEMCTL
supervision.feign.name = AMOS-SUPERVISION-API
jcs.company.topic.add=jcs/company/topic/add
jcs.company.topic.delete=jcs/company/topic/delete
iot.fegin.name=AMOS-API-IOT
equip.fegin.name=AMOS-EQUIPMANAGE
......
package com.yeejoin.amos;
import com.yeejoin.amos.supervision.mqtt.AmosMqttListener;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.mybatis.spring.annotation.MapperScan;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
......@@ -19,6 +23,7 @@ import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.client.RestTemplate;
import org.typroject.tyboot.core.restful.exception.GlobalExceptionHandler;
import org.typroject.tyboot.component.emq.EmqKeeper;
import java.io.IOException;
import java.net.InetAddress;
......@@ -49,6 +54,15 @@ public class SupervisionApplication {
private static final Logger logger = LoggerFactory.getLogger(SupervisionApplication.class);
@Autowired
private EmqKeeper emqKeeper;
@Autowired
private AmosMqttListener amosMqttListener;
@Value("${jcs.company.topic}")
private String airportTopic;
/**
* 启动amosop-server
*
......@@ -76,4 +90,13 @@ public class SupervisionApplication {
return new RestTemplate();
}
/**
* 初始化MQTT
* @throws MqttException
*/
@Bean
void initMqtt() throws MqttException
{ emqKeeper.getMqttClient().subscribe(airportTopic, 1, amosMqttListener); }
}
\ No newline at end of file
......@@ -45,6 +45,7 @@ Business.fegin.name=AMOS-AUTOSYS
Push.fegin.name=APPMESSAGEPUSHSERVICE
jcs.company.topic=jcs/company/topic/#
amos.flowWork.topic =/STATE_GRID/hazardManagement
amosRefresh.danger.topic =patrolDangerInsertOrUpdate
......
......@@ -61,6 +61,12 @@
<result property="checkMethod" column="check_method" />
<result property="createDate" column="create_date" />
<result property="inputClassify" column="input_classify" />
<result property="checkType" column="check_type" />
<result property="itemParent" column="item_parent" />
<result property="itemClassify" column="item_classify" />
<result property="itemTypeClassify" column="item_type_classify" />
<result property="itemLevel" column="item_level" />
<result property="itemStart" column="item_start" />
</resultMap>
<!--统计 -->
<select id="countInputItemInfoData" resultType="long">
......@@ -95,7 +101,12 @@
a.check_method,
a.create_date,
a.input_classify,
a.check_type
a.check_type,
a.item_parent,
a.item_classify,
a.item_type_classify,
a.item_level,
a.item_start
from
p_input_item a left join p_catalog_tree b on a.catalog_id = b.id
where a.is_delete = '0'
......@@ -273,6 +284,7 @@
<if test="id !=null and id !=''">
AND pii.id != #{id}
</if>
AND pii.is_delete != 1
ORDER BY create_date DESC;
</select>
</mapper>
\ No newline at end of file
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