学员管理增加统计页面

This commit is contained in:
liang.chao 2025-02-12 10:42:19 +08:00
parent 44a96f1999
commit c09e3e312b
9 changed files with 286 additions and 23 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.log.annotation.SysLog;
import com.bonus.common.log.enums.OperaType;
import com.bonus.exam.mapper.StudentManagementMapper;
import com.bonus.exam.service.StudentManagementService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
@ -19,6 +20,7 @@ import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
@ -30,11 +32,10 @@ import java.util.stream.Collectors;
@RestController
@RequestMapping("/studentManagement")
@Slf4j
public class StudentManagementController extends BaseController {
public class StudentManagementController extends BaseController {
@Resource(name = "StudentManagementService")
private StudentManagementService service;
/**
* 内部学员列表
* @param dto 实体类
@ -50,22 +51,23 @@ public class StudentManagementController extends BaseController {
} catch (Exception e) {
logger.error(e.toString(), e);
}
return getDataTableError(new ArrayList<>());
return getDataTableError(new ArrayList<>());
}
@PostMapping("/export")
public void export(HttpServletResponse response, @RequestBody StudentDto dto) {
try{
try {
List<StudentVo> list = service.selectInternalStudentList(dto);
ExcelUtil<StudentVo> util = new ExcelUtil<StudentVo>(StudentVo.class);
util.exportExcel(response, list, "培训");
}catch (Exception e){
logger.error(e.toString(),e);
} catch (Exception e) {
logger.error(e.toString(), e);
}
}
/**
* 外委学员列表
*
* @param dto 实体类
* @return 数据集合
*/
@ -79,13 +81,13 @@ public class StudentManagementController extends BaseController {
} catch (Exception e) {
logger.error(e.toString(), e);
}
return getDataTableError(new ArrayList<>());
return getDataTableError(new ArrayList<>());
}
@PostMapping("/assignedExport")
public void assignedExport(HttpServletResponse response, @RequestBody StudentDto dto) {
try{
try {
List<StudentVo> list = service.selectAssignedStudentsList(dto);
List<ForeignAffairVo> lists = new ArrayList<>();
for (StudentVo vo : list) {
@ -102,13 +104,14 @@ public class StudentManagementController extends BaseController {
}
ExcelUtil<ForeignAffairVo> util = new ExcelUtil<ForeignAffairVo>(ForeignAffairVo.class);
util.exportExcel(response, lists, "培训");
}catch (Exception e){
logger.error(e.toString(),e);
} catch (Exception e) {
logger.error(e.toString(), e);
}
}
/**
* 学员档案
*
* @param dto 实体类
* @return 数据集合
*/
@ -122,7 +125,7 @@ public class StudentManagementController extends BaseController {
} catch (Exception e) {
logger.error(e.toString(), e);
}
return getDataTableError(new ArrayList<>());
return getDataTableError(new ArrayList<>());
}
@PostMapping("/studentExport")
@ -209,6 +212,7 @@ public class StudentManagementController extends BaseController {
/**
* 学员档案--抬头
*
* @param dto 实体类
* @return 数据集合
*/
@ -234,7 +238,7 @@ public class StudentManagementController extends BaseController {
} catch (Exception e) {
logger.error(e.toString(), e);
}
return getDataTableError(new ArrayList<>());
return getDataTableError(new ArrayList<>());
}
@PostMapping("/exportReleaseStatics")
@ -254,4 +258,21 @@ public class StudentManagementController extends BaseController {
ExcelUtil<ReleaseVo> util = new ExcelUtil<>(ReleaseVo.class);
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.vo.ReleaseVo;
import com.bonus.common.exam.vo.StudentVo;
import com.bonus.common.exam.vo.TaskStatisticsVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Map;
/**
* @description:学员管理
@ -119,4 +121,16 @@ public interface StudentManagementMapper {
* @return 数据集合
*/
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.vo.ReleaseVo;
import com.bonus.common.exam.vo.StudentVo;
import com.bonus.common.exam.vo.TaskStatisticsVo;
import java.util.List;
import java.util.Map;
/**
* @description:学员管理
@ -44,4 +46,8 @@ public interface StudentManagementService {
* @return 数据集合
*/
List<ReleaseVo> getReleaseStatics(ReleaseVo dto);
TaskStatisticsVo getTaskStatistics(TaskStatisticsVo taskStatisticsVo);
Map getTaskStatisticsByMonth(TaskStatisticsVo taskStatisticsVo);
}

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.vo.ReleaseVo;
import com.bonus.common.exam.vo.StudentVo;
import com.bonus.common.exam.vo.TaskStatisticsVo;
import com.bonus.exam.mapper.StudentManagementMapper;
import com.bonus.exam.service.StudentManagementService;
import lombok.extern.slf4j.Slf4j;
@ -13,7 +14,9 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @description:学员管理逻辑处理
@ -129,7 +132,7 @@ public class StudentManagementServiceImpl implements StudentManagementService {
* @param vo 实体类
*/
private void selectScore(StudentVo vo) {
StudentVo vo1 = mapper.getExamScore(vo.getId(), vo.getUserId() ,vo.getType());
StudentVo vo1 = mapper.getExamScore(vo.getId(), vo.getUserId(), vo.getType());
if (vo1 == null) {
vo.setScore("0");
vo.setIsPass("");
@ -142,7 +145,7 @@ public class StudentManagementServiceImpl implements StudentManagementService {
if (StringUtils.isBlank(vo1.getScore()) || "null".equals(vo1.getPassScore())) {
vo1.setPassScore("0");
vo.setIsPass("");
}else{
} else {
vo.setIsPass(Double.parseDouble(vo1.getScore()) > Double.parseDouble(vo1.getPassScore()) ? "" : "");
}
@ -175,6 +178,7 @@ public class StudentManagementServiceImpl implements StudentManagementService {
});
return list;
}
/**
* 统计分析
*
@ -185,4 +189,26 @@ public class StudentManagementServiceImpl implements StudentManagementService {
public List<ReleaseVo> getReleaseStatics(ReleaseVo 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 r.idk
</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>

View File

@ -111,6 +111,11 @@ public class SubController extends BaseController {
}
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

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

View File

@ -46,8 +46,10 @@ public class SubServiceImpl implements SubService {
private FlowTaskService flowTaskService;
@Resource
private RemoteUserService remoteUserService;
/**
* 检查分包商是否存在
*
* @param bean 监理单位实体
* @return 是否存在
*/
@ -55,8 +57,10 @@ public class SubServiceImpl implements SubService {
public int checkIsExistSubName(SubcontractorsEntity bean) {
return mapper.checkIsExistSubName(bean);
}
/**
* 新增分包商
* 新增分包商
*
* @param bean 分包商实体
* @return 是否新增成功
*/
@ -89,11 +93,11 @@ public class SubServiceImpl implements SubService {
// 抛出异常触发事务回滚
throw new RuntimeException("Failed to addRoleUserLink");
}
}else{
if (bean.getSubIdCard().equals(user.getIdCard())){
} else {
if (bean.getSubIdCard().equals(user.getIdCard())) {
Long userId = user.getUserId();
bean.setId(Math.toIntExact(userId));
}else{
} else {
return StaticVariableUtils.NEGATIVE_THREE_INT;
}
@ -117,15 +121,15 @@ public class SubServiceImpl implements SubService {
// 返回操作结果可能是插入的记录数或者其他标识
return result;
} catch (Exception e) {
log.error("Failed to add subcontractor unit due to exception", e );
log.error("Failed to add subcontractor unit due to exception", e);
// 抛出异常触发事务回滚
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
}
return 0;
}
private void addSubPerson(SubcontractorsEntity bean){
System.out.println("addSubPerson=========="+bean);
private void addSubPerson(SubcontractorsEntity bean) {
System.out.println("addSubPerson==========" + bean);
SubPerson subPerson = new SubPerson();
subPerson.setName(bean.getSubPrincipal());
subPerson.setPhone(bean.getSubPrincipalPhone());
@ -144,6 +148,7 @@ public class SubServiceImpl implements SubService {
/**
* 分包商人员入场申请列表
*
* @param bean 分包商实体
* @return 分包商入场申请列表
*/
@ -167,6 +172,7 @@ public class SubServiceImpl implements SubService {
/**
* 人员审核提交
*
* @param bean 实体
* @return 审核结果
*/
@ -186,8 +192,10 @@ public class SubServiceImpl implements SubService {
// mapper.delSubPersonToLk(id);
return mapper.delSub(id);
}
/**
* 入场通知
*
* @param subPerson 实体
* @return 是否发送成功
*/
@ -196,14 +204,29 @@ public class SubServiceImpl implements SubService {
@Value("${user.url}")
private String url;
@Override
public int sendSubNotice(SubPerson subPerson) {
String content = subPerson.getProName()+" 即将开工," +
"请及时上传相关入场文件!浏览器网址:"+url+ "初始账号:"+subPerson.getPhone()+",初始密码:"+subcontractorPassword;
String content = subPerson.getProName() + " 即将开工," +
"请及时上传相关入场文件!浏览器网址:" + url + "初始账号:" + subPerson.getPhone() + ",初始密码:" + subcontractorPassword;
MsgBean bean = new MsgBean();
bean.setPhone(subPerson.getPhone());
bean.setMsg(content);
remoteUserService.setPhoneMsg(bean);
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("审核失败");
}
}
}