Commit c6feac8e authored by 吴卿华's avatar 吴卿华

员工详情查看

parent 272e7779
......@@ -6,29 +6,23 @@ import java.util.stream.Collectors;
import com.zehong.common.constant.UserConstants;
import com.zehong.common.core.domain.entity.SysRole;
import com.zehong.common.core.domain.entity.SysUser;
import com.zehong.common.core.domain.model.LoginUser;
import com.zehong.common.utils.SecurityUtils;
import com.zehong.common.utils.ServletUtils;
import com.zehong.common.utils.StringUtils;
import com.zehong.system.domain.form.TStaffForm;
import com.zehong.system.domain.vo.TStaffVo;
import com.zehong.system.service.ISysPostService;
import com.zehong.system.service.ISysRoleService;
import com.zehong.system.service.ISysUserService;
import com.zehong.system.domain.vo.UserCourseVo;
import com.zehong.system.service.*;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.enums.BusinessType;
import com.zehong.system.domain.TStaff;
import com.zehong.system.service.ITStaffService;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.common.core.page.TableDataInfo;
......@@ -54,6 +48,9 @@ public class TStaffController extends BaseController
@Autowired
private ISysUserService userService;
@Autowired
private ITTrainCourseService tTrainCourseService;
/**
* 查询员工信息管理列表
*/
......@@ -142,4 +139,13 @@ public class TStaffController extends BaseController
{
return toAjax(tStaffService.deleteTStaffByIds(staffIds));
}
@ApiOperation("用户课程列表")
@GetMapping("/userCourseList")
public TableDataInfo userCourseList(TStaffForm tStaff){
startPage();
List<UserCourseVo> list = tTrainCourseService.userCourseLists(tStaff);
return getDataTable(list);
}
}
......@@ -89,6 +89,7 @@ public class TStaff extends BaseEntity
@Excel(name = "删除标志", readConverterExp = "0=正常,1删除")
private String isDel;
public Long[] getRoleIds() {
return roleIds;
}
......
......@@ -10,7 +10,7 @@ import java.util.Date;
/**
* 员工信息管理对象 t_staff
*
*
* @author zehong
* @date 2022-06-17
*/
......@@ -38,32 +38,66 @@ public class TStaffForm extends BaseEntity
@Excel(name = "手机号码")
private String phonenumber;
public void setStaffName(String staffName)
private Long userId;
private Long staffId;
private int dataKind;
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public int getDataKind() {
return dataKind;
}
public void setDataKind(int dataKind) {
this.dataKind = dataKind;
}
public static long getSerialVersionUID() {
return serialVersionUID;
}
public Long getStaffId() {
return staffId;
}
public void setStaffId(Long staffId) {
this.staffId = staffId;
}
public void setStaffName(String staffName)
{
this.staffName = staffName;
}
public String getStaffName()
public String getStaffName()
{
return staffName;
}
public void setStaffCode(String staffCode)
public void setStaffCode(String staffCode)
{
this.staffCode = staffCode;
}
public String getStaffCode()
public String getStaffCode()
{
return staffCode;
}
public void setSex(String sex)
public void setSex(String sex)
{
this.sex = sex;
}
public String getSex()
public String getSex()
{
return sex;
}
......@@ -81,9 +115,22 @@ public class TStaffForm extends BaseEntity
this.phonenumber = phonenumber;
}
public String getPhonenumber()
public String getPhonenumber()
{
return phonenumber;
}
@Override
public String toString() {
return "TStaffForm{" +
"staffName='" + staffName + '\'' +
", staffCode='" + staffCode + '\'' +
", sex='" + sex + '\'' +
", deptId=" + deptId +
", phonenumber='" + phonenumber + '\'' +
", userId=" + userId +
", staffId=" + staffId +
", dataKind=" + dataKind +
'}';
}
}
......@@ -54,4 +54,7 @@ public class UserCourseVo {
/**单选题分数*/
private Integer singleChoiceScore;
/** 已完成时长*/
private Integer finishDuration;
}
......@@ -4,20 +4,21 @@ import java.util.List;
import com.zehong.system.domain.StatisticsTrainCourse;
import com.zehong.system.domain.TTrainCourse;
import com.zehong.system.domain.form.TStaffForm;
import com.zehong.system.domain.vo.UserCourseVo;
import org.apache.ibatis.annotations.Param;
/**
* 培训课程Mapper接口
*
*
* @author zehong
* @date 2022-09-19
*/
public interface TTrainCourseMapper
public interface TTrainCourseMapper
{
/**
* 查询培训课程
*
*
* @param courseId 培训课程ID
* @return 培训课程
*/
......@@ -25,7 +26,7 @@ public interface TTrainCourseMapper
/**
* 查询培训课程列表
*
*
* @param tTrainCourse 培训课程
* @return 培训课程集合
*/
......@@ -33,7 +34,7 @@ public interface TTrainCourseMapper
/**
* 新增培训课程
*
*
* @param tTrainCourse 培训课程
* @return 结果
*/
......@@ -41,7 +42,7 @@ public interface TTrainCourseMapper
/**
* 修改培训课程
*
*
* @param tTrainCourse 培训课程
* @return 结果
*/
......@@ -49,7 +50,7 @@ public interface TTrainCourseMapper
/**
* 删除培训课程
*
*
* @param courseId 培训课程ID
* @return 结果
*/
......@@ -57,7 +58,7 @@ public interface TTrainCourseMapper
/**
* 批量删除培训课程
*
*
* @param courseIds 需要删除的数据ID
* @return 结果
*/
......@@ -84,4 +85,6 @@ public interface TTrainCourseMapper
* @return List<StatisticsTrainCourse>
*/
List<StatisticsTrainCourse> statisticsTrainCourse(StatisticsTrainCourse statisticsTrainCourse);
List<UserCourseVo> userCourseLists(TStaffForm tStaff);
}
......@@ -6,6 +6,7 @@ import java.util.Map;
import com.zehong.system.domain.StatisticsTrainCourse;
import com.zehong.system.domain.TTrainCourse;
import com.zehong.system.domain.TTrainUserCourse;
import com.zehong.system.domain.form.TStaffForm;
import com.zehong.system.domain.vo.UserCourseVo;
/**
......@@ -81,6 +82,9 @@ public interface ITTrainCourseService
* @return
*/
public List<UserCourseVo> userCourseList(Long userId,Integer type);
public List<UserCourseVo> userCourseLists(TStaffForm tStaff);
public List<UserCourseVo> youkeCourseList(Long userId,Integer type);
/**
* 考试
......
......@@ -10,6 +10,7 @@ import com.zehong.system.domain.TTrainCourse;
import com.zehong.system.domain.TTrainCourseTopic;
import com.zehong.system.domain.TTrainPlan;
import com.zehong.system.domain.TTrainUserCourse;
import com.zehong.system.domain.form.TStaffForm;
import com.zehong.system.domain.vo.UserCourseVo;
import com.zehong.system.mapper.TTrainCourseMapper;
import com.zehong.system.mapper.TTrainCourseTopicMapper;
......@@ -177,15 +178,54 @@ public class TTrainCourseServiceImpl implements ITTrainCourseService
Long courseId = list.get(i).getCourseId();
//查询课程下面的题
List<TTrainCourseTopic> tTrainCourseTopics = tTrainCourseTopicMapper.selectCourseTopicList(courseId);
for (int t=0;t<tTrainCourseTopics.size();t++){
if (tTrainCourseTopics.get(t).getTopicType()==1){
totalScore=totalScore+list.get(i).getSingleChoiceScore();
}else if (tTrainCourseTopics.get(t).getTopicType()==2){
totalScore=totalScore+list.get(i).getMultipleChoiceScore();
}else if (tTrainCourseTopics.get(t).getTopicType()==3){
totalScore=totalScore+list.get(i).getJudgmentScore();
for (int t = 0; t < tTrainCourseTopics.size(); t++) {
if (StringUtils.isEmpty(String.valueOf(tTrainCourseTopics.get(t).getTopicType()))) {
if (tTrainCourseTopics.get(t).getTopicType() == 1) {
totalScore = totalScore + list.get(i).getSingleChoiceScore();
} else if (tTrainCourseTopics.get(t).getTopicType() == 2) {
totalScore = totalScore + list.get(i).getMultipleChoiceScore();
} else if (tTrainCourseTopics.get(t).getTopicType() == 3) {
totalScore = totalScore + list.get(i).getJudgmentScore();
}
}
}
list.get(i).setTotalScore(totalScore);
}
return list;
}
@Override
public List<UserCourseVo> userCourseLists(TStaffForm tStaff) {
List<UserCourseVo> list = tTrainCourseMapper.userCourseLists(tStaff);
for (UserCourseVo v :list){
if(v.getTestEndTime()!=null&&v.getTestEndTime().getTime()<new Date().getTime()){
v.setState(3);
}
if(v.getTestStartTime()!=null&&v.getTestStartTime().getTime()>new Date().getTime()){
v.setState(4);
}
}
for (int i=0;i<list.size();i++){
int totalScore=0;
Long courseId = list.get(i).getCourseId();
//查询课程下面的题
List<TTrainCourseTopic> tTrainCourseTopics = tTrainCourseTopicMapper.selectCourseTopicList(courseId);
for (int t = 0; t < tTrainCourseTopics.size(); t++) {
if (StringUtils.isEmpty(String.valueOf(tTrainCourseTopics.get(t).getTopicType()))) {
if (tTrainCourseTopics.get(t).getTopicType() == 1) {
totalScore = totalScore + list.get(i).getSingleChoiceScore();
} else if (tTrainCourseTopics.get(t).getTopicType() == 2) {
totalScore = totalScore + list.get(i).getMultipleChoiceScore();
} else if (tTrainCourseTopics.get(t).getTopicType() == 3) {
totalScore = totalScore + list.get(i).getJudgmentScore();
}
}
}
list.get(i).setTotalScore(totalScore);
}
return list;
......
......@@ -168,7 +168,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</insert>
<select id="userCourseList" resultType="com.zehong.system.domain.vo.UserCourseVo">
SELECT uc.user_course_id AS userCourseId,uc.state ,uc.examination_time AS examinationTime,uc.train_state AS trainState,
SELECT uc.user_course_id AS userCourseId,uc.finish_duration AS finishDuration,uc.state ,uc.examination_time AS examinationTime,uc.train_state AS trainState,
uc.`examination_result` AS examinationResult,uc.`create_time` AS createTime,c.test_start_time as testStartTime,c.test_end_time as testEndTime,
c.`course_name` AS courseName, c.`topic_num` AS topicNum,c.`release_time` AS releaseTime,c.data_kind as dataKind,c.personnel_type as personnelType,
p.`plan_name` AS courseType,c.course_id as courseId,c.qualified_num as qualifiedNum,c.multiple_choice_score as multipleChoiceScore,
......@@ -183,6 +183,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="type!=null and type == 2">
and uc.state = 2
</if>
<if test="dataKind!=null">
and c.data_kind = #{dataKind}
</if>
<if test="type!=null and type == 3">
and uc.state !=0
order by uc.examination_time desc
......@@ -210,4 +213,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
GROUP BY course.course_id
</select>
<select id="userCourseLists" resultType="com.zehong.system.domain.vo.UserCourseVo">
SELECT uc.user_course_id AS userCourseId,uc.finish_duration AS finishDuration,uc.state ,uc.examination_time AS examinationTime,uc.train_state AS trainState,
uc.`examination_result` AS examinationResult,uc.`create_time` AS createTime,c.test_start_time as testStartTime,c.test_end_time as testEndTime,
c.`course_name` AS courseName, c.`topic_num` AS topicNum,c.`release_time` AS releaseTime,c.data_kind as dataKind,c.personnel_type as personnelType,
p.`plan_name` AS courseType,c.course_id as courseId,c.qualified_num as qualifiedNum,c.multiple_choice_score as multipleChoiceScore,
c.judgment_score as judgmentScore,c.single_choice_score as singleChoiceScore
FROM t_train_user_course uc
LEFT JOIN t_train_course c ON c.`course_id` = uc.`course_id`
LEFT JOIN t_train_plan p ON p.`plan_id` = c.`course_type`
WHERE uc.user_id = #{staffId} and uc.personnel_type ='1'
and data_kind=#{dataKind}
</select>
</mapper>
......@@ -10,6 +10,16 @@ export function listStaff(query) {
})
}
// 查询员工用户课程列表 无分页
export function TStaffLisst(query) {
return request({
url: '/safetyManagement/staff/userCourseList',
method: 'get',
params: query
})
}
// 查询员工信息管理列表 无分页
export function TStaffList(query) {
return request({
......
......@@ -124,12 +124,12 @@
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
>修改</el-button>
<!--<el-button
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="showDetail(scope.row)"
>详情</el-button>-->
>详情</el-button>
<el-button
size="mini"
type="text"
......@@ -150,6 +150,145 @@
</el-col>
</el-row>
<!-- 档案信息对话框 -->
<el-dialog title="档案信息" width="1200px" :visible.sync="dialogTableVisible">
<template>
<el-descriptions class="margin-top" :column="3" :size="size" border>
<el-descriptions-item>
<template slot="label">
姓名
</template>
{{form.staffName}}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
性别
</template>
<p v-if="form.sex==0"></p>
<p v-if="form.sex==1"></p>
<p v-if="form.sex==2">未知</p>
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
手机号码
</template>
{{form.phonenumber}}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
归属部门
</template>
{{form.deptName}}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
职称
</template>
{{form.positionalTitles}}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
岗位
</template>
{{form.postName}}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
工种
</template>
{{form.profession}}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
是否为特种作业人员
</template>
<p v-if="form.specialOperators=='Y'"></p>
<p v-if="form.specialOperators=='N'"></p>
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
证书照片
</template>
<MyFileUpload
listType="picture-card"
@resFun="getFileInfo"
@remove="listRemove"
:fileArr="fileList"
/>
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
证书名称
</template>
{{form.certificateName}}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
证书有效日期
</template>
{{form.effectiveDate}}
</el-descriptions-item>
<el-descriptions-item>
<template slot="label">
备注
</template>
{{form.remark}}
</el-descriptions-item>
</el-descriptions>
<el-tabs v-model="activeName" @tab-click="handleClick">
<el-tab-pane label="培训信息" name="first">
<el-table v-loading="loading" :data="examinationList" @selection-change="handleSelectionChange">
<el-table-column label="培训课程" align="center" prop="courseName" >
<span slot-scope="scope" v-if="scope.row.courseName">{{scope.row.courseName}}</span>
<span v-else>-</span>
</el-table-column>
<el-table-column label="是否完成" align="center" prop="trainState">
<template slot-scope="scope">
<span v-if="scope.row.trainState == '0'">未完成</span>
<span v-if="scope.row.trainState == '1'">已完成</span>
</template>
</el-table-column>
<el-table-column label="培训时长(分钟)" align="center" prop="finishDuration" />
<el-table-column label="考试开始时间" align="center" prop="testStartTime" />
<el-table-column label="考试结束时间" align="center" prop="testEndTime" />
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getListS"
/>
</el-tab-pane>
<el-tab-pane label="考试信息" name="second">
<el-table v-loading="loading" :data="examinationList" @selection-change="handleSelectionChange">
<el-table-column label="培训课程" align="center" prop="courseName" >
<span slot-scope="scope" v-if="scope.row.courseName">{{scope.row.courseName}}</span>
<span v-else>-</span>
</el-table-column>
<el-table-column label="考试" align="center" prop="state">
<template slot-scope="scope">
<span v-if="scope.row.state == 0">未考试</span>
<span v-if="scope.row.state == 1">未通过</span>
<span v-if="scope.row.state == 2">已通过</span>
<span v-if="scope.row.state == 3||scope.row.state ==4">未考试</span>
</template>
</el-table-column>
<el-table-column label="考试开始时间" align="center" prop="testStartTime" />
<el-table-column label="考试结束时间" align="center" prop="testEndTime" />
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getListS"
/>
</el-tab-pane>
</el-tabs>
</template>
</el-dialog>
<!-- 添加参数配置对话框 -->
<el-dialog :title="title" :visible.sync="open" width="900px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
......@@ -446,7 +585,7 @@
</template>
<script>
import { listStaff, getStaff, delStaff, addStaff, updateStaff, exportStaff } from "@/api/safetyManagement/staff";
import { listStaff, getStaff, delStaff, addStaff, updateStaff, exportStaff,TStaffLisst } from "@/api/safetyManagement/staff";
import { treeselect } from "@/api/system/dept";
import MyFileUpload from '@/components/MyFileUpload';
import Treeselect from "@riophae/vue-treeselect";
......@@ -458,6 +597,11 @@ export default {
components: { Treeselect, MyFileUpload },
data() {
return {
staffId:0,
//详情标签页使用
activeName: 'second',
//用户详细信息遮罩层
dialogTableVisible : false,
// 遮罩层
loading: true,
// 导出遮罩层
......@@ -474,6 +618,8 @@ export default {
total: 0,
// 员工表格数据
staffList: null,
//考试信息
examinationList:null,
// 弹出层标题
title: "",
titleDetail: "",
......@@ -512,7 +658,9 @@ export default {
staffName: null,
phonenumber: null,
sex: null,
deptId: null
deptId: null,
staffId:0,
dataKind:1,
},
// 表单校验
rules: {
......@@ -552,6 +700,49 @@ export default {
});
},
methods: {
/***/
handleClick(tab, event) {
this.queryParams.dataKind=tab.index
TStaffLisst(this.queryParams).then(response => {
this.examinationList = response.rows;
this.total = response.total;
this.loading = false;
});
},
/**查看详情*/
showDetail(row){
this.dialogTableVisible=true;
//获取id
const staffId = row.staffId || this.ids;
getUser().then(response => {
this.roleOptions = response.roles;
});
getStaff(staffId).then(response => {
this.form = response.data;
this.postOptions = response.posts;
if (this.form.certificateUrl) {
this.fileList.push({
url: this.form.certificateUrl,
});
}
});
this.queryParams.staffId=row.staffId;
TStaffLisst(this.queryParams).then(response => {
this.examinationList = response.rows;
this.total = response.total;
this.loading = false;
});
},
/** 查询员工列表 */
getListS() {
this.loading = true;
TStaffLisst(this.queryParams).then(response => {
this.examinationList = response.rows;
this.total = response.total;
this.loading = false;
});
},
/** 查询员工列表 */
getList() {
this.loading = true;
......@@ -636,6 +827,7 @@ export default {
},
// 多选框选中数据
handleSelectionChange(selection) {
console.log(selection)
this.ids = selection.map(item => item.staffId);
this.single = selection.length != 1;
this.multiple = !selection.length;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment