2
This commit is contained in:
parent
3f891bf327
commit
1b6a1dab5b
@ -123,6 +123,12 @@ public class RepairWorkerController {
|
||||
return success(workerService.listByLeads());
|
||||
}
|
||||
|
||||
@GetMapping("/listLeadsAll")
|
||||
@Operation(summary = "通过班组长的id查该班组的员工(不去掉班组长)")
|
||||
public CommonResult<?> listLeadsAll() {
|
||||
return success(workerService.listLeadsAll());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查当前登录用户是否维修班组长
|
||||
* @author vinjor-M
|
||||
|
@ -106,6 +106,14 @@ public interface RepairWorkerService extends IService<RepairWorker> {
|
||||
**/
|
||||
List<RepairWorker> listByLeads();
|
||||
|
||||
/**
|
||||
* 通过班组长的id查该班组的员工(不去掉班组长)
|
||||
* @author PQZ
|
||||
* @date 15:20 2024/11/13
|
||||
* @return java.util.List<cn.iocoder.yudao.module.base.entity.RepairWorker>
|
||||
**/
|
||||
List<RepairWorker> listLeadsAll();
|
||||
|
||||
/**
|
||||
* 查当前登录用户是否维修班组长
|
||||
* @author vinjor-M
|
||||
|
@ -272,6 +272,21 @@ public class RepairWorkerServiceImpl extends ServiceImpl<RepairWorkerMapper, Rep
|
||||
return workerList.stream().filter(item -> !Objects.equals(item.getUserId(), worker.getUserId())).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过班组长的id查该班组的员工()不去掉班组长
|
||||
*
|
||||
* @return java.util.List<cn.iocoder.yudao.module.base.entity.RepairWorker>
|
||||
* @author PQZ
|
||||
* @date 15:20 2024/11/13
|
||||
**/
|
||||
@Override
|
||||
public List<RepairWorker> listLeadsAll() {
|
||||
// 取班组长的记录
|
||||
RepairWorker worker = baseMapper.selectOne(new LambdaQueryWrapper<RepairWorker>().eq(RepairWorker::getUserId, SecurityFrameworkUtils.getLoginUserId()));
|
||||
// 根据班组长的工种查所有该工程的工人
|
||||
return baseMapper.selectList(new LambdaQueryWrapper<RepairWorker>().eq(RepairWorker::getWorkType, worker.getWorkType()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查当前登录用户是否维修班组长
|
||||
*
|
||||
|
@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.iocoder.yudao.common.*;
|
||||
import cn.iocoder.yudao.framework.common.util.number.MoneyUtils;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.security.core.LoginUser;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.module.base.entity.RepairWorker;
|
||||
@ -876,7 +877,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
if ("".equals(userIdsStr)) {
|
||||
userIdsStr = String.valueOf(worker.getUserId());
|
||||
} else {
|
||||
userIdsStr = "," + worker.getUserId();
|
||||
userIdsStr = userIdsStr + "," + worker.getUserId();
|
||||
}
|
||||
}
|
||||
repairTicketsReqVO.setUserIds(userIds);
|
||||
@ -999,11 +1000,16 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
}
|
||||
repairWorkerService.sentMessage(reqVO.getNowRepairId(), "您有新的工单要处理");
|
||||
|
||||
// 获取当前操作人的身份----小李新加的逻辑
|
||||
String userRole = getUserRole();
|
||||
if (userRole.equals(RepairRoleEnum.REPAIR_STAFF.getCode())) {
|
||||
//指派施工,施工项目中不包含选中人员处理
|
||||
setTicketItem(reqVO.getId(),reqVO.getNowRepairId(),reqVO.getNowRepairName());
|
||||
}
|
||||
//最后记录操作日志--指派施工--pull下来的逻辑
|
||||
String code = RecordTypeEnum.ZPSG.getCode();
|
||||
String remark ="指派施工";
|
||||
// 获取当前操作人的身份----小李新加的逻辑
|
||||
String userRole = getUserRole();
|
||||
|
||||
// 总检
|
||||
if (userRole.equals(RepairRoleEnum.INSPECTION.getCode())){
|
||||
repairRecordsService.saveRepairRecord(reqVO.getId(), null, RecordTypeEnum.NFPG.getCode(), reqVO.getRemark(), reqVO.getImage());
|
||||
@ -1014,6 +1020,54 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 指派施工,施工项目中不包含选中人员处理
|
||||
* @author PQZ
|
||||
* @date 16:30 2024/11/13
|
||||
* @param ticketId 工单id
|
||||
* @param nowRepairId 当前处理人id
|
||||
* @param nowRepairName 当前处理人名称
|
||||
**/
|
||||
private void setTicketItem(String ticketId,Long nowRepairId,String nowRepairName){
|
||||
//查询所有维修工
|
||||
List<RepairWorker> list = repairWorkerService.list();
|
||||
//查询当前工单下所有项目
|
||||
LambdaQueryWrapper<DlRepairTitem> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(DlRepairTitem::getTicketId,ticketId);
|
||||
List<DlRepairTitem> itemList = titemService.list(lambdaQueryWrapper);
|
||||
//过滤出不包括当前指派人的值
|
||||
List<DlRepairTitem> filterList = itemList.stream().filter(item -> !item.getRepairNames().contains(nowRepairName)).collect(Collectors.toList());
|
||||
List<DlRepairTitem> saveList = new ArrayList<>();
|
||||
//当前处理人工作组
|
||||
Map<Long,RepairWorker> workerMap = list.stream().collect(Collectors.toMap(RepairWorker::getUserId,worker -> worker));
|
||||
String workType = workerMap.get(nowRepairId).getWorkType();
|
||||
filterList.forEach(item -> {
|
||||
//深拷贝
|
||||
DlRepairTitem saveItem = BeanUtils.toBean(item,DlRepairTitem.class);
|
||||
if (StringUtils.isNotEmpty(saveItem.getRepairIds())){
|
||||
//取出用户id
|
||||
List<Long> repairIds = Arrays.stream(saveItem.getRepairIds().split(",")).map(Long::parseLong).collect(Collectors.toList());
|
||||
repairIds.forEach(idItem -> {
|
||||
// 获取对应的 worker
|
||||
RepairWorker worker = workerMap.get(idItem);
|
||||
// 检查 worker 是否存在并比较 workType
|
||||
if (worker != null && workType.equals(worker.getWorkType())) {
|
||||
saveList.add(saveItem);
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
saveList.forEach(item -> {
|
||||
String newRepairId = item.getRepairIds()+","+nowRepairId;
|
||||
String newRepairName = item.getRepairNames() + "," + nowRepairName;
|
||||
item.setRepairIds(newRepairId);
|
||||
item.setRepairNames(newRepairName);
|
||||
});
|
||||
titemService.updateBatchById(saveList);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新工单状态(针对开始施工、施工中记录、施工完成)
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user