Compare commits
2 Commits
2dde810dec
...
f8544d6569
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f8544d6569 | ||
|
|
d1715c2c2b |
@ -35,4 +35,13 @@ public interface RepairWorkerMapper extends BaseMapper<RepairWorker> {
|
|||||||
* @date 2024年10月10日
|
* @date 2024年10月10日
|
||||||
**/
|
**/
|
||||||
List<Long> getAllWorkerIds();
|
List<Long> getAllWorkerIds();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据userId查询维修工信息
|
||||||
|
* @author PQZ
|
||||||
|
* @date 17:28 2024/11/4
|
||||||
|
* @param userId 用户id
|
||||||
|
* @return cn.iocoder.yudao.module.base.vo.RepairWorkerRespVO
|
||||||
|
**/
|
||||||
|
RepairWorkerRespVO getByUserId(Long userId);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -27,6 +27,15 @@ public interface RepairWorkerService extends IService<RepairWorker> {
|
|||||||
* @param userList 选中用户集合
|
* @param userList 选中用户集合
|
||||||
**/
|
**/
|
||||||
void saveWorkers(List<UserDTO> userList);
|
void saveWorkers(List<UserDTO> userList);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据用户id查询对应维修的角色,维修工人则查询班组,非维修工人查询角色
|
||||||
|
* @author PQZ
|
||||||
|
* @date 17:21 2024/11/4
|
||||||
|
* @param userId 用户id
|
||||||
|
* @return java.lang.String
|
||||||
|
**/
|
||||||
|
String getWorkerRoleName(Long userId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新维修工人
|
* 更新维修工人
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import cn.iocoder.yudao.module.base.entity.RepairRecordsItem;
|
|||||||
import cn.iocoder.yudao.module.base.mapper.RepairRecordsMapper;
|
import cn.iocoder.yudao.module.base.mapper.RepairRecordsMapper;
|
||||||
import cn.iocoder.yudao.module.base.service.RepairRecordsItemService;
|
import cn.iocoder.yudao.module.base.service.RepairRecordsItemService;
|
||||||
import cn.iocoder.yudao.module.base.service.RepairRecordsService;
|
import cn.iocoder.yudao.module.base.service.RepairRecordsService;
|
||||||
|
import cn.iocoder.yudao.module.base.service.RepairWorkerService;
|
||||||
import cn.iocoder.yudao.module.base.vo.RepairRecordsPageReqVO;
|
import cn.iocoder.yudao.module.base.vo.RepairRecordsPageReqVO;
|
||||||
import cn.iocoder.yudao.module.base.vo.RepairRecordsRespVO;
|
import cn.iocoder.yudao.module.base.vo.RepairRecordsRespVO;
|
||||||
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||||
@ -36,6 +37,8 @@ public class RepairRecordsServiceImpl extends ServiceImpl<RepairRecordsMapper, R
|
|||||||
private AdminUserApi userApi;
|
private AdminUserApi userApi;
|
||||||
@Resource
|
@Resource
|
||||||
private RepairRecordsItemService itemService;
|
private RepairRecordsItemService itemService;
|
||||||
|
@Resource
|
||||||
|
private RepairWorkerService workerService;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -82,6 +85,7 @@ public class RepairRecordsServiceImpl extends ServiceImpl<RepairRecordsMapper, R
|
|||||||
List<RepairRecordsRespVO> list = repairRecordsMapper.queryRepairRecords(pageReqVO);
|
List<RepairRecordsRespVO> list = repairRecordsMapper.queryRepairRecords(pageReqVO);
|
||||||
//为每一条维修记录设置查询附件
|
//为每一条维修记录设置查询附件
|
||||||
list.forEach(item -> {
|
list.forEach(item -> {
|
||||||
|
item.setRoleName(workerService.getWorkerRoleName(item.getDealUserId()));
|
||||||
List<RepairRecordsItem> itemList = itemService.getByMainId(REPAIR_RECORD_TYPE_RECORD, item.getId(), pageReqVO.getIsOpen());
|
List<RepairRecordsItem> itemList = itemService.getByMainId(REPAIR_RECORD_TYPE_RECORD, item.getId(), pageReqVO.getIsOpen());
|
||||||
item.setItemList(itemList);
|
item.setItemList(itemList);
|
||||||
//相对路径按照“,”分隔
|
//相对路径按照“,”分隔
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
package cn.iocoder.yudao.module.base.service.impl;
|
package cn.iocoder.yudao.module.base.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import cn.iocoder.yudao.common.RepairRoleEnum;
|
||||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
import cn.iocoder.yudao.framework.security.core.LoginUser;
|
import cn.iocoder.yudao.framework.security.core.LoginUser;
|
||||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||||
@ -15,6 +16,9 @@ import cn.iocoder.yudao.module.system.api.dict.DictDataApi;
|
|||||||
import cn.iocoder.yudao.module.system.api.dict.dto.DictDataRespDTO;
|
import cn.iocoder.yudao.module.system.api.dict.dto.DictDataRespDTO;
|
||||||
import cn.iocoder.yudao.module.system.api.notify.NotifyMessageSendApi;
|
import cn.iocoder.yudao.module.system.api.notify.NotifyMessageSendApi;
|
||||||
import cn.iocoder.yudao.module.system.api.notify.dto.NotifySendSingleToUserReqDTO;
|
import cn.iocoder.yudao.module.system.api.notify.dto.NotifySendSingleToUserReqDTO;
|
||||||
|
import cn.iocoder.yudao.module.system.api.permission.PermissionApi;
|
||||||
|
import cn.iocoder.yudao.module.system.api.permission.RoleApi;
|
||||||
|
import cn.iocoder.yudao.module.system.api.permission.dto.RoleReqDTO;
|
||||||
import cn.iocoder.yudao.module.system.api.user.dto.UserDTO;
|
import cn.iocoder.yudao.module.system.api.user.dto.UserDTO;
|
||||||
import cn.iocoder.yudao.module.tickets.entity.DlRepairTitem;
|
import cn.iocoder.yudao.module.tickets.entity.DlRepairTitem;
|
||||||
import cn.iocoder.yudao.module.tickets.service.DlRepairTitemService;
|
import cn.iocoder.yudao.module.tickets.service.DlRepairTitemService;
|
||||||
@ -57,6 +61,13 @@ public class RepairWorkerServiceImpl extends ServiceImpl<RepairWorkerMapper, Rep
|
|||||||
@Resource
|
@Resource
|
||||||
private DictDataApi dictDataApi;
|
private DictDataApi dictDataApi;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
@Lazy
|
||||||
|
private RoleApi roleApi;
|
||||||
|
@Resource
|
||||||
|
@Lazy
|
||||||
|
private PermissionApi permissionApi;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量创建维修工人
|
* 批量创建维修工人
|
||||||
@ -87,6 +98,52 @@ public class RepairWorkerServiceImpl extends ServiceImpl<RepairWorkerMapper, Rep
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据用户id查询对应维修的角色,维修工人则查询班组,非维修工人查询角色
|
||||||
|
*
|
||||||
|
* @param userId 用户id
|
||||||
|
* @return java.lang.String
|
||||||
|
* @author PQZ
|
||||||
|
* @date 17:21 2024/11/4
|
||||||
|
**/
|
||||||
|
@Override
|
||||||
|
public String getWorkerRoleName(Long userId) {
|
||||||
|
RepairWorkerRespVO worker = workerMapper.getByUserId(userId);
|
||||||
|
//如果为空说明不是维修工,查询当前用户的角色
|
||||||
|
if (null != worker){
|
||||||
|
return worker.getWorkerTypeStr();
|
||||||
|
} else {
|
||||||
|
List<Long> roleIds = permissionApi.getRoleIdsByUserId(userId);
|
||||||
|
// 所有的角色信息
|
||||||
|
List<RoleReqDTO> roleList = roleApi.getRoleList();
|
||||||
|
// 过滤出登录用户有的角色信息
|
||||||
|
List<RoleReqDTO> collect = roleList.stream().filter(item -> roleIds.contains(item.getId())).collect(Collectors.toList());
|
||||||
|
// 取出角色code
|
||||||
|
List<String> codes = collect.stream().map(RoleReqDTO::getCode).collect(Collectors.toList());
|
||||||
|
//维修业务管理员
|
||||||
|
if (codes.contains(RepairRoleEnum.ADMIN.getCode())) {
|
||||||
|
return RepairRoleEnum.ADMIN.getName();
|
||||||
|
}
|
||||||
|
// 总检
|
||||||
|
if (codes.contains(RepairRoleEnum.INSPECTION.getCode())) {
|
||||||
|
return RepairRoleEnum.INSPECTION.getName();
|
||||||
|
}
|
||||||
|
// 服务顾问
|
||||||
|
if (codes.contains(RepairRoleEnum.ADVISOR.getCode())) {
|
||||||
|
return RepairRoleEnum.ADVISOR.getName();
|
||||||
|
}
|
||||||
|
// 维修仓库管理员
|
||||||
|
if (codes.contains(RepairRoleEnum.WAREHOUSE.getCode())) {
|
||||||
|
return RepairRoleEnum.WAREHOUSE.getName();
|
||||||
|
}
|
||||||
|
// 维修财务
|
||||||
|
if (codes.contains(RepairRoleEnum.WXCW.getCode())) {
|
||||||
|
return RepairRoleEnum.WXCW.getName();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateWorker(RepairWorkerSaveReqVO updateReqVO) {
|
public void updateWorker(RepairWorkerSaveReqVO updateReqVO) {
|
||||||
// 更新
|
// 更新
|
||||||
|
|||||||
@ -16,5 +16,7 @@ public class RepairRecordsRespVO extends RepairRecords {
|
|||||||
private List<RepairRecordsItem> itemList;
|
private List<RepairRecordsItem> itemList;
|
||||||
/**维修记录关联附件信息*/
|
/**维修记录关联附件信息*/
|
||||||
private String images;
|
private String images;
|
||||||
|
/**角色、岗位名称*/
|
||||||
|
private String roleName;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,7 +9,7 @@ import lombok.Data;
|
|||||||
@Data
|
@Data
|
||||||
@ExcelIgnoreUnannotated
|
@ExcelIgnoreUnannotated
|
||||||
public class RepairWorkerRespVO extends RepairWorker {
|
public class RepairWorkerRespVO extends RepairWorker {
|
||||||
|
private String workerTypeStr;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -37,6 +37,17 @@
|
|||||||
WHERE
|
WHERE
|
||||||
main.deleted = 0
|
main.deleted = 0
|
||||||
</select>
|
</select>
|
||||||
|
<select id="getByUserId" resultType="cn.iocoder.yudao.module.base.vo.RepairWorkerRespVO">
|
||||||
|
SELECT
|
||||||
|
main.*,
|
||||||
|
sdd.label AS workerTypeStr
|
||||||
|
FROM
|
||||||
|
dl_repair_worker main
|
||||||
|
LEFT JOIN system_dict_data sdd ON sdd.dict_type = 'repair_work_type' AND main.work_type = sdd.`value`
|
||||||
|
WHERE
|
||||||
|
main.deleted = 0
|
||||||
|
AND main.user_id = #{userId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user