请假,外出,轮休,休假时间不能重复
Signed-off-by: lSun <15893999301@qq.com>
This commit is contained in:
parent
a53921de80
commit
aec4bd2f4b
|
|
@ -12,9 +12,11 @@ import com.bonus.common.security.utils.SecurityUtils;
|
||||||
import com.bonus.common.security.utils.ValidatorsUtils;
|
import com.bonus.common.security.utils.ValidatorsUtils;
|
||||||
import com.bonus.system.api.domain.MapVo;
|
import com.bonus.system.api.domain.MapVo;
|
||||||
import com.bonus.system.api.domain.SysRole;
|
import com.bonus.system.api.domain.SysRole;
|
||||||
|
import com.bonus.system.api.domain.SysUser;
|
||||||
import com.bonus.system.att.entity.Holiday;
|
import com.bonus.system.att.entity.Holiday;
|
||||||
import com.bonus.system.basic.domain.SysNotice;
|
import com.bonus.system.basic.domain.SysNotice;
|
||||||
import com.bonus.system.basic.service.SysNoticeService;
|
import com.bonus.system.basic.service.SysNoticeService;
|
||||||
|
import com.bonus.system.dept.dao.ProDeptRoleDao;
|
||||||
import com.bonus.system.holiday.dao.WorkReportDao;
|
import com.bonus.system.holiday.dao.WorkReportDao;
|
||||||
import com.bonus.system.leaveReporting.dao.LeaveReportingDao;
|
import com.bonus.system.leaveReporting.dao.LeaveReportingDao;
|
||||||
import com.bonus.system.leaveReporting.entity.LeaveReportingBean;
|
import com.bonus.system.leaveReporting.entity.LeaveReportingBean;
|
||||||
|
|
@ -51,6 +53,8 @@ public class LeaveReportingServiceImpl implements LeaveReportingService {
|
||||||
@Resource(name = "LeaveReportingDao")
|
@Resource(name = "LeaveReportingDao")
|
||||||
private LeaveReportingDao leaveReportingDao;
|
private LeaveReportingDao leaveReportingDao;
|
||||||
|
|
||||||
|
@Resource(name = "ProDeptRoleDao")
|
||||||
|
private ProDeptRoleDao proDeptRoleDao;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -95,14 +99,35 @@ public class LeaveReportingServiceImpl implements LeaveReportingService {
|
||||||
public AjaxResult getUserList(Long id) {
|
public AjaxResult getUserList(Long id) {
|
||||||
try {
|
try {
|
||||||
LeaveReportingBean bean = new LeaveReportingBean();
|
LeaveReportingBean bean = new LeaveReportingBean();
|
||||||
//只能查自己部门的人
|
SysUser sysUser = SecurityUtils.getLoginUser().getSysUser();
|
||||||
List<MapVo> orgList = SecurityUtils.getLoginUser().getSysUser().getOrgList();
|
List<String> roleId = sysUser.getRoleList();
|
||||||
if(!orgList.isEmpty()){
|
//管理员与人资角色可以看到所有
|
||||||
ArrayList<String> ids = new ArrayList<>();
|
if( roleId !=null && !roleId.isEmpty()){
|
||||||
for (MapVo mapVo : orgList) {
|
if (Collections.frequency(roleId, "1")==0 && Collections.frequency(roleId, "16")==0) {
|
||||||
ids.add(String.valueOf(mapVo.getId()));
|
if(Collections.frequency(roleId, "15")==0){
|
||||||
|
List<MapVo> orgList = sysUser.getOrgList();
|
||||||
|
if (!orgList.isEmpty()) {
|
||||||
|
ArrayList<String> ids = new ArrayList<>();
|
||||||
|
for (MapVo mapVo : orgList) {
|
||||||
|
String idT = proDeptRoleDao.getOrgChildById(mapVo.getId());
|
||||||
|
// 使用 Arrays.asList() 将数组转换为 ArrayList
|
||||||
|
ArrayList<String> idList = new ArrayList<>(Arrays.asList(idT.split(",")));
|
||||||
|
ids.addAll(idList);
|
||||||
|
}
|
||||||
|
bean.setOrgList(ids);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
//只能查自己部门的人
|
||||||
|
List<MapVo> orgList = SecurityUtils.getLoginUser().getSysUser().getOrgList();
|
||||||
|
if(!orgList.isEmpty()){
|
||||||
|
ArrayList<String> ids = new ArrayList<>();
|
||||||
|
for (MapVo mapVo : orgList) {
|
||||||
|
ids.add(String.valueOf(mapVo.getId()));
|
||||||
|
}
|
||||||
|
bean.setOrgList(ids);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
bean.setOrgList(ids);
|
|
||||||
}
|
}
|
||||||
bean.setId(id);
|
bean.setId(id);
|
||||||
List<LeaveReportingBean> list = leaveReportingDao.getUserList(bean);
|
List<LeaveReportingBean> list = leaveReportingDao.getUserList(bean);
|
||||||
|
|
|
||||||
|
|
@ -5,25 +5,26 @@
|
||||||
<mapper namespace="com.bonus.system.holiday.dao.HolidayDao">
|
<mapper namespace="com.bonus.system.holiday.dao.HolidayDao">
|
||||||
<insert id="insertHoliday" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
<insert id="insertHoliday" useGeneratedKeys="true" keyColumn="id" keyProperty="id">
|
||||||
INSERT INTO leave_apply(user_id,user_name,org_id,org_name,leave_type,leave_reason,
|
INSERT INTO leave_apply(user_id,user_name,org_id,org_name,leave_type,leave_reason,
|
||||||
leave_start_date,
|
leave_start_date,
|
||||||
<if test="leaveStartInterval != null">
|
<if test="leaveStartInterval != null">
|
||||||
leave_start_interval,
|
leave_start_interval,
|
||||||
</if>
|
</if>
|
||||||
leave_end_date,
|
leave_end_date,
|
||||||
<if test="leaveEndInterval != null">
|
<if test="leaveEndInterval != null">
|
||||||
leave_end_interval,
|
leave_end_interval,
|
||||||
</if>
|
</if>
|
||||||
leave_duration,examine_status,source,create_user_id,is_agree, location, host_user_id, remark,type)
|
leave_duration,examine_status,source,create_user_id,is_agree, location, host_user_id, remark,type)
|
||||||
VALUES(#{userId},#{userName},#{orgId},#{orgName},#{leaveType},#{leaveReason},
|
VALUES(#{userId},#{userName},#{orgId},#{orgName},#{leaveType},#{leaveReason},
|
||||||
#{leaveStartDate},
|
#{leaveStartDate},
|
||||||
<if test="leaveStartInterval != null">
|
<if test="leaveStartInterval != null">
|
||||||
#{leaveStartInterval},
|
#{leaveStartInterval},
|
||||||
</if>
|
</if>
|
||||||
#{leaveEndDate},
|
#{leaveEndDate},
|
||||||
<if test="leaveEndInterval != null">
|
<if test="leaveEndInterval != null">
|
||||||
#{leaveEndInterval},
|
#{leaveEndInterval},
|
||||||
</if>
|
</if>
|
||||||
#{leaveDuration},#{examineStatus},#{source},#{createUserId}, #{isAgree}, #{location}, #{hostUserId}, #{remark}, #{type})
|
#{leaveDuration},#{examineStatus},#{source},#{createUserId}, #{isAgree}, #{location}, #{hostUserId}, #{remark},
|
||||||
|
#{type})
|
||||||
</insert>
|
</insert>
|
||||||
<update id="updateHoliday">
|
<update id="updateHoliday">
|
||||||
UPDATE leave_apply
|
UPDATE leave_apply
|
||||||
|
|
@ -58,14 +59,14 @@
|
||||||
<update id="changeHolidayStatus">
|
<update id="changeHolidayStatus">
|
||||||
update leave_apply
|
update leave_apply
|
||||||
<set>
|
<set>
|
||||||
<if test="updateUserId != 0L">
|
<if test="updateUserId != 0L">
|
||||||
examine_opinion = #{examineOpinion},
|
examine_opinion = #{examineOpinion},
|
||||||
examine_user_id = #{examineUserId},
|
examine_user_id = #{examineUserId},
|
||||||
examine_time = #{examineTime},
|
examine_time = #{examineTime},
|
||||||
</if>
|
</if>
|
||||||
<if test="examineUserId != 0L">
|
<if test="examineUserId != 0L">
|
||||||
update_user_id = #{updateUserId},
|
update_user_id = #{updateUserId},
|
||||||
</if>
|
</if>
|
||||||
examine_status = #{examineStatus}
|
examine_status = #{examineStatus}
|
||||||
</set>
|
</set>
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
|
|
@ -91,10 +92,13 @@
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
<delete id="deleteHolidayById">
|
<delete id="deleteHolidayById">
|
||||||
update leave_apply SET is_active = '0' WHERE id = #{id}
|
update leave_apply
|
||||||
|
SET is_active = '0'
|
||||||
|
WHERE id = #{id}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<select id="getHolidayList" resultType="com.bonus.system.holiday.entity.HolidayBean" parameterType="com.bonus.system.holiday.entity.HolidayBean">
|
<select id="getHolidayList" resultType="com.bonus.system.holiday.entity.HolidayBean"
|
||||||
|
parameterType="com.bonus.system.holiday.entity.HolidayBean">
|
||||||
SELECT
|
SELECT
|
||||||
DISTINCT
|
DISTINCT
|
||||||
la.id,
|
la.id,
|
||||||
|
|
@ -138,7 +142,7 @@
|
||||||
and (la.user_id = #{bean.userId} or la.create_user_id = #{bean.userId} )
|
and (la.user_id = #{bean.userId} or la.create_user_id = #{bean.userId} )
|
||||||
</if>
|
</if>
|
||||||
<if test="bean.userIds != null and bean.userIds != '' ">
|
<if test="bean.userIds != null and bean.userIds != '' ">
|
||||||
and la.user_id != #{bean.userIds}
|
and la.user_id != #{bean.userIds}
|
||||||
</if>
|
</if>
|
||||||
|
|
||||||
<if test="bean.roleType =='2' || bean.roleType == 2 ">
|
<if test="bean.roleType =='2' || bean.roleType == 2 ">
|
||||||
|
|
@ -160,83 +164,73 @@
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectHolidayById" resultType="com.bonus.system.holiday.entity.HolidayBean">
|
<select id="selectHolidayById" resultType="com.bonus.system.holiday.entity.HolidayBean">
|
||||||
SELECT
|
SELECT id,
|
||||||
id,
|
user_id,
|
||||||
user_id,
|
user_name,
|
||||||
user_name,
|
org_id,
|
||||||
org_id,
|
org_name,
|
||||||
org_name,
|
create_time,
|
||||||
create_time,
|
leave_type,
|
||||||
leave_type,
|
leave_reason,
|
||||||
leave_reason,
|
leave_start_date,
|
||||||
leave_start_date,
|
leave_start_interval,
|
||||||
leave_start_interval,
|
leave_end_date,
|
||||||
leave_end_date,
|
leave_end_interval,
|
||||||
leave_end_interval,
|
leave_duration,
|
||||||
leave_duration,
|
examine_status,
|
||||||
examine_status,
|
examine_opinion,
|
||||||
examine_opinion,
|
is_agree,
|
||||||
is_agree, location, host_user_id, remark
|
location,
|
||||||
FROM
|
host_user_id,
|
||||||
leave_apply
|
remark
|
||||||
WHERE
|
FROM leave_apply
|
||||||
id = #{id}
|
WHERE id = #{id}
|
||||||
</select>
|
</select>
|
||||||
<select id="getLeaveType" resultType="java.util.Map">
|
<select id="getLeaveType" resultType="java.util.Map">
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
<select id="getOrgList" resultType="com.bonus.system.holiday.entity.HolidayKeyBean">
|
<select id="getOrgList" resultType="com.bonus.system.holiday.entity.HolidayKeyBean">
|
||||||
SELECT
|
SELECT `id`,
|
||||||
`id`,
|
org_name as `name`
|
||||||
org_name as `name`
|
FROM sys_organization
|
||||||
FROM
|
WHERE is_active = '1'
|
||||||
sys_organization
|
|
||||||
WHERE
|
|
||||||
is_active = '1'
|
|
||||||
</select>
|
</select>
|
||||||
<select id="getPersonList" resultType="com.bonus.system.holiday.entity.HolidayKeyBean">
|
<select id="getPersonList" resultType="com.bonus.system.holiday.entity.HolidayKeyBean">
|
||||||
SELECT
|
SELECT user_id as `id`,
|
||||||
user_id as `id`,
|
user_name as `name`
|
||||||
user_name as `name`
|
FROM sys_user
|
||||||
FROM
|
WHERE is_active = '1'
|
||||||
sys_user
|
|
||||||
WHERE
|
|
||||||
is_active = '1'
|
|
||||||
</select>
|
</select>
|
||||||
<select id="getLeaveTypeList" resultType="com.bonus.system.holiday.entity.HolidayKeyBean">
|
<select id="getLeaveTypeList" resultType="com.bonus.system.holiday.entity.HolidayKeyBean">
|
||||||
SELECT
|
SELECT dict_code as `id`,
|
||||||
dict_code as `id`,
|
dict_label as `name`
|
||||||
dict_label as `name`
|
FROM sys_dict_data
|
||||||
FROM
|
WHERE dict_type = 'att_status'
|
||||||
sys_dict_data
|
and dict_code > 47
|
||||||
WHERE
|
|
||||||
dict_type = 'att_status' and dict_code > 47
|
|
||||||
</select>
|
</select>
|
||||||
<select id="getUserIdById" resultType="java.lang.Long">
|
<select id="getUserIdById" resultType="java.lang.Long">
|
||||||
SELECT
|
SELECT user_id
|
||||||
user_id
|
FROM leave_apply
|
||||||
FROM
|
WHERE id = #{id}
|
||||||
leave_apply
|
|
||||||
WHERE
|
|
||||||
id = #{id}
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getHolidayData" resultType="com.bonus.system.holiday.entity.HolidayImportBean">
|
<select id="getHolidayData" resultType="com.bonus.system.holiday.entity.HolidayImportBean">
|
||||||
SELECT
|
SELECT user_name,
|
||||||
user_name,leave_start_date,leave_end_date
|
leave_start_date,
|
||||||
FROM
|
leave_end_date
|
||||||
leave_apply
|
FROM leave_apply
|
||||||
WHERE leave_end_date > #{previousMonthDate}
|
WHERE leave_end_date > #{previousMonthDate}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getHolidayDataByType" resultType="java.lang.String">
|
<select id="getHolidayDataByType" resultType="java.lang.String">
|
||||||
SELECT date
|
SELECT date
|
||||||
FROM sys_holiday
|
FROM sys_holiday
|
||||||
WHERE date between #{startDate} and #{endDate} and type = 1
|
WHERE date between #{startDate}
|
||||||
|
and #{endDate}
|
||||||
|
and type = 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<select id="judgeRepeatStrat" resultType="com.bonus.system.holiday.entity.HolidayBean">
|
<select id="judgeRepeatStrat" resultType="com.bonus.system.holiday.entity.HolidayBean">
|
||||||
SELECT leave_type AS leaveType,
|
SELECT leave_type AS leaveType,
|
||||||
`type`,
|
`type`,
|
||||||
|
|
@ -246,7 +240,8 @@
|
||||||
leave_end_interval AS leaveEndInterval,
|
leave_end_interval AS leaveEndInterval,
|
||||||
user_name AS userName
|
user_name AS userName
|
||||||
FROM leave_apply
|
FROM leave_apply
|
||||||
WHERE is_active = '1' and user_id = #{userId} and #{leaveStartDate} BETWEEN leave_start_date AND leave_end_date
|
WHERE is_active = '1' and user_id = #{userId} and #{leaveStartDate} BETWEEN leave_start_date AND leave_end_date
|
||||||
|
AND examine_status != '2'
|
||||||
<if test='id != null and id !=""'>
|
<if test='id != null and id !=""'>
|
||||||
and id !=#{id}
|
and id !=#{id}
|
||||||
</if>
|
</if>
|
||||||
|
|
@ -261,7 +256,8 @@
|
||||||
leave_end_interval AS leaveEndInterval,
|
leave_end_interval AS leaveEndInterval,
|
||||||
user_name AS userName
|
user_name AS userName
|
||||||
FROM leave_apply
|
FROM leave_apply
|
||||||
WHERE is_active = '1' and user_id = #{userId} and #{leaveEndDate} BETWEEN leave_start_date AND leave_end_date
|
WHERE is_active = '1' and user_id = #{userId} and #{leaveEndDate} BETWEEN leave_start_date AND leave_end_date
|
||||||
|
AND examine_status != '2'
|
||||||
<if test='id != null and id !=""'>
|
<if test='id != null and id !=""'>
|
||||||
and id !=#{id}
|
and id !=#{id}
|
||||||
</if>
|
</if>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue