This commit is contained in:
史宗金 2025-01-11 18:03:27 +08:00
commit c119c328b4
12 changed files with 991 additions and 84 deletions

View File

@ -34,20 +34,70 @@ public class AttExceptionHandleController extends BaseController {
private AttExceptionHandleService attExceptionHandle;
@RequiresPermissions("att:exception:query")
@GetMapping("/getAttExceptionList")
@Log(title = "异常处理->异常数据->列表查询", businessType = BusinessType.QUERY)
public TableDataInfo getAttExceptionList(AttExceptionBean data) {
@GetMapping("/list")
@Log(title = "异常处理->轮休临时外出异常数据->列表查询", businessType = BusinessType.QUERY)
public TableDataInfo list(AttExceptionBean data) {
startPage();
// List<AttExceptionBean> list = attExceptionHandle.selectAttExceptionList(data);
return attExceptionHandle.selectAttExceptionList(data);
}
@RequiresPermissions("att:exception:query")
@GetMapping("/getAttExceptionListByMonth")
@Log(title = "异常处理->异常报表->列表查询", businessType = BusinessType.QUERY)
public TableDataInfo getAttExceptionListByMonth(AttExceptionBean data) {
@GetMapping("/getDetailException")
@Log(title = "异常处理->轮休临时外出异常报表->列表查询", businessType = BusinessType.QUERY)
public TableDataInfo getDetailException(AttExceptionBean data) {
startPage();
List<AttExceptionBean> list = attExceptionHandle.getDetailException(data);
return getDataTable(list);
}
@RequiresPermissions("att:exception:query")
@GetMapping("/getDetailExceptionRest")
@Log(title = "异常处理->轮休异常报表未申请详情->列表查询", businessType = BusinessType.QUERY)
public TableDataInfo getDetailExceptionRest(AttDetailLeaveBean data) {
startPage();
List<AttDetailLeaveBean> list = attExceptionHandle.getDetailExceptionRest(data);
return getDataTable(list);
}
@RequiresPermissions("att:exception:query")
@GetMapping("/getDetailExceptionOut")
@Log(title = "异常处理->临时外出异常报表未申请详情->列表查询", businessType = BusinessType.QUERY)
public TableDataInfo getDetailExceptionOut(AttDetailLeaveBean data) {
startPage();
List<AttDetailLeaveBean> list = attExceptionHandle.getDetailExceptionOut(data);
return getDataTable(list);
}
@RequiresPermissions("att:exception:query")
@GetMapping("/getDetailExceptionAll")
@Log(title = "异常处理->轮休和临时外出异常报表未申请详情->列表查询", businessType = BusinessType.QUERY)
public TableDataInfo getDetailExceptionAll(AttDetailLeaveBean data) {
startPage();
List<AttDetailLeaveBean> list = attExceptionHandle.getDetailExceptionAll(data);
return getDataTable(list);
}
@RequiresPermissions("att:exception:query")
@GetMapping("/export")
public void export(HttpServletResponse response, AttExceptionBean data) {
try{
List<AttExceptionBean> list = attExceptionHandle.getDetailException(data);
ExcelUtil<AttExceptionBean> util = new ExcelUtil<AttExceptionBean>(AttExceptionBean.class);
util.exportExcel(response, list, "轮休临时外出异常报表");
}catch (Exception e){
log.error(e.toString(),e);
}
}
/**
* 审批提醒
* @param vo
* @return
*/
@PostMapping("/examineRemind")
@Log(title = "异常处理->临时外出异常报表->审批提醒", businessType = BusinessType.QUERY)
public AjaxResult examineRemind(@Validated @RequestBody AttExRemindBean vo) {
return attExceptionHandle.examineRemind(vo);
}
}

View File

@ -0,0 +1,48 @@
package com.bonus.system.att.controller;
import com.bonus.common.core.web.controller.BaseController;
import com.bonus.common.core.web.page.TableDataInfo;
import com.bonus.common.log.annotation.Log;
import com.bonus.common.log.enums.BusinessType;
import com.bonus.common.security.annotation.RequiresPermissions;
import com.bonus.system.att.entity.AttExceptionBean;
import com.bonus.system.att.service.AttExceptionHandleService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
/**
* 轮休临时外出异常数据
*
* @author hongchao
*/
@RestController
@RequestMapping("/attExceptionHandle")
@Slf4j
public class AttExceptionHandleController2 extends BaseController {
/*@Resource(name = "attExceptionHandle")
private AttExceptionHandleService attExceptionHandle;
@RequiresPermissions("att:exception:query")
@GetMapping("/getAttExceptionList")
@Log(title = "异常处理->异常数据->列表查询", businessType = BusinessType.QUERY)
public TableDataInfo getAttExceptionList(AttExceptionBean data) {
startPage();
return attExceptionHandle.selectAttExceptionList(data);
}
@RequiresPermissions("att:exception:query")
@GetMapping("/getAttExceptionListByMonth")
@Log(title = "异常处理->异常报表->列表查询", businessType = BusinessType.QUERY)
public TableDataInfo getAttExceptionListByMonth(AttExceptionBean data) {
startPage();
List<AttExceptionBean> list = attExceptionHandle.getDetailException(data);
return getDataTable(list);
}*/
}

View File

@ -18,9 +18,19 @@ public interface AttExceptionHandleDao {
* @param data 参数
* @return list bean
*/
List<AttExceptionBean> selectAttExceptionList(AttExceptionBean data);
AttExceptionBean selectAttExceptionList(AttExceptionBean data);
/**
* 轮休临时外出异常月份
* @return
*/
List<Map<String,Object>> selectAttExceptionMonth();
/**
* 轮休临时外出异常未处理月份
* @return
*/
List<Map<String,Object>> selectAttExceptionNoHandleMonth();
/**
* 获取轮休临时外出异常数据详情
@ -29,4 +39,52 @@ public interface AttExceptionHandleDao {
*/
List<AttExceptionBean> getDetailException(AttExceptionBean data);
/**
* 获取轮休临时外出异常数据详情
* @param data 参数
* @return list bean
*/
List<AttExceptionBean> getDetailAllException(AttExceptionBean data);
/**
* 获取轮休异常报表未申请详情
* @param data 参数
* @return list bean
*/
List<AttDetailLeaveBean> getDetailExceptionRest(AttDetailLeaveBean data);
/**
* 获取临时外出异常报表未申请详情
* @param data 参数
* @return list bean
*/
List<AttDetailLeaveBean> getDetailExceptionOut(AttDetailLeaveBean data);
/**
* 获取轮休和临时外出异常报表未申请详情
* @param data 参数
* @return list bean
*/
List<AttDetailLeaveBean> getDetailExceptionAll(AttDetailLeaveBean data);
/**
* 获取部门负责人id数据
* @param data 参数
* @return list bean
*/
AttExRemindBean getOrgUserId(AttExRemindBean data);
/**
* 审批提醒
* @param vo
* @return
*/
int examineRemind(AttExRemindBean vo);
/**
* 审批提醒
* @param vo
* @return
*/
int examineRemindTemp(AttExRemindBean vo);
}

View File

@ -0,0 +1,31 @@
package com.bonus.system.att.dao;
import com.bonus.system.att.entity.AttExceptionBean;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* 轮休临时外出异常数据-数据访问层
* @author hongchao
*/
@Repository("attExceptionHandleDao2")
public interface AttExceptionHandleDao2 {
/**
* 获取轮休临时外出异常数据
* @param data 参数
* @return list bean
*/
List<AttExceptionBean> selectAttExceptionList(AttExceptionBean data);
/**
* 获取轮休临时外出异常数据详情
* @param data 参数
* @return list bean
*/
List<AttExceptionBean> getDetailException(AttExceptionBean data);
}

View File

@ -44,6 +44,17 @@ public class AttExceptionBean {
private Integer orgId;
/**
* 考勤月份的当月一号
*/
private String attCurrentMonthFirst;
/**
* 考勤月份的次月一号
*/
private String attNextMonthFirst;
/**
* 异常数量
*/
@ -60,31 +71,16 @@ public class AttExceptionBean {
private int noFinishCount;
/**
* 迟到数量
* 轮休未审批条数
*/
private int lateCount;
@Excel(name = "轮休未审批条数")
private int errorRestCount;
/**
* 早退数量
* 临时外出未审批条数
*/
private int earlyCount;
/**
* 旷工数量
*/
private int absenteeismCount;
/**
* 打卡地异常数量
*/
private int addressCount;
/**
* 出入异常数量
*/
private int goOutCount;
@Excel(name = "临时外出未审批条数")
private int errorOutCount;
private int[] orgIds;

View File

@ -0,0 +1,94 @@
package com.bonus.system.att.entity;
import com.bonus.common.core.annotation.Excel;
import lombok.Data;
/**
* 月报表实体类
* @author zys
*/
@Data
public class AttExceptionBean2 {
/**
* 编号
*/
private Long id;
/**
* 姓名
*/
@Excel(name = "姓名")
private String name;
/**
* 用户编号
*/
private Long userId;
/**
* 考勤月份
*/
@Excel(name = "考勤月份")
private String attCurrentMonth;
/**
* 所属部门
*/
@Excel(name = "所属部门")
private String orgName;
/**
* 部门编号
*/
private Integer orgId;
/**
* 异常数量
*/
private int errorCount;
/**
* 已处理数量
*/
private int finishCount;
/**
* 未处理数量
*/
private int noFinishCount;
/**
* 迟到数量
*/
private int lateCount;
/**
* 早退数量
*/
private int earlyCount;
/**
* 旷工数量
*/
private int absenteeismCount;
/**
* 打卡地异常数量
*/
private int addressCount;
/**
* 出入异常数量
*/
private int goOutCount;
private int[] orgIds;
private String[] month;
}

View File

@ -20,10 +20,38 @@ public interface AttExceptionHandleService {
TableDataInfo selectAttExceptionList(AttExceptionBean data);
/**
* 获取异常数据详情
* 获取轮休临时外出异常数据详情
* @param data 参数
* @return list bean
*/
List<AttExceptionBean> getDetailException(AttExceptionBean data);
}
/**
* 获取轮休异常报表未申请详情
* @param data 参数
* @return list bean
*/
List<AttDetailLeaveBean> getDetailExceptionRest(AttDetailLeaveBean data);
/**
* 获取临时外出异常报表未申请详情
* @param data 参数
* @return list bean
*/
List<AttDetailLeaveBean> getDetailExceptionOut(AttDetailLeaveBean data);
/**
* 获取轮休和临时外出异常报表未申请详情
* @param data 参数
* @return list bean
*/
List<AttDetailLeaveBean> getDetailExceptionAll(AttDetailLeaveBean data);
/**
* 审批提醒
* @param vo
* @return
*/
AjaxResult examineRemind(AttExRemindBean vo);
}

View File

@ -0,0 +1,28 @@
package com.bonus.system.att.service;
import com.bonus.common.core.web.page.TableDataInfo;
import com.bonus.system.att.entity.AttExceptionBean;
import java.util.List;
/**
* 轮休临时外出异常数据-业务层
* @author hongchao
*/
public interface AttExceptionHandleService2 {
/**
* 获取轮休临时外出异常数据
* @param data 参数
* @return list bean
*/
/* TableDataInfo selectAttExceptionList(AttExceptionBean data);*/
/**
* 获取异常数据详情
* @param data 参数
* @return list bean
*/
/*List<AttExceptionBean> getDetailException(AttExceptionBean data);*/
}

View File

@ -47,14 +47,36 @@ public class AttExceptionHandleServiceImpl implements AttExceptionHandleService{
@Override
public TableDataInfo selectAttExceptionList(AttExceptionBean data)
{
AttExceptionBean attExceptionBean = new AttExceptionBean();
List<AttExceptionBean> list = new ArrayList<>();
List<Map<String,Object>> mapList = new ArrayList<>();
try {
list = attExceptionHandleDao.selectAttExceptionList(data);
list.forEach(item -> {
item.setNoFinishCount(item.getErrorCount()-item.getFinishCount());
});
if(!StringUtils.isEmpty(data.getAttCurrentMonth())){
LocalDate date = LocalDate.parse(data.getAttCurrentMonth() + "-01");
LocalDate nextMonth =date.plusMonths(1).withDayOfMonth(1);
LocalDate nowMonth =date.withDayOfMonth(1);
data.setAttNextMonthFirst(nextMonth.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))) ;
data.setAttCurrentMonthFirst(nowMonth.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
attExceptionBean = attExceptionHandleDao.selectAttExceptionList(data);
list.add(attExceptionBean);
}else{
mapList = attExceptionHandleDao.selectAttExceptionMonth();
if(mapList.size()!=0){
for (int i = 0; i < mapList.size(); i++) {
LocalDate date = LocalDate.parse(mapList.get(i).get("month") + "-01");
LocalDate nextMonth =date.plusMonths(1).withDayOfMonth(1);
LocalDate nowMonth =date.withDayOfMonth(1);
data.setAttCurrentMonth(String.valueOf(mapList.get(i).get("month")));
data.setAttNextMonthFirst(nextMonth.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))) ;
data.setAttCurrentMonthFirst(nowMonth.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
attExceptionBean = attExceptionHandleDao.selectAttExceptionList(data);
list.add(attExceptionBean);
}
}
}
} catch (Exception e) {
log.error("查询异常数据", e);
log.error("查询轮休临时外出异常数据", e);
}
TableDataInfo rspData = new TableDataInfo();
rspData.setCode(HttpStatus.SUCCESS);
@ -64,18 +86,251 @@ public class AttExceptionHandleServiceImpl implements AttExceptionHandleService{
return rspData;
}
// @Override
// public List<AttExceptionBean> getDetailException(AttExceptionBean data)
// {
// List<AttExceptionBean> listPerson = new ArrayList<>();
// List<AttExceptionBean> list = new ArrayList<>();
// List<Map<String,Object>> mapList = new ArrayList<>();
// List<AttDetailByMonthBean> listTemp = new ArrayList<>();
// List<Map<String,Object>> parentIdList = new ArrayList<>();
// List<Map<String,Object>> sonsIdList = new ArrayList<>();
// Map<String,Object> map = new HashMap<>();
// try {
// if(!StringUtils.isEmpty(data.getAttCurrentMonth())){
// LocalDate date = LocalDate.parse(data.getAttCurrentMonth() + "-01");
// LocalDate nextMonth =date.plusMonths(1).withDayOfMonth(1);
// LocalDate nowMonth =date.withDayOfMonth(1);
// data.setAttNextMonthFirst(nextMonth.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))) ;
// data.setAttCurrentMonthFirst(nowMonth.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
// if(data.getOrgId()==null){
// listTemp = attDetailByMonthDao.getAllParentId();
// for (int i = 0; i < listTemp.size(); i++) {
// findSonsIds(listTemp.get(i).getOrgId(),sonsIdList);
// }
// }else {
// findSonsIds(data.getOrgId(), sonsIdList);
// }
// for (int i = 0; i < sonsIdList.size(); i++) {
// map = sonsIdList.get(i);
// findParentIds(map,parentIdList);
// sonsIdList.get(i).put("orgName",parentIdList.get(i).get("orgName"));
// }
// int[] orgIdsTemp = new int[sonsIdList.size()];
// for (int i = 0; i < sonsIdList.size(); i++){
// orgIdsTemp[i] = (int) sonsIdList.get(i).get("id");
// }
// data.setOrgIds(orgIdsTemp);
// list = attExceptionHandleDao.getDetailException(data);
// for (int i = 0; i < list.size(); i++) {
// for (int j = 0; j < sonsIdList.size(); j++) {
// if(sonsIdList.get(j).get("id")==list.get(i).getOrgId()){
// list.get(i).setOrgName((String) sonsIdList.get(j).get("orgName"));
// }
// }
// }
// }else{
// mapList = attExceptionHandleDao.selectAttExceptionNoHandleMonth();
// if(mapList.size()!=0){
// String[] monthError = new String[mapList.size()];
// for (int i = 0; i < mapList.size(); i++) {
// monthError[i] = (String) mapList.get(i).get("month");
// }
// data.setMonth(monthError);
// list = attExceptionHandleDao.getDetailAllException(data);
// for (int i = 0; i < list.size(); i++) {
// LocalDate date = LocalDate.parse(list.get(i).getAttCurrentMonth());
//
// // 格式化日期为 "YYYY-MM"
// DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM");
// String formattedDate = date.format(formatter);
// list.get(i).setAttCurrentMonth(formattedDate);
// }
// }
// }
//
// } catch (Exception e) {
// log.error("查询轮休临时外出异常数据详细信息", e);
// }
// return list;
// }
@Override
public List<AttExceptionBean> getDetailException(AttExceptionBean data)
{
List<AttExceptionBean> listPerson = new ArrayList<>();
List<AttExceptionBean> list = new ArrayList<>();
List<Map<String,Object>> mapList = new ArrayList<>();
List<AttDetailByMonthBean> listTemp = new ArrayList<>();
List<Map<String,Object>> parentIdList = new ArrayList<>();
List<Map<String,Object>> sonsIdList = new ArrayList<>();
Map<String,Object> map = new HashMap<>();
try {
if(!StringUtils.isEmpty(data.getAttCurrentMonth())){
LocalDate date = LocalDate.parse(data.getAttCurrentMonth() + "-01");
LocalDate nextMonth =date.plusMonths(1).withDayOfMonth(1);
LocalDate nowMonth =date.withDayOfMonth(1);
data.setAttNextMonthFirst(nextMonth.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))) ;
data.setAttCurrentMonthFirst(nowMonth.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
list = attExceptionHandleDao.getDetailException(data);
}else{
list = attExceptionHandleDao.getDetailException(data);
}
} catch (Exception e) {
log.error("查询轮休临时外出异常数据详细信息", e);
}
return list;
}
@Override
public List<AttDetailLeaveBean> getDetailExceptionRest(AttDetailLeaveBean data)
{
List<AttDetailLeaveBean> list = new ArrayList<>();
try {
LocalDate date = LocalDate.parse(data.getAttCurrentMonth() + "-01");
LocalDate nextMonth =date.plusMonths(1).withDayOfMonth(1);
LocalDate nowMonth =date.withDayOfMonth(1);
data.setAttNextMonthFirst(nextMonth.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))) ;
data.setAttCurrentMonthFirst(nowMonth.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
list = attExceptionHandleDao.getDetailExceptionRest(data);
} catch (Exception e) {
log.error("查询轮休异常报表未申请详情", e);
}
return list;
}
@Override
public List<AttDetailLeaveBean> getDetailExceptionOut(AttDetailLeaveBean data)
{
List<AttDetailLeaveBean> list = new ArrayList<>();
try {
LocalDate date = LocalDate.parse(data.getAttCurrentMonth() + "-01");
LocalDate nextMonth =date.plusMonths(1).withDayOfMonth(1);
LocalDate nowMonth =date.withDayOfMonth(1);
data.setAttNextMonthFirst(nextMonth.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))) ;
data.setAttCurrentMonthFirst(nowMonth.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
list = attExceptionHandleDao.getDetailExceptionOut(data);
} catch (Exception e) {
log.error("查询临时外出异常报表未申请详情", e);
}
return list;
}
@Override
public List<AttDetailLeaveBean> getDetailExceptionAll(AttDetailLeaveBean data)
{
List<AttDetailLeaveBean> list = new ArrayList<>();
try {
LocalDate date = LocalDate.parse(data.getAttCurrentMonth() + "-01");
LocalDate nextMonth =date.plusMonths(1).withDayOfMonth(1);
LocalDate nowMonth =date.withDayOfMonth(1);
data.setAttNextMonthFirst(nextMonth.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))) ;
data.setAttCurrentMonthFirst(nowMonth.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
list = attExceptionHandleDao.getDetailExceptionAll(data);
} catch (Exception e) {
log.error("查询轮休和临时外出异常报表未申请详情", e);
}
return list;
}
/**
* 审批提醒
* @param vo
* @return
*/
@Override
@Transactional(rollbackFor = Exception.class)
public AjaxResult examineRemind(AttExRemindBean vo) {
try {
SysOrg att = orgDao.selectOrgById(vo.getOrgId());
if(att==null){
return AjaxResult.error("审批提醒失败");
}else{
String orgIds = att.getOrgHeadUserId();
if(orgIds != null){
String[] nameArray = orgIds.split(",");
Long[] longArray = new Long[nameArray.length];
for (int i = 0; i < nameArray.length; i++) {
try {
longArray[i] = Long.parseLong(nameArray[i].trim());
} catch (NumberFormatException e) {
longArray[i] = null; // 处理异常情况
}
}
for (int i = 0; i < longArray.length; i++) {
vo.setUserId(longArray[i]);
int numTemp = attExceptionHandleDao.examineRemindTemp(vo);
if(numTemp!=1){
return AjaxResult.error("审批提醒失败");
}
}
vo.setUserUpdate(SecurityUtils.getUserId());
if("轮休".equals(vo.getLeaveType())){
vo.setType(67L);
}else{
vo.setType(68L);
}
int num = attExceptionHandleDao.examineRemind(vo);
if (num==1) {
return AjaxResult.success();
}
}else{
return AjaxResult.error("部门没有负责人,无法提醒");
}
}
return AjaxResult.error("审批提醒失败");
} catch (Exception e) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return AjaxResult.error();
}
}
/**
* 从父级补充所属部门名称
* @param parentMap
* @param parentIdList
*/
public void findParentIds(Map<String,Object> parentMap,List<Map<String,Object>> parentIdList) {
Map<String, Object> map = attDetailByMonthDao.getDepartmentById(parentMap);
if (map!=null && map.get("parentId") != null) {
// 递归查找上级部门
findParentIds(map,parentIdList);
}else if(map!=null){
parentMap.put("orgName",map.get("orgName"));
parentIdList.add(parentMap);
}else{
parentIdList.add(parentMap);
}
}
/**
* 获取该部门编号下的所有部门编号
* @param orgId
* @param sonsIdList
*/
public void findSonsIds(int orgId, List<Map<String,Object>> sonsIdList) {
Map<String, Object> mapFinish = new HashMap<>();
Map<String, Object> mapTemp = new HashMap<>();
List<Map<String, Object>> listSon= attDetailByMonthDao.getSonsById(orgId);
if(listSon.size()!=0){
for (int i = 0; i < listSon.size(); i++) {
mapTemp = listSon.get(i);
if(mapTemp.get("parentId")==null){
sonsIdList.add(mapTemp);
}else{
findSonsIds((Integer) mapTemp.get("id"),sonsIdList);
}
}
}else{
mapFinish = attDetailByMonthDao.getSonsFinish(orgId);
sonsIdList.add(mapFinish);
}
}
}

View File

@ -0,0 +1,69 @@
package com.bonus.system.att.service;
import com.bonus.common.core.constant.HttpStatus;
import com.bonus.common.core.web.page.TableDataInfo;
import com.bonus.system.att.dao.AttDetailByMonthDao;
import com.bonus.system.att.dao.AttExceptionHandleDao;
import com.bonus.system.att.dao.AttExceptionHandleDao2;
import com.bonus.system.att.entity.AttExceptionBean;
import com.bonus.system.basic.dao.SysOrgDao;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
/**
* 轮休临时外出异常数据-业务层
* @author hongchao
*/
@Service("attExceptionHandle2")
@Slf4j
public class AttExceptionHandleServiceImpl2 implements AttExceptionHandleService2{
/*@Resource(name = "attExceptionHandleDao2")
private AttExceptionHandleDao2 attExceptionHandleDao;
@Resource(name = "attDetailByMonthDao")
private AttDetailByMonthDao attDetailByMonthDao;
@Resource
private SysOrgDao orgDao;
@Override
public TableDataInfo selectAttExceptionList(AttExceptionBean data)
{
List<AttExceptionBean> list = new ArrayList<>();
try {
list = attExceptionHandleDao.selectAttExceptionList(data);
list.forEach(item -> {
item.setNoFinishCount(item.getErrorCount()-item.getFinishCount());
});
} catch (Exception e) {
log.error("查询异常数据", e);
}
TableDataInfo rspData = new TableDataInfo();
rspData.setCode(HttpStatus.SUCCESS);
rspData.setRows(list);
rspData.setMsg("查询成功");
rspData.setTotal(new PageInfo(list).getTotal());
return rspData;
}
@Override
public List<AttExceptionBean> getDetailException(AttExceptionBean data)
{
List<AttExceptionBean> list = new ArrayList<>();
try {
list = attExceptionHandleDao.getDetailException(data);
} catch (Exception e) {
log.error("查询轮休临时外出异常数据详细信息", e);
}
return list;
}*/
}

View File

@ -1,62 +1,250 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bonus.system.att.dao.AttExceptionHandleDao">
<select id="selectAttExceptionList" resultType="com.bonus.system.att.entity.AttExceptionBean">
SELECT
DATE_FORMAT( att_current_day, '%Y-%m' ) AS yearMonth,
SUM(
CASE
select
#{attCurrentMonth} as attCurrentMonth,
count(case when (leave_start_date &lt; #{attNextMonthFirst} and leave_start_date &gt;= #{attCurrentMonthFirst}) then 1 END) as errorCount,
count(case when (examine_status != 0 and leave_start_date &lt; #{attNextMonthFirst} and leave_start_date &gt;= #{attCurrentMonthFirst}) then 1 end) as finishCount,
count(case when (examine_status = 0 and leave_start_date &lt; #{attNextMonthFirst} and leave_start_date &gt;= #{attCurrentMonthFirst}) then 1 end) as noFinishCount
from leave_apply as la
where la.is_active = 1
and (la.leave_type like '%外出%' or la.leave_type like '%轮休%')
</select>
WHEN toWorkOriginalAttStatus IN ( 2, 3, 4, 8, 9 )
OR offWorkOriginalAttStatus IN ( 2, 3, 4, 8, 9 ) THEN
1 ELSE 0
END
) AS errorCount,
SUM(
CASE
<select id="selectAttExceptionMonth" resultType="java.util.Map">
select
DATE_FORMAT(leave_start_date,'%Y-%m') as month,
count(*) as leaveCount
from leave_apply as la
where la.is_active = 1
and (la.leave_type like '%外出%' or la.leave_type like '%轮休%')
group by month
</select>
WHEN (
toWorkOriginalAttStatus IN ( 2, 3, 4, 8, 9 )
OR offWorkOriginalAttStatus IN ( 2, 3, 4, 8, 9 ))
AND is_update = 1
AND reviewer_status = 1 THEN
1 ELSE 0
END
) AS finishCount
FROM
v_att_update_data
<where>
locate(#{attCurrentMonth},att_current_day)
</where>
GROUP BY
yearMonth
<select id="selectAttExceptionNoHandleMonth" resultType="java.util.Map">
select
DATE_FORMAT(leave_start_date,'%Y-%m') as month,
count(*) as leaveCount
from leave_apply as la
where la.is_active = 1
and (la.leave_type like '%外出%' or la.leave_type like '%轮休%')
and la.examine_status=3
and (examine_time is null or examine_time = '')
group by month
</select>
<select id="getDetailException" resultType="com.bonus.system.att.entity.AttExceptionBean">
SELECT
vv.user_id,
vv.org_id,
su.user_name,
so.org_name,
sum( IF ( toWorkOriginalAttStatus = 2 OR offWorkOriginalAttStatus = 2, 1, 0 ) ) as lateCount,
sum( IF ( toWorkOriginalAttStatus = 3 OR offWorkOriginalAttStatus = 3, 1, 0 ) ) as absenteeismCount,
sum( IF ( toWorkOriginalAttStatus = 4 OR offWorkOriginalAttStatus = 4, 1, 0 ) ) as earlyCount,
sum( IF ( toWorkOriginalAttStatus = 8 OR offWorkOriginalAttStatus = 8, 1, 0 ) ) as addressCount,
sum( IF ( toWorkOriginalAttStatus = 9 OR offWorkOriginalAttStatus = 9, 1, 0 ) ) as goOutCount
FROM
v_att_update_data vv
LEFT JOIN sys_user su ON su.user_id = vv.user_id
AND su.is_active = '1'
LEFT JOIN sys_organization so ON so.id = vv.org_id
AND so.is_active = '1'
WHERE
locate( #{attCurrentMonth}, att_current_day )
GROUP BY
user_id,
org_id
select
user_id as userId,
user_name as name,
org_id as orgId,
org_name as orgName,
#{attCurrentMonth} as attCurrentMonth,
count(case when la.leave_type like '%轮休%' then 1 END ) as errorRestCount,
count(case when la.leave_type like '%外出%' then 1 END) as errorOutCount
from leave_apply as la
where la.is_active = 1
and examine_status = 0
and (leave_start_date &lt; #{attNextMonthFirst} and leave_start_date &gt;= #{attCurrentMonthFirst})
<if test="orgId != null and orgId != '' ">
and la.org_id = #{orgId}
</if>
<if test="name != null and name != '' ">
and INSTR(la.user_name,#{name}) > 0
</if>
group by user_id
</select>
<select id="getDetailAllException" resultType="com.bonus.system.att.entity.AttExceptionBean">
select
user_id as userId,
user_name as name,
org_id as orgId,
org_name as orgName,
leave_start_date as attCurrentMonth,
count(case when la.leave_type like '%轮休%' then 1 END ) as errorRestCount,
count(case when la.leave_type like '%外出%' then 1 END) as errorOutCount
from leave_apply as la
where
<foreach collection="month" item="monthOne" separator="OR">
(
leave_start_date &gt;= CONCAT(#{monthOne}, '-01') AND
leave_start_date &lt; LAST_DAY(CONCAT(#{monthOne}, '-01'))
)
</foreach>
and la.is_active = 1
and examine_status = 0
<if test="orgId != null and orgId != '' ">
and la.org_id in
<foreach item="id" collection="orgIds" open="(" separator="," close=")">
#{id}
</foreach>
</if>
<if test="name != null and name != '' ">
and INSTR(la.user_name,#{name}) > 0
</if>
group by user_id
</select>
<select id="getDetailExceptionRest" resultType="com.bonus.system.att.entity.AttDetailLeaveBean">
select
id as id,
user_id as userId,
user_name as name,
org_id as orgId,
org_name as orgName,
leave_type as leaveType,
examine_status as examineStatus,
concat(leave_start_date,' ',
case
when leave_start_interval=1 then '上午'
when leave_start_interval then '下午'
ELSE ''
END) as leaveStartDate,
concat(leave_end_date,' ',
case
when leave_end_interval=1 then '上午'
when leave_end_interval then '下午'
ELSE ''
END) as leaveEndDate,
leave_duration as leaveDuration
from leave_apply as la
where la.is_active = 1
and examine_status = 0
and (leave_start_date &lt; #{attNextMonthFirst} and leave_start_date &gt;= #{attCurrentMonthFirst}) and (la.leave_type like '%轮休%')
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
and date_format(la.leave_start_date,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
</if>
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
and date_format(la.leave_end_date,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
</if>
<if test="userId != null and userId != '' ">
and la.user_id=#{userId}
</if>
</select>
<select id="getDetailExceptionOut" resultType="com.bonus.system.att.entity.AttDetailLeaveBean">
select
id as id,
user_id as userId,
user_name as name,
org_id as orgId,
org_name as orgName,
leave_type as leaveType,
examine_status as examineStatus,
concat(leave_start_date,' ',
case
when leave_start_interval=1 then '上午'
when leave_start_interval then '下午'
ELSE ''
END) as leaveStartDate,
concat(leave_end_date,' ',
case
when leave_end_interval=1 then '上午'
when leave_end_interval then '下午'
ELSE ''
END) as leaveEndDate,
leave_duration as leaveDuration
from leave_apply as la
where la.is_active = 1
and examine_status = 0
and (leave_start_date &lt; #{attNextMonthFirst} and leave_start_date &gt;= #{attCurrentMonthFirst}) and (la.leave_type like '%外出%')
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
and date_format(la.leave_start_date,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
</if>
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
and date_format(la.leave_end_date,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
</if>
<if test="userId != null and userId != '' ">
and la.user_id=#{userId}
</if>
</select>
<select id="getDetailExceptionAll" resultType="com.bonus.system.att.entity.AttDetailLeaveBean">
select
id as id,
user_id as userId,
user_name as name,
org_id as orgId,
org_name as orgName,
leave_type as leaveType,
examine_status as examineStatus,
concat(leave_start_date,' ',
case
when leave_start_interval=1 then '上午'
when leave_start_interval then '下午'
ELSE ''
END) as leaveStartDate,
concat(leave_end_date,' ',
case
when leave_end_interval=1 then '上午'
when leave_end_interval then '下午'
ELSE ''
END) as leaveEndDate,
leave_duration as leaveDuration
from leave_apply as la
where la.is_active = 1
and (leave_start_date &lt; #{attNextMonthFirst} and leave_start_date &gt;= #{attCurrentMonthFirst}) and (la.leave_type like '%外出%' or la.leave_type like '%轮休%')
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
and date_format(la.leave_start_date,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
</if>
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
and date_format(la.leave_end_date,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
</if>
<if test="name != null and name != '' ">
and INSTR(la.user_name,#{name}) > 0
</if>
<if test="isExamine != null and isExamine == 1">
and la.examine_status = 0
</if>
<if test="isExamine != null and isExamine == 0">
and (la.examine_status = 1 or la.examine_status = 2 or la.examine_status = 3)
</if>
</select>
<select id="getOrgUserId" resultType="com.bonus.system.att.entity.AttExRemindBean">
select
org_head_user_id as orgHeadId
from sys_organization as so
where so.id = #{orgId}
</select>
<insert id="examineRemind" parameterType="com.bonus.system.att.entity.AttExRemindBean" >
insert into sys_notice(
<if test="userUpdate != null">user_id,</if>
<if test="title != null and title != ''">title,</if>
<if test="content != null and content != '' ">content,</if>
type,
create_time,
update_time,
is_active
)values(
<if test=" userUpdate != null">#{userUpdate},</if>
<if test="title != null and title != ''">#{title},</if>
<if test="content != null and content != ''">#{content},</if>
#{type},
now(),
now(),
1
)
</insert>
<insert id="examineRemindTemp" parameterType="com.bonus.system.att.entity.AttExRemindBean" >
insert into sys_notice_user(
<if test="userId != null">user_id,</if>
create_time,
update_time,
is_active
)values(
<if test=" userId != null">#{userId},</if>
now(),
now(),
1
)
</insert>
</mapper>

View File

@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bonus.system.att.dao.AttExceptionHandleDao2">
<select id="selectAttExceptionList" resultType="com.bonus.system.att.entity.AttExceptionBean">
SELECT
DATE_FORMAT( att_current_day, '%Y-%m' ) AS yearMonth,
SUM(
CASE
WHEN toWorkOriginalAttStatus IN ( 2, 3, 4, 8, 9 )
OR offWorkOriginalAttStatus IN ( 2, 3, 4, 8, 9 ) THEN
1 ELSE 0
END
) AS errorCount,
SUM(
CASE
WHEN (
toWorkOriginalAttStatus IN ( 2, 3, 4, 8, 9 )
OR offWorkOriginalAttStatus IN ( 2, 3, 4, 8, 9 ))
AND is_update = 1
AND reviewer_status = 1 THEN
1 ELSE 0
END
) AS finishCount
FROM
v_att_update_data
<where>
locate(#{attCurrentMonth},att_current_day)
</where>
GROUP BY
yearMonth
</select>
<select id="getDetailException" resultType="com.bonus.system.att.entity.AttExceptionBean">
SELECT
vv.user_id,
vv.org_id,
su.user_name,
so.org_name,
sum( IF ( toWorkOriginalAttStatus = 2 OR offWorkOriginalAttStatus = 2, 1, 0 ) ) as lateCount,
sum( IF ( toWorkOriginalAttStatus = 3 OR offWorkOriginalAttStatus = 3, 1, 0 ) ) as absenteeismCount,
sum( IF ( toWorkOriginalAttStatus = 4 OR offWorkOriginalAttStatus = 4, 1, 0 ) ) as earlyCount,
sum( IF ( toWorkOriginalAttStatus = 8 OR offWorkOriginalAttStatus = 8, 1, 0 ) ) as addressCount,
sum( IF ( toWorkOriginalAttStatus = 9 OR offWorkOriginalAttStatus = 9, 1, 0 ) ) as goOutCount
FROM
v_att_update_data vv
LEFT JOIN sys_user su ON su.user_id = vv.user_id
AND su.is_active = '1'
LEFT JOIN sys_organization so ON so.id = vv.org_id
AND so.is_active = '1'
WHERE
locate( #{attCurrentMonth}, att_current_day )
GROUP BY
user_id,
org_id
</select>
</mapper>