人车流量更新,gbs视频设备更新

develop
hanrenchun 10 months ago
parent d84d78a4aa
commit c340987577

@ -27,7 +27,7 @@ import java.util.List;
*/ */
@RequiredArgsConstructor @RequiredArgsConstructor
//@Component @Component
public class DevopsVideoInfoController { public class DevopsVideoInfoController {
private static final Logger logger = LoggerFactory.getLogger(DevopsVideoInfoController.class); private static final Logger logger = LoggerFactory.getLogger(DevopsVideoInfoController.class);
private final DevopsVideoInfoService0 devopsVideoInfoService; private final DevopsVideoInfoService0 devopsVideoInfoService;
@ -36,12 +36,12 @@ public class DevopsVideoInfoController {
* *
*/ */
@Scheduled(initialDelay = 100, fixedDelay = 3000) @Scheduled(initialDelay = 100, fixedDelay = 3000)
public void yjdr(DevopsVideoInfoDto villageDeviceInfo) { public void yjdr() {
if (!"true".equals(ConfigParam.DevopeVideoInfoSwitch)) { if (!"true".equals(ConfigParam.DevopeVideoInfoSwitch)) {
return; return;
} }
DevopsVideoInfoDto villageDeviceInfo = new DevopsVideoInfoDto();
String res = "error"; String res = "error";
try { try {
res = devopsVideoInfoService.yjdr(villageDeviceInfo); res = devopsVideoInfoService.yjdr(villageDeviceInfo);

@ -0,0 +1,21 @@
package com.ssf.mysqloracletest.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ssf.mysqloracletest.domain.DevopsVideoStatus;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
/**
* (DevopsVideoStatus)Mapper
*
* @author makejava
* @since 2023-11-29 09:33:21
*/
@Mapper
public interface DevopsVideoStatusMapper extends BaseMapper<DevopsVideoStatus> {
@Select("select count(1) from devops_video_status where device_name like '%执法记录仪%' and is_online = '1' ")
public int getGbsListOnline();
}

@ -35,8 +35,8 @@ import java.util.List;
* @author makejava * @author makejava
* @since 2023-11-29 09:33:20 * @since 2023-11-29 09:33:20
*/ */
//@Service @Service
//@DS("mysql") @DS("mysql")
@RequiredArgsConstructor @RequiredArgsConstructor
public class DevopsVideoInfoServiceImpl extends ServiceImpl<DevopsVideoInfoMapper, DevopsVideoInfo0> implements DevopsVideoInfoService0 { public class DevopsVideoInfoServiceImpl extends ServiceImpl<DevopsVideoInfoMapper, DevopsVideoInfo0> implements DevopsVideoInfoService0 {
@ -84,6 +84,7 @@ public class DevopsVideoInfoServiceImpl extends ServiceImpl<DevopsVideoInfoMappe
@Override @Override
public String yjdr(DevopsVideoInfoDto bean) { public String yjdr(DevopsVideoInfoDto bean) {
String type = StringKit.toString(bean.getType()); String type = StringKit.toString(bean.getType());
type = "gbs";
if ("".equals(type)) { if ("".equals(type)) {
return "error-导入类型未设置"; return "error-导入类型未设置";
} }

@ -0,0 +1,68 @@
package com.ssf.mysqloracletest.service.impl;
import cn.hutool.core.util.StrUtil;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ssf.mysqloracletest.domain.DevopsVideoStatus;
import com.ssf.mysqloracletest.exception.ServiceException;
import com.ssf.mysqloracletest.mapper.DevopsVideoStatusMapper;
import com.ssf.mysqloracletest.service.DevopsVideoStatusService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* (DevopsVideoStatus)ServiceImpl
*
* @author makejava
* @since 2023-11-29 09:33:21
*/
@Service
@DS("mysql")
@RequiredArgsConstructor
public class DevopsVideoStatusServiceImpl extends ServiceImpl<DevopsVideoStatusMapper, DevopsVideoStatus> implements DevopsVideoStatusService {
private final DevopsVideoStatusMapper videoStatusMapper;
@Override
public boolean insertOrUpdate(DevopsVideoStatus devopsVideoStatus) {
return false;
}
@Override
public Object importData(List<DevopsVideoStatus> list) {
int successNum = 0;
int failureNum = 0;
StringBuilder successMsg = new StringBuilder();
StringBuilder failureMsg = new StringBuilder();
for (DevopsVideoStatus devopsVideoStatus : list) {
try {
insertOrUpdate(devopsVideoStatus);
successNum++;
successMsg.append(StrUtil.format("<br/>{}、待替换 {} 导入成功", successNum, "待替换"));
} catch (Exception e) {
failureNum++;
failureMsg.append(StrUtil.format("<br/>{}、待替换 {} 导入失败:{}", failureNum, "待替换", e.getMessage()));
}
}
if (failureNum > 0) {
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
throw new ServiceException(failureMsg.toString());
} else {
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
return successMsg.toString();
}
}
@Override
public int getGbsListOnline(){
return videoStatusMapper.getGbsListOnline();
}
}

@ -93,17 +93,20 @@ public class PeopleVehicleFlowTask {
try { try {
//获取当前日期 //获取当前日期
LocalDateTime localDate = LocalDateTime.now(); LocalDateTime currentDate = LocalDateTime.now();
LocalDateTime startOfDay = currentDate.withHour(0).withMinute(0).withSecond(0);
LocalDate localDate = LocalDate.now();
//循环迭代7天 //循环迭代7天
for (int i = 0; i < 7; i++) { for (int i = 0; i < 7; i++) {
//构造查询条件 //构造查询条件
QueryWrapper<TStrhEntityInfoKs> queryWrapper = new QueryWrapper<>(); QueryWrapper<TStrhEntityInfoKs> queryWrapper = new QueryWrapper<>();
// 减去 i 天并设置查询条件的日期字段 // 减去 i 天并设置查询条件的日期字段
LocalDateTime date = localDate.minusDays(i); LocalDateTime targetDate = startOfDay.minusDays(i);
LocalDate date = localDate.minusDays(i);
// 将日期部分格式化为数据库存储格式 // 将日期部分格式化为数据库存储格式
String formattedDate = date.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); String formattedDate = targetDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
queryWrapper.between("capturetime", formattedDate, date.plusDays(1).format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); queryWrapper.between("capturetime", formattedDate, targetDate.plusDays(1).format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
int count = tStrhEntityInfoKsService.count(queryWrapper); int count = tStrhEntityInfoKsService.count(queryWrapper);
PeopleVehicleFlow peopleVehicleFlow = new PeopleVehicleFlow(); PeopleVehicleFlow peopleVehicleFlow = new PeopleVehicleFlow();
peopleVehicleFlow.setStatistic_count(String.valueOf(count)); peopleVehicleFlow.setStatistic_count(String.valueOf(count));
@ -119,7 +122,7 @@ public class PeopleVehicleFlowTask {
} else { } else {
UpdateWrapper<PeopleVehicleFlow> wrapper = new UpdateWrapper<>(); UpdateWrapper<PeopleVehicleFlow> wrapper = new UpdateWrapper<>();
wrapper.eq("statistic_time", date.toString()); wrapper.eq("statistic_time", date.toString());
wrapper.eq("statistic_type", 2); wrapper.eq("statistic_type", 1);
boolean update = peopleVehicleFlowService.update(peopleVehicleFlow, wrapper); boolean update = peopleVehicleFlowService.update(peopleVehicleFlow, wrapper);
if (update) { if (update) {
logger.info("Face-" + date + ":更新成功"); logger.info("Face-" + date + ":更新成功");

Loading…
Cancel
Save