更新检测相关功能

This commit is contained in:
许允枞 2024-11-04 18:05:07 +08:00
parent 768c09b0e4
commit 538067d7e0
5 changed files with 37 additions and 8 deletions

View File

@ -130,7 +130,7 @@ public class InspectionInfoController extends BaseController {
* @return
*/
@PostMapping("orderTaking")
public CommonResult orderTaking(Integer inspectionId, Integer workNodeId) {
public CommonResult orderTaking(Integer inspectionId,String workNodeId) {
inspectionWorkNodeService.updateInspectionWorkNode(inspectionId, workNodeId);
return success("接单成功");
}
@ -140,7 +140,7 @@ public class InspectionInfoController extends BaseController {
* @param inspectionWorkNode
*/
@PostMapping("controls")
public void controls(InspectionWorkNode inspectionWorkNode){
public void controls(@RequestBody InspectionWorkNode inspectionWorkNode){
inspectionWorkNodeService.updateImageAndStep(inspectionWorkNode);
}

View File

@ -155,4 +155,6 @@ public class InspectionInfo extends TenantBaseDO
private String workNodeId;
@TableField(exist = false)
private Long dealUserId;
@TableField(exist = false)
private String workNodeStatus;
}

View File

@ -19,7 +19,7 @@ public interface IInspectionWorkNodeService extends IService<InspectionWorkNode>
* @param inspectionId
* @param workNodeId
*/
void updateInspectionWorkNode(Integer inspectionId, Integer workNodeId);
void updateInspectionWorkNode(Integer inspectionId, String workNodeId);
/**
* 更新流程图片 步骤信息

View File

@ -49,7 +49,8 @@ public class InspectionWorkNodeServiceImpl extends ServiceImpl<InspectionWorkNod
* @param workNodeId
*/
@Override
public void updateInspectionWorkNode(Integer inspectionId, Integer workNodeId) {
@Transactional(rollbackFor = Exception.class)
public void updateInspectionWorkNode(Integer inspectionId, String workNodeId) {
//获取当前登录人
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
//当前登陆人 就是检测人
@ -65,7 +66,7 @@ public class InspectionWorkNodeServiceImpl extends ServiceImpl<InspectionWorkNod
throw new RuntimeException("流程不存在");
}
//判断当前流程是否已被接单
if (ObjectUtil.isNotNull(workNode.getDealUserId())) {
if (!workNode.getStatus().equals("0")) {
throw new RuntimeException("当前流程已被接单");
}
//修改流程相关信息
@ -81,6 +82,19 @@ public class InspectionWorkNodeServiceImpl extends ServiceImpl<InspectionWorkNod
inspectionInfo.setWorkerName(workerUser.getNickname());
inspectionInfo.setWorkerPhone(workerUser.getMobile());
inspectionInfoService.updateById(inspectionInfo);
//新增步骤
//根据projectId查询项目名称
DlInspectionProject project = inspectionProjectService.getOne(new LambdaQueryWrapper<DlInspectionProject>()
.eq(DlInspectionProject::getId, workNode.getProjectId()));
InspectionStepInfo inspectionStepInfo = new InspectionStepInfo();
inspectionStepInfo.setInspectionInfoId(Integer.parseInt(String.valueOf(inspectionInfo.getId())));
inspectionStepInfo.setTitle(project.getProjectName() + "项目开始检测");
inspectionStepInfo.setContent(project.getProjectName() + "项目开始检测");
inspectionStepInfo.setCreateTime(DateUtil.date());
inspectionStepInfo.setCreator(Integer.parseInt(String.valueOf(workerUser.getId())));
inspectionStepService.save(inspectionStepInfo);
}
/**
@ -91,6 +105,8 @@ public class InspectionWorkNodeServiceImpl extends ServiceImpl<InspectionWorkNod
@Override
@Transactional(rollbackFor = Exception.class)
public void updateImageAndStep(InspectionWorkNode inspectionWorkNode) {
//获取当前登陆人
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
switch (inspectionWorkNode.getSelectType()) {
case 1:
//退办理
@ -124,10 +140,12 @@ public class InspectionWorkNodeServiceImpl extends ServiceImpl<InspectionWorkNod
//根据projectId查询项目名称
DlInspectionProject project = inspectionProjectService.getOne(new LambdaQueryWrapper<DlInspectionProject>()
.eq(DlInspectionProject::getId, inspectionWorkNode.getProjectId()));
.eq(DlInspectionProject::getId, workNode.getProjectId()));
String stepTitle = project.getProjectName() + "项目检测完成";
inspectionStepInfo.setTitle(stepTitle);
inspectionStepInfo.setContent(inspectionWorkNode.getDealImages());
inspectionStepInfo.setContent(stepTitle);
inspectionStepInfo.setCreateTime(DateUtil.date());
inspectionStepInfo.setCreator(Integer.parseInt(String.valueOf(loginUser.getId())));
inspectionStepService.save(inspectionStepInfo);
if (!flag) {
stepTitle = "检测结束";
@ -137,10 +155,15 @@ public class InspectionWorkNodeServiceImpl extends ServiceImpl<InspectionWorkNod
inspectionInfo.setIsPass("1");
//设置工单结束时间
inspectionInfo.setEndTime(DateUtil.date());
//设置制证完成
inspectionInfo.setMakeCert("1");
//步骤结束
inspectionStepInfo = new InspectionStepInfo();
inspectionStepInfo.setTitle(stepTitle);
inspectionStepInfo.setContent(stepTitle);
inspectionStepInfo.setCreateTime(DateUtil.date());
inspectionStepInfo.setCreator(Integer.parseInt(String.valueOf(loginUser.getId())));
inspectionStepService.save(inspectionStepInfo);
} else {
//修改工单表当前流程
@ -224,6 +247,9 @@ public class InspectionWorkNodeServiceImpl extends ServiceImpl<InspectionWorkNod
.eq("inspection_info_id", inspectionWorkNode.getInspectionInfoId())
.ge("order_num", workNode.getOrderNum()));
//跟新工单表
inspectionInfoService.updateById(info);
// 添加步骤信息表
InspectionStepInfo stepInfo = new InspectionStepInfo();
stepInfo.setInspectionInfoId(Integer.parseInt(inspectionWorkNode.getInspectionInfoId().toString()));

View File

@ -269,7 +269,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectByUser" resultType="cn.iocoder.yudao.module.inspection.entity.InspectionInfo">
SELECT
ii.*,
iwn.id AS workNodeId
iwn.id AS workNodeId,
iwn.status AS workNodeStatus
FROM
inspection_info ii
JOIN