分包
This commit is contained in:
@ -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;
|
||||
|
||||
}
|
||||
|
||||
@ -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();
|
||||
}
|
||||
|
||||
|
||||
@ -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));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1223,17 +1223,20 @@ 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);
|
||||
|
||||
SubConstructionUser constructionUser = constructionUserService.lambdaQuery()
|
||||
.eq(SubConstructionUser::getSysUserId, userId)
|
||||
.one();
|
||||
if(constructionUser != null){
|
||||
constructionUser.setContractorId(contractorId);
|
||||
constructionUserService.updateById(constructionUser);
|
||||
if(isSub){
|
||||
SubConstructionUser constructionUser = constructionUserService.lambdaQuery()
|
||||
.eq(SubConstructionUser::getSysUserId, userId)
|
||||
.one();
|
||||
if(constructionUser != null){
|
||||
constructionUser.setContractorId(contractorId);
|
||||
constructionUserService.updateById(constructionUser);
|
||||
}
|
||||
}
|
||||
|
||||
return baseMapper.updateById(sysUser)>0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user