Commit 4e784266 authored by KeYong's avatar KeYong

修改bug

parent d0cdb74e
...@@ -83,13 +83,24 @@ public class ControllerAop { ...@@ -83,13 +83,24 @@ public class ControllerAop {
// 不需要添加请求头的接口 // 不需要添加请求头的接口
String[] url = new String[]{"/api/user/save/curCompany", "/jcs/command/lookHtmlText", String[] url = new String[]{"/api/user/save/curCompany", "/jcs/command/lookHtmlText",
"/jcs/common/duty-person/findByDutyAreaId", "/tzs/wechatBack", "/tzs/elevator/getElevatorInfo", "/jcs/common/duty-person/findByDutyAreaId", "/tzs/wechatBack", "/tzs/elevator/getElevatorInfo",
"/openapi/bizToken/applyToken","/fire-patrol-report/download","/fire-patrol-report/allPage","/jcs/excel/export/QDSJ"}; "/openapi/bizToken/applyToken","/fire-patrol-report/download","/fire-patrol-report/allPage"};
// 获取请求路径 // 获取请求路径
for (String uri : url) { for (String uri : url) {
if (request.getRequestURI().indexOf(uri) != -1) { if (request.getRequestURI().indexOf(uri) != -1) {
return; return;
} }
} }
// 因前端组件下载时不通过url请求,导致RequestContext取不到值,所以针对这个接口特殊处理
if (request.getRequestURI().indexOf("/jcs/excel/export/QDSJ") != -1) {
String appKey = request.getHeader("appKey");
String product = request.getHeader("product");
String token = request.getHeader("token");
RequestContext.setAppKey(appKey);
RequestContext.setProduct(product);
RequestContext.setToken(token);
}
//TODO tyboot 框架拦截器已缓存数据 //TODO tyboot 框架拦截器已缓存数据
String token = RequestContext.getToken(); String token = RequestContext.getToken();
......
...@@ -223,4 +223,7 @@ public class EquipmentSpecificAlarmLog extends BaseEntity { ...@@ -223,4 +223,7 @@ public class EquipmentSpecificAlarmLog extends BaseEntity {
@ApiModelProperty(value = "是否是缺陷提交确认", notes = "是否是缺陷提交确认") @ApiModelProperty(value = "是否是缺陷提交确认", notes = "是否是缺陷提交确认")
@TableField(exist = false) @TableField(exist = false)
private boolean addDefect; private boolean addDefect;
@TableField(value = "defect_batch_id")
private String defectBatchId;
} }
...@@ -5,7 +5,9 @@ import com.alibaba.fastjson.JSONObject; ...@@ -5,7 +5,9 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.equipmanage.common.entity.EquipmentSpecificAlarmLog; import com.yeejoin.equipmanage.common.entity.EquipmentSpecificAlarmLog;
import com.yeejoin.equipmanage.common.entity.MonitorEvent; import com.yeejoin.equipmanage.common.entity.MonitorEvent;
import com.yeejoin.equipmanage.common.entity.publics.CommonResponse;
import com.yeejoin.equipmanage.common.entity.vo.IdxBizDefectVo; import com.yeejoin.equipmanage.common.entity.vo.IdxBizDefectVo;
import com.yeejoin.equipmanage.common.utils.CommonResponseUtil;
import com.yeejoin.equipmanage.fegin.IdxFeign; import com.yeejoin.equipmanage.fegin.IdxFeign;
import com.yeejoin.equipmanage.mapper.EquipmentSpecificAlarmLogMapper; import com.yeejoin.equipmanage.mapper.EquipmentSpecificAlarmLogMapper;
import com.yeejoin.equipmanage.service.IConfirmAlarmService; import com.yeejoin.equipmanage.service.IConfirmAlarmService;
...@@ -52,10 +54,10 @@ public class ConfirmAlarmController extends AbstractBaseController { ...@@ -52,10 +54,10 @@ public class ConfirmAlarmController extends AbstractBaseController {
@PostMapping(value = "/confirmAlam") @PostMapping(value = "/confirmAlam")
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "保存") @ApiOperation(value = "保存")
public void confirmAlam(@RequestBody EquipmentSpecificAlarmLog ent) { public ResponseModel confirmAlam(@RequestBody EquipmentSpecificAlarmLog ent) {
String appKey = getAppKey(); String appKey = getAppKey();
String product = getProduct(); String product = getProduct();
iConfirmAlarmService.confirmAlam(ent, appKey, product, getToken(), getUserId()); return CommonResponseUtil.success(iConfirmAlarmService.confirmAlam(ent, appKey, product, getToken(), getUserId()));
} }
@PostMapping(value = "/addConfirmAlam") @PostMapping(value = "/addConfirmAlam")
...@@ -64,7 +66,6 @@ public class ConfirmAlarmController extends AbstractBaseController { ...@@ -64,7 +66,6 @@ public class ConfirmAlarmController extends AbstractBaseController {
public void addConfirmAlam(@RequestBody EquipmentSpecificAlarmLog ent) { public void addConfirmAlam(@RequestBody EquipmentSpecificAlarmLog ent) {
String appKey = getAppKey(); String appKey = getAppKey();
String product = getProduct(); String product = getProduct();
String token = getToken();
iConfirmAlarmService.confirmAlam(ent, appKey, product, getToken(), getUserId()); iConfirmAlarmService.confirmAlam(ent, appKey, product, getToken(), getUserId());
} }
...@@ -110,7 +111,7 @@ public class ConfirmAlarmController extends AbstractBaseController { ...@@ -110,7 +111,7 @@ public class ConfirmAlarmController extends AbstractBaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "缺陷处理状态") @ApiOperation(value = "缺陷处理状态")
public IdxBizDefectVo getDefectStatus(@PathVariable String id) { public IdxBizDefectVo getDefectStatus(@PathVariable String id) {
ResponseModel<JSONObject> responseModel = idxFeign.queryDefectByAlarmLogId(id); ResponseModel<JSONObject> responseModel = idxFeign.queryDefectByBatchId(id);
JSONObject result = responseModel.getResult(); JSONObject result = responseModel.getResult();
IdxBizDefectVo vo = JSON.parseObject(JSON.toJSONString(result), IdxBizDefectVo.class); IdxBizDefectVo vo = JSON.parseObject(JSON.toJSONString(result), IdxBizDefectVo.class);
return vo; return vo;
......
...@@ -25,6 +25,6 @@ public interface IdxFeign { ...@@ -25,6 +25,6 @@ public interface IdxFeign {
* @Date 2022/9/27 17:46 * @Date 2022/9/27 17:46
*/ */
@RequestMapping(value = "/defect/alarm/{alarmLogId}", method = RequestMethod.GET) @RequestMapping(value = "/defect/alarm/{alarmLogId}", method = RequestMethod.GET)
ResponseModel<JSONObject> queryDefectByAlarmLogId(@PathVariable String alarmLogId); ResponseModel<JSONObject> queryDefectByBatchId(@PathVariable String alarmLogId);
} }
...@@ -18,7 +18,7 @@ public interface IConfirmAlarmService extends IService<EquipmentSpecificAlarm> { ...@@ -18,7 +18,7 @@ public interface IConfirmAlarmService extends IService<EquipmentSpecificAlarm> {
Map<String ,Object> getDetailsById( Long alamId, Long equipId , String type, String area); Map<String ,Object> getDetailsById( Long alamId, Long equipId , String type, String area);
void confirmAlam(EquipmentSpecificAlarmLog ent, String appKey, String product, String token, String userId); String confirmAlam(EquipmentSpecificAlarmLog ent, String appKey, String product, String token, String userId);
/** /**
* 未处理消防告警 * 未处理消防告警
......
...@@ -164,7 +164,7 @@ public class ConfirmAlarmServiceImpl extends ServiceImpl<ConfirmAlarmMapper, Equ ...@@ -164,7 +164,7 @@ public class ConfirmAlarmServiceImpl extends ServiceImpl<ConfirmAlarmMapper, Equ
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void confirmAlam(EquipmentSpecificAlarmLog ent, String appKey, String product, String token, String userId) { public String confirmAlam(EquipmentSpecificAlarmLog ent, String appKey, String product, String token, String userId) {
try { try {
AgencyUserModel userModel = remoteSecurityService.getAgencyUser(); AgencyUserModel userModel = remoteSecurityService.getAgencyUser();
ent.setConfirmUser(userModel.getUserId()); ent.setConfirmUser(userModel.getUserId());
...@@ -211,34 +211,23 @@ public class ConfirmAlarmServiceImpl extends ServiceImpl<ConfirmAlarmMapper, Equ ...@@ -211,34 +211,23 @@ public class ConfirmAlarmServiceImpl extends ServiceImpl<ConfirmAlarmMapper, Equ
ent.setConfirmDate(new Date()); ent.setConfirmDate(new Date());
int i = 0 ; int i = 0 ;
ent.setConfirmTypeName(ConfirmAlamEnum.getTypeByCode(ent.getConfirmType())); ent.setConfirmTypeName(ConfirmAlamEnum.getTypeByCode(ent.getConfirmType()));
if (!ent.isAddDefect()) { Date date = new Date();
if (ent.getIsBatch() == 0){ SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
i = equipmentSpecificAlarmLogMapper.updateById(ent); String dateString = formatter.format(date);
}else { ent.setDefectBatchId(UUID.randomUUID().toString().replace("-", "").toLowerCase());
LambdaUpdateWrapper<EquipmentSpecificAlarmLog> updateWrapper = new LambdaUpdateWrapper<EquipmentSpecificAlarmLog>(). if (ent.isAddDefect()) {
eq(EquipmentSpecificAlarmLog::getEquipmentSpecificId,ent.getEquipmentSpecificId()). ent.setResolveResult(dateString + " " + userModel.getRealName() + " 添加为缺陷进行消缺。");
eq(EquipmentSpecificAlarmLog::getEquipmentSpecificIndexKey,ent.getEquipmentSpecificIndexKey())
.isNull(EquipmentSpecificAlarmLog::getConfirmDate);
i = equipmentSpecificAlarmLogMapper.update(ent, updateWrapper);
}
} else { } else {
// 自动确警处理 ent.setResolveResult(dateString + " " + userModel.getRealName() + " 进行警情确认处理。");
EquipmentSpecific specific = equipmentSpecificMapper.selectById(ent.getEquipmentSpecificId()); }
Date date = new Date(); if (ent.getIsBatch() == 0){
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); i = equipmentSpecificAlarmLogMapper.updateById(ent);
String dateString = formatter.format(date); } else {
ent.setTraceId(null); LambdaUpdateWrapper<EquipmentSpecificAlarmLog> updateWrapper = new LambdaUpdateWrapper<EquipmentSpecificAlarmLog>().
String equipmentName = StringUtil.isNotEmpty(specific.getCode()) ? specific.getName() + "(" + specific.getCode() + ")" : specific.getName(); eq(EquipmentSpecificAlarmLog::getEquipmentSpecificId,ent.getEquipmentSpecificId()).
if (ent.getConfirmType().equals(AlarmTypeEnum.PB.getCode())) { eq(EquipmentSpecificAlarmLog::getEquipmentSpecificIndexKey,ent.getEquipmentSpecificIndexKey())
ent.setAlarmReason(equipmentName + "频繁故障/误报,将设备报警信息屏蔽。"); .isNull(EquipmentSpecificAlarmLog::getConfirmDate);
} else { i = equipmentSpecificAlarmLogMapper.update(ent, updateWrapper);
ent.setAlarmReason(equipmentName + "引起设备报警");
}
ent.setResolveResult(dateString + "系统收到设备复归(已消除)信号,系统自动处理。");
ent.setConfirmUser("");
ent.setConfirmUserName("系统自动处理");
ent.setConfirmDate(date);
equipmentSpecificAlarmLogService.updateById(ent);
} }
//int i = confirmAlarmMapper.confirmAlam(ent); //int i = confirmAlarmMapper.confirmAlam(ent);
...@@ -283,6 +272,7 @@ public class ConfirmAlarmServiceImpl extends ServiceImpl<ConfirmAlarmMapper, Equ ...@@ -283,6 +272,7 @@ public class ConfirmAlarmServiceImpl extends ServiceImpl<ConfirmAlarmMapper, Equ
mqttSendGateway.sendToMqtt(TopicEnum.ALARM_LOG_INSERT.getTopic(), jsonObject.toString()); mqttSendGateway.sendToMqtt(TopicEnum.ALARM_LOG_INSERT.getTopic(), jsonObject.toString());
} }
}); });
return ent.getDefectBatchId();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
throw new BadRequest("确认失败"); throw new BadRequest("确认失败");
......
...@@ -29,7 +29,6 @@ import org.springframework.beans.BeanUtils; ...@@ -29,7 +29,6 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.security.core.parameters.P;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.TransactionSynchronization; import org.springframework.transaction.support.TransactionSynchronization;
...@@ -38,18 +37,14 @@ import org.springframework.util.CollectionUtils; ...@@ -38,18 +37,14 @@ import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import java.lang.reflect.Array;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.BigInteger; import java.math.BigInteger;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
//import net.sf.json.JSONObject;
/** /**
* @author keyong * @author keyong
...@@ -606,9 +601,26 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -606,9 +601,26 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
queryWrapper.eq(EquipmentSpecificAlarmLog::getEquipmentSpecificIndexKey, equipmentSpecificIndexKey); queryWrapper.eq(EquipmentSpecificAlarmLog::getEquipmentSpecificIndexKey, equipmentSpecificIndexKey);
queryWrapper.ne(EquipmentSpecificAlarmLog::getStatus, AlarmStatusEnum.HF.getCode()); queryWrapper.ne(EquipmentSpecificAlarmLog::getStatus, AlarmStatusEnum.HF.getCode());
List<EquipmentSpecificAlarmLog> logs = equipmentSpecificAlarmLogService.getBaseMapper().selectList(queryWrapper); List<EquipmentSpecificAlarmLog> logs = equipmentSpecificAlarmLogService.getBaseMapper().selectList(queryWrapper);
EquipmentSpecificAlarmLog log = logs.get(0);
EquipmentSpecific specific = equipmentSpecificMapper.selectById(log.getEquipmentSpecificId());
Date date = new Date();
logs.forEach(x -> { logs.forEach(x -> {
x.setCleanTime(new Date()); x.setCleanTime(new Date());
x.setStatus(AlarmStatusEnum.HF.getCode()); x.setStatus(AlarmStatusEnum.HF.getCode());
if (!flag) {
x.setConfirmType(x.getType());
x.setConfirmTypeName(ConfirmAlamEnum.getTypeByCode(x.getType()));
String equipmentName = StringUtil.isNotEmpty(specific.getCode()) ? specific.getName() + "(" + specific.getCode() + ")" : specific.getName();
if (x.getType().equals(AlarmTypeEnum.PB.getCode())) {
x.setAlarmReason(equipmentName + "频繁故障/误报,将设备报警信息屏蔽。");
} else {
x.setAlarmReason(equipmentName + "引起设备报警");
}
x.setResolveResult(date + "系统收到设备复归(已消除)信号,系统自动处理。");
x.setConfirmUser("");
x.setConfirmUserName("系统自动处理");
x.setConfirmDate(date);
}
x.setEquipmentSpecificIndexValue(TrueOrFalseEnum.fake.value); x.setEquipmentSpecificIndexValue(TrueOrFalseEnum.fake.value);
if (!StringUtils.isEmpty(traceId)) { if (!StringUtils.isEmpty(traceId)) {
x.setTraceId(traceId); x.setTraceId(traceId);
......
...@@ -326,13 +326,16 @@ public class ExcelServiceImpl { ...@@ -326,13 +326,16 @@ public class ExcelServiceImpl {
SignDto dto = new SignDto(); SignDto dto = new SignDto();
if(par!=null && par.size()>0) { if(par!=null && par.size()>0) {
String date =par.containsKey("date")?par.get("date").toString():null; String date =par.containsKey("date")?par.get("date").toString():null;
String bizOrgCode =par.containsKey("bizOrgCode")?par.get("bizOrgCode").toString():null; // String bizOrgCode =par.containsKey("bizOrgCode")?par.get("bizOrgCode").toString():null;
String bizOrgName =par.containsKey("bizOrgName")?par.get("bizOrgName").toString():null; String bizOrgName =par.containsKey("bizOrgName")?par.get("bizOrgName").toString():null;
String name =par.containsKey("name")?par.get("name").toString():null; String name =par.containsKey("name")?par.get("name").toString():null;
String type =par.containsKey("type")?par.get("type").toString():null; String type =par.containsKey("type")?par.get("type").toString():null;
String signTimeBIGGER =par.containsKey("signTimeBIGGER")?par.get("signTimeBIGGER").toString():null; String signTimeBIGGER =par.containsKey("signTimeBIGGER")?par.get("signTimeBIGGER").toString():null;
String signTimeLESS =par.containsKey("signTimeLESS")?par.get("signTimeLESS").toString():null; String signTimeLESS =par.containsKey("signTimeLESS")?par.get("signTimeLESS").toString():null;
dto.setBizOrgCode(bizOrgCode); ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
String companyId = reginParams.getPersonIdentity().getCompanyId();
OrgUsr orgUsr = orgUsrMapper.queryBySequenceNbr(companyId);
dto.setBizOrgCode(orgUsr.getBizOrgCode());
dto.setDate(date); dto.setDate(date);
dto.setBizOrgName(bizOrgName); dto.setBizOrgName(bizOrgName);
dto.setName(name); dto.setName(name);
......
...@@ -273,7 +273,7 @@ ...@@ -273,7 +273,7 @@
REPLACE INTO `wl_form_group`(`id`, `group_name`, `group_code`, `group_type`, `allow_operation`, `creator_id`, `create_date`) VALUES (132828674827, '消防水池装置', '92010700', 'equip', 'edit,delete', 2581805, '2022-10-09 03:36:44'); REPLACE INTO `wl_form_group`(`id`, `group_name`, `group_code`, `group_type`, `allow_operation`, `creator_id`, `create_date`) VALUES (132828674827, '消防水池装置', '92010700', 'equip', 'edit,delete', 2581805, '2022-10-09 03:36:44');
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="keyong" id="202210131888"> <changeSet author="keyong" id="202210131888-1">
<preConditions onFail="MARK_RAN"> <preConditions onFail="MARK_RAN">
<tableExists tableName="wl_equipment"/> <tableExists tableName="wl_equipment"/>
</preConditions> </preConditions>
...@@ -282,4 +282,15 @@ ...@@ -282,4 +282,15 @@
REPLACE INTO `wl_equipment`(`id`, `name`, `code`, `category_id`, `country`, `maintenance_cycle`, `check_cycle`, `remark`, `management_style`, `reviser_id`, `date_updated`, `creater_id`, `unit_id`, `made_in`, `manufacturer`, `img`, `video`, `mark_specification`, `supplier_id`, `pref_quota`, `create_date`, `company_name`, `department_orgcode`, `department_name`, `inspection_spec`, `maintenance_spec`, `area`, `is_iot`, `clean_type`, `expiry_date`) VALUES (1578945741864742914, '消防水箱', '93060600HQK44', 1547790305762250754, NULL, NULL, NULL, NULL, NULL, NULL, '2022-10-09 11:10:28', NULL, 55, NULL, NULL, 'upload/state_grid/studio_normalapp_3056965/D0D194CE38EA9F604B401F1BFCC31975.jpg', NULL, NULL, NULL, NULL, '2022-10-09 11:09:35', NULL, NULL, NULL, NULL, NULL, NULL, '1', '0', NULL); REPLACE INTO `wl_equipment`(`id`, `name`, `code`, `category_id`, `country`, `maintenance_cycle`, `check_cycle`, `remark`, `management_style`, `reviser_id`, `date_updated`, `creater_id`, `unit_id`, `made_in`, `manufacturer`, `img`, `video`, `mark_specification`, `supplier_id`, `pref_quota`, `create_date`, `company_name`, `department_orgcode`, `department_name`, `inspection_spec`, `maintenance_spec`, `area`, `is_iot`, `clean_type`, `expiry_date`) VALUES (1578945741864742914, '消防水箱', '93060600HQK44', 1547790305762250754, NULL, NULL, NULL, NULL, NULL, NULL, '2022-10-09 11:10:28', NULL, 55, NULL, NULL, 'upload/state_grid/studio_normalapp_3056965/D0D194CE38EA9F604B401F1BFCC31975.jpg', NULL, NULL, NULL, NULL, '2022-10-09 11:09:35', NULL, NULL, NULL, NULL, NULL, NULL, '1', '0', NULL);
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="keyong" id="202210131888-2">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="wl_equipment_specific_alarm_log" columnName="defect_batch_id"/>
</not>
</preConditions>
<comment>新增属性字段 defect_batch_id</comment>
<sql>
alter table `wl_equipment_specific_alarm_log` add column `defect_batch_id` varchar(64) DEFAULT NULL COMMENT '缺陷表批次号';
</sql>
</changeSet>
</databaseChangeLog> </databaseChangeLog>
\ No newline at end of file
...@@ -51,7 +51,8 @@ ...@@ -51,7 +51,8 @@
confirm_date, confirm_date,
(SELECT GROUP_CONCAT(fem.name) FROM `f_fire_fighting_system` fem WHERE find_in_set(fem.id,spe.system_id)) as systemName, (SELECT GROUP_CONCAT(fem.name) FROM `f_fire_fighting_system` fem WHERE find_in_set(fem.id,spe.system_id)) as systemName,
if(ala.clean_time is null, '未消除', '已消除') AS cleanStatus, if(ala.clean_time is null, '未消除', '已消除') AS cleanStatus,
ala.clean_time ala.clean_time,
ala.defect_batch_id
from from
wl_equipment_specific_alarm_log as ala wl_equipment_specific_alarm_log as ala
left join wl_equipment_specific as spe on spe.id = ala.equipment_specific_id left join wl_equipment_specific as spe on spe.id = ala.equipment_specific_id
......
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