Commit 16a1888e authored by zhangyingbin's avatar zhangyingbin

定时任务规则调用由消息调用改为直接调用

parent dc9da1c1
package com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl; package com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
...@@ -20,8 +21,11 @@ import com.yeejoin.amos.boot.module.tzs.flc.api.dto.CylinderInfoDto; ...@@ -20,8 +21,11 @@ import com.yeejoin.amos.boot.module.tzs.flc.api.dto.CylinderInfoDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.CylinderInfo; import com.yeejoin.amos.boot.module.tzs.flc.api.entity.CylinderInfo;
import com.yeejoin.amos.boot.module.tzs.flc.api.mapper.CylinderInfoMapper; import com.yeejoin.amos.boot.module.tzs.flc.api.mapper.CylinderInfoMapper;
import com.yeejoin.amos.component.rule.RuleTrigger; import com.yeejoin.amos.component.rule.RuleTrigger;
import com.yeejoin.amos.feign.rule.Rule;
import com.yeejoin.amos.feign.rule.model.FactBaseModel;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
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.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -30,6 +34,7 @@ import org.typroject.tyboot.core.foundation.utils.ValidationUtil; ...@@ -30,6 +34,7 @@ import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
/** /**
* @author Zhang Yingbin * @author Zhang Yingbin
...@@ -187,13 +192,26 @@ public class ScheduleService { ...@@ -187,13 +192,26 @@ public class ScheduleService {
log.info("调用气瓶规则对象!+:{}", JSON.toJSONString(warningMsgDto)); log.info("调用气瓶规则对象!+:{}", JSON.toJSONString(warningMsgDto));
} }
String[] test = new String[]{}; String[] test = new String[]{};
ruleTrigger.publish(warningMsgDto, cylPackageId,new String[0]); this.rulePublish(warningMsgDto,cylPackageId);
} catch (Exception e) { } catch (Exception e) {
log.error("调用气瓶规则失败!:{},{}", JSON.toJSONString(cylinderInfoDto),e); log.error("调用气瓶规则失败!:{},{}", JSON.toJSONString(cylinderInfoDto),e);
} }
} }
/** /**
* 调用规则公用方法
*/
public void rulePublish(WarningMsgDto warningMsgDto,String packageId){
FactBaseModel factBaseModel = new FactBaseModel();
factBaseModel.setPackageId(packageId);
factBaseModel.setProcessIds(new String[0]);
HashMap<String,byte[]> map = new HashMap();
map.put("com.yeejoin.amos.boot.module.tzs.api.dto.WarningMsgDto",JSONObject.toJSONString(warningMsgDto).getBytes());
factBaseModel.setFactMap(map);
Rule.ruleClient.fireRule(factBaseModel);
}
/**
* 气瓶规则调用 * 气瓶规则调用
* @param sequenceCode * @param sequenceCode
* @return * @return
...@@ -246,7 +264,7 @@ public class ScheduleService { ...@@ -246,7 +264,7 @@ public class ScheduleService {
if (log.isInfoEnabled()) { if (log.isInfoEnabled()) {
log.info("调用设备规则对象!+:{}", JSON.toJSONString(warningMsgDto)); log.info("调用设备规则对象!+:{}", JSON.toJSONString(warningMsgDto));
} }
ruleTrigger.publish(warningMsgDto, equPackageId, null); this.rulePublish(warningMsgDto,equPackageId);
} catch (Exception e) { } catch (Exception e) {
log.error("调用设备规则失败!:{},{}", JSON.toJSONString(equScheduleDto),e); log.error("调用设备规则失败!:{},{}", JSON.toJSONString(equScheduleDto),e);
} }
...@@ -301,7 +319,7 @@ public class ScheduleService { ...@@ -301,7 +319,7 @@ public class ScheduleService {
if (log.isInfoEnabled()) { if (log.isInfoEnabled()) {
log.info("调用许可规则对象!+:{}", JSON.toJSONString(warningMsgDto)); log.info("调用许可规则对象!+:{}", JSON.toJSONString(warningMsgDto));
} }
ruleTrigger.publish(warningMsgDto, licPackageId, null); this.rulePublish(warningMsgDto,licPackageId);
} catch (Exception e) { } catch (Exception e) {
log.error("调用许可规则失败!:{},{}", JSON.toJSONString(licScheduleDto),e); log.error("调用许可规则失败!:{},{}", JSON.toJSONString(licScheduleDto),e);
} }
......
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