Commit 6a8239cd authored by 刘林's avatar 刘林

fix(jg):超设计使用年限完成发送消息功能开发

parent 7eaabac8
......@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
......@@ -19,6 +20,7 @@ import com.yeejoin.amos.boot.module.jg.api.dto.*;
import com.yeejoin.amos.boot.module.jg.api.entity.*;
import com.yeejoin.amos.boot.module.jg.api.enums.BusinessTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.enums.CompanyTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.enums.SafetyProblemTypeEnum;
import com.yeejoin.amos.boot.module.jg.api.enums.WorkFlowStatusEnum;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgOverDesignServiceLifeEqMapper;
import com.yeejoin.amos.boot.module.jg.api.mapper.JgOverDesignServiceLifeMapper;
......@@ -44,6 +46,7 @@ import com.yeejoin.amos.feign.workflow.model.ActWorkflowStartDTO;
import com.yeejoin.amos.feign.workflow.model.ProcessTaskDTO;
import com.yeejoin.amos.feign.workflow.model.TaskResultDTO;
import io.seata.spring.annotation.GlobalTransactional;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
import org.springframework.beans.BeanUtils;
......@@ -55,6 +58,7 @@ import org.springframework.transaction.support.TransactionSynchronizationManager
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
......@@ -63,6 +67,7 @@ import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.nio.charset.StandardCharsets;
import java.time.ZoneId;
import java.util.*;
import java.util.concurrent.TimeUnit;
......@@ -121,6 +126,8 @@ public class JgOverDesignServiceLifeServiceImpl extends BaseService<JgOverDesign
private SnowflakeIdUtil sequence;
@Autowired
private EventPublisher eventPublisher;
@Autowired
private EmqKeeper emqKeeper;
/**
* 分页查询
......@@ -654,6 +661,7 @@ public class JgOverDesignServiceLifeServiceImpl extends BaseService<JgOverDesign
));
}
}
this.sendOverDesignMessage(equipmentLists);
}
private void updateDesignInfo(TaskV2Model taskV2Model, JgOverDesignServiceLife jgOverDesignServiceLife, List<Map<String, Object>> equipmentLists, List<IdxBizJgDesignInfo> designInfoList) {
......@@ -677,6 +685,22 @@ public class JgOverDesignServiceLifeServiceImpl extends BaseService<JgOverDesign
});
}
/**
* 发送超设计使用年限消息
* @param equipmentLists 设备信息
*/
private void sendOverDesignMessage(List<Map<String, Object>> equipmentLists) {
JSONArray jsonArray = JSON.parseArray(JSON.toJSONString(equipmentLists));
if (CollectionUtil.isNotEmpty(jsonArray)){
// try {
// emqKeeper.getMqttClient().publish(SafetyProblemTypeEnum.JYCQ.getTopic(), jsonArray.toString().getBytes(StandardCharsets.UTF_8), 2, false);
// } catch (MqttException e) {
// log.error("发送超设计使用年限消息失败---->{}" + e.getMessage());
// throw new RuntimeException(e);
// }
}
}
private void updateRegistrationManage(List<String> useOrgCodes) {
List<JgUseRegistrationManage> registrationList = useRegistrationManageService.lambdaQuery()
.in(JgUseRegistrationManage::getUseRegistrationCode, useOrgCodes).list();
......
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