bug修复
This commit is contained in:
parent
7e0badce4e
commit
3d03055709
@ -5,6 +5,7 @@ import java.util.Map;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.zhgd.jeecg.common.mybatis.EntityMap;
|
||||
import com.zhgd.xmgl.base.entity.vo.TrendOneVo;
|
||||
import com.zhgd.xmgl.entity.vo.NumberTimeTableVo;
|
||||
import com.zhgd.xmgl.modules.worker.entity.bo.WorkerAttendanceBo;
|
||||
import com.zhgd.xmgl.modules.worker.entity.dto.GetPassRecordDto;
|
||||
@ -85,4 +86,6 @@ public interface WorkerAttendanceMapper extends BaseMapper<WorkerAttendance> {
|
||||
List<NumberTimeTableVo> queryAttendanceTrend(Map<String, Object> map);
|
||||
|
||||
List<WorkerAttendance> queryPresenceList(Map<String, Object> map);
|
||||
|
||||
List<TrendOneVo> queryTodayAttendanceTrend(Map<String, Object> map);
|
||||
}
|
||||
|
||||
@ -808,4 +808,19 @@
|
||||
GROUP BY person_sn)
|
||||
AND a.pass_type = 1
|
||||
</select>
|
||||
|
||||
<select id="queryTodayAttendanceTrend" resultType="com.zhgd.xmgl.base.entity.vo.TrendOneVo">
|
||||
SELECT ifnull(round(sum(if(a.pass_type=1,1,-1)),2),0) y,DATE_FORMAT(a.create_time, '%Y-%m-%d %H:00') x
|
||||
FROM worker_attendance a
|
||||
INNER JOIN (
|
||||
SELECT MAX(create_time) AS create_time,person_sn
|
||||
FROM worker_attendance
|
||||
WHERE project_sn = #{projectSn}
|
||||
and create_time >= CURRENT_DATE
|
||||
and create_time <![CDATA[<=]]> CONCAT(DATE_FORMAT(CURRENT_DATE, '%Y-%m-%d'), ' 23:59:59')
|
||||
group by person_sn,DATE_FORMAT(create_time, '%Y-%m-%d %H:00')
|
||||
) t2 on t2.create_time=a.create_time and t2.person_sn=a.person_sn
|
||||
WHERE project_sn = #{projectSn}
|
||||
group by DATE_FORMAT(a.create_time, '%Y-%m-%d %H:00')
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@ -676,6 +676,7 @@
|
||||
INNER JOIN team_info b ON a.team_id = b.id
|
||||
WHERE a.project_sn = #{projectSn}
|
||||
and a.inService_type = 1
|
||||
GROUP BY b.worker_type_id
|
||||
) ap on w.id = ap.worker_type_id
|
||||
WHERE w.project_sn = #{projectSn}
|
||||
ORDER BY total_person_num desc
|
||||
|
||||
@ -1017,26 +1017,34 @@ status 状态码 String 1表示成功;其余表示失败
|
||||
}).collect(Collectors.groupingBy(WorkerAttendance::getCreateTimeHour));
|
||||
ArrayList<NumberTimeTableVo> rtList = new ArrayList<>();
|
||||
List<String> allHourInDay = DateUtils.getDateTimeStrList(100, "HH:mm");
|
||||
int lastNum = 0;
|
||||
Set<String> inSet = new HashSet<>();
|
||||
Set<String> outSet = new HashSet<>();
|
||||
for (String hour : allHourInDay) {
|
||||
List<WorkerAttendance> workerAttendances = timeDateListMap.get(hour);
|
||||
NumberTimeTableVo vo = new NumberTimeTableVo();
|
||||
int num = 0;
|
||||
if (CollUtil.isNotEmpty(workerAttendances)) {
|
||||
workerAttendances.sort((o1, o2) -> {
|
||||
if (o1.getCreateTime() == null || o2.getCreateTime() == null) {
|
||||
return 0;
|
||||
}
|
||||
return o1.getCreateTime().compareTo(o2.getCreateTime());
|
||||
});
|
||||
for (WorkerAttendance workerAttendance : workerAttendances) {
|
||||
if (Objects.equals(workerAttendance.getPassType(), 1)) {
|
||||
num++;
|
||||
if (!outSet.remove(workerAttendance.getPersonSn())) {
|
||||
inSet.add(workerAttendance.getPersonSn());
|
||||
}
|
||||
} else if (Objects.equals(workerAttendance.getPassType(), 2)) {
|
||||
num--;
|
||||
if (!inSet.remove(workerAttendance.getPersonSn())) {
|
||||
outSet.add(workerAttendance.getPersonSn());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (DateUtil.parse(nowHour).compareTo(DateUtil.parse(hour)) < 0) {
|
||||
//if (DateUtils.parse(nowHour).compareTo(DateUtils.parse(hour)) < 0&&false) { //测试语句
|
||||
vo.setNum(null);
|
||||
} else {
|
||||
vo.setNum(Math.max(lastNum + num, 0));
|
||||
lastNum = vo.getNum();
|
||||
vo.setNum(Math.max(inSet.size() - outSet.size(), 0));
|
||||
}
|
||||
vo.setTime(hour);
|
||||
rtList.add(vo);
|
||||
|
||||
@ -13,6 +13,7 @@ import com.zhgd.xmgl.modules.basicdata.mapper.HikvisionRequestRetryMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user