10 changed files with 213 additions and 157 deletions
@ -0,0 +1,21 @@ |
|||||
|
package com.ccsens.wisdomcar.persist.dao; |
||||
|
|
||||
|
import com.ccsens.wisdomcar.persist.mapper.StepMapper; |
||||
|
import org.apache.ibatis.annotations.Param; |
||||
|
import org.springframework.stereotype.Repository; |
||||
|
|
||||
|
/** |
||||
|
* @author 逗 |
||||
|
*/ |
||||
|
@Repository |
||||
|
public interface StepDao extends StepMapper { |
||||
|
|
||||
|
/** |
||||
|
* 通过rfid查找流程 |
||||
|
* @param value rfid |
||||
|
* @return 返回流程的code |
||||
|
*/ |
||||
|
String getCodeByRfId(@Param("rfid") String value); |
||||
|
|
||||
|
String getCodeByStepOne(); |
||||
|
} |
@ -1,57 +1,55 @@ |
|||||
//package com.ccsens.wisdomcar.rabbitMQ;
|
package com.ccsens.wisdomcar.rabbitMQ; |
||||
//
|
|
||||
//import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil; |
||||
//import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil; |
||||
//import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject; |
||||
//import com.ccsens.util.bean.message.common.OutMessage;
|
import com.ccsens.util.bean.message.common.OutMessage; |
||||
//import com.ccsens.util.bean.message.common.OutMessageSet;
|
import com.ccsens.util.bean.message.common.OutMessageSet; |
||||
//import com.ccsens.util.config.RabbitMQConfig;
|
import com.ccsens.util.config.RabbitMQConfig; |
||||
//import com.ccsens.wisdomcar.bean.dto.Message.CarRecordMessageDto;
|
import com.ccsens.wisdomcar.bean.dto.Message.CarRecordMessageDto; |
||||
//import com.ccsens.wisdomcar.service.IRecordService;
|
import com.ccsens.wisdomcar.service.IRecordService; |
||||
//import com.ccsens.wisdomcar.service.RecordService;
|
import lombok.extern.slf4j.Slf4j; |
||||
//import lombok.extern.slf4j.Slf4j;
|
import org.slf4j.Logger; |
||||
//import org.slf4j.Logger;
|
import org.slf4j.LoggerFactory; |
||||
//import org.slf4j.LoggerFactory;
|
import org.springframework.amqp.rabbit.annotation.RabbitHandler; |
||||
//import org.springframework.amqp.rabbit.annotation.RabbitHandler;
|
import org.springframework.amqp.rabbit.annotation.RabbitListener; |
||||
//import org.springframework.amqp.rabbit.annotation.RabbitListener;
|
import org.springframework.stereotype.Component; |
||||
//import org.springframework.stereotype.Component;
|
|
||||
//
|
import javax.annotation.Resource; |
||||
//import javax.annotation.Resource;
|
import java.util.Set; |
||||
//import java.util.List;
|
|
||||
//import java.util.Set;
|
@Slf4j |
||||
//
|
@Component |
||||
//@Slf4j
|
@RabbitListener(queues = RabbitMQConfig.WISDOM_CAR) |
||||
//@Component
|
public class RabbitController { |
||||
//@RabbitListener(queues = RabbitMQConfig.WISDOM_CAR)
|
@Resource |
||||
//public class RabbitController {
|
private IRecordService recordService; |
||||
// @Resource
|
|
||||
// private IRecordService recordService;
|
private Logger logger = LoggerFactory.getLogger(RabbitController.class); |
||||
//
|
|
||||
// private Logger logger = LoggerFactory.getLogger(RabbitController.class);
|
@RabbitHandler |
||||
//
|
public void process(String messageJson) { |
||||
// @RabbitHandler
|
logger.info("平车上传消息数据: {}",messageJson); |
||||
// public void process(String messageJson) {
|
OutMessageSet outMessageSet = JSONObject.parseObject(messageJson,OutMessageSet.class); |
||||
// logger.info("平车上传消息数据: {}",messageJson);
|
if(ObjectUtil.isNull(outMessageSet)){ |
||||
// OutMessageSet outMessageSet = JSONObject.parseObject(messageJson,OutMessageSet.class);
|
return; |
||||
// if(ObjectUtil.isNull(outMessageSet)){
|
} |
||||
// return;
|
Set<OutMessage> messageSet = outMessageSet.getMessageSet(); |
||||
// }
|
if (CollectionUtil.isEmpty(messageSet)) { |
||||
// Set<OutMessage> messageSet = outMessageSet.getMessageSet();
|
return; |
||||
// if (CollectionUtil.isEmpty(messageSet)) {
|
} |
||||
// return;
|
messageSet.forEach(outMessage -> { |
||||
// }
|
CarRecordMessageDto carRecordMessageDto = JSONObject.parseObject(outMessage.getData(),CarRecordMessageDto.class); |
||||
// messageSet.forEach(outMessage -> {
|
if(ObjectUtil.isNull(carRecordMessageDto)){ |
||||
// CarRecordMessageDto carRecordMessageDto = JSONObject.parseObject(outMessage.getData(),CarRecordMessageDto.class);
|
return; |
||||
// if(ObjectUtil.isNull(carRecordMessageDto)){
|
} |
||||
// return;
|
try { |
||||
// }
|
recordService.disposeMessage(carRecordMessageDto); |
||||
// try {
|
} catch (Exception e) { |
||||
// recordService.disposeMessage(carRecordMessageDto);
|
log.error("处理平车信息异常",e); |
||||
// } catch (Exception e) {
|
e.printStackTrace(); |
||||
// log.error("处理平车信息异常",e);
|
} |
||||
// e.printStackTrace();
|
}); |
||||
// }
|
} |
||||
// });
|
|
||||
// }
|
} |
||||
//
|
|
||||
//}
|
|
||||
|
@ -0,0 +1,25 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
|
<mapper namespace="com.ccsens.wisdomcar.persist.dao.StepDao"> |
||||
|
|
||||
|
|
||||
|
<select id="getCodeByRfId" resultType="java.lang.String"> |
||||
|
SELECT |
||||
|
s. |
||||
|
FROM |
||||
|
`t_step` s, |
||||
|
t_rfid r |
||||
|
WHERE |
||||
|
s.id = r.step_id |
||||
|
and r.rfid = #{rfid} |
||||
|
limit 1 |
||||
|
</select> |
||||
|
<select id="getCodeByStepOne" resultType="java.lang.String"> |
||||
|
SELECT |
||||
|
s.code |
||||
|
FROM |
||||
|
`t_step` s |
||||
|
ORDER BY id |
||||
|
limit 1 |
||||
|
</select> |
||||
|
</mapper> |
Loading…
Reference in new issue