增加新增工单时选择引车员

This commit is contained in:
许允枞 2024-11-12 16:39:21 +08:00
parent 0278eb6134
commit 3e431533f1
6 changed files with 53 additions and 11 deletions

View File

@ -41,6 +41,11 @@ public class DlInspectionProject extends TenantBaseDO {
*/
private String remark;
/**
* 排序
*/
private Integer sort;
@TableField(exist = false)
private List<ProjectRoyalty> projectRoyaltyList;
}

View File

@ -92,6 +92,8 @@ public class InspectionInfo extends TenantBaseDO
private String day;
//客户来源
private String customerSource;
/** 引车员id*/
private Long leadManId;
@TableField(exist = false)
private String lastTitle;
@ -157,4 +159,6 @@ public class InspectionInfo extends TenantBaseDO
private Long dealUserId;
@TableField(exist = false)
private String workNodeStatus;
@TableField(exist = false)
private String selectType;
}

View File

@ -25,8 +25,10 @@ import cn.iocoder.yudao.module.payment.service.IOrderInfoDetailService;
import cn.iocoder.yudao.module.payment.service.OrderInfoService;
import cn.iocoder.yudao.module.system.api.user.dto.UserDTO;
import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserSaveReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO;
import cn.iocoder.yudao.module.system.dal.dataobject.permission.UserRoleDO;
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
import cn.iocoder.yudao.module.system.dal.mysql.permission.RoleMapper;
import cn.iocoder.yudao.module.system.service.permission.RoleService;
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
import cn.iocoder.yudao.util.SendSmsUtil;
@ -91,6 +93,8 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
private RoleService roleService;
@Autowired
private InspectionSocket inspectionSocket;
@Resource
private RoleMapper roleMapper;
/**
* 查询请填写功能名称
@ -243,10 +247,14 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
Integer roleId = inspectionWorkNodes.get(0).getRoleId();
//根据角色id获取所有用户
List<UserDTO> listByUserId = roleService.getListByUserId(roleId);
if (CollUtil.isNotEmpty(listByUserId)) {
for (UserDTO userDTO : listByUserId) {
inspectionSocket.sendMessage("接工单", userDTO.getId().toString());
List<Long> ids = listByUserId.stream().map(UserDTO::getId).collect(Collectors.toList());
ids.add(inspectionInfo.getLeadManId());
// 获取当前共单引车员的id
if (CollUtil.isNotEmpty(ids)) {
for (Long id : ids) {
inspectionSocket.sendMessage("接工单", id.toString());
}
}
//检测步骤表插入检测开始
@ -390,6 +398,7 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
//获取当前登陆人的角色
List<UserRoleDO> byUserId = roleService.getByUserId(loginUser.getId());
inspectionInfo.setLeadManId(loginUser.getId());
List<Long> roleIds = byUserId.stream().map(UserRoleDO::getRoleId).collect(Collectors.toList());
if (!"1".equals(inspectionInfo.getStatus())) {
//进行中 已完成

View File

@ -30,6 +30,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* <p>
@ -194,8 +195,13 @@ public class InspectionWorkNodeServiceImpl extends ServiceImpl<InspectionWorkNod
inspectionInfo.setNowOrderNum(workNode.getOrderNum() + 1);
//获取下一节点
InspectionWorkNode nextNode = getNextNode(inspectionWorkNodes, workNode);
/*给下一单人员发送信息*/
List<UserDTO> listByUserId = roleService.getListByUserId(nextNode.getRoleId());
sendSocketMessage(listByUserId);
List<Long> ids = listByUserId.stream().map(UserDTO::getId).collect(Collectors.toList());
if (ObjectUtil.isNotNull(inspectionInfo.getLeadManId())){
ids.add(inspectionInfo.getLeadManId());
}
sendSocketMessage(ids);
}
//将节点状态改为已完成
@ -346,7 +352,11 @@ public class InspectionWorkNodeServiceImpl extends ServiceImpl<InspectionWorkNod
//获取重审的节点的roleID
Integer roleId = workNode.getRoleId();
List<UserDTO> listByUserId = roleService.getListByUserId(roleId);
sendSocketMessage(listByUserId);
List<Long> ids = listByUserId.stream().map(UserDTO::getId).collect(Collectors.toList());
if (ObjectUtil.isNotNull(info.getLeadManId())){
ids.add(info.getLeadManId());
}
sendSocketMessage(ids);
// 添加步骤信息表
InspectionStepInfo stepInfo = new InspectionStepInfo();
@ -363,11 +373,11 @@ public class InspectionWorkNodeServiceImpl extends ServiceImpl<InspectionWorkNod
inspectionStepService.save(stepInfo);
}
public void sendSocketMessage(List<UserDTO> listByUserId) {
if (CollUtil.isNotEmpty(listByUserId)) {
for (UserDTO userDTO : listByUserId) {
public void sendSocketMessage(List<Long> userIds) {
if (CollUtil.isNotEmpty(userIds)) {
for (Long userId : userIds) {
try {
inspectionSocket.sendMessage("接工单", userDTO.getId().toString());
inspectionSocket.sendMessage("接工单", userId.toString());
} catch (IOException e) {
throw new RuntimeException(e);
}

View File

@ -282,10 +282,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
-- ii.status = '0' -- 工单正在进行中
-- ii.now_order_num = iwn.order_num -- 当前工单步骤与流程节点顺序一致
-- AND iwn.status = '0' -- 流程节点状态为待开始
iwn.role_id IN
(ii.lead_man_id = #{inspectionInfo.leadManId}
OR iwn.role_id IN
<foreach collection="roleIds" item="roleId" open="(" separator="," close=")">
#{roleId}
</foreach>
</foreach>)
<if test="inspectionInfo.carNum != null">
AND ii.car_num like concat('%',#{inspectionInfo.carNum},'%')
</if>

View File

@ -7,6 +7,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.system.controller.admin.permission.vo.role.*;
import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleDO;
import cn.iocoder.yudao.module.system.service.permission.RoleService;
@ -117,4 +118,16 @@ public class RoleController {
return success(roleService.selectListByRoleId(role));
}
/**
* 通过角色code查询用户
* @param code
* @return
*/
@GetMapping("/getUsersByRoleCode")
public CommonResult getUsersByRoleCode(String code){
//获取当前登陆人的tenanId
Long tenantId = SecurityFrameworkUtils.getLoginUser().getTenantId();
return success(roleService.selectByRoleCode(tenantId,code));
}
}