人员管理
This commit is contained in:
parent
794b381c17
commit
0ae3826162
|
|
@ -29,4 +29,13 @@ public class ParamDto {
|
|||
|
||||
@ApiModelProperty(value = "姓名")
|
||||
private String userName;
|
||||
|
||||
@ApiModelProperty(value = "时间")
|
||||
private String time;
|
||||
|
||||
@ApiModelProperty(value = "开始时间")
|
||||
private String startTime;
|
||||
|
||||
@ApiModelProperty(value = "结束时间")
|
||||
private String endTime;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,32 @@
|
|||
package com.securitycontrol.entity.background.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author:cwchen
|
||||
* @date:2024-03-22-9:26
|
||||
* @version:1.0
|
||||
* @description:人员出入记录
|
||||
*/
|
||||
@Data
|
||||
public class UserAccessVo {
|
||||
|
||||
@ApiModelProperty(value = "人员ID")
|
||||
private String userId;
|
||||
|
||||
@ApiModelProperty(value = "人员身份证号码")
|
||||
private String idNumber;
|
||||
|
||||
@ApiModelProperty(value = "出入时间")
|
||||
private String accessTime;
|
||||
|
||||
@ApiModelProperty(value = "出入类型")
|
||||
private String accessType;
|
||||
|
||||
@ApiModelProperty(value = "姓名")
|
||||
private String userName;
|
||||
|
||||
@ApiModelProperty(value = "手机号")
|
||||
private String userPhone;
|
||||
}
|
||||
|
|
@ -4,12 +4,19 @@ import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
|||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
|
||||
import com.securitycontrol.background.export.entity.TeamExportVo;
|
||||
import com.securitycontrol.background.export.entity.TeamUserExportVo;
|
||||
import com.securitycontrol.background.export.entity.UserAccessExportVo;
|
||||
import com.securitycontrol.background.export.util.ExcelStyleUtil;
|
||||
import com.securitycontrol.background.service.HumanService;
|
||||
import com.securitycontrol.background.service.TeamService;
|
||||
import com.securitycontrol.common.core.utils.StringUtils;
|
||||
import com.securitycontrol.common.core.utils.aes.DateTimeHelper;
|
||||
import com.securitycontrol.common.log.annotation.Log;
|
||||
import com.securitycontrol.common.log.enums.OperationType;
|
||||
import com.securitycontrol.entity.background.dto.ParamDto;
|
||||
import com.securitycontrol.entity.background.vo.HumanManageVo;
|
||||
import com.securitycontrol.entity.background.vo.TeamManageVo;
|
||||
import com.securitycontrol.entity.background.vo.UserAccessVo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
|
@ -40,9 +47,12 @@ public class ExportFileController {
|
|||
@Resource(name = "TeamService")
|
||||
private TeamService service;
|
||||
|
||||
@Resource(name = "HumanService")
|
||||
private HumanService humanService;
|
||||
|
||||
@GetMapping("exportTeamData")
|
||||
@Log(title = "人车管理", menu = "人车管理->班组管理", grade = OperationType.EXPORT_BUSINESS, details = "导出班组", type = "业务日志")
|
||||
public void exportData(HttpServletRequest request, HttpServletResponse response, ParamDto dto) {
|
||||
public void exportTeamData(HttpServletRequest request, HttpServletResponse response, ParamDto dto) {
|
||||
try {
|
||||
List<TeamExportVo> teamExportVoList = new ArrayList<>();
|
||||
List<TeamManageVo> teamLists = service.getTeamLists(dto);
|
||||
|
|
@ -65,4 +75,64 @@ public class ExportFileController {
|
|||
log.error("导出班组", e);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("exportTeamUserData")
|
||||
@Log(title = "人车管理", menu = "人车管理->人员管理", grade = OperationType.EXPORT_BUSINESS, details = "导出班组人员", type = "业务日志")
|
||||
public void exportTeamUserData(HttpServletRequest request, HttpServletResponse response, ParamDto dto) {
|
||||
try {
|
||||
List<TeamUserExportVo> teamUserExportVoList = new ArrayList<>();
|
||||
List<HumanManageVo> teamUserLists = humanService.getHumanLists(dto);
|
||||
for (int i = 0; i < teamUserLists.size(); i++) {
|
||||
teamUserLists.get(i).setUserId((i + 1) + "");
|
||||
TeamUserExportVo teamUserExportVo = new TeamUserExportVo();
|
||||
BeanUtils.copyProperties(teamUserLists.get(i), teamUserExportVo);
|
||||
teamUserExportVoList.add(teamUserExportVo);
|
||||
}
|
||||
ExportParams exportParams = new ExportParams("班组人员", "班组人员", ExcelType.XSSF);
|
||||
exportParams.setStyle(ExcelStyleUtil.class);
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, TeamUserExportVo.class, teamUserExportVoList);
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
response.setHeader("content-disposition", "attachment;fileName=" + URLEncoder.encode("班组人员" + ".xlsx", "UTF-8"));
|
||||
ServletOutputStream outputStream = response.getOutputStream();
|
||||
workbook.write(outputStream);
|
||||
outputStream.close();
|
||||
workbook.close();
|
||||
} catch (Exception e) {
|
||||
log.error("导出班组人员", e);
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("exportUserAccessData")
|
||||
@Log(title = "人车管理", menu = "人车管理->人员管理", grade = OperationType.EXPORT_BUSINESS, details = "导出人员进出场记录", type = "业务日志")
|
||||
public void exportUserAccessData(HttpServletRequest request, HttpServletResponse response, ParamDto dto) {
|
||||
try {
|
||||
if(StringUtils.isNotEmpty(dto.getTime())){
|
||||
String[] timeArr = dto.getTime().split(" - ");
|
||||
dto.setStartTime(timeArr[0]);
|
||||
dto.setEndTime(timeArr[1]);
|
||||
}else {
|
||||
dto.setStartTime(DateTimeHelper.getNowDate());
|
||||
dto.setEndTime(DateTimeHelper.getNowDate());
|
||||
}
|
||||
List<UserAccessExportVo> userAccessExportVoList = new ArrayList<>();
|
||||
List<UserAccessVo> userAccessLists = humanService.getPersonnelAccessLists(dto);
|
||||
for (int i = 0; i < userAccessLists.size(); i++) {
|
||||
userAccessLists.get(i).setUserId((i + 1) + "");
|
||||
UserAccessExportVo userAccessExportVo = new UserAccessExportVo();
|
||||
BeanUtils.copyProperties(userAccessLists.get(i), userAccessExportVo);
|
||||
userAccessExportVoList.add(userAccessExportVo);
|
||||
}
|
||||
ExportParams exportParams = new ExportParams("人员进出场记录", "人员进出场记录", ExcelType.XSSF);
|
||||
exportParams.setStyle(ExcelStyleUtil.class);
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, UserAccessExportVo.class, userAccessExportVoList);
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
response.setHeader("content-disposition", "attachment;fileName=" + URLEncoder.encode("人员进出场记录" + ".xlsx", "UTF-8"));
|
||||
ServletOutputStream outputStream = response.getOutputStream();
|
||||
workbook.write(outputStream);
|
||||
outputStream.close();
|
||||
workbook.close();
|
||||
} catch (Exception e) {
|
||||
log.error("导出人员进出场记录", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
package com.securitycontrol.background.controller;
|
||||
|
||||
import com.securitycontrol.background.service.HumanService;
|
||||
import com.securitycontrol.common.core.utils.StringUtils;
|
||||
import com.securitycontrol.common.core.utils.aes.DateTimeHelper;
|
||||
import com.securitycontrol.common.core.web.controller.BaseController;
|
||||
import com.securitycontrol.common.core.web.domain.AjaxResult;
|
||||
import com.securitycontrol.common.core.web.page.TableDataInfo;
|
||||
|
|
@ -8,6 +10,8 @@ import com.securitycontrol.common.log.annotation.Log;
|
|||
import com.securitycontrol.common.log.enums.OperationType;
|
||||
import com.securitycontrol.entity.background.dto.ParamDto;
|
||||
import com.securitycontrol.entity.background.vo.HumanManageVo;
|
||||
import com.securitycontrol.entity.background.vo.UserAccessVo;
|
||||
import com.securitycontrol.entity.system.base.dto.ProDto;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
|
@ -66,4 +70,27 @@ public class HumanManageController extends BaseController {
|
|||
return service.delPersonnelById(dto);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "人员照片预览")
|
||||
@GetMapping("viewPersonnelFile")
|
||||
public AjaxResult viewPersonnelFile(ParamDto dto) {
|
||||
return service.viewPersonnelFile(dto);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取人员出入记录")
|
||||
@GetMapping("getPersonnelAccessLists")
|
||||
@Log(title = "人员管理", menu = "人员管理->人员管理", grade = OperationType.QUERY_BUSINESS, details = "查询人员出入记录", type = "业务日志")
|
||||
public TableDataInfo getPersonnelAccessLists(ParamDto dto) {
|
||||
if(StringUtils.isNotEmpty(dto.getTime())){
|
||||
String[] timeArr = dto.getTime().split(" - ");
|
||||
dto.setStartTime(timeArr[0]);
|
||||
dto.setEndTime(timeArr[1]);
|
||||
}else {
|
||||
dto.setStartTime(DateTimeHelper.getNowDate());
|
||||
dto.setEndTime(DateTimeHelper.getNowDate());
|
||||
}
|
||||
startPage();
|
||||
List<UserAccessVo> list = new ArrayList<>();
|
||||
list = service.getPersonnelAccessLists(dto);
|
||||
return getDataTable(list);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import lombok.Data;
|
|||
public class TeamExportVo {
|
||||
|
||||
@Excel(name = "序号", width = 10.0, orderNum = "0")
|
||||
private String teamId;
|
||||
private String userId;
|
||||
|
||||
@Excel(name = "所属工程", width = 20.0, orderNum = "1")
|
||||
private String proName;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,32 @@
|
|||
package com.securitycontrol.background.export.entity;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author:cwchen
|
||||
* @date:2024-03-22-9:03
|
||||
* @version:1.0
|
||||
* @description:班组人员导出-VO
|
||||
*/
|
||||
@Data
|
||||
public class TeamUserExportVo {
|
||||
|
||||
@Excel(name = "序号", width = 10.0, orderNum = "0")
|
||||
private String userId;
|
||||
|
||||
@Excel(name = "姓名", width = 20.0, orderNum = "1")
|
||||
private String userName;
|
||||
|
||||
@Excel(name = "工种", width = 20.0, orderNum = "2")
|
||||
private String userType;
|
||||
|
||||
@Excel(name = "班组长", width = 20.0, orderNum = "3")
|
||||
private String teamLeader;
|
||||
|
||||
@Excel(name = "班组名称", width = 20.0, orderNum = "4")
|
||||
private String teamName;
|
||||
|
||||
@Excel(name = "所属工程", width = 20.0, orderNum = "5")
|
||||
private String proName;
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
package com.securitycontrol.background.export.entity;
|
||||
|
||||
import cn.afterturn.easypoi.excel.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author:cwchen
|
||||
* @date:2024-03-22-9:26
|
||||
* @version:1.0
|
||||
* @description:人员出入记录
|
||||
*/
|
||||
@Data
|
||||
public class UserAccessExportVo {
|
||||
|
||||
@ApiModelProperty(value = "人员ID")
|
||||
@Excel(name = "序号", width = 10.0, orderNum = "0")
|
||||
private String userId;
|
||||
|
||||
@ApiModelProperty(value = "人员身份证号码")
|
||||
private String idNumber;
|
||||
|
||||
@ApiModelProperty(value = "出入时间")
|
||||
@Excel(name = "出入时间", width = 20.0, orderNum = "2")
|
||||
private String accessTime;
|
||||
|
||||
@ApiModelProperty(value = "出入类型")
|
||||
@Excel(name = "出入类型", width = 20.0, orderNum = "3")
|
||||
private String accessType;
|
||||
|
||||
@ApiModelProperty(value = "姓名")
|
||||
@Excel(name = "姓名", width = 20.0, orderNum = "1")
|
||||
private String userName;
|
||||
|
||||
@ApiModelProperty(value = "手机号")
|
||||
private String userPhone;
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@ package com.securitycontrol.background.mapper;
|
|||
|
||||
import com.securitycontrol.entity.background.dto.ParamDto;
|
||||
import com.securitycontrol.entity.background.vo.HumanManageVo;
|
||||
import com.securitycontrol.entity.background.vo.UserAccessVo;
|
||||
import com.securitycontrol.entity.system.vo.ResourceFileVo;
|
||||
import org.apache.ibatis.annotations.MapKey;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
|
@ -108,6 +109,7 @@ public interface HumanManageMapper {
|
|||
|
||||
/**
|
||||
* 获取人员照片
|
||||
*
|
||||
* @param userId
|
||||
* @return List<ResourceFileVo>
|
||||
* @description
|
||||
|
|
@ -115,4 +117,14 @@ public interface HumanManageMapper {
|
|||
* @date 2024/3/21 20:42
|
||||
*/
|
||||
List<ResourceFileVo> getFiles(String userId);
|
||||
|
||||
/**
|
||||
* 获取人员出入记录
|
||||
* @param dto
|
||||
* @return List<UserAccessVo>
|
||||
* @description
|
||||
* @author cwchen
|
||||
* @date 2024/3/22 9:33
|
||||
*/
|
||||
List<UserAccessVo> getPersonnelAccessLists(ParamDto dto);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.securitycontrol.background.service;
|
|||
import com.securitycontrol.common.core.web.domain.AjaxResult;
|
||||
import com.securitycontrol.entity.background.dto.ParamDto;
|
||||
import com.securitycontrol.entity.background.vo.HumanManageVo;
|
||||
import com.securitycontrol.entity.background.vo.UserAccessVo;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -51,6 +52,7 @@ public interface HumanService {
|
|||
|
||||
/**
|
||||
* 删除人员
|
||||
*
|
||||
* @param dto
|
||||
* @return AjaxResult
|
||||
* @description
|
||||
|
|
@ -58,4 +60,25 @@ public interface HumanService {
|
|||
* @date 2024/3/21 20:35
|
||||
*/
|
||||
AjaxResult delPersonnelById(ParamDto dto);
|
||||
|
||||
/**
|
||||
* 人员图片预览
|
||||
*
|
||||
* @param dto
|
||||
* @return AjaxResult
|
||||
* @description
|
||||
* @author cwchen
|
||||
* @date 2024/3/22 9:18
|
||||
*/
|
||||
AjaxResult viewPersonnelFile(ParamDto dto);
|
||||
|
||||
/**
|
||||
* 获取人员出入记录
|
||||
* @param dto
|
||||
* @return List<UserAccessVo>
|
||||
* @description
|
||||
* @author cwchen
|
||||
* @date 2024/3/22 9:33
|
||||
*/
|
||||
List<UserAccessVo> getPersonnelAccessLists(ParamDto dto);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ import com.securitycontrol.common.core.web.domain.AjaxResult;
|
|||
import com.securitycontrol.common.security.utils.ValidatorsUtils;
|
||||
import com.securitycontrol.entity.background.dto.ParamDto;
|
||||
import com.securitycontrol.entity.background.vo.HumanManageVo;
|
||||
import com.securitycontrol.entity.background.vo.UserAccessVo;
|
||||
import com.securitycontrol.entity.system.vo.ResourceFileVo;
|
||||
import com.securitycontrol.system.api.RemoteFileService;
|
||||
import com.securitycontrol.system.api.domain.SysFile;
|
||||
|
|
@ -207,4 +208,33 @@ public class HumanServiceImpl implements HumanService {
|
|||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult viewPersonnelFile(ParamDto dto) {
|
||||
List<HumanManageVo.FileData> list = new ArrayList<>();
|
||||
List<ResourceFileVo> resourceFileVos = mapper.getFiles(dto.getId());
|
||||
if (CollectionUtils.isNotEmpty(resourceFileVos)) {
|
||||
for (ResourceFileVo fileVo : resourceFileVos) {
|
||||
String base64 = null;
|
||||
Result<SysFile> result = remoteFileService.getImgBase64(fileVo.getFileId(), SecurityConstants.INNER);
|
||||
if (result != null && result.getCode() == HttpStatus.SUCCESS && result.getData() != null) {
|
||||
String jsonString = JSON.toJSONString(result.getData());
|
||||
JSONObject item = JSON.parseObject(jsonString);
|
||||
base64 = item.getString("url");
|
||||
}
|
||||
HumanManageVo.FileData fileData = new HumanManageVo.FileData();
|
||||
fileData.setFileId(fileVo.getFileId());
|
||||
fileData.setBase64Url(base64);
|
||||
list.add(fileData);
|
||||
}
|
||||
}
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<UserAccessVo> getPersonnelAccessLists(ParamDto dto) {
|
||||
List<UserAccessVo> list = new ArrayList<>();
|
||||
list = mapper.getPersonnelAccessLists(dto);
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -124,4 +124,16 @@
|
|||
file_id AS fileId
|
||||
FROM tb_resource_file WHERE source_id = #{userId}
|
||||
</select>
|
||||
<!--获取人员出入记录-->
|
||||
<select id="getPersonnelAccessLists" resultType="com.securitycontrol.entity.background.vo.UserAccessVo">
|
||||
SELECT tua.user_name AS userName,
|
||||
tua.access_time AS accessTime,
|
||||
sd.dict_name AS accessType
|
||||
FROM tb_user_access tua
|
||||
LEFT JOIN sys_dict sd ON tua.access_type = sd.dict_code
|
||||
WHERE user_id = #{id}
|
||||
<if test="startTime!=null and startTime!='' and endTime!=null and endTime!=''">
|
||||
AND tua.access_time BETWEEN CONCAT(#{startTime}, ' 00:00:00') AND CONCAT(#{endTime}, ' 23:59:59')
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
Reference in New Issue