人员管理
This commit is contained in:
parent
4572ffd995
commit
323d2c0c39
|
|
@ -54,4 +54,14 @@ public class BraceletParamsDto {
|
|||
* 资源类型
|
||||
*/
|
||||
private String sourceType;
|
||||
|
||||
/**
|
||||
* 资源文件ID
|
||||
*/
|
||||
private Long fileId;
|
||||
|
||||
/**
|
||||
* 文件ID
|
||||
*/
|
||||
private String filePath;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,11 @@
|
|||
package com.bonus.common.entity.bracelet.vo;
|
||||
|
||||
import com.alibaba.fastjson2.annotation.JSONField;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
import org.hibernate.validator.constraints.Range;
|
||||
|
|
@ -8,6 +13,7 @@ import org.hibernate.validator.constraints.Range;
|
|||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Pattern;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
|
|
@ -18,7 +24,7 @@ import java.util.Date;
|
|||
* @description:人员-vo
|
||||
*/
|
||||
@Data
|
||||
public class PersonVo {
|
||||
public class PersonVo implements Serializable {
|
||||
|
||||
/**
|
||||
* id
|
||||
|
|
@ -64,20 +70,24 @@ public class PersonVo {
|
|||
* 创建时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||
private Date createTime = new Date();
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||
private Date updateTime = new Date();
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private Long createUser;
|
||||
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||
private Long createUser = SecurityUtils.getUserId();
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
private Long updateUser;
|
||||
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||
private Long updateUser = SecurityUtils.getUserId();
|
||||
/**
|
||||
* 所属班组ID
|
||||
*/
|
||||
|
|
@ -86,6 +96,7 @@ public class PersonVo {
|
|||
/**
|
||||
* 删除的文件ID
|
||||
*/
|
||||
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||
private String delFiles;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.bonus.common.entity.file;
|
||||
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
|
|
@ -36,13 +37,13 @@ public class ResourceFileVo {
|
|||
private Date createTime = new Date();
|
||||
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private Long createUser;
|
||||
private Long createUser = SecurityUtils.getUserId();
|
||||
|
||||
@ApiModelProperty(value = "修改日期")
|
||||
private Date updateTime = new Date();
|
||||
|
||||
@ApiModelProperty(value = "修改人")
|
||||
private Long updateUser;
|
||||
private Long updateUser = SecurityUtils.getUserId();
|
||||
|
||||
@ApiModelProperty(value = "是否删除")
|
||||
private Integer delFlag = 0;
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ import com.bonus.common.security.interceptor.HeaderInterceptor;
|
|||
public class WebMvcConfig implements WebMvcConfigurer
|
||||
{
|
||||
/** 不需要拦截地址 "/logout",*/
|
||||
public static final String[] excludeUrls = { "/login", "/refresh" };
|
||||
public static final String[] excludeUrls = { "/login", "/refresh","/mongoFile/**" };
|
||||
|
||||
@Override
|
||||
public void addInterceptors(InterceptorRegistry registry)
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ public class PersonMgeController extends BaseController {
|
|||
@Resource(name = "IPersonMgeService")
|
||||
private IPersonMgeService service;
|
||||
|
||||
@RequiresPermissions("basic:person:list")
|
||||
// @RequiresPermissions("basic:person:list")
|
||||
@GetMapping("list")
|
||||
@SysLog(title = "人员管理", businessType = OperaType.QUERY,logType = 0,module = "基础管理->人员管理",details ="查询人员列表")
|
||||
public TableDataInfo list(BraceletParamsDto dto) {
|
||||
|
|
@ -41,14 +41,14 @@ public class PersonMgeController extends BaseController {
|
|||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@RequiresPermissions("basic:person:add")
|
||||
// @RequiresPermissions("basic:person:add")
|
||||
@PostMapping("addPerson")
|
||||
@SysLog(title = "人员管理", businessType = OperaType.INSERT,logType = 0,module = "基础管理->人员管理",details ="新增人员" )
|
||||
public AjaxResult add(HttpServletRequest request, @RequestParam(value = "file", required = false) MultipartFile file, String params) {
|
||||
return service.addPerson(file, params);
|
||||
}
|
||||
|
||||
@RequiresPermissions("basic:person:edit")
|
||||
// @RequiresPermissions("basic:person:edit")
|
||||
@PostMapping("editPerson")
|
||||
@SysLog(title = "人员管理", businessType = OperaType.INSERT,logType = 0,module = "基础管理->人员管理",details ="修改人员" )
|
||||
public AjaxResult editPerson(HttpServletRequest request, @RequestParam(value = "file", required = false) MultipartFile file, String params) {
|
||||
|
|
@ -60,7 +60,7 @@ public class PersonMgeController extends BaseController {
|
|||
return service.getPersonInfo(dto);
|
||||
}
|
||||
|
||||
@RequiresPermissions("basic:person:del")
|
||||
// @RequiresPermissions("basic:person:del")
|
||||
@PostMapping("delPerson")
|
||||
@SysLog(title = "人员管理", businessType = OperaType.INSERT,logType = 0,module = "基础管理->人员管理",details ="删除人员" )
|
||||
public AjaxResult delPerson(@RequestBody BraceletParamsDto dto) {
|
||||
|
|
|
|||
|
|
@ -30,5 +30,5 @@ public interface ResourceFileMapper {
|
|||
* @author cwchen
|
||||
* @date 2024/7/16 15:07
|
||||
*/
|
||||
void delResourceFile(PersonVo vo);
|
||||
void delResourceFile(Long fileId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import com.bonus.common.core.web.domain.AjaxResult;
|
|||
import com.bonus.common.entity.bracelet.BraceletParamsDto;
|
||||
import com.bonus.common.entity.bracelet.vo.PersonVo;
|
||||
import com.bonus.common.entity.file.ResourceFileVo;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import com.bonus.common.security.utils.ValidatorsUtils;
|
||||
import com.bonus.system.api.RemoteFileService;
|
||||
import com.bonus.system.api.domain.SysFile;
|
||||
|
|
@ -102,6 +103,7 @@ public class PersonMgeServiceImpl implements IPersonMgeService {
|
|||
// 对身份证号、手机号 进行 sm4加密 保存人员数据、保存文件资源
|
||||
vo.setIdCard(Sm4Utils.encode(vo.getIdCard()));
|
||||
vo.setPhone(Sm4Utils.encode(vo.getPhone()));
|
||||
// SecurityUtils.getLoginUser()
|
||||
mapper.addPerson(vo);
|
||||
delFileId = uploadFile(file, vo);
|
||||
} catch (Exception e) {
|
||||
|
|
@ -152,7 +154,7 @@ public class PersonMgeServiceImpl implements IPersonMgeService {
|
|||
if (StringUtils.isNotEmpty(vo.getDelFiles())) {
|
||||
String[] delFiles = vo.getDelFiles().split(",");
|
||||
for (String fileId : delFiles) {
|
||||
resourceFileMapper.delResourceFile(vo);
|
||||
resourceFileMapper.delResourceFile(vo.getFileId());
|
||||
remoteFileService.delFile(fileId, SecurityConstants.INNER);
|
||||
}
|
||||
}
|
||||
|
|
@ -188,7 +190,10 @@ public class PersonMgeServiceImpl implements IPersonMgeService {
|
|||
if (dto.getTeamId() != null) {
|
||||
return AjaxResult.error("该人员已分配班组,请先从班组中移除该人员");
|
||||
}
|
||||
// 删除人员、资源文件、人脸照片
|
||||
mapper.delPerson(dto);
|
||||
resourceFileMapper.delResourceFile(dto.getFileId());
|
||||
remoteFileService.delFile(dto.getFilePath(), SecurityConstants.INNER);
|
||||
return AjaxResult.success();
|
||||
} catch (Exception e) {
|
||||
log.error("删除人员", e);
|
||||
|
|
|
|||
|
|
@ -71,6 +71,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<!--查询人员列表-->
|
||||
<select id="getPersonLists" resultType="com.bonus.common.entity.bracelet.vo.PersonVo">
|
||||
SELECT tp.id,
|
||||
tp.name,
|
||||
tp.sex,
|
||||
tp.id_card AS idCard,
|
||||
tp.phone,
|
||||
tp.aqm_code AS aqmCode,
|
||||
|
|
@ -95,6 +97,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<if test="roleCode == 'team'">
|
||||
|
||||
</if>
|
||||
ORDER BY create_time
|
||||
ORDER BY tp.create_time
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -36,6 +36,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</insert>
|
||||
<!--删除资源文件-->
|
||||
<update id="delResourceFile">
|
||||
UPDATE sys_file_source SET del_flag = 1 WHERE id = #{id}
|
||||
UPDATE sys_file_source SET del_flag = 1 WHERE id = #{fileId}
|
||||
</update>
|
||||
</mapper>
|
||||
|
|
@ -4,6 +4,7 @@ package com.bonus.file.controller;
|
|||
import com.bonus.common.core.domain.R;
|
||||
import com.bonus.common.core.utils.BASE64DecodedMultipartFile;
|
||||
import com.bonus.common.entity.file.FileExportVo;
|
||||
import com.bonus.common.security.annotation.InnerAuth;
|
||||
import com.bonus.file.mongodb.service.FileUploadService;
|
||||
import com.bonus.file.mongodb.util.MongodbFileUtil;
|
||||
import com.bonus.system.api.domain.SysFile;
|
||||
|
|
@ -32,6 +33,7 @@ public class MongoFileUploadController {
|
|||
|
||||
@ApiOperation(value = "获取图片base64地址")
|
||||
@PostMapping("getImgBase64")
|
||||
@InnerAuth
|
||||
public R<SysFile> getImgBase64(@RequestBody String fileId){
|
||||
try {
|
||||
SysFile sysFile = new SysFile();
|
||||
|
|
@ -48,6 +50,7 @@ public class MongoFileUploadController {
|
|||
|
||||
@ApiOperation(value = "获取图片base64地址")
|
||||
@PostMapping("getFileBast64")
|
||||
@InnerAuth
|
||||
public R<SysFile> getFileBast64(@RequestBody String fileId){
|
||||
try {
|
||||
SysFile sysFile = new SysFile();
|
||||
|
|
@ -64,6 +67,7 @@ public class MongoFileUploadController {
|
|||
|
||||
@ApiOperation(value = "获取图片base64地址")
|
||||
@PostMapping("getFileByte")
|
||||
@InnerAuth
|
||||
public R<byte[]> getFileByte(@RequestBody String fileId){
|
||||
try {
|
||||
SysFile sysFile = new SysFile();
|
||||
|
|
@ -78,6 +82,7 @@ public class MongoFileUploadController {
|
|||
|
||||
@ApiOperation(value = "单文件上传")
|
||||
@PostMapping("singleUploadFile")
|
||||
@InnerAuth
|
||||
public R singleUploadFile(@RequestParam(value = "file", required = false) MultipartFile file){
|
||||
try {
|
||||
FileExportVo fileExportVo = mongoService.uploadFile(file);
|
||||
|
|
@ -90,6 +95,7 @@ public class MongoFileUploadController {
|
|||
|
||||
@ApiOperation(value = "多文件上传")
|
||||
@PostMapping("mostUploadFile")
|
||||
@InnerAuth
|
||||
public R mostUploadFile(@RequestParam(value = "files", required = false) MultipartFile[] files){
|
||||
try {
|
||||
List<MultipartFile> multipartFiles = Arrays.asList(files);
|
||||
|
|
@ -103,6 +109,7 @@ public class MongoFileUploadController {
|
|||
|
||||
@ApiOperation(value = "文件删除")
|
||||
@PostMapping("delFile")
|
||||
@InnerAuth
|
||||
public R delFile(@RequestBody String fileId){
|
||||
try {
|
||||
mongoService.removeFile(fileId);
|
||||
|
|
@ -115,6 +122,7 @@ public class MongoFileUploadController {
|
|||
|
||||
@ApiOperation(value = "base64上传")
|
||||
@PostMapping("uploadFileByBase64")
|
||||
@InnerAuth
|
||||
public R uploadFileByBase64(@RequestParam(value = "base64", required = false) String base64){
|
||||
try {
|
||||
MultipartFile multipartFile = BASE64DecodedMultipartFile.base64ToMultipart(base64);
|
||||
|
|
|
|||
Loading…
Reference in New Issue