QMS:质检不合格处置接口
master
xins 8 months ago
parent 8160104cf9
commit bcc7736224

@ -34,4 +34,8 @@ public class QmsConstants {
public static final String QMS_CHECK_PROJECT_STATUS_FAIL = "0";//不合格
/**质检工单实例节点处理状态*/
public static final String QMS_PROCESS_HANDLE_STATUS_FINISHED = "0";//已结束
public static final String QMS_PROCESS_HANDLE_STATUS_EXECUTING = "1";//执行中
}

@ -0,0 +1,24 @@
package com.hw.common.core.constant;
/**
* @Description:
* @ProjectName:HwMes
* @Author:xins
* @Date:2024-03-11 10:42
* @Version:1.0
*/
public class WfConstants {
public static final Long WF_QUALITY_ABNORMAL_PROCESS_ID = 301L;
/**质检工单实例状态*/
public static final String WF_INSTANCE_STATUS_START = "1";//已启动
public static final String WF_INSTANCE_STATUS_FINISH = "3";//已结束
/**质检工单实例节点状态*/
public static final String WF_PROCESS_HANDLE_STATUS_FINISH = "0";//已结束
/**质检文件关联类型*/
public static final String QMS_FILE_TARGET_TYPE_QUALITY_INSTANCE_ACTIVITY = "1";//质检工单实例节点
}

@ -1,6 +1,10 @@
package com.hw.qms.controller;
import com.hw.common.core.constant.QmsConstants;
import com.hw.common.core.constant.SecurityConstants;
import com.hw.common.core.constant.WfConstants;
import com.hw.common.core.constant.WmsConstants;
import com.hw.common.core.domain.R;
import com.hw.common.core.exception.ServiceException;
import com.hw.common.core.web.controller.BaseController;
import com.hw.common.core.web.domain.AjaxResult;
@ -11,10 +15,21 @@ import com.hw.common.security.annotation.RequiresPermissions;
import com.hw.qms.domain.*;
import com.hw.qms.domain.vo.QmsCheckResultDetailVo;
import com.hw.qms.domain.vo.QmsMaterialCheckVo;
import com.hw.qms.domain.vo.QmsQualityInstanceActivityVo;
import com.hw.qms.service.*;
import com.hw.system.api.RemoteFileService;
import com.hw.system.api.RemoteSysCommonService;
import com.hw.system.api.RemoteUserService;
import com.hw.system.api.domain.SysFile;
import com.hw.system.api.domain.common.WfProcessActivity;
import com.hw.system.api.domain.common.vo.WfProcessActivityVo;
import com.hw.system.api.model.LoginUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
/**
@ -39,6 +54,10 @@ public class QmsMobileController extends BaseController {
private IQmsQualityInstanceService qmsQualityInstanceService;
@Autowired
private IQmsCheckInstanceFileService qmsCheckInstanceFileService;
@Resource
private RemoteSysCommonService remoteSysCommonService;
@Resource
private RemoteFileService remoteFileService;
/**
*
@ -142,6 +161,7 @@ public class QmsMobileController extends BaseController {
// @RequiresPermissions("qms:checkrule:list")
@GetMapping("/getCheckResult4Handle")
public AjaxResult getCheckResult4Handle(QmsCheckResult qmsCheckResult) {
//todo:修改工单时,根据用户工单流程步骤权限判断显示哪些
QmsCheckResultDetailVo qmsCheckResultDetailVo = qmsCheckResultDetailService.getCheckResultDetailVo(qmsCheckResult.getCheckResultId());
int batchAmount = mesBaseBarcodeInfoService.selectBarcodeInfoCountByBatchcode(qmsCheckResult.getMaterialBatch());
qmsCheckResultDetailVo.setBatchAmount(batchAmount);
@ -151,18 +171,43 @@ public class QmsMobileController extends BaseController {
qmsCheckResultDetailVo.setMaterialName(qmsCheckResult.getMaterialName());
QmsQualityInstance qmsQualityInstance = qmsQualityInstanceService.selectQmsQualityInstanceByCheckResultId(qmsCheckResult.getCheckResultId());
Long processActivityOrder = 1L;
List<QmsQualityInstanceActivity> qmsQualityInstanceActivities = new ArrayList<>();
if (qmsQualityInstance != null) {
List<QmsQualityInstanceActivity> qmsQualityInstanceActivities = qmsQualityInstance.getQmsQualityInstanceActivityList();
qmsCheckResultDetailVo.setQmsQualityInstanceActivities(qmsQualityInstanceActivities);
qmsQualityInstanceActivities = qmsQualityInstance.getQmsQualityInstanceActivityList();
QmsQualityInstanceActivity lastQualityInstanceActivity = qmsQualityInstanceActivities.get(qmsQualityInstanceActivities.size() - 1);
processActivityOrder = lastQualityInstanceActivity.getProcessStepOrder() + 1;//获取下一步的流程实例步骤
QmsCheckInstanceFile queryCheckInstanceFile = new QmsCheckInstanceFile();
queryCheckInstanceFile.setTargetType("1");
queryCheckInstanceFile.setTargetType(WfConstants.QMS_FILE_TARGET_TYPE_QUALITY_INSTANCE_ACTIVITY);
queryCheckInstanceFile.setTargetId(qmsQualityInstance.getQualityInstanceId());
List<QmsCheckInstanceFile> qmsCheckInstanceFiles = qmsCheckInstanceFileService.selectQmsCheckInstanceFileList(queryCheckInstanceFile);
qmsCheckResultDetailVo.setQmsCheckInstanceFiles(qmsCheckInstanceFiles);
} else {
qmsCheckResultDetailVo.setPicEditedAble(true);
}
WfProcessActivityVo queryProcessActivityVo = new WfProcessActivityVo();
queryProcessActivityVo.setWfProcessId(WfConstants.WF_QUALITY_ABNORMAL_PROCESS_ID);
queryProcessActivityVo.setProcessActivityOrder(processActivityOrder);
R<WfProcessActivity> processActivityResult = remoteSysCommonService.getWfProcessActivityByUI(queryProcessActivityVo, SecurityConstants.INNER);
if (processActivityResult != null) {
WfProcessActivity wfProcessActivity = processActivityResult.getData();
if (wfProcessActivity != null) {
QmsQualityInstanceActivity qmsQualityInstanceActivity = new QmsQualityInstanceActivity();
qmsQualityInstanceActivity.setProcessActivityId(wfProcessActivity.getProcessActivityId());
qmsQualityInstanceActivity.setProcessHandleStatus(QmsConstants.QMS_PROCESS_HANDLE_STATUS_EXECUTING);
qmsQualityInstanceActivity.setProcessStepOrder(wfProcessActivity.getProcessActivityOrder());
qmsQualityInstanceActivity.setEditedAble(true);
qmsQualityInstanceActivities.add(qmsQualityInstanceActivity);
}
}
qmsCheckResultDetailVo.setQmsQualityInstanceActivities(qmsQualityInstanceActivities);
return success(qmsCheckResultDetailVo);
}
@ -173,8 +218,14 @@ public class QmsMobileController extends BaseController {
// @RequiresPermissions("qms:checkresultdetail:add")
@Log(title = "质检工单实例", businessType = BusinessType.INSERT)
@PostMapping("/handleQualityInstance")
public AjaxResult handleQualityInstance(@RequestBody QmsQualityInstance qmsQualityInstance) {
System.out.println(qmsQualityInstance.getCheckResultId());
return success(1);
public AjaxResult handleQualityInstance(QmsQualityInstanceActivityVo qmsQualityInstanceActivityVo,
@RequestParam(value = "files") List<MultipartFile> files) {
List<String> fileUrls = new ArrayList<>();
for (MultipartFile file : files) {
R<SysFile> sysFileR = remoteFileService.upload(file);
SysFile sysFile = sysFileR.getData();
fileUrls.add(sysFile.getUrl());
}
return success(qmsQualityInstanceService.handleQualityInstance(qmsQualityInstanceActivityVo,fileUrls));
}
}

@ -1,6 +1,8 @@
package com.hw.qms.domain;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
@ -9,7 +11,7 @@ import com.hw.common.core.web.domain.BaseEntity;
/**
* qms_quality_instance_activity
*
*
* @author xins
* @date 2024-01-23
*/
@ -71,124 +73,146 @@ public class QmsQualityInstanceActivity extends BaseEntity
@Excel(name = "转单人用户id或转发协助用户id;1、在转发时生成新的工单节点实例执行人id为转发的用户而转单人是刚才转发给此用户的用户id是否协助工单为0并且转发后当前工单的状态为已结束此用户的用户id是否协助工单为0并且转发后当前工单的状态为已结束此用户的用户id是否协助工单为0并且转发后当前工单的状态为已结束此用户的用户id是否协助工单为0并且转发后当前工单的状态为已结束2、在添加协助时生成新的工单节点实例执行人id为添加协助的用户而转单人是刚才添加协助此用户的用户id是否协助工单为1并且转发后当前工单的状态仍为执行中")
private Long transferUserId;
public void setInstanceActivityId(Long instanceActivityId)
/** 质检文件信息 */
private List<QmsCheckInstanceFile> qmsCheckInstanceFileList;
private boolean editedAble = false;//是否可编辑
public void setInstanceActivityId(Long instanceActivityId)
{
this.instanceActivityId = instanceActivityId;
}
public Long getInstanceActivityId()
public Long getInstanceActivityId()
{
return instanceActivityId;
}
public void setQualityInstanceId(Long qualityInstanceId)
public void setQualityInstanceId(Long qualityInstanceId)
{
this.qualityInstanceId = qualityInstanceId;
}
public Long getQualityInstanceId()
public Long getQualityInstanceId()
{
return qualityInstanceId;
}
public void setProcessActivityId(Long processActivityId)
public void setProcessActivityId(Long processActivityId)
{
this.processActivityId = processActivityId;
}
public Long getProcessActivityId()
public Long getProcessActivityId()
{
return processActivityId;
}
public void setProcessHandleResolution(String processHandleResolution)
public void setProcessHandleResolution(String processHandleResolution)
{
this.processHandleResolution = processHandleResolution;
}
public String getProcessHandleResolution()
public String getProcessHandleResolution()
{
return processHandleResolution;
}
public void setProcessHandleDesc(String processHandleDesc)
public void setProcessHandleDesc(String processHandleDesc)
{
this.processHandleDesc = processHandleDesc;
}
public String getProcessHandleDesc()
public String getProcessHandleDesc()
{
return processHandleDesc;
}
public void setProcessHandleStatus(String processHandleStatus)
public void setProcessHandleStatus(String processHandleStatus)
{
this.processHandleStatus = processHandleStatus;
}
public String getProcessHandleStatus()
public String getProcessHandleStatus()
{
return processHandleStatus;
}
public void setProcessStepOrder(Long processStepOrder)
public void setProcessStepOrder(Long processStepOrder)
{
this.processStepOrder = processStepOrder;
}
public Long getProcessStepOrder()
public Long getProcessStepOrder()
{
return processStepOrder;
}
public void setStartTime(Date startTime)
public void setStartTime(Date startTime)
{
this.startTime = startTime;
}
public Date getStartTime()
public Date getStartTime()
{
return startTime;
}
public void setEndTime(Date endTime)
public void setEndTime(Date endTime)
{
this.endTime = endTime;
}
public Date getEndTime()
public Date getEndTime()
{
return endTime;
}
public void setHandleUserId(Long handleUserId)
public void setHandleUserId(Long handleUserId)
{
this.handleUserId = handleUserId;
}
public Long getHandleUserId()
public Long getHandleUserId()
{
return handleUserId;
}
public void setHandleBy(String handleBy)
public void setHandleBy(String handleBy)
{
this.handleBy = handleBy;
}
public String getHandleBy()
public String getHandleBy()
{
return handleBy;
}
public void setHandleTime(Date handleTime)
public void setHandleTime(Date handleTime)
{
this.handleTime = handleTime;
}
public Date getHandleTime()
public Date getHandleTime()
{
return handleTime;
}
public void setTransferUserId(Long transferUserId)
public void setTransferUserId(Long transferUserId)
{
this.transferUserId = transferUserId;
}
public Long getTransferUserId()
public Long getTransferUserId()
{
return transferUserId;
}
public List<QmsCheckInstanceFile> getQmsCheckInstanceFileList() {
return qmsCheckInstanceFileList;
}
public void setQmsCheckInstanceFileList(List<QmsCheckInstanceFile> qmsCheckInstanceFileList) {
this.qmsCheckInstanceFileList = qmsCheckInstanceFileList;
}
public boolean isEditedAble() {
return editedAble;
}
public void setEditedAble(boolean editedAble) {
this.editedAble = editedAble;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

@ -21,6 +21,7 @@ public class QmsCheckResultDetailVo
{
private static final long serialVersionUID = 1L;
private Long checkResultId;
/**
*
*/
@ -41,6 +42,16 @@ public class QmsCheckResultDetailVo
List<QmsCheckInstanceFile> qmsCheckInstanceFiles;
private boolean picEditedAble = false;//图片是否可编辑或上传
public Long getCheckResultId() {
return checkResultId;
}
public void setCheckResultId(Long checkResultId) {
this.checkResultId = checkResultId;
}
public int getBatchAmount() {
return batchAmount;
}
@ -112,4 +123,12 @@ public class QmsCheckResultDetailVo
public void setQmsCheckInstanceFiles(List<QmsCheckInstanceFile> qmsCheckInstanceFiles) {
this.qmsCheckInstanceFiles = qmsCheckInstanceFiles;
}
public boolean isPicEditedAble() {
return picEditedAble;
}
public void setPicEditedAble(boolean picEditedAble) {
this.picEditedAble = picEditedAble;
}
}

@ -0,0 +1,37 @@
package com.hw.qms.domain.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.hw.common.core.annotation.Excel;
import com.hw.common.core.web.domain.BaseEntity;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;
/**
* qms_quality_instance_activity
*
* @author xins
* @date 2024-01-23
*/
@Data
public class QmsQualityInstanceActivityVo extends BaseEntity
{
@NotNull(message="质检结果ID必须输入")
private Long checkResultId;
@NotNull(message="质检流程步骤ID必须输入")
private Long processActivityId;
@NotNull(message="质检流程步骤顺序必须输入")
private Long processStepOrder;
@NotBlank(message="处理意见必须输入")
/** 处理意见 */
private String processHandleResolution;
}

@ -0,0 +1,87 @@
package com.hw.qms.mapper;
import java.util.List;
import com.hw.qms.domain.QmsQualityInstanceActivity;
import com.hw.qms.domain.QmsCheckInstanceFile;
/**
* Mapper
*
* @author xins
* @date 2024-03-11
*/
public interface QmsQualityInstanceActivityMapper
{
/**
*
*
* @param instanceActivityId
* @return
*/
public QmsQualityInstanceActivity selectQmsQualityInstanceActivityByInstanceActivityId(Long instanceActivityId);
/**
*
*
* @param qmsQualityInstanceActivity
* @return
*/
public List<QmsQualityInstanceActivity> selectQmsQualityInstanceActivityList(QmsQualityInstanceActivity qmsQualityInstanceActivity);
/**
*
*
* @param qmsQualityInstanceActivity
* @return
*/
public int insertQmsQualityInstanceActivity(QmsQualityInstanceActivity qmsQualityInstanceActivity);
/**
*
*
* @param qmsQualityInstanceActivity
* @return
*/
public int updateQmsQualityInstanceActivity(QmsQualityInstanceActivity qmsQualityInstanceActivity);
/**
*
*
* @param instanceActivityId
* @return
*/
public int deleteQmsQualityInstanceActivityByInstanceActivityId(Long instanceActivityId);
/**
*
*
* @param instanceActivityIds
* @return
*/
public int deleteQmsQualityInstanceActivityByInstanceActivityIds(Long[] instanceActivityIds);
/**
*
*
* @param instanceActivityIds
* @return
*/
public int deleteQmsCheckInstanceFileByTargetIds(Long[] instanceActivityIds);
/**
*
*
* @param qmsCheckInstanceFileList
* @return
*/
public int batchQmsCheckInstanceFile(List<QmsCheckInstanceFile> qmsCheckInstanceFileList);
/**
*
*
* @param instanceActivityId ID
* @return
*/
public int deleteQmsCheckInstanceFileByTargetId(Long instanceActivityId);
}

@ -2,6 +2,8 @@ package com.hw.qms.service;
import java.util.List;
import com.hw.qms.domain.QmsQualityInstance;
import com.hw.qms.domain.vo.QmsQualityInstanceActivityVo;
import org.springframework.transaction.annotation.Transactional;
/**
* Service
@ -68,4 +70,11 @@ public interface IQmsQualityInstanceService
* @return
*/
public QmsQualityInstance selectQmsQualityInstanceByCheckResultId(Long checkResultId);
/**
*
* @param qmsQualityInstanceActivityVo
* @param fileUrls
*/
public int handleQualityInstance(QmsQualityInstanceActivityVo qmsQualityInstanceActivityVo, List<String> fileUrls);
}

@ -7,10 +7,10 @@ import java.util.List;
import com.hw.common.core.constant.QmsConstants;
import com.hw.common.core.utils.DateUtils;
import com.hw.common.security.utils.SecurityUtils;
import com.hw.qms.domain.MesBaseBarcodeInfo;
import com.hw.qms.domain.QmsCheckRuleProject;
import com.hw.qms.domain.*;
import com.hw.qms.domain.vo.QmsCheckResultDetailVo;
import com.hw.qms.domain.vo.QmsMaterialCheckVo;
import com.hw.qms.domain.vo.QmsQualityInstanceActivityVo;
import com.hw.qms.mapper.QmsCheckResultDetailProjectMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -19,9 +19,7 @@ import java.util.ArrayList;
import com.hw.common.core.utils.StringUtils;
import org.springframework.transaction.annotation.Transactional;
import com.hw.qms.domain.QmsCheckResultDetailProject;
import com.hw.qms.mapper.QmsCheckResultDetailMapper;
import com.hw.qms.domain.QmsCheckResultDetail;
import com.hw.qms.service.IQmsCheckResultDetailService;
/**
@ -271,7 +269,9 @@ public class QmsCheckResultDetailServiceImpl implements IQmsCheckResultDetailSer
QmsCheckResultDetailVo checkResultDetailVo = new QmsCheckResultDetailVo();
checkResultDetailVo.setPassAmount(passAmount);
checkResultDetailVo.setFailAmount(failAmount);
checkResultDetailVo.setCheckResultId(checkResultId);
return checkResultDetailVo;
}
}

@ -1,10 +1,19 @@
package com.hw.qms.service.impl;
import java.util.Date;
import java.util.List;
import com.hw.common.core.constant.WfConstants;
import com.hw.common.core.utils.DateUtils;
import com.hw.common.security.utils.SecurityUtils;
import com.hw.qms.domain.QmsCheckInstanceFile;
import com.hw.qms.domain.vo.QmsQualityInstanceActivityVo;
import com.hw.qms.mapper.QmsQualityInstanceActivityMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import com.hw.common.core.utils.StringUtils;
import org.springframework.transaction.annotation.Transactional;
import com.hw.qms.domain.QmsQualityInstanceActivity;
@ -19,11 +28,13 @@ import com.hw.qms.service.IQmsQualityInstanceService;
* @date 2024-01-23
*/
@Service
public class QmsQualityInstanceServiceImpl implements IQmsQualityInstanceService
{
public class QmsQualityInstanceServiceImpl implements IQmsQualityInstanceService {
@Autowired
private QmsQualityInstanceMapper qmsQualityInstanceMapper;
@Autowired
private QmsQualityInstanceActivityMapper qmsQualityInstanceActivityMapper;
/**
*
*
@ -31,8 +42,7 @@ public class QmsQualityInstanceServiceImpl implements IQmsQualityInstanceService
* @return
*/
@Override
public QmsQualityInstance selectQmsQualityInstanceByQualityInstanceId(Long qualityInstanceId)
{
public QmsQualityInstance selectQmsQualityInstanceByQualityInstanceId(Long qualityInstanceId) {
return qmsQualityInstanceMapper.selectQmsQualityInstanceByQualityInstanceId(qualityInstanceId);
}
@ -43,8 +53,7 @@ public class QmsQualityInstanceServiceImpl implements IQmsQualityInstanceService
* @return
*/
@Override
public List<QmsQualityInstance> selectQmsQualityInstanceList(QmsQualityInstance qmsQualityInstance)
{
public List<QmsQualityInstance> selectQmsQualityInstanceList(QmsQualityInstance qmsQualityInstance) {
return qmsQualityInstanceMapper.selectQmsQualityInstanceList(qmsQualityInstance);
}
@ -56,8 +65,7 @@ public class QmsQualityInstanceServiceImpl implements IQmsQualityInstanceService
*/
@Transactional
@Override
public int insertQmsQualityInstance(QmsQualityInstance qmsQualityInstance)
{
public int insertQmsQualityInstance(QmsQualityInstance qmsQualityInstance) {
qmsQualityInstance.setCreateTime(DateUtils.getNowDate());
int rows = qmsQualityInstanceMapper.insertQmsQualityInstance(qmsQualityInstance);
insertQmsQualityInstanceActivity(qmsQualityInstance);
@ -72,8 +80,7 @@ public class QmsQualityInstanceServiceImpl implements IQmsQualityInstanceService
*/
@Transactional
@Override
public int updateQmsQualityInstance(QmsQualityInstance qmsQualityInstance)
{
public int updateQmsQualityInstance(QmsQualityInstance qmsQualityInstance) {
qmsQualityInstance.setUpdateTime(DateUtils.getNowDate());
qmsQualityInstanceMapper.deleteQmsQualityInstanceActivityByQualityInstanceId(qmsQualityInstance.getQualityInstanceId());
insertQmsQualityInstanceActivity(qmsQualityInstance);
@ -88,8 +95,7 @@ public class QmsQualityInstanceServiceImpl implements IQmsQualityInstanceService
*/
@Transactional
@Override
public int deleteQmsQualityInstanceByQualityInstanceIds(Long[] qualityInstanceIds)
{
public int deleteQmsQualityInstanceByQualityInstanceIds(Long[] qualityInstanceIds) {
qmsQualityInstanceMapper.deleteQmsQualityInstanceActivityByQualityInstanceIds(qualityInstanceIds);
return qmsQualityInstanceMapper.deleteQmsQualityInstanceByQualityInstanceIds(qualityInstanceIds);
}
@ -102,8 +108,7 @@ public class QmsQualityInstanceServiceImpl implements IQmsQualityInstanceService
*/
@Transactional
@Override
public int deleteQmsQualityInstanceByQualityInstanceId(Long qualityInstanceId)
{
public int deleteQmsQualityInstanceByQualityInstanceId(Long qualityInstanceId) {
qmsQualityInstanceMapper.deleteQmsQualityInstanceActivityByQualityInstanceId(qualityInstanceId);
return qmsQualityInstanceMapper.deleteQmsQualityInstanceByQualityInstanceId(qualityInstanceId);
}
@ -113,33 +118,22 @@ public class QmsQualityInstanceServiceImpl implements IQmsQualityInstanceService
*
* @param qmsQualityInstance
*/
public void insertQmsQualityInstanceActivity(QmsQualityInstance qmsQualityInstance)
{
public void insertQmsQualityInstanceActivity(QmsQualityInstance qmsQualityInstance) {
List<QmsQualityInstanceActivity> qmsQualityInstanceActivityList = qmsQualityInstance.getQmsQualityInstanceActivityList();
Long qualityInstanceId = qmsQualityInstance.getQualityInstanceId();
if (StringUtils.isNotNull(qmsQualityInstanceActivityList))
{
if (StringUtils.isNotNull(qmsQualityInstanceActivityList)) {
List<QmsQualityInstanceActivity> list = new ArrayList<QmsQualityInstanceActivity>();
for (QmsQualityInstanceActivity qmsQualityInstanceActivity : qmsQualityInstanceActivityList)
{
for (QmsQualityInstanceActivity qmsQualityInstanceActivity : qmsQualityInstanceActivityList) {
qmsQualityInstanceActivity.setQualityInstanceId(qualityInstanceId);
list.add(qmsQualityInstanceActivity);
}
if (list.size() > 0)
{
if (list.size() > 0) {
qmsQualityInstanceMapper.batchQmsQualityInstanceActivity(list);
}
}
}
/**
*
*
@ -147,8 +141,103 @@ public class QmsQualityInstanceServiceImpl implements IQmsQualityInstanceService
* @return
*/
@Override
public QmsQualityInstance selectQmsQualityInstanceByCheckResultId(Long checkResultId)
{
public QmsQualityInstance selectQmsQualityInstanceByCheckResultId(Long checkResultId) {
return qmsQualityInstanceMapper.selectQmsQualityInstanceByCheckResultId(checkResultId);
}
/**
*
*
* @param qmsQualityInstanceActivityVo
* @param fileUrls
*/
@Transactional
@Override
public int handleQualityInstance(QmsQualityInstanceActivityVo qmsQualityInstanceActivityVo, List<String> fileUrls) {
Long checkResultId = qmsQualityInstanceActivityVo.getCheckResultId();
QmsQualityInstance qmsQualityInstance = qmsQualityInstanceMapper.selectQmsQualityInstanceByCheckResultId(checkResultId);
Date currentDate = new Date();
String userName = SecurityUtils.getUsername();
//todo:权限校验
if (qmsQualityInstance == null) {
qmsQualityInstance = new QmsQualityInstance();
qmsQualityInstance.setCheckResultId(checkResultId);
qmsQualityInstance.setWfProcessId(WfConstants.WF_QUALITY_ABNORMAL_PROCESS_ID);
qmsQualityInstance.setWfInstanceStatus(WfConstants.WF_INSTANCE_STATUS_START);
qmsQualityInstance.setStartTime(currentDate);
qmsQualityInstance.setCreateTime(currentDate);
qmsQualityInstance.setCreateBy(userName);
int rows = qmsQualityInstanceMapper.insertQmsQualityInstance(qmsQualityInstance);
QmsQualityInstanceActivity qmsQualityInstanceActivity = new QmsQualityInstanceActivity();
qmsQualityInstanceActivity.setQualityInstanceId(qmsQualityInstance.getQualityInstanceId());
qmsQualityInstanceActivity.setProcessActivityId(qmsQualityInstanceActivityVo.getProcessActivityId());
qmsQualityInstanceActivity.setProcessHandleResolution(qmsQualityInstanceActivityVo.getProcessHandleResolution());
qmsQualityInstanceActivity.setProcessStepOrder(qmsQualityInstanceActivityVo.getProcessStepOrder());
qmsQualityInstanceActivity.setProcessHandleStatus(WfConstants.WF_PROCESS_HANDLE_STATUS_FINISH);
qmsQualityInstanceActivity.setStartTime(currentDate);
qmsQualityInstanceActivity.setEndTime(currentDate);
qmsQualityInstanceActivity.setHandleUserId(SecurityUtils.getUserId());
qmsQualityInstanceActivity.setHandleBy(userName);
qmsQualityInstanceActivity.setHandleTime(currentDate);
qmsQualityInstanceActivity.setCreateBy(userName);
qmsQualityInstanceActivity.setCreateTime(currentDate);
qmsQualityInstanceActivityMapper.insertQmsQualityInstanceActivity(qmsQualityInstanceActivity);
insertQmsCheckInstanceFile(qmsQualityInstanceActivity, fileUrls);
return rows;
} else {
QmsQualityInstanceActivity qmsQualityInstanceActivity = new QmsQualityInstanceActivity();
qmsQualityInstanceActivity.setQualityInstanceId(qmsQualityInstance.getQualityInstanceId());
qmsQualityInstanceActivity.setProcessActivityId(qmsQualityInstanceActivityVo.getProcessActivityId());
qmsQualityInstanceActivity.setProcessHandleResolution(qmsQualityInstanceActivityVo.getProcessHandleResolution());
qmsQualityInstanceActivity.setProcessStepOrder(qmsQualityInstanceActivityVo.getProcessStepOrder());
qmsQualityInstanceActivity.setProcessHandleStatus(WfConstants.WF_PROCESS_HANDLE_STATUS_FINISH);
qmsQualityInstanceActivity.setStartTime(currentDate);
qmsQualityInstanceActivity.setEndTime(currentDate);
qmsQualityInstanceActivity.setHandleUserId(SecurityUtils.getUserId());
qmsQualityInstanceActivity.setHandleBy(userName);
qmsQualityInstanceActivity.setHandleTime(currentDate);
qmsQualityInstanceActivity.setCreateBy(userName);
qmsQualityInstanceActivity.setCreateTime(currentDate);
//todo:如果工单流程增加到2步以上需要判断是否是最后一步再处理
qmsQualityInstance.setEndTime(currentDate);
qmsQualityInstance.setWfInstanceStatus(WfConstants.WF_INSTANCE_STATUS_FINISH);
qmsQualityInstance.setUpdateTime(currentDate);
qmsQualityInstance.setUpdateBy(userName);
qmsQualityInstanceMapper.updateQmsQualityInstance(qmsQualityInstance);
return qmsQualityInstanceActivityMapper.insertQmsQualityInstanceActivity(qmsQualityInstanceActivity);
}
}
/**
*
*
* @param qmsQualityInstanceActivity
* @param fileUrls url
*/
public void insertQmsCheckInstanceFile(QmsQualityInstanceActivity qmsQualityInstanceActivity, List<String> fileUrls) {
Long instanceActivityId = qmsQualityInstanceActivity.getInstanceActivityId();
if (StringUtils.isNotNull(fileUrls)) {
List<QmsCheckInstanceFile> list = new ArrayList<QmsCheckInstanceFile>();
for (String fileUrl : fileUrls) {
QmsCheckInstanceFile qmsCheckInstanceFile = new QmsCheckInstanceFile();
qmsCheckInstanceFile.setTargetId(instanceActivityId);
qmsCheckInstanceFile.setTargetType(WfConstants.QMS_FILE_TARGET_TYPE_QUALITY_INSTANCE_ACTIVITY);
qmsCheckInstanceFile.setFaultFile(fileUrl);
list.add(qmsCheckInstanceFile);
}
if (list.size() > 0) {
qmsQualityInstanceActivityMapper.batchQmsCheckInstanceFile(list);
}
}
}
}

@ -0,0 +1,151 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hw.qms.mapper.QmsQualityInstanceActivityMapper">
<resultMap type="QmsQualityInstanceActivity" id="QmsQualityInstanceActivityResult">
<result property="instanceActivityId" column="instance_activity_id" />
<result property="qualityInstanceId" column="quality_instance_id" />
<result property="processActivityId" column="process_activity_id" />
<result property="processHandleResolution" column="process_handle_resolution" />
<result property="processHandleDesc" column="process_handle_desc" />
<result property="processHandleStatus" column="process_handle_status" />
<result property="processStepOrder" column="process_step_order" />
<result property="startTime" column="start_time" />
<result property="endTime" column="end_time" />
<result property="handleUserId" column="handle_user_id" />
<result property="handleBy" column="handle_by" />
<result property="handleTime" column="handle_time" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="transferUserId" column="transfer_user_id" />
</resultMap>
<resultMap id="QmsQualityInstanceActivityQmsCheckInstanceFileResult" type="QmsQualityInstanceActivity" extends="QmsQualityInstanceActivityResult">
<collection property="qmsCheckInstanceFileList" notNullColumn="sub_check_instance_file_id" javaType="java.util.List" resultMap="QmsCheckInstanceFileResult" />
</resultMap>
<resultMap type="QmsCheckInstanceFile" id="QmsCheckInstanceFileResult">
<result property="checkInstanceFileId" column="sub_check_instance_file_id" />
<result property="targetType" column="sub_target_type" />
<result property="targetId" column="sub_target_id" />
<result property="faultFile" column="sub_fault_file" />
</resultMap>
<sql id="selectQmsQualityInstanceActivityVo">
select instance_activity_id, quality_instance_id, process_activity_id, process_handle_resolution, process_handle_desc, process_handle_status, process_step_order, start_time, end_time, handle_user_id, handle_by, handle_time, create_by, create_time, transfer_user_id from qms_quality_instance_activity
</sql>
<select id="selectQmsQualityInstanceActivityList" parameterType="QmsQualityInstanceActivity" resultMap="QmsQualityInstanceActivityResult">
<include refid="selectQmsQualityInstanceActivityVo"/>
<where>
<if test="qualityInstanceId != null "> and quality_instance_id = #{qualityInstanceId}</if>
<if test="processActivityId != null "> and process_activity_id = #{processActivityId}</if>
<if test="processHandleResolution != null and processHandleResolution != ''"> and process_handle_resolution = #{processHandleResolution}</if>
<if test="processHandleDesc != null and processHandleDesc != ''"> and process_handle_desc = #{processHandleDesc}</if>
<if test="processHandleStatus != null and processHandleStatus != ''"> and process_handle_status = #{processHandleStatus}</if>
<if test="processStepOrder != null "> and process_step_order = #{processStepOrder}</if>
<if test="startTime != null "> and start_time = #{startTime}</if>
<if test="endTime != null "> and end_time = #{endTime}</if>
<if test="handleUserId != null "> and handle_user_id = #{handleUserId}</if>
<if test="handleBy != null and handleBy != ''"> and handle_by = #{handleBy}</if>
<if test="handleTime != null "> and handle_time = #{handleTime}</if>
<if test="transferUserId != null "> and transfer_user_id = #{transferUserId}</if>
</where>
</select>
<select id="selectQmsQualityInstanceActivityByInstanceActivityId" parameterType="Long" resultMap="QmsQualityInstanceActivityQmsCheckInstanceFileResult">
select a.instance_activity_id, a.quality_instance_id, a.process_activity_id, a.process_handle_resolution, a.process_handle_desc, a.process_handle_status, a.process_step_order, a.start_time, a.end_time, a.handle_user_id, a.handle_by, a.handle_time, a.create_by, a.create_time, a.transfer_user_id,
b.check_instance_file_id as sub_check_instance_file_id, b.target_type as sub_target_type, b.target_id as sub_target_id, b.fault_file as sub_fault_file
from qms_quality_instance_activity a
left join qms_check_instance_file b on b.target_id = a.instance_activity_id
where a.instance_activity_id = #{instanceActivityId}
</select>
<insert id="insertQmsQualityInstanceActivity" parameterType="QmsQualityInstanceActivity" useGeneratedKeys="true" keyProperty="instanceActivityId">
insert into qms_quality_instance_activity
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="qualityInstanceId != null">quality_instance_id,</if>
<if test="processActivityId != null">process_activity_id,</if>
<if test="processHandleResolution != null and processHandleResolution != ''">process_handle_resolution,</if>
<if test="processHandleDesc != null">process_handle_desc,</if>
<if test="processHandleStatus != null">process_handle_status,</if>
<if test="processStepOrder != null">process_step_order,</if>
<if test="startTime != null">start_time,</if>
<if test="endTime != null">end_time,</if>
<if test="handleUserId != null">handle_user_id,</if>
<if test="handleBy != null">handle_by,</if>
<if test="handleTime != null">handle_time,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="transferUserId != null">transfer_user_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="qualityInstanceId != null">#{qualityInstanceId},</if>
<if test="processActivityId != null">#{processActivityId},</if>
<if test="processHandleResolution != null and processHandleResolution != ''">#{processHandleResolution},</if>
<if test="processHandleDesc != null">#{processHandleDesc},</if>
<if test="processHandleStatus != null">#{processHandleStatus},</if>
<if test="processStepOrder != null">#{processStepOrder},</if>
<if test="startTime != null">#{startTime},</if>
<if test="endTime != null">#{endTime},</if>
<if test="handleUserId != null">#{handleUserId},</if>
<if test="handleBy != null">#{handleBy},</if>
<if test="handleTime != null">#{handleTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="transferUserId != null">#{transferUserId},</if>
</trim>
</insert>
<update id="updateQmsQualityInstanceActivity" parameterType="QmsQualityInstanceActivity">
update qms_quality_instance_activity
<trim prefix="SET" suffixOverrides=",">
<if test="qualityInstanceId != null">quality_instance_id = #{qualityInstanceId},</if>
<if test="processActivityId != null">process_activity_id = #{processActivityId},</if>
<if test="processHandleResolution != null and processHandleResolution != ''">process_handle_resolution = #{processHandleResolution},</if>
<if test="processHandleDesc != null">process_handle_desc = #{processHandleDesc},</if>
<if test="processHandleStatus != null">process_handle_status = #{processHandleStatus},</if>
<if test="processStepOrder != null">process_step_order = #{processStepOrder},</if>
<if test="startTime != null">start_time = #{startTime},</if>
<if test="endTime != null">end_time = #{endTime},</if>
<if test="handleUserId != null">handle_user_id = #{handleUserId},</if>
<if test="handleBy != null">handle_by = #{handleBy},</if>
<if test="handleTime != null">handle_time = #{handleTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="transferUserId != null">transfer_user_id = #{transferUserId},</if>
</trim>
where instance_activity_id = #{instanceActivityId}
</update>
<delete id="deleteQmsQualityInstanceActivityByInstanceActivityId" parameterType="Long">
delete from qms_quality_instance_activity where instance_activity_id = #{instanceActivityId}
</delete>
<delete id="deleteQmsQualityInstanceActivityByInstanceActivityIds" parameterType="String">
delete from qms_quality_instance_activity where instance_activity_id in
<foreach item="instanceActivityId" collection="array" open="(" separator="," close=")">
#{instanceActivityId}
</foreach>
</delete>
<delete id="deleteQmsCheckInstanceFileByTargetIds" parameterType="String">
delete from qms_check_instance_file where target_id in
<foreach item="targetId" collection="array" open="(" separator="," close=")">
#{targetId}
</foreach>
</delete>
<delete id="deleteQmsCheckInstanceFileByTargetId" parameterType="Long">
delete from qms_check_instance_file where target_id = #{targetId}
</delete>
<insert id="batchQmsCheckInstanceFile">
insert into qms_check_instance_file( check_instance_file_id, target_type, target_id, fault_file) values
<foreach item="item" index="index" collection="list" separator=",">
( #{item.checkInstanceFileId}, #{item.targetType}, #{item.targetId}, #{item.faultFile})
</foreach>
</insert>
</mapper>

@ -3,8 +3,9 @@ package com.hw.system.common.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.hw.common.security.annotation.InnerAuth;
import com.hw.system.api.domain.common.WfProcessActivity;
import oracle.jdbc.proxy.annotation.Post;
import com.hw.system.api.domain.common.vo.WfProcessActivityVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
@ -111,4 +112,13 @@ public class WfProcessActivityController extends BaseController
return wfProcessActivityService.selectProcessActivityIdByWfProcessId(wfProcessId);
// return 200l;
}
@InnerAuth
@PostMapping("/getWfProcessActivityByUI")
public AjaxResult getWfProcessActivityByUI(@RequestBody WfProcessActivityVo queryProcessActivityVo) {
return success(wfProcessActivityService.selectWfProcessActivityByUI(queryProcessActivityVo.getWfProcessId(),
queryProcessActivityVo.getProcessActivityOrder()));
}
}

@ -2,6 +2,7 @@ package com.hw.system.common.mapper;
import com.hw.system.api.domain.common.WfProcessActivity;
import com.hw.system.api.domain.common.WfProcessActivityAuth;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -88,4 +89,15 @@ public interface WfProcessActivityMapper
Long selectProcessActivityIdByWfProcessId(Long wfProcessId);
/**
*
*
* @param wfProcessId
* @param processActivityOrder
* @return
*/
public WfProcessActivity selectWfProcessActivityByUI(@Param("wfProcessId") Long wfProcessId,
@Param("processActivityOrder") Long processActivityOrder);
}

@ -10,8 +10,7 @@ import java.util.List;
* @author xins
* @date 2024-01-19
*/
public interface IWfProcessActivityService
{
public interface IWfProcessActivityService {
/**
*
*
@ -61,4 +60,14 @@ public interface IWfProcessActivityService
public int deleteWfProcessActivityByProcessActivityId(Long processActivityId);
Long selectProcessActivityIdByWfProcessId(Long wfProcessId);
/**
*
*
* @param wfProcessId
* @param processActivityOrder
* @return
*/
public WfProcessActivity selectWfProcessActivityByUI(Long wfProcessId, Long processActivityOrder);
}

@ -166,4 +166,17 @@ public class WfProcessActivityServiceImpl implements IWfProcessActivityService
}
}
}
/**
*
*
* @param wfProcessId
* @param processActivityOrder
* @return
*/
public WfProcessActivity selectWfProcessActivityByUI(Long wfProcessId, Long processActivityOrder){
return wfProcessActivityMapper.selectWfProcessActivityByUI(wfProcessId, processActivityOrder);
}
}

@ -164,4 +164,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectProcessActivityIdByWfProcessId" parameterType="Long" resultType="Long">
select min(process_activity_id) from wf_process_activity where wf_process_id = #{wfProcessId}
</select>
<select id="selectWfProcessActivityByUI" resultMap="WfProcessActivityResult">
select a.process_activity_id, a.wf_process_id, a.process_activity_name, a.process_activity_order, a.wf_activity_type, a.email_notice, a.wechat_offical_notice, a.wecom_notice, a.sms_notice, a.dingtalk_notice, a.time_limit
from wf_process_activity a
where a.wf_process_id = #{wfProcessId} and a.process_activity_order = #{processActivityOrder} limit 1
</select>
</mapper>

Loading…
Cancel
Save