|
@@ -3,27 +3,24 @@ package com.qmth.sop.business.service.impl;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.qmth.sop.business.activiti.service.ActivitiService;
|
|
|
-import com.qmth.sop.business.bean.params.FlowApproveParam;
|
|
|
import com.qmth.sop.business.bean.result.TBQualityProblemApplyResult;
|
|
|
-import com.qmth.sop.business.entity.SysUser;
|
|
|
import com.qmth.sop.business.entity.TBQualityProblemApply;
|
|
|
-import com.qmth.sop.business.entity.TFCustomFlowEntity;
|
|
|
import com.qmth.sop.business.mapper.TBQualityProblemApplyMapper;
|
|
|
+import com.qmth.sop.business.service.SequenceService;
|
|
|
import com.qmth.sop.business.service.TBQualityProblemApplyService;
|
|
|
import com.qmth.sop.business.service.TFCustomFlowEntityService;
|
|
|
-import com.qmth.sop.common.contant.SystemConstant;
|
|
|
-import com.qmth.sop.common.enums.FlowApprovePassEnum;
|
|
|
import com.qmth.sop.common.enums.InfluenceDegreeEnum;
|
|
|
import com.qmth.sop.common.enums.QualityProblemReasonEnum;
|
|
|
import com.qmth.sop.common.enums.QualityProblemTypeEnum;
|
|
|
+import com.qmth.sop.common.enums.TFCustomTypeEnum;
|
|
|
import com.qmth.sop.common.util.ServletUtil;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
-import java.util.Arrays;
|
|
|
-import java.util.Map;
|
|
|
-import java.util.Objects;
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* 质量问题反馈表 服务实现.
|
|
@@ -43,6 +40,9 @@ public class TBQualityProblemApplyServiceImpl extends ServiceImpl<TBQualityProbl
|
|
|
@Resource
|
|
|
ActivitiService activitiService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ SequenceService sequenceService;
|
|
|
+
|
|
|
/**
|
|
|
* 查询列表
|
|
|
*
|
|
@@ -62,13 +62,20 @@ public class TBQualityProblemApplyServiceImpl extends ServiceImpl<TBQualityProbl
|
|
|
@Override
|
|
|
@Transactional
|
|
|
public Boolean saveTBQualityProblemApply(TBQualityProblemApply tbQualityProblemApply) throws InterruptedException {
|
|
|
- SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
- Map<String, Object> map = activitiService.taskApprove(new FlowApproveParam(tbQualityProblemApply.getFlowDeploymentId(), FlowApprovePassEnum.START, tbQualityProblemApply.getFormProperties(), Arrays.asList(String.valueOf(sysUser.getId()))));
|
|
|
- TFCustomFlowEntity tfCustomFlowEntity = (TFCustomFlowEntity) map.get(SystemConstant.CUSTOM_FLOW_ENTITY);
|
|
|
- tbQualityProblemApply.setProblemNo(tfCustomFlowEntity.getCode());
|
|
|
- tbQualityProblemApply.setId(SystemConstant.getDbUuid());
|
|
|
- tfCustomFlowEntity.setObjId(tbQualityProblemApply.getId());
|
|
|
- tfCustomFlowEntityService.updateById(tfCustomFlowEntity);
|
|
|
+ HttpServletRequest request = ServletUtil.getRequest();
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ Map<String, String> formDataMap = new HashMap<>();
|
|
|
+ Map<String, String[]> parameterMap = request.getParameterMap();
|
|
|
+ Set<Map.Entry<String, String[]>> entrySet = parameterMap.entrySet();
|
|
|
+ for (Map.Entry<String, String[]> entry : entrySet) {
|
|
|
+ String key = entry.getKey();
|
|
|
+ String[] value = entry.getValue();
|
|
|
+ formDataMap.put(key, value[0]);
|
|
|
+ }
|
|
|
+ map.putAll(formDataMap);
|
|
|
+ Map<String, Object> resultMap = activitiService.taskApprove(tbQualityProblemApply.getFlowDeploymentId(), tbQualityProblemApply.getApprove(), null, null, tbQualityProblemApply.getFormProperties(), tbQualityProblemApply.getApproveUserIds(), null, map);
|
|
|
+ String problemNo = sequenceService.createFlowCode(TFCustomTypeEnum.QUALITY_PROBLEM_FLOW);
|
|
|
+ tbQualityProblemApply.setProblemNo(problemNo);
|
|
|
return this.saveOrUpdate(tbQualityProblemApply);
|
|
|
}
|
|
|
|
|
@@ -80,10 +87,8 @@ public class TBQualityProblemApplyServiceImpl extends ServiceImpl<TBQualityProbl
|
|
|
@Override
|
|
|
@Transactional
|
|
|
public Boolean delete(long[] ids) {
|
|
|
- for (long id : ids) {
|
|
|
- this.removeById(id);
|
|
|
- }
|
|
|
- return true;
|
|
|
+ List<Long> idList = Arrays.stream(ids).boxed().collect(Collectors.toList());
|
|
|
+ return this.removeByIds(idList);
|
|
|
}
|
|
|
|
|
|
}
|