Commit 7f3645d4 authored by zhuangzhuang's avatar zhuangzhuang

5.17--springboot整合国际化,优化公司查询接口

parent 7b679b6f
......@@ -20,6 +20,8 @@ public class CircuitMessageVo {
private String SN;//网关编号
private String battery;
private List<ResultCityVo> list;
private List<ResultAlarmLog> alarmLogList;
......@@ -59,7 +61,7 @@ public class CircuitMessageVo {
public CircuitMessageVo() {
}
public CircuitMessageVo(String transportationNo, String routeName, String cargoName, String plateNo, String transportation, String evaluate, String alarmType, String SN, List<ResultAlarmLog> alarmLogList) {
public CircuitMessageVo(String transportationNo, String routeName, String cargoName, String plateNo, String transportation, String evaluate, String alarmType, String SN, List<ResultAlarmLog> alarmLogList) {
this.transportationNo = transportationNo;
this.routeName = routeName;
this.cargoName = cargoName;
......@@ -111,14 +113,6 @@ public class CircuitMessageVo {
this.transportation = transportation;
}
public String getAlarmType() {
return alarmType;
}
public void setAlarmType(String alarmType) {
this.alarmType = alarmType;
}
public String getEvaluate() {
return evaluate;
}
......@@ -127,6 +121,14 @@ public class CircuitMessageVo {
this.evaluate = evaluate;
}
public String getAlarmType() {
return alarmType;
}
public void setAlarmType(String alarmType) {
this.alarmType = alarmType;
}
public String getSN() {
return SN;
}
......@@ -135,6 +137,14 @@ public class CircuitMessageVo {
this.SN = SN;
}
public String getBattery() {
return battery;
}
public void setBattery(String battery) {
this.battery = battery;
}
public List<ResultCityVo> getList() {
return list;
}
......
package com.example.tdl.domain.vo;
public class CircuitResultVo {
private String transportationNo;
private String cargoNo;//货物编号
private String cargoName;
private String startCity;
private Long startTime;
private String endCity;
private Long endTime;
private Integer circuitState;
private String alarmType;
private String alarm;
private String evaluate;
private String transportation;
private String plateNo;
private String gSN;
private String gType;
public String getTransportationNo() {
return transportationNo;
}
public void setTransportationNo(String transportationNo) {
this.transportationNo = transportationNo;
}
public String getCargoNo() {
return cargoNo;
}
public void setCargoNo(String cargoNo) {
this.cargoNo = cargoNo;
}
public String getCargoName() {
return cargoName;
}
public void setCargoName(String cargoName) {
this.cargoName = cargoName;
}
public String getStartCity() {
return startCity;
}
public void setStartCity(String startCity) {
this.startCity = startCity;
}
public Long getStartTime() {
return startTime;
}
public void setStartTime(Long startTime) {
this.startTime = startTime;
}
public String getEndCity() {
return endCity;
}
public void setEndCity(String endCity) {
this.endCity = endCity;
}
public Long getEndTime() {
return endTime;
}
public void setEndTime(Long endTime) {
this.endTime = endTime;
}
public Integer getCircuitState() {
return circuitState;
}
public void setCircuitState(Integer circuitState) {
this.circuitState = circuitState;
}
public String getAlarmType() {
return alarmType;
}
public void setAlarmType(String alarmType) {
this.alarmType = alarmType;
}
public String getAlarm() {
return alarm;
}
public void setAlarm(String alarm) {
this.alarm = alarm;
}
public String getEvaluate() {
return evaluate;
}
public void setEvaluate(String evaluate) {
this.evaluate = evaluate;
}
public String getTransportation() {
return transportation;
}
public void setTransportation(String transportation) {
this.transportation = transportation;
}
public String getPlateNo() {
return plateNo;
}
public void setPlateNo(String plateNo) {
this.plateNo = plateNo;
}
public String getgSN() {
return gSN;
}
public void setgSN(String gSN) {
this.gSN = gSN;
}
public String getgType() {
return gType;
}
public void setgType(String gType) {
this.gType = gType;
}
}
package com.example.tdl.domain.vo;
public class GatewaySNVo {
private String SN;
public String getSN() {
return SN;
}
public void setSN(String SN) {
this.SN = SN;
}
}
......@@ -2,10 +2,19 @@ package com.example.tdl.domain.vo;
public class HistogramData {
private String classify;
private Integer count;
public HistogramData() {
}
public HistogramData(String classify, Integer count) {
this.classify = classify;
this.count = count;
}
public String getClassify() {
return classify;
}
......
package com.example.tdl.domain.vo;
public class OnlineVo {
private Integer online;
public Integer getOnline() {
return online;
}
public void setOnline(Integer online) {
this.online = online;
}
}
package com.example.tdl.domain.vo;
public class TdlSNVo {
private String TDLSN;
public String getTDLSN() {
return TDLSN;
}
public void setTDLSN(String TDLSN) {
this.TDLSN = TDLSN;
}
}
......@@ -20,7 +20,11 @@ public class AlarmLog {
private String classify;
public AlarmLog( String transportationNo, String startCity, String endCity, String TDLSN, String description, Float data, Long alarmTime, String classify) {
private String desp;
private Integer alarmNo;
public AlarmLog( String transportationNo, String startCity, String endCity, String TDLSN, String description, Float data, Long alarmTime, String classify, String desp, Integer alarmNo) {
this.transportationNo = transportationNo;
this.startCity = startCity;
this.endCity = endCity;
......@@ -29,6 +33,8 @@ public class AlarmLog {
this.data = data;
this.alarmTime = alarmTime;
this.classify = classify;
this.desp = desp;
this.alarmNo = alarmNo;
}
public Integer getId() {
......@@ -102,4 +108,20 @@ public class AlarmLog {
public void setClassify(String classify) {
this.classify = classify;
}
public String getDesp() {
return desp;
}
public void setDesp(String desp) {
this.desp = desp;
}
public Integer getAlarmNo() {
return alarmNo;
}
public void setAlarmNo(Integer alarmNo) {
this.alarmNo = alarmNo;
}
}
......@@ -42,7 +42,7 @@ public class LoginInterceptor implements HandlerInterceptor {
ps.write("{\"code\":2,\"message\":\"用户登录过期,请重新登录\"}".getBytes("UTF-8"));
return false;
}
redisService.refeshTimeOut("TOKEN_" +token,60 * 30);
redisService.refeshTimeOut("TOKEN_" +token,60 * 60 *24);
return true;
}
......
......@@ -9,7 +9,7 @@ import java.util.Map;
@Mapper
public interface CircuitMapper {
List<ResultCircuitVo> getAll(String companyName);
List<CircuitResultVo> getAll(String companyName);
List<ResultCircuitVo> getByTerm(CircuitTermVo circuitTermVo);
......
package com.example.tdl.mapper;
import com.example.tdl.domain.vo.GatewaySNVo;
import com.example.tdl.domain.vo.GatewayState;
import com.example.tdl.domain.vo.ResultGatewayVo;
import com.example.tdl.domain.vo.UpdateGatewayVo;
......@@ -30,4 +31,6 @@ public interface GatewayMapper {
Integer updateState(GatewayState gatewayState);
String getTransportationNo(@Param("SN") String SN,@Param("type") String type);
List<GatewaySNVo> getUnusedGateway(String SN);
}
package com.example.tdl.mapper;
import com.example.tdl.domain.vo.AddTDLDeviceVo;
import com.example.tdl.domain.vo.ResultTDLDeviceVo;
import com.example.tdl.domain.vo.TDLDeviceTermVo;
import com.example.tdl.domain.vo.UpdateTDLDeviceVo;
import com.example.tdl.domain.vo.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
......@@ -29,4 +26,6 @@ public interface TDLDeviceMapper {
List<String> getTdlSN(@Param("SN") String SN, @Param("type") String type);
String getTdl(@Param("SN") String SN, @Param("type") String type);
List<TdlSNVo> getUnusedTDL(String TDLSN);
}
......@@ -15,6 +15,9 @@ public interface UserMapper {
List<ResultUserVo> getAll(String companyName);
List<ResultUserVo> getAllUser();
List<ResultUserVo> getByTerm(UserTermVo userTermVo);
ResultUserVo getByPhone(@Param("phone") String phone,@Param("companyName") String companyName);
......
......@@ -214,13 +214,17 @@ public class MqttListener implements MqttCallback {
return 0;//休眠
}
CheckInVo checkInVo = new Gson().fromJson(message,CheckInVo.class);
if(checkInVo.getDevList().size()==0){
ConfigCMDVo configCMDVo = new Gson().fromJson(configVo.getMessage(),ConfigCMDVo.class);
if(configCMDVo == null){
return 0;//休眠
}
if(checkInVo.getDevList().size()==0 && configCMDVo !=null ){
return 1;//重发
}
if(configVo.getUntie() && StringUtils.isEmpty(configVo.getMessage()) ){
return 2;//解绑
}
ConfigCMDVo configCMDVo = new Gson().fromJson(configVo.getMessage(),ConfigCMDVo.class);
//判断两者的devList是否一致
if (configCMDVo.getDevList().containsAll(checkInVo.getDevList())
&& checkInVo.getDevList().containsAll(configCMDVo.getDevList())
......
......@@ -14,7 +14,7 @@ public class CircuitService {
@Autowired
private CircuitMapper circuitMapper;
public List<ResultCircuitVo> getAll(String companyName){
public List<CircuitResultVo> getAll(String companyName){
return circuitMapper.getAll(companyName);
}
......
......@@ -54,4 +54,8 @@ public class GatewayService {
public String getTransportationNo(String SN,String type){
return gatewayMapper.getTransportationNo(SN,type);
}
public List<GatewaySNVo> getUnusedGateway(String SN){
return gatewayMapper.getUnusedGateway(SN);
}
}
package com.example.tdl.service;
import com.example.tdl.domain.vo.AddTDLDeviceVo;
import com.example.tdl.domain.vo.ResultTDLDeviceVo;
import com.example.tdl.domain.vo.TDLDeviceTermVo;
import com.example.tdl.domain.vo.UpdateTDLDeviceVo;
import com.example.tdl.domain.vo.*;
import com.example.tdl.mapper.TDLDeviceMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -50,4 +47,8 @@ public class TDLDeviceService {
public String getTdl(String SN,String type){
return tdlDeviceMapper.getTdl(SN,type);
}
public List<TdlSNVo> getUnusedTDL(String TDLSN){
return tdlDeviceMapper.getUnusedTDL(TDLSN);
}
}
......@@ -34,6 +34,10 @@ public class UserService {
return userMapper.getAll(companyName);
}
public List<ResultUserVo> getAllUser(){
return userMapper.getAllUser();
}
public List<ResultUserVo> getByTerm(UserTermVo userTermVo){
return userMapper.getByTerm(userTermVo);
}
......
......@@ -47,6 +47,9 @@ public class AlarmLogController {
@Autowired
private CompanyService companyService;
@Autowired
private I18nController i18n;
//获取报警信息
@ApiOperation(value = "获取报警信息",notes = "获取报警信息" +
" transportationNo:运输编号" +
......@@ -63,6 +66,7 @@ public class AlarmLogController {
" alarmTime:报警时间" )
@ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
@ApiImplicitParam(paramType="header", name = "AccountLanguage", value = "language", required = false, dataType = "String"),
})
@PostMapping("/getAlarm")
public Object getAlarm(@RequestBody AlarmTermVo alarmTermVo ,HttpServletRequest request){
......@@ -99,6 +103,7 @@ public class AlarmLogController {
"alarmTime:报警时间" )
@ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
@ApiImplicitParam(paramType="header", name = "AccountLanguage", value = "language", required = false, dataType = "String"),
})
@PostMapping("/getRealTimeAlarm")
public Object getRealTimeAlarm(HttpServletRequest request){
......@@ -114,6 +119,7 @@ public class AlarmLogController {
"password:密码" )
@ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
@ApiImplicitParam(paramType="header", name = "AccountLanguage", value = "language", required = false, dataType = "String"),
})
@GetMapping("/getAlarmMessage")
public String getAlarmMessage(HttpServletRequest request){
......@@ -158,26 +164,30 @@ public class AlarmLogController {
String transportationNo = gatewayService.getTransportationNo(addAlarmLogVo.getGsn(),addAlarmLogVo.getGtype());
//获取终点,起点
ResultCircuitVo resultCircuitVo = circuitService.getCircuit(transportationNo);
for(int i = 0;i<addAlarmLogVo.getAlarm().size();i++){
for(int i = 0,length=addAlarmLogVo.getAlarm().size();i<length;i++){
if(addAlarmLogVo.getAlarm().get(i).getAlarmno() !=null && addAlarmLogVo.getAlarm().get(i).getAlarmno() == 0){
continue;
}
String classify="";
String desp = "";
if(addAlarmLogVo.getAlarm().get(i).getAlias().contains("T")){
desp = "温度" +map.get(addAlarmLogVo.getAlarm().get(i).getAlarmno());
classify = "1";
} else if(addAlarmLogVo.getAlarm().get(i).getDesp().contains("h")){
} else if(addAlarmLogVo.getAlarm().get(i).getAlias().contains("h")){
desp = "湿度" +map.get(addAlarmLogVo.getAlarm().get(i).getAlarmno());
classify = "2";
} else if(addAlarmLogVo.getAlarm().get(i).getDesp().contains("a0")){
} else if(addAlarmLogVo.getAlarm().get(i).getAlias().contains("a0")){
desp = "震动" +map.get(addAlarmLogVo.getAlarm().get(i).getAlarmno());
classify = "3";
} else if(addAlarmLogVo.getAlarm().get(i).getDesp().contains("ta")){
desp = "倾角" +map.get(addAlarmLogVo.getAlarm().get(i).getAlarmno());
} else if(addAlarmLogVo.getAlarm().get(i).getAlias().contains("ta")) {
desp = "倾角" + map.get(addAlarmLogVo.getAlarm().get(i).getAlarmno());
classify = "4";
} else if(addAlarmLogVo.getAlarm().get(i).getDesp().contains("离线")){
desp = addAlarmLogVo.getAlarm().get(i).getTdlsn()+"离线";
classify = "6";
}
AlarmLog alarmLog = new AlarmLog(transportationNo,resultCircuitVo.getStartCity(),resultCircuitVo.getEndCity(),addAlarmLogVo.getAlarm().get(i).getTdlsn().replace("TDL-","").trim(),desp,addAlarmLogVo.getAlarm().get(i).getValue(),addAlarmLogVo.getAlarm().get(i).getTs()*1000,classify);
// else if(addAlarmLogVo.getAlarm().get(i).getAlias().contains("离线")){
// desp = addAlarmLogVo.getAlarm().get(i).getTdlsn()+"离线";
// classify = "6";
// }
AlarmLog alarmLog = new AlarmLog(transportationNo,resultCircuitVo.getStartCity(),resultCircuitVo.getEndCity(),addAlarmLogVo.getAlarm().get(i).getTdlsn().replace("TDL-","").trim(),desp,addAlarmLogVo.getAlarm().get(i).getValue(),addAlarmLogVo.getAlarm().get(i).getTs()*1000,classify,addAlarmLogVo.getAlarm().get(i).getDesp(),addAlarmLogVo.getAlarm().get(i).getAlarmno());
int a = alarmLogServcie.addAlarmLog(alarmLog);
if(a == 0){
fb.setCode(0);
......@@ -189,5 +199,4 @@ public class AlarmLogController {
}
return gson.toJson(fb);
}
}
......@@ -37,6 +37,9 @@ public class CircuitTransferController {
@Autowired
private TokenRedisService tokenRedisService;
@Autowired
private I18nController i18n;
//修改线路途径地到达时间
@ApiOperation(value = "修改线路途径地到达时间",notes = "修改线路途径地到达时间,修改所需要传的参数:" +
......
......@@ -66,6 +66,9 @@ public class DataController {
@Autowired
private ProbesService probesService;
@Autowired
private I18nController i18n;
private final static String database ="original";
private List<String> list = new ArrayList<String>(){{
......@@ -83,7 +86,8 @@ public class DataController {
" lat: 纬度.")
@PostMapping("/getLocation")
@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"),
@ApiImplicitParam(paramType="header", name = "AccountLanguage", value = "language", required = false, dataType = "String"),
})
public Object getLocation(@RequestBody String transportationNo,HttpServletRequest request){
String token = request.getHeader("Account_token");
......@@ -182,12 +186,14 @@ public class DataController {
" ")
@PostMapping("/getHistoryData")
@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"),
@ApiImplicitParam(paramType="header", name = "AccountLanguage", value = "language", required = false, dataType = "String"),
})
public Object getHistoryData(@RequestBody String transportationNo,HttpServletRequest request){
String token = request.getHeader("Account_token");
String datum = tokenRedisService.get("TOKEN_" +token);
UserRedisVo user = gson.fromJson(datum,UserRedisVo.class);
String port = request.getHeader("AccountLanguage");
logger.info("" +System.currentTimeMillis());
logger.info("" + Calendar.getInstance().getTimeInMillis());
JSONObject jsonObject= JSON.parseObject(transportationNo);
......@@ -195,18 +201,18 @@ public class DataController {
List<DataVo> dataVoList = new ArrayList<>();
if(StringUtils.isEmpty(transportationNo)){
fb.setCode(0);
fb.setMessage("运输编号不能为空");
fb.setMessage(i18n.getMessage(request,"transportationNo"));
return gson.toJson(fb);
}
ResultCircuitVo resultCircuitVo = circuitService.getByTransportationNo(transportationNo,user.getCompanyName());
if(resultCircuitVo ==null){
fb.setCode(0);
fb.setMessage("该运输编号不存在");
fb.setMessage(i18n.getMessage(request,"noCircuit"));
return gson.toJson(fb);
}
if(resultCircuitVo.getStartTime() == null || resultCircuitVo.getStartTime() == 0){
fb.setCode(0);
fb.setMessage("该线路未开始运输");
fb.setMessage(i18n.getMessage(request,"notStarted"));
return gson.toJson(fb);
}
Long startTime = resultCircuitVo.getStartTime() *1000000l;
......@@ -216,7 +222,7 @@ public class DataController {
TDLLogVo gatewayVo = tdlLogService.getByTransportationNo(transportationNo);
if(gatewayVo == null){
fb.setCode(0);
fb.setMessage("该运输编号不存在");
fb.setMessage(i18n.getMessage(request,"noCircuit"));
return gson.toJson(fb);
}
String device = gatewayVo.getgType() +"_" +gatewayVo.getgSN();
......@@ -224,7 +230,7 @@ public class DataController {
List<String> devList= tdlLogService.getTdlSN(transportationNo);
if(devList.size() == 0){
fb.setCode(0);
fb.setMessage("没有数据");
fb.setMessage(i18n.getMessage(request,"noCircuit"));
return gson.toJson(fb);
}
Map<String,String> map = new HashMap<>();
......@@ -252,7 +258,7 @@ public class DataController {
List<HistoryData> historyData = new ArrayList<>();
if(queryResult.getResults().get(0).getSeries() != null){
//解析数据
historyData = getHistoryData(queryResult);
historyData = getHistoryData(queryResult,list.get(j));
}
historyDataVo.setDataList(historyData);
historyDataVoList.add(historyDataVo);
......@@ -269,6 +275,7 @@ public class DataController {
}
}
//获取温度数据
@ApiOperation(value = "获取温度数据",notes = "获取温度数据:" +
" TDLSN:tdl编号," +
......@@ -277,7 +284,7 @@ public class DataController {
" value:温度数据.")
@PostMapping("/getTemperature")
@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"),
})
public Object getTemperature(@RequestBody String transportationNo,HttpServletRequest request){
String token = request.getHeader("Account_token");
......@@ -319,11 +326,12 @@ public class DataController {
return gson.toJson(temperatures);
}
//获取湿度数据
@ApiOperation(value = "获取湿度数据",notes = "获取湿度数据:")
@PostMapping("/getHumidity")
@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"),
})
public Object getHumidity(@RequestBody String transportationNo,HttpServletRequest request){
String token = request.getHeader("Account_token");
......@@ -365,11 +373,12 @@ public class DataController {
return gson.toJson(humidities);
}
//获取倾斜度数据
@ApiOperation(value = "获取倾斜度数据",notes = "获取倾斜度数据")
@PostMapping("/getTiltAngle")
@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"),
})
public Object getTiltAngle(@RequestBody String transportationNo,HttpServletRequest request){
String token = request.getHeader("Account_token");
......@@ -410,6 +419,8 @@ public class DataController {
return gson.toJson(tiltAngles);
}
//获取震动能量
@ApiOperation(value = "获取震动能量",notes = "获取震动能量")
@PostMapping("/getShockEnergy")
......@@ -463,22 +474,35 @@ public class DataController {
List<LocationDataVo> historyDataList = new ArrayList<>();
for(List<Object> value:values){
LocationDataVo historyData = new LocationDataVo();
historyData.setTime(parseTime(value.get(0).toString()));
historyData.setLng(Double.parseDouble(value.get(1).toString()));
historyData.setLat(Double.parseDouble(value.get(2).toString()));
historyData.setError(0);
if(value.get(1).toString().equals("0.0")){
continue;
}else{
historyData.setTime(parseTime(value.get(0).toString()));
historyData.setLng(Double.parseDouble(value.get(1).toString()));
historyData.setLat(Double.parseDouble(value.get(2).toString()));
historyData.setError(0);
}
historyDataList.add(historyData);
}
return historyDataList;
}
public List<HistoryData> getHistoryData(QueryResult queryResult){
public List<HistoryData> getHistoryData(QueryResult queryResult,String alias){
List<List<Object>> values = getValues(queryResult);
List<HistoryData> historyDataList = new ArrayList<>();
for(List<Object> value:values){
HistoryData historyData = new HistoryData();
historyData.setTime(parseTime(value.get(0).toString()));
historyData.setValue(value.get(1)==null ? "" :value.get(1).toString());
if(alias.contains("a0")){
if(value.get(1)!=null && Double.valueOf(value.get(1).toString()) >0 && Double.valueOf(value.get(1).toString())<588897){
historyData.setValue(value.get(1)==null ? "" :value.get(1).toString());
}else{
continue;
}
}else{
historyData.setValue(value.get(1)==null ? "" :value.get(1).toString());
}
historyDataList.add(historyData);
}
return historyDataList;
......@@ -918,6 +942,4 @@ public class DataController {
// }
// return gson.toJson(liveDataVos);
// }
}
\ No newline at end of file
......@@ -57,6 +57,9 @@ public class EquipmentBindingController {
@Autowired
private TokenRedisService tokenRedisService;
@Autowired
private I18nController i18n;
List<String> list = new ArrayList<String>(){{
add("T");
add("h");
......@@ -125,7 +128,7 @@ public class EquipmentBindingController {
msg.put("msg",map.get("msg"));
if (msg.get("msg").equals("配置网关成功")){
fb.setCode(1);
fb.setMessage(msg.get("msg").toString());
fb.setMessage("配置网关成功");
//根据报警类型货报警信息
ResultAlarmVo alarmVo = alarmService.getByTypeAndScene(bindingVo.getAlarmType(),"运输",user.getCompanyName());
for(String alias :list){
......@@ -142,12 +145,12 @@ public class EquipmentBindingController {
alarmRuleVo.setMode("twoway");
alarmRuleVo.setPriority("1");
}else if(alias.equals("ta")){
alarmRuleVo.setMinval(String.valueOf(alarmVo.getTilt()));
alarmRuleVo.setMode("equal");
alarmRuleVo.setMaxval(String.valueOf(alarmVo.getTilt()));
alarmRuleVo.setMode("greater");
alarmRuleVo.setPriority("1");
}else if(alias.equals("a0")){
alarmRuleVo.setMinval(String.valueOf(alarmVo.getShock()));
alarmRuleVo.setMode("equal");
alarmRuleVo.setMaxval(String.valueOf(alarmVo.getShock()));
alarmRuleVo.setMode("greater");
alarmRuleVo.setPriority("1");
}
alarmRuleVos.add(alarmRuleVo);
......@@ -168,6 +171,11 @@ public class EquipmentBindingController {
})
@PostMapping("/untie")
public Object untie(@RequestBody String TDLSN){
if(StringUtils.isEmpty(TDLSN)){
fb.setCode(0);
fb.setMessage("TDL序列号不能为空");
return gson.toJson(fb);
}
JSONObject jsonObject= JSON.parseObject(TDLSN);
TDLSN=(String)jsonObject.get("TDLSN");
//判断当前tdl是否有网关在使用
......@@ -194,12 +202,14 @@ public class EquipmentBindingController {
msg.put("msg",map.get("msg"));
if (msg.get("msg").equals("解除网关成功")){
fb.setCode(1);
fb.setMessage(msg.get("msg").toString());
fb.setMessage("解除网关成功");
String key ="TDL/"+resultTDLDeviceVo.getGatewayType()+"/" +resultTDLDeviceVo.getGatewaySN() +"/Data";
alarmRedisService.delKey(key);
}else{
fb.setCode(0);
fb.setMessage(msg.get("msg").toString());
fb.setMessage("解除网关失败");
}
return gson.toJson(fb);
}
......
package com.example.tdl.web;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.example.tdl.domain.dto.CommFeedback;
import com.example.tdl.domain.vo.*;
import com.example.tdl.service.*;
......@@ -21,6 +23,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
......@@ -54,6 +57,9 @@ public class GatewayController {
@Autowired
private TopicConfigService topicConfigService;
@Autowired
private I18nController i18n;
//查询所有网关信息
@ApiOperation(value = "查询所有网关信息",notes = "查询所有网关信息:" +
......@@ -88,7 +94,7 @@ public class GatewayController {
}
if(!addGatewayVo.getSN().matches("^[0-9]{8}$")){
fb.setCode(0);
fb.setMessage("gateway编号必须是数字");
fb.setMessage("gateway编号必须是8位数字");
return gson.toJson(fb);
}
if (StringUtils.isEmpty(addGatewayVo.getName())){
......@@ -149,22 +155,22 @@ public class GatewayController {
public Object updateGateway(@RequestBody UpdateGatewayVo updateGatewayVo){
if (StringUtils.isEmpty(updateGatewayVo.getSN())){
fb.setCode(0);
fb.setMessage("修改的SN不能为空");
fb.setMessage("编号不能为空");
return gson.toJson(fb);
}
if (StringUtils.isEmpty(updateGatewayVo.getName())){
fb.setCode(0);
fb.setMessage("修改的名字不能为空");
fb.setMessage("名字不能为空");
return gson.toJson(fb);
}
if (StringUtils.isEmpty(updateGatewayVo.getType())){
fb.setCode(0);
fb.setMessage("修改的类型不能为空");
fb.setMessage("类型不能为空");
return gson.toJson(fb);
}
if (gatewayService.getBySNAndType(updateGatewayVo.getSN(),updateGatewayVo.getType())==null){
fb.setCode(0);
fb.setMessage("修改的设备不存在");
fb.setMessage("该网关不存在");
return gson.toJson(fb);
}
// ResultGatewayVo resultGatewayVo=gatewayService.getBySNAndType(updateGatewayVo.getSN(),updateGatewayVo.getType());
......@@ -276,7 +282,7 @@ public class GatewayController {
boolean state = gatewayService.getBySNAndType(deployProbesVo.getSN(),deployProbesVo.getType()).getState();
if(state){
fb.setCode(0);
fb.setMessage("设备在挂载,请先卸载设备");
fb.setMessage("设备在挂载");
return gson.toJson(fb);
}
Map<Object,Object> map=new HashMap<>();
......@@ -309,14 +315,14 @@ public class GatewayController {
public String setState(@RequestBody GatewayState device){
if (device.getbConfig() == false) {
fb.setCode(0);
fb.setMessage("该设备未配置通道。");
fb.setMessage("该网关未配置通道");
return gson.toJson(fb);
}
//根据设备的SN,TYPE获取所有通道
List<ResultProbesVo> list = probesService.getProbesByGateway(device.getSN(),device.getType());
if (list.size() == 0) {
fb.setCode(0);
fb.setMessage("该设备没有通道,请先增加通道。");
fb.setMessage("该网关未配置通道");
return gson.toJson(fb);
}
DeviceConfigVo deviceConfig = new DeviceConfigVo();
......@@ -388,4 +394,23 @@ public class GatewayController {
return gson.toJson(fb);
}
//获取未使用的网关
@ApiOperation(value = "获取未使用的网关",notes = "获取未使用的网关,传值说明:" +
" gSN:需要查询的网关序列号")
@ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
})
@RequestMapping(value = "/getUnusedGateway",method = RequestMethod.POST)
public Object getUnusedGateway(@RequestBody String gSN, HttpServletRequest request){
if(StringUtils.isEmpty(gSN)){
fb.setCode(0);
fb.setMessage(i18n.getMessage(request,"gateway"));
return gson.toJson(fb);
}
JSONObject jsonObject= JSON.parseObject(gSN);
gSN=(String)jsonObject.get("gSN");
return gatewayService.getUnusedGateway(gSN);
}
}
......@@ -8,6 +8,7 @@ import com.example.tdl.service.AlarmLogService;
import com.example.tdl.service.CircuitService;
import com.example.tdl.service.TDLLogService;
import com.example.tdl.service.redis.InfoRedisService;
import com.example.tdl.service.redis.TokenRedisService;
import com.google.gson.Gson;
import io.swagger.annotations.ApiImplicitParam;
......@@ -52,8 +53,15 @@ public class HomePageController {
@Autowired
private TokenRedisService tokenRedisService;
@Autowired
private InfoRedisService infoRedisService;
private final static String database ="original";
@Autowired
private I18nController i18n;
//获取当天所有的设备数据
@ApiOperation(value = "获取所有的运输数据",notes = "获取运输设备数据:" +
"sum:总数量;" +
......@@ -84,6 +92,7 @@ public class HomePageController {
@PostMapping("/getAll")
@ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
@ApiImplicitParam(paramType="header", name = "AccountLanguage", value = "language", required = false, dataType = "String"),
})
public Object getAll(@RequestBody String time, HttpServletRequest request){
String token = request.getHeader("Account_token");
......@@ -103,10 +112,10 @@ public class HomePageController {
dataVo.setBump(alarmLogServcie.getBumpCount(time,user.getCompanyName())); //获取颠簸数量
dataVo.setAlarmLogVoList(alarmLogServcie.getAlarmLog(time,user.getCompanyName()));//报警列表
List<HistogramData> list = alarmLogServcie.getByCount(time,user.getCompanyName());//获取报警柱状图
dataVo.setHistogramDataList(list);
//获取设备的当前位置
List<ResultCircuitVo> circuitVos = circuitService.getByTime(user.getCompanyName());
List<CircuitVo> circuitList = new ArrayList<>();
Integer num = 0;
for(int i = 0;i<circuitVos.size();i++){
CircuitVo circuitVo = new CircuitVo();
circuitVo.setTransportationNo(circuitVos.get(i).getTransportationNo());
......@@ -115,19 +124,21 @@ public class HomePageController {
circuitVo.setEndCity(circuitVos.get(i).getEndCity());
circuitVo.setStartTime(circuitVos.get(i).getStartTime());
circuitVo.setEndTime(circuitVos.get(i).getEndTime());
ResultGatewayVo gatewayVo = new ResultGatewayVo();
ResultGatewayVo gatewayVo = tdlLogService.getByNo(circuitVos.get(i).getTransportationNo());
String device = gatewayVo.getType() + "_" + gatewayVo.getSN();
Object data = infoRedisService.getHash("DeviceOnline", device );
if(data !=null){
OnlineVo onlineVo = gson.fromJson(data.toString(),OnlineVo.class);
if(onlineVo.getOnline() == 0){
num =num +1;
}
}
if (circuitVos.get(i).getStartTime() == null || circuitVos.get(i).getStartTime() == 0) {
circuitList.add(circuitVo);
} else {
if(circuitVos.get(i).getEndTime() == null ||circuitVos.get(i).getEndTime() == 0 ){
gatewayVo = circuitService.getByNo(circuitVos.get(i).getTransportationNo());
}else{
gatewayVo = tdlLogService.getByNo(circuitVos.get(i).getTransportationNo());
}
if(gatewayVo==null){
circuitList.add(circuitVo);
}else {
String device = gatewayVo.getType() + "_" + gatewayVo.getSN();
Long startTime = circuitVos.get(i).getStartTime() * 1000000l;
String sql = "";
if (circuitVos.get(i).getEndTime() == null || circuitVos.get(i).getEndTime() == 0) {
......@@ -137,7 +148,6 @@ public class HomePageController {
}
QueryResult queryResult = influxDBTemplate.query(new Query(sql, database));
if (queryResult.getResults().get(0).getSeries() != null) {
circuitVo.setTime(parseTime(queryResult.getResults().get(0).getSeries().get(0).getValues().get(0).get(0).toString()));
circuitVo.setLng(queryResult.getResults().get(0).getSeries().get(0).getValues().get(0).get(1).toString());
circuitVo.setLat(queryResult.getResults().get(0).getSeries().get(0).getValues().get(0).get(2).toString());
......@@ -146,6 +156,8 @@ public class HomePageController {
}
}
}
list.add(new HistogramData("6",num));
dataVo.setHistogramDataList(list);
dataVo.setCircuitList(circuitList);
return gson.toJson(dataVo);
}
......@@ -160,6 +172,7 @@ public class HomePageController {
@PostMapping("/getAllForAPP")
@ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
@ApiImplicitParam(paramType="header", name = "AccountLanguage", value = "language", required = false, dataType = "String"),
})
public Object getAllForAPP(HttpServletRequest request){
String token = request.getHeader("Account_token");
......
package com.example.tdl.web;
import java.util.Locale;
import javax.servlet.http.HttpServletRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.MessageSource;
import org.springframework.context.NoSuchMessageException;
import org.springframework.context.support.ReloadableResourceBundleMessageSource;
import org.springframework.stereotype.Controller;
@Controller
public class I18nController {
private static final Logger LOGGER = LoggerFactory.getLogger(I18nController.class);
private MessageSource messageSource;
@Value("${spring.messages.basename}")
private String basename;
@Value("${spring.messages.cache-seconds}")
private long cacheMillis;
@Value("${spring.messages.encoding}")
private String encoding;
/**
* 初始化
* @return
*/
private MessageSource initMessageSource() {
ReloadableResourceBundleMessageSource messageSource=new ReloadableResourceBundleMessageSource();
LOGGER.info("baseName====>:" + this.basename);
messageSource.setBasename(basename);
messageSource.setDefaultEncoding(encoding);
messageSource.setCacheMillis(cacheMillis);
return messageSource;
}
public Locale getLocale(HttpServletRequest request){
String lauage=request.getHeader("AccountLanguage");
//默认没有就是请求地区的语言
Locale locale=null;
if(lauage == null){
locale=Locale.CHINA;
} else if("jp".equals(lauage)){
locale=Locale.JAPANESE;
} else if("en".equals(lauage)){
locale=Locale.ENGLISH;
} else if("cn".equals(lauage)){
locale=Locale.CHINA;
} else{
locale=Locale.CHINA;
}
return locale;
}
/**
* 设置当前的返回信息
* @param request
* @param code
* @return
*/
public String getMessage(HttpServletRequest request, String code){
if(messageSource==null){
messageSource=initMessageSource();
}
String result=null;
try {
result = messageSource.getMessage(code, null, getLocale(request));
} catch (NoSuchMessageException e) {
e.printStackTrace();
LOGGER.error("Cannot find the error message of internationalization, return the original error message.");
}
if(result==null){
return code;
}
return result;
}
public String getMessage(HttpServletRequest request,Object[] args, String code){
if(messageSource==null){
messageSource=initMessageSource();
}
try {
return messageSource.getMessage(code, args,getLocale(request));
} catch (NoSuchMessageException e) {
e.printStackTrace();
LOGGER.error("Cannot find the error message of internationalization, return the original error message.");
return code;
}
}
}
......@@ -46,20 +46,27 @@ public class LoginController {
@Autowired
private LoginLogService loginLogService;
@Autowired
private I18nController i18n;
//使用token登录
@ApiOperation(value = "使用token登录",notes = "使用token登录:" +
" userName: 用户名," +
" password: 密码")
@RequestMapping(value = "/loginForToken", method = RequestMethod.POST)
@ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "AccountLanguage", value = "language", required = true, dataType = "String"),
})
public String loginForToken(@RequestBody LoginUserVo loginUserVo, HttpServletRequest request, HttpServletResponse response) {
String port =request.getHeader("AccountLanguage");
if(StringUtils.isEmpty(loginUserVo.getUserName())){
fb.setCode(0);
fb.setMessage("用户名不能为空");
fb.setMessage(i18n.getMessage(request,"userName"));
return gson.toJson(fb);
}
if(StringUtils.isEmpty(loginUserVo.getPassword())){
fb.setCode(0);
fb.setMessage("密码不能为空");
fb.setMessage(i18n.getMessage(request,"password"));
return gson.toJson(fb);
}
try {
......@@ -70,7 +77,7 @@ public class LoginController {
String token = DigestUtils.md5Hex(System.currentTimeMillis() + userVo.getUserName());
UserRedisVo redisVo = new UserRedisVo(userVo.getUserName(),userVo.getUserNumber(),userVo.getNickName(),userVo.getEmail(),userVo.getPhone(),userVo.getRoleName(),userVo.getCompanyName());
//将用户数据保存到redis中
tokenRedisService.set("TOKEN_" + token, gson.toJson(redisVo), 60 * 30);
tokenRedisService.set("TOKEN_" + token, gson.toJson(redisVo), 60 * 60 *24);
String ip = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest().getRemoteAddr();
int a=loginLogService.addLoginLog(new LoginLog(loginUserVo.getUserName(),System.currentTimeMillis(),ip));
if (a>0){
......@@ -78,13 +85,13 @@ public class LoginController {
fb.setMessage(token);
}else{
fb.setCode(0);
fb.setMessage("添加日志失败");
fb.setMessage(i18n.getMessage(request,"addLogFailure"));
}
} catch (Exception e) {
e.printStackTrace();
logger.info(e.toString());
fb.setCode(0);
fb.setMessage("用户名或密码错误");
fb.setMessage(i18n.getMessage(request,"login"));
}
return gson.toJson(fb);
}
......@@ -104,39 +111,9 @@ public class LoginController {
}
@ApiOperation(value="登录",notes = "登录")
@RequestMapping(value = "/login", method = RequestMethod.POST)
public String login(@RequestBody LoginUserVo loginUserVo,HttpServletRequest request,HttpServletResponse response){
if(StringUtils.isEmpty(loginUserVo.getUserName())){
fb.setCode(0);
fb.setMessage("用户名不能为空");
return gson.toJson(fb);
}
if(StringUtils.isEmpty(loginUserVo.getPassword())){
fb.setCode(0);
fb.setMessage("密码不能为空");
return gson.toJson(fb);
}
String token = userService.getUser(loginUserVo);
if(token == null){
fb.setCode(0);
fb.setMessage("账号或者密码错误");
}else{
CookieUtils.setCookie(request,response,"Account_token",token);
fb.setCode(1);
fb.setMessage(token);
}
return gson.toJson(fb);
}
//登录功能
// @ApiOperation(value = "登录功能",notes = "登录功能:" +
// " userName: 用户名," +
// " password: 密码")
// @RequestMapping(value = "/doLogin", method = RequestMethod.POST)
// public String login(@RequestBody LoginUserVo loginUserVo) {
// @ApiOperation(value="登录",notes = "登录")
// @RequestMapping(value = "/login", method = RequestMethod.POST)
// public String login(@RequestBody LoginUserVo loginUserVo,HttpServletRequest request,HttpServletResponse response){
// if(StringUtils.isEmpty(loginUserVo.getUserName())){
// fb.setCode(0);
// fb.setMessage("用户名不能为空");
......@@ -147,27 +124,18 @@ public class LoginController {
// fb.setMessage("密码不能为空");
// return gson.toJson(fb);
// }
// if(userService.getByUserName(loginUserVo.getUserName()) == null){
// String token = userService.getUser(loginUserVo);
// if(token == null){
// fb.setCode(0);
// fb.setMessage("该用户不存在");
// return gson.toJson(fb);
// }
//
// //实现登录过程,封装用户在页面上提交的用户和密码
// UsernamePasswordToken token = new UsernamePasswordToken(loginUserVo.getUserName(), loginUserVo.getPassword());
// //将封装好的用户名和密码交给shiro安全框架并实现登陆
// try {
// SecurityUtils.getSubject().login(token);
// fb.setMessage("账号或者密码错误");
// }else{
// CookieUtils.setCookie(request,response,"Account_token",token);
// fb.setCode(1);
// fb.setMessage("登录成功");
// } catch (Exception e) {
//// e.printStackTrace();
//// logger.info(e.toString());
// fb.setCode(0);
// fb.setMessage("登录失败");
// fb.setMessage(token);
// }
// return gson.toJson(fb);
// }
//
//
}
......@@ -11,6 +11,7 @@ import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -37,6 +38,10 @@ public class LoginLogController {
@Autowired
private TokenRedisService tokenRedisService;
@Autowired
private I18nController i18n;
//查询登录日志
@ApiOperation(value = "查询登录日志",notes = "查询登录日志,返回值说明:" +
" userName:用户名," +
......@@ -63,6 +68,7 @@ public class LoginLogController {
" ipAddress:登录地址。")
@ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
@ApiImplicitParam(paramType="header", name = "AccountLanguage", value = "language", required = false, dataType = "String"),
})
@RequestMapping(value="/getByTime",method = RequestMethod.POST)
public Object getByTime(@RequestBody LoginLogTermVo loginLogTermVo, HttpServletRequest request){
......@@ -71,12 +77,17 @@ public class LoginLogController {
UserRedisVo user = gson.fromJson(datum,UserRedisVo.class);
if (loginLogTermVo.getStartTime() == null){
fb.setCode(0);
fb.setMessage("查询开始时间不能为空");
fb.setMessage(i18n.getMessage(request,"logStartTime"));
return gson.toJson(fb);
}
if (loginLogTermVo.getStopTime() == null){
fb.setCode(0);
fb.setMessage("查询结束时间不能为空");
fb.setMessage(i18n.getMessage(request,"logEndTime"));
return gson.toJson(fb);
}
if(loginLogTermVo.getStopTime() < loginLogTermVo.getStartTime()){
fb.setCode(0);
fb.setMessage(i18n.getMessage(request,"wrongTime"));
return gson.toJson(fb);
}
return loginLogService.getByTime(loginLogTermVo.getStartTime(),loginLogTermVo.getStopTime(),user.getCompanyName());
......
......@@ -3,6 +3,7 @@ package com.example.tdl.web;
import com.example.tdl.domain.dto.CommFeedback;
import com.example.tdl.domain.vo.RoleNameVo;
import com.example.tdl.service.RoleService;
import com.example.tdl.service.redis.TokenRedisService;
import com.google.gson.Gson;
......@@ -19,6 +20,8 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping("/role")
......@@ -36,6 +39,9 @@ public class RoleController {
@Autowired
private TokenRedisService tokenRedisService;
@Autowired
private I18nController i18n;
//查询本公司的用户
@ApiOperation(value = "查询所有角色名",notes = "查询所有角色名")
......@@ -44,7 +50,11 @@ public class RoleController {
})
@RequestMapping(value="/getAllRoleName",method = RequestMethod.GET)
public Object getAllRoleName(){
return roleService.getAllRoleName();
List<RoleNameVo> roleNameVoList = roleService.getAllRoleName();
for(int i = 0,length = roleNameVoList.size();i<length;i++){
}
return roleNameVoList;
}
......
......@@ -19,6 +19,9 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import retrofit2.http.HTTP;
import javax.servlet.http.HttpServletRequest;
@RestController
......@@ -37,6 +40,10 @@ public class TDLDeviceController {
@Autowired
private TokenRedisService tokenRedisService;
@Autowired
private I18nController i18n;
//查询TDL信息
@ApiOperation(value = "查询TDL信息",notes = "查询TDL信息,返回值说明:" +
" TDLName:TDL名字," +
......@@ -171,4 +178,21 @@ public class TDLDeviceController {
return gson.toJson(fb);
}
@ApiOperation(value = "获取未被使用的TDL序列号",notes = "获取未被使用的TDL序列号,传值说明:" +
" TDLSN:需要查询的TDL序列号")
@ApiImplicitParams({
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
})
@RequestMapping(value = "/getUnusedTDL",method = RequestMethod.POST)
public Object getUnusedTDL(@RequestBody String TDLSN, HttpServletRequest request){
if (StringUtils.isEmpty(TDLSN)){
fb.setCode(0);
fb.setMessage(i18n.getMessage(request,"tdl"));
return gson.toJson(fb);
}
JSONObject jsonObject=JSON.parseObject(TDLSN);
TDLSN=(String)jsonObject.get("TDLSN");
return tdlDeviceService.getUnusedTDL(TDLSN);
}
}
......@@ -14,24 +14,21 @@ management.security.enabled=false
mybatis.type-aliases-package=com.example.demo.entity
mybatis.config-location=classpath:mybatis-config.xml
#message-source
spring.messages.basename=classpath:i18n/messages
#-1 no expried
spring.messages.cache-seconds= 3600
spring.messages.encoding=UTF-8
# Redis服务器地址
tdl.redis.host=192.168.1.16
# Redis数据库索引(默认为0)
tdl.redis.index=0
# Redis服务器连接端口
tdl.redis.port=6379
# Redis服务器连接密码(默认为空)
tdl.redis.password=
# 连接池最大连接数(使用负值表示没有限制)
tdl.redis.poolmaxactive=8
# 连接池最大阻塞等待时间(使用负值表示没有限制)
tdl.redis.poolmaxwait=-1
# 连接池中的最大空闲连接
tdl.redis.poolmaxidle=8
# 连接池中的最小空闲连接
tdl.redis.poolminidle=0
# 连接超时时间(毫秒)
tdl.redis.timeout=0
......@@ -51,6 +48,7 @@ tdl.mqtt.cacrt = ca.crt
tdl.mqtt.clientkey = witcd.pem
tdl.mqtt.clientcrt = witcd.crt
# InfluxDB
spring.influxdb.username=admin
spring.influxdb.password=37774020
......
#
alarmType=Early warning type can not be empty
alarmScene=Early warning scene can not be empty
wrongAlarmScene=Please choose the right warning scene
temMax=The upper limit of temperature can not be empty
temMin=The lower temperature limit can not be empty
humidityMax=The upper limit of humidity can not be empty
humidityMin=The lower limit of humidity can not be empty
tilt=Inclination can not be empty
shock=Vibration can not be empty
alarmExist=The added early warning type has already existed in this scene
addSuccess=You have added the warning information successfully
addFailure=Failed to add early warning information
modifiedAlarmType=The type of early warning that needs to be modified can not be empty
modifiedAlarmScene=The scene of early warning that needs to be modified can not be empty
modifiedWrongAlarmScene=The early warning scene that needs to be modified is not correct
modifiedAlarmExist=The modified early warning type has already existed in this scene
modifiedSuccess=You have modified the warning information successfully
modifiedFailure=Failed to modify early warning information
deletedAlarmType=The early warning scene that needs to be deleted can not empty
deletedAlarmScene=The early warning type that needs to be deleted can not empty
dusedAlarm=The early warning is being used
deletedSuccess=You have deleted the warning information successfully
deletedFailure=Failed to delete early warning information
transportationNo=The number of goods can not be empty
noCircuit=There is no such line
startCountry=The departure country can not be empty
startCity=The departure city can not be empty
startAddressDetail=The specific departure address can not be empty
startLat=The latitude of departure can not be empty
wrongStartLat=The latitude of departure ranges from -90 to 90
startLng=The longitude of departure can not be empty
wrongStartLng=he longitude of departure ranges from -180 to 180
startPostCode=The zip code of departure can not be empty
starExpTime=The expected departure time can not be empty
endCountry=The destination country can not be empty
endCity=The destination city can not be empty
endAddressDetail=The specific destination address can not be empty
endLat=The latitude of destination can not be empty
wrongEndLat=The latitude of destination ranges from -90 to 90
endLng=The longitude of destination can not be empty
wrongEndLng=The longitude of destination ranges from -180 to 180
endPostCode=The zip code of destination can not be empty
endCompTime=The expected arrival time of destination can not be empty
wrongEndCompTime=The estimated arrival time of the destination can not be less than the expected departure time
gateway=The gateway serial number can not be empty
gatewayExist=The gateway serial number does not exist
gatewayMounted=The gateway is mounted
gatewayConsistent=The usage scene of the gateway is not consistent with the current
tdl=Tag sequence number can not be empty
tdlExist=The TDL with a serial number of {0} does not exist
tdlUsed=The TDL with a serial number of {0} has been used
cargoNo=The number of goods can not be empty
plateNo=The number plate can not be empty
cargoName=The alias of the goods can not be empty
circuitSuccess=You have added line successfully
circuitFailure=Failed to added line
notStarted=The line has not started shipping
notBound=The line is not bound to the gateway or tdl
endCircuitSuccess=Successfully modified
endCircuitFailure=Failure to modify
evaluate=The rating of the evaluation can not be empty
completedCircuit=The line can be evaluated when the transportation has been completed
evaluateSuccess=Evaluation is successful
evaluateFailure=Evaluation failed
circuitState=The transport number cannot be empty
inTransit=The line is in transit or has been shipped
bindTDL=The line is not bound to tdl
bindGateway=The line is not bound to the gateway
circuitDeleteSuccess=You have deleted the line successfully
circuitDeleteFailure=Failed to delete the line
startTime=The start time of the line can not be empty
startCircuitSuccess=The line was successfully transported
startCircuitFailure=Failure of the line to start transportation
companyName=The company name can not be empty
country=The country can not be empty
city=The city can not be empty
addressDetail=The detailed address can not be empty
tel=The contact phone can not be empty
manager=The person in charge can not be empty
wrongTel=The phone number is invalid
repeateCompanyName=The company name can not be repeated
addCompanySuccess=You have added the company successfully
addCompanyFailure=Failed to add the company
companyNo=The company number can not be empty
modifyCompanySuccess=You have modified the company successfully
modifyCompanyFailure=Failed to modify the company
deleteCompanySuccess=You have deleted the company successfully
deleteCompanyFailure=Fail to delete company
userName=The username can not be empty
password=The password can not be empty
addLogFailure=Failed to add log
login=Incorrect username or password
loginout=Withdraw from success
logStartTime=The startTime can not be empty
logEndTime=The endTime can not be empty
wrongTime=The start time is not greater than the end time
name=Alias can not be empty
lat=Latitudes cannot be empty
wrongLat=The latitude ranges from -90 to 90
lng=The longitude can not be empty
wrongLng=The longitude ranges from -180 to 180
repeatedName=The added common address alias cannot be repeated
addAddressSuccess=You have added the commonly used address successfully
addAddressFailure=Fail to add the commonly used address
modifiedName=The commonly used address alias that need to be modified can not be empty
modifiedNewName=The new alias can't be empty
modifiedRepeatedName=The modified commonly used address alias cannot be repeated
modifiedAddressSuccess=Modify the user commonly used address successfully
modifiedAddressFailure=Modify the failure of the user's common address
deletedName=The alias that needs to be deleted can not be empty
deletedAddressSuccess=You have deleted the commonly used address successfully
deletedAddressFailure=Failed to delete the commonly used address
usernameRule=The username starts with a letter, which can contain numbers,_and 6-20 characters
repeatedUserName=Username has been existed
passwordRule=The password must be 6-20 characters,which contain numbers,letters and _
nickName=The nickname can not be empty
phone=The phone number can not be empty
phoneRule=The phone number is invalid
repeatedRule=The phone number has been registered
email=The mail can not be empty
emailRule=The email address is invalid
repeatedEmail=The mail has been registered
roleName=The role name can not be empty
existRoleName=The role name does not existed
existCompany=The company name does not existed
addUserSuccess=You have added the user successfully
addUserFailure=Failed to add a user
userNumber=The user number can not be empty
modifiedUserSuccess=You have modified the user successfully
modifiedUserFailure=Failed to modify the user
deleteUserSuccess=You have deleted the user successfully
deleteUserFailure=Failed to delete the user
resetPasswordSuccess=You have reseted the password successfully
resetPasswordFailure=Failed to reset the password
modifiedPasswordSuccess=You have modified the password successfully
modifiedPasswordFailure=Failed to modify the password
addressVoList=There are no more than three stopovers
addressVoCountry=The stopover country can not be empty
addressVoCity=The stopover city can not be empty
addressVoAddressDetail=The specific stopover address can not be empty
addressVoLat=The latitude of stopover can not be empty
wrongAddressVoLat=The latitude of stopover ranges from -90 to 90
addressVoLng=The longitude of stopover can not be empty
wrongaddressVoLng=The longitude of stopover ranges from -180 to 180
addressVoPostCode=The zip code of stopover can not be empty
addressVoExpTime=The expected departure time of stopover can not be empty
addressVoCompTime=The expected arrival time of stopover can not be empty
wrongAddressVoCompTime=The estimated arrival time of the stopover can not be less than the expected departure time
wrongAddressVoExpTime=The estimated arrival time of the current stopover cannot be greater than the expected departure time of the next stopover
systemManage=System Administrator
superManage=Super Administrator
warehouse=Warehouse Manager
transportManage=Transport Manager
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
......@@ -33,7 +33,9 @@
#{description,jdbcType=VARCHAR},
#{data,jdbcType=FLOAT},
#{alarmTime,jdbcType=INTEGER},
#{classify,jdbcType=VARCHAR}
#{classify,jdbcType=VARCHAR},
#{desp,jdbcType=VARCHAR},
#{alarmNo,jdbcType=VARCHAR}
)
</insert>
......@@ -70,10 +72,6 @@
SELECT ifnull(classify,"5") classify,count(description) count FROM alarm_log WHERE classify = "5"
and transportationNo in (select transportationNo from circuit where company_id =(select id from company where companyName =#{companyName,jdbcType=VARCHAR}))
AND DATE_SUB(CURDATE(), INTERVAL #{time,jdbcType=VARCHAR} DAY) &lt;= date(FROM_UNIXTIME(alarmTime/1000,'%Y-%m-%d %H:%i:%s'))
UNION ALL
SELECT ifnull(classify,"6") classify,count(description) count FROM alarm_log WHERE classify = "6"
and transportationNo in (select transportationNo from circuit where company_id =(select id from company where companyName =#{companyName,jdbcType=VARCHAR}))
AND DATE_SUB(CURDATE(), INTERVAL #{time,jdbcType=VARCHAR} DAY) &lt;= date(FROM_UNIXTIME(alarmTime/1000,'%Y-%m-%d %H:%i:%s'))
</select>
<select id="getByTime" resultType="java.lang.Integer">
......@@ -105,6 +103,7 @@
<if test="endTime!=null">
AND c.endTime &lt;= #{endTime,jdbcType=INTEGER}
</if>
order by al.alarmTime DESC
</select>
<select id="getRealTimeAlarm" parameterType="java.lang.String" resultType="com.example.tdl.domain.vo.AlarmLogVo">
......
......@@ -2,13 +2,16 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.example.tdl.mapper.CircuitMapper">
<!--获取所有线路的信息-->
<select id="getAll" resultType="com.example.tdl.domain.vo.ResultCircuitVo" parameterType="String">
<select id="getAll" resultType="com.example.tdl.domain.vo.CircuitResultVo" parameterType="String">
SELECT c.transportationNo,cargoNo,cargoName,(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 alarmType FROM alarm WHERE id IN (SELECT alarm_id from tdl_gateway_log WHERE transportationNo=c.transportationNo)) alarmType,
(select GROUP_CONCAT( DISTINCT classify) from alarm_log al where al.transportationNo = c.transportationNo) alarm,evaluate,transportation
from circuit c where c.state=1
(select GROUP_CONCAT( DISTINCT classify) from alarm_log al where al.transportationNo = c.transportationNo) alarm,evaluate,transportation,plateNo,
(select DISTINCT gatewaySN from tdl_gateway_log WHERE transportationNo=c.transportationNo) gSN,(select DISTINCT gatewayType from tdl_gateway_log WHERE transportationNo=c.transportationNo) gType
from circuit c
where c.state=1
AND company_id=(SELECT id from company where companyName=#{companyName,jdbcType=VARCHAR})
order by c.createTime desc
</select>
......
......@@ -82,6 +82,13 @@
AND type=#{type,jdbcType=VARCHAR}))
</select>
<select id="getUnusedGateway" parameterType="String" resultType="com.example.tdl.domain.vo.GatewaySNVo">
select SN from gateway
where SN like CONCAT(CONCAT('%',#{SN,jdbcType=VARCHAR}), '%')
and useScene = 0
and state = 1
</select>
<!-- <insert id="addGateway" parameterType="com.example.tdl.domain.vo.AddGatewayVo">
INSERT into gateway VALUES (
......
......@@ -76,4 +76,10 @@
and g.SN =#{SN,jdbcType=VARCHAR}
and g.type=#{type,jdbcType=VARCHAR}
</select>
<select id="getUnusedTDL" resultType="com.example.tdl.domain.vo.TdlSNVo" parameterType="String" >
select TDLSN from tdldevice
where TDLSN like CONCAT(CONCAT('%',#{TDLSN,jdbcType=VARCHAR}), '%')
and useScene = 0
</select>
</mapper>
\ No newline at end of file
......@@ -27,6 +27,13 @@
AND u.state=1
</select>
<select id="getAllUser" resultType="com.example.tdl.domain.vo.ResultUserVo">
select userNumber, userName,password,nickName,phone,email,roleName,c.companyName
from company c,`user` u INNER JOIN role r ON u.role_id=r.id
WHERE u.company_id=c.id
AND u.state=1
</select>
<!--根据条件查询-->
<select id="getByTerm" resultType="com.example.tdl.domain.vo.ResultUserVo" parameterType="com.example.tdl.domain.vo.UserTermVo">
select userNumber, userName,password,nickName,phone,email,roleName,c.companyName
......@@ -44,7 +51,9 @@
<if test="phone!=null">
AND phone like CONCAT(CONCAT('%',#{phone,jdbcType=VARCHAR}), '%')
</if>
<if test="companyName!=null">
AND c.companyName=#{companyName,jdbcType=VARCHAR}
</if>
AND u.state=1
</select>
......
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