休假报备、出差报备 删除和修改添加限制

This commit is contained in:
cwchen 2025-02-12 15:18:11 +08:00
parent 960d9cd6f1
commit 52b6da1b53
12 changed files with 156 additions and 30 deletions

View File

@ -18,10 +18,7 @@ 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.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList; import java.util.*;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
/** /**
* 出差报备 * 出差报备
@ -127,6 +124,10 @@ public class EvectionController extends BaseController {
@Log(title = "流程管理->出差报备->修改出差报备", businessType = BusinessType.UPDATE) @Log(title = "流程管理->出差报备->修改出差报备", businessType = BusinessType.UPDATE)
public AjaxResult edit(@Validated @RequestBody EvectionBean o) { public AjaxResult edit(@Validated @RequestBody EvectionBean o) {
try{ try{
AjaxResult result = isCheck(o.getId() + "");
if(result!=null){
return result;
}
int res = evectionService.updateEvection(o); int res = evectionService.updateEvection(o);
return toAjax(res); return toAjax(res);
}catch (Exception e){ }catch (Exception e){
@ -144,6 +145,10 @@ public class EvectionController extends BaseController {
@Log(title = "流程管理->出差报备->删除出差报备", businessType = BusinessType.DELETE) @Log(title = "流程管理->出差报备->删除出差报备", businessType = BusinessType.DELETE)
public AjaxResult remove(@PathVariable("id") String id) { public AjaxResult remove(@PathVariable("id") String id) {
try{ try{
AjaxResult result = isCheck(id);
if(result!=null){
return result;
}
return toAjax(evectionService.deleteEvectionById(id)); return toAjax(evectionService.deleteEvectionById(id));
}catch (Exception e){ }catch (Exception e){
log.error(e.toString(),e); log.error(e.toString(),e);
@ -151,6 +156,23 @@ public class EvectionController extends BaseController {
return error("系统异常"); return error("系统异常");
} }
/**
* 判断出差报备数据是否被核对
* @param id
* @return AjaxResult
* @author cwchen
* @date 2025/2/12 14:32
*/
public AjaxResult isCheck(String id) {
// 判断休假报备数据是否被核对
Integer checkStatus = evectionService.isCheck(id);
if(!Objects.equals(checkStatus,0)){
return AjaxResult.error("出差报备数据已被核对,无法操作");
}else {
return null;
}
}
/** /**
* 根据id获取详细信息 * 根据id获取详细信息
*/ */

View File

@ -27,4 +27,13 @@ public interface EvectionDao {
EvectionBean getPostName(Long id); EvectionBean getPostName(Long id);
List<EvectionBean> getUserList(@Param("params")EvectionBean bean); List<EvectionBean> getUserList(@Param("params")EvectionBean bean);
/**
* 判断出差报备数据是否被核对
* @param evectionBean
* @return List<Integer>
* @author cwchen
* @date 2025/2/12 15:14
*/
List<Integer> isCheck(EvectionBean evectionBean);
} }

View File

@ -63,4 +63,13 @@ public interface EvectionService {
EvectionBean getPostName(Long id); EvectionBean getPostName(Long id);
AjaxResult getUserList(Long id); AjaxResult getUserList(Long id);
/**
* 判断出差报备数据是否被核对
* @param id
* @return Integer
* @author cwchen
* @date 2025/2/12 15:12
*/
Integer isCheck(String id);
} }

View File

@ -9,6 +9,7 @@ import com.bonus.system.evection.entity.EvectionBean;
import com.bonus.system.holiday.dao.WorkReportDao; import com.bonus.system.holiday.dao.WorkReportDao;
import com.bonus.system.leaveReporting.entity.LeaveReportingBean; import com.bonus.system.leaveReporting.entity.LeaveReportingBean;
import lombok.extern.log4j.Log4j2; import lombok.extern.log4j.Log4j2;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -133,4 +134,22 @@ public class EvectionServiceImpl implements EvectionService {
return AjaxResult.error(); return AjaxResult.error();
} }
} }
@Override
public Integer isCheck(String id) {
try {
EvectionBean evectionBean = evectionDao.selectEvectionById(id);
List<Integer> list = evectionDao.isCheck(evectionBean);
if(CollectionUtils.isNotEmpty(list)){
for (Integer status : list) {
if(!Objects.equals(status,0)){
return status;
}
}
}
} catch (Exception e) {
log.error(e.toString(),e);
}
return 0;
}
} }

View File

@ -124,7 +124,7 @@ public class WorkReportServiceImpl implements WorkReportService {
List<WorkReportBean> list = new ArrayList<>(); List<WorkReportBean> list = new ArrayList<>();
if (StringHelper.isNotEmpty(bean.getType())) { if (StringHelper.isNotEmpty(bean.getType())) {
if ("请假".equals(bean.getType())) { if ("请假".equals(bean.getType())) {
bean.setHolidayType(new String[]{"病假", "年休假", "探亲假", "事假", "产假", "婚假", "丧假", "育儿假", "陪护假"}); bean.setHolidayType(new String[]{"病假", "年休假", "探亲假", "事假", "产假", "婚假", "丧假", "育儿假", "陪护假","流产假","哺乳假","节育假","父母护理假","其他"});
} }
list = dao.getDetailsList(bean); list = dao.getDetailsList(bean);
if (list.size() > 0) { if (list.size() > 0) {

View File

@ -19,10 +19,7 @@ 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.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList; import java.util.*;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
/** /**
* 休假报备 * 休假报备
@ -108,6 +105,10 @@ public class LeaveReportingController extends BaseController {
@Log(title = "流程管理->休假报备->修改休假报备", businessType = BusinessType.UPDATE) @Log(title = "流程管理->休假报备->修改休假报备", businessType = BusinessType.UPDATE)
public AjaxResult edit(@Validated @RequestBody LeaveReportingBean o) { public AjaxResult edit(@Validated @RequestBody LeaveReportingBean o) {
try{ try{
AjaxResult result = isCheck(o.getId());
if(result!=null){
return result;
}
int res = leaveReportingService.updateLeaveReporting(o); int res = leaveReportingService.updateLeaveReporting(o);
return toAjax(res); return toAjax(res);
}catch (Exception e){ }catch (Exception e){
@ -125,6 +126,10 @@ public class LeaveReportingController extends BaseController {
@Log(title = "流程管理->休假报备->删除休假报备", businessType = BusinessType.DELETE) @Log(title = "流程管理->休假报备->删除休假报备", businessType = BusinessType.DELETE)
public AjaxResult remove(@PathVariable("id") Long id) { public AjaxResult remove(@PathVariable("id") Long id) {
try{ try{
AjaxResult result = isCheck(id);
if(result!=null){
return result;
}
return toAjax(leaveReportingService.deleteLeaveReportingById(id)); return toAjax(leaveReportingService.deleteLeaveReportingById(id));
}catch (Exception e){ }catch (Exception e){
log.error(e.toString(),e); log.error(e.toString(),e);
@ -132,6 +137,23 @@ public class LeaveReportingController extends BaseController {
return error("系统异常"); return error("系统异常");
} }
/**
* 判断休假报备数据是否被核对
* @param id
* @return AjaxResult
* @author cwchen
* @date 2025/2/12 14:32
*/
public AjaxResult isCheck(Long id) {
// 判断休假报备数据是否被核对
Integer checkStatus = leaveReportingService.isCheck(id);
if(!Objects.equals(checkStatus,0)){
return AjaxResult.error("休假报备数据已被核对,无法操作");
}else {
return null;
}
}
/** /**
* 根据id获取详细信息 * 根据id获取详细信息
*/ */

View File

@ -41,4 +41,13 @@ public interface LeaveReportingDao {
List<LeaveReportingBean> getFestivalAndHoliday(LeaveReportingBean bean); List<LeaveReportingBean> getFestivalAndHoliday(LeaveReportingBean bean);
String getAttTypeByUserId(Long userId); String getAttTypeByUserId(Long userId);
/**
* 判断休假报备数据是否被核对
* @param bean
* @return Integer
* @author cwchen
* @date 2025/2/12 14:34
*/
List<Integer> isCheck(LeaveReportingBean bean);
} }

View File

@ -67,4 +67,12 @@ public interface LeaveReportingService {
AjaxResult getUserListCheck(Long id); AjaxResult getUserListCheck(Long id);
/**
* 判断休假报备数据是否被核对
* @param id
* @return Integer
* @author cwchen
* @date 2025/2/12 14:32
*/
Integer isCheck(Long id);
} }

View File

@ -179,4 +179,22 @@ public class LeaveReportingServiceImpl implements LeaveReportingService {
private String formatDate(Date date) { private String formatDate(Date date) {
return DATE_FORMAT.get().format(date); return DATE_FORMAT.get().format(date);
} }
@Override
public Integer isCheck(Long id) {
try {
LeaveReportingBean leaveReportingBean = leaveReportingDao.selectLeaveReportingById(id);
List<Integer> list = leaveReportingDao.isCheck(leaveReportingBean);
if(CollectionUtils.isNotEmpty(list)){
for (Integer status : list) {
if(!Objects.equals(status,0)){
return status;
}
}
}
} catch (Exception e) {
log.error(e.toString(),e);
}
return 0;
}
} }

View File

@ -205,4 +205,12 @@
left join att_group ag on agpr.group_id = ag.id left join att_group ag on agpr.group_id = ag.id
where user_id = #{userId} and agpr.is_active = '1' where user_id = #{userId} and agpr.is_active = '1'
</select> </select>
<!--判断休假报备数据是否被核对-->
<select id="isCheck" resultType="java.lang.Integer">
SELECT status
FROM leave_check lc
WHERE lc.org_id = #{orgId} AND (DATE_FORMAT(#{leaveStartDate},'%Y-%m') = lc.month OR DATE_FORMAT(#{leaveEndDate},'%Y-%m') = lc.month)
AND lc.is_active = '1'
ORDER BY lc.create_time
</select>
</mapper> </mapper>

View File

@ -239,4 +239,12 @@
) )
</if> </if>
</select> </select>
<!--判断出差报备数据是否被核对-->
<select id="isCheck" resultType="java.lang.Integer">
SELECT status
FROM leave_check lc
WHERE lc.org_id = #{orgId} AND (DATE_FORMAT(#{leaveStartDate},'%Y-%m') = lc.month OR DATE_FORMAT(#{leaveEndDate},'%Y-%m') = lc.month)
AND lc.is_active = '1'
ORDER BY lc.create_time
</select>
</mapper> </mapper>

View File

@ -122,26 +122,21 @@
SUM(CASE WHEN la.leave_type = '临时外出' and (la.examine_status='1' or la.examine_status='0') THEN 1 ELSE 0 END) AS outNum, SUM(CASE WHEN la.leave_type = '临时外出' and (la.examine_status='1' or la.examine_status='0') THEN 1 ELSE 0 END) AS outNum,
SUM( SUM(
CASE CASE
WHEN la.leave_type='病假' and la.source=2 THEN WHEN la.leave_type='年休假' THEN 1
1 WHEN la.leave_type='探亲假' THEN 1
WHEN la.leave_type='年休假' and la.source=2 THEN WHEN la.leave_type='事假' THEN 1
1 WHEN la.leave_type='病假' THEN 1
WHEN la.leave_type='探亲假' and la.source=2 THEN WHEN la.leave_type='产假' THEN 1
1 WHEN la.leave_type='婚假' THEN 1
WHEN la.leave_type='事假' and la.source=2 THEN WHEN la.leave_type='丧假' THEN 1
1 WHEN la.leave_type='育儿假' THEN 1
WHEN la.leave_type='产假' and la.source=2 THEN WHEN la.leave_type='陪护假' THEN 1
1 WHEN la.leave_type='流产假' THEN 1
WHEN la.leave_type='婚假' and la.source=2 THEN WHEN la.leave_type='哺乳假' THEN 1
1 WHEN la.leave_type='节育假' THEN 1
WHEN la.leave_type='丧假' and la.source=2 THEN WHEN la.leave_type='父母护理假' THEN 1
1 WHEN la.leave_type='其他' THEN 1
WHEN la.leave_type='育儿假' and la.source=2 THEN ELSE 0
1
WHEN la.leave_type='陪护假' and la.source=2 THEN
1
ELSE
0
END END
) as holidayNum ) as holidayNum
FROM FROM
@ -222,7 +217,6 @@
<foreach item="item" index="index" collection="holidayType" open="(" separator="," close=")"> <foreach item="item" index="index" collection="holidayType" open="(" separator="," close=")">
#{item} #{item}
</foreach> </foreach>
and la.source=2
</if> </if>
<if test="type!='出差' and holidayType==null"> <if test="type!='出差' and holidayType==null">
AND la.leave_type = #{type} AND la.leave_type = #{type}