1
This commit is contained in:
parent
da5e1474da
commit
f53debdba2
@ -293,5 +293,17 @@ public class DlRepairTicketsController {
|
||||
dlRepairTicketsService.confirm(respVO);
|
||||
return CommonResult.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 从总检的角度差维修中、已完成的工单数量
|
||||
* @author vinjor-M
|
||||
* @date 11:29 2024/10/24
|
||||
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
|
||||
**/
|
||||
@GetMapping("/getBossNum")
|
||||
@Operation(summary = "从总检的角度差维修中、已完成的工单数量")
|
||||
public CommonResult<?> getBossNum() {
|
||||
return success(dlRepairTicketsService.getBossNum());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 针对表【dl_repair_tickets(维修工单表)】的数据库操作Service
|
||||
@ -163,4 +164,12 @@ public interface DlRepairTicketsService extends IService<DlRepairTickets> {
|
||||
* @param respVO 请求对象
|
||||
**/
|
||||
void confirm(DlRepairTicketsRespVO respVO);
|
||||
|
||||
/**
|
||||
* 从总检的角度差维修中、已完成的工单数量
|
||||
* @author vinjor-M
|
||||
* @date 11:30 2024/10/24
|
||||
* @return java.util.Map<java.lang.String,java.lang.Integer>
|
||||
**/
|
||||
Map<String,Integer> getBossNum();
|
||||
}
|
||||
|
@ -431,15 +431,15 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
public IPage<DlRepairTickets> getPageType(DlRepairTicketsReqVO repairTicketsReqVO, Page<DlRepairTickets> page) {
|
||||
String userRoleCode = getUserRole();
|
||||
if (userRoleCode.equals(RepairRoleEnum.ADMIN.getCode())) {
|
||||
//维修管理员和总检,看所有数据
|
||||
//维修管理员看所有数据
|
||||
} else if(userRoleCode.equals(RepairRoleEnum.INSPECTION.getCode())){
|
||||
//总检
|
||||
if (RepairCons.TICKETS_WAITING.equals(repairTicketsReqVO.getSelectType())) {
|
||||
//查待处理的,查需要自己处理的,否则就是查所有
|
||||
repairTicketsReqVO.setUserId(String.valueOf(SecurityFrameworkUtils.getLoginUserId()));
|
||||
repairTicketsReqVO.setUserIds(Collections.singletonList(SecurityFrameworkUtils.getLoginUserId()));
|
||||
}
|
||||
}else if (userRoleCode.equals(RepairRoleEnum.ADVISOR.getCode())) {
|
||||
//服务顾问看自己的
|
||||
//服务顾问
|
||||
repairTicketsReqVO.setAdviserId(String.valueOf(SecurityFrameworkUtils.getLoginUserId()));
|
||||
} else if (userRoleCode.equals(RepairRoleEnum.REPAIR_STAFF.getCode())) {
|
||||
//维修工,进一步判断是否是班组长
|
||||
@ -460,8 +460,10 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
return null;
|
||||
}
|
||||
if (RepairCons.TICKETS_WAITING.equals(repairTicketsReqVO.getSelectType())) {
|
||||
//查待处理
|
||||
return baseMapper.getPageType(repairTicketsReqVO, page);
|
||||
} else {
|
||||
//查所有
|
||||
return baseMapper.getPageTypeAll(repairTicketsReqVO, page);
|
||||
}
|
||||
}
|
||||
@ -713,6 +715,8 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
String userRoleCode = getUserRole();
|
||||
// 当前操作人的id
|
||||
Long loginUserId = SecurityFrameworkUtils.getLoginUserId();
|
||||
//设置查询类型---待总检或待出厂检验的工单
|
||||
repairTicketsReqVO.setSelectType("special");
|
||||
// 维修服务顾问
|
||||
if (userRoleCode.equals(RepairRoleEnum.ADVISOR.getCode())) {
|
||||
repairTicketsReqVO.setNowRepairId(loginUserId);
|
||||
@ -763,13 +767,40 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
public void confirm(DlRepairTicketsRespVO respVO){
|
||||
// 更新工单状态
|
||||
baseMapper.update(new LambdaUpdateWrapper<DlRepairTickets>()
|
||||
.set(DlRepairTickets::getTicketsWorkStatus, "03")
|
||||
.set(DlRepairTickets::getTicketsWorkStatus, TicketsWorkStatusEnum.END.getCode())
|
||||
.eq(DlRepairTickets::getId, respVO.getId())
|
||||
);
|
||||
|
||||
// 记录日志
|
||||
repairRecordsService.saveRepairRecord(respVO.getId(), null, RecordTypeEnum.JSGD.getCode(), respVO.getRemark(), respVO.getImage());
|
||||
}
|
||||
|
||||
/**
|
||||
* 从总检的角度差维修中、已完成的工单数量
|
||||
*
|
||||
* @return java.util.Map<java.lang.String, java.lang.Integer>
|
||||
* @author vinjor-M
|
||||
* @date 11:30 2024/10/24
|
||||
**/
|
||||
@Override
|
||||
public Map<String, Integer> getBossNum() {
|
||||
Map<String,Integer> rtnMap = new HashMap<>();
|
||||
int workingNum = 0;
|
||||
int doneNum = 0;
|
||||
List<DlRepairTickets> repairTickets = this.list();
|
||||
if(!repairTickets.isEmpty()){
|
||||
Map<String,List<DlRepairTickets>> ifFinishMap = repairTickets.stream().collect(Collectors.groupingBy(DlRepairTickets::getIsFinish));
|
||||
if(ifFinishMap.containsKey("0")){
|
||||
workingNum = ifFinishMap.get("0").size();
|
||||
}
|
||||
if(ifFinishMap.containsKey("1")){
|
||||
doneNum = ifFinishMap.get("1").size();
|
||||
}
|
||||
}
|
||||
rtnMap.put("workingNum",workingNum);
|
||||
rtnMap.put("doneNum",doneNum);
|
||||
return rtnMap;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -182,9 +182,10 @@
|
||||
</select>
|
||||
|
||||
<select id="getPageType" resultMap="APPBaseResultMap">
|
||||
-- 查待处理数据 --
|
||||
select drt.*
|
||||
from dl_repair_tickets drt
|
||||
where drt.deleted = '0'
|
||||
where (drt.deleted = '0') AND drt.tickets_status IN ('04','05','01')
|
||||
<if test="map.ticketNo != null and map.ticketNo != ''">
|
||||
and (
|
||||
drt.ticket_no like concat('%', #{map.ticketNo}, '%')
|
||||
@ -199,36 +200,36 @@
|
||||
)
|
||||
</if>
|
||||
<if test="map.searchTimeArray != null and map.searchTimeArray.length > 0">
|
||||
and drt.create_time between #{map.searchTimeArray[0]} and #{map.searchTimeArray[1]}
|
||||
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 (drt.tickets_status = '05')
|
||||
<choose>
|
||||
<when test="map.isFinish == '0'">
|
||||
and (drt.now_repair_id in
|
||||
<when test="map.selectType=='special'">
|
||||
-- 小李用的逻辑 --
|
||||
<if test="map.isFinish != null and map.isFinish != ''">
|
||||
AND ( drt.is_finish = #{map.isFinish})
|
||||
</if>
|
||||
<if test="map.nowRepairId != null and map.nowRepairId != ''">
|
||||
AND ( drt.now_repair_id = #{map.nowRepairId})
|
||||
</if>
|
||||
</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>
|
||||
)
|
||||
</when>
|
||||
<when test="map.isFinish == '1'">
|
||||
and (
|
||||
<foreach item="item" collection="map.userIds" index="index" open="" separator="or" close="">
|
||||
find_in_set(#{item}, drti.repair_ids) > 0
|
||||
</foreach>
|
||||
)
|
||||
</when>
|
||||
</if>
|
||||
</otherwise>
|
||||
</choose>
|
||||
</if>
|
||||
<if test="map.nowRepairId != null and map.nowRepairId != ''">
|
||||
and drt.now_repair_id = #{map.nowRepairId}
|
||||
</if>
|
||||
order by drt.create_time desc
|
||||
</select>
|
||||
|
||||
@ -279,9 +280,11 @@
|
||||
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.userIds != null and map.userIds.size > 0">
|
||||
-- 维修工或维修厂长查所有的就是维修人是自己的或者是自己班组内的 --
|
||||
and (
|
||||
<foreach item="item" collection="map.userIds" index="index" open="" separator="or" close="">
|
||||
find_in_set(#{item}, drt.now_repair_id) > 0
|
||||
|
Loading…
Reference in New Issue
Block a user