bug修改
This commit is contained in:
parent
a4758c602c
commit
d67e2203eb
@ -73,6 +73,7 @@ public class ExamNoticeController {
|
||||
public Result<IPage<ExamNotice>> queryPageList(@ApiIgnore @RequestBody Map<String, Object> map) {
|
||||
QueryWrapper<ExamNotice> queryWrapper = QueryGenerator.initPageQueryWrapper(ExamNotice.class, map);
|
||||
Page<ExamNotice> page = PageUtil.getPage(map);
|
||||
queryWrapper.lambda().orderByDesc(ExamNotice::getCreateTime);
|
||||
IPage<ExamNotice> pageList = examNoticeService.page(page, queryWrapper);
|
||||
return Result.success(pageList);
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.zhgd.xmgl.modules.exam.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.zhgd.annotation.OperLog;
|
||||
import com.zhgd.xmgl.modules.exam.vo.ExamQuestionBankQuery;
|
||||
@ -125,11 +126,13 @@ public class ExamQuestionBankController {
|
||||
List<ExamQuestionBank> radioList = list.stream()
|
||||
.filter(l -> l.getType() == randomQueryList.get(finalI).getType()
|
||||
&& l.getDifficulty() == randomQueryList.get(finalI).getDifficulty()).collect(Collectors.toList());
|
||||
for (int j = 0; j < randomQueryList.get(i).getNumber();) {
|
||||
int index = random.nextInt(radioList.size());
|
||||
boolean add = resultList.add(radioList.get(index).getId());
|
||||
if (add) {
|
||||
j++;
|
||||
if (randomQueryList.get(i).getNumber() != null) {
|
||||
for (int j = 0; j < randomQueryList.get(i).getNumber();) {
|
||||
int index = random.nextInt(radioList.size());
|
||||
boolean add = resultList.add(radioList.get(index).getId());
|
||||
if (add) {
|
||||
j++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -67,4 +67,16 @@ public class ExamNotice implements Serializable {
|
||||
@Excel(name = "项目SN", width = 15)
|
||||
@ApiModelProperty(value = "项目SN")
|
||||
private String projectSn;
|
||||
/**
|
||||
* 企业ID
|
||||
*/
|
||||
@Excel(name = "企业ID", width = 15)
|
||||
@ApiModelProperty(value = "企业ID")
|
||||
private Long enterpriseId;
|
||||
/**
|
||||
* 教育培训记录ID
|
||||
*/
|
||||
@Excel(name = "教育培训记录ID", width = 15)
|
||||
@ApiModelProperty(value = "教育培训记录ID")
|
||||
private Long recordId;
|
||||
}
|
||||
|
||||
@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import liquibase.pro.packaged.L;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
@ -2,6 +2,7 @@ package com.zhgd.xmgl.modules.exam.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.zhgd.annotation.DataScope;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.zhgd.xmgl.modules.exam.entity.ExamNotice;
|
||||
@ -14,6 +15,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Mapper
|
||||
@DataScope
|
||||
public interface ExamNoticeMapper extends BaseMapper<ExamNotice> {
|
||||
|
||||
}
|
||||
|
||||
@ -5,6 +5,8 @@ import java.util.List;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.zhgd.annotation.DataScope;
|
||||
import com.zhgd.xmgl.modules.exam.entity.ExamCourse;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
@ -18,7 +20,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Mapper
|
||||
@DataScope
|
||||
public interface ExamTrainMapper extends BaseMapper<ExamTrain> {
|
||||
|
||||
@DataScope(includeTable = "exam_train")
|
||||
Page<ExamTrain> pageList(Page page, @Param(Constants.WRAPPER) Wrapper<ExamTrain> wrapper);
|
||||
}
|
||||
|
||||
@ -3,9 +3,9 @@
|
||||
<mapper namespace="com.zhgd.xmgl.modules.exam.mapper.ExamPaperMapper">
|
||||
|
||||
<select id="pageList" resultType="com.zhgd.xmgl.modules.exam.entity.ExamPaper">
|
||||
select ep.*, s.name as subjectName, u.real_name createByName from exam_paper ep
|
||||
select * from (select ep.*, s.name as subjectName, u.real_name createByName from exam_paper ep
|
||||
left join exam_subject s on ep.subject_id = s.id
|
||||
left join system_user u on ep.create_by = u.user_id
|
||||
left join system_user u on ep.create_by = u.user_id) a
|
||||
${ew.customSqlSegment}
|
||||
</select>
|
||||
</mapper>
|
||||
@ -3,7 +3,8 @@
|
||||
<mapper namespace="com.zhgd.xmgl.modules.exam.mapper.ExamTrainRecordMapper">
|
||||
|
||||
<select id="pageList" resultType="com.zhgd.xmgl.modules.exam.vo.ExamTrainRecordVo">
|
||||
select * from (select ec.*, et.exam_paper_id, et.course_id, es.name subjectName, et.title, et.train_begin_time, et.train_end_time, et.name trainName from exam_train_record ec
|
||||
select * from (select ec.*, et.exam_paper_id, et.course_id, es.name subjectName, et.title, et.train_begin_time, et.train_end_time, et.name trainName, et.duration examDuration
|
||||
from exam_train_record ec
|
||||
left join exam_train et on ec.train_id = et.id
|
||||
left join exam_subject es on et.subject_id = es.id
|
||||
left join exam_course c on et.course_id = c.id) a
|
||||
@ -11,7 +12,7 @@
|
||||
</select>
|
||||
|
||||
<select id="examPageList" resultType="com.zhgd.xmgl.modules.exam.vo.ExamTrainRecordVo">
|
||||
select * from (select ec.*, et.exam_paper_id, et.course_id, es.name subjectName, et.title, et.train_begin_time, et.train_end_time, et.name trainName from exam_train_record ec
|
||||
select * from (select ec.*, et.exam_paper_id, et.course_id, es.name subjectName, et.title, et.train_begin_time, et.train_end_time, et.name trainName, et.duration examDuration from exam_train_record ec
|
||||
left join exam_train et on ec.train_id = et.id
|
||||
left join exam_subject es on et.subject_id = es.id
|
||||
left join exam_course c on et.course_id = c.id
|
||||
|
||||
@ -131,6 +131,7 @@ public class ExamTrainRecordServiceImpl extends ServiceImpl<ExamTrainRecordMappe
|
||||
.eq(ExamTrainRecord::getTrainId, courseRecord.getTrainId())
|
||||
.eq(ExamTrainRecord::getWorkerId, courseRecord.getWorkerId()));
|
||||
examTrainRecord.setIsPass(1);
|
||||
examTrainRecord.setScore(0);
|
||||
this.updateById(examTrainRecord);
|
||||
}
|
||||
}
|
||||
@ -146,20 +147,20 @@ public class ExamTrainRecordServiceImpl extends ServiceImpl<ExamTrainRecordMappe
|
||||
//扣分
|
||||
score = -collect.get(0).getPoint();
|
||||
}
|
||||
//扣分
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("id", workerId);
|
||||
map.put("deductScore", -score);
|
||||
workerInfoService.updateScoreSendAuth(map);
|
||||
XzDeductScoreRecord xzDeductScoreRecord = new XzDeductScoreRecord();
|
||||
xzDeductScoreRecord.setCreateDate(new Date());
|
||||
xzDeductScoreRecord.setDeductReason(StrUtil.format("您在{}" + desc + "{}分",
|
||||
DateUtil.format(new Date(), "yyyy年MM月dd日HH:mm:ss"), Double.valueOf(score)));
|
||||
xzDeductScoreRecord.setDeductScore(Double.valueOf(score));
|
||||
xzDeductScoreRecord.setCurScore(workerInfoService.getById(workerId).getSafeScore());
|
||||
xzDeductScoreRecord.setWorkerId(workerId);
|
||||
xzDeductScoreRecord.setProjectSn(collect.get(0).getProjectSn());
|
||||
xzDeductScoreRecordService.save(xzDeductScoreRecord);
|
||||
}
|
||||
//扣分
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("id", workerId);
|
||||
map.put("deductScore", -score);
|
||||
workerInfoService.updateScoreSendAuth(map);
|
||||
XzDeductScoreRecord xzDeductScoreRecord = new XzDeductScoreRecord();
|
||||
xzDeductScoreRecord.setCreateDate(new Date());
|
||||
xzDeductScoreRecord.setDeductReason(StrUtil.format("您在{}" + desc + "{}分",
|
||||
DateUtil.format(new Date(), "yyyy年MM月dd日HH:mm:ss"), Double.valueOf(score)));
|
||||
xzDeductScoreRecord.setDeductScore(Double.valueOf(score));
|
||||
xzDeductScoreRecord.setCurScore(workerInfoService.getById(workerId).getSafeScore());
|
||||
xzDeductScoreRecord.setWorkerId(workerId);
|
||||
xzDeductScoreRecord.setProjectSn(collect.get(0).getProjectSn());
|
||||
xzDeductScoreRecordService.save(xzDeductScoreRecord);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,6 +3,8 @@ package com.zhgd.xmgl.modules.exam.service.impl;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.SystemUser;
|
||||
import com.zhgd.xmgl.modules.basicdata.service.ISystemUserService;
|
||||
import com.zhgd.xmgl.modules.exam.entity.ExamCourseRecord;
|
||||
import com.zhgd.xmgl.modules.exam.entity.ExamTrain;
|
||||
import com.zhgd.xmgl.modules.exam.entity.ExamTrainRecord;
|
||||
@ -12,6 +14,8 @@ import com.zhgd.xmgl.modules.exam.service.IExamPaperService;
|
||||
import com.zhgd.xmgl.modules.exam.service.IExamTrainRecordService;
|
||||
import com.zhgd.xmgl.modules.exam.service.IExamTrainService;
|
||||
import com.zhgd.xmgl.modules.exam.vo.ExamTrainRecordVo;
|
||||
import com.zhgd.xmgl.modules.worker.entity.WorkerInfo;
|
||||
import com.zhgd.xmgl.modules.worker.service.IWorkerInfoService;
|
||||
import com.zhgd.xmgl.security.entity.UserInfo;
|
||||
import com.zhgd.xmgl.security.util.SecurityUtils;
|
||||
import com.zhgd.xmgl.util.DateUtils;
|
||||
@ -41,6 +45,12 @@ public class ExamTrainServiceImpl extends ServiceImpl<ExamTrainMapper, ExamTrain
|
||||
@Autowired
|
||||
private IExamPaperService examPaperService;
|
||||
|
||||
@Autowired
|
||||
private ISystemUserService systemUserService;
|
||||
|
||||
@Autowired
|
||||
private IWorkerInfoService workerInfoService;
|
||||
|
||||
@Autowired
|
||||
private IExamCourseRecordService examCourseRecordService;
|
||||
|
||||
@ -55,8 +65,8 @@ public class ExamTrainServiceImpl extends ServiceImpl<ExamTrainMapper, ExamTrain
|
||||
if (trainRecordList.size() > 0) {
|
||||
int complete = trainRecordList.stream().filter(t -> t.getScore() != null).collect(Collectors.toList()).size();
|
||||
int pass = trainRecordList.stream().filter(t -> t.getIsPass() == 1).collect(Collectors.toList()).size();
|
||||
record.setCompleteRadio(new BigDecimal(complete).divide(new BigDecimal(trainRecordList.size()), 2, BigDecimal.ROUND_HALF_UP));
|
||||
record.setPassRadio(new BigDecimal(pass).divide(new BigDecimal(trainRecordList.size()), 2, BigDecimal.ROUND_HALF_UP));
|
||||
record.setCompleteRadio(new BigDecimal(complete).divide(new BigDecimal(trainRecordList.size()), 2, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)));
|
||||
record.setPassRadio(new BigDecimal(pass).divide(new BigDecimal(trainRecordList.size()), 2, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal(100)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -49,10 +49,14 @@ public class ExamTrainRecordVo extends ExamTrainRecord {
|
||||
@Excel(name = "教育结束时间", width = 15)
|
||||
@ApiModelProperty(value = "教育结束时间")
|
||||
private Date trainEndTime;
|
||||
|
||||
/**
|
||||
* 培训计划名称
|
||||
*/
|
||||
@ApiModelProperty(value = "培训计划名称")
|
||||
private String trainName;
|
||||
/**
|
||||
* 考试限制时长
|
||||
*/
|
||||
@ApiModelProperty(value = "考试限制时长")
|
||||
private String examDuration;
|
||||
}
|
||||
|
||||
@ -134,5 +134,14 @@ public class DepartmentInfoController {
|
||||
return Result.success(departmentInfoService.queryDepartmentAndTeamList(map));
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "列表查询项目下所有部门和班组信息", notes = "列表查询项目下所有部门和班组信息", httpMethod = "GET")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "query", required = true, dataType = "String"),
|
||||
@ApiImplicitParam(name = "enterpriseId", value = "所属企业", paramType = "query", required = false, dataType = "String"),
|
||||
@ApiImplicitParam(name = "departmentTeamName", value = "部门或班组名称", paramType = "query", required = false, dataType = "String"),
|
||||
})
|
||||
@GetMapping(value = "/getDepartmentAndTeamList")
|
||||
public Result<List<Map<String, Object>>> getDepartmentAndTeamList(@RequestParam Map<String, Object> map) {
|
||||
return Result.success(departmentInfoService.getDepartmentAndTeamList(map));
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,14 @@
|
||||
package com.zhgd.xmgl.modules.worker.entity.vo;
|
||||
|
||||
import com.zhgd.xmgl.modules.worker.entity.DepartmentInfo;
|
||||
import com.zhgd.xmgl.modules.worker.entity.TeamInfo;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class AllProjectDeptVo extends DepartmentInfo {
|
||||
@ApiModelProperty(value = "deptId")
|
||||
private String deptId;
|
||||
@ApiModelProperty(value = "部门人数")
|
||||
private String totalPersonNum;
|
||||
}
|
||||
@ -88,6 +88,9 @@ public interface WorkerInfoMapper extends BaseMapper<WorkerInfo> {
|
||||
@DataScope(includeTable = "team_info")
|
||||
List<AllProjectTeamVo> selectAllProjectTeamList(Map<String, Object> map);
|
||||
|
||||
@DataScope(includeTable = "department_info")
|
||||
List<AllProjectDeptVo> selectAllProjectDeptList(Map<String, Object> map);
|
||||
|
||||
EntityMap selectWorkerInfoById(@Param("id") String id);
|
||||
|
||||
Map<String, Object> selectAttendanceWorkerPersonTypeTotal(Map<String, Object> map);
|
||||
|
||||
@ -69,13 +69,19 @@
|
||||
select di.id as gtMaterialDepartmentTeamId,di.department_name as department_team_name,1 as
|
||||
gt_material_department_team_type from department_info di
|
||||
<where>
|
||||
di.project_sn=#{projectSn} and di.enterprise_id=#{enterpriseId}
|
||||
di.project_sn=#{projectSn}
|
||||
<if test="enterpriseId != null and enterpriseId != ''">
|
||||
and di.enterprise_id=#{enterpriseId}
|
||||
</if>
|
||||
</where>
|
||||
union all
|
||||
select ti.id as gtMaterialDepartmentTeamId,ti.team_name as department_team_name,2 as
|
||||
gt_material_department_team_type from team_info ti
|
||||
<where>
|
||||
ti.project_sn=#{projectSn} and ti.enterprise_id=#{enterpriseId}
|
||||
ti.project_sn=#{projectSn}
|
||||
<if test="enterpriseId != null and enterpriseId != ''">
|
||||
and ti.enterprise_id=#{enterpriseId}
|
||||
</if>
|
||||
</where>
|
||||
)t
|
||||
</select>
|
||||
|
||||
@ -961,6 +961,46 @@
|
||||
</if>
|
||||
order by total_person_num desc
|
||||
</select>
|
||||
<select id="selectAllProjectDeptList" resultType="com.zhgd.xmgl.modules.worker.entity.vo.AllProjectDeptVo"
|
||||
parameterType="map">
|
||||
SELECT e.*,
|
||||
IFNULL(tp2.total_person_num, 0) total_person_num, <!--人员数量-->
|
||||
e.id deptId,
|
||||
b.enterprise_name
|
||||
FROM department_info e
|
||||
LEFT JOIN (
|
||||
SELECT w1.department_id, COUNT(DISTINCT w1.person_sn) total_person_num, w1.enter_date
|
||||
FROM worker_info w1
|
||||
where
|
||||
(
|
||||
w1.inService_type = 1
|
||||
<if test="queryStartTime != null and queryStartTime != ''">
|
||||
<!--查询历史在职的-->
|
||||
or w1.inService_type =2
|
||||
</if>
|
||||
)
|
||||
<if test="queryStartTime != null and queryStartTime != ''">
|
||||
and w1.enter_date >= #{queryStartTime}
|
||||
</if>
|
||||
<if test="queryEndTime != null and queryEndTime != ''">
|
||||
and w1.enter_date <![CDATA[<=]]> #{queryEndTime}
|
||||
</if>
|
||||
AND w1.person_type = 1
|
||||
<if test="projectSn != null and projectSn != ''">
|
||||
and w1.project_sn = #{projectSn}
|
||||
</if>
|
||||
group by w1.department_id
|
||||
) tp2 ON e.id = tp2.department_id
|
||||
LEFT JOIN enterprise_info b ON e.enterprise_id = b.id
|
||||
WHERE e.project_sn = #{projectSn}
|
||||
<if test="teamName != null and teamName != ''">
|
||||
and e.team_name like CONCAT(CONCAT('%', #{teamName}), '%')
|
||||
</if>
|
||||
<if test="enterpriseId != null and enterpriseId != ''">
|
||||
and e.enterprise_id = #{enterpriseId}
|
||||
</if>
|
||||
order by total_person_num desc
|
||||
</select>
|
||||
<select id="selectWorkerInfoById" resultType="com.zhgd.jeecg.common.mybatis.EntityMap">
|
||||
SELECT a.*,
|
||||
b.enterprise_name,
|
||||
|
||||
@ -4,6 +4,7 @@ import com.zhgd.jeecg.common.mybatis.EntityMap;
|
||||
import com.zhgd.xmgl.modules.gt.entity.GtMaterialInOutWarehouse;
|
||||
import com.zhgd.xmgl.modules.worker.entity.DepartmentInfo;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.apache.hadoop.yarn.webapp.hamlet.Hamlet;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -31,4 +32,6 @@ public interface IDepartmentInfoService extends IService<DepartmentInfo> {
|
||||
List<DepartmentInfo> selectDepartmentDetailsList(Map<String, Object> map);
|
||||
|
||||
List<GtMaterialInOutWarehouse> queryDepartmentAndTeamList(Map<String, Object> map);
|
||||
|
||||
List<Map<String, Object>> getDepartmentAndTeamList(Map<String, Object> map);
|
||||
}
|
||||
|
||||
@ -9,6 +9,8 @@ import com.zhgd.xmgl.async.AsyncWorker;
|
||||
import com.zhgd.xmgl.modules.gt.entity.GtMaterialInOutWarehouse;
|
||||
import com.zhgd.xmgl.modules.worker.entity.DepartmentInfo;
|
||||
import com.zhgd.xmgl.modules.worker.entity.WorkerInfo;
|
||||
import com.zhgd.xmgl.modules.worker.entity.vo.AllProjectDeptVo;
|
||||
import com.zhgd.xmgl.modules.worker.entity.vo.AllProjectTeamVo;
|
||||
import com.zhgd.xmgl.modules.worker.mapper.DepartmentInfoMapper;
|
||||
import com.zhgd.xmgl.modules.worker.mapper.WorkerInfoMapper;
|
||||
import com.zhgd.xmgl.modules.worker.service.IDepartmentInfoService;
|
||||
@ -17,9 +19,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @Description: 劳务人员部门
|
||||
@ -138,4 +138,43 @@ public class DepartmentInfoServiceImpl extends ServiceImpl<DepartmentInfoMapper,
|
||||
List<GtMaterialInOutWarehouse> departmentAndTeamList = departmentInfoMapper.queryDepartmentAndTeamList(map);
|
||||
return departmentAndTeamList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> getDepartmentAndTeamList(Map<String, Object> map) {
|
||||
List<AllProjectTeamVo> allProjectTeamVoList = workerInfoMapper.selectAllProjectTeamList(map);
|
||||
List<AllProjectDeptVo> allProjectDeptVoList = workerInfoMapper.selectAllProjectDeptList(map);
|
||||
List<Map<String, Object>> resultList = new ArrayList<>();
|
||||
for (AllProjectTeamVo allProjectTeamVo : allProjectTeamVoList) {
|
||||
Map<String, Object> map1 = new HashMap<>();
|
||||
map1.put("id", allProjectTeamVo.getTeamId());
|
||||
map1.put("name", allProjectTeamVo.getTeamName());
|
||||
map1.put("enterpriseName", allProjectTeamVo.getEnterpriseName());
|
||||
map1.put("personNum", allProjectTeamVo.getTotalPersonNum());
|
||||
map1.put("type", 1);
|
||||
resultList.add(map1);
|
||||
}
|
||||
for (AllProjectDeptVo allProjectDeptVo : allProjectDeptVoList) {
|
||||
Map<String, Object> map2 = new HashMap<>();
|
||||
map2.put("id", allProjectDeptVo.getDeptId());
|
||||
map2.put("name", allProjectDeptVo.getDepartmentName());
|
||||
map2.put("enterpriseName", allProjectDeptVo.getEnterpriseName());
|
||||
map2.put("personNum", allProjectDeptVo.getTotalPersonNum());
|
||||
map2.put("type", 2);
|
||||
resultList.add(map2);
|
||||
}
|
||||
Collections.sort(resultList, new MapComparatorAsc());
|
||||
return resultList;
|
||||
}
|
||||
|
||||
static class MapComparatorAsc implements Comparator<Map<String, Object>> {
|
||||
@Override
|
||||
public int compare(Map<String, Object> m1, Map<String, Object> m2) {
|
||||
Integer v1 = Integer.valueOf(m1.get("personNum").toString());
|
||||
Integer v2 = Integer.valueOf(m2.get("personNum").toString());
|
||||
if (v2 != null) {
|
||||
return v2.compareTo(v1);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,6 +7,8 @@ import com.zhgd.xmgl.modules.exam.entity.*;
|
||||
import com.zhgd.xmgl.modules.exam.service.*;
|
||||
import com.zhgd.xmgl.modules.project.entity.Project;
|
||||
import com.zhgd.xmgl.modules.project.service.IProjectService;
|
||||
import com.zhgd.xmgl.modules.worker.entity.WorkerInfo;
|
||||
import com.zhgd.xmgl.modules.worker.service.IWorkerInfoService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
@ -51,6 +53,9 @@ public class ExamTask {
|
||||
@Autowired
|
||||
private IExamNoticeService examNoticeService;
|
||||
|
||||
@Autowired
|
||||
private IWorkerInfoService workerInfoService;
|
||||
|
||||
|
||||
@Scheduled(cron = "0 0/1 * * * ?")
|
||||
public void examNotice() {
|
||||
@ -68,26 +73,41 @@ public class ExamTask {
|
||||
List<ExamTrainRecord> examTrainRecordList = examTrainRecordService.list(Wrappers.<ExamTrainRecord>lambdaQuery().eq(ExamTrainRecord::getTrainId, examTrainList.get(j).getId()));
|
||||
for (int i1 = 0; i1 < examTrainRecordList.size(); i1++) {
|
||||
if (examTrainRecordList.get(i1).getScore() == null) {
|
||||
ExamNotice examNotice = new ExamNotice();
|
||||
examNotice.setWorkerId(examTrainRecordList.get(i1).getWorkerId().toString());
|
||||
examNotice.setWorkerName(examTrainRecordList.get(i1).getWorkerName());
|
||||
examNotice.setType(1);
|
||||
examNotice.setContent("参加安全教育培训");
|
||||
examNotice.setProjectSn(list.get(i).getProjectSn());
|
||||
noticeList.add(examNotice);
|
||||
ExamNotice exist = examNoticeService.getOne(Wrappers.<ExamNotice>lambdaQuery().eq(ExamNotice::getWorkerId, examTrainRecordList.get(i1).getWorkerId())
|
||||
.eq(ExamNotice::getRecordId, examTrainRecordList.get(i1).getId())
|
||||
.eq(ExamNotice::getContent, "参加安全教育培训"));
|
||||
if (exist == null) {
|
||||
WorkerInfo workerInfo = workerInfoService.getById(examTrainRecordList.get(i1).getWorkerId());
|
||||
ExamNotice examNotice = new ExamNotice();
|
||||
examNotice.setWorkerId(examTrainRecordList.get(i1).getWorkerId().toString());
|
||||
examNotice.setWorkerName(examTrainRecordList.get(i1).getWorkerName());
|
||||
examNotice.setType(1);
|
||||
examNotice.setContent("参加安全教育培训");
|
||||
examNotice.setProjectSn(list.get(i).getProjectSn());
|
||||
examNotice.setEnterpriseId(workerInfo.getEnterpriseId());
|
||||
noticeList.add(examNotice);
|
||||
}
|
||||
}
|
||||
}
|
||||
List<ExamCourseRecord> examCourseRecords = examCourseRecordService.list(Wrappers.<ExamCourseRecord>lambdaQuery()
|
||||
.eq(ExamCourseRecord::getTrainId, examTrainList.get(j).getId()));
|
||||
for (int i2 = 0; i2 < examCourseRecords.size(); i2++) {
|
||||
if (examCourseRecords.get(i2).getNumber() == null || examCourseRecords.get(i2).getNumber() == 0) {
|
||||
ExamNotice examNotice = new ExamNotice();
|
||||
examNotice.setWorkerId(examCourseRecords.get(i2).getWorkerId().toString());
|
||||
examNotice.setWorkerName(examCourseRecords.get(i2).getWorkerName());
|
||||
examNotice.setType(1);
|
||||
examNotice.setContent("参加安全教育课程学习");
|
||||
examNotice.setProjectSn(list.get(i).getProjectSn());
|
||||
noticeList.add(examNotice);
|
||||
ExamNotice exist = examNoticeService.getOne(Wrappers.<ExamNotice>lambdaQuery().eq(ExamNotice::getWorkerId, examCourseRecords.get(i2).getWorkerId())
|
||||
.eq(ExamNotice::getRecordId, examCourseRecords.get(i2).getId())
|
||||
.eq(ExamNotice::getContent, "参加安全教育课程学习"));
|
||||
if (exist == null) {
|
||||
WorkerInfo workerInfo = workerInfoService.getById(examCourseRecords.get(i2).getWorkerId());
|
||||
ExamNotice examNotice = new ExamNotice();
|
||||
examNotice.setWorkerId(examCourseRecords.get(i2).getWorkerId().toString());
|
||||
examNotice.setWorkerName(examCourseRecords.get(i2).getWorkerName());
|
||||
examNotice.setType(1);
|
||||
examNotice.setContent("参加安全教育课程学习");
|
||||
examNotice.setProjectSn(list.get(i).getProjectSn());
|
||||
examNotice.setEnterpriseId(workerInfo.getEnterpriseId());
|
||||
examNotice.setRecordId(examCourseRecords.get(i2).getId());
|
||||
noticeList.add(examNotice);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -306,7 +306,8 @@ public class WorkerTask {
|
||||
Set<String> personSn = new HashSet<>();
|
||||
//计算日常考勤规则
|
||||
if (type.equals("1")) {
|
||||
DateTime dateTime = DateUtil.beginOfDay(DateUtil.offsetDay(new Date(), -3));
|
||||
dayNum = dayNum + 1;
|
||||
DateTime dateTime = DateUtil.beginOfDay(DateUtil.offsetDay(new Date(), -dayNum));
|
||||
Set<String> personSet = workerAttendanceService.list(Wrappers.<WorkerAttendance>lambdaQuery().between(WorkerAttendance::getCreateTime
|
||||
, dateTime, new Date())).stream().map(w -> w.getPersonSn()).collect(Collectors.toSet());
|
||||
Set<String> workerSet = workerInfoMapper.selectList(Wrappers.<WorkerInfo>lambdaQuery().eq(WorkerInfo::getInserviceType, 1)).stream().map(w -> w.getPersonSn()).collect(Collectors.toSet());
|
||||
@ -314,6 +315,7 @@ public class WorkerTask {
|
||||
personSn.addAll(workerSet);
|
||||
}
|
||||
if (type.equals("2")) {
|
||||
dayNum = dayNum + 1;
|
||||
List<XzSecurityInspectTaskRecord> xzSecurityInspectTaskRecords = xzSecurityInspectTaskRecordMapper.selectList(Wrappers.<XzSecurityInspectTaskRecord>lambdaQuery()
|
||||
.eq(XzSecurityInspectTaskRecord::getSn, project.getProjectSn())
|
||||
.le(XzSecurityInspectTaskRecord::getEndTime, DateUtil.offsetDay(new Date(), -dayNum)));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user