Commit 256ea50f authored by zhuangzhuang's avatar zhuangzhuang

4.9--修改根据线路编号查询线路信息的返回值,修改mqtt的监听bug,修改报警的逻辑问题

parent 89269511
...@@ -173,9 +173,9 @@ public class GWConfigWorker implements Callable<String>, MqttCallback { ...@@ -173,9 +173,9 @@ public class GWConfigWorker implements Callable<String>, MqttCallback {
//解析Message消息 //解析Message消息
RespVo respVo = new Gson().fromJson(Message,RespVo.class); RespVo respVo = new Gson().fromJson(Message,RespVo.class);
if(respVo.getResponse().equals("config")){ if(respVo.getResponse().equals("config")){
logger.info(SN); // logger.info(SN);
logger.info(Type); // logger.info(Type);
logger.info(""+respVo.getStatus()); // logger.info(""+respVo.getStatus());
//配置回复 //配置回复
configService.bindiSuccess(SN,Type,respVo.getStatus()); configService.bindiSuccess(SN,Type,respVo.getStatus());
}else{ }else{
...@@ -209,7 +209,7 @@ public class GWConfigWorker implements Callable<String>, MqttCallback { ...@@ -209,7 +209,7 @@ public class GWConfigWorker implements Callable<String>, MqttCallback {
//发送数据 //发送数据
MqttMessage msg = new MqttMessage(); MqttMessage msg = new MqttMessage();
msg.setQos(1); msg.setQos(1);
msg.setRetained(true); msg.setRetained(false);
msg.setPayload(ConfigCMD.getBytes()); msg.setPayload(ConfigCMD.getBytes());
mqttAsyncClient.publish(ConfigTopic,msg); mqttAsyncClient.publish(ConfigTopic,msg);
} }
......
...@@ -21,6 +21,8 @@ public class ResultCircuitVo { ...@@ -21,6 +21,8 @@ public class ResultCircuitVo {
private String evaluate; private String evaluate;
private String transportation;
public String getTransportationNo() { public String getTransportationNo() {
return transportationNo; return transportationNo;
} }
...@@ -100,4 +102,12 @@ public class ResultCircuitVo { ...@@ -100,4 +102,12 @@ public class ResultCircuitVo {
public void setEvaluate(String evaluate) { public void setEvaluate(String evaluate) {
this.evaluate = evaluate; this.evaluate = evaluate;
} }
public String getTransportation() {
return transportation;
}
public void setTransportation(String transportation) {
this.transportation = transportation;
}
} }
\ No newline at end of file
...@@ -25,4 +25,6 @@ public interface AlarmMapper { ...@@ -25,4 +25,6 @@ public interface AlarmMapper {
ResultAlarmVo getByTypeAndScene(@Param("alarmType") String alarmType,@Param("alarmScene") String alarmScene); ResultAlarmVo getByTypeAndScene(@Param("alarmType") String alarmType,@Param("alarmScene") String alarmScene);
List<String> getForWarehouse(); List<String> getForWarehouse();
List<String> getForTransportation();
} }
...@@ -36,7 +36,7 @@ import java.util.concurrent.TimeUnit; ...@@ -36,7 +36,7 @@ import java.util.concurrent.TimeUnit;
public class MqttListener implements MqttCallback { public class MqttListener implements MqttCallback {
private static final int INIT_DELAY_DEFAULT = 1000; // unit:ms private static final int INIT_DELAY_DEFAULT = 1000; // unit:ms
private static final int SCH_PERIOD_DEFAULT = 10 * INIT_DELAY_DEFAULT; // unit:ms private static final int SCH_PERIOD_DEFAULT = 10 * INIT_DELAY_DEFAULT; // unit:ms
private static final String CHECKIN_TOPIC = "Witium/+/+/CheckIn"; private static final String CHECKIN_TOPIC = "TDL/+/+/CheckIn";
private MqttTemlateAsync mqttAsyncClient; private MqttTemlateAsync mqttAsyncClient;
......
...@@ -45,4 +45,8 @@ public class AlarmService { ...@@ -45,4 +45,8 @@ public class AlarmService {
return alarmMapper.getForWarehouse(); return alarmMapper.getForWarehouse();
} }
public List<String> getForTransportation(){
return alarmMapper.getForTransportation();
}
} }
...@@ -297,4 +297,15 @@ public class AlarmController { ...@@ -297,4 +297,15 @@ public class AlarmController {
return alarmService.getForWarehouse(); return alarmService.getForWarehouse();
} }
@ApiOperation(value = "查询运输场景下的预警类型",notes = "查询运输场景下的预警类型")
@ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
})
@RequestMapping(value="/getForTransportation",method = RequestMethod.GET)
public Object getForTransportation(){
return alarmService.getForTransportation();
}
} }
...@@ -170,7 +170,8 @@ public class CircuitController { ...@@ -170,7 +170,8 @@ public class CircuitController {
} }
if(circuitTermVo.getStartTime()==null){ if(circuitTermVo.getStartTime()==null){
circuitTermVo.setStartTime(null); circuitTermVo.setStartTime(null);
} if(circuitTermVo.getEndTime()==null){ }
if(circuitTermVo.getEndTime()==null){
circuitTermVo.setEndTime(null); circuitTermVo.setEndTime(null);
} }
circuitTermVo.setCompanyName(user.getCompanyName()); circuitTermVo.setCompanyName(user.getCompanyName());
...@@ -458,7 +459,7 @@ public class CircuitController { ...@@ -458,7 +459,7 @@ public class CircuitController {
} }
alarmTypeVar =alarmTypeVar + addCircuitVo.getTdlAlarmList().get(j).getAlarmType() +" "; alarmTypeVar =alarmTypeVar + addCircuitVo.getTdlAlarmList().get(j).getAlarmType() +" ";
TDLSNVar =TDLSNVar + addCircuitVo.getTdlAlarmList().get(j).getTDLSN() +" "; TDLSNVar =TDLSNVar + addCircuitVo.getTdlAlarmList().get(j).getTDLSN() +" ";
devList.add("tdl-"+addCircuitVo.getTdlAlarmList().get(j).getTDLSN()); devList.add("TDL-"+addCircuitVo.getTdlAlarmList().get(j).getTDLSN());
saveAlarmRule("TDL/"+type+"/" +addCircuitVo.getSN()+"/Data",addCircuitVo.getTdlAlarmList().get(j).getTDLSN(),addCircuitVo.getTdlAlarmList().get(j).getAlarmType()); saveAlarmRule("TDL/"+type+"/" +addCircuitVo.getSN()+"/Data",addCircuitVo.getTdlAlarmList().get(j).getTDLSN(),addCircuitVo.getTdlAlarmList().get(j).getAlarmType());
} }
...@@ -856,7 +857,8 @@ public class CircuitController { ...@@ -856,7 +857,8 @@ public class CircuitController {
" alarmType:预警类型," + " alarmType:预警类型," +
" circuitState:线路状态(0未开始,1运输中,2完成)," + " circuitState:线路状态(0未开始,1运输中,2完成)," +
" alarm:报警详情(比如:温度,湿度,震动)" + " alarm:报警详情(比如:温度,湿度,震动)" +
" evaluate:运输评价") " evaluate:运输评价" +
" transportation:运输方式")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
}) })
......
...@@ -67,7 +67,8 @@ public class EquipmentBindingController { ...@@ -67,7 +67,8 @@ public class EquipmentBindingController {
" mode:1--运输/2--仓库," + " mode:1--运输/2--仓库," +
" TDLSN:tdl编号," + " TDLSN:tdl编号," +
" transportationNo:运输编号," + " transportationNo:运输编号," +
" warehouseNo:仓库编号" ) " warehouseNo:仓库编号," +
" alarmType:预警类型" )
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
}) })
...@@ -153,8 +154,6 @@ public class EquipmentBindingController { ...@@ -153,8 +154,6 @@ public class EquipmentBindingController {
} }
@ApiOperation(value = "重置tdl",notes = "重置tdl") @ApiOperation(value = "重置tdl",notes = "重置tdl")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
......
...@@ -98,7 +98,6 @@ public class HomePageController { ...@@ -98,7 +98,6 @@ public class HomePageController {
dataVo.setBump(alarmLogServcie.getBumpCount(time)); //获取颠簸数量 dataVo.setBump(alarmLogServcie.getBumpCount(time)); //获取颠簸数量
dataVo.setAlarmLogVoList(alarmLogServcie.getAlarmLog(time));//报警列表 dataVo.setAlarmLogVoList(alarmLogServcie.getAlarmLog(time));//报警列表
List<HistogramData> list = alarmLogServcie.getByCount(time);//获取报警柱状图 List<HistogramData> list = alarmLogServcie.getByCount(time);//获取报警柱状图
//获取设备的当前位置 //获取设备的当前位置
List<ResultCircuitVo> circuitVos = circuitService.getByTime(time,user.getCompanyName()); List<ResultCircuitVo> circuitVos = circuitService.getByTime(time,user.getCompanyName());
List<CircuitVo> circuitList = new ArrayList<>(); List<CircuitVo> circuitList = new ArrayList<>();
......
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/tdlCloud?useUnicode=true&characterEncoding=utf-8&useSSL=false spring.datasource.url=jdbc:mysql://192.168.1.16:3306/tdlCloud?useUnicode=true&characterEncoding=utf-8&useSSL=false
spring.datasource.username=root spring.datasource.username=root
spring.datasource.password=root spring.datasource.password=37774020
spring.datasource.driver-class-name=com.mysql.jdbc.Driver spring.datasource.driver-class-name=com.mysql.jdbc.Driver
threadpool.corepoolsize = 30 threadpool.corepoolsize = 30
......
...@@ -59,4 +59,9 @@ ...@@ -59,4 +59,9 @@
<select id="getForWarehouse" resultType="String"> <select id="getForWarehouse" resultType="String">
SELECT alarmType from alarm WHERE alarmScene="仓库" SELECT alarmType from alarm WHERE alarmScene="仓库"
</select> </select>
<!--查询仓库的预警类型-->
<select id="getForTransportation" resultType="String">
SELECT alarmType from alarm WHERE alarmScene="运输"
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
SELECT c.transportationNo,cargoNo,(SELECT city from city WHERE id =(SELECT city_id from circuit_transfer WHERE circuit_id=c.id ORDER BY sequence LIMIT 1)) startCity,startTime, SELECT c.transportationNo,cargoNo,(SELECT city from city WHERE id =(SELECT city_id from circuit_transfer WHERE circuit_id=c.id ORDER BY sequence LIMIT 1)) startCity,startTime,
(SELECT city from city WHERE id =(SELECT city_id from circuit_transfer WHERE circuit_id=c.id ORDER BY sequence DESC LIMIT 1)) endCity,endTime,circuitState, (SELECT city from city WHERE id =(SELECT city_id from circuit_transfer WHERE circuit_id=c.id ORDER BY sequence DESC LIMIT 1)) endCity,endTime,circuitState,
(SELECT alarmType FROM alarm WHERE id IN (SELECT alarm_id from tdl_gateway_log WHERE transportationNo=c.transportationNo)) alarmType, (SELECT alarmType FROM alarm WHERE id IN (SELECT alarm_id from tdl_gateway_log WHERE transportationNo=c.transportationNo)) alarmType,
(select GROUP_CONCAT(classify) from alarm_log al where al.transportationNo = c.transportationNo) alarm,evaluate (select GROUP_CONCAT( DISTINCT classify) from alarm_log al where al.transportationNo = c.transportationNo) alarm,evaluate,transportation
from circuit c where c.state=1 from circuit c where c.state=1
AND company_id=(SELECT id from company where companyName=#{companyName,jdbcType=VARCHAR}) AND company_id=(SELECT id from company where companyName=#{companyName,jdbcType=VARCHAR})
</select> </select>
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
SELECT c.transportationNo,cargoNo,(SELECT city from city WHERE id =(SELECT city_id from circuit_transfer WHERE circuit_id=c.id ORDER BY sequence LIMIT 1)) startCity,startTime, SELECT c.transportationNo,cargoNo,(SELECT city from city WHERE id =(SELECT city_id from circuit_transfer WHERE circuit_id=c.id ORDER BY sequence LIMIT 1)) startCity,startTime,
(SELECT city from city WHERE id =(SELECT city_id from circuit_transfer WHERE circuit_id=c.id ORDER BY sequence DESC LIMIT 1)) endCity,endTime,circuitState, (SELECT city from city WHERE id =(SELECT city_id from circuit_transfer WHERE circuit_id=c.id ORDER BY sequence DESC LIMIT 1)) endCity,endTime,circuitState,
(SELECT alarmType FROM alarm WHERE id IN (SELECT alarm_id from tdl_gateway_log WHERE transportationNo=c.transportationNo)) alarmType, (SELECT alarmType FROM alarm WHERE id IN (SELECT alarm_id from tdl_gateway_log WHERE transportationNo=c.transportationNo)) alarmType,
(select GROUP_CONCAT(classify) from alarm_log al where al.transportationNo = c.transportationNo) alarm,evaluate (select GROUP_CONCAT(DISTINCT classify) from alarm_log al where al.transportationNo = c.transportationNo) alarm,evaluate,transportation
from circuit c where c.state=1 AND company_id=(SELECT id from company where companyName=#{companyName,jdbcType=VARCHAR}) from circuit c where c.state=1 AND company_id=(SELECT id from company where companyName=#{companyName,jdbcType=VARCHAR})
<if test="circuitState!=null"> <if test="circuitState!=null">
AND circuitState=#{circuitState,jdbcType=INTEGER} AND circuitState=#{circuitState,jdbcType=INTEGER}
...@@ -163,7 +163,7 @@ ...@@ -163,7 +163,7 @@
SELECT c.transportationNo,cargoNo,(SELECT city from city WHERE id =(SELECT city_id from circuit_transfer WHERE circuit_id=c.id ORDER BY sequence LIMIT 1)) startCity,startTime, SELECT c.transportationNo,cargoNo,(SELECT city from city WHERE id =(SELECT city_id from circuit_transfer WHERE circuit_id=c.id ORDER BY sequence LIMIT 1)) startCity,startTime,
(SELECT city from city WHERE id =(SELECT city_id from circuit_transfer WHERE circuit_id=c.id ORDER BY sequence DESC LIMIT 1)) endCity,endTime,circuitState, (SELECT city from city WHERE id =(SELECT city_id from circuit_transfer WHERE circuit_id=c.id ORDER BY sequence DESC LIMIT 1)) endCity,endTime,circuitState,
(SELECT alarmType FROM alarm WHERE id IN (SELECT alarm_id from tdl_gateway_log WHERE transportationNo=c.transportationNo)) alarmType, (SELECT alarmType FROM alarm WHERE id IN (SELECT alarm_id from tdl_gateway_log WHERE transportationNo=c.transportationNo)) alarmType,
(select GROUP_CONCAT(classify) from alarm_log al where al.transportationNo = c.transportationNo) alarm,ifnull(evaluate,"") evaluate (select GROUP_CONCAT(DISTINCT classify) from alarm_log al where al.transportationNo = c.transportationNo) alarm,ifnull(evaluate,"") evaluate,transportation
from circuit c where c.state=1 from circuit c where c.state=1
AND c.transportationNo=#{transportationNo,jdbcType=VARCHAR} AND c.transportationNo=#{transportationNo,jdbcType=VARCHAR}
AND company_id=(SELECT id from company where companyName=#{companyName,jdbcType=VARCHAR}) AND company_id=(SELECT id from company where companyName=#{companyName,jdbcType=VARCHAR})
...@@ -171,7 +171,7 @@ ...@@ -171,7 +171,7 @@
<!--根据线路编号获取线路信息 app--> <!--根据线路编号获取线路信息 app-->
<select id="getByTransportationNoForApp" resultType="com.example.tdl.domain.vo.ResultCircuitForAppVo" parameterType="String"> <select id="getByTransportationNoForApp" resultType="com.example.tdl.domain.vo.ResultCircuitForAppVo" parameterType="String">
SELECT c.transportationNo,(SELECT GROUP_CONCAT(city SEPARATOR '-') city from city WHERE id in (SELECT city_id from circuit_transfer WHERE circuit_id=c.id AND sequence in (LEFT(s.sequence,1),RIGHT(s.sequence,1)))) city, SELECT c.transportationNo,CONCAT_WS("-",(SELECT city from city WHERE id =(SELECT city_id from circuit_transfer WHERE circuit_id=c.id AND sequence =LEFT(s.sequence,1))),(SELECT city from city WHERE id =(SELECT city_id from circuit_transfer WHERE circuit_id=c.id AND sequence=RIGHT(s.sequence,1)))) city,
cargoNo,plateNo,deliveryAddress,transportation,transportationType,remark cargoNo,plateNo,deliveryAddress,transportation,transportationType,remark
from circuit c,(SELECT GROUP_CONCAT(sequence) sequence from circuit_transfer where circuit_id=(SELECT id from circuit where transportationNo=#{transportationNo,jdbcType=VARCHAR})) s from circuit c,(SELECT GROUP_CONCAT(sequence) sequence from circuit_transfer where circuit_id=(SELECT id from circuit where transportationNo=#{transportationNo,jdbcType=VARCHAR})) s
where c.state=1 where c.state=1
...@@ -205,7 +205,7 @@ ...@@ -205,7 +205,7 @@
SELECT c.transportationNo,cargoNo,(SELECT city from city WHERE id =(SELECT city_id from circuit_transfer WHERE circuit_id=c.id ORDER BY sequence LIMIT 1)) startCity,startTime, SELECT c.transportationNo,cargoNo,(SELECT city from city WHERE id =(SELECT city_id from circuit_transfer WHERE circuit_id=c.id ORDER BY sequence LIMIT 1)) startCity,startTime,
(SELECT city from city WHERE id =(SELECT city_id from circuit_transfer WHERE circuit_id=c.id ORDER BY sequence DESC LIMIT 1)) endCity,endTime,circuitState, (SELECT city from city WHERE id =(SELECT city_id from circuit_transfer WHERE circuit_id=c.id ORDER BY sequence DESC LIMIT 1)) endCity,endTime,circuitState,
(SELECT alarmType FROM alarm WHERE id IN (SELECT alarm_id from tdl_gateway_log WHERE transportationNo=c.transportationNo)) alarmType, (SELECT alarmType FROM alarm WHERE id IN (SELECT alarm_id from tdl_gateway_log WHERE transportationNo=c.transportationNo)) alarmType,
(select GROUP_CONCAT(classify) from alarm_log al where al.transportationNo = c.transportationNo) alarm,evaluate (select GROUP_CONCAT(DISTINCT classify) from alarm_log al where al.transportationNo = c.transportationNo) alarm,evaluate,transportation
from circuit c where c.state=1 AND cargoNo=#{cargoNo,jdbcType=VARCHAR} from circuit c where c.state=1 AND cargoNo=#{cargoNo,jdbcType=VARCHAR}
AND company_id=(SELECT id from company where companyName=#{companyName,jdbcType=VARCHAR}) AND company_id=(SELECT id from company where companyName=#{companyName,jdbcType=VARCHAR})
</select> </select>
...@@ -216,7 +216,7 @@ ...@@ -216,7 +216,7 @@
SELECT c.transportationNo,cargoNo,(SELECT city from city WHERE id =(SELECT city_id from circuit_transfer WHERE circuit_id=c.id ORDER BY sequence LIMIT 1)) startCity,startTime, SELECT c.transportationNo,cargoNo,(SELECT city from city WHERE id =(SELECT city_id from circuit_transfer WHERE circuit_id=c.id ORDER BY sequence LIMIT 1)) startCity,startTime,
(SELECT city from city WHERE id =(SELECT city_id from circuit_transfer WHERE circuit_id=c.id ORDER BY sequence DESC LIMIT 1)) endCity,endTime,circuitState, (SELECT city from city WHERE id =(SELECT city_id from circuit_transfer WHERE circuit_id=c.id ORDER BY sequence DESC LIMIT 1)) endCity,endTime,circuitState,
(SELECT alarmType FROM alarm WHERE id IN (SELECT alarm_id from tdl_gateway_log WHERE transportationNo=c.transportationNo)) alarmType, (SELECT alarmType FROM alarm WHERE id IN (SELECT alarm_id from tdl_gateway_log WHERE transportationNo=c.transportationNo)) alarmType,
(select GROUP_CONCAT(classify) from alarm_log al where al.transportationNo = c.transportationNo) alarm,evaluate (select GROUP_CONCAT(DISTINCT classify) from alarm_log al where al.transportationNo = c.transportationNo) alarm,evaluate,transportation
from circuit c where c.state=1 AND circuitState=#{circuitState,jdbcType=INTEGER} from circuit c where c.state=1 AND circuitState=#{circuitState,jdbcType=INTEGER}
AND company_id=(SELECT id from company where companyName=#{companyName,jdbcType=VARCHAR}) AND company_id=(SELECT id from company where companyName=#{companyName,jdbcType=VARCHAR})
</select> </select>
...@@ -243,7 +243,7 @@ ...@@ -243,7 +243,7 @@
SELECT c.transportationNo,cargoNo,(SELECT city from city WHERE id =(SELECT city_id from circuit_transfer WHERE circuit_id=c.id ORDER BY sequence LIMIT 1)) startCity,startTime, SELECT c.transportationNo,cargoNo,(SELECT city from city WHERE id =(SELECT city_id from circuit_transfer WHERE circuit_id=c.id ORDER BY sequence LIMIT 1)) startCity,startTime,
(SELECT city from city WHERE id =(SELECT city_id from circuit_transfer WHERE circuit_id=c.id ORDER BY sequence DESC LIMIT 1)) endCity,endTime,circuitState, (SELECT city from city WHERE id =(SELECT city_id from circuit_transfer WHERE circuit_id=c.id ORDER BY sequence DESC LIMIT 1)) endCity,endTime,circuitState,
(SELECT alarmType FROM alarm WHERE id IN (SELECT alarm_id from tdl_gateway_log WHERE transportationNo=c.transportationNo)) alarmType, (SELECT alarmType FROM alarm WHERE id IN (SELECT alarm_id from tdl_gateway_log WHERE transportationNo=c.transportationNo)) alarmType,
(select GROUP_CONCAT(classify) from alarm_log al where al.transportationNo = c.transportationNo) alarm,evaluate (select GROUP_CONCAT(DISTINCT classify) from alarm_log al where al.transportationNo = c.transportationNo) alarm,evaluate,transportation
from circuit c where c.state=1 from circuit c where c.state=1
AND company_id=(SELECT id from company where companyName=#{companyName,jdbcType=VARCHAR}) AND company_id=(SELECT id from company where companyName=#{companyName,jdbcType=VARCHAR})
AND DATE_SUB(CURDATE(), INTERVAL #{time,jdbcType=VARCHAR} DAY) &lt;= date(FROM_UNIXTIME(createTime/1000,'%Y-%m-%d %H:%i:%s')) AND DATE_SUB(CURDATE(), INTERVAL #{time,jdbcType=VARCHAR} DAY) &lt;= date(FROM_UNIXTIME(createTime/1000,'%Y-%m-%d %H:%i:%s'))
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
<!--绑定回复--> <!--绑定回复-->
<update id="bindiSuccess"> <update id="bindiSuccess">
update config set resp=#{resp,jdbcType=INTEGER},flag=true update config set resp=#{resp,jdbcType=INTEGER}
where gSN= #{gSN,jdbcType=VARCHAR} where gSN= #{gSN,jdbcType=VARCHAR}
and gType=#{gType,jdbcType=VARCHAR} and gType=#{gType,jdbcType=VARCHAR}
and state = 1; and state = 1;
......
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