This commit is contained in:
parent
41e88f49fc
commit
794b381c17
|
|
@ -3,6 +3,10 @@ package com.securitycontrol.entity.background.vo;
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import org.hibernate.validator.constraints.Length;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author 10488
|
* @author 10488
|
||||||
|
|
@ -14,18 +18,28 @@ public class HumanManageVo {
|
||||||
private String userId;
|
private String userId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "班组ID")
|
@ApiModelProperty(value = "班组ID")
|
||||||
|
@NotBlank(message = "班组不能为空", groups = {Query.class})
|
||||||
|
@Length(max = 100, message = "班组字符长度不能超过100", groups = {Query.class})
|
||||||
private String teamId;
|
private String teamId;
|
||||||
|
|
||||||
@ApiModelProperty(value = "人员姓名")
|
@ApiModelProperty(value = "人员姓名")
|
||||||
|
@NotBlank(message = "人员姓名不能为空", groups = {Query.class})
|
||||||
|
@Length(max = 30, message = "人员姓名字符长度不能超过30", groups = {Query.class})
|
||||||
private String userName;
|
private String userName;
|
||||||
|
|
||||||
@ApiModelProperty(value = "身份证号码")
|
@ApiModelProperty(value = "身份证号码")
|
||||||
|
@NotBlank(message = "身份证号码不能为空", groups = {Query.class})
|
||||||
|
@Length(max = 100, message = "身份证号码字符长度不能超过100", groups = {Query.class})
|
||||||
private String idNumber;
|
private String idNumber;
|
||||||
|
|
||||||
@ApiModelProperty(value = "手机号码")
|
@ApiModelProperty(value = "手机号码")
|
||||||
|
@NotBlank(message = "手机号码不能为空", groups = {Query.class})
|
||||||
|
@Length(max = 20, message = "手机号码字符长度不能超过100", groups = {Query.class})
|
||||||
private String phone;
|
private String phone;
|
||||||
|
|
||||||
@ApiModelProperty(value = "工种")
|
@ApiModelProperty(value = "工种")
|
||||||
|
@NotBlank(message = "工种不能为空", groups = {Query.class})
|
||||||
|
@Length(max = 30, message = "工种字符长度不能超过30", groups = {Query.class})
|
||||||
private String userType;
|
private String userType;
|
||||||
|
|
||||||
@ApiModelProperty(value = "人员状态")
|
@ApiModelProperty(value = "人员状态")
|
||||||
|
|
@ -51,11 +65,21 @@ public class HumanManageVo {
|
||||||
private String proName;
|
private String proName;
|
||||||
|
|
||||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||||
|
@ApiModelProperty(value = "删除的文件ID")
|
||||||
private String delFiles;
|
private String delFiles;
|
||||||
|
|
||||||
@ApiModelProperty(value = "创建时间")
|
@ApiModelProperty(value = "创建时间")
|
||||||
private String createTime;
|
private String createTime;
|
||||||
|
|
||||||
|
|
||||||
|
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||||
|
private List<HumanManageVo.FileData> fileData;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class FileData{
|
||||||
|
private String fileId;
|
||||||
|
private String base64Url;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 查询条件限制
|
* 查询条件限制
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -53,11 +53,17 @@ public class HumanManageController extends BaseController {
|
||||||
return service.addOrUpdatePersonnel(file, params);
|
return service.addOrUpdatePersonnel(file, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "人员详情")
|
||||||
|
@GetMapping("getPersonnelById")
|
||||||
|
public AjaxResult getPersonnelById(ParamDto dto) {
|
||||||
|
return service.getPersonnelById(dto);
|
||||||
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "删除人员")
|
@ApiOperation(value = "删除人员")
|
||||||
@PostMapping("delHuman")
|
@PostMapping("delPersonnel")
|
||||||
@Log(title = "人员管理", menu = "人车管理->人员管理", grade = OperationType.DELETE_BUSINESS, details = "删除人员", type = "业务日志")
|
@Log(title = "人员管理", menu = "人车管理->人员管理", grade = OperationType.DELETE_BUSINESS, details = "删除人员", type = "业务日志")
|
||||||
public AjaxResult delPro(@RequestBody HumanManageVo dto) {
|
public AjaxResult delPersonnelById(@RequestBody ParamDto dto) {
|
||||||
return service.delHuman(dto);
|
return service.delPersonnelById(dto);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package com.securitycontrol.background.mapper;
|
||||||
import com.securitycontrol.entity.background.dto.ParamDto;
|
import com.securitycontrol.entity.background.dto.ParamDto;
|
||||||
import com.securitycontrol.entity.background.vo.HumanManageVo;
|
import com.securitycontrol.entity.background.vo.HumanManageVo;
|
||||||
import com.securitycontrol.entity.system.vo.ResourceFileVo;
|
import com.securitycontrol.entity.system.vo.ResourceFileVo;
|
||||||
|
import org.apache.ibatis.annotations.MapKey;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
|
@ -74,11 +75,44 @@ public interface HumanManageMapper {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 人员是否存在
|
* 人员是否存在
|
||||||
|
*
|
||||||
* @param vo
|
* @param vo
|
||||||
* @return List<Map < String>>
|
* @return List<Map < String>>
|
||||||
* @description
|
* @description
|
||||||
* @author cwchen
|
* @author cwchen
|
||||||
* @date 2024/3/21 17:53
|
* @date 2024/3/21 17:53
|
||||||
*/
|
*/
|
||||||
|
@MapKey("id")
|
||||||
List<Map<String, String>> userIsExist(HumanManageVo vo);
|
List<Map<String, String>> userIsExist(HumanManageVo vo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除人员
|
||||||
|
*
|
||||||
|
* @param dto
|
||||||
|
* @description
|
||||||
|
* @author cwchen
|
||||||
|
* @date 2024/3/21 20:37
|
||||||
|
*/
|
||||||
|
void delPersonnelById(ParamDto dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 人员详情
|
||||||
|
*
|
||||||
|
* @param dto
|
||||||
|
* @return HumanManageVo
|
||||||
|
* @description
|
||||||
|
* @author cwchen
|
||||||
|
* @date 2024/3/21 20:40
|
||||||
|
*/
|
||||||
|
HumanManageVo getPersonnelById(ParamDto dto);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取人员照片
|
||||||
|
* @param userId
|
||||||
|
* @return List<ResourceFileVo>
|
||||||
|
* @description
|
||||||
|
* @author cwchen
|
||||||
|
* @date 2024/3/21 20:42
|
||||||
|
*/
|
||||||
|
List<ResourceFileVo> getFiles(String userId);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ public interface HumanService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增/修改 用户
|
* 新增/修改 用户
|
||||||
|
*
|
||||||
* @param file
|
* @param file
|
||||||
* @param params
|
* @param params
|
||||||
* @return AjaxResult
|
* @return AjaxResult
|
||||||
|
|
@ -36,13 +37,25 @@ public interface HumanService {
|
||||||
*/
|
*/
|
||||||
AjaxResult addOrUpdatePersonnel(MultipartFile file, String params);
|
AjaxResult addOrUpdatePersonnel(MultipartFile file, String params);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ssss
|
* 人员详情
|
||||||
*
|
*
|
||||||
* @param vo
|
* @param dto
|
||||||
* @return
|
* @return AjaxResult
|
||||||
|
* @description
|
||||||
|
* @author cwchen
|
||||||
|
* @date 2024/3/21 20:34
|
||||||
*/
|
*/
|
||||||
AjaxResult delHuman(HumanManageVo vo);
|
AjaxResult getPersonnelById(ParamDto dto);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除人员
|
||||||
|
* @param dto
|
||||||
|
* @return AjaxResult
|
||||||
|
* @description
|
||||||
|
* @author cwchen
|
||||||
|
* @date 2024/3/21 20:35
|
||||||
|
*/
|
||||||
|
AjaxResult delPersonnelById(ParamDto dto);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ import com.securitycontrol.entity.background.dto.ParamDto;
|
||||||
import com.securitycontrol.entity.background.vo.HumanManageVo;
|
import com.securitycontrol.entity.background.vo.HumanManageVo;
|
||||||
import com.securitycontrol.entity.system.vo.ResourceFileVo;
|
import com.securitycontrol.entity.system.vo.ResourceFileVo;
|
||||||
import com.securitycontrol.system.api.RemoteFileService;
|
import com.securitycontrol.system.api.RemoteFileService;
|
||||||
|
import com.securitycontrol.system.api.domain.SysFile;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
@ -152,16 +153,58 @@ public class HumanServiceImpl implements HumanService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AjaxResult delHuman(HumanManageVo vo) {
|
public AjaxResult getPersonnelById(ParamDto dto) {
|
||||||
try{
|
HumanManageVo vo = new HumanManageVo();
|
||||||
HumanManageVo delvo=new HumanManageVo();
|
vo = mapper.getPersonnelById(dto);
|
||||||
delvo.setUserId(vo.getUserId());
|
String decryptIdNumber = AesCbcUtils.decrypt(vo.getIdNumber());
|
||||||
// delvo.setDelFalge("0");
|
if(decryptIdNumber != null){
|
||||||
mapper.updateHuman(delvo);
|
vo.setIdNumber(decryptIdNumber);
|
||||||
}catch (Exception e){
|
}
|
||||||
|
List<ResourceFileVo> resourceFileVos = mapper.getFiles(vo.getUserId());
|
||||||
|
if (CollectionUtils.isNotEmpty(resourceFileVos)) {
|
||||||
|
List<HumanManageVo.FileData> list = new ArrayList<>();
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
vo.setFileData(list);
|
||||||
|
}
|
||||||
|
return AjaxResult.success(vo);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public AjaxResult delPersonnelById(ParamDto dto) {
|
||||||
|
try {
|
||||||
|
if (StringUtils.isEmpty(dto.getId())) {
|
||||||
|
return AjaxResult.error("参数不完整");
|
||||||
|
}
|
||||||
|
mapper.delPersonnelById(dto);
|
||||||
|
// 查询人员照片
|
||||||
|
List<ResourceFileVo> files = mapper.getFiles(dto.getId());
|
||||||
|
if (CollectionUtils.isNotEmpty(files)) {
|
||||||
|
files.forEach(item -> {
|
||||||
|
mapper.delFile(item.getFileId());
|
||||||
|
remoteFileService.delFile(item.getFileId(), SecurityConstants.INNER);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("删除人员", e);
|
||||||
|
//手动回滚异常
|
||||||
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||||
return AjaxResult.error();
|
return AjaxResult.error();
|
||||||
}
|
}
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -71,11 +71,15 @@
|
||||||
<delete id="delFile">
|
<delete id="delFile">
|
||||||
DELETE FROM tb_resource_file WHERE file_id = #{fileId}
|
DELETE FROM tb_resource_file WHERE file_id = #{fileId}
|
||||||
</delete>
|
</delete>
|
||||||
|
<!--删除人员-->
|
||||||
|
<delete id="delPersonnelById">
|
||||||
|
DELETE FROM t_team_people WHERE user_id = #{id}
|
||||||
|
</delete>
|
||||||
<!--获取人员列表-->
|
<!--获取人员列表-->
|
||||||
<select id="getHumanLists" resultType="com.securitycontrol.entity.background.vo.HumanManageVo">
|
<select id="getHumanLists" resultType="com.securitycontrol.entity.background.vo.HumanManageVo">
|
||||||
SELECT
|
SELECT
|
||||||
ttp.user_id AS userId,
|
ttp.user_id AS userId,
|
||||||
ttp.user_name as userName,
|
ttp.user_name AS userName,
|
||||||
sd.dict_name AS userType,
|
sd.dict_name AS userType,
|
||||||
twt.team_leader AS teamLeader,
|
twt.team_leader AS teamLeader,
|
||||||
twt.team_name AS teamName,
|
twt.team_name AS teamName,
|
||||||
|
|
@ -102,4 +106,22 @@
|
||||||
SELECT user_id AS id,id_number AS value FROM t_team_people WHERE user_id != #{userId}
|
SELECT user_id AS id,id_number AS value FROM t_team_people WHERE user_id != #{userId}
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
<!--人员详情-->
|
||||||
|
<select id="getPersonnelById" resultType="com.securitycontrol.entity.background.vo.HumanManageVo">
|
||||||
|
SELECT
|
||||||
|
ttp.user_id AS userId,
|
||||||
|
ttp.user_name AS userName,
|
||||||
|
ttp.user_type AS userType,
|
||||||
|
ttp.id_number AS idNumber,
|
||||||
|
ttp.phone,
|
||||||
|
ttp.team_id AS teamId
|
||||||
|
FROM t_team_people ttp
|
||||||
|
WHERE ttp.user_id = #{id}
|
||||||
|
</select>
|
||||||
|
<!--获取人员照片-->
|
||||||
|
<select id="getFiles" resultType="com.securitycontrol.entity.system.vo.ResourceFileVo">
|
||||||
|
SELECT id AS resourceId,
|
||||||
|
file_id AS fileId
|
||||||
|
FROM tb_resource_file WHERE source_id = #{userId}
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
Loading…
Reference in New Issue