diff --git a/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java index a65e857f..259cc549 100644 --- a/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java +++ b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java @@ -223,5 +223,8 @@ public interface ErrorCodeConstants { ErrorCode THE_CORRESPONDING_ASSET_TYPE_WAS_NOT_FOUND = new ErrorCode(1_010_001_006, "未找到对应的资产类型!"); + // ========== 考勤设备相关 1-011-001-001 ========== + ErrorCode USERS_EXT_NOT_EXISTS = new ErrorCode(1_011_001_001, "用户信息不存在"); + ErrorCode ATTENDANCE_MACHINE_NOT_EXISTS = new ErrorCode(1_011_002_001, "设备不存在"); } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/equipment/AttendanceMachineController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/equipment/AttendanceMachineController.java new file mode 100644 index 00000000..cfd21707 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/equipment/AttendanceMachineController.java @@ -0,0 +1,94 @@ +package cn.iocoder.yudao.module.system.controller.admin.equipment; + +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; +import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; +import cn.iocoder.yudao.module.system.controller.admin.equipment.vo.attendancemachine.AttendanceMachinePageReqVO; +import cn.iocoder.yudao.module.system.controller.admin.equipment.vo.attendancemachine.AttendanceMachineRespVO; +import cn.iocoder.yudao.module.system.controller.admin.equipment.vo.attendancemachine.AttendanceMachineSaveReqVO; +import cn.iocoder.yudao.module.system.dal.dataobject.equipment.AttendanceMachineDO; +import cn.iocoder.yudao.module.system.service.equipment.AttendanceMachineService; +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.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; +import java.io.IOException; +import java.util.List; + +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; +import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; + + +@Tag(name = "管理后台 - 考勤设备") +@RestController +@RequestMapping("/system/attendance-machine") +@Validated +public class AttendanceMachineController { + + @Resource + private AttendanceMachineService attendanceMachineService; + + @PostMapping("/create") + @Operation(summary = "创建考勤设备") + @PreAuthorize("@ss.hasPermission('system:attendance-machine:create')") + public CommonResult createAttendanceMachine(@Valid @RequestBody AttendanceMachineSaveReqVO createReqVO) { + return success(attendanceMachineService.createAttendanceMachine(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新考勤设备") + @PreAuthorize("@ss.hasPermission('system:attendance-machine:update')") + public CommonResult updateAttendanceMachine(@Valid @RequestBody AttendanceMachineSaveReqVO updateReqVO) { + attendanceMachineService.updateAttendanceMachine(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除考勤设备") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('system:attendance-machine:delete')") + public CommonResult deleteAttendanceMachine(@RequestParam("id") Long id) { + attendanceMachineService.deleteAttendanceMachine(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得考勤设备") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('system:attendance-machine:query')") + public CommonResult getAttendanceMachine(@RequestParam("id") Long id) { + AttendanceMachineDO attendanceMachine = attendanceMachineService.getAttendanceMachine(id); + return success(BeanUtils.toBean(attendanceMachine, AttendanceMachineRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得考勤设备分页") + @PreAuthorize("@ss.hasPermission('system:attendance-machine:query')") + public CommonResult> getAttendanceMachinePage(@Valid AttendanceMachinePageReqVO pageReqVO) { + PageResult pageResult = attendanceMachineService.getAttendanceMachinePage(pageReqVO); + return success(BeanUtils.toBean(pageResult, AttendanceMachineRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出考勤设备 Excel") + @PreAuthorize("@ss.hasPermission('system:attendance-machine:export')") + @OperateLog(type = EXPORT) + public void exportAttendanceMachineExcel(@Valid AttendanceMachinePageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = attendanceMachineService.getAttendanceMachinePage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "考勤设备.xls", "数据", AttendanceMachineRespVO.class, + BeanUtils.toBean(list, AttendanceMachineRespVO.class)); + } + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/equipment/UsersExtController.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/equipment/UsersExtController.java new file mode 100644 index 00000000..518b4c4b --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/equipment/UsersExtController.java @@ -0,0 +1,129 @@ +package cn.iocoder.yudao.module.system.controller.admin.equipment; + +import cn.hutool.core.collection.CollUtil; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; +import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; +import cn.iocoder.yudao.module.system.controller.admin.equipment.vo.attendancemachine.AttendanceMachineRespVO; +import cn.iocoder.yudao.module.system.controller.admin.equipment.vo.userExt.UsersExtPageReqVO; +import cn.iocoder.yudao.module.system.controller.admin.equipment.vo.userExt.UsersExtRespVO; +import cn.iocoder.yudao.module.system.controller.admin.equipment.vo.userExt.UsersExtSaveReqVO; +import cn.iocoder.yudao.module.system.convert.equipment.UsersExtConvert; +import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO; +import cn.iocoder.yudao.module.system.dal.dataobject.equipment.AttendanceMachineDO; +import cn.iocoder.yudao.module.system.dal.dataobject.equipment.UsersExtDO; +import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO; +import cn.iocoder.yudao.module.system.service.dept.DeptService; +import cn.iocoder.yudao.module.system.service.equipment.AttendanceMachineService; +import cn.iocoder.yudao.module.system.service.equipment.UsersExtService; +import cn.iocoder.yudao.module.system.service.user.AdminUserService; +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.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +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.operatelog.core.enums.OperateTypeEnum.EXPORT; + + + +@Tag(name = "管理后台 - 用户信息拓展") +@RestController +@RequestMapping("/system/users-ext") +@Validated +public class UsersExtController { + + @Resource + private UsersExtService usersExtService; + + @Resource + private AdminUserService userService; + + @Resource + private DeptService deptService; + + @Resource + private AttendanceMachineService attendanceMachineService; + + @PostMapping("/create") + @Operation(summary = "上传照片") + @PreAuthorize("@ss.hasPermission('system:users-ext:create')") + public CommonResult createUsersExt(@Valid @RequestBody UsersExtSaveReqVO createReqVO) { + return success(usersExtService.createUsersExt(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "删除用户已下发的设备") + @PreAuthorize("@ss.hasPermission('system:users-ext:update')") + public CommonResult updateUsersExt(@Valid @RequestBody UsersExtSaveReqVO updateReqVO) { + usersExtService.updateUsersExt(updateReqVO); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得用户下发设备详情") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('system:users-ext:query')") + public CommonResult> getAttendanceMachine(@RequestParam("id") Long id) { + + UsersExtDO usersExt = usersExtService.getUsersExt(id); + + // 获得用户已下发的设备列表 + List attendanceMachineDO = attendanceMachineService.getAttendanceMachineByDeviceNo(usersExt.getAttendanceMachineNos()); + + // 获得部门信息Map + Map deptDOMap = deptService.getDeptMap(convertList(attendanceMachineDO, AttendanceMachineDO::getDeptId)); + + List respVOS = BeanUtils.toBean(attendanceMachineDO, AttendanceMachineRespVO.class); + + return success(CollectionUtils.convertList(respVOS, respVO -> respVO.setDeptName(deptDOMap.get(respVO.getDeptId()).getName()))); + } + + @GetMapping("/page") + @Operation(summary = "获得用户信息拓展分页") + @PreAuthorize("@ss.hasPermission('system:users-ext:query')") + public CommonResult> getUsersExtPage(@Valid UsersExtPageReqVO pageReqVO) { + + PageResult pageResult = usersExtService.getUsersExtPage(pageReqVO); + if (!CollUtil.isEmpty(pageResult.getList())) { + + //获得用户Map + Map userMap = userService.getUserMap(convertList(pageResult.getList(), UsersExtDO::getUserId)); + //获得部门Map + Map deptMap = deptService.getDeptMap(convertList(pageResult.getList(), UsersExtDO::getDeptId)); + + return success(new PageResult<>(UsersExtConvert.INSTANCE.convertList(pageResult.getList(), userMap, deptMap) + , pageResult.getTotal())); + } + + return success(BeanUtils.toBean(pageResult, UsersExtRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出用户信息拓展 Excel") + @PreAuthorize("@ss.hasPermission('system:users-ext:export')") + @OperateLog(type = EXPORT) + public void exportUsersExtExcel(@Valid UsersExtPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = usersExtService.getUsersExtPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "用户信息拓展.xls", "数据", UsersExtRespVO.class, + BeanUtils.toBean(list, UsersExtRespVO.class)); + } + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/equipment/vo/attendancemachine/AttendanceMachinePageReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/equipment/vo/attendancemachine/AttendanceMachinePageReqVO.java new file mode 100644 index 00000000..b6fe05fc --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/equipment/vo/attendancemachine/AttendanceMachinePageReqVO.java @@ -0,0 +1,39 @@ +package cn.iocoder.yudao.module.system.controller.admin.equipment.vo.attendancemachine; + +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; +import org.springframework.format.annotation.DateTimeFormat; + +import java.time.LocalDateTime; + +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 考勤设备分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class AttendanceMachinePageReqVO extends PageParam { + + @Schema(description = "资产编号") + private String assetsNo; + + @Schema(description = "设备号") + private String deviceNo; + + @Schema(description = "所属部门编号", example = "128") + private Long deptId; + + @Schema(description = "设备名称") + private String deviceName; + + @Schema(description = "设备密码") + private String password; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/equipment/vo/attendancemachine/AttendanceMachineRespVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/equipment/vo/attendancemachine/AttendanceMachineRespVO.java new file mode 100644 index 00000000..f0c7f9f4 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/equipment/vo/attendancemachine/AttendanceMachineRespVO.java @@ -0,0 +1,42 @@ +package cn.iocoder.yudao.module.system.controller.admin.equipment.vo.attendancemachine; + +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Schema(description = "管理后台 - 考勤设备 Response VO") +@Data +@ExcelIgnoreUnannotated +public class AttendanceMachineRespVO { + + @Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @ExcelProperty("id") + private Long id; + + @Schema(description = "资产编号", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("资产编号") + private String assetsNo; + + @Schema(description = "设备号", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("设备号") + private String deviceNo; + + @Schema(description = "所属部门编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "128") + private Long deptId; + + @Schema(description = "所属部门名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "研发部") + @ExcelProperty("所属部门名称") + private String deptName; + + @Schema(description = "设备名称", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("设备名称") + private String deviceName; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("创建时间") + private LocalDateTime createTime; + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/equipment/vo/attendancemachine/AttendanceMachineSaveReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/equipment/vo/attendancemachine/AttendanceMachineSaveReqVO.java new file mode 100644 index 00000000..dbcdf448 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/equipment/vo/attendancemachine/AttendanceMachineSaveReqVO.java @@ -0,0 +1,36 @@ +package cn.iocoder.yudao.module.system.controller.admin.equipment.vo.attendancemachine; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; + +@Schema(description = "管理后台 - 考勤设备新增/修改 Request VO") +@Data +public class AttendanceMachineSaveReqVO { + + @Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + private Long id; + + @Schema(description = "资产编号", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "资产编号不能为空") + private String assetsNo; + + @Schema(description = "设备号", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "设备号不能为空") + private String deviceNo; + + @Schema(description = "所属部门编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "128") + @NotNull(message = "所属部门编号不能为空") + private Long deptId; + + @Schema(description = "设备名称", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "设备名称不能为空") + private String deviceName; + + @Schema(description = "设备密码", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "设备密码不能为空") + private String password; + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/equipment/vo/datasynchronousrecord/DataSynchronousRecordPageReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/equipment/vo/datasynchronousrecord/DataSynchronousRecordPageReqVO.java new file mode 100644 index 00000000..f7a1ce2f --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/equipment/vo/datasynchronousrecord/DataSynchronousRecordPageReqVO.java @@ -0,0 +1,33 @@ +package cn.iocoder.yudao.module.system.controller.admin.equipment.vo.datasynchronousrecord; + +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; +import org.springframework.format.annotation.DateTimeFormat; + +import java.time.LocalDateTime; + +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 考勤机数据同步记录分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class DataSynchronousRecordPageReqVO extends PageParam { + + @Schema(description = "设备编号") + private String deviceNo; + + @Schema(description = "用户编号", example = "146") + private Long userId; + + @Schema(description = "下发结果") + private String result; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/equipment/vo/datasynchronousrecord/DataSynchronousRecordRespVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/equipment/vo/datasynchronousrecord/DataSynchronousRecordRespVO.java new file mode 100644 index 00000000..f4b4803d --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/equipment/vo/datasynchronousrecord/DataSynchronousRecordRespVO.java @@ -0,0 +1,35 @@ +package cn.iocoder.yudao.module.system.controller.admin.equipment.vo.datasynchronousrecord; + +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Schema(description = "管理后台 - 考勤机数据同步记录 Response VO") +@Data +@ExcelIgnoreUnannotated +public class DataSynchronousRecordRespVO { + + @Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @ExcelProperty("id") + private Long id; + + @Schema(description = "设备编号", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("设备编号") + private String deviceNo; + + @Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "146") + @ExcelProperty("用户编号") + private Long userId; + + @Schema(description = "下发结果", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("下发结果") + private String result; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("创建时间") + private LocalDateTime createTime; + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/equipment/vo/datasynchronousrecord/DataSynchronousRecordSaveReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/equipment/vo/datasynchronousrecord/DataSynchronousRecordSaveReqVO.java new file mode 100644 index 00000000..49c6ede1 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/equipment/vo/datasynchronousrecord/DataSynchronousRecordSaveReqVO.java @@ -0,0 +1,28 @@ +package cn.iocoder.yudao.module.system.controller.admin.equipment.vo.datasynchronousrecord; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; + +@Schema(description = "管理后台 - 考勤机数据同步记录新增/修改 Request VO") +@Data +public class DataSynchronousRecordSaveReqVO { + + @Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + private Long id; + + @Schema(description = "设备编号", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "设备编号不能为空") + private String deviceNo; + + @Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "146") + @NotNull(message = "用户编号不能为空") + private Long userId; + + @Schema(description = "下发结果", requiredMode = Schema.RequiredMode.REQUIRED) + @NotEmpty(message = "下发结果不能为空") + private String result; + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/equipment/vo/userExt/UsersExtPageReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/equipment/vo/userExt/UsersExtPageReqVO.java new file mode 100644 index 00000000..5d99a2ef --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/equipment/vo/userExt/UsersExtPageReqVO.java @@ -0,0 +1,37 @@ +package cn.iocoder.yudao.module.system.controller.admin.equipment.vo.userExt; + +import lombok.*; +import java.util.*; +import io.swagger.v3.oas.annotations.media.Schema; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import org.springframework.format.annotation.DateTimeFormat; +import java.time.LocalDateTime; + +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 用户信息拓展分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class UsersExtPageReqVO extends PageParam { + + @Schema(description = "用户编号", example = "146") + private List userIds; + + @Schema(description = "用户名称 | 用于模糊检索", example = "146") + private String userName; + + @Schema(description = "部门编号", example = "128") + private Long deptId; + + @Schema(description = "手机号") + private String phoneNumber; + + @Schema(description = "是否录入人脸 | 0:未录入 1:已录入") + private Integer isEnter; + + @Schema(description = "创建时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private LocalDateTime[] createTime; + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/equipment/vo/userExt/UsersExtRespVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/equipment/vo/userExt/UsersExtRespVO.java new file mode 100644 index 00000000..3a657598 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/equipment/vo/userExt/UsersExtRespVO.java @@ -0,0 +1,46 @@ +package cn.iocoder.yudao.module.system.controller.admin.equipment.vo.userExt; + +import cn.iocoder.yudao.module.system.controller.admin.worklog.vo.upload.UploadUserFile; +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; +import java.util.List; + +@Schema(description = "管理后台 - 用户信息拓展 Response VO") +@Data +@ExcelIgnoreUnannotated +public class UsersExtRespVO { + + @Schema(description = "id", example = "1") + @ExcelProperty("id") + private Long id; + + @Schema(description = "用户编号", example = "146") + private Long userId; + + @Schema(description = "用户名称", example = "张三") + @ExcelProperty("用户名称") + private String userName; + + @Schema(description = "部门编号", example = "128") + private Long deptId; + + @Schema(description = "部门名称", example = "研发部") + @ExcelProperty("部门名称") + private String deptName; + + @Schema(description = "人脸图片地址") + @ExcelProperty("人脸图片地址") + private List faceImg; + + @Schema(description = "绑定的考勤机设备号集合") + private List attendanceMachineNos; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("创建时间") + private LocalDateTime createTime; + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/equipment/vo/userExt/UsersExtSaveReqVO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/equipment/vo/userExt/UsersExtSaveReqVO.java new file mode 100644 index 00000000..237bbfdb --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/controller/admin/equipment/vo/userExt/UsersExtSaveReqVO.java @@ -0,0 +1,31 @@ +package cn.iocoder.yudao.module.system.controller.admin.equipment.vo.userExt; + +import cn.iocoder.yudao.module.system.controller.admin.worklog.vo.upload.UploadUserFile; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import javax.validation.constraints.NotNull; +import java.util.List; + +@Schema(description = "管理后台 - 用户信息拓展新增/修改 Request VO") +@Data +public class UsersExtSaveReqVO { + + @Schema(description = "id", example = "1") + private Long id; + + @Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "146") + @NotNull(message = "用户编号不能为空") + private Long userId; + + @Schema(description = "部门编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "128") + @NotNull(message = "部门编号不能为空") + private Long deptId; + + @Schema(description = "人脸图片附件") + private List faceImg; + + @Schema(description = "绑定的考勤机设备号集合") + private List attendanceMachineNos; + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/convert/equipment/UsersExtConvert.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/convert/equipment/UsersExtConvert.java new file mode 100644 index 00000000..50e377c1 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/convert/equipment/UsersExtConvert.java @@ -0,0 +1,39 @@ +package cn.iocoder.yudao.module.system.convert.equipment; + +import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; +import cn.iocoder.yudao.module.system.controller.admin.equipment.vo.userExt.UsersExtRespVO; +import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO; +import cn.iocoder.yudao.module.system.dal.dataobject.equipment.UsersExtDO; +import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +import java.util.List; +import java.util.Map; + +@Mapper +public interface UsersExtConvert { + + UsersExtConvert INSTANCE = Mappers.getMapper(UsersExtConvert.class); + + default List convertList(List list, Map userMap, Map deptMap) { + + return CollectionUtils.convertList(list, user -> convert(user, userMap.get(user.getUserId()), deptMap.get(user.getDeptId()))); + } + + default UsersExtRespVO convert(UsersExtDO usersExtDO, AdminUserDO user, DeptDO dept) { + + UsersExtRespVO userVO = BeanUtils.toBean(usersExtDO, UsersExtRespVO.class); + + if (user != null) { + userVO.setUserName(user.getNickname()); + } + + if (dept != null) { + userVO.setDeptName(dept.getName()); + } + + return userVO; + } +} diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/equipment/AttendanceMachineDO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/equipment/AttendanceMachineDO.java new file mode 100644 index 00000000..e9b4aba2 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/equipment/AttendanceMachineDO.java @@ -0,0 +1,48 @@ +package cn.iocoder.yudao.module.system.dal.dataobject.equipment; + +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.*; + +/** + * 考勤设备 DO + * + * @author 符溶馨 + */ +@TableName("kq_attendance_machine") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class AttendanceMachineDO extends BaseDO { + + /** + * id + */ + @TableId + private Long id; + /** + * 资产编号 + */ + private String assetsNo; + /** + * 设备号 + */ + private String deviceNo; + /** + * 所属部门编号 + */ + private Long deptId; + /** + * 设备名称 + */ + private String deviceName; + /** + * 设备密码 + */ + private String password; + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/equipment/DataSynchronousRecordDO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/equipment/DataSynchronousRecordDO.java new file mode 100644 index 00000000..1cc85353 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/equipment/DataSynchronousRecordDO.java @@ -0,0 +1,40 @@ +package cn.iocoder.yudao.module.system.dal.dataobject.equipment; + +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.*; + +/** + * 考勤机数据同步记录 DO + * + * @author 符溶馨 + */ +@TableName("kq_data_synchronous_record") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class DataSynchronousRecordDO extends BaseDO { + + /** + * id + */ + @TableId + private Long id; + /** + * 设备编号 + */ + private String deviceNo; + /** + * 用户编号 + */ + private Long userId; + /** + * 下发结果 + */ + private String result; + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/equipment/UsersExtDO.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/equipment/UsersExtDO.java new file mode 100644 index 00000000..2c36cc53 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/equipment/UsersExtDO.java @@ -0,0 +1,55 @@ +package cn.iocoder.yudao.module.system.dal.dataobject.equipment; + +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; +import cn.iocoder.yudao.module.system.controller.admin.worklog.vo.upload.UploadUserFile; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; +import lombok.*; + +import java.util.List; + +/** + * 用户信息拓展 DO + * + * @author 符溶馨 + */ +@TableName("system_users_ext") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class UsersExtDO extends BaseDO { + + /** + * id + */ + @TableId + private Long id; + + /** + * 用户编号 + */ + private Long userId; + + /** + * 部门编号 + */ + private Long deptId; + + /** + * 人脸图片附件 + */ + @TableField(typeHandler = JacksonTypeHandler.class) + private List faceImg; + + /** + * 绑定的考勤机设备号集合 + */ + @TableField(typeHandler = JacksonTypeHandler.class) + private List attendanceMachineNos; + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/equipment/AttendanceMachineMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/equipment/AttendanceMachineMapper.java new file mode 100644 index 00000000..b81c1004 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/equipment/AttendanceMachineMapper.java @@ -0,0 +1,29 @@ +package cn.iocoder.yudao.module.system.dal.mysql.equipment; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; +import cn.iocoder.yudao.module.system.controller.admin.equipment.vo.attendancemachine.AttendanceMachinePageReqVO; +import cn.iocoder.yudao.module.system.dal.dataobject.equipment.AttendanceMachineDO; +import org.apache.ibatis.annotations.Mapper; + +/** + * 考勤设备 Mapper + * + * @author 符溶馨 + */ +@Mapper +public interface AttendanceMachineMapper extends BaseMapperX { + + default PageResult selectPage(AttendanceMachinePageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(AttendanceMachineDO::getAssetsNo, reqVO.getAssetsNo()) + .eqIfPresent(AttendanceMachineDO::getDeviceNo, reqVO.getDeviceNo()) + .eqIfPresent(AttendanceMachineDO::getDeptId, reqVO.getDeptId()) + .likeIfPresent(AttendanceMachineDO::getDeviceName, reqVO.getDeviceName()) + .eqIfPresent(AttendanceMachineDO::getPassword, reqVO.getPassword()) + .betweenIfPresent(AttendanceMachineDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(AttendanceMachineDO::getId)); + } + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/equipment/DataSynchronousRecordMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/equipment/DataSynchronousRecordMapper.java new file mode 100644 index 00000000..ce16406d --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/equipment/DataSynchronousRecordMapper.java @@ -0,0 +1,27 @@ +package cn.iocoder.yudao.module.system.dal.mysql.equipment; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; +import cn.iocoder.yudao.module.system.controller.admin.equipment.vo.datasynchronousrecord.DataSynchronousRecordPageReqVO; +import cn.iocoder.yudao.module.system.dal.dataobject.equipment.DataSynchronousRecordDO; +import org.apache.ibatis.annotations.Mapper; + +/** + * 考勤机数据同步记录 Mapper + * + * @author 符溶馨 + */ +@Mapper +public interface DataSynchronousRecordMapper extends BaseMapperX { + + default PageResult selectPage(DataSynchronousRecordPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(DataSynchronousRecordDO::getDeviceNo, reqVO.getDeviceNo()) + .eqIfPresent(DataSynchronousRecordDO::getUserId, reqVO.getUserId()) + .eqIfPresent(DataSynchronousRecordDO::getResult, reqVO.getResult()) + .betweenIfPresent(DataSynchronousRecordDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(DataSynchronousRecordDO::getId)); + } + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/equipment/UsersExtMapper.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/equipment/UsersExtMapper.java new file mode 100644 index 00000000..61ffcc5e --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/equipment/UsersExtMapper.java @@ -0,0 +1,38 @@ +package cn.iocoder.yudao.module.system.dal.mysql.equipment; + + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; +import cn.iocoder.yudao.module.system.controller.admin.equipment.vo.userExt.UsersExtPageReqVO; +import cn.iocoder.yudao.module.system.dal.dataobject.equipment.UsersExtDO; +import org.apache.ibatis.annotations.Mapper; + +/** + * 用户信息拓展 Mapper + * + * @author 符溶馨 + */ +@Mapper +public interface UsersExtMapper extends BaseMapperX { + + default PageResult selectPage(UsersExtPageReqVO reqVO) { + + LambdaQueryWrapperX queryWrapper = new LambdaQueryWrapperX<>(); + + queryWrapper.inIfPresent(UsersExtDO::getUserId, reqVO.getUserIds()) + .eqIfPresent(UsersExtDO::getDeptId, reqVO.getDeptId()) + .betweenIfPresent(UsersExtDO::getCreateTime, reqVO.getCreateTime()); + + if (reqVO.getIsEnter() == 1) { + queryWrapper.isNotNull(UsersExtDO::getFaceImg); + }else if (reqVO.getIsEnter() == 0) { + queryWrapper.isNull(UsersExtDO::getFaceImg); + } + + queryWrapper.orderByDesc(UsersExtDO::getId); + + return selectPage(reqVO, queryWrapper); + } + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/equipment/AttendanceMachineService.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/equipment/AttendanceMachineService.java new file mode 100644 index 00000000..4503b88d --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/equipment/AttendanceMachineService.java @@ -0,0 +1,64 @@ +package cn.iocoder.yudao.module.system.service.equipment; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.system.controller.admin.equipment.vo.attendancemachine.AttendanceMachinePageReqVO; +import cn.iocoder.yudao.module.system.controller.admin.equipment.vo.attendancemachine.AttendanceMachineSaveReqVO; +import cn.iocoder.yudao.module.system.dal.dataobject.equipment.AttendanceMachineDO; + +import javax.validation.Valid; +import java.util.List; + +/** + * 考勤设备 Service 接口 + * + * @author 符溶馨 + */ +public interface AttendanceMachineService { + + /** + * 创建考勤设备 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createAttendanceMachine(@Valid AttendanceMachineSaveReqVO createReqVO); + + /** + * 更新考勤设备 + * + * @param updateReqVO 更新信息 + */ + void updateAttendanceMachine(@Valid AttendanceMachineSaveReqVO updateReqVO); + + /** + * 删除考勤设备 + * + * @param id 编号 + */ + void deleteAttendanceMachine(Long id); + + /** + * 获得考勤设备 + * + * @param id 编号 + * @return 考勤设备 + */ + AttendanceMachineDO getAttendanceMachine(Long id); + + /** + * 获得考勤设备 + * + * @param deviceNo 设备编号 + * @return 考勤设备 + */ + List getAttendanceMachineByDeviceNo(List deviceNo); + + /** + * 获得考勤设备分页 + * + * @param pageReqVO 分页查询 + * @return 考勤设备分页 + */ + PageResult getAttendanceMachinePage(AttendanceMachinePageReqVO pageReqVO); + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/equipment/AttendanceMachineServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/equipment/AttendanceMachineServiceImpl.java new file mode 100644 index 00000000..1c352cd0 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/equipment/AttendanceMachineServiceImpl.java @@ -0,0 +1,81 @@ +package cn.iocoder.yudao.module.system.service.equipment; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; +import cn.iocoder.yudao.module.system.controller.admin.equipment.vo.attendancemachine.AttendanceMachinePageReqVO; +import cn.iocoder.yudao.module.system.controller.admin.equipment.vo.attendancemachine.AttendanceMachineSaveReqVO; +import cn.iocoder.yudao.module.system.dal.dataobject.equipment.AttendanceMachineDO; +import cn.iocoder.yudao.module.system.dal.mysql.equipment.AttendanceMachineMapper; +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; + +import javax.annotation.Resource; + +import java.util.List; + +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.ATTENDANCE_MACHINE_NOT_EXISTS; + +/** + * 考勤设备 Service 实现类 + * + * @author 符溶馨 + */ +@Service +@Validated +public class AttendanceMachineServiceImpl implements AttendanceMachineService { + + @Resource + private AttendanceMachineMapper attendanceMachineMapper; + + @Override + public Long createAttendanceMachine(AttendanceMachineSaveReqVO createReqVO) { + // 插入 + AttendanceMachineDO attendanceMachine = BeanUtils.toBean(createReqVO, AttendanceMachineDO.class); + attendanceMachineMapper.insert(attendanceMachine); + // 返回 + return attendanceMachine.getId(); + } + + @Override + public void updateAttendanceMachine(AttendanceMachineSaveReqVO updateReqVO) { + // 校验存在 + validateAttendanceMachineExists(updateReqVO.getId()); + // 更新 + AttendanceMachineDO updateObj = BeanUtils.toBean(updateReqVO, AttendanceMachineDO.class); + attendanceMachineMapper.updateById(updateObj); + } + + @Override + public void deleteAttendanceMachine(Long id) { + // 校验存在 + validateAttendanceMachineExists(id); + // 删除 + attendanceMachineMapper.deleteById(id); + } + + private void validateAttendanceMachineExists(Long id) { + if (attendanceMachineMapper.selectById(id) == null) { + throw exception(ATTENDANCE_MACHINE_NOT_EXISTS); + } + } + + @Override + public AttendanceMachineDO getAttendanceMachine(Long id) { + + return attendanceMachineMapper.selectById(id); + } + + @Override + public List getAttendanceMachineByDeviceNo(List deviceNo) { + + return attendanceMachineMapper.selectList(AttendanceMachineDO::getDeviceNo, deviceNo); + } + + @Override + public PageResult getAttendanceMachinePage(AttendanceMachinePageReqVO pageReqVO) { + + return attendanceMachineMapper.selectPage(pageReqVO); + } + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/equipment/DataSynchronousRecordService.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/equipment/DataSynchronousRecordService.java new file mode 100644 index 00000000..3a1f605d --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/equipment/DataSynchronousRecordService.java @@ -0,0 +1,41 @@ +package cn.iocoder.yudao.module.system.service.equipment; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.system.controller.admin.equipment.vo.datasynchronousrecord.DataSynchronousRecordPageReqVO; +import cn.iocoder.yudao.module.system.controller.admin.equipment.vo.datasynchronousrecord.DataSynchronousRecordSaveReqVO; +import cn.iocoder.yudao.module.system.dal.dataobject.equipment.DataSynchronousRecordDO; + +import javax.validation.Valid; + +/** + * 考勤机数据同步记录 Service 接口 + * + * @author 符溶馨 + */ +public interface DataSynchronousRecordService { + + /** + * 创建考勤机数据同步记录 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createDataSynchronousRecord(@Valid DataSynchronousRecordSaveReqVO createReqVO); + + /** + * 获得考勤机数据同步记录 + * + * @param id 编号 + * @return 考勤机数据同步记录 + */ + DataSynchronousRecordDO getDataSynchronousRecord(Long id); + + /** + * 获得考勤机数据同步记录分页 + * + * @param pageReqVO 分页查询 + * @return 考勤机数据同步记录分页 + */ + PageResult getDataSynchronousRecordPage(DataSynchronousRecordPageReqVO pageReqVO); + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/equipment/DataSynchronousRecordServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/equipment/DataSynchronousRecordServiceImpl.java new file mode 100644 index 00000000..a52a4056 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/equipment/DataSynchronousRecordServiceImpl.java @@ -0,0 +1,45 @@ +package cn.iocoder.yudao.module.system.service.equipment; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; +import cn.iocoder.yudao.module.system.controller.admin.equipment.vo.datasynchronousrecord.DataSynchronousRecordPageReqVO; +import cn.iocoder.yudao.module.system.controller.admin.equipment.vo.datasynchronousrecord.DataSynchronousRecordSaveReqVO; +import cn.iocoder.yudao.module.system.dal.dataobject.equipment.DataSynchronousRecordDO; +import cn.iocoder.yudao.module.system.dal.mysql.equipment.DataSynchronousRecordMapper; +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; + +import javax.annotation.Resource; + +/** + * 考勤机数据同步记录 Service 实现类 + * + * @author 符溶馨 + */ +@Service +@Validated +public class DataSynchronousRecordServiceImpl implements DataSynchronousRecordService { + + @Resource + private DataSynchronousRecordMapper dataSynchronousRecordMapper; + + @Override + public Long createDataSynchronousRecord(DataSynchronousRecordSaveReqVO createReqVO) { + // 插入 + DataSynchronousRecordDO dataSynchronousRecord = BeanUtils.toBean(createReqVO, DataSynchronousRecordDO.class); + dataSynchronousRecordMapper.insert(dataSynchronousRecord); + // 返回 + return dataSynchronousRecord.getId(); + } + + @Override + public DataSynchronousRecordDO getDataSynchronousRecord(Long id) { + return dataSynchronousRecordMapper.selectById(id); + } + + @Override + public PageResult getDataSynchronousRecordPage(DataSynchronousRecordPageReqVO pageReqVO) { + return dataSynchronousRecordMapper.selectPage(pageReqVO); + } + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/equipment/UsersExtService.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/equipment/UsersExtService.java new file mode 100644 index 00000000..e6b6fbd3 --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/equipment/UsersExtService.java @@ -0,0 +1,48 @@ +package cn.iocoder.yudao.module.system.service.equipment; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.system.controller.admin.equipment.vo.userExt.UsersExtPageReqVO; +import cn.iocoder.yudao.module.system.controller.admin.equipment.vo.userExt.UsersExtSaveReqVO; +import cn.iocoder.yudao.module.system.dal.dataobject.equipment.UsersExtDO; + +import javax.validation.Valid; + +/** + * 用户信息拓展 Service 接口 + * + * @author 符溶馨 + */ +public interface UsersExtService { + + /** + * 创建用户信息拓展 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + Long createUsersExt(@Valid UsersExtSaveReqVO createReqVO); + + /** + * 更新用户信息拓展 + * + * @param updateReqVO 更新信息 + */ + void updateUsersExt(@Valid UsersExtSaveReqVO updateReqVO); + + /** + * 获得用户信息拓展 + * + * @param id 编号 + * @return 用户信息拓展 + */ + UsersExtDO getUsersExt(Long id); + + /** + * 获得用户信息拓展分页 + * + * @param pageReqVO 分页查询 + * @return 用户信息拓展分页 + */ + PageResult getUsersExtPage(UsersExtPageReqVO pageReqVO); + +} \ No newline at end of file diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/equipment/UsersExtServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/equipment/UsersExtServiceImpl.java new file mode 100644 index 00000000..e1753abf --- /dev/null +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/equipment/UsersExtServiceImpl.java @@ -0,0 +1,89 @@ +package cn.iocoder.yudao.module.system.service.equipment; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; +import cn.iocoder.yudao.module.system.controller.admin.equipment.vo.userExt.UsersExtPageReqVO; +import cn.iocoder.yudao.module.system.controller.admin.equipment.vo.userExt.UsersExtSaveReqVO; +import cn.iocoder.yudao.module.system.dal.dataobject.equipment.UsersExtDO; +import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO; +import cn.iocoder.yudao.module.system.dal.mysql.equipment.UsersExtMapper; +import cn.iocoder.yudao.module.system.service.user.AdminUserService; +import org.springframework.context.annotation.Lazy; +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; + +import javax.annotation.Resource; +import java.util.Collections; + +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.module.system.enums.ErrorCodeConstants.USERS_EXT_NOT_EXISTS; + +/** + * 用户信息拓展 Service 实现类 + * + * @author 符溶馨 + */ +@Service +@Validated +public class UsersExtServiceImpl implements UsersExtService { + + @Resource + private UsersExtMapper usersExtMapper; + + @Resource + @Lazy + private AdminUserService userService; + + @Override + public Long createUsersExt(UsersExtSaveReqVO createReqVO) { + + // 插入 + UsersExtDO usersExt = BeanUtils.toBean(createReqVO, UsersExtDO.class); + usersExtMapper.insert(usersExt); + // 返回 + return usersExt.getId(); + } + + @Override + public void updateUsersExt(UsersExtSaveReqVO updateReqVO) { + // 校验存在 + validateUsersExtExists(updateReqVO.getUserId()); + // 更新 + UsersExtDO updateObj = BeanUtils.toBean(updateReqVO, UsersExtDO.class); + + usersExtMapper.updateById(updateObj); + } + + private void validateUsersExtExists(Long userId) { + + if (usersExtMapper.selectOne(UsersExtDO::getUserId, userId) == null) { + throw exception(USERS_EXT_NOT_EXISTS); + } + } + + @Override + public UsersExtDO getUsersExt(Long id) { + return usersExtMapper.selectById(id); + } + + @Override + public PageResult getUsersExtPage(UsersExtPageReqVO pageReqVO) { + + if (pageReqVO.getUserName() != null) { + + pageReqVO.setUserIds(convertList(userService.getUserListByNickname(pageReqVO.getUserName()), AdminUserDO::getId)); + } + + if (pageReqVO.getPhoneNumber() != null) { + + AdminUserDO userDO = userService.getUserByMobile(pageReqVO.getPhoneNumber()); + if (userDO != null) { + + pageReqVO.setUserIds(Collections.singletonList(userDO.getId())); + } + } + + return usersExtMapper.selectPage(pageReqVO); + } +} \ No newline at end of file