当日任务

This commit is contained in:
cwchen 2024-03-23 17:06:31 +08:00
parent b362feed71
commit 8c5de362ad
9 changed files with 305 additions and 12 deletions

View File

@ -14,7 +14,8 @@ import java.util.List;
@Data
public class TodayTaskDto {
@ApiModelProperty("站班会ID")
private String classId;
@ApiModelProperty("角色编码")
private String roleCode;

View File

@ -0,0 +1,26 @@
package com.securitycontrol.entity.background.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @authorcwchen
* @date2024-03-20-14:12
* @version1.0
* @description球机上下线时长
*/
@Data
public class DeviceUpDownVo {
@ApiModelProperty("PUID")
private String puId;
@ApiModelProperty("上线时间")
private String upTime;
@ApiModelProperty("结束时间")
private String downTime;
@ApiModelProperty("在线时长")
private double hours;
}

View File

@ -3,23 +3,19 @@ package com.securitycontrol.background.controller;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import com.securitycontrol.background.export.entity.DutyPlanExportVo;
import com.securitycontrol.background.export.entity.TeamExportVo;
import com.securitycontrol.background.export.entity.TeamUserExportVo;
import com.securitycontrol.background.export.entity.UserAccessExportVo;
import com.securitycontrol.background.export.entity.*;
import com.securitycontrol.background.export.util.ExcelStyleUtil;
import com.securitycontrol.background.service.DutyPlanService;
import com.securitycontrol.background.service.HumanService;
import com.securitycontrol.background.service.ITodayTaskService;
import com.securitycontrol.background.service.TeamService;
import com.securitycontrol.common.core.utils.StringUtils;
import com.securitycontrol.common.core.utils.aes.DateTimeHelper;
import com.securitycontrol.common.log.annotation.Log;
import com.securitycontrol.common.log.enums.OperationType;
import com.securitycontrol.entity.background.dto.ParamDto;
import com.securitycontrol.entity.background.vo.DutyPlanVo;
import com.securitycontrol.entity.background.vo.HumanManageVo;
import com.securitycontrol.entity.background.vo.TeamManageVo;
import com.securitycontrol.entity.background.vo.UserAccessVo;
import com.securitycontrol.entity.background.dto.TodayTaskDto;
import com.securitycontrol.entity.background.vo.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.beans.BeanUtils;
@ -56,6 +52,9 @@ public class ExportFileController {
@Resource(name = "DutyPlanService")
private DutyPlanService dutyPlanService;
@Resource(name = "ITodayTaskService")
private ITodayTaskService iTodayTaskService;
@GetMapping("exportDutyPlanData")
@Log(title = "值班计划管理", menu = "风险值班管理->值班计划管理", grade = OperationType.EXPORT_BUSINESS, details = "导出值班计划", type = "业务日志")
public void exportDutyPlanData(HttpServletRequest request, HttpServletResponse response, DutyPlanVo dto) {
@ -171,4 +170,30 @@ public class ExportFileController {
log.error("导出人员进出场记录", e);
}
}
@GetMapping("exportTodayTaskData")
@Log(title = "风险值班管理", menu = "风险值班管理->当日任务", grade = OperationType.EXPORT_BUSINESS, details = "导出当日任务", type = "业务日志")
public void exportTodayTaskData(HttpServletRequest request, HttpServletResponse response, TodayTaskDto dto) {
try {
List<TodayTaskExportVo> todayTaskExportVoList = new ArrayList<>();
List<TodayTaskVo> todayTaskVoList = iTodayTaskService.getToDayTaskLists(dto);
for (int i = 0; i < todayTaskVoList.size(); i++) {
todayTaskVoList.get(i).setClassId((i + 1) + "");
TodayTaskExportVo todayTaskExportVo = new TodayTaskExportVo();
BeanUtils.copyProperties(todayTaskVoList.get(i), todayTaskExportVo);
todayTaskExportVoList.add(todayTaskExportVo);
}
ExportParams exportParams = new ExportParams("当日任务", "当日任务", ExcelType.XSSF);
exportParams.setStyle(ExcelStyleUtil.class);
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, TodayTaskExportVo.class, todayTaskExportVoList);
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setHeader("content-disposition", "attachment;fileName=" + URLEncoder.encode("当日任务" + ".xlsx", "UTF-8"));
ServletOutputStream outputStream = response.getOutputStream();
workbook.write(outputStream);
outputStream.close();
workbook.close();
} catch (Exception e) {
log.error("导出当日任务", e);
}
}
}

View File

@ -2,6 +2,7 @@ package com.securitycontrol.background.controller;
import com.securitycontrol.background.service.ITodayTaskService;
import com.securitycontrol.common.core.web.controller.BaseController;
import com.securitycontrol.common.core.web.domain.AjaxResult;
import com.securitycontrol.common.core.web.page.TableDataInfo;
import com.securitycontrol.common.log.annotation.Log;
import com.securitycontrol.common.log.enums.OperationType;
@ -36,4 +37,17 @@ public class TodayTaskController extends BaseController {
List<TodayTaskVo> list = service.getToDayTaskLists(dto);
return getDataTable(list);
}
@ApiOperation(value = "远程巡视详情")
@GetMapping("getToDayTaskDetail")
public AjaxResult getToDayTaskDetail(TodayTaskDto dto) {
return service.getToDayTaskDetail(dto);
}
@ApiOperation(value = "球机上下线时长")
@GetMapping("getBallTimeList")
public AjaxResult getBallTimeList(TodayTaskDto dto){
return service.getBallTimeList(dto);
}
}

View File

@ -0,0 +1,72 @@
package com.securitycontrol.background.export.entity;
import cn.afterturn.easypoi.excel.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @authorcwchen
* @date2024-03-23-12:45
* @version1.0
* @description今日任务-VO
*/
@Data
public class TodayTaskExportVo {
@ApiModelProperty("站班会id")
@Excel(name = "序号", width = 10.0, orderNum = "0")
private String classId;
@ApiModelProperty("建管单位")
@Excel(name = "建管单位", width = 20.0, orderNum = "1")
private String org;
@ApiModelProperty("标段工程名称")
@Excel(name = "标段工程名称", width = 20.0, orderNum = "2")
private String bidName;
@ApiModelProperty("作业票编号")
@Excel(name = "作业票号", width = 20.0, orderNum = "3")
private String ticketNo;
@ApiModelProperty("施工状态")
@Excel(name = "施工状态", width = 20.0, orderNum = "4")
private String sgStatus;
@ApiModelProperty("风险等级")
@Excel(name = "风险等级", width = 20.0, orderNum = "5")
private String riskLevel;
@ApiModelProperty("工作负责人")
@Excel(name = "班组长", width = 20.0, orderNum = "6")
private String workManager;
@ApiModelProperty("工作内容")
@Excel(name = "工作内容", width = 20.0, orderNum = "7")
private String workContent;
@ApiModelProperty("单项工程编码")
@Excel(name = "工作内容", width = 20.0, orderNum = "8")
private String signCode;
@ApiModelProperty("标段工程编码")
@Excel(name = "工作内容", width = 20.0, orderNum = "9")
private String bidCode;
@ApiModelProperty("工程编码")
@Excel(name = "工作内容", width = 20.0, orderNum = "10")
private String proCode;
@ApiModelProperty("监理单位")
@Excel(name = "监理单位", width = 20.0, orderNum = "11")
private String jldw;
@ApiModelProperty("施工单位")
@Excel(name = "施工单位", width = 20.0, orderNum = "12")
private String sgdw;
@ApiModelProperty("督查人")
@Excel(name = "督查人", width = 20.0, orderNum = "13")
private String checkUserName;
}

View File

@ -1,10 +1,13 @@
package com.securitycontrol.background.mapper;
import com.securitycontrol.entity.background.dto.TodayTaskDto;
import com.securitycontrol.entity.background.vo.DeviceUpDownVo;
import com.securitycontrol.entity.background.vo.TodayTaskVo;
import org.apache.ibatis.annotations.MapKey;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Map;
/**
* @authorcwchen
@ -36,4 +39,37 @@ public interface ITodayTaskMapper {
*/
String getCheckUser(String checkUserId);
/**
* 站班会详情
*
* @param dto
* @return Map<String>
* @description
* @author cwchen
* @date 2024/3/23 15:41
*/
@MapKey("classId")
Map<String, Map<String, String>> getClassDetail(TodayTaskDto dto);
/**
* 施工人员
*
* @param dto
* @return List<Map < String>>
* @description
* @author cwchen
* @date 2024/3/23 15:42
*/
@MapKey("id")
List<Map<String, String>> getWorkPeopleLists(TodayTaskDto dto);
/**
* 球机在线时长
* @param dto
* @return List<DeviceUpDownVo>
* @description
* @author cwchen
* @date 2024/3/23 16:47
*/
List<DeviceUpDownVo> getBallTimeList(TodayTaskDto dto);
}

View File

@ -1,5 +1,6 @@
package com.securitycontrol.background.service;
import com.securitycontrol.common.core.web.domain.AjaxResult;
import com.securitycontrol.entity.background.dto.TodayTaskDto;
import com.securitycontrol.entity.background.vo.TodayTaskVo;
@ -14,6 +15,7 @@ import java.util.List;
public interface ITodayTaskService {
/**
* 获取当日任务列表
*
* @param dto
* @return List<TodayTaskVo>
* @description
@ -21,4 +23,25 @@ public interface ITodayTaskService {
* @date 2024/3/23 13:21
*/
List<TodayTaskVo> getToDayTaskLists(TodayTaskDto dto);
/**
* 远程巡视详情
*
* @param dto
* @return AjaxResult
* @description
* @author cwchen
* @date 2024/3/23 15:19
*/
AjaxResult getToDayTaskDetail(TodayTaskDto dto);
/**
* 球机上下线时长
* @param dto
* @return AjaxResult
* @description
* @author cwchen
* @date 2024/3/23 16:40
*/
AjaxResult getBallTimeList(TodayTaskDto dto);
}

View File

@ -3,7 +3,10 @@ package com.securitycontrol.background.service.impl;
import com.securitycontrol.background.mapper.ITodayTaskMapper;
import com.securitycontrol.background.service.ITodayTaskService;
import com.securitycontrol.common.core.utils.aes.DateTimeHelper;
import com.securitycontrol.common.core.utils.aes.StringHelper;
import com.securitycontrol.common.core.web.domain.AjaxResult;
import com.securitycontrol.entity.background.dto.TodayTaskDto;
import com.securitycontrol.entity.background.vo.DeviceUpDownVo;
import com.securitycontrol.entity.background.vo.TodayTaskVo;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
@ -11,9 +14,7 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.*;
import java.util.concurrent.Callable;
import java.util.concurrent.Future;
@ -92,4 +93,55 @@ public class TodayTaskServiceImpl implements ITodayTaskService {
}
return dto;
}
@Override
public AjaxResult getToDayTaskDetail(TodayTaskDto dto) {
Map<String, Object> map = new HashMap<>(16);
Map<String, String> mapResult = new HashMap<>(6);
List<Map<String, String>> resultList = new ArrayList<>(100);
try {
Future<Map<String, Map<String, String>>> future = testTaskExecutor.submit(() -> {
log.info("站班会详情-执行线程{}", Thread.currentThread().getName());
Map<String, Map<String, String>> dataMap = new HashMap<>(16);
dataMap = mapper.getClassDetail(dto);
return dataMap;
});
Future<List<Map<String, String>>> future2 = testTaskExecutor.submit(() -> {
log.info("施工人员-执行线程{}", Thread.currentThread().getName());
List<Map<String, String>> list = new ArrayList<>(100);
list = mapper.getWorkPeopleLists(dto);
return list;
});
mapResult = future.get().get(dto.getClassId());
resultList = future2.get();
} catch (Exception e) {
log.error("远程巡视详情",e);
}
map.put("classDetails",mapResult);
map.put("workPeopleLists",resultList);
return AjaxResult.success(map);
}
@Override
public AjaxResult getBallTimeList(TodayTaskDto dto) {
List<DeviceUpDownVo> list = new ArrayList<>(100);
try {
if (StringHelper.isEmpty(dto.getWorkDay())) {
dto.setWorkDay(DateTimeHelper.getNowDay());
}
list = mapper.getBallTimeList(dto);
for (DeviceUpDownVo vo : list) {
if (StringHelper.isEmpty(vo.getDownTime())) {
Double hours = DateTimeHelper.getTimeHours(DateTimeHelper.getNowTime(), vo.getUpTime());
vo.setHours(hours);
} else {
Double hours = DateTimeHelper.getTimeHours(vo.getDownTime(), vo.getUpTime());
vo.setHours(hours);
}
}
} catch (Exception e) {
log.error("球机上下线时长",e);
}
return AjaxResult.success(list);
}
}

View File

@ -53,5 +53,49 @@
<select id="getCheckUser" resultType="java.lang.String">
SELECT login_name FROM sys_user where user_id = #{checkUserId}
</select>
<!--站班会详情-->
<select id="getClassDetail" resultType="java.util.Map">
SELECT tcm.class_id AS classId,
tcm.ticket_id AS ticketId,
tcm.ticket_no AS ticketNo,
CASE tcm.sg_status WHEN '1' THEN '开工'
WHEN '2' THEN '暂停' WHEN '3' THEN '完工' END AS sgStatus,
tcm.bid_name AS bidName,
tcm.sgdw,
tcm.jldw,
tcm.work_day AS workDay,
tcm.start_time AS startTime,
tcm.work_content AS workContent,
tcm.work_manager AS workManager,
tcm.safety_manager AS safetyManager,
tcm.work_manager_phone AS workManagerPhone,
tcm.controll,
tcm.changes,
tcm.current_control AS currentControl
FROM t_class_metting tcm
WHERE tcm.class_id = #{classId}
</select>
<!--施工人员-->
<select id="getWorkPeopleLists" resultType="java.util.Map">
SELECT id,tcmp.user_name AS userName
FROM t_class_metting_people tcmp
WHERE tcmp.class_id = #{classId}
</select>
<!--球机在线时长-->
<select id="getBallTimeList" resultType="com.securitycontrol.entity.background.vo.DeviceUpDownVo">
select tdu.puid,
tdu.up_time AS upTime,
tdu.down_time downTime
FROM t_device_updown tdu
left join t_class_metting tcm on tdu.puid=tcm.puid AND tcm.del_flag = '0'
<where>
<if test="classId!=null and classId!=''">
AND tcm.class_id=#{classId}
</if>
<if test="workDay!=null and workDay!=''">
AND tdu.up_time BETWEEN CONCAT(#{workDay},' 00:00:00') AND CONCAT(#{workDay},' 23:59:59')
</if>
</where>
</select>
</mapper>