This commit is contained in:
zt
2025-09-17 17:44:28 +08:00
parent 6110374e67
commit 4ffb639d33
14 changed files with 117 additions and 34 deletions

View File

@ -255,7 +255,7 @@ public class SubConstructionUserController extends BaseController {
/** /**
* 人脸识别 * 人脸识别
*/ */
@SaCheckPermission("contractor:constructionUser:add") // @SaCheckPermission("contractor:constructionUser:add")
@Log(title = "施工人员", businessType = BusinessType.OTHER) @Log(title = "施工人员", businessType = BusinessType.OTHER)
@PostMapping("/face/recognize") @PostMapping("/face/recognize")
public R<SysOssVo> faceRecognize(@RequestParam("file") MultipartFile file) { public R<SysOssVo> faceRecognize(@RequestParam("file") MultipartFile file) {

View File

@ -294,4 +294,6 @@ public class SubConstructionUserVo implements Serializable {
* 用户Id * 用户Id
*/ */
private Long sysUserId; private Long sysUserId;
private String postId;
} }

View File

@ -1,5 +1,6 @@
package org.dromara.contractor.service.impl; package org.dromara.contractor.service.impl;
import cn.dev33.satoken.secure.BCrypt;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.io.IoUtil; import cn.hutool.core.io.IoUtil;
@ -14,6 +15,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import org.dromara.common.core.constant.DateConstant; import org.dromara.common.core.constant.DateConstant;
import org.dromara.common.core.constant.HttpStatus; import org.dromara.common.core.constant.HttpStatus;
import org.dromara.common.core.enums.UserType;
import org.dromara.common.core.exception.ServiceException; import org.dromara.common.core.exception.ServiceException;
import org.dromara.common.core.utils.DateUtils; import org.dromara.common.core.utils.DateUtils;
import org.dromara.common.core.utils.ObjectUtils; import org.dromara.common.core.utils.ObjectUtils;
@ -52,6 +54,7 @@ import org.dromara.project.domain.enums.BusAttendanceClockStatusEnum;
import org.dromara.project.domain.enums.BusAttendanceCommuterEnum; import org.dromara.project.domain.enums.BusAttendanceCommuterEnum;
import org.dromara.project.domain.enums.BusConstructionUserAttendanceStatusEnum; import org.dromara.project.domain.enums.BusConstructionUserAttendanceStatusEnum;
import org.dromara.project.service.*; import org.dromara.project.service.*;
import org.dromara.system.domain.SysUser;
import org.dromara.system.domain.bo.SysUserBo; import org.dromara.system.domain.bo.SysUserBo;
import org.dromara.system.domain.vo.SysOssVo; import org.dromara.system.domain.vo.SysOssVo;
import org.dromara.system.domain.vo.SysUserVo; import org.dromara.system.domain.vo.SysUserVo;
@ -332,6 +335,7 @@ public class SubConstructionUserServiceImpl extends ServiceImpl<SubConstructionU
* @return 是否新增成功 * @return 是否新增成功
*/ */
@Override @Override
@Transactional(rollbackFor = Exception.class)
public Long insertByBo(SubConstructionUserCreateReq req) { public Long insertByBo(SubConstructionUserCreateReq req) {
// 将实体类和 DTO 进行转换 // 将实体类和 DTO 进行转换
SubConstructionUser constructionUser = new SubConstructionUser(); SubConstructionUser constructionUser = new SubConstructionUser();
@ -341,15 +345,24 @@ public class SubConstructionUserServiceImpl extends ServiceImpl<SubConstructionU
Long userId = LoginHelper.getUserId(); Long userId = LoginHelper.getUserId();
projectService.validAuth(req.getProjectId(), userId); projectService.validAuth(req.getProjectId(), userId);
String phone = constructionUser.getPhone(); String phone = constructionUser.getPhone();
SysUserVo userVo = userService.selectUserByPhonenumber(phone); // SysUserVo userVo = userService.selectUserByPhonenumber(phone);
if (userVo == null) { // if (userVo == null) {
throw new ServiceException("当前用户未在系统注册", HttpStatus.BAD_REQUEST); // throw new ServiceException("当前用户未在系统注册", HttpStatus.BAD_REQUEST);
} // }
constructionUser.setSysUserId(userVo.getUserId()); // constructionUser.setSysUserId(userVo.getUserId());
String sfzNumber = req.getSfzNumber(); String sfzNumber = req.getSfzNumber();
// 对身份证号码进行加密 // 对身份证号码进行加密
String encrypt = idCardEncryptorUtil.encrypt(sfzNumber); String encrypt = idCardEncryptorUtil.encrypt(sfzNumber);
constructionUser.setSfzNumber(encrypt); constructionUser.setSfzNumber(encrypt);
//新增系统用户
SysUser sysUser = new SysUser();
sysUser.setUserName(phone);
sysUser.setNickName(req.getUserName());
sysUser.setPhonenumber(phone);
sysUser.setUserType(UserType.APP_USER.getUserType());
Long sysUserId = userService.save(sysUser);
constructionUser.setSysUserId(sysUserId);
// 操作数据库 // 操作数据库
boolean save = this.save(constructionUser); boolean save = this.save(constructionUser);
if (!save) { if (!save) {
@ -874,7 +887,13 @@ public class SubConstructionUserServiceImpl extends ServiceImpl<SubConstructionU
constructionUserVo.setFileUploadStatus(SubConstructionUserFileStatusEnum.UPLOAD.getValue()); constructionUserVo.setFileUploadStatus(SubConstructionUserFileStatusEnum.UPLOAD.getValue());
} }
// 解密身份证号码 // 解密身份证号码
String decrypt = idCardEncryptorUtil.decrypt(constructionUserVo.getSfzNumber()); String decrypt = constructionUserVo.getSfzNumber();
try {
decrypt = idCardEncryptorUtil.decrypt(constructionUserVo.getSfzNumber());
}catch (Exception e){
log.warn("身份证解密失败");
}
String hide = null; String hide = null;
if (decrypt != null) { if (decrypt != null) {
hide = DesensitizedUtil.idCardNum(decrypt, 1, 2); hide = DesensitizedUtil.idCardNum(decrypt, 1, 2);
@ -892,9 +911,21 @@ public class SubConstructionUserServiceImpl extends ServiceImpl<SubConstructionU
Integer age = Math.max(Period.between(sfzBirth, LocalDate.now()).getYears(), 0); Integer age = Math.max(Period.between(sfzBirth, LocalDate.now()).getYears(), 0);
constructionUserVo.setAge(age); constructionUserVo.setAge(age);
} }
//添加岗位
if(constructionUser.getTeamId()!=null){
BusProjectTeamMember one = projectTeamMemberService.getOne(Wrappers.<BusProjectTeamMember>lambdaQuery()
.eq(BusProjectTeamMember::getTeamId, constructionUser.getTeamId())
.last("limit 1")
);
if(one != null){
constructionUserVo.setPostId(one.getPostId());
}
}
return constructionUserVo; return constructionUserVo;
}).toList(); }).toList();
constructionUserVoPage.setRecords(constructionUserVoList); constructionUserVoPage.setRecords(constructionUserVoList);
return constructionUserVoPage; return constructionUserVoPage;
} }

View File

@ -470,7 +470,7 @@ public class BusAttendanceServiceImpl extends ServiceImpl<BusAttendanceMapper, B
.toList(); .toList();
if (CollUtil.isEmpty(punchRangeList)) { if (CollUtil.isEmpty(punchRangeList)) {
throw new ServiceException(isConstruct ? "班组" : "项目" + "未配置考勤范围", HttpStatus.BAD_REQUEST); throw new ServiceException(isConstruct ? "班组未配置考勤范围" : "项目未配置考勤范围", HttpStatus.BAD_REQUEST);
} }
List<GeoPoint> matchingRange = JSTUtil.findMatchingRange(req.getLat(), req.getLng(), punchRangeList); List<GeoPoint> matchingRange = JSTUtil.findMatchingRange(req.getLat(), req.getLng(), punchRangeList);
return matchingRange != null; return matchingRange != null;

View File

@ -140,10 +140,13 @@ public class BusProjectTeamMemberServiceImpl extends ServiceImpl<BusProjectTeamM
Long teamId = req.getTeamId(); Long teamId = req.getTeamId();
BusProjectTeam projectTeam = projectTeamService.getById(teamId); BusProjectTeam projectTeam = projectTeamService.getById(teamId);
if (projectTeam == null) { if (projectTeam == null) {
throw new ServiceException("对应班组不存在", HttpStatus.NOT_FOUND); throw new ServiceException("对应班组不存在", HttpStatus.ERROR);
} }
Long memberId = projectTeamMember.getMemberId(); Long memberId = projectTeamMember.getMemberId();
SubConstructionUser constructionUser = constructionUserService.getBySysUserId(memberId); SubConstructionUser constructionUser = constructionUserService.getBySysUserId(memberId);
if (constructionUser.getTeamId() != null) {
throw new ServiceException("当前用户已入场", HttpStatus.ERROR);
}
// 判断用户是否已经被拉黑 // 判断用户是否已经被拉黑
constructionBlacklistService.validUserInBlacklist(constructionUser.getSysUserId(), projectTeamMember.getProjectId()); constructionBlacklistService.validUserInBlacklist(constructionUser.getSysUserId(), projectTeamMember.getProjectId());
// 判断对应的用户与项目关联是否存在 // 判断对应的用户与项目关联是否存在
@ -151,7 +154,7 @@ public class BusProjectTeamMemberServiceImpl extends ServiceImpl<BusProjectTeamM
.eq(BusProjectTeamMember::getMemberId, memberId) .eq(BusProjectTeamMember::getMemberId, memberId)
.eq(BusProjectTeamMember::getProjectId, projectTeamMember.getProjectId())); .eq(BusProjectTeamMember::getProjectId, projectTeamMember.getProjectId()));
if (teamMember != null) { if (teamMember != null) {
throw new ServiceException("当前用户已入场", HttpStatus.BAD_REQUEST); throw new ServiceException("当前用户已入场", HttpStatus.ERROR);
} }
// 操作数据库 // 操作数据库
boolean save = this.save(projectTeamMember); boolean save = this.save(projectTeamMember);
@ -182,29 +185,20 @@ public class BusProjectTeamMemberServiceImpl extends ServiceImpl<BusProjectTeamM
relevancy.setProjectId(req.getProjectId()); relevancy.setProjectId(req.getProjectId());
userProjectRelevancyService.save(relevancy); userProjectRelevancyService.save(relevancy);
} }
//设置基础角色 //设置基础角色 先清空已有角色
List<SysUserRole> sysUserRoles = userRoleMapper.selectList(Wrappers.<SysUserRole>lambdaQuery() userRoleMapper.delete(Wrappers.<SysUserRole>lambdaQuery()
.eq(SysUserRole::getUserId, constructionUser.getSysUserId()) .eq(SysUserRole::getUserId, constructionUser.getSysUserId())
.eq(SysUserRole::getProjectId, req.getProjectId()) .eq(SysUserRole::getProjectId, req.getProjectId())
.in(SysUserRole::getRoleId, Arrays.asList(2L, 3L)) .in(SysUserRole::getRoleId, Arrays.asList(2L, 3L))
); );
if (CollUtil.isEmpty(sysUserRoles)) { //再添加分配角色
SysUserRole sysUserRole = new SysUserRole(); Long roleId = "0".equals(req.getPostId()) ? 2L : 3L;
sysUserRole.setUserId(constructionUser.getSysUserId()); SysUserRole sysUserRole = new SysUserRole();
sysUserRole.setRoleId("0".equals(req.getPostId()) ? 2L : 3L); sysUserRole.setUserId(constructionUser.getSysUserId());
sysUserRole.setProjectId(req.getProjectId()); sysUserRole.setRoleId(roleId);
userRoleMapper.insert(sysUserRole); sysUserRole.setProjectId(req.getProjectId());
} else { userRoleMapper.insert(sysUserRole);
Long roleId = "0".equals(req.getPostId()) ? 2L : 3L;
List<Long> list1 = sysUserRoles.stream().map(SysUserRole::getRoleId).toList();
if (!list1.contains(roleId)){
SysUserRole sysUserRole = new SysUserRole();
sysUserRole.setUserId(constructionUser.getSysUserId());
sysUserRole.setRoleId(roleId);
sysUserRole.setProjectId(req.getProjectId());
userRoleMapper.insert(sysUserRole);
}
}
return projectTeamMember.getId(); return projectTeamMember.getId();
} }
@ -290,11 +284,11 @@ public class BusProjectTeamMemberServiceImpl extends ServiceImpl<BusProjectTeamM
String salaryVoucherFile = req.getSalaryVoucherFile(); String salaryVoucherFile = req.getSalaryVoucherFile();
String salaryConfirmationFile = req.getSalaryConfirmationFile(); String salaryConfirmationFile = req.getSalaryConfirmationFile();
if (StringUtils.isAnyBlank(salaryVoucherFile, salaryConfirmationFile)) { if (StringUtils.isAnyBlank(salaryVoucherFile, salaryConfirmationFile)) {
throw new ServiceException("请上传退场文件", HttpStatus.BAD_REQUEST); throw new ServiceException("请上传退场文件", HttpStatus.ERROR);
} }
BusProjectTeamMember projectTeamMember = this.getById(id); BusProjectTeamMember projectTeamMember = this.getById(id);
if (projectTeamMember == null) { if (projectTeamMember == null) {
throw new ServiceException("对应项目班组下的成员不存在", HttpStatus.NOT_FOUND); throw new ServiceException("对应项目班组下的成员不存在", HttpStatus.ERROR);
} }
projectService.validAuth(projectTeamMember.getProjectId(), userId); projectService.validAuth(projectTeamMember.getProjectId(), userId);
boolean result = this.removeById(id); boolean result = this.removeById(id);

View File

@ -137,4 +137,14 @@ public class QltQualityInspectionController extends BaseController {
@PathVariable Long projectId) { @PathVariable Long projectId) {
return R.ok(busProjectTeamService.queryForemanListByProjectId(projectId)); return R.ok(busProjectTeamService.queryForemanListByProjectId(projectId));
} }
/**
* 获取整改记录
*/
@GetMapping("/record/{jobKey}")
public R<List<QltQualityInspectionVo>> getRecord(@NotNull(message = "任务批号不能为空")
@PathVariable String jobKey) {
return R.ok(qualityInspectionService.getRecord(jobKey));
}
} }

View File

@ -4,6 +4,7 @@ import lombok.Data;
import java.io.Serial; import java.io.Serial;
import java.io.Serializable; import java.io.Serializable;
import java.util.List;
/** /**
* @author lilemy * @author lilemy
@ -52,6 +53,4 @@ public class QltQualityInspectionQueryReq implements Serializable {
* 巡检标题 * 巡检标题
*/ */
private String inspectionHeadline; private String inspectionHeadline;
} }

View File

@ -347,12 +347,15 @@ public class QltQualityInspectionServiceImpl extends ServiceImpl<QltQualityInspe
Long projectId = req.getProjectId(); Long projectId = req.getProjectId();
String inspectionType = req.getInspectionType(); String inspectionType = req.getInspectionType();
String inspectionStatus = req.getInspectionStatus(); String inspectionStatus = req.getInspectionStatus();
if(inspectionStatus != null){
String[] split = inspectionStatus.split(",");
lqw.in( QltQualityInspection::getInspectionStatus, Arrays.asList(split));
}
String rectificationUnit = req.getRectificationUnit(); String rectificationUnit = req.getRectificationUnit();
Long rectificationId = req.getRectificationId(); Long rectificationId = req.getRectificationId();
// 精确查询 // 精确查询
lqw.orderByDesc(QltQualityInspection::getCreateTime); lqw.orderByDesc(QltQualityInspection::getCreateTime);
lqw.eq(StringUtils.isNotBlank(inspectionType), QltQualityInspection::getInspectionType, inspectionType); lqw.eq(StringUtils.isNotBlank(inspectionType), QltQualityInspection::getInspectionType, inspectionType);
lqw.eq(StringUtils.isNotBlank(inspectionStatus), QltQualityInspection::getInspectionStatus, inspectionStatus);
lqw.eq(StringUtils.isNotBlank(rectificationUnit), QltQualityInspection::getRectificationUnit, rectificationUnit); lqw.eq(StringUtils.isNotBlank(rectificationUnit), QltQualityInspection::getRectificationUnit, rectificationUnit);
lqw.eq(ObjectUtils.isNotEmpty(projectId), QltQualityInspection::getProjectId, projectId); lqw.eq(ObjectUtils.isNotEmpty(projectId), QltQualityInspection::getProjectId, projectId);
lqw.eq(ObjectUtils.isNotEmpty(rectificationId), QltQualityInspection::getRectificationId, rectificationId); lqw.eq(ObjectUtils.isNotEmpty(rectificationId), QltQualityInspection::getRectificationId, rectificationId);

View File

@ -143,4 +143,13 @@ public class HseSafetyInspectionController extends BaseController {
@PathVariable Long[] ids) { @PathVariable Long[] ids) {
return toAjax(safetyInspectionService.deleteByIds(List.of(ids))); return toAjax(safetyInspectionService.deleteByIds(List.of(ids)));
} }
/**
* 根据任务号获取整改记录
*/
@GetMapping("/record/{jobKey}")
public R<List<HseSafetyInspectionVo>> getRecord(@NotNull(message = "任务批号不能为空")
@PathVariable String jobKey) {
return R.ok(safetyInspectionService.getRecord(jobKey));
}
} }

View File

@ -326,4 +326,12 @@ public class SysUserController extends BaseController {
return R.ok(userService.selectUserListByDept(deptId)); return R.ok(userService.selectUserListByDept(deptId));
} }
@SaCheckPermission("system:user:edit")
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
@PutMapping("/appUserType/{userId}/{appUserType}")
public R<Boolean> updateUserAppType(@PathVariable("userId") Long userId,
@PathVariable("appUserType") String appUserType) {
return R.ok(userService.updateAppUserType(userId, appUserType));
}
} }

View File

@ -104,6 +104,12 @@ public class SysUser extends TenantEntity {
private String remark; private String remark;
/**
* app用户类型 0-施工人员 1-管理人员 2-分包人员
*/
private String appUserType;
public SysUser(Long userId) { public SysUser(Long userId) {
this.userId = userId; this.userId = userId;
} }

View File

@ -149,4 +149,7 @@ public class SysUserVo implements Serializable {
*/ */
private List<Long> projectIds; private List<Long> projectIds;
private String appUserType;
} }

View File

@ -260,4 +260,8 @@ public interface ISysUserService {
List<String> getUserNamesByDept(Long deptId); List<String> getUserNamesByDept(Long deptId);
SysUserVo queryById(Long userId); SysUserVo queryById(Long userId);
Long save(SysUser sysUser);
Boolean updateAppUserType(Long userId,String appUserType);
} }

View File

@ -815,6 +815,20 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
return ObjectUtils.notNullGetter(sysUser, SysUser::getUserName); return ObjectUtils.notNullGetter(sysUser, SysUser::getUserName);
} }
@Override
public Long save(SysUser sysUser) {
baseMapper.insert(sysUser);
return sysUser.getUserId();
}
@Override
public Boolean updateAppUserType(Long userId, String appUserType) {
return baseMapper.update(null,
new LambdaUpdateWrapper<SysUser>()
.set(SysUser::getAppUserType, appUserType)
.eq(SysUser::getUserId, userId)) > 0;
}
/** /**
* 通过用户ID查询用户账户 * 通过用户ID查询用户账户
* *