考勤设备管理模块
This commit is contained in:
parent
1632c409a0
commit
d39e08015c
@ -226,5 +226,9 @@ public interface ErrorCodeConstants {
|
||||
// ========== 考勤设备相关 1-011-001-001 ==========
|
||||
ErrorCode USERS_EXT_NOT_EXISTS = new ErrorCode(1_011_001_001, "用户信息不存在");
|
||||
|
||||
ErrorCode USERS_FACE_EXISTS = new ErrorCode(1_011_001_002, "用户人脸图片已存在");
|
||||
|
||||
ErrorCode ATTENDANCE_MACHINE_NOT_EXISTS = new ErrorCode(1_011_002_001, "设备不存在");
|
||||
|
||||
ErrorCode ATTENDANCE_PASSWORD_NOT_EQUAL = new ErrorCode(1_011_002_002, "旧密码错误,请重新输入");
|
||||
}
|
||||
|
@ -1,15 +1,9 @@
|
||||
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.controller.admin.equipment.vo.attendancemachine.*;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.equipment.vo.userExt.UsersExtRespVO;
|
||||
import cn.iocoder.yudao.module.system.service.equipment.AttendanceMachineService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
@ -19,13 +13,9 @@ 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 = "管理后台 - 考勤设备")
|
||||
@ -48,47 +38,57 @@ public class AttendanceMachineController {
|
||||
@Operation(summary = "更新考勤设备")
|
||||
@PreAuthorize("@ss.hasPermission('system:attendance-machine:update')")
|
||||
public CommonResult<Boolean> 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<Boolean> deleteAttendanceMachine(@RequestParam("id") Long id) {
|
||||
attendanceMachineService.deleteAttendanceMachine(id);
|
||||
@PutMapping("/update-password")
|
||||
@Operation(summary = "考勤设备密码修改")
|
||||
@PreAuthorize("@ss.hasPermission('system:attendance-machine:update')")
|
||||
public CommonResult<Boolean> updateAttendanceMachine(@Valid @RequestBody AttendanceMachinePasswordVO updateReqVO) {
|
||||
|
||||
attendanceMachineService.updatePassword(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@PutMapping("/update-user")
|
||||
@Operation(summary = "考勤设备用户下发")
|
||||
@PreAuthorize("@ss.hasPermission('system:attendance-machine:update')")
|
||||
public CommonResult<Boolean> addUserToAttendanceMachine(@Valid @RequestBody AddUserToAttendanceMachineVO addReqVO) {
|
||||
|
||||
attendanceMachineService.addUserToAttendanceMachine(addReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/getUserByDeviceNo")
|
||||
@Operation(summary = "获得设备已下发的用户列表")
|
||||
@PreAuthorize("@ss.hasPermission('system:attendance-machine:query')")
|
||||
public CommonResult<PageResult<UsersExtRespVO>> getUserByDeviceNo(UserExtPageReqVO pageReqVO) {
|
||||
|
||||
PageResult<UsersExtRespVO> userPage = attendanceMachineService.getUserByDeviceNo(pageReqVO);
|
||||
|
||||
return success(userPage);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得考勤设备")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@Parameter(name = "assetsNo", description = "资产编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('system:attendance-machine:query')")
|
||||
public CommonResult<AttendanceMachineRespVO> getAttendanceMachine(@RequestParam("id") Long id) {
|
||||
AttendanceMachineDO attendanceMachine = attendanceMachineService.getAttendanceMachine(id);
|
||||
return success(BeanUtils.toBean(attendanceMachine, AttendanceMachineRespVO.class));
|
||||
public CommonResult<AttendanceMachineRespVO> getAttendanceMachine(@RequestParam("assetsNo") String assetsNo) {
|
||||
|
||||
AttendanceMachineRespVO attendanceMachine = attendanceMachineService.getAttendanceMachine(assetsNo);
|
||||
|
||||
return success(attendanceMachine);
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得考勤设备分页")
|
||||
@PreAuthorize("@ss.hasPermission('system:attendance-machine:query')")
|
||||
public CommonResult<PageResult<AttendanceMachineRespVO>> getAttendanceMachinePage(@Valid AttendanceMachinePageReqVO pageReqVO) {
|
||||
PageResult<AttendanceMachineDO> 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<AttendanceMachineDO> list = attendanceMachineService.getAttendanceMachinePage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "考勤设备.xls", "数据", AttendanceMachineRespVO.class,
|
||||
BeanUtils.toBean(list, AttendanceMachineRespVO.class));
|
||||
}
|
||||
PageResult<AttendanceMachineRespVO> pageResult = attendanceMachineService.getAttendanceMachinePage(pageReqVO);
|
||||
|
||||
return success(pageResult);
|
||||
}
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.equipment;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
@ -9,37 +10,42 @@ 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.UserExtImportVO;
|
||||
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.controller.admin.user.vo.user.UserImportExcelVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserImportRespVO;
|
||||
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.dept.PostDO;
|
||||
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.Parameters;
|
||||
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 org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
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;
|
||||
|
||||
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
|
||||
@Tag(name = "管理后台 - 用户信息拓展")
|
||||
@RestController
|
||||
@ -50,20 +56,27 @@ public class UsersExtController {
|
||||
@Resource
|
||||
private UsersExtService usersExtService;
|
||||
|
||||
@Resource
|
||||
private AdminUserService userService;
|
||||
|
||||
@Resource
|
||||
private DeptService deptService;
|
||||
|
||||
@Resource
|
||||
private AttendanceMachineService attendanceMachineService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@RequestMapping(value = "/create",
|
||||
method = {RequestMethod.POST, RequestMethod.PUT}) // 解决 uni-app 不支持 Put 上传文件的问题)
|
||||
@Operation(summary = "上传照片")
|
||||
@PreAuthorize("@ss.hasPermission('system:users-ext:create')")
|
||||
public CommonResult<Long> createUsersExt(@Valid @RequestBody UsersExtSaveReqVO createReqVO) {
|
||||
return success(usersExtService.createUsersExt(createReqVO));
|
||||
public CommonResult<Long> createUsersExt(@Valid UsersExtSaveReqVO createReqVO) throws Exception {
|
||||
|
||||
if (createReqVO.getFaceFile().isEmpty()) {
|
||||
|
||||
usersExtService.deleteUserFaceImg(getLoginUserId());
|
||||
|
||||
return success(1L);
|
||||
}
|
||||
|
||||
UsersExtDO updateDO = BeanUtils.toBean(createReqVO, UsersExtDO.class);
|
||||
return success(usersExtService.createUsersExt(updateDO, createReqVO.getFaceFile()));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@ -94,19 +107,18 @@ public class UsersExtController {
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得用户信息拓展分页")
|
||||
@Operation(summary = "获得考勤设备用户人脸信息分页")
|
||||
@PreAuthorize("@ss.hasPermission('system:users-ext:query')")
|
||||
public CommonResult<PageResult<UsersExtRespVO>> getUsersExtPage(@Valid UsersExtPageReqVO pageReqVO) {
|
||||
|
||||
PageResult<UsersExtDO> pageResult = usersExtService.getUsersExtPage(pageReqVO);
|
||||
PageResult<UsersExtRespVO> pageResult = usersExtService.getUsersExtPage(pageReqVO);
|
||||
|
||||
if (!CollUtil.isEmpty(pageResult.getList())) {
|
||||
|
||||
//获得用户Map
|
||||
Map<Long, AdminUserDO> userMap = userService.getUserMap(convertList(pageResult.getList(), UsersExtDO::getUserId));
|
||||
//获得部门Map
|
||||
Map<Long, DeptDO> deptMap = deptService.getDeptMap(convertList(pageResult.getList(), UsersExtDO::getDeptId));
|
||||
Map<Long, DeptDO> deptMap = deptService.getDeptMap(convertList(pageResult.getList(), UsersExtRespVO::getDeptId));
|
||||
|
||||
return success(new PageResult<>(UsersExtConvert.INSTANCE.convertList(pageResult.getList(), userMap, deptMap)
|
||||
return success(new PageResult<>(UsersExtConvert.INSTANCE.convertList(pageResult.getList(), deptMap)
|
||||
, pageResult.getTotal()));
|
||||
}
|
||||
|
||||
@ -119,11 +131,41 @@ public class UsersExtController {
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportUsersExtExcel(@Valid UsersExtPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<UsersExtDO> list = usersExtService.getUsersExtPage(pageReqVO).getList();
|
||||
List<UsersExtRespVO> list = usersExtService.getUsersExtPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "用户信息拓展.xls", "数据", UsersExtRespVO.class,
|
||||
BeanUtils.toBean(list, UsersExtRespVO.class));
|
||||
ExcelUtils.write(response, "用户人脸图片.xlsx", "数据", UsersExtRespVO.class,
|
||||
list);
|
||||
}
|
||||
|
||||
@GetMapping("/get-import-template")
|
||||
@Operation(summary = "获得导入用户模板")
|
||||
public void importTemplate(HttpServletResponse response) throws IOException {
|
||||
|
||||
UsersExtPageReqVO pageReqVO = new UsersExtPageReqVO();
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
pageReqVO.setIsEnter(0);
|
||||
|
||||
//获得 所有未录入人脸得用户信息
|
||||
List<UsersExtRespVO> list = usersExtService.getUsersExtPage(pageReqVO).getList();
|
||||
|
||||
// 输出
|
||||
ExcelUtils.write(response, "用户导入.xlsx", "用户列表", UsersExtRespVO.class, list);
|
||||
}
|
||||
|
||||
@PostMapping("/import")
|
||||
@Operation(summary = "导入用户人脸")
|
||||
@Parameters({
|
||||
@Parameter(name = "file", description = "Excel 文件", required = true),
|
||||
@Parameter(name = "updateSupport", description = "是否支持更新,默认为 false", example = "true")
|
||||
})
|
||||
@PreAuthorize("@ss.hasPermission('system:user:import')")
|
||||
public CommonResult<UserImportRespVO> importExcel(@RequestParam("file") MultipartFile file,
|
||||
@RequestParam(value = "updateSupport", required = false, defaultValue = "false") Boolean updateSupport) throws Exception {
|
||||
|
||||
List<UserExtImportVO> list = ExcelUtils.read(file, UserExtImportVO.class);
|
||||
|
||||
return success(usersExtService.importUserList(list, updateSupport));
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.equipment.vo.attendancemachine;
|
||||
|
||||
import cn.iocoder.yudao.module.system.controller.admin.equipment.vo.userExt.UsersExtRespVO;
|
||||
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 AddUserToAttendanceMachineVO {
|
||||
|
||||
@Schema(description = "下发用户列表")
|
||||
@NotNull(message = "下发用户不能为空")
|
||||
private List<UsersExtRespVO> userInfo;
|
||||
|
||||
@Schema(description = "设备号列表", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "设备号不能为空")
|
||||
private List<String> deviceNos;
|
||||
|
||||
@Schema(description = "下发或删除 | 0下发, 1删除")
|
||||
private Integer method;
|
||||
}
|
@ -5,11 +5,6 @@ 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
|
||||
@ -17,23 +12,15 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
|
||||
@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;
|
||||
@Schema(description = "资产类型编号")
|
||||
private Long typeId;
|
||||
|
||||
@Schema(description = "是否在线 | 0否 1是")
|
||||
private Integer isOnLine;
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.equipment.vo.attendancemachine;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Schema(description = "管理后台 - 设备密码修改 Request VO")
|
||||
@Data
|
||||
public class AttendanceMachinePasswordVO {
|
||||
|
||||
@Schema(description = "设备ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@NotNull(message = "设备ID不能为空")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "旧密码", requiredMode = Schema.RequiredMode.REQUIRED, example = "123456")
|
||||
@NotEmpty(message = "旧密码不能为空")
|
||||
@Length(min = 4, max = 16, message = "密码长度为 4-16 位")
|
||||
private String oldPassword;
|
||||
|
||||
@Schema(description = "新密码", requiredMode = Schema.RequiredMode.REQUIRED, example = "654321")
|
||||
@NotEmpty(message = "新密码不能为空")
|
||||
@Length(min = 4, max = 16, message = "密码长度为 4-16 位")
|
||||
private String newPassword;
|
||||
}
|
@ -12,10 +12,13 @@ import java.time.LocalDateTime;
|
||||
@ExcelIgnoreUnannotated
|
||||
public class AttendanceMachineRespVO {
|
||||
|
||||
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@Schema(description = "设备id", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@ExcelProperty("id")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "资产ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long assetsId;
|
||||
|
||||
@Schema(description = "资产编号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("资产编号")
|
||||
private String assetsNo;
|
||||
@ -35,8 +38,4 @@ public class AttendanceMachineRespVO {
|
||||
@ExcelProperty("设备名称")
|
||||
private String deviceName;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -13,24 +13,19 @@ public class AttendanceMachineSaveReqVO {
|
||||
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "资产ID", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private Long assetsId;
|
||||
|
||||
@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;
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
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;
|
||||
|
||||
@Schema(description = "管理后台 - 考勤设备已下发用户列表分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class UserExtPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "设备号")
|
||||
private String deviceNo;
|
||||
|
||||
@Schema(description = "用户名称")
|
||||
private String userName;
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.equipment.vo.userExt;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Accessors(chain = false) // 设置 chain = false,避免用户导入有问题
|
||||
public class UserExtImportVO {
|
||||
|
||||
@ExcelProperty("用户编号")
|
||||
private Long userId;
|
||||
|
||||
@ExcelProperty("用户名称")
|
||||
private String userName;
|
||||
|
||||
@ExcelProperty("人脸图片")
|
||||
private MultipartFile faceFile;
|
||||
|
||||
private String faceImg;
|
||||
}
|
@ -15,15 +15,15 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
|
||||
@ToString(callSuper = true)
|
||||
public class UsersExtPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "用户编号", example = "146")
|
||||
private List<Long> userIds;
|
||||
|
||||
@Schema(description = "用户名称 | 用于模糊检索", example = "146")
|
||||
private String userName;
|
||||
|
||||
@Schema(description = "部门编号", example = "128")
|
||||
private Long deptId;
|
||||
|
||||
@Schema(description = "包括自己的所有子级部门编号", example = "128")
|
||||
private List<Long> deptIds;
|
||||
|
||||
@Schema(description = "手机号")
|
||||
private String phoneNumber;
|
||||
|
||||
|
@ -15,10 +15,10 @@ import java.util.List;
|
||||
public class UsersExtRespVO {
|
||||
|
||||
@Schema(description = "id", example = "1")
|
||||
@ExcelProperty("id")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "用户编号", example = "146")
|
||||
@ExcelProperty("用户编号")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "用户名称", example = "张三")
|
||||
@ -33,14 +33,13 @@ public class UsersExtRespVO {
|
||||
private String deptName;
|
||||
|
||||
@Schema(description = "人脸图片地址")
|
||||
@ExcelProperty("人脸图片地址")
|
||||
private List<UploadUserFile> faceImg;
|
||||
@ExcelProperty("人脸图片")
|
||||
private String faceImg;
|
||||
|
||||
@Schema(description = "绑定的考勤机设备号集合")
|
||||
private List<String> attendanceMachineNos;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -1,8 +1,8 @@
|
||||
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 org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
@ -23,7 +23,7 @@ public class UsersExtSaveReqVO {
|
||||
private Long deptId;
|
||||
|
||||
@Schema(description = "人脸图片附件")
|
||||
private List<UploadUserFile> faceImg;
|
||||
private MultipartFile faceFile;
|
||||
|
||||
@Schema(description = "绑定的考勤机设备号集合")
|
||||
private List<String> attendanceMachineNos;
|
||||
|
@ -17,23 +17,17 @@ public interface UsersExtConvert {
|
||||
|
||||
UsersExtConvert INSTANCE = Mappers.getMapper(UsersExtConvert.class);
|
||||
|
||||
default List<UsersExtRespVO> convertList(List<UsersExtDO> list, Map<Long, AdminUserDO> userMap, Map<Long, DeptDO> deptMap) {
|
||||
default List<UsersExtRespVO> convertList(List<UsersExtRespVO> list, Map<Long, DeptDO> deptMap) {
|
||||
|
||||
return CollectionUtils.convertList(list, user -> convert(user, userMap.get(user.getUserId()), deptMap.get(user.getDeptId())));
|
||||
return CollectionUtils.convertList(list, user -> convert(user, 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());
|
||||
}
|
||||
default UsersExtRespVO convert(UsersExtRespVO usersExtDO, DeptDO dept) {
|
||||
|
||||
if (dept != null) {
|
||||
userVO.setDeptName(dept.getName());
|
||||
usersExtDO.setDeptName(dept.getName());
|
||||
}
|
||||
|
||||
return userVO;
|
||||
return usersExtDO;
|
||||
}
|
||||
}
|
||||
|
@ -24,6 +24,10 @@ public class AttendanceMachineDO extends BaseDO {
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 资产ID
|
||||
*/
|
||||
private Long assetsId;
|
||||
/**
|
||||
* 资产编号
|
||||
*/
|
||||
|
@ -0,0 +1,42 @@
|
||||
package cn.iocoder.yudao.module.system.dal.dataobject.equipment;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
/**
|
||||
* 考勤机下发记录 DO
|
||||
*
|
||||
* @author 符溶馨
|
||||
*/
|
||||
@TableName("kq_distribute_record")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class DistributeRecordDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 设备编号
|
||||
*/
|
||||
private String deviceNo;
|
||||
/**
|
||||
* 用户编号
|
||||
*/
|
||||
private Long userId;
|
||||
/**
|
||||
* 下发结果
|
||||
*/
|
||||
private String result;
|
||||
|
||||
}
|
@ -41,10 +41,9 @@ public class UsersExtDO extends BaseDO {
|
||||
private Long deptId;
|
||||
|
||||
/**
|
||||
* 人脸图片附件
|
||||
* 人脸图片
|
||||
*/
|
||||
@TableField(typeHandler = JacksonTypeHandler.class)
|
||||
private List<UploadUserFile> faceImg;
|
||||
private String faceImg;
|
||||
|
||||
/**
|
||||
* 绑定的考勤机设备号集合
|
||||
|
@ -4,8 +4,13 @@ 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.controller.admin.equipment.vo.attendancemachine.AttendanceMachineRespVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.equipment.vo.attendancemachine.UserExtPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.equipment.vo.userExt.UsersExtRespVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.equipment.AttendanceMachineDO;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 考勤设备 Mapper
|
||||
@ -15,15 +20,9 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
@Mapper
|
||||
public interface AttendanceMachineMapper extends BaseMapperX<AttendanceMachineDO> {
|
||||
|
||||
default PageResult<AttendanceMachineDO> selectPage(AttendanceMachinePageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<AttendanceMachineDO>()
|
||||
.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));
|
||||
}
|
||||
IPage<AttendanceMachineRespVO> selectAttendancePage(@Param("page") IPage<AttendanceMachineRespVO> mpPage, @Param("reqVO") AttendanceMachinePageReqVO pageReqVO);
|
||||
|
||||
AttendanceMachineRespVO selectAttendanceByAssetsNo(@Param("assetsNo") String assetsNo);
|
||||
|
||||
IPage<UsersExtRespVO> selectUserPage(@Param("page") IPage<UsersExtRespVO> mpPage, @Param("reqVO") UserExtPageReqVO pageReqVO);
|
||||
}
|
@ -5,8 +5,14 @@ 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.controller.admin.equipment.vo.userExt.UsersExtRespVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.equipment.UsersExtDO;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 用户信息拓展 Mapper
|
||||
@ -16,23 +22,12 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
@Mapper
|
||||
public interface UsersExtMapper extends BaseMapperX<UsersExtDO> {
|
||||
|
||||
default PageResult<UsersExtDO> selectPage(UsersExtPageReqVO reqVO) {
|
||||
IPage<UsersExtRespVO> selectFacePage(@Param("page") IPage<UsersExtRespVO> mpPage, @Param("reqVO") UsersExtPageReqVO pageReqVO);
|
||||
|
||||
LambdaQueryWrapperX<UsersExtDO> queryWrapper = new LambdaQueryWrapperX<>();
|
||||
default void updateFaceImg(Long id) {
|
||||
|
||||
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);
|
||||
update(null, new LambdaUpdateWrapper<UsersExtDO>()
|
||||
.set(UsersExtDO::getFaceImg, null)
|
||||
.eq(UsersExtDO::getId, id));
|
||||
}
|
||||
|
||||
}
|
@ -67,4 +67,11 @@ public interface AssetsTypeService {
|
||||
* @return
|
||||
*/
|
||||
List<AssetsTypeDO> getAllList();
|
||||
|
||||
/**
|
||||
* 根据资产名称 获得指定资产类型信息
|
||||
* @param name 资产名称
|
||||
* @return 资产类型
|
||||
*/
|
||||
AssetsTypeDO getByName(String name);
|
||||
}
|
@ -67,4 +67,9 @@ public class AssetsTypeServiceImpl implements AssetsTypeService {
|
||||
return assetsTypeMapper.selectList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AssetsTypeDO getByName(String name) {
|
||||
|
||||
return assetsTypeMapper.selectOne(AssetsTypeDO::getName, name);
|
||||
}
|
||||
}
|
@ -162,10 +162,17 @@ public class WorkLogCommentServiceImpl implements WorkLogCommentService {
|
||||
//获得日志详情
|
||||
LogInstanceRespVO instanceDO = logInstanceService.getLogInstance(workLogComment.getWorkLogId());
|
||||
|
||||
//获得 用户信息Map
|
||||
Map<Long, AdminUserDO> userMap = userService.getUserMap(Arrays.asList(instanceDO.getStartUserId(), workLogComment.getUserId()));
|
||||
//获得 userMap
|
||||
Map<Long, AdminUserDO> userMap = userService.getUserMap(Arrays.asList(instanceDO.getStartUserId(), workLogComment.getCommentUserId(), workLogComment.getUserId()));
|
||||
|
||||
String openId = userMap.get(instanceDO.getStartUserId()).getOpenId();
|
||||
String openId = null;
|
||||
if (instanceDO.getType() == 0) {
|
||||
|
||||
openId = userMap.get(instanceDO.getStartUserId()).getOpenId();
|
||||
}else if (instanceDO.getType() == 1) {
|
||||
|
||||
openId = userMap.get(workLogComment.getCommentUserId()).getOpenId();
|
||||
}
|
||||
|
||||
if (openId != null) {
|
||||
|
||||
@ -174,6 +181,5 @@ public class WorkLogCommentServiceImpl implements WorkLogCommentService {
|
||||
openId, workLogComment, userMap.get(workLogComment.getUserId()).getNickname(),
|
||||
"formal"));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -1,8 +1,8 @@
|
||||
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.controller.admin.equipment.vo.attendancemachine.*;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.equipment.vo.userExt.UsersExtRespVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.equipment.AttendanceMachineDO;
|
||||
|
||||
import javax.validation.Valid;
|
||||
@ -31,19 +31,18 @@ public interface AttendanceMachineService {
|
||||
void updateAttendanceMachine(@Valid AttendanceMachineSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除考勤设备
|
||||
*
|
||||
* @param id 编号
|
||||
* 考勤设备密码修改
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void deleteAttendanceMachine(Long id);
|
||||
void updatePassword(AttendanceMachinePasswordVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 获得考勤设备
|
||||
*
|
||||
* @param id 编号
|
||||
* @param assetsNo 资产编号
|
||||
* @return 考勤设备
|
||||
*/
|
||||
AttendanceMachineDO getAttendanceMachine(Long id);
|
||||
AttendanceMachineRespVO getAttendanceMachine(String assetsNo);
|
||||
|
||||
/**
|
||||
* 获得考勤设备
|
||||
@ -59,6 +58,18 @@ public interface AttendanceMachineService {
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 考勤设备分页
|
||||
*/
|
||||
PageResult<AttendanceMachineDO> getAttendanceMachinePage(AttendanceMachinePageReqVO pageReqVO);
|
||||
PageResult<AttendanceMachineRespVO> getAttendanceMachinePage(AttendanceMachinePageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 获得该设备下 已下发的用户列表
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 用户列表
|
||||
*/
|
||||
PageResult<UsersExtRespVO> getUserByDeviceNo(UserExtPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 考勤设备 实时下发用户
|
||||
* @param addReqVO 下发信息
|
||||
*/
|
||||
void addUserToAttendanceMachine(AddUserToAttendanceMachineVO addReqVO);
|
||||
}
|
@ -1,20 +1,35 @@
|
||||
package cn.iocoder.yudao.module.system.service.equipment;
|
||||
|
||||
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.module.system.controller.admin.equipment.vo.attendancemachine.AttendanceMachinePageReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.equipment.vo.attendancemachine.AttendanceMachineSaveReqVO;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.assets.vo.DeptAssetsInOutStockSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.equipment.vo.attendancemachine.*;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.equipment.vo.userExt.UsersExtRespVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.assets.AssetsTypeDO;
|
||||
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.mysql.equipment.AttendanceMachineMapper;
|
||||
import cn.iocoder.yudao.module.system.service.assets.AssetsTypeService;
|
||||
import cn.iocoder.yudao.module.system.service.assets.DeptAssetsInOutStockService;
|
||||
import cn.iocoder.yudao.module.system.service.dept.DeptService;
|
||||
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
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.ATTENDANCE_MACHINE_NOT_EXISTS;
|
||||
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.ATTENDANCE_PASSWORD_NOT_EQUAL;
|
||||
|
||||
/**
|
||||
* 考勤设备 Service 实现类
|
||||
@ -28,6 +43,21 @@ public class AttendanceMachineServiceImpl implements AttendanceMachineService {
|
||||
@Resource
|
||||
private AttendanceMachineMapper attendanceMachineMapper;
|
||||
|
||||
@Resource
|
||||
private AssetsTypeService assetsTypeService;
|
||||
|
||||
@Resource
|
||||
private DeptService deptService;
|
||||
|
||||
@Resource
|
||||
private DeptAssetsInOutStockService deptAssetsInOutStockService;
|
||||
|
||||
@Resource
|
||||
private PasswordEncoder passwordEncoder;
|
||||
|
||||
@Resource
|
||||
private UsersExtService usersExtService;
|
||||
|
||||
@Override
|
||||
public Long createAttendanceMachine(AttendanceMachineSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
@ -38,20 +68,50 @@ public class AttendanceMachineServiceImpl implements AttendanceMachineService {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateAttendanceMachine(AttendanceMachineSaveReqVO updateReqVO) {
|
||||
|
||||
// 校验存在
|
||||
validateAttendanceMachineExists(updateReqVO.getId());
|
||||
|
||||
//如果分配机构的情况, 则调用资产分配方法
|
||||
if (updateReqVO.getId() != null) {
|
||||
|
||||
DeptAssetsInOutStockSaveReqVO vos = new DeptAssetsInOutStockSaveReqVO();
|
||||
vos.setInDeptId(updateReqVO.getDeptId());
|
||||
vos.setAssetsId(updateReqVO.getAssetsId());
|
||||
vos.setNum(1);
|
||||
|
||||
deptAssetsInOutStockService.createDeptAssetsInOutStock(-1L, Collections.singletonList(vos));
|
||||
}
|
||||
|
||||
// 更新
|
||||
AttendanceMachineDO updateObj = BeanUtils.toBean(updateReqVO, AttendanceMachineDO.class);
|
||||
attendanceMachineMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAttendanceMachine(Long id) {
|
||||
// 校验存在
|
||||
validateAttendanceMachineExists(id);
|
||||
// 删除
|
||||
attendanceMachineMapper.deleteById(id);
|
||||
public void updatePassword(AttendanceMachinePasswordVO updateReqVO) {
|
||||
|
||||
//校验 旧密码
|
||||
AttendanceMachineDO attendanceMachineDO = attendanceMachineMapper.selectById(updateReqVO.getId());
|
||||
if (attendanceMachineDO == null) {
|
||||
|
||||
throw exception(ATTENDANCE_MACHINE_NOT_EXISTS);
|
||||
}else {
|
||||
|
||||
if (!passwordEncoder.matches(updateReqVO.getOldPassword(), attendanceMachineDO.getPassword())) {
|
||||
|
||||
throw exception(ATTENDANCE_PASSWORD_NOT_EQUAL);
|
||||
}
|
||||
}
|
||||
|
||||
//更新
|
||||
attendanceMachineDO = new AttendanceMachineDO()
|
||||
.setId(updateReqVO.getId())
|
||||
.setPassword(passwordEncoder.encode(updateReqVO.getNewPassword()));
|
||||
|
||||
attendanceMachineMapper.updateById(attendanceMachineDO);
|
||||
}
|
||||
|
||||
private void validateAttendanceMachineExists(Long id) {
|
||||
@ -61,9 +121,9 @@ public class AttendanceMachineServiceImpl implements AttendanceMachineService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public AttendanceMachineDO getAttendanceMachine(Long id) {
|
||||
public AttendanceMachineRespVO getAttendanceMachine(String assetsNo) {
|
||||
|
||||
return attendanceMachineMapper.selectById(id);
|
||||
return attendanceMachineMapper.selectAttendanceByAssetsNo(assetsNo);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -73,9 +133,71 @@ public class AttendanceMachineServiceImpl implements AttendanceMachineService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<AttendanceMachineDO> getAttendanceMachinePage(AttendanceMachinePageReqVO pageReqVO) {
|
||||
public PageResult<AttendanceMachineRespVO> getAttendanceMachinePage(AttendanceMachinePageReqVO pageReqVO) {
|
||||
|
||||
return attendanceMachineMapper.selectPage(pageReqVO);
|
||||
//获得 设备资产编号
|
||||
AssetsTypeDO assetsTypeDO = assetsTypeService.getByName("考勤设备");
|
||||
if (assetsTypeDO != null) {
|
||||
|
||||
pageReqVO.setTypeId(assetsTypeDO.getId());
|
||||
}
|
||||
|
||||
IPage<AttendanceMachineRespVO> mpPage = MyBatisUtils.buildPage(pageReqVO);
|
||||
IPage<AttendanceMachineRespVO> page = attendanceMachineMapper.selectAttendancePage(mpPage, pageReqVO);
|
||||
|
||||
// 获得部门信息Map
|
||||
Map<Long, DeptDO> deptDOMap = deptService.getDeptMap(convertList(page.getRecords(), AttendanceMachineRespVO::getDeptId));
|
||||
|
||||
return new PageResult<>(
|
||||
CollectionUtils.convertList(page.getRecords(), data -> data.setDeptName(deptDOMap.isEmpty() ? null : deptDOMap.get(data.getDeptId()).getName())),
|
||||
page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<UsersExtRespVO> getUserByDeviceNo(UserExtPageReqVO pageReqVO) {
|
||||
|
||||
IPage<UsersExtRespVO> mpPage = MyBatisUtils.buildPage(pageReqVO);
|
||||
IPage<UsersExtRespVO> page = attendanceMachineMapper.selectUserPage(mpPage, pageReqVO);
|
||||
|
||||
// 获得部门信息Map
|
||||
Map<Long, DeptDO> deptDOMap = deptService.getDeptMap(convertList(page.getRecords(), UsersExtRespVO::getDeptId));
|
||||
|
||||
return new PageResult<>(
|
||||
CollectionUtils.convertList(page.getRecords(), data -> data.setDeptName(deptDOMap.isEmpty() ? null : deptDOMap.get(data.getDeptId()).getName())),
|
||||
page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addUserToAttendanceMachine(AddUserToAttendanceMachineVO addReqVO) {
|
||||
|
||||
// 更新用户已下发设备列表
|
||||
List<UsersExtRespVO> userInfo = addReqVO.getUserInfo();
|
||||
if (addReqVO.getMethod() == 0) {
|
||||
|
||||
userInfo.forEach(data -> {
|
||||
|
||||
List<String> deviceNo = data.getAttendanceMachineNos();
|
||||
// 添加设备号
|
||||
deviceNo.addAll(addReqVO.getDeviceNos());
|
||||
|
||||
//设备 用户绑定设备
|
||||
data.setAttendanceMachineNos(deviceNo);
|
||||
});
|
||||
}else if (addReqVO.getMethod() == 1) {
|
||||
|
||||
userInfo.forEach(data -> {
|
||||
|
||||
List<String> deviceNo = data.getAttendanceMachineNos();
|
||||
// 添加设备号
|
||||
deviceNo.removeAll(addReqVO.getDeviceNos());
|
||||
|
||||
//设备 用户绑定设备
|
||||
data.setAttendanceMachineNos(deviceNo);
|
||||
});
|
||||
}
|
||||
|
||||
// 更新 用户信息
|
||||
usersExtService.updateListUsersExt(userInfo);
|
||||
|
||||
}
|
||||
}
|
@ -1,11 +1,17 @@
|
||||
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.UserExtImportVO;
|
||||
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.controller.admin.user.vo.user.UserImportRespVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.equipment.UsersExtDO;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户信息拓展 Service 接口
|
||||
@ -20,7 +26,7 @@ public interface UsersExtService {
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createUsersExt(@Valid UsersExtSaveReqVO createReqVO);
|
||||
Long createUsersExt(UsersExtDO updateDO, MultipartFile file) throws IOException;
|
||||
|
||||
/**
|
||||
* 更新用户信息拓展
|
||||
@ -29,6 +35,18 @@ public interface UsersExtService {
|
||||
*/
|
||||
void updateUsersExt(@Valid UsersExtSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 批量更新用户 所下发得设备信息
|
||||
*
|
||||
* @param updateDo 更新信息
|
||||
*/
|
||||
void updateListUsersExt(@Valid List<UsersExtRespVO> updateDo);
|
||||
|
||||
/**
|
||||
* 删除用户人脸信息
|
||||
*/
|
||||
void deleteUserFaceImg(Long userId) throws Exception;
|
||||
|
||||
/**
|
||||
* 获得用户信息拓展
|
||||
*
|
||||
@ -43,6 +61,13 @@ public interface UsersExtService {
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 用户信息拓展分页
|
||||
*/
|
||||
PageResult<UsersExtDO> getUsersExtPage(UsersExtPageReqVO pageReqVO);
|
||||
PageResult<UsersExtRespVO> getUsersExtPage(UsersExtPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 用户人脸信息 导入
|
||||
* @param list 人脸信息
|
||||
* @param updateSupport
|
||||
* @return
|
||||
*/
|
||||
UserImportRespVO importUserList(List<UserExtImportVO> list, Boolean updateSupport);
|
||||
}
|
@ -1,23 +1,40 @@
|
||||
package cn.iocoder.yudao.module.system.service.equipment;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils;
|
||||
import cn.iocoder.yudao.module.infra.api.file.FileApi;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.equipment.vo.userExt.UserExtImportVO;
|
||||
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.controller.admin.user.vo.user.UserImportRespVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.worklog.vo.upload.UploadUserFile;
|
||||
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 cn.iocoder.yudao.module.system.dal.mysql.equipment.UsersExtMapper;
|
||||
import cn.iocoder.yudao.module.system.service.dept.DeptService;
|
||||
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collections;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
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;
|
||||
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 用户信息拓展 Service 实现类
|
||||
@ -33,16 +50,57 @@ public class UsersExtServiceImpl implements UsersExtService {
|
||||
|
||||
@Resource
|
||||
@Lazy
|
||||
private DeptService deptService;
|
||||
|
||||
@Resource
|
||||
@Lazy
|
||||
private FileApi fileApi;
|
||||
|
||||
@Resource
|
||||
private AdminUserService userService;
|
||||
|
||||
@Override
|
||||
public Long createUsersExt(UsersExtSaveReqVO createReqVO) {
|
||||
public Long createUsersExt(UsersExtDO updateDO, MultipartFile file) throws IOException {
|
||||
|
||||
String url = null;
|
||||
String name = null;
|
||||
String fileName = file.getOriginalFilename();
|
||||
if (fileName == null || fileName.isEmpty()) {
|
||||
|
||||
name = updateDO.getUserId() + "_faceImg.jpg";
|
||||
}else {
|
||||
|
||||
name = updateDO.getUserId() + "_faceImg." + fileName.split("\\.")[1];
|
||||
}
|
||||
byte[] content = IoUtil.readBytes(file.getInputStream());
|
||||
|
||||
//校验 当前用户人脸信息是否已存在
|
||||
UsersExtDO usersExtDO = usersExtMapper.selectOne(UsersExtDO::getUserId, updateDO.getUserId());
|
||||
if (usersExtDO == null) {
|
||||
|
||||
// 同步 把人脸图片插入 BusinessFile中 存储文件
|
||||
url = fileApi.createBusinessFile(6L, name, content) ;
|
||||
|
||||
updateDO.setFaceImg(url);
|
||||
usersExtMapper.insert(updateDO);
|
||||
|
||||
}else {
|
||||
|
||||
//有人脸图片的情况
|
||||
if (usersExtDO.getFaceImg() != null) {
|
||||
|
||||
// 变更business_file的content字段内容
|
||||
url = fileApi.updateBusinessFileContent(usersExtDO.getFaceImg(), 6L, name, content);
|
||||
|
||||
//更新人脸图片
|
||||
updateDO.setId(usersExtDO.getId());
|
||||
updateDO.setFaceImg(url);
|
||||
usersExtMapper.updateById(usersExtDO);
|
||||
}
|
||||
}
|
||||
|
||||
// 插入
|
||||
UsersExtDO usersExt = BeanUtils.toBean(createReqVO, UsersExtDO.class);
|
||||
usersExtMapper.insert(usersExt);
|
||||
// 返回
|
||||
return usersExt.getId();
|
||||
return updateDO.getUserId();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -55,6 +113,30 @@ public class UsersExtServiceImpl implements UsersExtService {
|
||||
usersExtMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateListUsersExt(List<UsersExtRespVO> updateDo) {
|
||||
|
||||
// 更新
|
||||
List<UsersExtDO> update = BeanUtils.toBean(updateDo, UsersExtDO.class);
|
||||
|
||||
usersExtMapper.updateBatch(update);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteUserFaceImg(Long userId) throws Exception {
|
||||
|
||||
//校验 当前用户人脸信息是否已存在
|
||||
UsersExtDO usersExtDO = usersExtMapper.selectOne(UsersExtDO::getUserId, userId);
|
||||
if (usersExtDO != null) {
|
||||
|
||||
//删除 文件存储器中人脸图片
|
||||
fileApi.deleteBpmFile(usersExtDO.getFaceImg());
|
||||
|
||||
//更新 清空人脸图片信息
|
||||
usersExtMapper.updateFaceImg(usersExtDO.getId());
|
||||
}
|
||||
}
|
||||
|
||||
private void validateUsersExtExists(Long userId) {
|
||||
|
||||
if (usersExtMapper.selectOne(UsersExtDO::getUserId, userId) == null) {
|
||||
@ -68,22 +150,89 @@ public class UsersExtServiceImpl implements UsersExtService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<UsersExtDO> getUsersExtPage(UsersExtPageReqVO pageReqVO) {
|
||||
public PageResult<UsersExtRespVO> getUsersExtPage(UsersExtPageReqVO pageReqVO) {
|
||||
|
||||
if (pageReqVO.getUserName() != null) {
|
||||
if (pageReqVO.getDeptId() != null) {
|
||||
|
||||
pageReqVO.setUserIds(convertList(userService.getUserListByNickname(pageReqVO.getUserName()), AdminUserDO::getId));
|
||||
List<Long> deptIds = convertList(deptService.getChildDeptList(pageReqVO.getDeptId()), DeptDO::getId);
|
||||
deptIds.add(pageReqVO.getDeptId()); // 包括自身
|
||||
|
||||
pageReqVO.setDeptIds(deptIds);
|
||||
}
|
||||
|
||||
if (pageReqVO.getPhoneNumber() != null) {
|
||||
IPage<UsersExtRespVO> mpPage = MyBatisUtils.buildPage(pageReqVO);
|
||||
IPage<UsersExtRespVO> page = usersExtMapper.selectFacePage(mpPage, pageReqVO);
|
||||
|
||||
AdminUserDO userDO = userService.getUserByMobile(pageReqVO.getPhoneNumber());
|
||||
if (userDO != null) {
|
||||
return new PageResult<>(page.getRecords(), page.getTotal());
|
||||
}
|
||||
|
||||
pageReqVO.setUserIds(Collections.singletonList(userDO.getId()));
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class) // 添加事务,异常则回滚所有导入
|
||||
public UserImportRespVO importUserList(List<UserExtImportVO> importUsers, Boolean isUpdateSupport) {
|
||||
|
||||
if (CollUtil.isEmpty(importUsers)) {
|
||||
throw exception(USER_IMPORT_LIST_IS_EMPTY);
|
||||
}
|
||||
|
||||
UserImportRespVO respVO = UserImportRespVO.builder().createUsernames(new ArrayList<>()).updateUsernames(new ArrayList<>()).failureUsernames(new LinkedHashMap<>()).build();
|
||||
|
||||
Map<Long, AdminUserDO> userDOMap = userService.getUserMap(convertList(importUsers, UserExtImportVO::getUserId));
|
||||
|
||||
importUsers.forEach(importUser -> {
|
||||
|
||||
try {
|
||||
//获得 更新信息
|
||||
UsersExtDO updateDO = BeanUtils.toBean(importUser, UsersExtDO.class);
|
||||
//设备部门编号
|
||||
updateDO.setDeptId(userDOMap.get(updateDO.getUserId()).getDeptId());
|
||||
|
||||
String url = null;
|
||||
String name = null;
|
||||
String fileName = importUser.getFaceFile().getOriginalFilename();
|
||||
if (fileName == null || fileName.isEmpty()) {
|
||||
|
||||
name = importUser.getUserId() + "_faceImg.jpg";
|
||||
}else {
|
||||
|
||||
name = importUser.getUserId() + "_faceImg." + fileName.split("\\.")[1];
|
||||
}
|
||||
byte[] content = IoUtil.readBytes(importUser.getFaceFile().getInputStream());
|
||||
|
||||
//校验 当前用户人脸信息是否已存在
|
||||
UsersExtDO usersExtDO = usersExtMapper.selectOne(UsersExtDO::getUserId, importUser.getUserId());
|
||||
if (usersExtDO == null) {
|
||||
|
||||
// 同步 把人脸图片插入 BusinessFile中 存储文件
|
||||
url = fileApi.createBusinessFile(6L, name, content);
|
||||
|
||||
updateDO.setFaceImg(url);
|
||||
usersExtMapper.insert(updateDO);
|
||||
|
||||
respVO.getCreateUsernames().add(importUser.getUserName());
|
||||
}else {
|
||||
|
||||
if (!isUpdateSupport) {
|
||||
|
||||
respVO.getFailureUsernames().put(importUser.getUserName(), USERS_FACE_EXISTS.getMsg());
|
||||
}else {
|
||||
|
||||
// 变更business_file的content字段内容
|
||||
url = fileApi.updateBusinessFileContent(usersExtDO.getFaceImg(), 6L, name, content);
|
||||
|
||||
//更新人脸图片
|
||||
updateDO.setId(usersExtDO.getId());
|
||||
updateDO.setFaceImg(url);
|
||||
usersExtMapper.updateById(updateDO);
|
||||
|
||||
respVO.getUpdateUsernames().add(importUser.getUserName());
|
||||
}
|
||||
}
|
||||
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return usersExtMapper.selectPage(pageReqVO);
|
||||
return respVO;
|
||||
}
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
<?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.equipment.AttendanceMachineMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
<select id="selectAttendancePage" resultType="cn.iocoder.yudao.module.system.controller.admin.equipment.vo.attendancemachine.AttendanceMachineRespVO">
|
||||
SELECT
|
||||
b.id,
|
||||
a.assets_no AS assetsNo,
|
||||
b.device_no AS deviceNo,
|
||||
c.dept_id AS deptId,
|
||||
b.device_name AS deviceName
|
||||
FROM
|
||||
zc_assets a
|
||||
LEFT JOIN kq_attendance_machine b ON a.assets_no = b.assets_no
|
||||
LEFT JOIN zc_dept_assets c ON a.id = c.assets_id
|
||||
WHERE
|
||||
a.deleted = 0
|
||||
AND a.type_id = #{reqVO.typeId}
|
||||
<if test="reqVO.deptId != null">
|
||||
AND c.dept_id = #{reqVO.deptId}
|
||||
</if>
|
||||
<if test="reqVO.deviceName != null and reqVO.deviceName != ''">
|
||||
AND b.device_name LIKE CONCAT('%', #{reqVO.deviceName}, '%')
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="selectAttendanceByAssetsNo" resultType="cn.iocoder.yudao.module.system.controller.admin.equipment.vo.attendancemachine.AttendanceMachineRespVO">
|
||||
SELECT
|
||||
a.assets_id AS assetsId,
|
||||
a.device_no AS deviceNo,
|
||||
b.dept_id AS deptId,
|
||||
a.device_name AS deviceName
|
||||
FROM
|
||||
kq_attendance_machine a,
|
||||
zc_dept_assets b
|
||||
WHERE
|
||||
a.assets_id = b.assets_id
|
||||
AND a.assets_no = #{assetsNo}
|
||||
</select>
|
||||
|
||||
<select id="selectUserPage" resultType="cn.iocoder.yudao.module.system.controller.admin.equipment.vo.userExt.UsersExtRespVO">
|
||||
SELECT
|
||||
a.id AS id,
|
||||
a.user_id AS userId,
|
||||
d.nickname AS userName,
|
||||
b.dept_id AS dpetId,
|
||||
a.face_img AS faceImg,
|
||||
c.create_time AS createTime
|
||||
FROM
|
||||
( system_users_ext a, kq_attendance_machine b )
|
||||
LEFT JOIN kq_distribute_record c ON c.device_no = b.device_no AND c.user_id = a.user_id
|
||||
LEFT JOIN system_users d ON a.user_id = d.id
|
||||
WHERE
|
||||
b.device_no LIKE CONCAT( '%', a.attendance_machine_nos '%' )
|
||||
AND b.device_no = #{reqVO.deviceNo}
|
||||
<if test="reqVO.userName != null and reqVO.userName != ''">
|
||||
AND d.nickname LIKE CONCAT( '%', #{reqVO.userName} '%' )
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
@ -0,0 +1,56 @@
|
||||
<?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.equipment.UsersExtMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
<select id="selectFacePage" resultType="cn.iocoder.yudao.module.system.controller.admin.equipment.vo.userExt.UsersExtRespVO">
|
||||
SELECT
|
||||
b.id,
|
||||
a.id AS userId,
|
||||
a.nickname AS userName,
|
||||
a.dept_id AS dept_id,
|
||||
b.face_img AS faceImg,
|
||||
b.attendance_machine_nos AS attendanceMachineNos,
|
||||
b.create_time AS createTime
|
||||
FROM
|
||||
system_users a
|
||||
LEFT JOIN
|
||||
system_users_ext b ON a.id = b.user_id
|
||||
<where>
|
||||
a.deleted = 0
|
||||
AND a.status = 0
|
||||
<if test="reqVO.userName != null and reqVO.userName != ''">
|
||||
AND a.nickname LIKE CONCAT('%', #{reqVO.userName}, '%')
|
||||
</if>
|
||||
<if test="reqVO.deptIds != null and reqVO.deptIds.size() > 0">
|
||||
AND a.dept_id IN
|
||||
<foreach collection="reqVO.deptIds" item="reqVO.deptIds" open="(" separator="," close=")">
|
||||
#{reqVO.deptIds}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="reqVO.phoneNumber != null">
|
||||
AND a.mobile = #{reqVO.phoneNumber}
|
||||
</if>
|
||||
<if test="reqVO.isEnter == 0">
|
||||
AND ISNULL(b.face_img)
|
||||
</if>
|
||||
<if test="reqVO.isEnter == 1">
|
||||
AND b.face_img IS NOT NULL
|
||||
</if>
|
||||
<if test="reqVO.createTime != null and reqVO.createTime.length > 0">
|
||||
<if test="reqVO.createTime[0] != null">
|
||||
and b.create_time >= #{reqVO.createTime[0]}
|
||||
</if>
|
||||
<if test="reqVO.createTime[1] != null">
|
||||
and b.create_time <= #{reqVO.createTime[1]}
|
||||
</if>
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
Loading…
Reference in New Issue
Block a user