维修工接单/维修班组长重新指派,维修工填写配件申请单 1/2

This commit is contained in:
xiaofajia 2024-10-12 19:59:20 +08:00
parent f772f616ac
commit 4e50de5bfe
8 changed files with 206 additions and 2 deletions

View File

@ -0,0 +1,19 @@
package cn.iocoder.yudao.common;
/**
* 维修系统中的通用常量类
*
* @author 小李
* @date 16:51 2024/10/12
**/
public class RepairConstants {
public static final String SERVICE_ADVISOR = "维修服务顾问";
public static final String GENERAL_INSPECTION = "维修总检";
public static final String TEAM_LEADER = "班组长";
public static final String REPAIR_STAFF = "维修工";
}

View File

@ -115,5 +115,23 @@ public class DlRepairTicketsController {
dlRepairTicketsService.updateCustomerAndCar(customerAndCarVO);
return CommonResult.ok();
}
/**
* 分类查询工单分页
*
* @author 小李
* @date 16:26 2024/10/12
* @param repairTicketsReqVO 查询对象
* @param pageNo 页码
* @param pageSize 条数
**/
@GetMapping("/pageType")
@Operation(summary = "分类查询工单分页")
public CommonResult<?> getPageType(DlRepairTicketsReqVO repairTicketsReqVO,
@RequestParam(value = "pageNo", defaultValue = "1")Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10")Integer pageSize){
Page<DlRepairTickets> page = new Page<>(pageNo, pageSize);
return success(dlRepairTicketsService.getPageType(repairTicketsReqVO, page));
}
}

View File

@ -175,4 +175,7 @@ public class DlRepairTickets extends TenantBaseDO {
/** 工单进行状态 */
private String ticketsWorkStatus;
/** 工单完成情况0:未完成1:已完成) */
private String isFinish;
}

View File

@ -25,6 +25,15 @@ public interface DlRepairTicketsMapper extends BaseMapper<DlRepairTickets> {
* @param repairTicketsReqVO 查询对象
**/
IPage<DlRepairTickets> getTicketsPage(@Param("map") DlRepairTicketsReqVO repairTicketsReqVO, Page<DlRepairTickets> page);
/**
* 分类查询工单分页
*
* @author 小李
* @date 16:26 2024/10/12
* @param repairTicketsReqVO 查询对象
**/
IPage<DlRepairTickets> getPageType(@Param("map") DlRepairTicketsReqVO repairTicketsReqVO, Page<DlRepairTickets> page);
}

View File

@ -69,4 +69,13 @@ public interface DlRepairTicketsService extends IService<DlRepairTickets> {
* @param customerAndCarVO 用户信息和车辆信息
**/
void updateCustomerAndCar(CustomerAndCarVO customerAndCarVO);
/**
* 分类查询工单分页
*
* @author 小李
* @date 16:26 2024/10/12
* @param repairTicketsReqVO 查询对象
**/
IPage<DlRepairTickets> getPageType(DlRepairTicketsReqVO repairTicketsReqVO, Page<DlRepairTickets> page);
}

View File

@ -3,8 +3,11 @@ 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.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.base.entity.RepairWorker;
import cn.iocoder.yudao.module.base.service.RepairWorkerService;
import cn.iocoder.yudao.module.booking.entity.DlRepairBooking;
import cn.iocoder.yudao.module.booking.service.DlRepairBookingService;
import cn.iocoder.yudao.module.custom.entity.CustomerCar;
@ -24,6 +27,9 @@ import cn.iocoder.yudao.module.system.api.dept.DeptApi;
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
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.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.AdminUserApi;
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
import cn.iocoder.yudao.module.system.api.user.dto.UserDTO;
@ -42,12 +48,15 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
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 java.math.BigDecimal;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
@ -109,6 +118,18 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
@Lazy
private AdminUserApi adminUserApi;
@Resource
@Lazy
private PermissionApi permissionApi;
@Resource
@Lazy
private RoleApi roleApi;
@Resource
@Lazy
private RepairWorkerService repairWorkerService;
/**
* 维修工单表 新增
*
@ -325,6 +346,47 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
}
}
}
/**
* 分类查询工单分页
*
* @author 小李
* @date 16:26 2024/10/12
* @param repairTicketsReqVO 查询对象
**/
@Override
public IPage<DlRepairTickets> getPageType(DlRepairTicketsReqVO repairTicketsReqVO, Page<DlRepairTickets> page){
// 查看当前登录用户是什么角色
// 当前登录用户的角色信息
List<Long> byUserId = permissionApi.getRoleIdsByUserId(SecurityFrameworkUtils.getLoginUserId());
// 所有的角色信息
List<RoleReqDTO> roleList = roleApi.getRoleList();
// 过滤出登录用户有的角色信息
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());
if (names.contains(RepairConstants.SERVICE_ADVISOR)){
// 服务顾问的ID
repairTicketsReqVO.setAdviserId(String.valueOf(SecurityFrameworkUtils.getLoginUserId()));
}else if (names.contains(RepairConstants.TEAM_LEADER)){
// 班组长
// 查自己是什么班组的组长
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());
// 可能指定的时候指定的有班组长所以还要加班组长的id也加进去
userIds.add(one.getUserId());
repairTicketsReqVO.setUserIds(userIds);
}else if (names.contains(RepairConstants.REPAIR_STAFF)){
// 维修工的ID
repairTicketsReqVO.setUserIds(Collections.singletonList(SecurityFrameworkUtils.getLoginUserId()));
}else if (names.contains(RepairConstants.GENERAL_INSPECTION)){
// 维修总检不操作
}else return null;
return baseMapper.getPageType(repairTicketsReqVO, page);
}
}

View File

@ -6,6 +6,7 @@ import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import java.util.List;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@ -21,4 +22,7 @@ public class DlRepairTicketsReqVO extends DlRepairTickets {
@Schema(pattern = "时间区间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date[] searchTimeArray;
/** 工单中项目指定的施工人员的ids */
private List<Long> userIds;
}

View File

@ -42,6 +42,7 @@
<result property="profit" column="profit" />
<result property="partStatus" column="part_status" />
<result property="ticketsWorkStatus" column="tickets_work_status" />
<result property="isFinish" column="is_finish" />
</resultMap>
<sql id="Base_SQL">
@ -81,7 +82,8 @@
cost,
profit,
part_status,
tickets_work_status
tickets_work_status,
is_finish
from dl_repair_tickets drt
where drt.deleted = '0'
</sql>
@ -124,4 +126,82 @@
</if>
order by drt.create_time desc
</select>
<select id="getPageType" resultMap="BaseResultMap">
select drt.id as id,
ticket_no,
repair_type,
user_id,
user_name,
user_mobile,
car_id,
car_no,
car_vin,
car_brand_id,
car_brand_name,
car_brand_type,
adviser_id,
adviser_name,
pay_type,
repair_advice,
quality_mileage,
quality_day,
end_check,
part_disposal,
drt.remark as remark,
ticket_type,
corp_id,
dept_id,
count,
project_price,
part_price,
other_price,
total_price,
tickets_status,
drt.create_time as create_time,
in_time,
out_time,
cost,
profit,
part_status,
tickets_work_status,
is_finish
from dl_repair_tickets drt
left join dl_repair_titem drti
on drt.id = drti.ticket_id
where drt.deleted = '0'
<if test="map.ticketNo != null and map.ticketNo != ''">
and (
drt.ticket_no like concat('%', #{map.ticketNo}, '%')
or
drt.car_no like concat('%', #{map.ticketNo}, '%')
or
drt.user_name like concat('%', #{map.ticketNo}, '%')
or
drt.user_mobile like concat('%', #{map.ticketNo}, '%')
or
drt.remark like concat('%', #{map.ticketNo}, '%')
)
</if>
<if test="map.searchTimeArray != null and map.searchTimeArray.length > 0">
and drt.create_time between #{map.searchTimeArray[0]} and #{map.searchTimeArray[1]}
</if>
<if test="map.adviserId != null and map.adviserId != ''">
and drt.adviser_id = #{map.adviserId}
</if>
<if test="map.isFinish != null and map.isFinish != ''">
and drt.is_finish = #{map.isFinish}
</if>
<if test="map.userIds != null and map.userIds.size > 0">
and (
<foreach item="item" collection="map.userIds" index="index" open="" separator="or" close="">
instr(drti.repair_ids, concat(',', #{item}, ',')) > 0
</foreach>
)
</if>
</select>
<sql id="IDS_TO_SQL">
</sql>
</mapper>