|
@@ -13,10 +13,7 @@ import com.qmth.sop.business.entity.TFCustomFlowEntity;
|
|
import com.qmth.sop.business.entity.TFFlowApprove;
|
|
import com.qmth.sop.business.entity.TFFlowApprove;
|
|
import com.qmth.sop.business.entity.TFFlowLog;
|
|
import com.qmth.sop.business.entity.TFFlowLog;
|
|
import com.qmth.sop.business.mapper.SysUserMapper;
|
|
import com.qmth.sop.business.mapper.SysUserMapper;
|
|
-import com.qmth.sop.business.service.TFCustomFlowEntityService;
|
|
|
|
-import com.qmth.sop.business.service.TFCustomFlowService;
|
|
|
|
-import com.qmth.sop.business.service.TFFlowApproveService;
|
|
|
|
-import com.qmth.sop.business.service.TFFlowLogService;
|
|
|
|
|
|
+import com.qmth.sop.business.service.*;
|
|
import com.qmth.sop.common.contant.SystemConstant;
|
|
import com.qmth.sop.common.contant.SystemConstant;
|
|
import com.qmth.sop.common.enums.*;
|
|
import com.qmth.sop.common.enums.*;
|
|
import com.qmth.sop.common.lock.MemoryLock;
|
|
import com.qmth.sop.common.lock.MemoryLock;
|
|
@@ -41,6 +38,7 @@ import org.springframework.core.io.ClassPathResource;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.util.CollectionUtils;
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
@@ -89,6 +87,9 @@ public class ActivitiServiceImpl implements ActivitiService {
|
|
@Resource
|
|
@Resource
|
|
TFFlowLogService tfFlowLogService;
|
|
TFFlowLogService tfFlowLogService;
|
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
+ BasicAttachmentService basicAttachmentService;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 根据deploymentId查找processDefinitionId
|
|
* 根据deploymentId查找processDefinitionId
|
|
*
|
|
*
|
|
@@ -100,22 +101,46 @@ public class ActivitiServiceImpl implements ActivitiService {
|
|
return sysUserMapper.findProcessDefinitionIdByDeploymentId(deploymentId);
|
|
return sysUserMapper.findProcessDefinitionIdByDeploymentId(deploymentId);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 上传流程
|
|
|
|
+ *
|
|
|
|
+ * @param file
|
|
|
|
+ * @return
|
|
|
|
+ * @throws IOException
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ public Map<String, Object> upload(MultipartFile file) throws IOException {
|
|
|
|
+ basicAttachmentService.validateAttachment(file);
|
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
|
+ DeploymentBuilder builder = repositoryService.createDeployment();
|
|
|
|
+ ZipInputStream zip = new ZipInputStream(file.getInputStream());
|
|
|
|
+ builder.addZipInputStream(zip);
|
|
|
|
+ Map<String, Object> mapData = formPropertiesGet(builder.deploy().getId(), null, null);
|
|
|
|
+ map.put(file.getName(), mapData);
|
|
|
|
+ return map;
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 部署流程
|
|
* 部署流程
|
|
*
|
|
*
|
|
* @param tfCustomTypeEnumList
|
|
* @param tfCustomTypeEnumList
|
|
* @return
|
|
* @return
|
|
|
|
+ * @throws IOException
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
public Map<String, Object> createDeployment(List<TFCustomTypeEnum> tfCustomTypeEnumList) throws IOException {
|
|
public Map<String, Object> createDeployment(List<TFCustomTypeEnum> tfCustomTypeEnumList) throws IOException {
|
|
- Map<String, Object> map = new HashMap<>();
|
|
|
|
|
|
+ Map<String, Object> map = null;
|
|
for (TFCustomTypeEnum tfCustomTypeEnum : tfCustomTypeEnumList) {
|
|
for (TFCustomTypeEnum tfCustomTypeEnum : tfCustomTypeEnumList) {
|
|
- DeploymentBuilder builder = repositoryService.createDeployment();
|
|
|
|
- ClassPathResource resource = new ClassPathResource(tfCustomTypeEnum.getFileName());
|
|
|
|
- ZipInputStream zip = new ZipInputStream(resource.getInputStream());
|
|
|
|
- builder.addZipInputStream(zip);
|
|
|
|
- Map<String, Object> mapData = formPropertiesGet(builder.deploy().getId(), null, null);
|
|
|
|
- map.put(tfCustomTypeEnum.name(), mapData);
|
|
|
|
|
|
+ List<TFCustomFlow> tfCustomFlowList = tfCustomFlowService.list(new QueryWrapper<TFCustomFlow>().lambda().eq(TFCustomFlow::getType, tfCustomTypeEnum));
|
|
|
|
+ if (CollectionUtils.isEmpty(tfCustomFlowList)) {
|
|
|
|
+ map = CollectionUtils.isEmpty(map) ? new HashMap<>() : map;
|
|
|
|
+ DeploymentBuilder builder = repositoryService.createDeployment();
|
|
|
|
+ ClassPathResource resource = new ClassPathResource(tfCustomTypeEnum.getFileName());
|
|
|
|
+ ZipInputStream zip = new ZipInputStream(resource.getInputStream());
|
|
|
|
+ builder.addZipInputStream(zip);
|
|
|
|
+ Map<String, Object> mapData = formPropertiesGet(builder.deploy().getId(), null, null);
|
|
|
|
+ map.put(tfCustomTypeEnum.name(), mapData);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
return map;
|
|
return map;
|
|
}
|
|
}
|