请假,外出,轮休,休假时间不能重复
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.system.api.domain.MapVo;
|
||||
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.basic.domain.SysNotice;
|
||||
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.leaveReporting.dao.LeaveReportingDao;
|
||||
import com.bonus.system.leaveReporting.entity.LeaveReportingBean;
|
||||
|
|
@ -51,6 +53,8 @@ public class LeaveReportingServiceImpl implements LeaveReportingService {
|
|||
@Resource(name = "LeaveReportingDao")
|
||||
private LeaveReportingDao leaveReportingDao;
|
||||
|
||||
@Resource(name = "ProDeptRoleDao")
|
||||
private ProDeptRoleDao proDeptRoleDao;
|
||||
|
||||
|
||||
@Override
|
||||
|
|
@ -95,14 +99,35 @@ public class LeaveReportingServiceImpl implements LeaveReportingService {
|
|||
public AjaxResult getUserList(Long id) {
|
||||
try {
|
||||
LeaveReportingBean bean = new LeaveReportingBean();
|
||||
//只能查自己部门的人
|
||||
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()));
|
||||
SysUser sysUser = SecurityUtils.getLoginUser().getSysUser();
|
||||
List<String> roleId = sysUser.getRoleList();
|
||||
//管理员与人资角色可以看到所有
|
||||
if( roleId !=null && !roleId.isEmpty()){
|
||||
if (Collections.frequency(roleId, "1")==0 && Collections.frequency(roleId, "16")==0) {
|
||||
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);
|
||||
List<LeaveReportingBean> list = leaveReportingDao.getUserList(bean);
|
||||
|
|
|
|||
|
|
@ -5,25 +5,26 @@
|
|||
<mapper namespace="com.bonus.system.holiday.dao.HolidayDao">
|
||||
<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,
|
||||
leave_start_date,
|
||||
<if test="leaveStartInterval != null">
|
||||
leave_start_interval,
|
||||
</if>
|
||||
leave_end_date,
|
||||
<if test="leaveEndInterval != null">
|
||||
leave_end_interval,
|
||||
</if>
|
||||
leave_duration,examine_status,source,create_user_id,is_agree, location, host_user_id, remark,type)
|
||||
leave_start_date,
|
||||
<if test="leaveStartInterval != null">
|
||||
leave_start_interval,
|
||||
</if>
|
||||
leave_end_date,
|
||||
<if test="leaveEndInterval != null">
|
||||
leave_end_interval,
|
||||
</if>
|
||||
leave_duration,examine_status,source,create_user_id,is_agree, location, host_user_id, remark,type)
|
||||
VALUES(#{userId},#{userName},#{orgId},#{orgName},#{leaveType},#{leaveReason},
|
||||
#{leaveStartDate},
|
||||
<if test="leaveStartInterval != null">
|
||||
#{leaveStartInterval},
|
||||
</if>
|
||||
#{leaveEndDate},
|
||||
<if test="leaveEndInterval != null">
|
||||
#{leaveEndInterval},
|
||||
</if>
|
||||
#{leaveDuration},#{examineStatus},#{source},#{createUserId}, #{isAgree}, #{location}, #{hostUserId}, #{remark}, #{type})
|
||||
#{leaveStartDate},
|
||||
<if test="leaveStartInterval != null">
|
||||
#{leaveStartInterval},
|
||||
</if>
|
||||
#{leaveEndDate},
|
||||
<if test="leaveEndInterval != null">
|
||||
#{leaveEndInterval},
|
||||
</if>
|
||||
#{leaveDuration},#{examineStatus},#{source},#{createUserId}, #{isAgree}, #{location}, #{hostUserId}, #{remark},
|
||||
#{type})
|
||||
</insert>
|
||||
<update id="updateHoliday">
|
||||
UPDATE leave_apply
|
||||
|
|
@ -58,14 +59,14 @@
|
|||
<update id="changeHolidayStatus">
|
||||
update leave_apply
|
||||
<set>
|
||||
<if test="updateUserId != 0L">
|
||||
examine_opinion = #{examineOpinion},
|
||||
examine_user_id = #{examineUserId},
|
||||
examine_time = #{examineTime},
|
||||
</if>
|
||||
<if test="examineUserId != 0L">
|
||||
update_user_id = #{updateUserId},
|
||||
</if>
|
||||
<if test="updateUserId != 0L">
|
||||
examine_opinion = #{examineOpinion},
|
||||
examine_user_id = #{examineUserId},
|
||||
examine_time = #{examineTime},
|
||||
</if>
|
||||
<if test="examineUserId != 0L">
|
||||
update_user_id = #{updateUserId},
|
||||
</if>
|
||||
examine_status = #{examineStatus}
|
||||
</set>
|
||||
where id = #{id}
|
||||
|
|
@ -91,10 +92,13 @@
|
|||
</update>
|
||||
|
||||
<delete id="deleteHolidayById">
|
||||
update leave_apply SET is_active = '0' WHERE id = #{id}
|
||||
update leave_apply
|
||||
SET is_active = '0'
|
||||
WHERE id = #{id}
|
||||
</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
|
||||
DISTINCT
|
||||
la.id,
|
||||
|
|
@ -138,7 +142,7 @@
|
|||
and (la.user_id = #{bean.userId} or la.create_user_id = #{bean.userId} )
|
||||
</if>
|
||||
<if test="bean.userIds != null and bean.userIds != '' ">
|
||||
and la.user_id != #{bean.userIds}
|
||||
and la.user_id != #{bean.userIds}
|
||||
</if>
|
||||
|
||||
<if test="bean.roleType =='2' || bean.roleType == 2 ">
|
||||
|
|
@ -160,83 +164,73 @@
|
|||
</select>
|
||||
|
||||
<select id="selectHolidayById" resultType="com.bonus.system.holiday.entity.HolidayBean">
|
||||
SELECT
|
||||
id,
|
||||
user_id,
|
||||
user_name,
|
||||
org_id,
|
||||
org_name,
|
||||
create_time,
|
||||
leave_type,
|
||||
leave_reason,
|
||||
leave_start_date,
|
||||
leave_start_interval,
|
||||
leave_end_date,
|
||||
leave_end_interval,
|
||||
leave_duration,
|
||||
examine_status,
|
||||
examine_opinion,
|
||||
is_agree, location, host_user_id, remark
|
||||
FROM
|
||||
leave_apply
|
||||
WHERE
|
||||
id = #{id}
|
||||
SELECT id,
|
||||
user_id,
|
||||
user_name,
|
||||
org_id,
|
||||
org_name,
|
||||
create_time,
|
||||
leave_type,
|
||||
leave_reason,
|
||||
leave_start_date,
|
||||
leave_start_interval,
|
||||
leave_end_date,
|
||||
leave_end_interval,
|
||||
leave_duration,
|
||||
examine_status,
|
||||
examine_opinion,
|
||||
is_agree,
|
||||
location,
|
||||
host_user_id,
|
||||
remark
|
||||
FROM leave_apply
|
||||
WHERE id = #{id}
|
||||
</select>
|
||||
<select id="getLeaveType" resultType="java.util.Map">
|
||||
|
||||
</select>
|
||||
<select id="getOrgList" resultType="com.bonus.system.holiday.entity.HolidayKeyBean">
|
||||
SELECT
|
||||
`id`,
|
||||
org_name as `name`
|
||||
FROM
|
||||
sys_organization
|
||||
WHERE
|
||||
is_active = '1'
|
||||
SELECT `id`,
|
||||
org_name as `name`
|
||||
FROM sys_organization
|
||||
WHERE is_active = '1'
|
||||
</select>
|
||||
<select id="getPersonList" resultType="com.bonus.system.holiday.entity.HolidayKeyBean">
|
||||
SELECT
|
||||
user_id as `id`,
|
||||
user_name as `name`
|
||||
FROM
|
||||
sys_user
|
||||
WHERE
|
||||
is_active = '1'
|
||||
SELECT user_id as `id`,
|
||||
user_name as `name`
|
||||
FROM sys_user
|
||||
WHERE is_active = '1'
|
||||
</select>
|
||||
<select id="getLeaveTypeList" resultType="com.bonus.system.holiday.entity.HolidayKeyBean">
|
||||
SELECT
|
||||
dict_code as `id`,
|
||||
dict_label as `name`
|
||||
FROM
|
||||
sys_dict_data
|
||||
WHERE
|
||||
dict_type = 'att_status' and dict_code > 47
|
||||
SELECT dict_code as `id`,
|
||||
dict_label as `name`
|
||||
FROM sys_dict_data
|
||||
WHERE dict_type = 'att_status'
|
||||
and dict_code > 47
|
||||
</select>
|
||||
<select id="getUserIdById" resultType="java.lang.Long">
|
||||
SELECT
|
||||
user_id
|
||||
FROM
|
||||
leave_apply
|
||||
WHERE
|
||||
id = #{id}
|
||||
SELECT user_id
|
||||
FROM leave_apply
|
||||
WHERE id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="getHolidayData" resultType="com.bonus.system.holiday.entity.HolidayImportBean">
|
||||
SELECT
|
||||
user_name,leave_start_date,leave_end_date
|
||||
FROM
|
||||
leave_apply
|
||||
SELECT user_name,
|
||||
leave_start_date,
|
||||
leave_end_date
|
||||
FROM leave_apply
|
||||
WHERE leave_end_date > #{previousMonthDate}
|
||||
</select>
|
||||
|
||||
<select id="getHolidayDataByType" resultType="java.lang.String">
|
||||
SELECT date
|
||||
FROM sys_holiday
|
||||
WHERE date between #{startDate} and #{endDate} and type = 1
|
||||
WHERE date between #{startDate}
|
||||
and #{endDate}
|
||||
and type = 1
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<select id="judgeRepeatStrat" resultType="com.bonus.system.holiday.entity.HolidayBean">
|
||||
SELECT leave_type AS leaveType,
|
||||
`type`,
|
||||
|
|
@ -246,7 +240,8 @@
|
|||
leave_end_interval AS leaveEndInterval,
|
||||
user_name AS userName
|
||||
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 !=""'>
|
||||
and id !=#{id}
|
||||
</if>
|
||||
|
|
@ -261,7 +256,8 @@
|
|||
leave_end_interval AS leaveEndInterval,
|
||||
user_name AS userName
|
||||
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 !=""'>
|
||||
and id !=#{id}
|
||||
</if>
|
||||
|
|
|
|||
Loading…
Reference in New Issue