Merge branch 'dev' of http://122.51.230.86:3000/dianliang/lanan-system into dev
This commit is contained in:
commit
1f4a63a296
@ -13,6 +13,8 @@ import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.module.core.text.Convert;
|
||||
import cn.iocoder.yudao.module.core.text.ServletUtils;
|
||||
import cn.iocoder.yudao.module.label.vo.LabelRespVO;
|
||||
import cn.iocoder.yudao.module.partner.entity.PartnerCustomerInfo;
|
||||
import cn.iocoder.yudao.module.partner.service.IPartnerCustomerInfoService;
|
||||
import cn.iocoder.yudao.module.partner.service.IPartnerWorkerService;
|
||||
import cn.iocoder.yudao.module.payment.service.OrderInfoService;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.dict.DictDataDO;
|
||||
@ -57,6 +59,8 @@ public class InspectionMallPartnersController extends BaseController {
|
||||
private PermissionService permissionService;
|
||||
@Autowired
|
||||
private RoleService roleService;
|
||||
@Autowired
|
||||
private IPartnerCustomerInfoService partnerCustomerInfoService;
|
||||
|
||||
/**
|
||||
* 查询合作商管理列表
|
||||
@ -128,6 +132,8 @@ public class InspectionMallPartnersController extends BaseController {
|
||||
return CommonResult.success(list);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@GetMapping("/delWorkOrder")
|
||||
public CommonResult<IPage<?>> delWorkOrder(String carNum,String goodsTitle,String customerSource,String payType,String startTime,Long roleId,String endTime,Integer pageSize,Integer pageNum)
|
||||
{
|
||||
|
@ -2,14 +2,9 @@ package cn.iocoder.yudao.module.partner.controller;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.core.controller.BaseController;
|
||||
import cn.iocoder.yudao.module.core.page.TableDataInfo;
|
||||
import cn.iocoder.yudao.module.core.text.Convert;
|
||||
import cn.iocoder.yudao.module.core.text.ServletUtils;
|
||||
import cn.iocoder.yudao.module.inspection.service.AppInspectionPartnerService;
|
||||
import cn.iocoder.yudao.module.label.vo.LabelRespVO;
|
||||
import cn.iocoder.yudao.module.partner.entity.PartnerCustomerInfo;
|
||||
import cn.iocoder.yudao.module.partner.service.IPartnerCustomerInfoService;
|
||||
import cn.iocoder.yudao.module.shop.entity.ShopMallPartners;
|
||||
import cn.iocoder.yudao.util.ExcelUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@ -18,8 +13,6 @@ import org.springframework.web.bind.annotation.*;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
/**
|
||||
* 客户信息Controller
|
||||
*
|
||||
@ -51,6 +44,7 @@ public class PartnerCustomerInfoController extends BaseController
|
||||
// return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导出客户信息列表
|
||||
*/
|
||||
|
@ -43,6 +43,7 @@ public class PartnerCustomerInfo extends TenantBaseDO
|
||||
@Excel(name = "性别")
|
||||
private String sex;
|
||||
|
||||
|
||||
/** 年龄 */
|
||||
@Excel(name = "年龄")
|
||||
private Integer userAge;
|
||||
@ -57,5 +58,7 @@ public class PartnerCustomerInfo extends TenantBaseDO
|
||||
private String roleCode;
|
||||
@TableField(exist = false)
|
||||
private String roleName;
|
||||
@TableField(exist = false)
|
||||
private int orderCount;
|
||||
|
||||
}
|
||||
|
@ -1,8 +1,6 @@
|
||||
package cn.iocoder.yudao.module.partner.mapper;
|
||||
|
||||
|
||||
import cn.iocoder.yudao.module.label.vo.LabelPageReqVO;
|
||||
import cn.iocoder.yudao.module.label.vo.LabelRespVO;
|
||||
import cn.iocoder.yudao.module.partner.entity.PartnerCustomerInfo;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
@ -56,4 +54,6 @@ public interface PartnerCustomerInfoMapper extends BaseMapper<PartnerCustomerInf
|
||||
* @return 结果
|
||||
*/
|
||||
public int deletePartnerCustomerInfoByIds(Long[] ids);
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,7 +1,5 @@
|
||||
package cn.iocoder.yudao.module.partner.service;
|
||||
|
||||
import cn.iocoder.yudao.module.label.vo.LabelPageReqVO;
|
||||
import cn.iocoder.yudao.module.label.vo.LabelRespVO;
|
||||
import cn.iocoder.yudao.module.partner.entity.PartnerCustomerInfo;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@ -60,4 +58,7 @@ public interface IPartnerCustomerInfoService extends IService<PartnerCustomerInf
|
||||
*/
|
||||
public int deletePartnerCustomerInfoByIds(Long[] ids);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -53,6 +53,8 @@ public class PartnerCustomerInfoServiceImpl extends ServiceImpl<PartnerCustomerI
|
||||
private PermissionService permissionService;
|
||||
@Resource
|
||||
private PartnerCustomerInfoMapper customerInfoMapper;
|
||||
@Autowired
|
||||
private PartnerCustomerInfoMapper partnerCustomerInfoMapper;
|
||||
|
||||
/**
|
||||
* 查询客户信息列表
|
||||
@ -241,4 +243,8 @@ public class PartnerCustomerInfoServiceImpl extends ServiceImpl<PartnerCustomerI
|
||||
{
|
||||
return baseMapper.deletePartnerCustomerInfoByIds(ids);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -48,6 +49,9 @@ public interface OrderInfoService extends IService<OrderInfo> {
|
||||
**/
|
||||
IPage<OrderInfo> queryListPage(OrderInfo orderInfo, Page<OrderInfo> page);
|
||||
|
||||
|
||||
|
||||
|
||||
Long createOrder(OrderInfo orderInfo) throws Exception;
|
||||
|
||||
JSONObject pickCarDetail(Long pickCarId);
|
||||
|
@ -181,6 +181,7 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
||||
return baseMapper.pageOrderListSystem(orderInfo,page);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Long createOrder(OrderInfo orderInfo) throws Exception {
|
||||
|
@ -50,12 +50,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
resultType="cn.iocoder.yudao.module.partner.entity.PartnerCustomerInfo">
|
||||
select pci.*,
|
||||
sr.name as roleName,
|
||||
sr.code as roleCode
|
||||
sr.code as roleCode,
|
||||
COUNT(ins.id) AS orderCount
|
||||
from partner_customer_info pci
|
||||
left join shop_user_car suc on suc.user_id = pci.user_id
|
||||
left join system_users su on su.id = pci.user_id
|
||||
left join system_user_role sur on sur.user_id = su.id
|
||||
left join system_role sr on sr.id = sur.role_id
|
||||
LEFT JOIN inspection_info ins ON ins.user_id = pci.user_id AND YEAR(ins.create_time) =YEAR(NOW())
|
||||
<where>
|
||||
<if test="vo.carNum != null and vo.carNum != ''"> and suc.car_no like concat('%', #{vo.carNum}, '%')</if>
|
||||
<if test="vo.customerName != null and vo.customerName != ''"> and pci.customer_name like concat('%', #{vo.customerName}, '%')</if>
|
||||
@ -126,4 +128,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
|
@ -0,0 +1,100 @@
|
||||
package cn.iocoder.yudao.module.app.controller.admin;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.websocket.*;
|
||||
import javax.websocket.server.PathParam;
|
||||
import javax.websocket.server.ServerEndpoint;
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
|
||||
/**
|
||||
* 维修APP消息监听
|
||||
* @author vinjor-M
|
||||
* @date 10:22 2024/10/17
|
||||
**/
|
||||
@ServerEndpoint(value = "/websocket/message/{tenantId}/{userId}")
|
||||
@Component
|
||||
public class NotifyMessageSocket {
|
||||
private final static Logger log = LoggerFactory.getLogger(NotifyMessageSocket.class);
|
||||
// 保存链接的session,key为用户名,value为对应的session名
|
||||
public static ConcurrentHashMap<String, Session> sessionMap = new ConcurrentHashMap<>();
|
||||
//关键代码,设置一个静态上下文属性appcontext
|
||||
private static ApplicationContext appcontext;
|
||||
public static void setAppcontext(ApplicationContext appcontext) {
|
||||
NotifyMessageSocket.appcontext = appcontext;
|
||||
}
|
||||
public static ApplicationContext getAppcontext() {
|
||||
return appcontext;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 创建连接
|
||||
* 用于监听建立连接,当有客户端与该服务端点建立连接时,将会自回调该注解标注的方法
|
||||
* @param session
|
||||
* @param userId
|
||||
*/
|
||||
@OnOpen
|
||||
public void onOpen(Session session, @PathParam(value = "tenantId") String tenantId,@PathParam(value = "userId") String userId) {
|
||||
this.sessionMap.put(tenantId+"_"+userId,session);
|
||||
log.info("{}租户下用户{}已创建连接", tenantId,userId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 用于监听客户端向服务端发送消息,当客户端与服务端发送消息时,将会回调该注解标注的方法
|
||||
* {
|
||||
* Stringitude:124.11,
|
||||
* latitude:125.33,
|
||||
* positionInfo:"山东省济南市市中区八一立交桥"
|
||||
* }
|
||||
* @param msg
|
||||
* @param userId
|
||||
*/
|
||||
@OnMessage
|
||||
public void onMessage(String msg,@PathParam(value = "userId") String userId){
|
||||
System.out.println("消息通知+"+userId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 用于监听连接关闭,当客户端与该服务端点断开连接时,将会回调该注解标注的方法
|
||||
* @param session
|
||||
* @param userId
|
||||
*/
|
||||
@OnClose
|
||||
public void onClose(Session session,@PathParam(value = "tenantId") String tenantId,@PathParam(value = "userId") String userId){
|
||||
this.sessionMap.remove(tenantId+"_"+userId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 用于监听该连接上的任何错误,当客户端与该服务端点的连接发生任何异常,都将回调该注解标注的方法
|
||||
* 注意该方法的参数必选Throwable,可选Sessiion以及0-n个String参数,且String参数需要使用@PathParam注解标注
|
||||
* @param throwable
|
||||
* @param tenantId 租户id
|
||||
* @param userId 用户id
|
||||
*/
|
||||
@OnError
|
||||
public void onError(Throwable throwable,@PathParam(value = "tenantId") String tenantId,@PathParam(value = "userId") String userId){
|
||||
log.error("{}租户下用户{}已创建连接", tenantId,userId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送给指定的用户
|
||||
* @param message
|
||||
*/
|
||||
public void sendMessage(String message, String tenantId,String userId) throws IOException {
|
||||
if (sessionMap.containsKey(tenantId+"_"+userId)){
|
||||
Session session = sessionMap.get(tenantId+"_"+userId);
|
||||
session.getAsyncRemote().sendText(message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,7 +1,10 @@
|
||||
package cn.iocoder.yudao.module.base.controller.admin;
|
||||
|
||||
import cn.iocoder.yudao.common.MessageSend;
|
||||
import cn.iocoder.yudao.common.dto.MessageDTO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.app.controller.admin.NotifyMessageSocket;
|
||||
import cn.iocoder.yudao.module.base.entity.RepairWorker;
|
||||
import cn.iocoder.yudao.module.base.service.RepairWorkerService;
|
||||
import cn.iocoder.yudao.module.base.vo.RepairWorkerPageReqVO;
|
||||
@ -13,12 +16,17 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.common.BaseConstants.QUALS_INTERIM_PERIOD;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.ok;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "管理后台 - 维修工人")
|
||||
@ -29,6 +37,10 @@ public class RepairWorkerController {
|
||||
|
||||
@Resource
|
||||
private RepairWorkerService workerService;
|
||||
@Autowired
|
||||
private NotifyMessageSocket notifyMessageSocket;
|
||||
@Autowired
|
||||
private MessageSend messageSend;
|
||||
|
||||
|
||||
/**
|
||||
@ -124,4 +136,30 @@ public class RepairWorkerController {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 测试给维修工发送消息---测试
|
||||
* @author vinjor-M
|
||||
* @date 18:08 2024/10/16
|
||||
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
|
||||
**/
|
||||
@GetMapping("/sendMessage")
|
||||
@Operation(summary = "测试给维修工发送消息")
|
||||
public CommonResult<?> sendMessage(Long userId) {
|
||||
try {
|
||||
MessageDTO messageDTO = new MessageDTO();
|
||||
List<Long> userIds = new ArrayList<>();
|
||||
userIds.add(userId);
|
||||
messageDTO.setUserIds(userIds);
|
||||
messageDTO.setTemplateCode(QUALS_INTERIM_PERIOD);
|
||||
List<Object> paramList = new ArrayList<>();
|
||||
paramList.add("测试");
|
||||
paramList.add("3");
|
||||
messageDTO.setParamList(paramList);
|
||||
messageSend.send(messageDTO);
|
||||
notifyMessageSocket.sendMessage("11","180",userId.toString());
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return ok();
|
||||
}
|
||||
}
|
@ -97,7 +97,7 @@ public interface DlRepairTicketsService extends IService<DlRepairTickets> {
|
||||
* @author 小李
|
||||
* @date 9:28 2024/10/14
|
||||
**/
|
||||
Integer getUserRole();
|
||||
String getUserRole();
|
||||
|
||||
/**
|
||||
* 接单
|
||||
|
@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.tickets.service.impl;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.iocoder.yudao.common.RepairConstants;
|
||||
import cn.iocoder.yudao.common.RepairErrorCodeConstants;
|
||||
import cn.iocoder.yudao.common.RepairRoleEnum;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.module.base.entity.RepairWorker;
|
||||
import cn.iocoder.yudao.module.base.service.RepairWorkerService;
|
||||
@ -51,21 +51,14 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.deepoove.poi.XWPFTemplate;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.security.core.Authentication;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.print.Doc;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.iocoder.yudao.common.BaseConstants.ORDER_TENANT_NAME;
|
||||
@ -138,6 +131,8 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
@Resource
|
||||
@Lazy
|
||||
private RepairWorkerService repairWorkerService;
|
||||
@Resource
|
||||
private RepairWorkerService workerService;
|
||||
|
||||
/**
|
||||
* 维修工单表 新增
|
||||
@ -395,28 +390,29 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
**/
|
||||
@Override
|
||||
public IPage<DlRepairTickets> getPageType(DlRepairTicketsReqVO repairTicketsReqVO, Page<DlRepairTickets> page){
|
||||
Integer userRole = getUserRole();
|
||||
switch (userRole){
|
||||
case 1:
|
||||
break;
|
||||
case 2:
|
||||
repairTicketsReqVO.setAdviserId(String.valueOf(SecurityFrameworkUtils.getLoginUserId()));
|
||||
break;
|
||||
case 3:
|
||||
// 查自己是什么班组的组长
|
||||
String userRoleCode = getUserRole();
|
||||
if(userRoleCode.equals(RepairRoleEnum.ADMIN.getCode())|| userRoleCode.equals(RepairRoleEnum.INSPECTION.getCode())){
|
||||
//维修管理员和总检,看所有数据
|
||||
}else if(userRoleCode.equals(RepairRoleEnum.ADVISOR.getCode())){
|
||||
//服务顾问看自己的
|
||||
repairTicketsReqVO.setAdviserId(String.valueOf(SecurityFrameworkUtils.getLoginUserId()));
|
||||
}else if(userRoleCode.equals(RepairRoleEnum.REPAIR_STAFF.getCode())){
|
||||
//维修工,进一步判断是否是班组长
|
||||
boolean ifLeader = workerService.getIfLeader();
|
||||
if(ifLeader){
|
||||
//班组长,看本班组所有数据
|
||||
RepairWorker one = repairWorkerService.getOne(new LambdaQueryWrapper<RepairWorker>().eq(RepairWorker::getUserId, SecurityFrameworkUtils.getLoginUserId()));
|
||||
// 查自己班组的员工信息
|
||||
List<RepairWorker> list = repairWorkerService.list(new LambdaQueryWrapper<RepairWorker>().eq(RepairWorker::getWorkType, one.getWorkType()));
|
||||
// 所有的员工信息
|
||||
List<Long> userIds = list.stream().map(RepairWorker::getUserId).collect(Collectors.toList());
|
||||
repairTicketsReqVO.setUserIds(userIds);
|
||||
break;
|
||||
case 4:
|
||||
}else{
|
||||
//普通维修工
|
||||
repairTicketsReqVO.setUserIds(Collections.singletonList(SecurityFrameworkUtils.getLoginUserId()));
|
||||
break;
|
||||
case -1:
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}else{
|
||||
return null;
|
||||
}
|
||||
return baseMapper.getPageType(repairTicketsReqVO, page);
|
||||
}
|
||||
@ -428,7 +424,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
* @date 9:28 2024/10/14
|
||||
**/
|
||||
@Override
|
||||
public Integer getUserRole(){
|
||||
public String getUserRole(){
|
||||
// 查看当前登录用户是什么角色
|
||||
// 当前登录用户的角色信息
|
||||
List<Long> byUserId = permissionApi.getRoleIdsByUserId(SecurityFrameworkUtils.getLoginUserId());
|
||||
@ -437,29 +433,33 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
// 过滤出登录用户有的角色信息
|
||||
List<RoleReqDTO> collect = roleList.stream().filter(item -> byUserId.contains(item.getId())).collect(Collectors.toList());
|
||||
// 取出角色名称
|
||||
List<String> names = collect.stream().map(RoleReqDTO::getName).collect(Collectors.toList());
|
||||
List<String> codes = collect.stream().map(RoleReqDTO::getCode).collect(Collectors.toList());
|
||||
// 维修业务管理员--可以看所有数据,但不能做操作
|
||||
if (codes.contains(RepairRoleEnum.ADMIN.getCode())){
|
||||
return RepairRoleEnum.ADMIN.getCode();
|
||||
}
|
||||
// 总检
|
||||
if (names.contains(RepairConstants.GENERAL_INSPECTION)){
|
||||
return 1;
|
||||
if (codes.contains(RepairRoleEnum.INSPECTION.getCode())){
|
||||
return RepairRoleEnum.INSPECTION.getCode();
|
||||
}
|
||||
// 服务顾问
|
||||
if (names.contains(RepairConstants.SERVICE_ADVISOR)){
|
||||
return 2;
|
||||
if (codes.contains(RepairRoleEnum.ADVISOR.getName())){
|
||||
return RepairRoleEnum.ADVISOR.getName();
|
||||
}
|
||||
// 班组长
|
||||
if (names.contains(RepairConstants.TEAM_LEADER)){
|
||||
return 3;
|
||||
}
|
||||
// 维修工
|
||||
if (names.contains(RepairConstants.REPAIR_STAFF)){
|
||||
return 4;
|
||||
// 维修工(或班组长)
|
||||
if (codes.contains(RepairRoleEnum.REPAIR_STAFF.getCode())){
|
||||
return RepairRoleEnum.REPAIR_STAFF.getCode();
|
||||
}
|
||||
// 维修仓库管理员
|
||||
if(names.contains(RepairConstants.REPAIR_WAREHOUSE)){
|
||||
return 5;
|
||||
if(codes.contains(RepairRoleEnum.WAREHOUSE.getCode())){
|
||||
return RepairRoleEnum.WAREHOUSE.getCode();
|
||||
}
|
||||
// 维修财务
|
||||
if(codes.contains(RepairRoleEnum.WXCW.getCode())){
|
||||
return RepairRoleEnum.WXCW.getCode();
|
||||
}
|
||||
// 啥也不是
|
||||
return -1;
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.tickets.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.iocoder.yudao.common.RepairRoleEnum;
|
||||
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.iocoder.yudao.module.base.entity.RepairWorker;
|
||||
import cn.iocoder.yudao.module.base.service.RepairWorkerService;
|
||||
@ -75,6 +76,8 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
|
||||
@Resource
|
||||
@Lazy
|
||||
private RepairWaresService repairWaresService;
|
||||
@Resource
|
||||
private RepairWorkerService workerService;
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
@ -86,35 +89,33 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
|
||||
@Override
|
||||
public IPage<DlTicketWares> getPage(DlTicketWaresReqVO reqVO, Page<DlTicketWares> page){
|
||||
// 确认查看者身份
|
||||
Integer userRole = repairTicketsService.getUserRole();
|
||||
// 啥也不是
|
||||
if (userRole == -1){
|
||||
return null;
|
||||
}
|
||||
switch (userRole){
|
||||
// 服务顾问
|
||||
case 2:
|
||||
reqVO.setAdviserId(SecurityFrameworkUtils.getLoginUserId());
|
||||
break;
|
||||
// 班组长
|
||||
case 3:
|
||||
// 查自己是什么班组的组长
|
||||
String userRoleCode = repairTicketsService.getUserRole();
|
||||
if(userRoleCode.equals(RepairRoleEnum.ADMIN.getCode())|| userRoleCode.equals(RepairRoleEnum.INSPECTION.getCode())){
|
||||
//维修管理员和总检,看所有数据
|
||||
}else if(userRoleCode.equals(RepairRoleEnum.ADVISOR.getCode())){
|
||||
//服务顾问
|
||||
reqVO.setAdviserId(SecurityFrameworkUtils.getLoginUserId());
|
||||
}else if(userRoleCode.equals(RepairRoleEnum.REPAIR_STAFF.getCode())){
|
||||
//维修工,进一步判断是否是班组长
|
||||
boolean ifLeader = workerService.getIfLeader();
|
||||
if(ifLeader){
|
||||
//班组长,看本班组所有数据
|
||||
RepairWorker one = repairWorkerService.getOne(new LambdaQueryWrapper<RepairWorker>().eq(RepairWorker::getUserId, SecurityFrameworkUtils.getLoginUserId()));
|
||||
// 查自己班组的员工信息
|
||||
List<RepairWorker> list = repairWorkerService.list(new LambdaQueryWrapper<RepairWorker>().eq(RepairWorker::getWorkType, one.getWorkType()));
|
||||
// 所有的员工信息
|
||||
List<Long> userIds = list.stream().map(RepairWorker::getUserId).collect(Collectors.toList());
|
||||
reqVO.setUserIds(userIds);
|
||||
break;
|
||||
// 维修工
|
||||
case 4:
|
||||
}else{
|
||||
//普通维修工
|
||||
reqVO.setUserIds(Collections.singletonList(SecurityFrameworkUtils.getLoginUserId()));
|
||||
break;
|
||||
}
|
||||
}else if(userRoleCode.equals(RepairRoleEnum.WAREHOUSE.getCode())){
|
||||
// 维修仓库管理员
|
||||
case 5:
|
||||
reqVO.setStatus(null);
|
||||
reqVO.setUserRole(5);
|
||||
break;
|
||||
reqVO.setStatus(null);
|
||||
reqVO.setUserRole(5);
|
||||
}else{
|
||||
return null;
|
||||
}
|
||||
return baseMapper.getPage(reqVO, page);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user