This commit is contained in:
Vinjor 2024-10-30 15:37:40 +08:00
parent 0548422b4b
commit c891ef584c
5 changed files with 60 additions and 19 deletions

View File

@ -59,9 +59,11 @@
AND main.phone_number LIKE concat('%',#{entity.phoneNumber},'%')
</if>
<if test="entity.phoneOrCar != null and entity.phoneOrCar != ''">
AND main.phone_number = #{entity.phoneOrCar}
OR car.license_number = #{entity.phoneOrCar}
OR car.vin = #{entity.phoneOrCar}
AND (
main.phone_number LIKE CONCAT('%',#{entity.phoneOrCar},'%')
OR car.license_number LIKE CONCAT('%',#{entity.phoneOrCar},'%')
OR car.vin LIKE CONCAT('%',#{entity.phoneOrCar},'%')
)
</if>
</where>
GROUP BY main.id

View File

@ -742,14 +742,25 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
} else if (userRoleCode.equals(RepairRoleEnum.REPAIR_STAFF.getCode())) {
//维修工进一步判断是否是班组长
boolean ifLeader = repairWorkerService.getIfLeader();
repairTicketsReqVO.setRoleCode(RepairRoleEnum.REPAIR_STAFF.getCode());
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());
String userIdsStr = "";
List<Long> userIds = new ArrayList<>();
for (RepairWorker worker:list){
userIds.add(worker.getUserId());
if("".equals(userIdsStr)){
userIdsStr = String.valueOf(worker.getUserId());
}else{
userIdsStr = ","+worker.getUserId();
}
}
repairTicketsReqVO.setUserIds(userIds);
repairTicketsReqVO.setUserIdsStr(userIdsStr);
} else {
//普通维修工
repairTicketsReqVO.setUserIds(Collections.singletonList(SecurityFrameworkUtils.getLoginUserId()));

View File

@ -25,6 +25,12 @@ public class DlRepairTicketsReqVO extends DlRepairTickets {
/** 工单中项目指定的施工人员的ids */
private List<Long> userIds;
/** 工单中项目指定的施工人员的ids字符串拼接 */
private String userIdsStr;
/** 查询类型(waiting 待处理的 | all 所有数据) */
private String selectType;
/** 人员角色code */
private String roleCode;
}

View File

@ -58,5 +58,7 @@ public class DlRepairTicketsRespVO extends DlRepairTickets {
/** 如果是完成并移交下一班组,就有移交给了那一个班组 */
private String nextName;
/** 维修班组长是否可以重新派工--当前施工人是自己或者本班组内的人员 */
private Boolean canOperate;
}

View File

@ -106,6 +106,7 @@
<result property="threePackMoney" column="three_pack_money" />
<result property="confirmFaultMoney" column="confirm_fault_money" />
<result property="billingRemark" column="billing_remark" />
<result property="canOperate" column="can_operate" />
<association property="booking" javaType="cn.iocoder.yudao.module.booking.entity.DlRepairBooking" select="selectBookingById" column="id"/>
<collection property="itemList" column="id" ofType="cn.iocoder.yudao.module.tickets.entity.DlRepairTitem" select="selectItemList" />
</resultMap>
@ -208,7 +209,13 @@
<select id="getPageType" resultMap="APPBaseResultMap">
-- 查待处理数据 --
select drt.*
<if test="map.roleCode=='repair_staff'">
-- 维修工,需要判断出当前用户是否可以重新派工 --
, IF(FIND_IN_SET(drt.now_repair_id, #{map.userIdsStr}) > 0,true,false) AS can_operate
</if>
from dl_repair_tickets drt
left join dl_repair_titem drti
on drt.id = drti.ticket_id AND drti.deleted = '0'
where (drt.deleted = '0') AND drt.tickets_status IN ('04','05','01','07')
<if test="map.ticketNo != null and map.ticketNo != ''">
and (
@ -238,22 +245,35 @@
</when>
<otherwise>
-- 正常查询用的逻辑 --
<if test="map.adviserId != null and map.adviserId != ''">
-- 查服务顾问 待处理的 工单未完成并且服务顾问是自己的 工单已完成且当前处理人是自己的--
AND ( drt.is_finish = '0' AND drt.adviser_id = #{map.adviserId} )
OR (drt.is_finish = '1' AND drt.now_repair_id = #{map.adviserId})
</if>
<if test="map.userIds != null and map.userIds.size > 0">
-- 查维修工、总检待处理的 --
AND (drt.is_finish = '0')
AND (drt.now_repair_id in
<foreach collection="map.userIds" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
)
</if>
<choose>
<when test="map.roleCode=='repair_staff'">
-- 维修工的查询逻辑,涉及维修项目的维修工是自己或者本班组内的--
AND (
<foreach item="item" collection="map.userIds" index="index" open="" separator="or" close="">
find_in_set(#{item}, drti.repair_ids) > 0
</foreach>
)
</when>
<otherwise>
<if test="map.adviserId != null and map.adviserId != ''">
-- 查服务顾问 待处理的 工单未完成并且服务顾问是自己的 工单已完成且当前处理人是自己的--
AND ( drt.is_finish = '0' AND drt.adviser_id = #{map.adviserId} )
OR (drt.is_finish = '1' AND drt.now_repair_id = #{map.adviserId})
</if>
<if test="map.userIds != null and map.userIds.size > 0">
-- 查总检待处理的 --
AND (drt.is_finish = '0')
AND (drt.now_repair_id in
<foreach collection="map.userIds" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
)
</if>
</otherwise>
</choose>
</otherwise>
</choose>
GROUP BY drt.id
order by drt.create_time desc
</select>
@ -311,7 +331,7 @@
-- 维修工或维修厂长查所有的就是维修人是自己的或者是自己班组内的 --
and (
<foreach item="item" collection="map.userIds" index="index" open="" separator="or" close="">
find_in_set(#{item}, drt.now_repair_id) > 0
find_in_set(#{item}, drti.repair_ids) > 0
</foreach>
)
</if>