feat(system): 补充日志功能并优化考勤系统
- 新增补卡功能和相关接口 - 实现批量补卡方法 - 添加补卡记录查询功能 - 优化考勤记录获取逻辑 - 新增日志相关功能: - 获取指定公司下可使用的模板精简列表 - 获取日志页面中的公司列表 - 获取部门日志未读数量 - 修复一些与日志和考勤相关的bug
This commit is contained in:
parent
a8535516ad
commit
3d16e3183e
@ -2,11 +2,12 @@ package cn.iocoder.yudao.module.system.api.attendance;
|
|||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
import cn.iocoder.yudao.module.system.api.attendance.dto.AttendancePunchRecordDTO;
|
import cn.iocoder.yudao.module.system.api.attendance.dto.AttendancePunchRecordDTO;
|
||||||
import cn.iocoder.yudao.module.system.api.attendance.vo.AttendancePunchRecordVO;
|
import cn.iocoder.yudao.module.system.api.attendance.dto.ReplacementCardDTO;
|
||||||
import cn.iocoder.yudao.module.system.enums.ApiConstants;
|
import cn.iocoder.yudao.module.system.enums.ApiConstants;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
|
||||||
@ -18,9 +19,15 @@ public interface AttendanceApi {
|
|||||||
|
|
||||||
String PREFIX = ApiConstants.PREFIX + "/attendance";
|
String PREFIX = ApiConstants.PREFIX + "/attendance";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@PostMapping(PREFIX + "/askingForLeaveAfterwardsToModifyAttendance")
|
@PostMapping(PREFIX + "/askingForLeaveAfterwardsToModifyAttendance")
|
||||||
@Operation(summary = "获取考勤记录")
|
@Operation(summary = "获取考勤记录")
|
||||||
CommonResult askingForLeaveAfterwardsToModifyAttendance(@RequestBody AttendancePunchRecordDTO attendancePunchRecordDTO);
|
CommonResult askingForLeaveAfterwardsToModifyAttendance(@RequestBody AttendancePunchRecordDTO attendancePunchRecordDTO);
|
||||||
|
|
||||||
|
@GetMapping(PREFIX + "getReplacementCardNum")
|
||||||
|
@Operation(summary = "获取补卡次数")
|
||||||
|
CommonResult<Integer> getReplacementCardNum();
|
||||||
|
|
||||||
|
@PostMapping("/replacementCard")
|
||||||
|
@Operation(summary = "批量补卡")
|
||||||
|
CommonResult<Boolean> replacementCard(@RequestBody List<Long> punchRecordIds);
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,19 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.api.attendance.dto;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class ReplacementCardDTO {
|
||||||
|
|
||||||
|
@Schema(description = "日期 yyyy-MM-dd格式")
|
||||||
|
private String actualDayTime;
|
||||||
|
|
||||||
|
@Schema(description = "班次子表id")
|
||||||
|
private Long attendanceGroupShiftItemId;
|
||||||
|
|
||||||
|
@Schema(description = "上下班类型 0上班 1下班")
|
||||||
|
private Integer workType;
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.api.group;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.module.system.enums.ApiConstants;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
|
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿:fallbackFactory =
|
||||||
|
@Tag(name = "RPC 服务 - 考勤组")
|
||||||
|
public interface AttendanceGroupApi {
|
||||||
|
|
||||||
|
String PREFIX = ApiConstants.PREFIX + "/attendance-group";
|
||||||
|
|
||||||
|
@GetMapping(PREFIX + "getReplacementCardNum")
|
||||||
|
@Operation(summary = "获得可补卡次数")
|
||||||
|
@Parameter(name = "userId", description = "用户编号", required = true, example = "1024")
|
||||||
|
CommonResult<Integer> getReplacementCardNum(@RequestParam("userId") Long userId);
|
||||||
|
}
|
@ -2,16 +2,23 @@ package cn.iocoder.yudao.module.system.api.attendance;
|
|||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
import cn.iocoder.yudao.module.system.api.attendance.dto.AttendancePunchRecordDTO;
|
import cn.iocoder.yudao.module.system.api.attendance.dto.AttendancePunchRecordDTO;
|
||||||
|
import cn.iocoder.yudao.module.system.service.attendance.AttendanceService;
|
||||||
import cn.iocoder.yudao.module.system.service.attendance.punchrecord.AttendancePunchRecordService;
|
import cn.iocoder.yudao.module.system.service.attendance.punchrecord.AttendancePunchRecordService;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
||||||
@Validated
|
@Validated
|
||||||
public class AttendanceApiImpl implements AttendanceApi {
|
public class AttendanceApiImpl implements AttendanceApi {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private AttendanceService attendanceService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private AttendancePunchRecordService attendancePunchRecordService;
|
private AttendancePunchRecordService attendancePunchRecordService;
|
||||||
|
|
||||||
@ -19,6 +26,17 @@ public class AttendanceApiImpl implements AttendanceApi {
|
|||||||
@Override
|
@Override
|
||||||
public CommonResult askingForLeaveAfterwardsToModifyAttendance(AttendancePunchRecordDTO attendancePunchRecordDTO) {
|
public CommonResult askingForLeaveAfterwardsToModifyAttendance(AttendancePunchRecordDTO attendancePunchRecordDTO) {
|
||||||
attendancePunchRecordService.askingForLeaveAfterwardsToModifyAttendance(attendancePunchRecordDTO);
|
attendancePunchRecordService.askingForLeaveAfterwardsToModifyAttendance(attendancePunchRecordDTO);
|
||||||
return CommonResult.success("ok");
|
return success("ok");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CommonResult<Integer> getReplacementCardNum() {
|
||||||
|
return success(attendanceService.getReplacementCardNum());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CommonResult<Boolean> replacementCard(List<Long> punchRecordIds) {
|
||||||
|
attendanceService.replacementCardBatch(punchRecordIds);
|
||||||
|
return success(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,29 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.api.group;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.attendance.group.AttendanceGroupDO;
|
||||||
|
import cn.iocoder.yudao.module.system.service.attendance.group.AttendanceGroupService;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
@RestController // 提供 RESTful API 接口,给 Feign 调用
|
||||||
|
@Validated
|
||||||
|
public class AttendanceGroupApiImpl implements AttendanceGroupApi{
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private AttendanceGroupService attendanceGroupService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CommonResult<Integer> getReplacementCardNum(Long userId) {
|
||||||
|
int num = 0;
|
||||||
|
AttendanceGroupDO group = attendanceGroupService.getByUserId(userId);
|
||||||
|
if (group != null) {
|
||||||
|
num = group.getReplacementCardNum();
|
||||||
|
}
|
||||||
|
return success(num);
|
||||||
|
}
|
||||||
|
}
|
@ -11,8 +11,10 @@ import java.util.List;
|
|||||||
public class AttendanceStatusByDayVO {
|
public class AttendanceStatusByDayVO {
|
||||||
@Schema(description = "状态 0正常 1异常(迟到/早退/缺卡/请假)")
|
@Schema(description = "状态 0正常 1异常(迟到/早退/缺卡/请假)")
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
@Schema(description = "是否有提交过 请假/加班/出差/外出/补卡 申请 0否 1是")
|
@Schema(description = "是否有提交过 请假/加班/出差/外出/补卡 申请 0否 1是")
|
||||||
private Integer submitStatus = 0;
|
private Integer submitStatus = 0;
|
||||||
|
|
||||||
@Schema(description = "考勤记录根据考勤组/班次 分组")
|
@Schema(description = "考勤记录根据考勤组/班次 分组")
|
||||||
private List<AttendanceByGroupVO> list;
|
private List<AttendanceByGroupVO> list;
|
||||||
}
|
}
|
||||||
|
@ -45,6 +45,9 @@ public class DeptRespVO {
|
|||||||
@Schema(description = "是否为虚机构 | 0否 1是")
|
@Schema(description = "是否为虚机构 | 0否 1是")
|
||||||
private Integer virtuallyStatus;
|
private Integer virtuallyStatus;
|
||||||
|
|
||||||
|
@Schema(description = "标识符")
|
||||||
|
private String flag;
|
||||||
|
|
||||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "时间戳格式")
|
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "时间戳格式")
|
||||||
private LocalDateTime createTime;
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package cn.iocoder.yudao.module.system.controller.admin.punchrecord;
|
package cn.iocoder.yudao.module.system.controller.admin.punchrecord;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.bpm.api.oa.BpmOAReplacementCardApi;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@ -37,6 +38,9 @@ public class AttendancePunchRecordController {
|
|||||||
@Resource
|
@Resource
|
||||||
private AttendancePunchRecordService punchRecordService;
|
private AttendancePunchRecordService punchRecordService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private BpmOAReplacementCardApi replacementCardApi;
|
||||||
|
|
||||||
@PostMapping("/create")
|
@PostMapping("/create")
|
||||||
@Operation(summary = "创建用户打卡记录")
|
@Operation(summary = "创建用户打卡记录")
|
||||||
@PreAuthorize("@ss.hasPermission('attendance:punch-record:create')")
|
@PreAuthorize("@ss.hasPermission('attendance:punch-record:create')")
|
||||||
@ -70,6 +74,19 @@ public class AttendancePunchRecordController {
|
|||||||
return success(BeanUtils.toBean(punchRecord, AttendancePunchRecordRespVO.class));
|
return success(BeanUtils.toBean(punchRecord, AttendancePunchRecordRespVO.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/getMissingCardRecord")
|
||||||
|
@Operation(summary = "获得本月用户缺卡记录")
|
||||||
|
@PreAuthorize("@ss.hasPermission('attendance:punch-record:query')")
|
||||||
|
public CommonResult<List<AttendancePunchRecordRespVO>> getPunchRecord() {
|
||||||
|
|
||||||
|
// 获取当前用户已申请的补卡记录
|
||||||
|
List<Long> punchRecordIds = replacementCardApi.getPunchRecordIds().getCheckedData();
|
||||||
|
// 获得本月用户缺卡记录
|
||||||
|
List<AttendancePunchRecordDO> punchRecords = punchRecordService.getMissingCardRecord(punchRecordIds);
|
||||||
|
|
||||||
|
return success(BeanUtils.toBean(punchRecords, AttendancePunchRecordRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
@Operation(summary = "获得用户打卡记录分页")
|
@Operation(summary = "获得用户打卡记录分页")
|
||||||
@PreAuthorize("@ss.hasPermission('attendance:punch-record:query')")
|
@PreAuthorize("@ss.hasPermission('attendance:punch-record:query')")
|
||||||
|
@ -85,6 +85,14 @@ public class LogFormController {
|
|||||||
return success(LogFormConvert.INSTANCE.convertList2(list));
|
return success(LogFormConvert.INSTANCE.convertList2(list));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/listByCompanyDeptId")
|
||||||
|
@Operation(summary = "获得指定公司下可使用的模板精简列表", description = "用于表单下拉框")
|
||||||
|
@Parameter(name = "companyDeptId" , description = "公司部门编号", required = true)
|
||||||
|
public CommonResult<List<LogFormSimpleRespVO>> getListByCompanyDeptId(@RequestParam("companyDeptId") Long companyDeptId) {
|
||||||
|
List<LogFormDO> list = formService.getListByCompanyDeptId(companyDeptId);
|
||||||
|
return success(LogFormConvert.INSTANCE.convertList2(list));
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
@Operation(summary = "获得动态模板分页")
|
@Operation(summary = "获得动态模板分页")
|
||||||
public CommonResult<PageResult<LogFormRespVO>> getFormPage(@Valid LogFormPageReqVO pageVO) {
|
public CommonResult<PageResult<LogFormRespVO>> getFormPage(@Valid LogFormPageReqVO pageVO) {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package cn.iocoder.yudao.module.system.controller.admin.worklog;
|
package cn.iocoder.yudao.module.system.controller.admin.worklog;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
@ -8,10 +9,7 @@ import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
|||||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.DeptRespVO;
|
import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.DeptRespVO;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserRespVO;
|
import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserRespVO;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.worklog.vo.loginstance.LogInstanceNextOrUpVO;
|
import cn.iocoder.yudao.module.system.controller.admin.worklog.vo.loginstance.*;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.worklog.vo.loginstance.LogInstancePageReqVO;
|
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.worklog.vo.loginstance.LogInstanceRespVO;
|
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.worklog.vo.loginstance.LogInstanceSaveReqVO;
|
|
||||||
import cn.iocoder.yudao.module.system.convert.worklog.LogInstanceConvert;
|
import cn.iocoder.yudao.module.system.convert.worklog.LogInstanceConvert;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO;
|
||||||
@ -39,6 +37,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
|
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
|
||||||
@ -147,8 +146,12 @@ public class LogInstanceController {
|
|||||||
|
|
||||||
@PostMapping("/get-dept")
|
@PostMapping("/get-dept")
|
||||||
@Operation(summary = "获得我收到的日志页面中的部门列表")
|
@Operation(summary = "获得我收到的日志页面中的部门列表")
|
||||||
|
@Parameter(name = "companyDeptId", description = "公司部门编号")
|
||||||
@PreAuthorize("@ss.hasPermission('system:view-log:query')")
|
@PreAuthorize("@ss.hasPermission('system:view-log:query')")
|
||||||
public CommonResult<List<DeptRespVO>> getReadDept() {
|
public CommonResult<List<DeptRespVO>> getReadDept(@RequestParam(value = "companyDeptId", required = false) Long companyDeptId) {
|
||||||
|
|
||||||
|
// 获取公司下级所有部门
|
||||||
|
List<Long> companyDeptIds = convertList(deptService.getChildDept(companyDeptId), DeptDO::getId);
|
||||||
|
|
||||||
// 获得用户角色
|
// 获得用户角色
|
||||||
List<RoleDO> userRoles = roleService.getRoleListFromCache(permissionService.getUserRoleIdListByUserId(getLoginUserId()));
|
List<RoleDO> userRoles = roleService.getRoleListFromCache(permissionService.getUserRoleIdListByUserId(getLoginUserId()));
|
||||||
@ -156,15 +159,88 @@ public class LogInstanceController {
|
|||||||
if (codes.contains("super_admin")) {
|
if (codes.contains("super_admin")) {
|
||||||
|
|
||||||
List<Long> deptIds = logUseService.getUseDeptList();
|
List<Long> deptIds = logUseService.getUseDeptList();
|
||||||
|
if (CollectionUtil.isNotEmpty(companyDeptIds)) {
|
||||||
|
deptIds = deptIds.stream().filter(companyDeptIds::contains).collect(Collectors.toList());
|
||||||
|
}
|
||||||
List<DeptDO> deptDOS = deptService.getDeptList(deptIds);
|
List<DeptDO> deptDOS = deptService.getDeptList(deptIds);
|
||||||
|
|
||||||
return success(BeanUtils.toBean(deptDOS, DeptRespVO.class));
|
return success(BeanUtils.toBean(deptDOS, DeptRespVO.class));
|
||||||
}else {
|
}else {
|
||||||
List<DeptRespVO> deptInfo = logInstanceService.getDeptInfo();
|
|
||||||
|
List<DeptRespVO> deptInfo = logInstanceService.getDeptInfo(companyDeptIds);
|
||||||
return success(deptInfo);
|
return success(deptInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get-company-dept")
|
||||||
|
@Operation(summary = "获得我收到的日志页面中的公司列表")
|
||||||
|
@PreAuthorize("@ss.hasPermission('system:view-log:query')")
|
||||||
|
public CommonResult<List<DeptRespVO>> getReadCompanyDept() {
|
||||||
|
|
||||||
|
// 获得公司编号列表
|
||||||
|
List<DeptDO> companyDeptDOs = deptService.getCompanyDept();
|
||||||
|
|
||||||
|
// 获得用户角色
|
||||||
|
List<RoleDO> userRoles = roleService.getRoleListFromCache(permissionService.getUserRoleIdListByUserId(getLoginUserId()));
|
||||||
|
List<String> codes = convertList(userRoles, RoleDO::getCode);
|
||||||
|
|
||||||
|
List<DeptRespVO> deptInfo;
|
||||||
|
if (codes.contains("super_admin")) {
|
||||||
|
|
||||||
|
List<Long> deptIds = logUseService.getUseDeptList();
|
||||||
|
deptInfo = BeanUtils.toBean(deptService.getDeptList(deptIds), DeptRespVO.class);
|
||||||
|
}else {
|
||||||
|
|
||||||
|
// 获取可查看日志的部门列表
|
||||||
|
deptInfo = logInstanceService.getDeptInfo(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<DeptRespVO> respVOS = new ArrayList<>();
|
||||||
|
for (DeptDO companyDept : companyDeptDOs) {
|
||||||
|
if (deptInfo.stream().anyMatch(dept -> dept.getFlag().contains(companyDept.getId().toString()))) {
|
||||||
|
respVOS.add(BeanUtils.toBean(companyDept, DeptRespVO.class));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return success(respVOS);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get-dept-unReadCount")
|
||||||
|
@Operation(summary = "获得我收到的日志页面中的各部门列表以及未读数量")
|
||||||
|
@Parameter(name = "companyDeptId", description = "公司部门编号", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('system:view-log:query')")
|
||||||
|
public CommonResult<List<LogInstanceDeptUnReadCountVO>> getDeptUnReadCount(@RequestParam("companyDeptId") Long companyDeptId) {
|
||||||
|
|
||||||
|
// 获取公司下级所有部门
|
||||||
|
List<Long> companyDeptIds = convertList(deptService.getChildDept(companyDeptId), DeptDO::getId);
|
||||||
|
|
||||||
|
// 获得用户角色
|
||||||
|
List<RoleDO> userRoles = roleService.getRoleListFromCache(permissionService.getUserRoleIdListByUserId(getLoginUserId()));
|
||||||
|
List<String> codes = convertList(userRoles, RoleDO::getCode);
|
||||||
|
if (codes.contains("super_admin")) {
|
||||||
|
|
||||||
|
List<Long> deptIds = logUseService.getUseDeptList();
|
||||||
|
if (CollectionUtil.isNotEmpty(companyDeptIds)) {
|
||||||
|
deptIds = deptIds.stream().filter(companyDeptIds::contains).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
List<DeptDO> deptDOS = deptService.getDeptList(deptIds);
|
||||||
|
|
||||||
|
return success(deptDOS.stream()
|
||||||
|
.map(dept -> {
|
||||||
|
LogInstanceDeptUnReadCountVO vo = new LogInstanceDeptUnReadCountVO();
|
||||||
|
vo.setDeptId(dept.getId());
|
||||||
|
vo.setDeptName(dept.getName());
|
||||||
|
vo.setUnReadCount(0);
|
||||||
|
return vo;
|
||||||
|
})
|
||||||
|
.collect(Collectors.toList()));
|
||||||
|
}else {
|
||||||
|
|
||||||
|
List<LogInstanceDeptUnReadCountVO> respVOS = logReadService.getDeptUnReadCount(companyDeptIds);
|
||||||
|
return success(respVOS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/get-upLog")
|
@GetMapping("/get-upLog")
|
||||||
@Operation(summary = "获取上一篇日志,用于导入上一篇日志")
|
@Operation(summary = "获取上一篇日志,用于导入上一篇日志")
|
||||||
@Parameter(name = "formId", description = "日志模板编号", required = true, example = "1")
|
@Parameter(name = "formId", description = "日志模板编号", required = true, example = "1")
|
||||||
|
@ -0,0 +1,18 @@
|
|||||||
|
package cn.iocoder.yudao.module.system.controller.admin.worklog.vo.loginstance;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 部门日志未读数量 Response VO")
|
||||||
|
@Data
|
||||||
|
public class LogInstanceDeptUnReadCountVO {
|
||||||
|
|
||||||
|
@Schema(description = "部门编号")
|
||||||
|
private Long deptId;
|
||||||
|
|
||||||
|
@Schema(description = "部门名称")
|
||||||
|
private String deptName;
|
||||||
|
|
||||||
|
@Schema(description = "未读数量")
|
||||||
|
private Integer unReadCount;
|
||||||
|
}
|
@ -136,9 +136,14 @@ public class AttendancePunchRecordDO extends BaseDO {
|
|||||||
private Long leaveEarlyTime;
|
private Long leaveEarlyTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 加班时长时间戳
|
* 下加班时长时间戳
|
||||||
*/
|
*/
|
||||||
private Long workOvertimeTime;
|
private Long downWorkOvertimeTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上班加班时长时间戳
|
||||||
|
*/
|
||||||
|
private Long upWorkOvertimeTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否已提醒 0否 1是
|
* 是否已提醒 0否 1是
|
||||||
@ -157,4 +162,10 @@ public class AttendancePunchRecordDO extends BaseDO {
|
|||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private String deptName;
|
private String deptName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 补卡状态 0无补卡 1补卡中
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
private Integer replacementCardStatus = 0;
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ import lombok.*;
|
|||||||
@Builder
|
@Builder
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class LogReadDo extends BaseDO {
|
public class LogReadDO extends BaseDO {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 编号
|
* 编号
|
@ -151,6 +151,7 @@ public interface AdminUserMapper extends BaseMapperX<AdminUserDO> {
|
|||||||
" lc.user_id = max.userId\n" +
|
" lc.user_id = max.userId\n" +
|
||||||
" AND lc.create_time = max.max_create_time) a on a.user_id = t.id");
|
" AND lc.create_time = max.max_create_time) a on a.user_id = t.id");
|
||||||
queryWrapper.eq(AdminUserDO::getUserType, 1);
|
queryWrapper.eq(AdminUserDO::getUserType, 1);
|
||||||
|
queryWrapper.eq(AdminUserDO::getStatus, CommonStatusEnum.ENABLE.getStatus());
|
||||||
queryWrapper.likeIfPresent(AdminUserDO::getNickname, pageReqVO.getUserName());
|
queryWrapper.likeIfPresent(AdminUserDO::getNickname, pageReqVO.getUserName());
|
||||||
queryWrapper.inIfPresent(AdminUserDO::getDeptId, pageReqVO.getDeptIds());
|
queryWrapper.inIfPresent(AdminUserDO::getDeptId, pageReqVO.getDeptIds());
|
||||||
if (Objects.nonNull(pageReqVO.getSigningDate())) {
|
if (Objects.nonNull(pageReqVO.getSigningDate())) {
|
||||||
|
@ -2,8 +2,10 @@ package cn.iocoder.yudao.module.system.dal.mysql.worklog;
|
|||||||
|
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.worklog.LogReadDo;
|
import cn.iocoder.yudao.module.system.controller.admin.worklog.vo.loginstance.LogInstanceDeptUnReadCountVO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.worklog.LogReadDO;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -13,20 +15,23 @@ import java.util.List;
|
|||||||
* @author 符溶馨
|
* @author 符溶馨
|
||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface LogReadMapper extends BaseMapperX<LogReadDo> {
|
public interface LogReadMapper extends BaseMapperX<LogReadDO> {
|
||||||
|
|
||||||
default List<LogReadDo> selectUserByLogId(Long logId, Integer readStatus) {
|
default List<LogReadDO> selectUserByLogId(Long logId, Integer readStatus) {
|
||||||
|
|
||||||
return selectList(new LambdaQueryWrapperX<LogReadDo>()
|
return selectList(new LambdaQueryWrapperX<LogReadDO>()
|
||||||
.eq(LogReadDo::getLogInstanceId, logId)
|
.eq(LogReadDO::getLogInstanceId, logId)
|
||||||
.eq(LogReadDo::getReadStatus, readStatus));
|
.eq(LogReadDO::getReadStatus, readStatus));
|
||||||
}
|
}
|
||||||
|
|
||||||
default void updateReadStatus(Long logId, Long userId){
|
default void updateReadStatus(Long logId, Long userId){
|
||||||
|
|
||||||
update(new LogReadDo().setReadStatus(1),
|
update(new LogReadDO().setReadStatus(1),
|
||||||
new LambdaQueryWrapperX<LogReadDo>()
|
new LambdaQueryWrapperX<LogReadDO>()
|
||||||
.eq(LogReadDo::getLogInstanceId, logId)
|
.eq(LogReadDO::getLogInstanceId, logId)
|
||||||
.eq(LogReadDo::getReadUserId, userId));
|
.eq(LogReadDO::getReadUserId, userId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<LogInstanceDeptUnReadCountVO> selectDeptUnReadCount(@Param("userId") Long userId,
|
||||||
|
@Param("deptIds") List<Long> deptIds);
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import cn.iocoder.yudao.module.bpm.api.model.BpmModelApi;
|
|||||||
import cn.iocoder.yudao.module.bpm.api.oa.BpmOAEntryApi;
|
import cn.iocoder.yudao.module.bpm.api.oa.BpmOAEntryApi;
|
||||||
import cn.iocoder.yudao.module.bpm.api.oa.BpmOAEvectionApi;
|
import cn.iocoder.yudao.module.bpm.api.oa.BpmOAEvectionApi;
|
||||||
import cn.iocoder.yudao.module.bpm.api.oa.BpmOAGoOutApi;
|
import cn.iocoder.yudao.module.bpm.api.oa.BpmOAGoOutApi;
|
||||||
|
import cn.iocoder.yudao.module.bpm.api.oa.BpmOAReplacementCardApi;
|
||||||
import cn.iocoder.yudao.module.infra.api.config.ConfigApi;
|
import cn.iocoder.yudao.module.infra.api.config.ConfigApi;
|
||||||
import cn.iocoder.yudao.module.infra.api.file.FileApi;
|
import cn.iocoder.yudao.module.infra.api.file.FileApi;
|
||||||
import cn.iocoder.yudao.module.infra.api.websocket.WebSocketSenderApi;
|
import cn.iocoder.yudao.module.infra.api.websocket.WebSocketSenderApi;
|
||||||
@ -12,6 +13,7 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
|
|||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
@Configuration(proxyBeanMethods = false)
|
@Configuration(proxyBeanMethods = false)
|
||||||
@EnableFeignClients(clients = {FileApi.class, WebSocketSenderApi.class, FactoryInfoApi.class, BpmModelApi.class, BpmOAGoOutApi.class, BpmOAEntryApi.class, ConfigApi.class, BpmOAEvectionApi.class})
|
@EnableFeignClients(clients = {FileApi.class, WebSocketSenderApi.class, FactoryInfoApi.class, BpmModelApi.class, BpmOAGoOutApi.class, BpmOAEntryApi.class, ConfigApi.class,
|
||||||
|
BpmOAEvectionApi.class, BpmOAReplacementCardApi.class})
|
||||||
public class RpcConfiguration {
|
public class RpcConfiguration {
|
||||||
}
|
}
|
||||||
|
@ -158,6 +158,12 @@ public interface AttendanceService {
|
|||||||
*/
|
*/
|
||||||
void replacementCard(AttendanceReplacementCardDTO dto);
|
void replacementCard(AttendanceReplacementCardDTO dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量不卡
|
||||||
|
* @param punchRecordIds 打卡记录id
|
||||||
|
*/
|
||||||
|
void replacementCardBatch(List<Long> punchRecordIds);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 考勤机打卡
|
* 考勤机打卡
|
||||||
*
|
*
|
||||||
|
@ -15,6 +15,7 @@ import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
|||||||
import cn.iocoder.yudao.framework.common.exception.ServiceException;
|
import cn.iocoder.yudao.framework.common.exception.ServiceException;
|
||||||
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
|
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
|
||||||
import cn.iocoder.yudao.framework.common.util.distance.GeoUtil;
|
import cn.iocoder.yudao.framework.common.util.distance.GeoUtil;
|
||||||
|
import cn.iocoder.yudao.module.bpm.api.oa.BpmOAReplacementCardApi;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.attendance.dto.*;
|
import cn.iocoder.yudao.module.system.controller.admin.attendance.dto.*;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.attendance.vo.*;
|
import cn.iocoder.yudao.module.system.controller.admin.attendance.vo.*;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.punchrecord.vo.AttendancePunchRecordSaveReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.punchrecord.vo.AttendancePunchRecordSaveReqVO;
|
||||||
@ -112,6 +113,9 @@ public class AttendanceServiceImpl implements AttendanceService {
|
|||||||
@Resource
|
@Resource
|
||||||
private DeptService deptService;
|
private DeptService deptService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private BpmOAReplacementCardApi replacementCardApi;
|
||||||
|
|
||||||
|
|
||||||
// 定义一些常量以提高代码的可读性和可维护性
|
// 定义一些常量以提高代码的可读性和可维护性
|
||||||
/**
|
/**
|
||||||
@ -516,13 +520,21 @@ public class AttendanceServiceImpl implements AttendanceService {
|
|||||||
AttendanceOnTheDayDTO.PUNCH_STATUS_MISS,
|
AttendanceOnTheDayDTO.PUNCH_STATUS_MISS,
|
||||||
AttendanceOnTheDayDTO.ASK_FOR_LEAVE
|
AttendanceOnTheDayDTO.ASK_FOR_LEAVE
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// 获取当前用户 本月正在补卡申请的记录
|
||||||
|
List<Long> punchRecordIds = replacementCardApi.getPunchRecordIds().getCheckedData();
|
||||||
|
|
||||||
for (Map.Entry<String, List<AttendancePunchRecordDO>> entry : collect.entrySet()) {
|
for (Map.Entry<String, List<AttendancePunchRecordDO>> entry : collect.entrySet()) {
|
||||||
AttendanceStatusByDayVO attendanceStatusByDayVO = new AttendanceStatusByDayVO();
|
AttendanceStatusByDayVO attendanceStatusByDayVO = new AttendanceStatusByDayVO();
|
||||||
int status = 0;
|
int status = 0;
|
||||||
for (AttendancePunchRecordDO attendancePunchRecordDO : entry.getValue()) {
|
for (int i = 0; i < entry.getValue().size(); i++) {
|
||||||
if (statusList.contains(attendancePunchRecordDO.getStatus())) {
|
if (statusList.contains(entry.getValue().get(i).getStatus())) {
|
||||||
status = 1;
|
status = 1;
|
||||||
break;
|
if (entry.getValue().get(i).getStatus().equals(AttendanceOnTheDayDTO.PUNCH_STATUS_MISS)
|
||||||
|
&& punchRecordIds.contains(entry.getValue().get(i).getId())) {
|
||||||
|
entry.getValue().get(i).setReplacementCardStatus(Constants.TRUE);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
attendanceStatusByDayVO.setStatus(status);
|
attendanceStatusByDayVO.setStatus(status);
|
||||||
@ -1038,6 +1050,7 @@ public class AttendanceServiceImpl implements AttendanceService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void replacementCard(AttendanceReplacementCardDTO dto) {
|
public void replacementCard(AttendanceReplacementCardDTO dto) {
|
||||||
Long userId = getLoginUserId();
|
Long userId = getLoginUserId();
|
||||||
//先减去补卡次数
|
//先减去补卡次数
|
||||||
@ -1070,6 +1083,37 @@ public class AttendanceServiceImpl implements AttendanceService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void replacementCardBatch(List<Long> punchRecordIds) {
|
||||||
|
|
||||||
|
Long userId = getLoginUserId();
|
||||||
|
try {
|
||||||
|
// -- 找到缺卡记录
|
||||||
|
List<AttendancePunchRecordDO> list = attendancePunchRecordMapper.selectBatchIds(punchRecordIds);
|
||||||
|
|
||||||
|
List<AttendancePunchRecordDO> updateDOs = new ArrayList<>();
|
||||||
|
for (AttendancePunchRecordDO attendancePunchRecordDO : list) {
|
||||||
|
AttendancePunchRecordDO updateDO = new AttendancePunchRecordDO()
|
||||||
|
.setId(attendancePunchRecordDO.getId())
|
||||||
|
.setStatus(AttendanceOnTheDayDTO.REPLACEMENT_CARD)
|
||||||
|
.setPunchTime(attendancePunchRecordDO.getShouldPunchTime());
|
||||||
|
|
||||||
|
updateDOs.add(updateDO);
|
||||||
|
}
|
||||||
|
// 批量修改 补卡记录
|
||||||
|
boolean update = attendancePunchRecordMapper.updateBatch(updateDOs);
|
||||||
|
if (!update) {
|
||||||
|
throw exception(CANNOT_FIND_THE_RECORD_THAT_NEEDS_TO_BE_REPLACED);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
// -- 如果有报错的话 - 那么进行回滚操作 - 并且redis 中的补卡次数也要+1 (redis并不会回滚)
|
||||||
|
String key = "ReplacementCardNum" + "_" + userId + "_" + LocalDateTime.now().format(Constants.YEAR_MONTH_FORMAT);
|
||||||
|
stringRedisTemplate.opsForValue().increment(key, punchRecordIds.size());
|
||||||
|
throw exception(ABNORMAL_CARD_REPLENISHMENT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JSONObject attendanceMachineCheck(JSONObject object) {
|
public JSONObject attendanceMachineCheck(JSONObject object) {
|
||||||
JSONObject result = new JSONObject().set("Result", 0).set("Msg", "识别通过");
|
JSONObject result = new JSONObject().set("Result", 0).set("Msg", "识别通过");
|
||||||
@ -1145,7 +1189,6 @@ public class AttendanceServiceImpl implements AttendanceService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 按日导出
|
* 按日导出
|
||||||
*
|
*
|
||||||
|
@ -120,4 +120,10 @@ public interface AttendancePunchRecordService {
|
|||||||
* @param dto
|
* @param dto
|
||||||
*/
|
*/
|
||||||
void askingForLeaveAfterwardsToModifyAttendance(AttendancePunchRecordDTO dto);
|
void askingForLeaveAfterwardsToModifyAttendance(AttendancePunchRecordDTO dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取本月缺卡记录
|
||||||
|
* @return 打卡记录列表
|
||||||
|
*/
|
||||||
|
List<AttendancePunchRecordDO> getMissingCardRecord(List<Long> punchRecordIds);
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ import cn.iocoder.yudao.framework.common.pojo.BpmOALeaveDTO;
|
|||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
|
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
|
||||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
import cn.iocoder.yudao.module.system.api.attendance.dto.AttendancePunchRecordDTO;
|
import cn.iocoder.yudao.module.system.api.attendance.dto.AttendancePunchRecordDTO;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.punchrecord.vo.AttendancePunchRecordPageReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.punchrecord.vo.AttendancePunchRecordPageReqVO;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.punchrecord.vo.AttendancePunchRecordSaveReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.punchrecord.vo.AttendancePunchRecordSaveReqVO;
|
||||||
@ -37,6 +38,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.time.temporal.ChronoUnit;
|
import java.time.temporal.ChronoUnit;
|
||||||
@ -45,6 +47,7 @@ import java.util.concurrent.TimeUnit;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||||
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.PUNCH_RECORD_NOT_EXISTS;
|
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.PUNCH_RECORD_NOT_EXISTS;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -333,6 +336,18 @@ public class AttendancePunchRecordServiceImpl implements AttendancePunchRecordSe
|
|||||||
.le(AttendancePunchRecordDO::getShouldPunchTime, dto.getEndTime()));
|
.le(AttendancePunchRecordDO::getShouldPunchTime, dto.getEndTime()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<AttendancePunchRecordDO> getMissingCardRecord(List<Long> punchRecordIds) {
|
||||||
|
|
||||||
|
String now = LocalDate.now().format(Constants.YEAR_MONTH_FORMAT);
|
||||||
|
|
||||||
|
return punchRecordMapper.selectList(new LambdaQueryWrapperX<AttendancePunchRecordDO>()
|
||||||
|
.notIn(CollectionUtil.isNotEmpty(punchRecordIds), AttendancePunchRecordDO::getId, punchRecordIds)
|
||||||
|
.eq(AttendancePunchRecordDO::getStatus, AttendanceOnTheDayDTO.PUNCH_STATUS_MISS)
|
||||||
|
.eq(AttendancePunchRecordDO::getUserId, getLoginUserId())
|
||||||
|
.like(AttendancePunchRecordDO::getDayTime, now));
|
||||||
|
}
|
||||||
|
|
||||||
private Map<Long, Long> getAttendanceGroupShiftIdGroupByGroup(List<AttendanceGroupDO> attendanceGroupDOS, LocalDateTime localDateTime) {
|
private Map<Long, Long> getAttendanceGroupShiftIdGroupByGroup(List<AttendanceGroupDO> attendanceGroupDOS, LocalDateTime localDateTime) {
|
||||||
Map<Long, Long> map = new HashMap<>();
|
Map<Long, Long> map = new HashMap<>();
|
||||||
List<AttendanceGroupDO> fixedList = attendanceGroupDOS.stream().filter(a -> a.getType().equals(1)).collect(Collectors.toList());
|
List<AttendanceGroupDO> fixedList = attendanceGroupDOS.stream().filter(a -> a.getType().equals(1)).collect(Collectors.toList());
|
||||||
|
@ -268,7 +268,8 @@ public class DeptServiceImpl implements DeptService {
|
|||||||
public List<DeptDO> getChildDept(Long id) {
|
public List<DeptDO> getChildDept(Long id) {
|
||||||
|
|
||||||
return deptMapper.selectList(new LambdaQueryWrapperX<DeptDO>()
|
return deptMapper.selectList(new LambdaQueryWrapperX<DeptDO>()
|
||||||
.like(DeptDO::getFlag, id));
|
.like(DeptDO::getFlag, id)
|
||||||
|
.eq(DeptDO::getStatus, CommonStatusEnum.ENABLE.getStatus()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -322,7 +323,8 @@ public class DeptServiceImpl implements DeptService {
|
|||||||
|
|
||||||
return deptMapper.selectList(new LambdaQueryWrapperX<DeptDO>()
|
return deptMapper.selectList(new LambdaQueryWrapperX<DeptDO>()
|
||||||
.eq(DeptDO::getType, 0)
|
.eq(DeptDO::getType, 0)
|
||||||
.eq(DeptDO::getVirtuallyStatus, 0));
|
.eq(DeptDO::getVirtuallyStatus, 0)
|
||||||
|
.eq(DeptDO::getStatus, CommonStatusEnum.ENABLE.getStatus()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -97,4 +97,11 @@ public interface LogFormService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<LogFormRuleVO> getLogFormRuleList();
|
List<LogFormRuleVO> getLogFormRuleList();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得指定公司下可使用的模板精简列表
|
||||||
|
* @param companyDeptId 公司部门编号
|
||||||
|
* @return 模版列表
|
||||||
|
*/
|
||||||
|
List<LogFormDO> getListByCompanyDeptId(Long companyDeptId);
|
||||||
}
|
}
|
||||||
|
@ -9,10 +9,12 @@ import cn.iocoder.yudao.module.system.controller.admin.worklog.vo.form.LogFormPa
|
|||||||
import cn.iocoder.yudao.module.system.controller.admin.worklog.vo.form.LogFormRuleVO;
|
import cn.iocoder.yudao.module.system.controller.admin.worklog.vo.form.LogFormRuleVO;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.worklog.vo.form.LogFormUpdateReqVO;
|
import cn.iocoder.yudao.module.system.controller.admin.worklog.vo.form.LogFormUpdateReqVO;
|
||||||
import cn.iocoder.yudao.module.system.convert.worklog.LogFormConvert;
|
import cn.iocoder.yudao.module.system.convert.worklog.LogFormConvert;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.worklog.LogFormDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.worklog.LogFormDO;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.worklog.LogRuleDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.worklog.LogRuleDO;
|
||||||
import cn.iocoder.yudao.module.system.dal.mysql.worklog.LogFormMapper;
|
import cn.iocoder.yudao.module.system.dal.mysql.worklog.LogFormMapper;
|
||||||
import cn.iocoder.yudao.module.system.enums.ErrorCodeConstants;
|
import cn.iocoder.yudao.module.system.enums.ErrorCodeConstants;
|
||||||
|
import cn.iocoder.yudao.module.system.service.dept.DeptService;
|
||||||
import cn.iocoder.yudao.module.system.service.worklog.dto.LogFormFieldRespDTO;
|
import cn.iocoder.yudao.module.system.service.worklog.dto.LogFormFieldRespDTO;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@ -23,6 +25,7 @@ import java.util.*;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
|
||||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -42,6 +45,9 @@ public class LogFormServiceImpl implements LogFormService {
|
|||||||
@Resource
|
@Resource
|
||||||
private LogUseService logUseService;
|
private LogUseService logUseService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private DeptService deptService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long createForm(LogFormCreateReqVO createReqVO) {
|
public Long createForm(LogFormCreateReqVO createReqVO) {
|
||||||
this.checkFields(createReqVO.getFields());
|
this.checkFields(createReqVO.getFields());
|
||||||
@ -137,6 +143,16 @@ public class LogFormServiceImpl implements LogFormService {
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<LogFormDO> getListByCompanyDeptId(Long companyDeptId) {
|
||||||
|
|
||||||
|
// 获得公司下所有部门编号列表
|
||||||
|
List<Long> deptIds = convertList(deptService.getChildDept(companyDeptId), DeptDO::getId);
|
||||||
|
List<Long> formIds = logUseService.getFormIdList(deptIds);
|
||||||
|
|
||||||
|
return formMapper.selectBatchIds(formIds);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验 Field,避免 field 重复
|
* 校验 Field,避免 field 重复
|
||||||
*
|
*
|
||||||
|
@ -1,10 +1,7 @@
|
|||||||
package cn.iocoder.yudao.module.system.service.worklog;
|
package cn.iocoder.yudao.module.system.service.worklog;
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.DeptRespVO;
|
import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.DeptRespVO;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.worklog.vo.loginstance.LogInstanceNextOrUpVO;
|
import cn.iocoder.yudao.module.system.controller.admin.worklog.vo.loginstance.*;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.worklog.vo.loginstance.LogInstancePageReqVO;
|
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.worklog.vo.loginstance.LogInstanceRespVO;
|
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.worklog.vo.loginstance.LogInstanceSaveReqVO;
|
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.worklog.LogInstanceDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.worklog.LogInstanceDO;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
|
||||||
@ -59,7 +56,7 @@ public interface LogInstanceService {
|
|||||||
/**
|
/**
|
||||||
* 获得我收到的日志页面中的部门列表
|
* 获得我收到的日志页面中的部门列表
|
||||||
*/
|
*/
|
||||||
List<DeptRespVO> getDeptInfo();
|
List<DeptRespVO> getDeptInfo(List<Long> deptIds);
|
||||||
|
|
||||||
|
|
||||||
List<LogInstanceDO> getNeedWriteLogInstanceByTimeRange(Long fromId, List<String> time, Long userId);
|
List<LogInstanceDO> getNeedWriteLogInstanceByTimeRange(Long fromId, List<String> time, Long userId);
|
||||||
|
@ -6,12 +6,8 @@ import cn.hutool.json.JSONObject;
|
|||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
|
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
|
||||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
import cn.iocoder.yudao.module.infra.api.config.ConfigApi;
|
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.DeptRespVO;
|
import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.DeptRespVO;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.worklog.vo.loginstance.LogInstanceNextOrUpVO;
|
import cn.iocoder.yudao.module.system.controller.admin.worklog.vo.loginstance.*;
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.worklog.vo.loginstance.LogInstancePageReqVO;
|
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.worklog.vo.loginstance.LogInstanceRespVO;
|
|
||||||
import cn.iocoder.yudao.module.system.controller.admin.worklog.vo.loginstance.LogInstanceSaveReqVO;
|
|
||||||
import cn.iocoder.yudao.module.system.convert.worklog.LogInstanceConvert;
|
import cn.iocoder.yudao.module.system.convert.worklog.LogInstanceConvert;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
|
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
|
||||||
@ -25,7 +21,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.mapstruct.ap.internal.util.Strings;
|
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@ -77,10 +72,6 @@ public class LogInstanceServiceImpl implements LogInstanceService {
|
|||||||
@Lazy
|
@Lazy
|
||||||
private LogStatisticsService logStatisticsService;
|
private LogStatisticsService logStatisticsService;
|
||||||
|
|
||||||
@Resource
|
|
||||||
private ConfigApi configApi;
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long createLogInstance(LogInstanceSaveReqVO createReqVO) {
|
public Long createLogInstance(LogInstanceSaveReqVO createReqVO) {
|
||||||
|
|
||||||
@ -338,16 +329,17 @@ public class LogInstanceServiceImpl implements LogInstanceService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<DeptRespVO> getDeptInfo() {
|
public List<DeptRespVO> getDeptInfo(List<Long> childDeptIds) {
|
||||||
|
|
||||||
// 根据日志规则 获取当前登录用户可以查看日志的用户信息
|
// 根据日志规则 获取当前登录用户可以查看日志的用户信息
|
||||||
List<LogReadDo> logInstanceIds = logReadService.getReadListByReadUserId(getLoginUserId());
|
List<LogReadDO> logInstanceIds = logReadService.getReadListByReadUserId(getLoginUserId());
|
||||||
List<Long> startUserIds = convertList(logInstanceIds, LogReadDo::getStartUserId);
|
List<Long> startUserIds = convertList(logInstanceIds, LogReadDO::getStartUserId);
|
||||||
List<AdminUserDO> adminUserDOS = adminUserService.getUserList(startUserIds);
|
List<AdminUserDO> adminUserDOS = adminUserService.getUserList(startUserIds);
|
||||||
|
|
||||||
// 获得部门信息
|
// 获得部门信息
|
||||||
List<Long> deptIds = adminUserDOS.stream()
|
List<Long> deptIds = adminUserDOS.stream()
|
||||||
.map(AdminUserDO::getDeptId)
|
.map(AdminUserDO::getDeptId)
|
||||||
|
.filter(deptId -> CollectionUtil.isNotEmpty(childDeptIds) && childDeptIds.contains(deptId))
|
||||||
.distinct()
|
.distinct()
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
@ -443,7 +435,6 @@ public class LogInstanceServiceImpl implements LogInstanceService {
|
|||||||
return vo;
|
return vo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<LogInstanceDO> getNeedWriteLogInstanceByTimeRange(Long fromId, List<String> time, Long userId) {
|
public List<LogInstanceDO> getNeedWriteLogInstanceByTimeRange(Long fromId, List<String> time, Long userId) {
|
||||||
return logInstanceMapper.selectList(new LambdaQueryWrapper<LogInstanceDO>()
|
return logInstanceMapper.selectList(new LambdaQueryWrapper<LogInstanceDO>()
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
package cn.iocoder.yudao.module.system.service.worklog;
|
package cn.iocoder.yudao.module.system.service.worklog;
|
||||||
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.worklog.LogReadDo;
|
import cn.iocoder.yudao.module.system.controller.admin.worklog.vo.loginstance.LogInstanceDeptUnReadCountVO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.worklog.LogReadDO;
|
||||||
import cn.iocoder.yudao.module.system.service.worklog.dto.LogReadUserRespDTO;
|
import cn.iocoder.yudao.module.system.service.worklog.dto.LogReadUserRespDTO;
|
||||||
|
|
||||||
import javax.validation.Valid;
|
import javax.validation.Valid;
|
||||||
@ -41,7 +42,7 @@ public interface LogReadService {
|
|||||||
* @param userId 用户编号
|
* @param userId 用户编号
|
||||||
* @return 日志列表
|
* @return 日志列表
|
||||||
*/
|
*/
|
||||||
List<LogReadDo> getReadListByReadUserId(Long userId);
|
List<LogReadDO> getReadListByReadUserId(Long userId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得指定日志的查看状态
|
* 获得指定日志的查看状态
|
||||||
@ -62,4 +63,11 @@ public interface LogReadService {
|
|||||||
* @param loginUserId 登录用户编号
|
* @param loginUserId 登录用户编号
|
||||||
*/
|
*/
|
||||||
void setRead(Long loginUserId);
|
void setRead(Long loginUserId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得我收到的日志页面中的各部门列表以及未读数量
|
||||||
|
* @param deptIds 部门编号列表
|
||||||
|
* @return 各部门列表以及未读数量
|
||||||
|
*/
|
||||||
|
List<LogInstanceDeptUnReadCountVO> getDeptUnReadCount(List<Long> deptIds);
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
package cn.iocoder.yudao.module.system.service.worklog;
|
package cn.iocoder.yudao.module.system.service.worklog;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
import cn.iocoder.yudao.module.system.dal.dataobject.worklog.LogReadDo;
|
import cn.iocoder.yudao.module.system.controller.admin.worklog.vo.loginstance.LogInstanceDeptUnReadCountVO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.dataobject.worklog.LogReadDO;
|
||||||
|
import cn.iocoder.yudao.module.system.dal.mysql.dept.DeptMapper;
|
||||||
import cn.iocoder.yudao.module.system.dal.mysql.worklog.LogReadMapper;
|
import cn.iocoder.yudao.module.system.dal.mysql.worklog.LogReadMapper;
|
||||||
import cn.iocoder.yudao.module.system.service.worklog.dto.LogReadUserRespDTO;
|
import cn.iocoder.yudao.module.system.service.worklog.dto.LogReadUserRespDTO;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
@ -15,6 +17,7 @@ import java.util.Map;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
|
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
|
||||||
|
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 日志查看 Service 实现类
|
* 日志查看 Service 实现类
|
||||||
@ -28,12 +31,15 @@ public class LogReadServiceImpl implements LogReadService{
|
|||||||
@Resource
|
@Resource
|
||||||
private LogReadMapper logReadMapper;
|
private LogReadMapper logReadMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private DeptMapper deptMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createLogRule(List<LogReadUserRespDTO> createReqVO, Long logInstanceId, Long startUserId) {
|
public void createLogRule(List<LogReadUserRespDTO> createReqVO, Long logInstanceId, Long startUserId) {
|
||||||
|
|
||||||
List<LogReadDo> userInfoList = createReqVO.stream()
|
List<LogReadDO> userInfoList = createReqVO.stream()
|
||||||
.map(user -> {
|
.map(user -> {
|
||||||
LogReadDo logReadDo = new LogReadDo();
|
LogReadDO logReadDo = new LogReadDO();
|
||||||
logReadDo.setLogInstanceId(logInstanceId);
|
logReadDo.setLogInstanceId(logInstanceId);
|
||||||
logReadDo.setStartUserId(startUserId);
|
logReadDo.setStartUserId(startUserId);
|
||||||
logReadDo.setReadUserDept(user.getDeptId());
|
logReadDo.setReadUserDept(user.getDeptId());
|
||||||
@ -52,11 +58,11 @@ public class LogReadServiceImpl implements LogReadService{
|
|||||||
|
|
||||||
Map<Integer, List<Long>> readDoMap = new HashMap<>();
|
Map<Integer, List<Long>> readDoMap = new HashMap<>();
|
||||||
|
|
||||||
List<LogReadDo> UnReadDos = logReadMapper.selectUserByLogId(logId, 0);
|
List<LogReadDO> UnReadDos = logReadMapper.selectUserByLogId(logId, 0);
|
||||||
List<LogReadDo> readDos = logReadMapper.selectUserByLogId(logId, 1);
|
List<LogReadDO> readDos = logReadMapper.selectUserByLogId(logId, 1);
|
||||||
|
|
||||||
readDoMap.put(0, convertList(UnReadDos, LogReadDo::getReadUserId));
|
readDoMap.put(0, convertList(UnReadDos, LogReadDO::getReadUserId));
|
||||||
readDoMap.put(1, convertList(readDos, LogReadDo::getReadUserId));
|
readDoMap.put(1, convertList(readDos, LogReadDO::getReadUserId));
|
||||||
|
|
||||||
return readDoMap;
|
return readDoMap;
|
||||||
}
|
}
|
||||||
@ -68,9 +74,9 @@ public class LogReadServiceImpl implements LogReadService{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<LogReadDo> getReadListByReadUserId(Long userId) {
|
public List<LogReadDO> getReadListByReadUserId(Long userId) {
|
||||||
|
|
||||||
QueryWrapper<LogReadDo> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<LogReadDO> queryWrapper = new QueryWrapper<>();
|
||||||
queryWrapper.select("DISTINCT start_user_id");
|
queryWrapper.select("DISTINCT start_user_id");
|
||||||
queryWrapper.eq("read_user_id", userId);
|
queryWrapper.eq("read_user_id", userId);
|
||||||
|
|
||||||
@ -80,9 +86,9 @@ public class LogReadServiceImpl implements LogReadService{
|
|||||||
@Override
|
@Override
|
||||||
public Boolean isReadByLogId(Long logId) {
|
public Boolean isReadByLogId(Long logId) {
|
||||||
|
|
||||||
Long count = logReadMapper.selectCount(new LambdaQueryWrapperX<LogReadDo>()
|
Long count = logReadMapper.selectCount(new LambdaQueryWrapperX<LogReadDO>()
|
||||||
.eq(LogReadDo::getLogInstanceId, logId)
|
.eq(LogReadDO::getLogInstanceId, logId)
|
||||||
.eq(LogReadDo::getReadStatus, 1));
|
.eq(LogReadDO::getReadStatus, 1));
|
||||||
|
|
||||||
return count > 0L;
|
return count > 0L;
|
||||||
}
|
}
|
||||||
@ -90,16 +96,22 @@ public class LogReadServiceImpl implements LogReadService{
|
|||||||
@Override
|
@Override
|
||||||
public Long getUnRead(Long userId) {
|
public Long getUnRead(Long userId) {
|
||||||
|
|
||||||
return logReadMapper.selectCount(new LambdaQueryWrapperX<LogReadDo>()
|
return logReadMapper.selectCount(new LambdaQueryWrapperX<LogReadDO>()
|
||||||
.eq(LogReadDo::getReadUserId, userId)
|
.eq(LogReadDO::getReadUserId, userId)
|
||||||
.eq(LogReadDo::getReadStatus, 0));
|
.eq(LogReadDO::getReadStatus, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setRead(Long loginUserId) {
|
public void setRead(Long loginUserId) {
|
||||||
|
|
||||||
logReadMapper.update(new LogReadDo().setReadStatus(1), new LambdaQueryWrapperX<LogReadDo>()
|
logReadMapper.update(new LogReadDO().setReadStatus(1), new LambdaQueryWrapperX<LogReadDO>()
|
||||||
.eq(LogReadDo::getReadUserId, loginUserId)
|
.eq(LogReadDO::getReadUserId, loginUserId)
|
||||||
.eq(LogReadDo::getReadStatus, 0));
|
.eq(LogReadDO::getReadStatus, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<LogInstanceDeptUnReadCountVO> getDeptUnReadCount(List<Long> deptIds) {
|
||||||
|
|
||||||
|
return logReadMapper.selectDeptUnReadCount(getLoginUserId(), deptIds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -67,4 +67,11 @@ public interface LogUseService {
|
|||||||
* 获取需要填写日志的部门列表
|
* 获取需要填写日志的部门列表
|
||||||
*/
|
*/
|
||||||
List<Long> getUseDeptList();
|
List<Long> getUseDeptList();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取部门对应的模板编号
|
||||||
|
* @param deptIds 部门编号列表
|
||||||
|
* @return 模版列表
|
||||||
|
*/
|
||||||
|
List<Long> getFormIdList(List<Long> deptIds);
|
||||||
}
|
}
|
@ -104,4 +104,11 @@ public class LogUseServiceImpl implements LogUseService {
|
|||||||
List<LogUseDO> logUseDOS = logUseMapper.selectList(queryWrapper);
|
List<LogUseDO> logUseDOS = logUseMapper.selectList(queryWrapper);
|
||||||
return convertList(logUseDOS, LogUseDO::getUseUserDept);
|
return convertList(logUseDOS, LogUseDO::getUseUserDept);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Long> getFormIdList(List<Long> deptIds) {
|
||||||
|
|
||||||
|
List<LogUseDO> logUseDOS = logUseMapper.selectList(LogUseDO::getUseUserDept, deptIds);
|
||||||
|
return logUseDOS.stream().map(LogUseDO::getFormId).distinct().collect(Collectors.toList());
|
||||||
|
}
|
||||||
}
|
}
|
@ -0,0 +1,38 @@
|
|||||||
|
<?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="cn.iocoder.yudao.module.system.dal.mysql.worklog.LogReadMapper">
|
||||||
|
|
||||||
|
<!--
|
||||||
|
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||||
|
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||||
|
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||||
|
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||||
|
-->
|
||||||
|
|
||||||
|
<select id="selectDeptUnReadCount" resultType="cn.iocoder.yudao.module.system.controller.admin.worklog.vo.loginstance.LogInstanceDeptUnReadCountVO">
|
||||||
|
SELECT
|
||||||
|
d.id AS deptId,
|
||||||
|
d.name AS deptName,
|
||||||
|
COUNT(log.id) AS unReadCount
|
||||||
|
FROM
|
||||||
|
system_dept d
|
||||||
|
INNER JOIN
|
||||||
|
system_users u ON
|
||||||
|
d.id = u.dept_id
|
||||||
|
LEFT JOIN
|
||||||
|
work_log_read log ON
|
||||||
|
log.start_user_id = u.id
|
||||||
|
AND log.read_status = 0
|
||||||
|
AND log.deleted = 0
|
||||||
|
AND log.read_user_id = #{userId}
|
||||||
|
WHERE
|
||||||
|
d.id IN
|
||||||
|
<foreach item="deptId" collection="deptIds" separator="," open="(" close=")" index="">
|
||||||
|
#{deptId}
|
||||||
|
</foreach>
|
||||||
|
AND d.deleted = 0
|
||||||
|
AND u.deleted = 0
|
||||||
|
GROUP BY
|
||||||
|
d.id
|
||||||
|
</select>
|
||||||
|
</mapper>
|
Loading…
Reference in New Issue
Block a user