自测问题修改

This commit is contained in:
cwchen 2024-08-20 08:55:37 +08:00
parent 4ab67cfd6a
commit 1fcf1bba00
8 changed files with 128 additions and 15 deletions

View File

@ -9,6 +9,22 @@ package com.bonus.common.core.constant;
*/
public class BusinessConstants {
/**
* 身份证类型
*/
public static final int SAME_TYPE = 1;
/**
* 手机号
*/
public static final int SAME_TYPE2 = 2;
/**
* 安全帽编号
*/
public static final int SAME_TYPE3 = 3;
/**
* 马甲编号
*/
public static final int SAME_TYPE4 = 4;
public static final int TYPE = 1;
public static final int TYPE2 = 2;
public static final int TYPE3 = 0;
@ -29,7 +45,9 @@ public class BusinessConstants {
public final static String XLS = ".xls";
/** * 杆塔导入 */
/**
* 杆塔导入
*/
public final static String Gt_IMPORT_VO = "GtImportVo";
/**
* 人员导入

View File

@ -88,7 +88,7 @@ public class ImportExcelUtils {
private static boolean checkModal(Sheet sheet, String className) {
int colNum = sheet.getRow(1).getLastCellNum();
if (Objects.equals(className, BusinessConstants.PERSON_IMPORT_VO)) {
return colNum == 7;
return colNum == 9;
}else if(Objects.equals(className, BusinessConstants.Gt_IMPORT_VO)){
return colNum == 4;
}
@ -179,6 +179,14 @@ public class ImportExcelUtils {
// 人员岗位
obj.put("post", row.getCell(BusinessConstants.CELL_6).getStringCellValue());
}
if (row.getCell(BusinessConstants.CELL_7) != null) {
// 安全帽编号
obj.put("aqmCode", row.getCell(BusinessConstants.CELL_7).getStringCellValue());
}
if (row.getCell(BusinessConstants.CELL_8) != null) {
// 安全帽编号
obj.put("mjCode", row.getCell(BusinessConstants.CELL_8).getStringCellValue());
}
return obj;
}

View File

@ -28,12 +28,13 @@ public class PersonExportVo {
@Excel(name = "电话", width = 20.0,height = 15.0,orderNum = "4")
private String phone;
@Excel(name = "安全帽编号", width = 20.0,height = 15.0,orderNum = "5")
@Excel(name = "人员岗位", width = 20.0,height = 15.0,orderNum = "5")
private String post;
@Excel(name = "安全帽编号", width = 20.0,height = 15.0,orderNum = "6")
private String aqmCode;
@Excel(name = "马甲编号", width = 20.0,height = 15.0,orderNum = "6")
@Excel(name = "马甲编号", width = 20.0,height = 15.0,orderNum = "7")
private String mjCode;
@Excel(name = "人员岗位", width = 20.0,height = 15.0,orderNum = "7")
private String post;
}

View File

@ -50,4 +50,12 @@ public class PersonImportVo implements Serializable {
* 岗位
*/
private String post;
/**
* 安全帽编号
*/
private String aqmCode;
/**
* 马甲编号
*/
private String mjCode;
}

View File

@ -245,4 +245,20 @@ public interface PersonMgeMapper {
* @date 2024/8/19 15:08
*/
Integer canItBeModified(PersonVo vo);
/**
* 获取所有已入库的安全帽编号
* @return List<Map<String,String>>
* @author cwchen
* @date 2024/8/19 18:01
*/
List<Map<String, String>> aqmCodeIsExist();
/**
* 获取所有已入库的马甲编号
* @return List<Map<String,String>>
* @author cwchen
* @date 2024/8/19 18:31
*/
List<Map<String, String>> mjCodeIsExist();
}

View File

@ -186,7 +186,7 @@ public class PersonMgeServiceImpl implements IPersonMgeService {
}
// 人员已分配班组岗位限制修改
Integer canItBeModified = mapper.canItBeModified(vo);
if(canItBeModified > 0){
if (canItBeModified > 0) {
return AjaxResult.error("人员已分配班组,岗位已限制修改");
}
// 验证身份证是否重复手机号
@ -311,10 +311,10 @@ public class PersonMgeServiceImpl implements IPersonMgeService {
}
// 判断人员是否领用设备包括手环箱手环安全帽等设备
List<Integer> isLyDevices = mapper.isLyDevices(vo);
if(isLyDevices.get(0) > 0){
if (isLyDevices.get(0) > 0) {
return AjaxResult.error("该人员已绑定手环");
}
if(isLyDevices.get(1) > 0){
if (isLyDevices.get(1) > 0) {
return AjaxResult.error("该人员已绑定设备");
}
// 删除人员资源文件人脸照片
@ -417,19 +417,31 @@ public class PersonMgeServiceImpl implements IPersonMgeService {
}
list.add(personVo);
}
// 校验身份证号电话是否存在相同数据
// 校验身份证号电话安全帽编号马甲编号 是否存在相同数据
List<String> sameList = same(list, 1, "身份证号");
List<String> sameList2 = same(list, 2, "电话");
List<String> sameList3 = same(list, 3, "安全帽编号");
List<String> sameList4 = same(list, 4, "马甲编号");
String existData = isExistData(sameList);
String existData2 = isExistData(sameList2);
String existData3 = isExistData(sameList3);
String existData4 = isExistData(sameList4);
if (StringUtils.isNotBlank(existData)) {
return AjaxResult.error(existData);
}
if (StringUtils.isNotBlank(existData2)) {
return AjaxResult.error(existData2);
}
// 校验库中数据是否重复
if (StringUtils.isNotBlank(existData3)) {
return AjaxResult.error(existData3);
}
if (StringUtils.isNotBlank(existData4)) {
return AjaxResult.error(existData4);
}
// 校验库中数据的身份证号手机号安全帽编号马甲编号是否重复
List<Map<String, String>> personIsExist = mapper.personIsExist(new PersonVo());
List<Map<String, String>> aqmCodes = mapper.aqmCodeIsExist();
List<Map<String, String>> mjCodes = mapper.mjCodeIsExist();
for (PersonVo vo : list) {
if (idCardIsExist(personIsExist, vo, 1)) {
return AjaxResult.error("" + vo.getSerialNumber() + "行身份证号码已存在");
@ -437,6 +449,12 @@ public class PersonMgeServiceImpl implements IPersonMgeService {
if (idCardIsExist(personIsExist, vo, 2)) {
return AjaxResult.error("" + vo.getSerialNumber() + "行电话已存在");
}
if (codeIsExist(aqmCodes, vo.getAqmCode())) {
return AjaxResult.error("" + vo.getSerialNumber() + "行安全帽编号已存在");
}
if (codeIsExist(mjCodes, vo.getMjCode())) {
return AjaxResult.error("" + vo.getSerialNumber() + "行马甲编号已存在");
}
}
for (PersonVo vo : list) {
// 对身份证号手机号 进行 sm4加密 保存人员数据保存文件资源
@ -495,6 +513,29 @@ public class PersonMgeServiceImpl implements IPersonMgeService {
}
}
/**
* 判断安全帽编号马甲编号 是否重复
* @param list
* @param value
* @return boolean
* @author cwchen
* @date 2024/8/19 18:09
*/
public boolean codeIsExist(List<Map<String, String>> list, String value) {
if (CollectionUtils.isEmpty(list) || StringUtils.isEmpty(value)) {
return false;
} else {
for (Map<String, String> map : list) {
String code = map.get("code");
if (Objects.equals(code, value)) {
return true;
}
}
return false;
}
}
/**
* 文件上传
*
@ -591,6 +632,8 @@ public class PersonMgeServiceImpl implements IPersonMgeService {
vo.setPhone(handleData(obj.getString("phone")));
vo.setFile(obj.get("file") != null ? (MultipartFile) obj.get("file") : null);
vo.setPost(setPost(postList, handleData(obj.getString("post"))));
vo.setAqmCode(handleData(obj.getString("aqmCode")));
vo.setMjCode(handleData(obj.getString("mjCode")));
return vo;
}
@ -637,11 +680,20 @@ public class PersonMgeServiceImpl implements IPersonMgeService {
}
public static List<String> same(List<PersonVo> list, int type, String name) {
// 1 身份证号 2.手机号
// 1 身份证号 2.手机号 3.安全安全帽编号 4.马甲编号
List<String> errList = new ArrayList<String>();
Map<String, String> map = new HashMap<String, String>();
for (int i = 0; i < list.size(); i++) {
String key = type == BusinessConstants.TYPE ? list.get(i).getIdCard() : list.get(i).getPhone();
String key = null;
if (type == BusinessConstants.SAME_TYPE) {
key = list.get(i).getIdCard();
} else if (type == BusinessConstants.SAME_TYPE2) {
key = list.get(i).getPhone();
} else if (type == BusinessConstants.SAME_TYPE3) {
key = list.get(i).getAqmCode();
} else if (type == BusinessConstants.SAME_TYPE4) {
key = list.get(i).getMjCode();
}
if (key == null || Objects.equals("", key)) {
continue;
}

View File

@ -238,7 +238,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
tp.phone,
tp.aqm_code AS aqmCode,
tp.mj_code AS mjCode,
sdd.dict_label AS post
sdd.dict_label AS post,
tp.aqm_code AS aqmCode,
tp.mj_code AS mjCode
FROM tb_people tp
LEFT JOIN sys_dict_data sdd ON tp.post = sdd.dict_value AND sdd.dict_type = 'post_type' AND sdd.status = '0'
WHERE tp.del_flag = 0
@ -265,6 +267,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="canItBeModified" resultType="java.lang.Integer">
SELECT COUNT(*) FROM tb_people tp WHERE id = #{id} AND team_id IS NOT NULL
</select>
<!--获取所有已入库的安全帽编号-->
<select id="aqmCodeIsExist" resultType="java.util.Map">
SELECT aqm_code AS code FROM tb_people WHERE aqm_code IS NOT NULL AND del_flag = 0
</select>
<!--获取所有已入库的马甲编号-->
<select id="mjCodeIsExist" resultType="java.util.Map">
SELECT mj_code AS code FROM tb_people WHERE mj_code IS NOT NULL AND del_flag = 0
</select>
<!--删除资源文件-->
<update id="delCertificateResourceFile">