当天新增人员-生成当天考勤模板数据
This commit is contained in:
parent
64dcc34d46
commit
d5757a7e05
|
|
@ -1,5 +1,6 @@
|
||||||
package com.bonus.system.att.dao;
|
package com.bonus.system.att.dao;
|
||||||
|
|
||||||
|
import com.bonus.system.att.entity.AttDataBean;
|
||||||
import com.bonus.system.att.entity.AttGroupBean;
|
import com.bonus.system.att.entity.AttGroupBean;
|
||||||
import com.bonus.system.att.entity.AttGroupCheckOrgBean;
|
import com.bonus.system.att.entity.AttGroupCheckOrgBean;
|
||||||
import com.bonus.system.basic.domain.SysTree;
|
import com.bonus.system.basic.domain.SysTree;
|
||||||
|
|
@ -11,6 +12,7 @@ import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 考勤组-数据访问层
|
* 考勤组-数据访问层
|
||||||
|
*
|
||||||
* @author zys
|
* @author zys
|
||||||
*/
|
*/
|
||||||
@Repository("attGroupDao")
|
@Repository("attGroupDao")
|
||||||
|
|
@ -18,6 +20,7 @@ public interface AttGroupDao {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取考勤组列表
|
* 获取考勤组列表
|
||||||
|
*
|
||||||
* @param bean 参数
|
* @param bean 参数
|
||||||
* @return list bean
|
* @return list bean
|
||||||
*/
|
*/
|
||||||
|
|
@ -25,12 +28,14 @@ public interface AttGroupDao {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询组织选择列表
|
* 查询组织选择列表
|
||||||
|
*
|
||||||
* @return list bean
|
* @return list bean
|
||||||
*/
|
*/
|
||||||
List<AttGroupCheckOrgBean> selectOrgList();
|
List<AttGroupCheckOrgBean> selectOrgList();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除考勤组
|
* 删除考勤组
|
||||||
|
*
|
||||||
* @param groupId 考勤组编号
|
* @param groupId 考勤组编号
|
||||||
* @return 1|0
|
* @return 1|0
|
||||||
*/
|
*/
|
||||||
|
|
@ -38,6 +43,7 @@ public interface AttGroupDao {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 上传考勤组表
|
* 上传考勤组表
|
||||||
|
*
|
||||||
* @param bean 参数
|
* @param bean 参数
|
||||||
* @return 1|0
|
* @return 1|0
|
||||||
*/
|
*/
|
||||||
|
|
@ -45,6 +51,7 @@ public interface AttGroupDao {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 上传考勤组设置表
|
* 上传考勤组设置表
|
||||||
|
*
|
||||||
* @param bean 参数
|
* @param bean 参数
|
||||||
* @return 1|0
|
* @return 1|0
|
||||||
*/
|
*/
|
||||||
|
|
@ -52,6 +59,7 @@ public interface AttGroupDao {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 上传考勤人员绑定表
|
* 上传考勤人员绑定表
|
||||||
|
*
|
||||||
* @param checkOrgList 参数
|
* @param checkOrgList 参数
|
||||||
* @return 1|0
|
* @return 1|0
|
||||||
*/
|
*/
|
||||||
|
|
@ -59,6 +67,7 @@ public interface AttGroupDao {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据考勤组编号获取详细信息
|
* 根据考勤组编号获取详细信息
|
||||||
|
*
|
||||||
* @param groupId 考勤组编号
|
* @param groupId 考勤组编号
|
||||||
* @return bean
|
* @return bean
|
||||||
*/
|
*/
|
||||||
|
|
@ -66,6 +75,7 @@ public interface AttGroupDao {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据考勤组编号获取人员绑定情况
|
* 根据考勤组编号获取人员绑定情况
|
||||||
|
*
|
||||||
* @param groupId 考勤组编号
|
* @param groupId 考勤组编号
|
||||||
* @return list bean
|
* @return list bean
|
||||||
*/
|
*/
|
||||||
|
|
@ -73,6 +83,7 @@ public interface AttGroupDao {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除考勤组绑定人员
|
* 删除考勤组绑定人员
|
||||||
|
*
|
||||||
* @param groupId 考勤组编号
|
* @param groupId 考勤组编号
|
||||||
*/
|
*/
|
||||||
void deleteAttGroupRelationPerson(Long groupId);
|
void deleteAttGroupRelationPerson(Long groupId);
|
||||||
|
|
@ -81,6 +92,7 @@ public interface AttGroupDao {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改考勤组
|
* 修改考勤组
|
||||||
|
*
|
||||||
* @param bean 参数
|
* @param bean 参数
|
||||||
* @return 1|0
|
* @return 1|0
|
||||||
*/
|
*/
|
||||||
|
|
@ -88,6 +100,7 @@ public interface AttGroupDao {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改考勤组设置表
|
* 修改考勤组设置表
|
||||||
|
*
|
||||||
* @param bean 参数
|
* @param bean 参数
|
||||||
* @return 1|0
|
* @return 1|0
|
||||||
*/
|
*/
|
||||||
|
|
@ -95,6 +108,7 @@ public interface AttGroupDao {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询人员是否绑定考勤组
|
* 查询人员是否绑定考勤组
|
||||||
|
*
|
||||||
* @param id 用户编号
|
* @param id 用户编号
|
||||||
* @return 1|0
|
* @return 1|0
|
||||||
*/
|
*/
|
||||||
|
|
@ -102,16 +116,27 @@ public interface AttGroupDao {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询出可选中人员
|
* 查询出可选中人员
|
||||||
|
*
|
||||||
* @return list bean
|
* @return list bean
|
||||||
*/
|
*/
|
||||||
List<SysTree> getAttGroupCheckPerson(Long groupId);
|
List<SysTree> getAttGroupCheckPerson(Long groupId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* 根据组织编号获取人员
|
* 根据组织编号获取人员
|
||||||
|
*
|
||||||
* @param idList 组织编号
|
* @param idList 组织编号
|
||||||
* @param groupId 考勤组(当前考情组)
|
* @param groupId 考勤组(当前考情组)
|
||||||
* @return list bean
|
* @return list bean
|
||||||
*/
|
*/
|
||||||
List<AttGroupCheckOrgBean> getUserByOrg(@Param("idList")ArrayList<String> idList, @Param("groupId")Long groupId);
|
List<AttGroupCheckOrgBean> getUserByOrg(@Param("idList") ArrayList<String> idList, @Param("groupId") Long groupId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据人员ID查询组织机构
|
||||||
|
* @param bean
|
||||||
|
* @param addList
|
||||||
|
* @return List<AttDataBean>
|
||||||
|
* @author cwchen
|
||||||
|
* @date 2025/2/18 13:49
|
||||||
|
*/
|
||||||
|
List<AttDataBean> getUserInfo(@Param("params") AttGroupBean bean, @Param("list") List<AttGroupCheckOrgBean> addList);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -145,9 +145,6 @@ public class AttGroupBean {
|
||||||
*/
|
*/
|
||||||
private String currentDay;
|
private String currentDay;
|
||||||
|
|
||||||
/**是否有法定节假日*/
|
|
||||||
private Integer isHaveHoliday;
|
|
||||||
|
|
||||||
public AttGroupBean(Long groupId, String attDay, String toWorkTime, String offWorkTime,
|
public AttGroupBean(Long groupId, String attDay, String toWorkTime, String offWorkTime,
|
||||||
Long todayClockNum, Long lateMinute, Long leaveMinute,
|
Long todayClockNum, Long lateMinute, Long leaveMinute,
|
||||||
Long absenteeismLateMinute, Long absenteeismLeaveMinute,
|
Long absenteeismLateMinute, Long absenteeismLeaveMinute,
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,12 @@
|
||||||
package com.bonus.system.att.service;
|
package com.bonus.system.att.service;
|
||||||
|
|
||||||
import com.bonus.common.core.constant.Constants;
|
import com.bonus.common.core.constant.Constants;
|
||||||
|
import com.bonus.common.core.utils.DateTimeHelper;
|
||||||
import com.bonus.common.core.utils.bean.BeanUtils;
|
import com.bonus.common.core.utils.bean.BeanUtils;
|
||||||
import com.bonus.common.security.utils.SecurityUtils;
|
import com.bonus.common.security.utils.SecurityUtils;
|
||||||
import com.bonus.system.att.dao.AttGroupDao;
|
import com.bonus.system.att.dao.AttGroupDao;
|
||||||
import com.bonus.system.att.dao.AttSourceDataDao;
|
import com.bonus.system.att.dao.AttSourceDataDao;
|
||||||
|
import com.bonus.system.att.entity.AttDataBean;
|
||||||
import com.bonus.system.att.entity.AttGroupBean;
|
import com.bonus.system.att.entity.AttGroupBean;
|
||||||
import com.bonus.system.att.entity.AttGroupCheckOrgBean;
|
import com.bonus.system.att.entity.AttGroupCheckOrgBean;
|
||||||
import com.bonus.system.att.utils.TreeUtils;
|
import com.bonus.system.att.utils.TreeUtils;
|
||||||
|
|
@ -61,7 +63,7 @@ public class AttGroupServiceImpl implements AttGroupService {
|
||||||
bean.setCreateUserId(SecurityUtils.getLoginUser().getSysUser().getUserId());
|
bean.setCreateUserId(SecurityUtils.getLoginUser().getSysUser().getUserId());
|
||||||
//只有部门的将部门变成部门下所有人(去除掉其他考勤组选的人)
|
//只有部门的将部门变成部门下所有人(去除掉其他考勤组选的人)
|
||||||
List<AttGroupCheckOrgBean> checkOrgAllList = dealWithOrgUser(bean, null);
|
List<AttGroupCheckOrgBean> checkOrgAllList = dealWithOrgUser(bean, null);
|
||||||
if(checkOrgAllList.isEmpty()){
|
if (checkOrgAllList.isEmpty()) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
//新增考勤组表
|
//新增考勤组表
|
||||||
|
|
@ -75,6 +77,7 @@ public class AttGroupServiceImpl implements AttGroupService {
|
||||||
checkOrgAllList.get(k).setGroupId(bean.getGroupId());
|
checkOrgAllList.get(k).setGroupId(bean.getGroupId());
|
||||||
}
|
}
|
||||||
int x = attGroupDao.insertAttGroupPerson(checkOrgAllList);
|
int x = attGroupDao.insertAttGroupPerson(checkOrgAllList);
|
||||||
|
addAttData(bean, checkOrgAllList);
|
||||||
if (j > 0 && (x == checkOrgAllList.size())) {
|
if (j > 0 && (x == checkOrgAllList.size())) {
|
||||||
result = 1;
|
result = 1;
|
||||||
}
|
}
|
||||||
|
|
@ -102,7 +105,7 @@ public class AttGroupServiceImpl implements AttGroupService {
|
||||||
int result = 0;
|
int result = 0;
|
||||||
bean.setUpdateUserId(SecurityUtils.getLoginUser().getSysUser().getUserId());
|
bean.setUpdateUserId(SecurityUtils.getLoginUser().getSysUser().getUserId());
|
||||||
List<AttGroupCheckOrgBean> checkOrgAllList = dealWithOrgUser(bean, null);
|
List<AttGroupCheckOrgBean> checkOrgAllList = dealWithOrgUser(bean, null);
|
||||||
if(checkOrgAllList.isEmpty()){
|
if (checkOrgAllList.isEmpty()) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
//新增考勤组表
|
//新增考勤组表
|
||||||
|
|
@ -134,20 +137,41 @@ public class AttGroupServiceImpl implements AttGroupService {
|
||||||
if (!addList.isEmpty()) {
|
if (!addList.isEmpty()) {
|
||||||
//添加考勤组绑定人员
|
//添加考勤组绑定人员
|
||||||
attGroupDao.insertAttGroupPerson(addList);
|
attGroupDao.insertAttGroupPerson(addList);
|
||||||
// 新增的人员 生成当天的考勤模板
|
addAttData(bean, addList);
|
||||||
List<AttGroupBean> list = new ArrayList<>();
|
|
||||||
for (AttGroupCheckOrgBean attGroupCheckOrgBean : addList) {
|
|
||||||
AttGroupBean groupBean = new AttGroupBean();
|
|
||||||
BeanUtils.copyProperties(attGroupCheckOrgBean, groupBean);
|
|
||||||
list.add(groupBean);
|
|
||||||
}
|
|
||||||
attSourceDataDao.insertAttSettingHistoryData(list);
|
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增的人员 生成当天的考勤模板/与考勤规则进行绑定
|
||||||
|
*
|
||||||
|
* @param bean
|
||||||
|
* @param addList
|
||||||
|
* @return void
|
||||||
|
* @author cwchen
|
||||||
|
* @date 2025/2/18 13:56
|
||||||
|
*/
|
||||||
|
public void addAttData(AttGroupBean bean, List<AttGroupCheckOrgBean> addList) {
|
||||||
|
// 新增的人员 生成当天的考勤模板/与考勤规则进行绑定
|
||||||
|
List<AttGroupBean> list = new ArrayList<>();
|
||||||
|
List<AttDataBean> listPerson = new ArrayList<>();
|
||||||
|
for (AttGroupCheckOrgBean attGroupCheckOrgBean : addList) {
|
||||||
|
AttGroupBean groupBean = new AttGroupBean();
|
||||||
|
groupBean.setGroupId(attGroupCheckOrgBean.getGroupId());
|
||||||
|
groupBean.setUserId(Long.parseLong(attGroupCheckOrgBean.getUserId()));
|
||||||
|
groupBean.setCurrentDay(DateTimeHelper.getNowDate());
|
||||||
|
list.add(groupBean);
|
||||||
|
}
|
||||||
|
// 新增人员考勤模板数据
|
||||||
|
attSourceDataDao.insertAttSettingHistoryData(list);
|
||||||
|
// 查询人员组织机构ID
|
||||||
|
listPerson = attGroupDao.getUserInfo(bean, addList);
|
||||||
|
// 新增人员考勤规则
|
||||||
|
attSourceDataDao.insertAttDataList(listPerson);
|
||||||
|
}
|
||||||
|
|
||||||
public Map<String, List<AttGroupCheckOrgBean>> compareByUserId(
|
public Map<String, List<AttGroupCheckOrgBean>> compareByUserId(
|
||||||
List<AttGroupCheckOrgBean> list1,
|
List<AttGroupCheckOrgBean> list1,
|
||||||
List<AttGroupCheckOrgBean> list2) {
|
List<AttGroupCheckOrgBean> list2) {
|
||||||
|
|
|
||||||
|
|
@ -98,6 +98,30 @@
|
||||||
</if>
|
</if>
|
||||||
-- AND agpr.user_id IS NULL
|
-- AND agpr.user_id IS NULL
|
||||||
</select>
|
</select>
|
||||||
|
<!--根据人员ID查询组织机构-->
|
||||||
|
<select id="getUserInfo" resultType="com.bonus.system.att.entity.AttDataBean">
|
||||||
|
SELECT suo.user_id AS userId,
|
||||||
|
suo.org_id AS orgId,
|
||||||
|
CURRENT_DATE AS attCurrentDay,
|
||||||
|
0 AS attStatus,
|
||||||
|
1 AS attType
|
||||||
|
FROM sys_user_org suo
|
||||||
|
WHERE user_id IN
|
||||||
|
<foreach item="item" collection="list" separator="," open="(" close=")" index="">
|
||||||
|
#{item.userId}
|
||||||
|
</foreach>
|
||||||
|
UNION ALL
|
||||||
|
SELECT suo.user_id AS userId,
|
||||||
|
suo.org_id AS orgId,
|
||||||
|
CURRENT_DATE AS attCurrentDay,
|
||||||
|
0 AS attStatus,
|
||||||
|
2 AS attType
|
||||||
|
FROM sys_user_org suo
|
||||||
|
WHERE user_id IN
|
||||||
|
<foreach item="item" collection="list" separator="," open="(" close=")" index="">
|
||||||
|
#{item.userId}
|
||||||
|
</foreach>
|
||||||
|
</select>
|
||||||
|
|
||||||
<delete id="deleteAttGroup">
|
<delete id="deleteAttGroup">
|
||||||
update att_group
|
update att_group
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue