diff --git a/bonus-modules/bonus-system/src/main/java/com/bonus/system/att/controller/AttExceptionHandleController.java b/bonus-modules/bonus-system/src/main/java/com/bonus/system/att/controller/AttExceptionHandleController.java index 7f04925..d0a5738 100644 --- a/bonus-modules/bonus-system/src/main/java/com/bonus/system/att/controller/AttExceptionHandleController.java +++ b/bonus-modules/bonus-system/src/main/java/com/bonus/system/att/controller/AttExceptionHandleController.java @@ -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 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 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 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 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 list = attExceptionHandle.getDetailExceptionAll(data); + return getDataTable(list); + } + + @RequiresPermissions("att:exception:query") + @GetMapping("/export") + public void export(HttpServletResponse response, AttExceptionBean data) { + try{ + List list = attExceptionHandle.getDetailException(data); + ExcelUtil util = new ExcelUtil(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); + } } diff --git a/bonus-modules/bonus-system/src/main/java/com/bonus/system/att/controller/AttExceptionHandleController2.java b/bonus-modules/bonus-system/src/main/java/com/bonus/system/att/controller/AttExceptionHandleController2.java new file mode 100644 index 0000000..86862af --- /dev/null +++ b/bonus-modules/bonus-system/src/main/java/com/bonus/system/att/controller/AttExceptionHandleController2.java @@ -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 list = attExceptionHandle.getDetailException(data); + return getDataTable(list); + }*/ + +} diff --git a/bonus-modules/bonus-system/src/main/java/com/bonus/system/att/dao/AttExceptionHandleDao.java b/bonus-modules/bonus-system/src/main/java/com/bonus/system/att/dao/AttExceptionHandleDao.java index f809115..1c4c83b 100644 --- a/bonus-modules/bonus-system/src/main/java/com/bonus/system/att/dao/AttExceptionHandleDao.java +++ b/bonus-modules/bonus-system/src/main/java/com/bonus/system/att/dao/AttExceptionHandleDao.java @@ -18,9 +18,19 @@ public interface AttExceptionHandleDao { * @param data 参数 * @return list bean */ - List selectAttExceptionList(AttExceptionBean data); + AttExceptionBean selectAttExceptionList(AttExceptionBean data); + /** + * 轮休临时外出异常月份 + * @return + */ + List> selectAttExceptionMonth(); + /** + * 轮休临时外出异常未处理月份 + * @return + */ + List> selectAttExceptionNoHandleMonth(); /** * 获取轮休临时外出异常数据详情 @@ -29,4 +39,52 @@ public interface AttExceptionHandleDao { */ List getDetailException(AttExceptionBean data); + /** + * 获取轮休临时外出异常数据详情 + * @param data 参数 + * @return list bean + */ + List getDetailAllException(AttExceptionBean data); + + /** + * 获取轮休异常报表未申请详情 + * @param data 参数 + * @return list bean + */ + List getDetailExceptionRest(AttDetailLeaveBean data); + + /** + * 获取临时外出异常报表未申请详情 + * @param data 参数 + * @return list bean + */ + List getDetailExceptionOut(AttDetailLeaveBean data); + + /** + * 获取轮休和临时外出异常报表未申请详情 + * @param data 参数 + * @return list bean + */ + List 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); } diff --git a/bonus-modules/bonus-system/src/main/java/com/bonus/system/att/dao/AttExceptionHandleDao2.java b/bonus-modules/bonus-system/src/main/java/com/bonus/system/att/dao/AttExceptionHandleDao2.java new file mode 100644 index 0000000..f33f9db --- /dev/null +++ b/bonus-modules/bonus-system/src/main/java/com/bonus/system/att/dao/AttExceptionHandleDao2.java @@ -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 selectAttExceptionList(AttExceptionBean data); + + + + /** + * 获取轮休临时外出异常数据详情 + * @param data 参数 + * @return list bean + */ + List getDetailException(AttExceptionBean data); + +} diff --git a/bonus-modules/bonus-system/src/main/java/com/bonus/system/att/entity/AttExceptionBean.java b/bonus-modules/bonus-system/src/main/java/com/bonus/system/att/entity/AttExceptionBean.java index 29d548c..c30e985 100644 --- a/bonus-modules/bonus-system/src/main/java/com/bonus/system/att/entity/AttExceptionBean.java +++ b/bonus-modules/bonus-system/src/main/java/com/bonus/system/att/entity/AttExceptionBean.java @@ -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; diff --git a/bonus-modules/bonus-system/src/main/java/com/bonus/system/att/entity/AttExceptionBean2.java b/bonus-modules/bonus-system/src/main/java/com/bonus/system/att/entity/AttExceptionBean2.java new file mode 100644 index 0000000..1a362fc --- /dev/null +++ b/bonus-modules/bonus-system/src/main/java/com/bonus/system/att/entity/AttExceptionBean2.java @@ -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; + + +} diff --git a/bonus-modules/bonus-system/src/main/java/com/bonus/system/att/service/AttExceptionHandleService.java b/bonus-modules/bonus-system/src/main/java/com/bonus/system/att/service/AttExceptionHandleService.java index 0b96665..1f7da27 100644 --- a/bonus-modules/bonus-system/src/main/java/com/bonus/system/att/service/AttExceptionHandleService.java +++ b/bonus-modules/bonus-system/src/main/java/com/bonus/system/att/service/AttExceptionHandleService.java @@ -20,10 +20,38 @@ public interface AttExceptionHandleService { TableDataInfo selectAttExceptionList(AttExceptionBean data); /** - * 获取异常数据详情 + * 获取轮休临时外出异常数据详情 * @param data 参数 * @return list bean */ List getDetailException(AttExceptionBean data); - } + /** + * 获取轮休异常报表未申请详情 + * @param data 参数 + * @return list bean + */ + List getDetailExceptionRest(AttDetailLeaveBean data); + + /** + * 获取临时外出异常报表未申请详情 + * @param data 参数 + * @return list bean + */ + List getDetailExceptionOut(AttDetailLeaveBean data); + + /** + * 获取轮休和临时外出异常报表未申请详情 + * @param data 参数 + * @return list bean + */ + List getDetailExceptionAll(AttDetailLeaveBean data); + + + /** + * 审批提醒 + * @param vo + * @return + */ + AjaxResult examineRemind(AttExRemindBean vo); +} diff --git a/bonus-modules/bonus-system/src/main/java/com/bonus/system/att/service/AttExceptionHandleService2.java b/bonus-modules/bonus-system/src/main/java/com/bonus/system/att/service/AttExceptionHandleService2.java new file mode 100644 index 0000000..cd40b63 --- /dev/null +++ b/bonus-modules/bonus-system/src/main/java/com/bonus/system/att/service/AttExceptionHandleService2.java @@ -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 getDetailException(AttExceptionBean data);*/ + + } diff --git a/bonus-modules/bonus-system/src/main/java/com/bonus/system/att/service/AttExceptionHandleServiceImpl.java b/bonus-modules/bonus-system/src/main/java/com/bonus/system/att/service/AttExceptionHandleServiceImpl.java index 4fd132e..0e50275 100644 --- a/bonus-modules/bonus-system/src/main/java/com/bonus/system/att/service/AttExceptionHandleServiceImpl.java +++ b/bonus-modules/bonus-system/src/main/java/com/bonus/system/att/service/AttExceptionHandleServiceImpl.java @@ -47,14 +47,36 @@ public class AttExceptionHandleServiceImpl implements AttExceptionHandleService{ @Override public TableDataInfo selectAttExceptionList(AttExceptionBean data) { + AttExceptionBean attExceptionBean = new AttExceptionBean(); List list = new ArrayList<>(); + List> 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 getDetailException(AttExceptionBean data) +// { +// List listPerson = new ArrayList<>(); +// List list = new ArrayList<>(); +// List> mapList = new ArrayList<>(); +// List listTemp = new ArrayList<>(); +// List> parentIdList = new ArrayList<>(); +// List> sonsIdList = new ArrayList<>(); +// Map 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 getDetailException(AttExceptionBean data) { + List listPerson = new ArrayList<>(); List list = new ArrayList<>(); + List> mapList = new ArrayList<>(); + List listTemp = new ArrayList<>(); + List> parentIdList = new ArrayList<>(); + List> sonsIdList = new ArrayList<>(); + Map 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 getDetailExceptionRest(AttDetailLeaveBean data) + { + List 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 getDetailExceptionOut(AttDetailLeaveBean data) + { + List 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 getDetailExceptionAll(AttDetailLeaveBean data) + { + List 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 parentMap,List> parentIdList) { + Map 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> sonsIdList) { + Map mapFinish = new HashMap<>(); + Map mapTemp = new HashMap<>(); + List> 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); + } + } } diff --git a/bonus-modules/bonus-system/src/main/java/com/bonus/system/att/service/AttExceptionHandleServiceImpl2.java b/bonus-modules/bonus-system/src/main/java/com/bonus/system/att/service/AttExceptionHandleServiceImpl2.java new file mode 100644 index 0000000..227038a --- /dev/null +++ b/bonus-modules/bonus-system/src/main/java/com/bonus/system/att/service/AttExceptionHandleServiceImpl2.java @@ -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 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 getDetailException(AttExceptionBean data) + { + List list = new ArrayList<>(); + try { + list = attExceptionHandleDao.getDetailException(data); + } catch (Exception e) { + log.error("查询轮休临时外出异常数据详细信息", e); + } + return list; + }*/ + + + +} diff --git a/bonus-modules/bonus-system/src/main/resources/mapper/att/AttExceptionHandleMapper.xml b/bonus-modules/bonus-system/src/main/resources/mapper/att/AttExceptionHandleMapper.xml index 51f2215..a24748b 100644 --- a/bonus-modules/bonus-system/src/main/resources/mapper/att/AttExceptionHandleMapper.xml +++ b/bonus-modules/bonus-system/src/main/resources/mapper/att/AttExceptionHandleMapper.xml @@ -1,62 +1,250 @@ + PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - 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 - - locate(#{attCurrentMonth},att_current_day) - - GROUP BY - yearMonth + + + + + + + + + + + + + insert into sys_notice( + user_id, + title, + content, + type, + create_time, + update_time, + is_active + )values( + #{userUpdate}, + #{title}, + #{content}, + #{type}, + now(), + now(), + 1 + ) + + + + insert into sys_notice_user( + user_id, + create_time, + update_time, + is_active + )values( + #{userId}, + now(), + now(), + 1 + ) + diff --git a/bonus-modules/bonus-system/src/main/resources/mapper/att/AttExceptionHandleMapper2.xml b/bonus-modules/bonus-system/src/main/resources/mapper/att/AttExceptionHandleMapper2.xml new file mode 100644 index 0000000..8f73e30 --- /dev/null +++ b/bonus-modules/bonus-system/src/main/resources/mapper/att/AttExceptionHandleMapper2.xml @@ -0,0 +1,62 @@ + + + + + + + + +