Commit b9970fef authored by zhuangzhuang's avatar zhuangzhuang

5.24--线路实时数据增加预警范围

parent 99045539
...@@ -8,6 +8,10 @@ public class DataVo { ...@@ -8,6 +8,10 @@ public class DataVo {
private List<HistoryDataVo> dataList; private List<HistoryDataVo> dataList;
private String min;
private String max;
public String getDescription() { public String getDescription() {
return description; return description;
} }
...@@ -23,4 +27,20 @@ public class DataVo { ...@@ -23,4 +27,20 @@ public class DataVo {
public void setDataList(List<HistoryDataVo> dataList) { public void setDataList(List<HistoryDataVo> dataList) {
this.dataList = dataList; this.dataList = dataList;
} }
public String getMin() {
return min;
}
public void setMin(String min) {
this.min = min;
}
public String getMax() {
return max;
}
public void setMax(String max) {
this.max = max;
}
} }
package com.example.tdl.mapper; package com.example.tdl.mapper;
import com.example.tdl.domain.vo.DelAlarmVo; import com.example.tdl.domain.vo.DelAlarmVo;
import com.example.tdl.domain.vo.ResultAlarmVo;
import com.example.tdl.domain.vo.ResultGatewayVo; import com.example.tdl.domain.vo.ResultGatewayVo;
import com.example.tdl.domain.vo.TDLLogVo; import com.example.tdl.domain.vo.TDLLogVo;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
...@@ -20,4 +22,6 @@ public interface TDLLogMapper { ...@@ -20,4 +22,6 @@ public interface TDLLogMapper {
List<String> getByAlarm(DelAlarmVo delAlarmVo); List<String> getByAlarm(DelAlarmVo delAlarmVo);
ResultAlarmVo getByTdl(@Param("transportationNo") String transportationNo, @Param("TDLSN") String TDLSN);
} }
...@@ -2,6 +2,7 @@ package com.example.tdl.service; ...@@ -2,6 +2,7 @@ package com.example.tdl.service;
import com.example.tdl.domain.vo.DelAlarmVo; import com.example.tdl.domain.vo.DelAlarmVo;
import com.example.tdl.domain.vo.ResultAlarmVo;
import com.example.tdl.domain.vo.ResultGatewayVo; import com.example.tdl.domain.vo.ResultGatewayVo;
import com.example.tdl.domain.vo.TDLLogVo; import com.example.tdl.domain.vo.TDLLogVo;
import com.example.tdl.mapper.TDLLogMapper; import com.example.tdl.mapper.TDLLogMapper;
...@@ -36,4 +37,8 @@ public class TDLLogService { ...@@ -36,4 +37,8 @@ public class TDLLogService {
public List<String> getByAlarm(DelAlarmVo delAlarmVo){ public List<String> getByAlarm(DelAlarmVo delAlarmVo){
return tdlLogMapper.getByAlarm(delAlarmVo); return tdlLogMapper.getByAlarm(delAlarmVo);
} }
public ResultAlarmVo getByTdl(String transportationNo,String TdlSN){
return tdlLogMapper.getByTdl(transportationNo,TdlSN);
}
} }
...@@ -8,7 +8,7 @@ public class PicUploadUtil { ...@@ -8,7 +8,7 @@ public class PicUploadUtil {
private static final String[] IMAGE_TYPE = new String[]{ ".bmp", ".jpg", ".jpeg", ".gif", ".png" }; private static final String[] IMAGE_TYPE = new String[]{ ".bmp", ".jpg", ".jpeg", ".gif", ".png" };
public String uploadImage(MultipartFile multipartFile,String number,String imageType){ public static String uploadImage(MultipartFile multipartFile,String number,String imageType){
boolean isLegal = false; boolean isLegal = false;
// 判断文件后缀名是否符合 // 判断文件后缀名是否符合
for (String type : IMAGE_TYPE) { for (String type : IMAGE_TYPE) {
......
...@@ -123,10 +123,8 @@ public class DataController { ...@@ -123,10 +123,8 @@ public class DataController {
Long time = resultCircuitVo.getEndTime()*1000000l; Long time = resultCircuitVo.getEndTime()*1000000l;
if("baidu".equals(searchLocationVo.getType())){ if("baidu".equals(searchLocationVo.getType())){
sql = "SELECT \"bdlng\",\"bdlat\" FROM \"tdl_policy\".\""+device+"\"where time >= "+startTime +" and time<= "+time+" ORDER BY time "; sql = "SELECT \"bdlng\",\"bdlat\" FROM \"tdl_policy\".\""+device+"\"where time >= "+startTime +" and time<= "+time+" ORDER BY time ";
}else{ }else{
sql = "SELECT \"lng\",\"lat\" FROM \"tdl_policy\".\""+device+"\"where time >= "+startTime +" and time<= "+time+" ORDER BY time "; sql = "SELECT \"lng\",\"lat\" FROM \"tdl_policy\".\""+device+"\"where time >= "+startTime +" and time<= "+time+" ORDER BY time ";
} }
}else{ }else{
if("baidu".equals(searchLocationVo.getType())){ if("baidu".equals(searchLocationVo.getType())){
...@@ -203,9 +201,7 @@ public class DataController { ...@@ -203,9 +201,7 @@ public class DataController {
} }
//获取历史数据 //获取历史数据
@ApiOperation(value = "获取历史数据",notes = "获取历史数据:" + @ApiOperation(value = "获取历史数据",notes = "获取历史数据:")
"返回数据格式:" +
" ")
@PostMapping("/getHistoryData") @PostMapping("/getHistoryData")
@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"),
...@@ -268,8 +264,16 @@ public class DataController { ...@@ -268,8 +264,16 @@ public class DataController {
for( int i =0;i<devList.size();i++){ for( int i =0;i<devList.size();i++){
HistoryDataVo historyDataVo = new HistoryDataVo(); HistoryDataVo historyDataVo = new HistoryDataVo();
String TDLSN=devList.get(i).replace("TDL-","").trim(); String TDLSN=devList.get(i).replace("TDL-","").trim();
historyDataVo.setTDLSN(devList.get(i).replace("TDL-","").trim()); historyDataVo.setTDLSN(TDLSN);
//String sql = "SELECT \"T\" FROM \"tdl_policy\".\"WTD93LG_17110198\" where \"tdl\"=\'TDL-1707010057708\' and time >=1522220659993000000 ORDER BY time "; ResultAlarmVo resultAlarmVo = tdlLogService.getByTdl(transportationNo,TDLSN);
if(list.get(j).equals("\"T\"") ){
//根据tdl货物报警信息
dataVo.setMax(resultAlarmVo.getTemMax().toString());
dataVo.setMin(resultAlarmVo.getTemMin().toString());
}else if(list.get(j).equals("\"h\"")){
dataVo.setMax(resultAlarmVo.getHumidityMax().toString());
dataVo.setMin(resultAlarmVo.getHumidityMin().toString());
}
String sql=""; String sql="";
if(resultCircuitVo.getEndTime() !=null && resultCircuitVo.getEndTime() !=0){ if(resultCircuitVo.getEndTime() !=null && resultCircuitVo.getEndTime() !=0){
sql = "SELECT "+list.get(j)+" FROM \"tdl_policy\".\""+device+"\" where \"tdl\"='"+devList.get(i)+"' and time >="+startTime + " and time<="+resultCircuitVo.getEndTime() *1000000l+" ORDER BY time "; sql = "SELECT "+list.get(j)+" FROM \"tdl_policy\".\""+device+"\" where \"tdl\"='"+devList.get(i)+"' and time >="+startTime + " and time<="+resultCircuitVo.getEndTime() *1000000l+" ORDER BY time ";
......
...@@ -8,6 +8,7 @@ import com.example.tdl.domain.vo.*; ...@@ -8,6 +8,7 @@ import com.example.tdl.domain.vo.*;
import com.example.tdl.entity.Warehouse; import com.example.tdl.entity.Warehouse;
import com.example.tdl.service.*; import com.example.tdl.service.*;
import com.example.tdl.service.redis.TokenRedisService; import com.example.tdl.service.redis.TokenRedisService;
import com.example.tdl.util.PicUploadUtil;
import com.google.gson.Gson; import com.google.gson.Gson;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
...@@ -18,6 +19,7 @@ import org.slf4j.Logger; ...@@ -18,6 +19,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
...@@ -245,10 +247,22 @@ public class WarehouseController { ...@@ -245,10 +247,22 @@ public class WarehouseController {
@ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"), @ApiImplicitParam(paramType="header", name = "Account_token", value = "token", required = true, dataType = "String"),
}) })
@RequestMapping(value="/addWarehouse",method = RequestMethod.POST) @RequestMapping(value="/addWarehouse",method = RequestMethod.POST)
public Object addWarehouse(@RequestBody AddWarehouseVo addWarehouseVo,HttpServletRequest request){ public Object addWarehouse(@RequestBody AddWarehouseVo addWarehouseVo, HttpServletRequest request){
String token = request.getHeader("Account_token"); String token = request.getHeader("Account_token");
String datum = tokenRedisService.get("TOKEN_" +token); String datum = tokenRedisService.get("TOKEN_" +token);
UserRedisVo user = gson.fromJson(datum,UserRedisVo.class); UserRedisVo user = gson.fromJson(datum,UserRedisVo.class);
String warehouseNo = getWarehouseNo();
// if (multipartFile.isEmpty() || StringUtils.isBlank(multipartFile.getOriginalFilename())) {
// fb.setCode(0);
// fb.setMessage("图片不能为空");
// return gson.toJson(fb);
// }
// if (multipartFile.getSize() > 5 * 1024 * 1024) {
// fb.setCode(0);
// fb.setMessage("上传图片大小不能超过5M!");
// return gson.toJson(fb);
// }
// String img = PicUploadUtil.uploadImage(multipartFile,warehouseNo,"warehouse");
if (StringUtils.isEmpty(addWarehouseVo.getWarehouseName())){ if (StringUtils.isEmpty(addWarehouseVo.getWarehouseName())){
fb.setCode(0); fb.setCode(0);
fb.setMessage("仓库名不能为空"); fb.setMessage("仓库名不能为空");
...@@ -372,7 +386,7 @@ public class WarehouseController { ...@@ -372,7 +386,7 @@ public class WarehouseController {
return gson.toJson(fb); return gson.toJson(fb);
} }
Map<Object,Object> map=new HashMap<>(); Map<Object,Object> map=new HashMap<>();
map.put("warehouseNo",getWarehouseNo()); map.put("warehouseNo",warehouseNo);
map.put("warehouseName",addWarehouseVo.getWarehouseName()); map.put("warehouseName",addWarehouseVo.getWarehouseName());
map.put("country",addWarehouseVo.getCountry()); map.put("country",addWarehouseVo.getCountry());
map.put("city",addWarehouseVo.getCity()); map.put("city",addWarehouseVo.getCity());
...@@ -409,6 +423,8 @@ public class WarehouseController { ...@@ -409,6 +423,8 @@ public class WarehouseController {
} }
//根据仓库编号修改仓库信息 //根据仓库编号修改仓库信息
@ApiOperation(value = "根据仓库编号修改仓库信息",notes = "根据仓库编号修改仓库信息,updatTime不用传,传值说明:" + @ApiOperation(value = "根据仓库编号修改仓库信息",notes = "根据仓库编号修改仓库信息,updatTime不用传,传值说明:" +
" warehouseNo:需要修改的仓库编号," + " warehouseNo:需要修改的仓库编号," +
......
...@@ -35,4 +35,12 @@ ...@@ -35,4 +35,12 @@
and c.companyName=#{companyName,jdbcType=VARCHAR} and c.companyName=#{companyName,jdbcType=VARCHAR}
</select> </select>
<select id="getByTdl" parameterType="String" resultType="com.example.tdl.domain.vo.ResultAlarmVo">
select alarmType,alarmScene,temMax,temMin,humidityMax,humidityMin,tilt,shock,remark
from alarm a,tdl_gateway_log t
where a.id = t.alarm_id
and transportationNo = #{transportationNo,jdbcType=VARCHAR}
and TDLSN = #{TDLSN,jdbcType=VARCHAR}
</select>
</mapper> </mapper>
\ No newline at end of file
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