Compare commits
4 Commits
10ea5856b3
...
dc6ec5a8dc
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dc6ec5a8dc | ||
|
|
f0f0b376d1 | ||
|
|
fdfaab6ef7 | ||
|
|
5524a08201 |
@ -267,4 +267,30 @@ public class InspectionInfoController extends BaseController {
|
|||||||
public CommonResult isExamine(){
|
public CommonResult isExamine(){
|
||||||
return success(inspectionInfoService.isExamine());
|
return success(inspectionInfoService.isExamine());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取某个工单针对当前操作用户,某个状态的项目们
|
||||||
|
*
|
||||||
|
* @author 小李
|
||||||
|
* @date 10:48 2024/12/11
|
||||||
|
* @param id 工单ID
|
||||||
|
* @param status 状态
|
||||||
|
* @param flag 状态字段是否生效,默认生效
|
||||||
|
**/
|
||||||
|
@GetMapping("/getWorkNodeByIdAndNow")
|
||||||
|
public CommonResult<?> getWorkNodeByIdAndNow(Long id, String status, @RequestParam(value = "flag", defaultValue = "true") Boolean flag){
|
||||||
|
return success(inspectionInfoService.getWorkNodeByIdAndNow(id, status, flag));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断是否可以修改引车员
|
||||||
|
*
|
||||||
|
* @author 小李
|
||||||
|
* @date 15:22 2024/12/11
|
||||||
|
* @param id 工单ID
|
||||||
|
**/
|
||||||
|
@GetMapping("/judgeUpdateLeadMan")
|
||||||
|
public CommonResult<?> judgeUpdateLeadMan(Long id){
|
||||||
|
return success(inspectionInfoService.judgeUpdateLeadMan(id));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -36,5 +36,5 @@ public interface InspectionWorkNodeMapper extends BaseMapper<InspectionWorkNode>
|
|||||||
* 批量修改检测状态
|
* 批量修改检测状态
|
||||||
* @param workNodes
|
* @param workNodes
|
||||||
*/
|
*/
|
||||||
void recheck(@Param("list") List<InspectionWorkNode> workNodes);
|
void recheck(@Param("list") List<InspectionWorkNode> workNodes, @Param("status") String status);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -109,4 +109,23 @@ public interface IInspectionInfoService extends IService<InspectionInfo>
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Boolean isExamine();
|
Boolean isExamine();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取某个工单针对当前操作用户,某个状态的项目们
|
||||||
|
*
|
||||||
|
* @author 小李
|
||||||
|
* @date 10:48 2024/12/11
|
||||||
|
* @param id 工单ID
|
||||||
|
* @param status 状态
|
||||||
|
**/
|
||||||
|
Map<String, String> getWorkNodeByIdAndNow(Long id, String status, Boolean flag);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断是否可以修改引车员
|
||||||
|
*
|
||||||
|
* @author 小李
|
||||||
|
* @date 15:22 2024/12/11
|
||||||
|
* @param id 工单ID
|
||||||
|
**/
|
||||||
|
Boolean judgeUpdateLeadMan(Long id);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,10 +3,7 @@ package cn.iocoder.yudao.module.inspection.service.impl;
|
|||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
@ -57,6 +54,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.config.CommonStr.USER_TYPE_CUS;
|
import static cn.iocoder.yudao.framework.common.config.CommonStr.USER_TYPE_CUS;
|
||||||
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 【请填写功能名称】Service业务层处理
|
* 【请填写功能名称】Service业务层处理
|
||||||
@ -99,6 +97,9 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
|
|||||||
private InspectionSocket inspectionSocket;
|
private InspectionSocket inspectionSocket;
|
||||||
@Resource
|
@Resource
|
||||||
private RoleMapper roleMapper;
|
private RoleMapper roleMapper;
|
||||||
|
@Resource
|
||||||
|
@Lazy
|
||||||
|
private DlInspectionProjectService projectService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询【请填写功能名称】
|
* 查询【请填写功能名称】
|
||||||
@ -555,4 +556,76 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取某个工单针对当前操作用户,某个状态的项目们
|
||||||
|
*
|
||||||
|
* @param id 工单ID
|
||||||
|
* @param status 状态
|
||||||
|
* @author 小李
|
||||||
|
* @date 10:48 2024/12/11
|
||||||
|
**/
|
||||||
|
@Override
|
||||||
|
public Map<String, String> getWorkNodeByIdAndNow(Long id, String status, Boolean flag) {
|
||||||
|
Long userId = SecurityFrameworkUtils.getLoginUserId();
|
||||||
|
List<UserRoleDO> roles = roleService.getByUserId(userId);
|
||||||
|
if (CollUtil.isEmpty(roles)) {
|
||||||
|
throw exception0(500, "查询角色为空");
|
||||||
|
}
|
||||||
|
List<Long> roleIds = roles.stream().map(UserRoleDO::getRoleId).collect(Collectors.toList());
|
||||||
|
LambdaQueryWrapper<InspectionWorkNode> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.eq(InspectionWorkNode::getInspectionInfoId, id);
|
||||||
|
if (flag) {
|
||||||
|
wrapper.eq(InspectionWorkNode::getStatus, status);
|
||||||
|
}
|
||||||
|
InspectionInfo inspectionInfo = baseMapper.selectById(id);
|
||||||
|
if (!inspectionInfo.getLeadManId().equals(userId)) {
|
||||||
|
wrapper.in(InspectionWorkNode::getRoleId, roleIds);
|
||||||
|
}
|
||||||
|
List<InspectionWorkNode> workNodes = workNodeService.list(wrapper);
|
||||||
|
if (CollUtil.isEmpty(workNodes)) {
|
||||||
|
throw exception0(500, "没有项目需要操作");
|
||||||
|
}
|
||||||
|
List<String> projectIds = workNodes.stream().map(InspectionWorkNode::getProjectId).collect(Collectors.toList());
|
||||||
|
if (CollUtil.isEmpty(projectIds)) {
|
||||||
|
throw exception0(500, "没有项目需要操作");
|
||||||
|
}
|
||||||
|
List<DlInspectionProject> projects = projectService.listByIds(projectIds);
|
||||||
|
if (CollUtil.isEmpty(projects)) {
|
||||||
|
throw exception0(500, "没有项目需要操作");
|
||||||
|
}
|
||||||
|
Map<String, String> map = projects.stream().collect(Collectors.toMap(DlInspectionProject::getId, DlInspectionProject::getProjectName));
|
||||||
|
Map<String, String> result = new HashMap<>();
|
||||||
|
workNodes.forEach(item -> {
|
||||||
|
result.put(item.getId(), map.get(item.getProjectId()));
|
||||||
|
});
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断是否可以修改引车员
|
||||||
|
*
|
||||||
|
* @author 小李
|
||||||
|
* @date 15:22 2024/12/11
|
||||||
|
* @param id 工单ID
|
||||||
|
**/
|
||||||
|
@Override
|
||||||
|
public Boolean judgeUpdateLeadMan(Long id){
|
||||||
|
boolean result = true;
|
||||||
|
InspectionInfo inspectionInfo = baseMapper.selectById(id);
|
||||||
|
if (!inspectionInfo.getStatus().equals("2")){
|
||||||
|
result = false;
|
||||||
|
}
|
||||||
|
if (!result){
|
||||||
|
List<InspectionWorkNode> list = workNodeService.list(new LambdaQueryWrapper<InspectionWorkNode>().eq(InspectionWorkNode::getInspectionInfoId, id));
|
||||||
|
Set<String> status = list.stream().map(InspectionWorkNode::getStatus).collect(Collectors.toSet());
|
||||||
|
if (status.contains("3")){
|
||||||
|
result = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (result){
|
||||||
|
result = inspectionInfo.getCreator().equals(SecurityFrameworkUtils.getLoginUserId()+"");
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -29,9 +29,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -81,7 +79,7 @@ public class InspectionWorkNodeServiceImpl extends ServiceImpl<InspectionWorkNod
|
|||||||
throw new RuntimeException("流程不存在");
|
throw new RuntimeException("流程不存在");
|
||||||
}
|
}
|
||||||
//判断当前流程是否已被接单
|
//判断当前流程是否已被接单
|
||||||
if (!workNode.getStatus().equals("0")) {
|
if (!workNode.getStatus().equals("0") && !workNode.getStatus().equals("3")) {
|
||||||
throw new RuntimeException("当前流程已被接单");
|
throw new RuntimeException("当前流程已被接单");
|
||||||
}
|
}
|
||||||
//修改流程相关信息
|
//修改流程相关信息
|
||||||
@ -216,11 +214,17 @@ public class InspectionWorkNodeServiceImpl extends ServiceImpl<InspectionWorkNod
|
|||||||
// 更新或插入步骤信息
|
// 更新或插入步骤信息
|
||||||
DlInspectionProject project = inspectionProjectService.getOne(new LambdaQueryWrapper<DlInspectionProject>()
|
DlInspectionProject project = inspectionProjectService.getOne(new LambdaQueryWrapper<DlInspectionProject>()
|
||||||
.eq(DlInspectionProject::getId, workNode.getProjectId()));
|
.eq(DlInspectionProject::getId, workNode.getProjectId()));
|
||||||
InspectionStepInfo stepInfo = inspectionStepService.getOne(new LambdaQueryWrapper<InspectionStepInfo>()
|
List<InspectionStepInfo> stepInfos = inspectionStepService.list(new LambdaQueryWrapper<InspectionStepInfo>()
|
||||||
.and(i -> i.eq(InspectionStepInfo::getInspectionInfoId, workNode.getInspectionInfoId())
|
.and(i -> i.eq(InspectionStepInfo::getInspectionInfoId, workNode.getInspectionInfoId())
|
||||||
.eq(InspectionStepInfo::getWorkNodeId, workNode.getId())
|
.eq(InspectionStepInfo::getWorkNodeId, workNode.getId())
|
||||||
.eq(InspectionStepInfo::getTitle, ObjectUtil.isNotEmpty(project) ? project.getProjectName() : workNode.getProjectName())
|
.eq(InspectionStepInfo::getTitle, ObjectUtil.isNotEmpty(project) ? project.getProjectName() : workNode.getProjectName())
|
||||||
));
|
));
|
||||||
|
InspectionStepInfo stepInfo = new InspectionStepInfo();
|
||||||
|
if (CollUtil.isNotEmpty(stepInfos)){
|
||||||
|
List<InspectionStepInfo> sorted = stepInfos.stream()
|
||||||
|
.sorted(Comparator.comparing(InspectionStepInfo::getCreateTime).reversed()).collect(Collectors.toList());
|
||||||
|
stepInfo = sorted.get(0);
|
||||||
|
}
|
||||||
if (ObjectUtil.isNotEmpty(stepInfo)) {
|
if (ObjectUtil.isNotEmpty(stepInfo)) {
|
||||||
stepInfo.setUpdateTime(DateUtil.date());
|
stepInfo.setUpdateTime(DateUtil.date());
|
||||||
stepInfo.setUpdater(Integer.parseInt(SecurityFrameworkUtils.getLoginUserId() + ""));
|
stepInfo.setUpdater(Integer.parseInt(SecurityFrameworkUtils.getLoginUserId() + ""));
|
||||||
@ -346,7 +350,11 @@ public class InspectionWorkNodeServiceImpl extends ServiceImpl<InspectionWorkNod
|
|||||||
//获取当前登陆人
|
//获取当前登陆人
|
||||||
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
|
||||||
//将传递过来的流程节点全部改为未进行
|
//将传递过来的流程节点全部改为未进行
|
||||||
baseMapper.recheck(workNodes.getWorkNodes());
|
String status = "0";
|
||||||
|
if (CollUtil.isNotEmpty(workNodes.getWorkNodes()) && ObjectUtil.isNotEmpty(workNodes.getWorkNodes().get(0).getStatus())){
|
||||||
|
status = workNodes.getWorkNodes().get(0).getStatus();
|
||||||
|
}
|
||||||
|
baseMapper.recheck(workNodes.getWorkNodes(), status);
|
||||||
//将检测工单设置为重审
|
//将检测工单设置为重审
|
||||||
InspectionInfo info = inspectionInfoService.getById(workNodes.getInspectionInfoId());
|
InspectionInfo info = inspectionInfoService.getById(workNodes.getInspectionInfoId());
|
||||||
info.setIsRetrial("1");
|
info.setIsRetrial("1");
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
</update>
|
</update>
|
||||||
<update id="recheck">
|
<update id="recheck">
|
||||||
UPDATE inspection_work_node
|
UPDATE inspection_work_node
|
||||||
SET status = '0', deal_user_id = null, deal_user_name = null, deal_images = null, remark = null,type = null
|
SET status = #{status}, deal_user_id = null, deal_user_name = null, deal_images = null, remark = null,type = null
|
||||||
WHERE id in (
|
WHERE id in (
|
||||||
<foreach collection="list" item="item" separator=",">
|
<foreach collection="list" item="item" separator=",">
|
||||||
#{item.id}
|
#{item.id}
|
||||||
|
|||||||
@ -299,7 +299,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</if>
|
</if>
|
||||||
<!-- 待支付 -->
|
<!-- 待支付 -->
|
||||||
<if test="inspectionInfo.status == '0'.toString()">
|
<if test="inspectionInfo.status == '0'.toString()">
|
||||||
and (oi.pay_time is null)
|
AND (oi.pay_time is null)
|
||||||
ORDER BY iwn.update_time DESC
|
ORDER BY iwn.update_time DESC
|
||||||
</if>
|
</if>
|
||||||
<!-- 待接受(待检测) -->
|
<!-- 待接受(待检测) -->
|
||||||
@ -317,11 +317,37 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</if>
|
</if>
|
||||||
<!-- 进行中(检测中) -->
|
<!-- 进行中(检测中) -->
|
||||||
<if test="inspectionInfo.status == 2">
|
<if test="inspectionInfo.status == 2">
|
||||||
AND ii.status = '0'
|
AND (ii.status = '0' OR ii.status = '2')
|
||||||
AND iwn.status = '1'
|
AND iwn.status = '1'
|
||||||
AND iwn.deal_user_id = #{inspectionInfo.dealUserId}
|
AND iwn.deal_user_id = #{inspectionInfo.dealUserId}
|
||||||
ORDER BY iwn.update_time DESC
|
ORDER BY iwn.update_time DESC
|
||||||
</if>
|
</if>
|
||||||
|
<!-- 待重检 -->
|
||||||
|
<if test="inspectionInfo.status == 3">
|
||||||
|
AND <!-- 工单负责人或角色ID匹配 -->
|
||||||
|
(ii.lead_man_id = #{inspectionInfo.leadManId}
|
||||||
|
OR iwn.role_id IN
|
||||||
|
<foreach collection="roleIds" item="roleId" open="(" separator="," close=")">
|
||||||
|
#{roleId}
|
||||||
|
</foreach>)
|
||||||
|
AND ii.status = '2'
|
||||||
|
-- AND iwn.status = '1'
|
||||||
|
-- AND ii.now_order_num = iwn.order_num
|
||||||
|
ORDER BY ii.update_time DESC
|
||||||
|
</if>
|
||||||
|
<!-- 待复检 -->
|
||||||
|
<if test="inspectionInfo.status == 4">
|
||||||
|
AND <!-- 工单负责人或角色ID匹配 -->
|
||||||
|
(ii.lead_man_id = #{inspectionInfo.leadManId}
|
||||||
|
OR iwn.role_id IN
|
||||||
|
<foreach collection="roleIds" item="roleId" open="(" separator="," close=")">
|
||||||
|
#{roleId}
|
||||||
|
</foreach>)
|
||||||
|
-- AND ii.status = '2'
|
||||||
|
AND iwn.status = '3'
|
||||||
|
-- AND ii.now_order_num = iwn.order_num
|
||||||
|
ORDER BY ii.update_time DESC
|
||||||
|
</if>
|
||||||
<!-- 已完成 -->
|
<!-- 已完成 -->
|
||||||
<if test="inspectionInfo.status == 5">
|
<if test="inspectionInfo.status == 5">
|
||||||
AND iwn.status = '2'
|
AND iwn.status = '2'
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user