Browse Source

youhua

master
4670101279 2 years ago
parent
commit
9486148630
  1. 19
      ruoyi-api/src/main/java/com/ruoyi/api/service/impl/DapingServiceImpl.java
  2. 2
      ruoyi-api/src/main/resources/mapper/api/DapingMapper.xml
  3. 14
      ruoyi-code/src/main/java/com/ruoyi/code/camera/controller/ApiController.java

19
ruoyi-api/src/main/java/com/ruoyi/api/service/impl/DapingServiceImpl.java

@ -5,6 +5,7 @@ import com.ruoyi.api.mapper.DapingMapper;
import com.ruoyi.api.service.DapingService; import com.ruoyi.api.service.DapingService;
import com.ruoyi.code.camera.domain.WaterPhotoInfo; import com.ruoyi.code.camera.domain.WaterPhotoInfo;
import com.ruoyi.common.core.page.R; import com.ruoyi.common.core.page.R;
import com.ruoyi.common.utils.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.util.ArrayList;
@ -23,8 +24,10 @@ public class DapingServiceImpl extends ServiceImpl<DapingMapper, WaterPhotoInfo>
public List<WaterPhotoInfo> getStationInfo() { public List<WaterPhotoInfo> getStationInfo() {
return baseMapper.selectStationInfo().stream().filter(waterPhotoInfo -> { return baseMapper.selectStationInfo().stream().filter(waterPhotoInfo -> {
String imgName = waterPhotoInfo.getImgName(); String imgName = waterPhotoInfo.getImgName();
if(StringUtils.isNotBlank(imgName)) {
String img = imgName.replace("\\", "/"); String img = imgName.replace("\\", "/");
waterPhotoInfo.setImgName(img); waterPhotoInfo.setImgName(img);
}
return true; return true;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
} }
@ -57,10 +60,18 @@ public class DapingServiceImpl extends ServiceImpl<DapingMapper, WaterPhotoInfo>
} }
valueList = new ArrayList<>(); valueList = new ArrayList<>();
valMap = new HashMap<>(); valMap = new HashMap<>();
for (WaterPhotoInfo waterPhotoInfo : waterPhotoInfos) { for (int i = 0; i < waterPhotoInfos.size(); i++) {
valueList.add(waterPhotoInfo.getValue()); if(waterPhotoInfos.get(i).getId() != null){
if(!tmList.contains(waterPhotoInfo.getTm())){ valueList.add(waterPhotoInfos.get(i).getValue());
tmList.add(waterPhotoInfo.getTm()); }else{
if(i > 0){
valueList.add(valueList.get(i-1));
}else{
valueList.add(waterPhotoInfos.get(i).getValue());
}
}
if(!tmList.contains(waterPhotoInfos.get(i).getTm())){
tmList.add(waterPhotoInfos.get(i).getTm());
} }
} }

2
ruoyi-api/src/main/resources/mapper/api/DapingMapper.xml

@ -15,7 +15,7 @@
s.camera_sn s.camera_sn
FROM FROM
sc_station_info s sc_station_info s
left join sc_water_current_data c on c.stnm_id = s.id inner join sc_water_current_data c on c.stnm_id = s.id
</select> </select>
<select id="selectWaterLevel" resultType="com.ruoyi.code.camera.domain.WaterPhotoInfo"> <select id="selectWaterLevel" resultType="com.ruoyi.code.camera.domain.WaterPhotoInfo">
SELECT SELECT

14
ruoyi-code/src/main/java/com/ruoyi/code/camera/controller/ApiController.java

@ -59,6 +59,11 @@ public class ApiController extends BaseController
return R.ok(); return R.ok();
} }
@RequestMapping("/devHeart")
public R devHeart(String devNo){
System.out.println(devNo+"发送心跳");
return R.ok();
}
/** /**
* 重启注册服务 * 重启注册服务
@ -223,7 +228,7 @@ public class ApiController extends BaseController
return R.ok(); return R.ok();
} }
private final SimpleDateFormat sdf_pic = new SimpleDateFormat("yyyy_MM_dd_HH_mm_ss"); private final SimpleDateFormat sdf_pic = new SimpleDateFormat("yyyyMMddHHmmss");
private final SimpleDateFormat sdf_time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); private final SimpleDateFormat sdf_time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
private final SimpleDateFormat sdf_date = new SimpleDateFormat("yyyy-MM-dd"); private final SimpleDateFormat sdf_date = new SimpleDateFormat("yyyy-MM-dd");
@ -243,10 +248,11 @@ public class ApiController extends BaseController
String pic_date = sdf_date.format(date); String pic_date = sdf_date.format(date);
//图片名称 new_2022_10_13_13_15_00_序列号.jpg //图片名称 2022_10_13_13_15_00_序列号.jpg
String pic_name = "new_"+getPicName(date)+"_"+serialNo+".jpg"; String pic_name = getPicName(date)+"_"+serialNo+".jpg";
//保存路径 //保存路径
String path = RuoYiConfig.getProfile() + File.separator+"upload"+File.separator+"myftp"+File.separator+ serialNo + File.separator + pic_date + File.separator; // String path = RuoYiConfig.getProfile() + File.separator+"upload"+File.separator+"myftp"+File.separator+ serialNo + File.separator + pic_date + File.separator;
String path = RuoYiConfig.getProfile() + File.separator+"upload"+File.separator+"myftp"+File.separator+ "img" + File.separator + serialNo + File.separator;
File file = new File(path); File file = new File(path);
//判断是否需要创建文件夹 //判断是否需要创建文件夹
if (!file.exists()) { if (!file.exists()) {

Loading…
Cancel
Save