|
@@ -2,21 +2,27 @@ 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.boot.api.exception.ApiException;
|
|
|
+import com.qmth.sop.business.activiti.service.ActivitiService;
|
|
|
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.mapper.TBQualityProblemApplyMapper;
|
|
|
+import com.qmth.sop.business.service.SequenceService;
|
|
|
import com.qmth.sop.business.service.TBQualityProblemApplyService;
|
|
|
-import com.qmth.sop.common.enums.*;
|
|
|
-import com.qmth.sop.common.util.ResultUtil;
|
|
|
+import com.qmth.sop.business.service.TFCustomFlowEntityService;
|
|
|
+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.dao.DuplicateKeyException;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.Map;
|
|
|
import java.util.Objects;
|
|
|
+import java.util.Set;
|
|
|
|
|
|
/**
|
|
|
* 质量问题反馈表 服务实现.
|
|
@@ -30,6 +36,14 @@ import java.util.Objects;
|
|
|
@Service
|
|
|
public class TBQualityProblemApplyServiceImpl extends ServiceImpl<TBQualityProblemApplyMapper, TBQualityProblemApply> implements TBQualityProblemApplyService {
|
|
|
|
|
|
+ @Resource
|
|
|
+ TFCustomFlowEntityService tfCustomFlowEntityService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ ActivitiService activitiService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ SequenceService sequenceService;
|
|
|
|
|
|
/**
|
|
|
* 查询列表
|
|
@@ -37,43 +51,34 @@ public class TBQualityProblemApplyServiceImpl extends ServiceImpl<TBQualityProbl
|
|
|
* @param iPage
|
|
|
* @return
|
|
|
*/
|
|
|
-// @Override
|
|
|
-// public IPage<TBQualityProblemApply> query(IPage<Map> iPage,String query) {
|
|
|
-// return this.baseMapper.query(iPage,query);
|
|
|
-// }
|
|
|
@Override
|
|
|
public IPage<TBQualityProblemApplyResult> query(IPage<Map> iPage, Long serviceId, Long userId, QualityProblemTypeEnum type, QualityProblemReasonEnum reason, InfluenceDegreeEnum degree, String custom, String problemNo, Long startTime, Long endTime) {
|
|
|
- return this.baseMapper.query(iPage, serviceId,userId,Objects.nonNull(type)?type.name():null,Objects.nonNull(reason)?reason.name():null,Objects.nonNull(degree)?degree.name():null,custom,problemNo,startTime,endTime);
|
|
|
+ return this.baseMapper.query(iPage, serviceId, userId, Objects.nonNull(type) ? type.name() : null, Objects.nonNull(reason) ? reason.name() : null, Objects.nonNull(degree) ? degree.name() : null, custom, problemNo, startTime, endTime);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 新增修改质量问题反馈表
|
|
|
*
|
|
|
- * @param tBQualityProblemApply
|
|
|
+ * @param tbQualityProblemApply
|
|
|
*/
|
|
|
@Override
|
|
|
@Transactional
|
|
|
- public Boolean saveTBQualityProblemApply(TBQualityProblemApply tBQualityProblemApply) {
|
|
|
- try {
|
|
|
- SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
- if (Objects.isNull(tBQualityProblemApply.getId())) {// 新增
|
|
|
- tBQualityProblemApply.setCreateId(1l);
|
|
|
- } else { // 修改
|
|
|
- }
|
|
|
- return saveOrUpdate(tBQualityProblemApply);
|
|
|
- } catch (Exception e) {
|
|
|
- if (e instanceof DuplicateKeyException) {
|
|
|
- String errorColumn = e.getCause().toString();
|
|
|
- String columnStr = errorColumn.substring(errorColumn.lastIndexOf("key") + 3, errorColumn.length()).replaceAll("'", "");
|
|
|
- throw ExceptionResultEnum.SQL_ERROR.exception("[" + FieldUniqueEnum.convertToTitle(columnStr) + "]数据不允许重复插入");
|
|
|
- } else if (e instanceof ApiException) {
|
|
|
- ResultUtil.error((ApiException) e, e.getMessage());
|
|
|
- } else {
|
|
|
- ResultUtil.error(e.getMessage());
|
|
|
- }
|
|
|
+ public Boolean saveTBQualityProblemApply(TBQualityProblemApply tbQualityProblemApply) throws InterruptedException {
|
|
|
+ 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]);
|
|
|
}
|
|
|
- return null;
|
|
|
-
|
|
|
+ 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);
|
|
|
}
|
|
|
|
|
|
/**
|