待重检、待复检
This commit is contained in:
parent
fdfaab6ef7
commit
f0f0b376d1
@ -275,10 +275,11 @@ public class InspectionInfoController extends BaseController {
|
||||
* @date 10:48 2024/12/11
|
||||
* @param id 工单ID
|
||||
* @param status 状态
|
||||
* @param flag 状态字段是否生效,默认生效
|
||||
**/
|
||||
@GetMapping("/getWorkNodeByIdAndNow")
|
||||
public CommonResult<?> getWorkNodeByIdAndNow(Long id, String status){
|
||||
return success(inspectionInfoService.getWorkNodeByIdAndNow(id, status));
|
||||
public CommonResult<?> getWorkNodeByIdAndNow(Long id, String status, @RequestParam(value = "flag", defaultValue = "true") Boolean flag){
|
||||
return success(inspectionInfoService.getWorkNodeByIdAndNow(id, status, flag));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -36,5 +36,5 @@ public interface InspectionWorkNodeMapper extends BaseMapper<InspectionWorkNode>
|
||||
* 批量修改检测状态
|
||||
* @param workNodes
|
||||
*/
|
||||
void recheck(@Param("list") List<InspectionWorkNode> workNodes);
|
||||
void recheck(@Param("list") List<InspectionWorkNode> workNodes, @Param("status") String status);
|
||||
}
|
||||
|
@ -118,5 +118,5 @@ public interface IInspectionInfoService extends IService<InspectionInfo>
|
||||
* @param id 工单ID
|
||||
* @param status 状态
|
||||
**/
|
||||
Map<String, String> getWorkNodeByIdAndNow(Long id, String status);
|
||||
Map<String, String> getWorkNodeByIdAndNow(Long id, String status, Boolean flag);
|
||||
}
|
||||
|
@ -194,11 +194,11 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
|
||||
}
|
||||
inspectionInfo.setCategoryId(goods.getGoodsCategoryId());
|
||||
|
||||
if (ObjectUtil.isNotNull(inspectionInfo.getAdditionalRecording()) && inspectionInfo.getAdditionalRecording() == 1){
|
||||
if (ObjectUtil.isNotNull(inspectionInfo.getAdditionalRecording()) && inspectionInfo.getAdditionalRecording() == 1) {
|
||||
inspectionInfo.setStatus("1");
|
||||
inspectionInfo.setIsPass("1");
|
||||
inspectionInfo.setEndTime(inspectionInfo.getStartTime());
|
||||
}else {
|
||||
} else {
|
||||
inspectionInfo.setStatus("0");
|
||||
}
|
||||
inspectionInfo.setWorkId(workerUser.getId());
|
||||
@ -319,7 +319,7 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
|
||||
// Integer roleId = inspectionWorkNodes.get(0).getRoleId();
|
||||
List<Integer> roleIds = new ArrayList<>();
|
||||
/*获取所有的角色id*/
|
||||
if(CollUtil.isNotEmpty(inspectionWorkNodes)){
|
||||
if (CollUtil.isNotEmpty(inspectionWorkNodes)) {
|
||||
roleIds = inspectionWorkNodes.stream().map(inspectionWorkNode -> inspectionWorkNode.getRoleId()).collect(Collectors.toList());
|
||||
}
|
||||
//根据角色id获取所有用户
|
||||
@ -560,37 +560,39 @@ public class InspectionInfoServiceImpl extends ServiceImpl<InspectionInfoMapper,
|
||||
/**
|
||||
* 获取某个工单针对当前操作用户,某个状态的项目们
|
||||
*
|
||||
* @param id 工单ID
|
||||
* @param status 状态
|
||||
* @author 小李
|
||||
* @date 10:48 2024/12/11
|
||||
* @param id 工单ID
|
||||
* @param status 状态
|
||||
**/
|
||||
@Override
|
||||
public Map<String, String> getWorkNodeByIdAndNow(Long id, String status){
|
||||
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)){
|
||||
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);
|
||||
wrapper.eq(InspectionWorkNode::getStatus, status);
|
||||
if (flag) {
|
||||
wrapper.eq(InspectionWorkNode::getStatus, status);
|
||||
}
|
||||
InspectionInfo inspectionInfo = baseMapper.selectById(id);
|
||||
if (!inspectionInfo.getLeadManId().equals(userId)){
|
||||
if (!inspectionInfo.getLeadManId().equals(userId)) {
|
||||
wrapper.in(InspectionWorkNode::getRoleId, roleIds);
|
||||
}
|
||||
List<InspectionWorkNode> workNodes = workNodeService.list(wrapper);
|
||||
if (CollUtil.isEmpty(workNodes)){
|
||||
throw exception0(500, "查询节点为空");
|
||||
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, "查询项目时为空");
|
||||
if (CollUtil.isEmpty(projectIds)) {
|
||||
throw exception0(500, "没有项目需要操作");
|
||||
}
|
||||
List<DlInspectionProject> projects = projectService.listByIds(projectIds);
|
||||
if (CollUtil.isEmpty(projects)){
|
||||
throw exception0(500, "查询项目时为空");
|
||||
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<>();
|
||||
|
@ -29,9 +29,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@ -81,7 +79,7 @@ public class InspectionWorkNodeServiceImpl extends ServiceImpl<InspectionWorkNod
|
||||
throw new RuntimeException("流程不存在");
|
||||
}
|
||||
//判断当前流程是否已被接单
|
||||
if (!workNode.getStatus().equals("0")) {
|
||||
if (!workNode.getStatus().equals("0") && !workNode.getStatus().equals("3")) {
|
||||
throw new RuntimeException("当前流程已被接单");
|
||||
}
|
||||
//修改流程相关信息
|
||||
@ -216,11 +214,17 @@ public class InspectionWorkNodeServiceImpl extends ServiceImpl<InspectionWorkNod
|
||||
// 更新或插入步骤信息
|
||||
DlInspectionProject project = inspectionProjectService.getOne(new LambdaQueryWrapper<DlInspectionProject>()
|
||||
.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())
|
||||
.eq(InspectionStepInfo::getWorkNodeId, workNode.getId())
|
||||
.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)) {
|
||||
stepInfo.setUpdateTime(DateUtil.date());
|
||||
stepInfo.setUpdater(Integer.parseInt(SecurityFrameworkUtils.getLoginUserId() + ""));
|
||||
@ -346,7 +350,11 @@ public class InspectionWorkNodeServiceImpl extends ServiceImpl<InspectionWorkNod
|
||||
//获取当前登陆人
|
||||
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());
|
||||
info.setIsRetrial("1");
|
||||
|
@ -8,7 +8,7 @@
|
||||
</update>
|
||||
<update id="recheck">
|
||||
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 (
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
#{item.id}
|
||||
|
@ -299,7 +299,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</if>
|
||||
<!-- 待支付 -->
|
||||
<if test="inspectionInfo.status == '0'.toString()">
|
||||
and (oi.pay_time is null)
|
||||
AND (oi.pay_time is null)
|
||||
ORDER BY iwn.update_time DESC
|
||||
</if>
|
||||
<!-- 待接受(待检测) -->
|
||||
@ -317,11 +317,37 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</if>
|
||||
<!-- 进行中(检测中) -->
|
||||
<if test="inspectionInfo.status == 2">
|
||||
AND ii.status = '0'
|
||||
AND (ii.status = '0' OR ii.status = '2')
|
||||
AND iwn.status = '1'
|
||||
AND iwn.deal_user_id = #{inspectionInfo.dealUserId}
|
||||
ORDER BY iwn.update_time DESC
|
||||
</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">
|
||||
AND iwn.status = '2'
|
||||
|
Loading…
Reference in New Issue
Block a user