This commit is contained in:
zt
2025-10-17 15:37:24 +08:00
parent a323844440
commit ebddc5c51f
5 changed files with 26 additions and 9 deletions

View File

@ -1,5 +1,6 @@
package org.dromara.project.domain.dto.projectteammember;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import java.io.Serial;
@ -45,4 +46,9 @@ public class BusProjectTeamMemberCreateReq implements Serializable {
*/
private String remark;
/**
* 分包公司id
*/
private Long contractorId;
}

View File

@ -176,11 +176,13 @@ public class BusProjectTeamMemberServiceImpl extends ServiceImpl<BusProjectTeamM
LambdaUpdateWrapper<SubConstructionUser> constructionUserLuw = Wrappers.lambdaUpdate(SubConstructionUser.class)
.eq(SubConstructionUser::getId, constructionUser.getId())
.set(SubConstructionUser::getProjectId, req.getProjectId())
.set(req.getContractorId()!=null,SubConstructionUser::getContractorId, req.getContractorId())
.set(SubConstructionUser::getTeamId, projectTeamMember.getTeamId())
.set(SubConstructionUser::getTeamName, projectTeam.getTeamName())
.set(SubConstructionUser::getEntryDate, new Date())
.set(SubConstructionUser::getLeaveDate, null)
.set(SubConstructionUser::getExitStatus, "0")
.set(SubConstructionUser::getUserRole, "0")
.set(StrUtil.isNotBlank(req.getTypeOfWork()),SubConstructionUser::getTypeOfWork,req.getTypeOfWork())
.set(constructionUser.getFirstDate() == null, SubConstructionUser::getFirstDate, LocalDate.now());
constructionUserService.update(constructionUserLuw);
@ -212,6 +214,10 @@ public class BusProjectTeamMemberServiceImpl extends ServiceImpl<BusProjectTeamM
roleService.cleanOnlineUser(Collections.singletonList(constructionUser.getSysUserId()));
if(req.getContractorId()!=null){
userService.updateFb(constructionUser.getSysUserId(),req.getContractorId(),false);
}
return projectTeamMember.getId();
}

View File

@ -404,7 +404,7 @@ public class SysUserController extends BaseController {
@PutMapping("/fb/{userId}/{contractorId}")
public R<Boolean> updateFb(@PathVariable("userId") Long userId,
@PathVariable("contractorId") Long contractorId) {
return R.ok(userService.updateFb(userId, contractorId));
return R.ok(userService.updateFb(userId, contractorId,true));
}

View File

@ -275,11 +275,13 @@ public interface ISysUserService {
List<SysUserVo> selectUserListByAppUserType(String appUserType,Long projectId,Long contractorId);
Boolean updateFb(Long userId,Long contractorId);
Boolean updateFb(Long userId,Long contractorId,Boolean isSub);
List<SysUser> selectUserByRoleIdAndProjectId(Long roleId,Long projectId);
List<SysUser> selectUserByRoleIdsAndProjectId(List<Long> roleIds,Long projectId);
String queryNameById(Long id);
}

View File

@ -1223,10 +1223,11 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
}
@Override
public Boolean updateFb(Long userId,Long contractorId) {
public Boolean updateFb(Long userId,Long contractorId,Boolean isSub) {
SysUser sysUser = baseMapper.selectById(userId);
sysUser.setContractorId(contractorId);
if(isSub){
SubConstructionUser constructionUser = constructionUserService.lambdaQuery()
.eq(SubConstructionUser::getSysUserId, userId)
.one();
@ -1234,6 +1235,8 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
constructionUser.setContractorId(contractorId);
constructionUserService.updateById(constructionUser);
}
}
return baseMapper.updateById(sysUser)>0;
}