Merge remote-tracking branch 'origin/master'

This commit is contained in:
haozq 2025-02-12 15:29:36 +08:00
commit 3e14466911
12 changed files with 339 additions and 24 deletions

View File

@ -0,0 +1,28 @@
package com.bonus.common.exam.vo;
import lombok.Data;
import java.util.HashMap;
import java.util.List;
/**
* @Authorliang.chao
* @Date2025/2/10 - 14:34
*/
@Data
public class TaskStatisticsVo {
// 学习任务数量
private Integer studyTaskCount;
// 培训任务数量
private Integer trainingTaskCount;
// 考试任务数量
private Integer examTaskCount;
// 年份
private Integer year;
// 月份
private String month;
// 月数量
private Integer recordCount;
private List<TaskStatisticsVo> list;
}

View File

@ -9,6 +9,7 @@ import com.bonus.common.exam.dto.StudentDto;
import com.bonus.common.exam.vo.*; import com.bonus.common.exam.vo.*;
import com.bonus.common.log.annotation.SysLog; import com.bonus.common.log.annotation.SysLog;
import com.bonus.common.log.enums.OperaType; import com.bonus.common.log.enums.OperaType;
import com.bonus.exam.mapper.StudentManagementMapper;
import com.bonus.exam.service.StudentManagementService; import com.bonus.exam.service.StudentManagementService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
@ -19,6 +20,7 @@ import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@ -34,7 +36,6 @@ public class StudentManagementController extends BaseController {
@Resource(name = "StudentManagementService") @Resource(name = "StudentManagementService")
private StudentManagementService service; private StudentManagementService service;
/** /**
* 内部学员列表 * 内部学员列表
* @param dto 实体类 * @param dto 实体类
@ -66,6 +67,7 @@ public class StudentManagementController extends BaseController {
/** /**
* 外委学员列表 * 外委学员列表
*
* @param dto 实体类 * @param dto 实体类
* @return 数据集合 * @return 数据集合
*/ */
@ -109,6 +111,7 @@ public class StudentManagementController extends BaseController {
/** /**
* 学员档案 * 学员档案
*
* @param dto 实体类 * @param dto 实体类
* @return 数据集合 * @return 数据集合
*/ */
@ -209,6 +212,7 @@ public class StudentManagementController extends BaseController {
/** /**
* 学员档案--抬头 * 学员档案--抬头
*
* @param dto 实体类 * @param dto 实体类
* @return 数据集合 * @return 数据集合
*/ */
@ -254,4 +258,21 @@ public class StudentManagementController extends BaseController {
ExcelUtil<ReleaseVo> util = new ExcelUtil<>(ReleaseVo.class); ExcelUtil<ReleaseVo> util = new ExcelUtil<>(ReleaseVo.class);
util.exportExcel(response, list, "考试"); util.exportExcel(response, list, "考试");
} }
/**
* 任务统计
*
* @throws IOException
*/
@GetMapping("/getTaskStatistics")
public AjaxResult taskStatistics(TaskStatisticsVo taskStatisticsVo) {
TaskStatisticsVo taskStatistics = service.getTaskStatistics(taskStatisticsVo);
return AjaxResult.success(taskStatistics);
}
@GetMapping("/getTaskStatisticsByMonth")
public AjaxResult taskStatisticsByMonth(TaskStatisticsVo taskStatisticsVo) {
Map map = service.getTaskStatisticsByMonth(taskStatisticsVo);
return AjaxResult.success(map);
}
} }

View File

@ -3,10 +3,12 @@ package com.bonus.exam.mapper;
import com.bonus.common.exam.dto.StudentDto; import com.bonus.common.exam.dto.StudentDto;
import com.bonus.common.exam.vo.ReleaseVo; import com.bonus.common.exam.vo.ReleaseVo;
import com.bonus.common.exam.vo.StudentVo; import com.bonus.common.exam.vo.StudentVo;
import com.bonus.common.exam.vo.TaskStatisticsVo;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* @description:学员管理 * @description:学员管理
@ -119,4 +121,16 @@ public interface StudentManagementMapper {
* @return 数据集合 * @return 数据集合
*/ */
List<ReleaseVo> getReleaseStatics(ReleaseVo dto); List<ReleaseVo> getReleaseStatics(ReleaseVo dto);
TaskStatisticsVo getStudyTaskCount(TaskStatisticsVo taskStatisticsVo);
Integer getTrainingTaskCount(TaskStatisticsVo taskStatisticsVo);
Integer getExamTaskCount(TaskStatisticsVo taskStatisticsVo);
List<TaskStatisticsVo> getStudyTaskCountByMonth(TaskStatisticsVo taskStatisticsVo);
List<TaskStatisticsVo> getTrainingTaskCountByMonth(TaskStatisticsVo taskStatisticsVo);
List<TaskStatisticsVo> getExamTaskCountByMonth(TaskStatisticsVo taskStatisticsVo);
} }

View File

@ -4,8 +4,10 @@ import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.exam.dto.StudentDto; import com.bonus.common.exam.dto.StudentDto;
import com.bonus.common.exam.vo.ReleaseVo; import com.bonus.common.exam.vo.ReleaseVo;
import com.bonus.common.exam.vo.StudentVo; import com.bonus.common.exam.vo.StudentVo;
import com.bonus.common.exam.vo.TaskStatisticsVo;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* @description:学员管理 * @description:学员管理
@ -44,4 +46,8 @@ public interface StudentManagementService {
* @return 数据集合 * @return 数据集合
*/ */
List<ReleaseVo> getReleaseStatics(ReleaseVo dto); List<ReleaseVo> getReleaseStatics(ReleaseVo dto);
TaskStatisticsVo getTaskStatistics(TaskStatisticsVo taskStatisticsVo);
Map getTaskStatisticsByMonth(TaskStatisticsVo taskStatisticsVo);
} }

View File

@ -108,6 +108,22 @@ public class LearningTaskServiceImpl implements LearningTaskService {
return bigDecimal.floatValue(); return bigDecimal.floatValue();
} }
public static Float getStudyTimeById(List<Map<String, Object>> list) {
if (CollectionUtils.isEmpty(list)) {
return 0F;
}
BigDecimal bigDecimal = new BigDecimal("0");
for (Map<String, Object> map : list) {
Object studyTimeObj = map.get("time");
if (studyTimeObj != null) {
BigDecimal studyTime = BigDecimal.valueOf(Float.parseFloat(String.valueOf(studyTimeObj)));
// 继续处理 studyTime
bigDecimal = bigDecimal.add(studyTime);
}
}
return bigDecimal.floatValue();
}
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public AjaxResult addStudyTask(MultipartFile file, String params) { public AjaxResult addStudyTask(MultipartFile file, String params) {
@ -494,7 +510,9 @@ public class LearningTaskServiceImpl implements LearningTaskService {
Float time = getStudyTaskById(studyTaskCoursewareTimeList); Float time = getStudyTaskById(studyTaskCoursewareTimeList);
// 培训人员学习时长 // 培训人员学习时长
List<Map<String, Object>> studyTimes = mapper.getTaskCoursewareTime(dto.getStudyTaskId()); List<Map<String, Object>> studyTimes = mapper.getTaskCoursewareTime(dto.getStudyTaskId());
Float studyTimeById = getStudyTimeById(studyTimes);
for (StudyTaskPersonVo vo : list) { for (StudyTaskPersonVo vo : list) {
vo.setStudyTime(studyTimeById);
if (CollectionUtils.isNotEmpty(hasExam)) { if (CollectionUtils.isNotEmpty(hasExam)) {
int num = mapper.getExamRecord(hasExam.get(0), 1, String.valueOf(vo.getUserId())); int num = mapper.getExamRecord(hasExam.get(0), 1, String.valueOf(vo.getUserId()));
if (num > 0) { if (num > 0) {

View File

@ -6,6 +6,7 @@ import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.exam.dto.StudentDto; import com.bonus.common.exam.dto.StudentDto;
import com.bonus.common.exam.vo.ReleaseVo; import com.bonus.common.exam.vo.ReleaseVo;
import com.bonus.common.exam.vo.StudentVo; import com.bonus.common.exam.vo.StudentVo;
import com.bonus.common.exam.vo.TaskStatisticsVo;
import com.bonus.exam.mapper.StudentManagementMapper; import com.bonus.exam.mapper.StudentManagementMapper;
import com.bonus.exam.service.StudentManagementService; import com.bonus.exam.service.StudentManagementService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -13,7 +14,9 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* @description:学员管理逻辑处理 * @description:学员管理逻辑处理
@ -175,6 +178,7 @@ public class StudentManagementServiceImpl implements StudentManagementService {
}); });
return list; return list;
} }
/** /**
* 统计分析 * 统计分析
* *
@ -185,4 +189,26 @@ public class StudentManagementServiceImpl implements StudentManagementService {
public List<ReleaseVo> getReleaseStatics(ReleaseVo dto) { public List<ReleaseVo> getReleaseStatics(ReleaseVo dto) {
return mapper.getReleaseStatics(dto); return mapper.getReleaseStatics(dto);
} }
@Override
public TaskStatisticsVo getTaskStatistics(TaskStatisticsVo taskStatisticsVo) {
TaskStatisticsVo studyTaskCount = mapper.getStudyTaskCount(taskStatisticsVo);
Integer trainingTaskCount = mapper.getTrainingTaskCount(taskStatisticsVo);
Integer examTaskCount = mapper.getExamTaskCount(taskStatisticsVo);
studyTaskCount.setTrainingTaskCount(trainingTaskCount);
studyTaskCount.setExamTaskCount(examTaskCount);
return studyTaskCount;
}
@Override
public Map getTaskStatisticsByMonth(TaskStatisticsVo taskStatisticsVo) {
List<TaskStatisticsVo> studyTaskCountByMonth = mapper.getStudyTaskCountByMonth(taskStatisticsVo);
List<TaskStatisticsVo> trainingTaskCountByMonth = mapper.getTrainingTaskCountByMonth(taskStatisticsVo);
List<TaskStatisticsVo> examTaskCountByMonth = mapper.getExamTaskCountByMonth(taskStatisticsVo);
HashMap<String, Object> map = new HashMap<>();
map.put("studyTaskCountByMonth", studyTaskCountByMonth);
map.put("trainingTaskCountByMonth", trainingTaskCountByMonth);
map.put("examTaskCountByMonth", examTaskCountByMonth);
return map;
}
} }

View File

@ -385,4 +385,142 @@
group by create_id)r group by create_id)r
GROUP BY r.idk GROUP BY r.idk
</select> </select>
<select id="getStudyTaskCount" resultType="com.bonus.common.exam.vo.TaskStatisticsVo">
SELECT
count(*) as studyTaskCount,
YEAR(est.create_time) AS year
FROM
edu_study_task est
where est.is_acrive = '1'
<if test="year != null">
and YEAR(est.create_time) = #{year}
</if>
</select>
<select id="getTrainingTaskCount" resultType="java.lang.Integer">
SELECT
count(*) as trainingTaskCount
FROM
edu_train_task ett
where ett.is_active = '1'
<if test="year != null">
and YEAR(ett.create_time) = #{year}
</if>
</select>
<select id="getExamTaskCount" resultType="java.lang.Integer">
SELECT
count(*) as examTaskCount
FROM
edu_exam_task ext
where ext.is_active = '1'
<if test="year != null">
and YEAR(ext.create_trime) = #{year}
</if>
</select>
<select id="getTrainingTaskCountByMonth" resultType="com.bonus.common.exam.vo.TaskStatisticsVo">
SELECT
m.month,
IFNULL(d.recordCount, 0) AS recordCount
FROM (
SELECT '01' AS month UNION ALL
SELECT '02' UNION ALL
SELECT '03' UNION ALL
SELECT '04' UNION ALL
SELECT '05' UNION ALL
SELECT '06' UNION ALL
SELECT '07' UNION ALL
SELECT '08' UNION ALL
SELECT '09' UNION ALL
SELECT '10' UNION ALL
SELECT '11' UNION ALL
SELECT '12'
) m
LEFT JOIN (
SELECT
DATE_FORMAT(create_time, '%m') AS month,
COUNT(*) AS recordCount
FROM
edu_train_task
WHERE
is_active = '1'
<if test="year != null">
AND YEAR(create_time) = #{year}
</if>
GROUP BY
DATE_FORMAT(create_time, '%Y-%m')
) d ON m.month = d.month
ORDER BY
m.month
</select>
<select id="getExamTaskCountByMonth" resultType="com.bonus.common.exam.vo.TaskStatisticsVo">
SELECT
m.month,
IFNULL(d.recordCount, 0) AS recordCount
FROM (
SELECT '01' AS month UNION ALL
SELECT '02' UNION ALL
SELECT '03' UNION ALL
SELECT '04' UNION ALL
SELECT '05' UNION ALL
SELECT '06' UNION ALL
SELECT '07' UNION ALL
SELECT '08' UNION ALL
SELECT '09' UNION ALL
SELECT '10' UNION ALL
SELECT '11' UNION ALL
SELECT '12'
) m
LEFT JOIN (
SELECT
DATE_FORMAT(create_trime, '%m') AS month,
COUNT(*) AS recordCount
FROM
edu_exam_task
WHERE
is_active = '1'
<if test="year != null">
AND YEAR(create_trime) = #{year}
</if>
GROUP BY
DATE_FORMAT(create_trime, '%Y-%m')
) d ON m.month = d.month
ORDER BY
m.month
</select>
<select id="getStudyTaskCountByMonth" resultType="com.bonus.common.exam.vo.TaskStatisticsVo">
SELECT
m.month,
IFNULL(recordCount, 0) AS recordCount
FROM (
SELECT '01' AS month UNION ALL
SELECT '02' UNION ALL
SELECT '03' UNION ALL
SELECT '04' UNION ALL
SELECT '05' UNION ALL
SELECT '06' UNION ALL
SELECT '07' UNION ALL
SELECT '08' UNION ALL
SELECT '09' UNION ALL
SELECT '10' UNION ALL
SELECT '11' UNION ALL
SELECT '12'
) m
LEFT JOIN (
SELECT
DATE_FORMAT(create_time, '%m') AS month,
COUNT(*) AS recordCount
FROM
edu_study_task
WHERE
is_acrive = '1'
<if test="year != null">
and YEAR(create_time) = #{year}
</if>
GROUP BY
DATE_FORMAT(create_time, '%m')
) d ON m.month = d.month
ORDER BY
m.month
</select>
</mapper> </mapper>

View File

@ -111,6 +111,11 @@ public class SubController extends BaseController {
} }
return AjaxResult.error("审核失败"); return AjaxResult.error("审核失败");
} }
@PostMapping("/submitPersonApprovalBach")
@SysLog(title = "分包商管理", businessType = OperaType.QUERY,logType = 0,module = "分包商管理->人员入场批量审核")
public AjaxResult submitPersonApprovalBach(@RequestBody List<RequestEntity> bean) {
return service.submitPersonApprovalBach(bean);
}
/** /**
* 入场通知 * 入场通知

View File

@ -151,4 +151,9 @@ public class SubPerson extends BaseBean implements Serializable {
private String annotation = "0"; private String annotation = "0";
private String isExistFile; private String isExistFile;
private List<String> userList;
private String taskType;
} }

View File

@ -52,4 +52,6 @@ public interface SubService {
* @return 是否发送成功 * @return 是否发送成功
*/ */
int sendSubNotice(SubPerson subPerson); int sendSubNotice(SubPerson subPerson);
AjaxResult submitPersonApprovalBach(List<RequestEntity> bean);
} }

View File

@ -2,6 +2,7 @@ package com.bonus.project.service.impl;
import com.bonus.common.core.domain.MsgBean; import com.bonus.common.core.domain.MsgBean;
import com.bonus.common.core.domain.RequestEntity; import com.bonus.common.core.domain.RequestEntity;
import com.bonus.common.core.utils.PageUtils;
import com.bonus.common.core.utils.StaticVariableUtils; import com.bonus.common.core.utils.StaticVariableUtils;
import com.bonus.common.core.utils.StringUtils; import com.bonus.common.core.utils.StringUtils;
import com.bonus.common.core.web.domain.AjaxResult; import com.bonus.common.core.web.domain.AjaxResult;
@ -24,7 +25,9 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport; import org.springframework.transaction.interceptor.TransactionAspectSupport;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@ -46,8 +49,10 @@ public class SubServiceImpl implements SubService {
private FlowTaskService flowTaskService; private FlowTaskService flowTaskService;
@Resource @Resource
private RemoteUserService remoteUserService; private RemoteUserService remoteUserService;
/** /**
* 检查分包商是否存在 * 检查分包商是否存在
*
* @param bean 监理单位实体 * @param bean 监理单位实体
* @return 是否存在 * @return 是否存在
*/ */
@ -55,8 +60,10 @@ public class SubServiceImpl implements SubService {
public int checkIsExistSubName(SubcontractorsEntity bean) { public int checkIsExistSubName(SubcontractorsEntity bean) {
return mapper.checkIsExistSubName(bean); return mapper.checkIsExistSubName(bean);
} }
/** /**
* 新增分包商 * 新增分包商
*
* @param bean 分包商实体 * @param bean 分包商实体
* @return 是否新增成功 * @return 是否新增成功
*/ */
@ -144,15 +151,34 @@ public class SubServiceImpl implements SubService {
/** /**
* 分包商人员入场申请列表 * 分包商人员入场申请列表
*
* @param bean 分包商实体 * @param bean 分包商实体
* @return 分包商入场申请列表 * @return 分包商入场申请列表
*/ */
@Override @Override
public List<SubPerson> enterPersonList(SubPerson bean) { public List<SubPerson> enterPersonList(SubPerson bean) {
long startTime = System.currentTimeMillis();
RequestEntity entity = new RequestEntity();
entity.setUserId(String.valueOf(SecurityUtils.getLoginUser().getUserid()));
AjaxResult ajaxResult = flowTaskService.getStayFlow(entity);
List<String> stringList = new ArrayList<>();
if (ajaxResult.isSuccess() ) {
List<Map<String, Object>> data = (List<Map<String, Object>>) ajaxResult.get("data");
if (data != null && !data.isEmpty()) {
if (data != null && !data.isEmpty()) {
stringList = data.stream()
.map(map -> (String) map.get("proInsId"))
.collect(Collectors.toList());
}
}
}
bean.setUserList(stringList);
PageUtils.startPage();
List<SubPerson> list = mapper.enterPersonList(bean); List<SubPerson> list = mapper.enterPersonList(bean);
RequestEntity entity = new RequestEntity(); System.err.println("stringList="+stringList);
// RequestEntity entity = new RequestEntity();
entity.setUserId(String.valueOf(SecurityUtils.getLoginUser().getUserid())); entity.setUserId(String.valueOf(SecurityUtils.getLoginUser().getUserid()));
// 创建一个 GenericProcessor 实例 对审批流程数据进行处理 // 创建一个 GenericProcessor 实例 对审批流程数据进行处理
GenericProcessor processor = new GenericProcessor(); GenericProcessor processor = new GenericProcessor();
@ -162,11 +188,14 @@ public class SubServiceImpl implements SubService {
.filter(subPerson -> bean.getStatus().equals(subPerson.getIntoStatus())) .filter(subPerson -> bean.getStatus().equals(subPerson.getIntoStatus()))
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
long endTime = System.currentTimeMillis();
System.err.println("耗时:"+(endTime-startTime));
return list; return list;
} }
/** /**
* 人员审核提交 * 人员审核提交
*
* @param bean 实体 * @param bean 实体
* @return 审核结果 * @return 审核结果
*/ */
@ -186,8 +215,10 @@ public class SubServiceImpl implements SubService {
// mapper.delSubPersonToLk(id); // mapper.delSubPersonToLk(id);
return mapper.delSub(id); return mapper.delSub(id);
} }
/** /**
* 入场通知 * 入场通知
*
* @param subPerson 实体 * @param subPerson 实体
* @return 是否发送成功 * @return 是否发送成功
*/ */
@ -196,6 +227,7 @@ public class SubServiceImpl implements SubService {
@Value("${user.url}") @Value("${user.url}")
private String url; private String url;
@Override @Override
public int sendSubNotice(SubPerson subPerson) { public int sendSubNotice(SubPerson subPerson) {
String content = subPerson.getProName() + " 即将开工," + String content = subPerson.getProName() + " 即将开工," +
@ -206,4 +238,18 @@ public class SubServiceImpl implements SubService {
remoteUserService.setPhoneMsg(bean); remoteUserService.setPhoneMsg(bean);
return 1; return 1;
} }
@Override
public AjaxResult submitPersonApprovalBach(List<RequestEntity> beans) {
try {
for (RequestEntity bean : beans) {
bean.setUserId(String.valueOf(SecurityUtils.getLoginUser().getUserid()));
flowTaskService.approvalFlow(bean);
}
return AjaxResult.success("审核成功");
} catch (Exception e) {
log.error(e.toString(), e);
return AjaxResult.error("审核失败");
}
}
} }

View File

@ -140,6 +140,12 @@
and lcp.out_status = #{status} and lcp.out_status = #{status}
</if> </if>
</if> </if>
<if test="userList != null and userList !='' ">
and lcp.proc_inst_id in
<foreach collection="userList" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</select> </select>
<select id="checkIsExistPersonName" resultType="com.bonus.system.api.domain.SysUser"> <select id="checkIsExistPersonName" resultType="com.bonus.system.api.domain.SysUser">
SELECT user_id as userId, SELECT user_id as userId,