自测问题修改

This commit is contained in:
cwchen 2024-08-19 16:19:55 +08:00
parent a3ce537251
commit 9732ebeaa9
8 changed files with 93 additions and 6 deletions

View File

@ -0,0 +1,26 @@
package com.bonus.gateway.filter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.reactive.CorsWebFilter;
import org.springframework.web.cors.reactive.UrlBasedCorsConfigurationSource;
import org.springframework.web.util.pattern.PathPatternParser;
/**
* description:
* java项目fhadmin.cn
*/
@Configuration
public class CorsConfig {
@Bean
public CorsWebFilter corsFilter() {
CorsConfiguration config = new CorsConfiguration();
config.addAllowedMethod("*"); // 是什么请求方法比如GET POST PUT DELATE ...
config.addAllowedOrigin("*"); // 来自哪个域名的请求*号表示所有
config.addAllowedOriginPattern("*"); // 来自哪个域名的请求*号表示所有
config.addAllowedHeader("*"); // 是什么请求头部
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(new PathPatternParser());
source.registerCorsConfiguration("/**", config);
return new CorsWebFilter(source);
}
}

View File

@ -115,4 +115,13 @@ public interface EquipmentReqMapper {
* @date 2024/8/7 14:53
*/
Long getTeamLeader(EquipmentReqDataVo vo);
/**
* 判断班组是否已经解散
* @param teamId
* @return int
* @author cwchen
* @date 2024/8/19 10:04
*/
int isTeamDissolve(Long teamId);
}

View File

@ -227,4 +227,22 @@ public interface PersonMgeMapper {
* @date 2024/8/12 13:12
*/
void updatePeoplePushStatus(Long id);
/**
* 判断人员是否绑定了设备
* @param vo
* @return List<Integer>
* @author cwchen
* @date 2024/8/19 10:57
*/
List<Integer> isLyDevices(PersonVo vo);
/**
* 人员已分配班组岗位限制修改
* @param vo
* @return Integer
* @author cwchen
* @date 2024/8/19 15:08
*/
Integer canItBeModified(PersonVo vo);
}

View File

@ -55,6 +55,11 @@ public class EquipmentReqServiceImpl implements IEquipmentReqService {
if(!isDepartRoleCode){
return AjaxResult.error("非项目部角色,无领用设备权限");
}
// 判断班组是否已经解散
int isTeamDissolve = mapper.isTeamDissolve(vo.getTeamId());
if(isTeamDissolve == 0){
return AjaxResult.error("该班组已解散,无法领用设备");
}
if (CollectionUtils.isEmpty(vo.getList())) {
return AjaxResult.error("领用设备不能为空");
}

View File

@ -184,6 +184,11 @@ public class PersonMgeServiceImpl implements IPersonMgeService {
if (StringUtils.isNotBlank(validResult)) {
return AjaxResult.error(validResult);
}
// 人员已分配班组岗位限制修改
Integer canItBeModified = mapper.canItBeModified(vo);
if(canItBeModified > 0){
return AjaxResult.error("人员已分配班组,岗位已限制修改");
}
// 验证身份证是否重复手机号
List<Map<String, String>> list = mapper.personIsExist(vo);
if (idCardIsExist(list, vo, 1)) {
@ -300,9 +305,18 @@ public class PersonMgeServiceImpl implements IPersonMgeService {
public AjaxResult delPerson(BraceletParamsDto dto) {
List<CertificateVo> list = new ArrayList<>();
try {
if (dto.getTeamId() != null) {
PersonVo vo = mapper.getPersonInfo(dto);
if (vo.getTeamId() != null) {
return AjaxResult.error("该人员已分配班组,请先从班组中移除该人员");
}
// 判断人员是否领用设备包括手环箱手环安全帽等设备
List<Integer> isLyDevices = mapper.isLyDevices(vo);
if(isLyDevices.get(0) > 0){
return AjaxResult.error("该人员已绑定手环");
}
if(isLyDevices.get(1) > 0){
return AjaxResult.error("该人员已绑定设备");
}
// 删除人员资源文件人脸照片
mapper.delPerson(dto);
list = mapper.getCertificate(dto);
@ -473,7 +487,7 @@ public class PersonMgeServiceImpl implements IPersonMgeService {
String encodeValue = Sm4Utils.encode(type == BusinessConstants.TYPE ? vo.getIdCard() : vo.getPhone());
for (Map<String, String> map : list) {
String value = type == BusinessConstants.TYPE ? map.get("value") : map.get("phone");
if (Objects.equals(encodeValue, map.get("value"))) {
if (Objects.equals(encodeValue, value)) {
return true;
}
}

View File

@ -189,4 +189,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
FROM t_work_team twt
WHERE twt.team_id = #{teamId}
</select>
<!--判断班组是否已经解散-->
<select id="isTeamDissolve" resultType="java.lang.Integer">
SELECT COUNT(*) FROM t_work_team twt WHERE team_id = #{teamId} AND team_status = 0 AND del_flag = 0
</select>
</mapper>

View File

@ -68,7 +68,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
tp.mj_code AS mjCode,
sfs.file_path AS filePath,
sfs.id AS fileId,
tp.post
tp.post,
tp.team_id AS teamId
FROM tb_people tp
LEFT JOIN sys_file_source sfs ON tp.id = sfs.source_id AND sfs.source_type = #{sourceType} AND sfs.del_flag = 0
WHERE tp.id = #{id} AND tp.del_flag = 0
@ -254,6 +255,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
SELECT dict_label AS name, dict_value AS value FROM sys_dict_data sdd
WHERE sdd.dict_type = 'post_type' AND sdd.status = '0'
</select>
<!--判断人员是否绑定了手环设备以及其他设备-->
<select id="isLyDevices" resultType="java.lang.Integer">
SELECT COUNT(*) FROM tb_bracelet WHERE bid_id = #{id} AND peopel_type = 0 AND del_flag = 0
UNION ALL
SELECT COUNT(*) FROM tb_dev_ly WHERE ly_user = #{id}
</select>
<!--人员已分配班组,岗位限制修改 -->
<select id="canItBeModified" resultType="java.lang.Integer">
SELECT COUNT(*) FROM tb_people tp WHERE id = #{id} AND team_id IS NOT NULL
</select>
<!--删除资源文件-->
<update id="delCertificateResourceFile">

View File

@ -142,13 +142,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
FROM tb_people
WHERE del_flag = 0
<if test="type == 2">
AND team_id IS NULL
AND team_id IS NULL AND post !='team_leader'
</if>
<if test="type == 3 and teamId==null">
AND team_id IS NOT NULL
AND team_id IS NOT NULL AND post !='team_leader'
</if>
<if test="type == 3 and teamId!=null">
AND team_id =#{teamId}
AND team_id =#{teamId} AND post !='team_leader'
</if>
</if>
</select>