当日站班会
This commit is contained in:
parent
635d28025f
commit
b362feed71
|
|
@ -0,0 +1,64 @@
|
||||||
|
package com.securitycontrol.common.core.config;
|
||||||
|
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.scheduling.annotation.EnableAsync;
|
||||||
|
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||||
|
import java.util.concurrent.ThreadPoolExecutor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author cw chen
|
||||||
|
* @description TODO
|
||||||
|
* @date 2022-08-22 14:42
|
||||||
|
*/
|
||||||
|
@EnableAsync
|
||||||
|
@Configuration
|
||||||
|
public class SpringThreadPoolConfig {
|
||||||
|
/**
|
||||||
|
* 核心线程数(默认线程数)
|
||||||
|
*/
|
||||||
|
private int corePoolSize = 10;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最大线程数
|
||||||
|
*/
|
||||||
|
private int maxPoolSize = 10;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 允许线程空闲时间(单位:默认为秒)
|
||||||
|
*/
|
||||||
|
private int keepAliveTime = 10;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 缓冲队列数
|
||||||
|
*/
|
||||||
|
private int queueCapacity = 200;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 线程池名前缀
|
||||||
|
*/
|
||||||
|
private String threadNamePrefix = "custom-executor";
|
||||||
|
|
||||||
|
@Bean("testTaskExecutor")
|
||||||
|
public ThreadPoolTaskExecutor taskExecutor1() {
|
||||||
|
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||||
|
//设置核心线程数
|
||||||
|
executor.setCorePoolSize(corePoolSize);
|
||||||
|
//设置最大线程数
|
||||||
|
executor.setMaxPoolSize(maxPoolSize);
|
||||||
|
//线程池所使用的缓冲队列
|
||||||
|
executor.setQueueCapacity(queueCapacity);
|
||||||
|
//等待任务在关机时完成--表明等待所有线程执行完
|
||||||
|
executor.setWaitForTasksToCompleteOnShutdown(true);
|
||||||
|
// 等待时间 (默认为0,此时立即停止),并没等待xx秒后强制停止
|
||||||
|
executor.setKeepAliveSeconds(keepAliveTime);
|
||||||
|
// 线程名称前缀
|
||||||
|
executor.setThreadNamePrefix(threadNamePrefix);
|
||||||
|
// 线程池对拒绝任务的处理策略
|
||||||
|
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
|
||||||
|
// 初始化
|
||||||
|
executor.initialize();
|
||||||
|
return executor;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1 +1,2 @@
|
||||||
com.securitycontrol.common.core.utils.SpringUtils
|
com.securitycontrol.common.core.utils.SpringUtils
|
||||||
|
com.securitycontrol.common.core.config.SpringThreadPoolConfig
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,43 @@
|
||||||
|
package com.securitycontrol.entity.background.dto;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author:cwchen
|
||||||
|
* @date:2024-03-23-12:45
|
||||||
|
* @version:1.0
|
||||||
|
* @description:今日任务-dto
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class TodayTaskDto {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ApiModelProperty("角色编码")
|
||||||
|
private String roleCode;
|
||||||
|
|
||||||
|
@ApiModelProperty("日期")
|
||||||
|
private String workDay;
|
||||||
|
|
||||||
|
@ApiModelProperty("开始时间")
|
||||||
|
private String startTime;
|
||||||
|
|
||||||
|
@ApiModelProperty("结束时间")
|
||||||
|
private String endTime;
|
||||||
|
|
||||||
|
@ApiModelProperty("关键字")
|
||||||
|
private String keyWord;
|
||||||
|
|
||||||
|
@ApiModelProperty("建管单位编码")
|
||||||
|
private String orgCode;
|
||||||
|
|
||||||
|
private List<String> orgCodeList;
|
||||||
|
|
||||||
|
@ApiModelProperty("风险等级")
|
||||||
|
private String riskLevel;
|
||||||
|
|
||||||
|
private List<String> riskLevelList;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,65 @@
|
||||||
|
package com.securitycontrol.entity.background.vo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author:cwchen
|
||||||
|
* @date:2024-03-23-12:45
|
||||||
|
* @version:1.0
|
||||||
|
* @description:今日任务-VO
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class TodayTaskVo {
|
||||||
|
|
||||||
|
@ApiModelProperty("站班会id")
|
||||||
|
private String classId;
|
||||||
|
|
||||||
|
@ApiModelProperty("工作负责人")
|
||||||
|
private String workManager;
|
||||||
|
|
||||||
|
@ApiModelProperty("球机编码")
|
||||||
|
private String macId;
|
||||||
|
|
||||||
|
@ApiModelProperty("puid")
|
||||||
|
private String puid;
|
||||||
|
|
||||||
|
@ApiModelProperty("工作内容")
|
||||||
|
private String workContent;
|
||||||
|
|
||||||
|
@ApiModelProperty("风险等级")
|
||||||
|
private String riskLevel;
|
||||||
|
|
||||||
|
@ApiModelProperty("建管单位")
|
||||||
|
private String org;
|
||||||
|
|
||||||
|
@ApiModelProperty("标段工程名称")
|
||||||
|
private String bidName;
|
||||||
|
|
||||||
|
@ApiModelProperty("单项工程编码")
|
||||||
|
private String signCode;
|
||||||
|
|
||||||
|
@ApiModelProperty("标段工程编码")
|
||||||
|
private String bidCode;
|
||||||
|
|
||||||
|
@ApiModelProperty("工程编码")
|
||||||
|
private String proCode;
|
||||||
|
|
||||||
|
@ApiModelProperty("监理单位")
|
||||||
|
private String jldw;
|
||||||
|
|
||||||
|
@ApiModelProperty("作业票编号")
|
||||||
|
private String ticketNo;
|
||||||
|
|
||||||
|
@ApiModelProperty("施工单位")
|
||||||
|
private String sgdw;
|
||||||
|
|
||||||
|
@ApiModelProperty("施工状态")
|
||||||
|
private String sgStatus;
|
||||||
|
|
||||||
|
@ApiModelProperty("督查人ID")
|
||||||
|
private String checkUserId;
|
||||||
|
|
||||||
|
@ApiModelProperty("督查人")
|
||||||
|
private String checkUserName;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
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.page.TableDataInfo;
|
||||||
|
import com.securitycontrol.common.log.annotation.Log;
|
||||||
|
import com.securitycontrol.common.log.enums.OperationType;
|
||||||
|
import com.securitycontrol.entity.background.dto.TodayTaskDto;
|
||||||
|
import com.securitycontrol.entity.background.vo.TodayTaskVo;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author:cwchen
|
||||||
|
* @date:2024-03-23-12:40
|
||||||
|
* @version:1.0
|
||||||
|
* @description:当日任务
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/back/todayTask/")
|
||||||
|
public class TodayTaskController extends BaseController {
|
||||||
|
|
||||||
|
@Resource(name = "ITodayTaskService")
|
||||||
|
private ITodayTaskService service;
|
||||||
|
|
||||||
|
@ApiOperation(value = "获取当日任务列表")
|
||||||
|
@GetMapping("getToDayTaskLists")
|
||||||
|
@Log(title = "风险值班管理", menu = "风险值班管理->当日任务", grade = OperationType.QUERY_BUSINESS, details = "查询班组", type = "业务日志")
|
||||||
|
public TableDataInfo getToDayTaskLists(TodayTaskDto dto) {
|
||||||
|
startPage();
|
||||||
|
List<TodayTaskVo> list = service.getToDayTaskLists(dto);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
package com.securitycontrol.background.mapper;
|
||||||
|
|
||||||
|
import com.securitycontrol.entity.background.dto.TodayTaskDto;
|
||||||
|
import com.securitycontrol.entity.background.vo.TodayTaskVo;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author:cwchen
|
||||||
|
* @date:2024-03-23-12:49
|
||||||
|
* @version:1.0
|
||||||
|
* @description:当日任务-数据库访问层
|
||||||
|
*/
|
||||||
|
@Repository(value = "ITodayTaskMapper")
|
||||||
|
public interface ITodayTaskMapper {
|
||||||
|
/**
|
||||||
|
* 获取当日任务列表
|
||||||
|
*
|
||||||
|
* @param dto
|
||||||
|
* @return List<TodayTaskVo>
|
||||||
|
* @description
|
||||||
|
* @author cwchen
|
||||||
|
* @date 2024/3/23 13:36
|
||||||
|
*/
|
||||||
|
List<TodayTaskVo> getToDayTaskLists(TodayTaskDto dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询督查人
|
||||||
|
*
|
||||||
|
* @param checkUserId
|
||||||
|
* @return String
|
||||||
|
* @description
|
||||||
|
* @author cwchen
|
||||||
|
* @date 2024/3/23 14:38
|
||||||
|
*/
|
||||||
|
String getCheckUser(String checkUserId);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.securitycontrol.background.service;
|
||||||
|
|
||||||
|
import com.securitycontrol.entity.background.dto.TodayTaskDto;
|
||||||
|
import com.securitycontrol.entity.background.vo.TodayTaskVo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author:cwchen
|
||||||
|
* @date:2024-03-23-12:47
|
||||||
|
* @version:1.0
|
||||||
|
* @description:当日任务
|
||||||
|
*/
|
||||||
|
public interface ITodayTaskService {
|
||||||
|
/**
|
||||||
|
* 获取当日任务列表
|
||||||
|
* @param dto
|
||||||
|
* @return List<TodayTaskVo>
|
||||||
|
* @description
|
||||||
|
* @author cwchen
|
||||||
|
* @date 2024/3/23 13:21
|
||||||
|
*/
|
||||||
|
List<TodayTaskVo> getToDayTaskLists(TodayTaskDto dto);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,95 @@
|
||||||
|
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.entity.background.dto.TodayTaskDto;
|
||||||
|
import com.securitycontrol.entity.background.vo.TodayTaskVo;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
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.concurrent.Callable;
|
||||||
|
import java.util.concurrent.Future;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author:cwchen
|
||||||
|
* @date:2024-03-23-12:47
|
||||||
|
* @version:1.0
|
||||||
|
* @description:当日任务-业务层
|
||||||
|
*/
|
||||||
|
@Service(value = "ITodayTaskService")
|
||||||
|
@Slf4j
|
||||||
|
public class TodayTaskServiceImpl implements ITodayTaskService {
|
||||||
|
|
||||||
|
@Resource(name = "ITodayTaskMapper")
|
||||||
|
private ITodayTaskMapper mapper;
|
||||||
|
|
||||||
|
@Resource(name = "testTaskExecutor")
|
||||||
|
private ThreadPoolTaskExecutor testTaskExecutor;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<TodayTaskVo> getToDayTaskLists(TodayTaskDto dto) {
|
||||||
|
// 多线程执行操作,存放的数据集合
|
||||||
|
List<Future> futureList = new ArrayList<>();
|
||||||
|
List<TodayTaskVo> newList = new ArrayList<>();
|
||||||
|
try {
|
||||||
|
dto = handleParams(dto);
|
||||||
|
List<TodayTaskVo> list = mapper.getToDayTaskLists(dto);
|
||||||
|
for (TodayTaskVo todayTaskVo : list) {
|
||||||
|
Future<TodayTaskVo> future = testTaskExecutor.submit(new Callable<TodayTaskVo>() {
|
||||||
|
@Override
|
||||||
|
public TodayTaskVo call() throws Exception {
|
||||||
|
// 查询督查人
|
||||||
|
String checkUserName = mapper.getCheckUser(todayTaskVo.getCheckUserId());
|
||||||
|
todayTaskVo.setCheckUserName(checkUserName);
|
||||||
|
return todayTaskVo;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
futureList.add(future);
|
||||||
|
}
|
||||||
|
for (Future<TodayTaskVo> future : futureList) {
|
||||||
|
TodayTaskVo todayTaskVo = future.get();
|
||||||
|
newList.add(todayTaskVo);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("获取当日任务列表", e);
|
||||||
|
}
|
||||||
|
return newList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理参数
|
||||||
|
* @param dto
|
||||||
|
* @return TodayTaskDto
|
||||||
|
* @description
|
||||||
|
* @author cwchen
|
||||||
|
* @date 2024/3/23 14:33
|
||||||
|
*/
|
||||||
|
public TodayTaskDto handleParams(TodayTaskDto dto) {
|
||||||
|
if (StringUtils.isBlank(dto.getWorkDay())) {
|
||||||
|
dto.setStartTime(DateTimeHelper.getNowDate());
|
||||||
|
dto.setEndTime(DateTimeHelper.getNowDate());
|
||||||
|
} else {
|
||||||
|
String[] dateArr = dto.getWorkDay().split(" - ");
|
||||||
|
dto.setStartTime(dateArr[0]);
|
||||||
|
dto.setEndTime(dateArr[1]);
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(dto.getOrgCode())) {
|
||||||
|
String[] buildCodeArr = dto.getOrgCode().split(",");
|
||||||
|
List<String> buildCodeList = Arrays.asList(buildCodeArr);
|
||||||
|
dto.setOrgCodeList(buildCodeList);
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(dto.getRiskLevel())) {
|
||||||
|
String[] riskLevelArr = dto.getRiskLevel().split(",");
|
||||||
|
List<String> riskLevelList = Arrays.asList(riskLevelArr);
|
||||||
|
dto.setRiskLevelList(riskLevelList);
|
||||||
|
}
|
||||||
|
return dto;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,57 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||||
|
<mapper namespace="com.securitycontrol.background.mapper.ITodayTaskMapper">
|
||||||
|
|
||||||
|
<!--获取当日任务列表-->
|
||||||
|
<select id="getToDayTaskLists" resultType="com.securitycontrol.entity.background.vo.TodayTaskVo">
|
||||||
|
SELECT tcm.class_id AS classId,
|
||||||
|
tcm.bid_code AS bidCode,
|
||||||
|
tcm.pro_code AS proCode,
|
||||||
|
tcm.risk_level AS riskLevel,
|
||||||
|
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_content AS workContent,
|
||||||
|
tcm.work_manager AS workManager,
|
||||||
|
tcm.puid AS puid,
|
||||||
|
tcm.ticket_no AS ticketNo,
|
||||||
|
sb.city_name AS org,
|
||||||
|
tcm.bid_code AS bidCode,
|
||||||
|
tcm.sign_code AS signCode,
|
||||||
|
tcmc.user_id AS checkUserId
|
||||||
|
FROM t_class_metting tcm
|
||||||
|
LEFT JOIN t_class_metting_check tcmc ON tcm.class_id = tcmc.class_id AND tcmc.create_day BETWEEN #{startTime} AND #{endTime}
|
||||||
|
LEFT JOIN sys_build sb ON tcm.org = sb.org_id
|
||||||
|
WHERE tcm.work_day BETWEEN #{startTime} AND #{endTime} AND tcm.del_flag = '0'
|
||||||
|
<if test="keyWord !=null and keyWord !=''">
|
||||||
|
AND (
|
||||||
|
INSTR(tcm.bid_name,#{keyWord}) > 0 OR
|
||||||
|
INSTR(tcm.ticket_no,#{keyWord}) > 0 OR
|
||||||
|
INSTR(tcm.sgdw,#{keyWord}) > 0 OR
|
||||||
|
INSTR(tcm.jldw,#{keyWord}) > 0 OR
|
||||||
|
INSTR(tcm.work_manager,#{keyWord}) > 0
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
<if test="orgCode!=null and orgCode!=''">
|
||||||
|
AND sb.org_id IN (
|
||||||
|
<foreach collection="orgCodeList" item="item" separator=",">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
<if test="riskLevel!=null and riskLevel!=''">
|
||||||
|
AND tcm.risk_level IN (
|
||||||
|
<foreach collection="riskLevelList" item="item" separator=",">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
<!--查询督查人-->
|
||||||
|
<select id="getCheckUser" resultType="java.lang.String">
|
||||||
|
SELECT login_name FROM sys_user where user_id = #{checkUserId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
Loading…
Reference in New Issue