Merge remote-tracking branch 'origin/dunhuan_jdk8' into dunhuan_jdk8

This commit is contained in:
guoshengxiong 2025-11-12 11:28:27 +08:00
commit 3613777169
6 changed files with 58 additions and 10 deletions

View File

@ -37,6 +37,16 @@ public class TreeProjectVideoListVo {
private VideoItem videoItem;
private ProjectVideoConfig projectVideoConfig;
private List<TreeProjectVideoListVo> children;
/**
*监控总数
*/
@ApiModelProperty("监控总数")
private Integer totalNum;
/**
*监控在线总数
*/
@ApiModelProperty("监控在线总数")
private Integer onlineNum;
/**
* 监控类型枚举
*/

View File

@ -108,7 +108,6 @@ import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.function.Function;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -531,9 +530,46 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
String name = MapUtils.getString(map, "name");
List<TreeProjectVideoListVo> rtVoList = BeanUtil.copyToList(TreeUtils.listToTree(JSONArray.parseArray(JSON.toJSONString(voList)), "id", "parentId", "children", "name", name), TreeProjectVideoListVo.class);
rtVoList = rtVoList.stream().filter(v -> Objects.equals(v.getType(), TreeProjectVideoListVo.MonitorType.PROJECT.getCode())).collect(Collectors.toList());
for (TreeProjectVideoListVo vo : rtVoList) {
getAndSetTotalAndOnlineNum(vo);
}
return rtVoList;
}
/**
* 递归统计总数和在线视频监控数量
*
* @param vo
* @return 包含totalNum和onlineNum的Map
*/
public static Map<String, Integer> getAndSetTotalAndOnlineNum(TreeProjectVideoListVo vo) {
Map<String, Integer> result = new HashMap<>();
int totalNum = 0;
int onlineNum = 0;
if (Objects.equals(vo.getType(), TreeProjectVideoListVo.MonitorType.VIDEO.getCode())) {
totalNum = 1;
if (Objects.equals(vo.getVideoItem().getDeviceState(), 1)) {
onlineNum = 1;
}
}
// 递归处理子节点
List<TreeProjectVideoListVo> children = vo.getChildren();
if (CollUtil.isNotEmpty(children)) {
for (int i = 0; i < children.size(); i++) {
TreeProjectVideoListVo child = children.get(i);
Map<String, Integer> childStats = getAndSetTotalAndOnlineNum(child);
// 累加子节点的统计结果
totalNum += childStats.getOrDefault("totalNum", 0);
onlineNum += childStats.getOrDefault("onlineNum", 0);
}
}
result.put("totalNum", totalNum);
result.put("onlineNum", onlineNum);
vo.setTotalNum(totalNum);
vo.setOnlineNum(onlineNum);
return result;
}
@Override
public void saveZwProject(ZwProjectDataVo zwProjectDataVo) {
Project project = new Project();

View File

@ -30,7 +30,7 @@
group by a.id
</select>
<select id="selectOneWorkerAttendance" resultType="com.zhgd.jeecg.common.mybatis.EntityMap">
SELECT pass_type, create_time
SELECT pass_type, create_time, project_sn
FROM worker_attendance
WHERE person_sn = #{personSn}
AND is_statistics = 0

View File

@ -11,7 +11,12 @@
IF(29>DAY(last_day(str_to_date(CONCAT(#{param.monthTime},'-01'),'%Y-%m-%d'))),NULL,day29) day29,
IF(30>DAY(last_day(str_to_date(CONCAT(#{param.monthTime},'-01'),'%Y-%m-%d'))),NULL,day30) day30,
IF(31>DAY(last_day(str_to_date(CONCAT(#{param.monthTime},'-01'),'%Y-%m-%d'))),NULL,day31) day31
,a.enterprise_id enterprise_id
,if(a.person_type=1,b.id,c1.id) dept_id
,a.id worker_id
from worker_info a
LEFT JOIN team_info b ON a.team_id = b.id and a.person_type=1
LEFT JOIN department_info c1 ON a.department_id = c1.id and a.person_type=2
LEFT JOIN worker_month_attendance_statistics c ON a.person_sn=c.person_sn AND c.query_time=#{param.monthTime}
where a.project_sn=#{param.projectSn} and a.inService_type=#{param.inserviceType}
<if test="param.personType!=null and param.personType!=''">

View File

@ -69,7 +69,9 @@ public class WorkerMonthAttendanceStatisticsServiceImpl extends ServiceImpl<Work
private GovtOpenApiService govtOpenApiService;
@Autowired
private EnvironmentUtil environmentUtil;
@Lazy
@Autowired
private IProjectConfigService projectConfigService;
@Override
public IPage<EntityMap> selectMonthAttendanceByPage(Map<String, Object> map) {
@ -141,7 +143,6 @@ public class WorkerMonthAttendanceStatisticsServiceImpl extends ServiceImpl<Work
return workerMonthAttendanceStatisticsMapper.getListByProjectSn(projectSn);
}
@Override
public void getMonthAttendanceStatistics(String inputTime) {
try {
@ -531,10 +532,6 @@ public class WorkerMonthAttendanceStatisticsServiceImpl extends ServiceImpl<Work
}
}
@Lazy
@Autowired
private IProjectConfigService projectConfigService;
//判断考勤情况
public Map<String, Integer> getWorkerAttendanceType(String personSn, Long workerAttendanceRuleId, String passTime) {
int attendanceType = 0;

View File

@ -30,8 +30,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.*;
import java.util.stream.Collectors;
@ -43,7 +43,7 @@ import java.util.stream.Collectors;
* @create: 2021-11-11 18:48
**/
@Slf4j
@Controller
@RestController
@RequestMapping("/xmgl/task/")
public class VideoTask {
@Autowired