Browse Source

Merge branch 'pt' of dd.tall.wiki:ccsens_wiki/ccsenscloud into pt

recovery
zy_Java 5 years ago
parent
commit
c619e2d6f2
  1. 8
      wisdomcar/src/main/java/com/ccsens/wisdomcar/bean/vo/StatisticsVo.java
  2. 6
      wisdomcar/src/main/java/com/ccsens/wisdomcar/persist/dao/StatisticsDao.java
  3. 114
      wisdomcar/src/main/java/com/ccsens/wisdomcar/rabbitMQ/RabbitController.java
  4. 13
      wisdomcar/src/main/java/com/ccsens/wisdomcar/service/StatisticsService.java
  5. 16
      wisdomcar/src/main/resources/mapper_dao/StatisticsDao.xml

8
wisdomcar/src/main/java/com/ccsens/wisdomcar/bean/vo/StatisticsVo.java

@ -36,8 +36,6 @@ public class StatisticsVo {
@Data
@ApiModel("各个结点时长")
public static class PointTime{
@ApiModelProperty("节点名")
private String name;
@ApiModelProperty("节点耗时")
private Long time;
}
@ -47,10 +45,10 @@ public class StatisticsVo {
@ApiModel("各个结点时长集合")
public static class PointTimeList{
@ApiModelProperty("当前数据")
private List<PointTime> pointTimeCurrentList;
private List<Long> pointTimeCurrentList;
@ApiModelProperty("医院数据")
private List<PointTime> pointTimeHospital;
private List<Long> pointTimeHospital;
@ApiModelProperty("国际数据")
private List<PointTime> pointTimeInternation;
private List<Long> pointTimeInternation;
}
}

6
wisdomcar/src/main/java/com/ccsens/wisdomcar/persist/dao/StatisticsDao.java

@ -11,11 +11,11 @@ public interface StatisticsDao extends FirstAidMapper {
List<StatisticsVo.PointTime> getPointTimeCurrent(@Param("id") Long id);
List<Long> getPointTimeCurrent(@Param("id") Long id);
List<StatisticsVo.PointTime> getPointTimeHospital(@Param("id") Long id);
List<Long> getPointTimeHospital(@Param("id") Long id);
List<StatisticsVo.PointTime> getPointTimeInternation(@Param("id") Long id);
List<Long> getPointTimeInternation(@Param("id") Long id);
public List<Integer> selResult(@Param("param")StatisticsDto.UseNum param);

114
wisdomcar/src/main/java/com/ccsens/wisdomcar/rabbitMQ/RabbitController.java

@ -1,57 +1,57 @@
package com.ccsens.wisdomcar.rabbitMQ;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONObject;
import com.ccsens.util.bean.message.common.OutMessage;
import com.ccsens.util.bean.message.common.OutMessageSet;
import com.ccsens.util.config.RabbitMQConfig;
import com.ccsens.wisdomcar.bean.dto.Message.CarRecordMessageDto;
import com.ccsens.wisdomcar.service.IRecordService;
import com.ccsens.wisdomcar.service.RecordService;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.List;
import java.util.Set;
@Slf4j
@Component
@RabbitListener(queues = RabbitMQConfig.WISDOM_CAR)
public class RabbitController {
@Resource
private IRecordService recordService;
private Logger logger = LoggerFactory.getLogger(RabbitController.class);
@RabbitHandler
public void process(String messageJson) {
logger.info("平车上传消息数据: {}",messageJson);
OutMessageSet outMessageSet = JSONObject.parseObject(messageJson,OutMessageSet.class);
if(ObjectUtil.isNull(outMessageSet)){
return;
}
Set<OutMessage> messageSet = outMessageSet.getMessageSet();
if (CollectionUtil.isEmpty(messageSet)) {
return;
}
messageSet.forEach(outMessage -> {
CarRecordMessageDto carRecordMessageDto = JSONObject.parseObject(outMessage.getData(),CarRecordMessageDto.class);
if(ObjectUtil.isNull(carRecordMessageDto)){
return;
}
try {
recordService.disposeMessage(carRecordMessageDto);
} catch (Exception e) {
log.error("处理平车信息异常",e);
e.printStackTrace();
}
});
}
}
//package com.ccsens.wisdomcar.rabbitMQ;
//
//import cn.hutool.core.collection.CollectionUtil;
//import cn.hutool.core.util.ObjectUtil;
//import com.alibaba.fastjson.JSONObject;
//import com.ccsens.util.bean.message.common.OutMessage;
//import com.ccsens.util.bean.message.common.OutMessageSet;
//import com.ccsens.util.config.RabbitMQConfig;
//import com.ccsens.wisdomcar.bean.dto.Message.CarRecordMessageDto;
//import com.ccsens.wisdomcar.service.IRecordService;
//import com.ccsens.wisdomcar.service.RecordService;
//import lombok.extern.slf4j.Slf4j;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.amqp.rabbit.annotation.RabbitHandler;
//import org.springframework.amqp.rabbit.annotation.RabbitListener;
//import org.springframework.stereotype.Component;
//
//import javax.annotation.Resource;
//import java.util.List;
//import java.util.Set;
//
//@Slf4j
//@Component
//@RabbitListener(queues = RabbitMQConfig.WISDOM_CAR)
//public class RabbitController {
// @Resource
// private IRecordService recordService;
//
// private Logger logger = LoggerFactory.getLogger(RabbitController.class);
//
// @RabbitHandler
// public void process(String messageJson) {
// logger.info("平车上传消息数据: {}",messageJson);
// OutMessageSet outMessageSet = JSONObject.parseObject(messageJson,OutMessageSet.class);
// if(ObjectUtil.isNull(outMessageSet)){
// return;
// }
// Set<OutMessage> messageSet = outMessageSet.getMessageSet();
// if (CollectionUtil.isEmpty(messageSet)) {
// return;
// }
// messageSet.forEach(outMessage -> {
// CarRecordMessageDto carRecordMessageDto = JSONObject.parseObject(outMessage.getData(),CarRecordMessageDto.class);
// if(ObjectUtil.isNull(carRecordMessageDto)){
// return;
// }
// try {
// recordService.disposeMessage(carRecordMessageDto);
// } catch (Exception e) {
// log.error("处理平车信息异常",e);
// e.printStackTrace();
// }
// });
// }
//
//}

13
wisdomcar/src/main/java/com/ccsens/wisdomcar/service/StatisticsService.java

@ -59,19 +59,18 @@ public class StatisticsService implements IStatisticsService{
@Override
public StatisticsVo.PointTimeList getPointTime(StatisticsDto.Hospital param) {
List<StatisticsVo.PointTime> pointTimeCurrent1 = new ArrayList<>();
List<Long> pointTimeCurrent1 = new ArrayList<>();
//当前数据
List<StatisticsVo.PointTime> pointTimeCurrent = statisticsDao.getPointTimeCurrent(param.getId());
for (int i = 0; i <7; i++) {
List<Long> pointTimeCurrent = statisticsDao.getPointTimeCurrent(param.getId());
for (int i = 0; i <pointTimeCurrent.size() ; i++) {
if (i<6){
pointTimeCurrent.get(i).setTime(pointTimeCurrent.get(i+1).getTime()/1000-pointTimeCurrent.get(i).getTime()/1000);
pointTimeCurrent1.add(pointTimeCurrent.get(i+1)-pointTimeCurrent.get(i));
}
}
//医院数据
List<StatisticsVo.PointTime> pointTimeHospital = statisticsDao.getPointTimeHospital(param.getId());
List<Long> pointTimeHospital = statisticsDao.getPointTimeHospital(param.getId());
//国际数据
List<StatisticsVo.PointTime> pointTimeInternation = statisticsDao.getPointTimeInternation(param.getId());
List<Long> pointTimeInternation = statisticsDao.getPointTimeInternation(param.getId());
StatisticsVo.PointTimeList pointTimeList = new StatisticsVo.PointTimeList();
pointTimeList.setPointTimeCurrentList(pointTimeCurrent1);

16
wisdomcar/src/main/resources/mapper_dao/StatisticsDao.xml

@ -34,30 +34,28 @@ FROM
<select id="getPointTimeCurrent" parameterType="java.util.Map" resultType="com.ccsens.wisdomcar.bean.vo.StatisticsVo$PointTime">
select tfar.begin_time, tfar.type as name
<select id="getPointTimeCurrent" parameterType="java.util.Map" resultType="Long">
select tfar.begin_time as time
from
t_first_aid_record tfar ,(select id from t_first_aid tfa where tfa.hospital_id=0 and tfa.rec_status=0 ORDER BY tfa.begin_time) t
t_first_aid_record tfar ,(select id from t_first_aid tfa where tfa.hospital_id=#{id} and tfa.rec_status=0 ORDER BY tfa.begin_time) t
where tfar.rec_status=0 and t.id = tfar.first_aid_id
</select>
<select id="getPointTimeHospital" parameterType="java.util.Map" resultType="com.ccsens.wisdomcar.bean.vo.StatisticsVo$PointTime">
<select id="getPointTimeHospital" parameterType="java.util.Map" resultType="Long">
select
ts.`name`,
MIN(tfas.duration)/1000 as time
from
t_first_aid_standard tfas left JOIN t_step ts on tfas.step_id = ts.id
where tfas.hospital_id=0 and tfas.type=1 and tfas.rec_status = 0 and ts.rec_status=0
where tfas.hospital_id=#{id} and tfas.type=1 and tfas.rec_status = 0 and ts.rec_status=0
GROUP BY tfas.step_id;
</select>
<select id="getPointTimeInternation" parameterType="java.util.Map" resultType="com.ccsens.wisdomcar.bean.vo.StatisticsVo$PointTime">
<select id="getPointTimeInternation" parameterType="java.util.Map" resultType="Long">
select
ts.`name`,
MIN(tfas.duration)/1000 as time
from
t_first_aid_standard tfas left JOIN t_step ts on tfas.step_id = ts.id
where tfas.hospital_id=0 and tfas.type=0 and tfas.rec_status = 0 and ts.rec_status=0
where tfas.hospital_id=#{id} and tfas.type=0 and tfas.rec_status = 0 and ts.rec_status=0
GROUP BY tfas.step_id;
</select>
</mapper>
Loading…
Cancel
Save