parent
49ba6ddacb
commit
81e7dd0329
|
|
@ -6,13 +6,17 @@ import com.bonus.common.core.web.page.TableDataInfo;
|
||||||
import com.bonus.common.log.annotation.Log;
|
import com.bonus.common.log.annotation.Log;
|
||||||
import com.bonus.common.log.enums.BusinessType;
|
import com.bonus.common.log.enums.BusinessType;
|
||||||
import com.bonus.common.security.annotation.RequiresPermissions;
|
import com.bonus.common.security.annotation.RequiresPermissions;
|
||||||
|
import com.bonus.common.security.utils.SecurityUtils;
|
||||||
|
import com.bonus.system.api.domain.SysRole;
|
||||||
import com.bonus.system.api.domain.SysUser;
|
import com.bonus.system.api.domain.SysUser;
|
||||||
import com.bonus.system.att.entity.AttDataDetailsBean;
|
import com.bonus.system.att.entity.AttDataDetailsBean;
|
||||||
import com.bonus.system.att.entity.AttDayReportBean;
|
import com.bonus.system.att.entity.AttDayReportBean;
|
||||||
import com.bonus.system.att.entity.AttMonthReportBean;
|
import com.bonus.system.att.entity.AttMonthReportBean;
|
||||||
import com.bonus.system.att.service.AttendanceDetailsService;
|
import com.bonus.system.att.service.AttendanceDetailsService;
|
||||||
|
import com.bonus.system.basic.dao.SysUserMapper;
|
||||||
import com.bonus.system.basic.domain.SysOrg;
|
import com.bonus.system.basic.domain.SysOrg;
|
||||||
import com.bonus.system.basic.service.SysOrgService;
|
import com.bonus.system.basic.service.SysOrgService;
|
||||||
|
import com.bonus.system.holiday.dao.WorkReportDao;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
@ -38,6 +42,12 @@ public class AttendanceDetailsController extends BaseController {
|
||||||
@Resource(name = "sysOrgService")
|
@Resource(name = "sysOrgService")
|
||||||
private SysOrgService sysOrgService;
|
private SysOrgService sysOrgService;
|
||||||
|
|
||||||
|
@Resource(name = "WorkReportDao")
|
||||||
|
private WorkReportDao dao;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private SysUserMapper userMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取考勤原始明细列表
|
* 获取考勤原始明细列表
|
||||||
*/
|
*/
|
||||||
|
|
@ -62,6 +72,39 @@ public class AttendanceDetailsController extends BaseController {
|
||||||
@Log(title = "考勤报表->考勤明细->列表查询", businessType = BusinessType.QUERY)
|
@Log(title = "考勤报表->考勤明细->列表查询", businessType = BusinessType.QUERY)
|
||||||
public TableDataInfo getDetailsList(AttDataDetailsBean bean) {
|
public TableDataInfo getDetailsList(AttDataDetailsBean bean) {
|
||||||
try{
|
try{
|
||||||
|
// 部门负责人和部门考勤员可以在考勤明细页面看到本部门人员的考勤信息,管理员和人资专员可以看所有数据,普通人员看到自己数据
|
||||||
|
Long userId = SecurityUtils.getUserId();
|
||||||
|
List<SysRole> sysRoleList = dao.getRoleListByUserId(userId);
|
||||||
|
int roleCount = 0;
|
||||||
|
if(!sysRoleList.isEmpty()){
|
||||||
|
for (SysRole sysRole : sysRoleList) {
|
||||||
|
if(sysRole.getRoleName().contains("管理员")){
|
||||||
|
roleCount = 1;
|
||||||
|
break;
|
||||||
|
}else if(sysRole.getRoleName().contains("人资专员")){
|
||||||
|
roleCount = 1;
|
||||||
|
break;
|
||||||
|
}else if(sysRole.getRoleName().contains("部门负责人")){
|
||||||
|
roleCount = 2;
|
||||||
|
break;
|
||||||
|
}else if(sysRole.getRoleName().contains("部门考勤员")){
|
||||||
|
roleCount = 2;
|
||||||
|
break;
|
||||||
|
}else if(sysRole.getRoleName().contains("普通人员")){
|
||||||
|
roleCount = 3;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(roleCount==2){
|
||||||
|
String ids = userMapper.getOrg(userId);
|
||||||
|
bean.setRoleType("2");
|
||||||
|
bean.setOrgListId(ids);
|
||||||
|
}else if(roleCount==3){
|
||||||
|
bean.setRoleType("3");
|
||||||
|
bean.setUserId(userId);
|
||||||
|
}
|
||||||
startPage();
|
startPage();
|
||||||
return getDataTable(attendanceDetailsService.selectAttDetailsList(bean));
|
return getDataTable(attendanceDetailsService.selectAttDetailsList(bean));
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
|
|
@ -222,4 +265,19 @@ public class AttendanceDetailsController extends BaseController {
|
||||||
return attendanceDetailsService.synchronous(bean);
|
return attendanceDetailsService.synchronous(bean);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取日报表-详细记录
|
||||||
|
*/
|
||||||
|
@GetMapping("/getAttDayList")
|
||||||
|
@Log(title = "考勤报表->日报表->今日出勤状态", businessType = BusinessType.QUERY)
|
||||||
|
public TableDataInfo getAttDayList(AttDataDetailsBean bean) {
|
||||||
|
try{
|
||||||
|
startPage();
|
||||||
|
return getDataTable(attendanceDetailsService.getAttDayList(bean));
|
||||||
|
}catch (Exception e){
|
||||||
|
log.error(e.toString(),e);
|
||||||
|
}
|
||||||
|
return getDataTableError(new ArrayList<>());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -84,4 +84,6 @@ public interface AttendanceDetailsDao {
|
||||||
List<AttDataDetailsBean> getAttDayReportDetailsList(AttDataDetailsBean bean);
|
List<AttDataDetailsBean> getAttDayReportDetailsList(AttDataDetailsBean bean);
|
||||||
|
|
||||||
List<AttDataDetailsBean> getOutCountList(AttDataDetailsBean bean);
|
List<AttDataDetailsBean> getOutCountList(AttDataDetailsBean bean);
|
||||||
|
|
||||||
|
List<AttDataDetailsBean> getAttDayList(AttDataDetailsBean bean);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -199,6 +199,18 @@ public class AttDataDetailsBean {
|
||||||
/** 上班时间外出次数 */
|
/** 上班时间外出次数 */
|
||||||
private Integer outCount;
|
private Integer outCount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 角色类型 1:人资专员和管理员;2:部门考勤员,部门负责人 3:普通人员
|
||||||
|
*/
|
||||||
|
private String roleType;
|
||||||
|
private String orgListId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 考勤类型
|
||||||
|
*/
|
||||||
|
private String attendType;
|
||||||
|
private String attStatusToday;
|
||||||
|
|
||||||
public AttDataDetailsBean() {
|
public AttDataDetailsBean() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -99,4 +99,6 @@ public interface AttendanceDetailsService {
|
||||||
List<AttDataDetailsBean> getOutCountList(AttDataDetailsBean bean);
|
List<AttDataDetailsBean> getOutCountList(AttDataDetailsBean bean);
|
||||||
|
|
||||||
AjaxResult synchronous(AttDataDetailsBean bean);
|
AjaxResult synchronous(AttDataDetailsBean bean);
|
||||||
|
|
||||||
|
List<AttDataDetailsBean> getAttDayList(AttDataDetailsBean bean);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -183,6 +183,11 @@ public class AttendanceDetailsServiceImpl implements AttendanceDetailsService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<AttDataDetailsBean> getAttDayList(AttDataDetailsBean bean) {
|
||||||
|
return attendanceDetailsDao.getAttDayList(bean);
|
||||||
|
}
|
||||||
|
|
||||||
public List<AttDayReportBean> getAttDayReportListAll(List<AttDayReportBean> list) {
|
public List<AttDayReportBean> getAttDayReportListAll(List<AttDayReportBean> list) {
|
||||||
List<AttDayReportBean> allList = new ArrayList<>();
|
List<AttDayReportBean> allList = new ArrayList<>();
|
||||||
Map<String, AttDayReportBean> map = list.stream()
|
Map<String, AttDayReportBean> map = list.stream()
|
||||||
|
|
|
||||||
|
|
@ -24,4 +24,9 @@ public class IndexTodayAttBean {
|
||||||
*/
|
*/
|
||||||
private String attRate;
|
private String attRate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 未出勤
|
||||||
|
*/
|
||||||
|
private String noActualAttNum;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,12 @@
|
||||||
and ( toWorkAttStatus = #{attStatus} or offWorkAttStatus = #{attStatus} )
|
and ( toWorkAttStatus = #{attStatus} or offWorkAttStatus = #{attStatus} )
|
||||||
</if>
|
</if>
|
||||||
</if>
|
</if>
|
||||||
|
<if test="roleType =='2' || roleType == 2 ">
|
||||||
|
and v.org_id in (#{orgListId})
|
||||||
|
</if>
|
||||||
|
<if test="roleType =='3' || roleType == 3 ">
|
||||||
|
and su.user_id = #{userId}
|
||||||
|
</if>
|
||||||
GROUP BY
|
GROUP BY
|
||||||
v.att_current_day,
|
v.att_current_day,
|
||||||
v.user_id
|
v.user_id
|
||||||
|
|
@ -141,16 +147,13 @@
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getAttDayReportList" resultType="com.bonus.system.att.entity.AttDayReportBean">
|
<select id="getAttDayReportList" resultType="com.bonus.system.att.entity.AttDayReportBean">
|
||||||
SELECT
|
SELECT adr.*,
|
||||||
adr.*,
|
COUNT(awa.user_id) as outCount
|
||||||
COUNT( awa.user_id ) as outCount
|
FROM att_day_report adr
|
||||||
FROM
|
LEFT JOIN att_work_abnormal awa
|
||||||
att_day_report adr
|
ON awa.att_current_day = adr.att_current_day and awa.org_id = adr.org_id
|
||||||
LEFT JOIN att_work_abnormal awa ON awa.att_current_day = adr.att_current_day and awa.org_id = adr.org_id
|
WHERE adr.att_current_day BETWEEN #{startDate} AND #{endDate}
|
||||||
WHERE
|
GROUP BY adr.att_current_day
|
||||||
adr.att_current_day BETWEEN #{startDate} AND #{endDate}
|
|
||||||
GROUP BY
|
|
||||||
adr.att_current_day
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getAttMonthReportList" resultType="com.bonus.system.att.entity.AttMonthReportBean">
|
<select id="getAttMonthReportList" resultType="com.bonus.system.att.entity.AttMonthReportBean">
|
||||||
|
|
@ -220,6 +223,41 @@
|
||||||
awa.att_current_day DESC
|
awa.att_current_day DESC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getAttDayList" resultType="com.bonus.system.att.entity.AttDataDetailsBean">
|
||||||
|
SELECT
|
||||||
|
su.user_name, so.org_name, a.*
|
||||||
|
FROM
|
||||||
|
sys_user su
|
||||||
|
LEFT JOIN v_att_update_data a ON a.user_id = su.user_id
|
||||||
|
LEFT JOIN att_group_person_relation agpr ON agpr.user_id = su.user_id
|
||||||
|
LEFT JOIN sys_user_org org ON org.user_id = su.user_id
|
||||||
|
left join sys_organization so on so.id = org.org_id
|
||||||
|
WHERE su.is_active = 1 AND agpr.is_active = 1
|
||||||
|
<if test="attendType == 1 || attendType == '1'">
|
||||||
|
<if test="attCurrentDay != null and attCurrentDay != ''">
|
||||||
|
AND att_current_day = #{attCurrentDay}
|
||||||
|
</if>
|
||||||
|
<if test='attStatus == "1"'>
|
||||||
|
and ( toWorkAttStatus = #{attStatus} and offWorkAttStatus = #{attStatus} )
|
||||||
|
</if>
|
||||||
|
</if>
|
||||||
|
<if test="attendType == 2 || attendType == '2'">
|
||||||
|
<if test="attCurrentDay != null and attCurrentDay != ''">
|
||||||
|
AND att_current_day = #{attCurrentDay}
|
||||||
|
</if>
|
||||||
|
<if test='attStatus == "1"'>
|
||||||
|
and ( toWorkAttStatus != #{attStatus} and offWorkAttStatus != #{attStatus} )
|
||||||
|
</if>
|
||||||
|
</if>
|
||||||
|
<if test="attStatusToday != null and attStatusToday != ''">
|
||||||
|
and ( toWorkAttStatus = #{attStatusToday} or offWorkAttStatus = #{attStatusToday} )
|
||||||
|
</if>
|
||||||
|
<if test="userName != null and userName != ''">
|
||||||
|
AND su.user_name like concat('%', #{userName}, '%')
|
||||||
|
</if>
|
||||||
|
GROUP BY agpr.user_id
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
<update id="updateAttDetailsData">
|
<update id="updateAttDetailsData">
|
||||||
<foreach collection="list" item="params" separator=";">
|
<foreach collection="list" item="params" separator=";">
|
||||||
|
|
|
||||||
|
|
@ -161,6 +161,13 @@
|
||||||
<if test="roleType =='2' || roleType == 2 ">
|
<if test="roleType =='2' || roleType == 2 ">
|
||||||
and suo.org_id in (#{orgListId})
|
and suo.org_id in (#{orgListId})
|
||||||
</if>
|
</if>
|
||||||
|
<if test="isAttend =='1' || isAttend == 1 ">
|
||||||
|
and agpr.user_id is not null
|
||||||
|
</if>
|
||||||
|
<if test="isAttend =='0' || isAttend == 0 ">
|
||||||
|
and agpr.user_id is null
|
||||||
|
</if>
|
||||||
|
|
||||||
GROUP BY su.user_id
|
GROUP BY su.user_id
|
||||||
order by su.update_time desc
|
order by su.update_time desc
|
||||||
</select>
|
</select>
|
||||||
|
|
|
||||||
|
|
@ -5,13 +5,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<mapper namespace="com.bonus.system.index.dao.HomePageDao">
|
<mapper namespace="com.bonus.system.index.dao.HomePageDao">
|
||||||
|
|
||||||
<select id="getTodayAttData" resultType="com.bonus.system.index.entity.IndexTodayAttBean">
|
<select id="getTodayAttData" resultType="com.bonus.system.index.entity.IndexTodayAttBean">
|
||||||
select a.shouldAttNum, a.actualAttNum, TRUNCATE(a.actualAttNum /
|
select a.shouldAttNum, a.actualAttNum,(a.shouldAttNum - a.actualAttNum) as noActualAttNum, TRUNCATE(a.actualAttNum /
|
||||||
a.shouldAttNum * 100, 0) as attRate from (
|
a.shouldAttNum * 100, 0) as attRate from (
|
||||||
select count(su.user_id) as shouldAttNum, count(a.user_id) as actualAttNum
|
select count(agpr.user_id ) as shouldAttNum, count(a.user_id) as actualAttNum
|
||||||
from sys_user su left join (
|
from sys_user su left join (
|
||||||
select * from v_att_update_data where att_current_day = #{date}
|
select * from v_att_update_data where att_current_day = #{date}
|
||||||
and (toWorkAttStatus = 1 or offWorkAttStatus = 1)
|
and (toWorkAttStatus = 1 or offWorkAttStatus = 1)
|
||||||
) a on a.user_id = su.user_id
|
) a on a.user_id = su.user_id
|
||||||
|
LEFT JOIN att_group_person_relation agpr on agpr.user_id = su.user_id and agpr.is_active = 1
|
||||||
where su.is_active = 1
|
where su.is_active = 1
|
||||||
) a
|
) a
|
||||||
</select>
|
</select>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue