添加仿真流程模版库
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
package com.sdm.capability.controller;
|
||||
|
||||
import com.sdm.capability.model.req.flow.DelFlowTemplateByDirReq;
|
||||
import com.sdm.capability.model.req.flow.DeprecatedTemplateReq;
|
||||
import com.sdm.capability.model.req.flow.GetFlowTemplateByNameReq;
|
||||
import com.sdm.capability.model.req.flow.UpdatePatentApplicationReq;
|
||||
import com.sdm.capability.service.FlowService;
|
||||
import com.sdm.capability.model.entity.SimulationFlowTemplate;
|
||||
import com.sdm.capability.model.req.flow.GetFlowTemplateReq;
|
||||
import com.sdm.capability.service.IFlowService;
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.entity.req.system.LaunchApproveReq;
|
||||
import com.sdm.common.feign.inter.capability.ISimulationFlowTemplateFeignClient;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@@ -13,70 +13,97 @@ import javax.annotation.Resource;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/flow")
|
||||
public class FlowController {
|
||||
public class FlowController implements ISimulationFlowTemplateFeignClient {
|
||||
|
||||
@Resource
|
||||
private FlowService flowService;
|
||||
private IFlowService IFlowService;
|
||||
|
||||
/**
|
||||
* 根据路径获取流程模板
|
||||
*
|
||||
* @param route
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getFlowTemplateByRoute")
|
||||
public SdmResponse getFlowTemplateByName(@RequestParam("route") String route) {
|
||||
return SdmResponse.success(flowService.getFlowTemplateByRoute(route));
|
||||
}
|
||||
|
||||
@PostMapping("/getFlowTemplatePath")
|
||||
public SdmResponse getFlowTemplatePath() {
|
||||
return flowService.getFlowTemplatePth();
|
||||
}
|
||||
|
||||
@PostMapping("/updateFlowTemplatePath")
|
||||
public SdmResponse updateFlowTemplatePath() {
|
||||
return flowService.updateFlowTemplatePath();
|
||||
}
|
||||
|
||||
@PostMapping("/delFlowTemplateByDir")
|
||||
public SdmResponse delFlowTemplateByDir(@RequestBody @Validated DelFlowTemplateByDirReq req) {
|
||||
return flowService.delFlowTemplateByDir(req);
|
||||
@PostMapping("/createFlowTemplateDraft")
|
||||
public SdmResponse createFlowTemplateDraft(@RequestBody @Validated SimulationFlowTemplate flowTemplate) {
|
||||
return IFlowService.createFlowTemplateDraft(flowTemplate);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据名称查询流程模板
|
||||
* @param req
|
||||
* 添加仿真流程模版草稿
|
||||
* @param template
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/getFlowTemplateByName")
|
||||
public SdmResponse getFlowTemplateByName(@RequestBody @Validated GetFlowTemplateByNameReq req) {
|
||||
return flowService.getFlowTemplateByName(req);
|
||||
@PostMapping("/upgradeFlowTemplateDraft")
|
||||
public SdmResponse upgradeFlowTemplateDraft(@RequestBody @Validated SimulationFlowTemplate template) {
|
||||
return IFlowService.upgradeFlowTemplateDraft(template);
|
||||
}
|
||||
|
||||
/**
|
||||
* 弃用模板
|
||||
* @param req
|
||||
* @param template
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/deprecatedTemplate")
|
||||
public SdmResponse deprecatedTemplate(@RequestBody @Validated DeprecatedTemplateReq req) {
|
||||
return flowService.deprecatedTemplate(req);
|
||||
@PostMapping("/updateFlowTemplateDraft")
|
||||
public SdmResponse updateFlowTemplateDraft(@RequestBody @Validated SimulationFlowTemplate template) {
|
||||
return IFlowService.updateFlowTemplateDraft(template);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新专利申请状态
|
||||
* 删除流程模版草稿
|
||||
* @param uuid
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/deleteFlowTemplateDraft")
|
||||
public SdmResponse deleteFlowTemplateDraft(@RequestParam("uuid") String uuid) {
|
||||
return IFlowService.deleteFlowTemplateDraft(uuid);
|
||||
}
|
||||
|
||||
@PostMapping("/releaseFlowTemplate")
|
||||
public SdmResponse releaseFlowTemplateDraft(@RequestParam("uuid") String uuid,@RequestParam("versionType") int versionType) {
|
||||
return IFlowService.releaseFlowTemplate(uuid,versionType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询流程模版
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("updatePatentApplication")
|
||||
public SdmResponse updatePatentApplication(@RequestBody @Validated UpdatePatentApplicationReq req) {
|
||||
return flowService.updatePatentApplication(req);
|
||||
@PostMapping("/queryFlowTemplate")
|
||||
public SdmResponse queryFlowTemplate(@RequestBody @Validated GetFlowTemplateReq req) {
|
||||
return IFlowService.getReleaseFlowTemplateByCondition(req.templateType,req.templateName,req.approveType,req.beginTime,req.endTime,req.creator,req.current,req.size,req.type,req.templateStatus);
|
||||
}
|
||||
|
||||
@GetMapping("/updateData")
|
||||
public SdmResponse updateData(String path) {
|
||||
return flowService.updateData(path);
|
||||
/**
|
||||
* 查询仿真流程模版版本信息
|
||||
* @param uuid
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/queryFlowTemplateVersion")
|
||||
public SdmResponse queryFlowTemplateVersion(@RequestParam("uuid") String uuid) {
|
||||
return IFlowService.getFlowTemplateVersions(uuid);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置流程模版启用状态
|
||||
* @param uuid
|
||||
* @param status
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/setFlowTemplateStatus")
|
||||
public SdmResponse turnOnOffFlowTemplate(@RequestParam("uuid") String uuid,@RequestParam("status")int status) {
|
||||
return IFlowService.turnOnOffTemplate(uuid,status);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过UUID获取流程模版详情
|
||||
* @param uuid
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/queryFlowTemplateInfo")
|
||||
public SdmResponse queryFlowTemplateInfo(@RequestParam("uuid") String uuid)
|
||||
{
|
||||
return IFlowService.getFlowTemplateInfo(uuid);
|
||||
}
|
||||
|
||||
@PostMapping("/flow/approveHandleNotice")
|
||||
public SdmResponse receiveApproveNotice(LaunchApproveReq req) {
|
||||
|
||||
return IFlowService.handleApproveResult(req);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,42 +1,29 @@
|
||||
package com.sdm.capability.dao;
|
||||
|
||||
import com.sdm.common.entity.pojo.capability.CapFlowTemplate;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import com.sdm.capability.model.entity.SimulationFlowTemplate;
|
||||
import com.sdm.capability.model.entity.SimulationFlowTemplateBrief;
|
||||
import org.apache.ibatis.annotations.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface FlowMapper {
|
||||
|
||||
int addFlowTemplate(@Param("name") String name, @Param("creator") String creator, @Param("path") String path,
|
||||
@Param("type") byte type, @Param("imagePath") String imagePath, @Param("description") String description,
|
||||
@Param("approveStatus") int approveStatus, @Param("englishName") String englishName);
|
||||
@Insert("INSERT INTO simulation_flow_template(uuid,templateName,templateVersion,templateContent,viewContent,parentUuid,templateStatus,templateType,approveType,comment,tenantId,createName,creator) VALUES(#{template.uuid},#{template.templateName},#{template.templateVersion},#{template.templateContent},#{template.viewContent},#{template.parentUuid},#{template.templateStatus},#{template.templateType},#{template.approveType},#{template.comment},#{template.tenantId},#{template.createName},#{template.creator})")
|
||||
int addFlowTemplate(@Param("template") SimulationFlowTemplate template);
|
||||
|
||||
int updateFlowTemplate(@Param("id") long id, @Param("name") String name, @Param("imagePath") String imagePath, @Param("path") String path,
|
||||
@Param("updater") String updater, @Param("type") byte type, @Param("englishName") String englishName);
|
||||
@Update("UPDATE simulation_flow_template SET templateContent=#{template.templateContent},viewContent=#{template.viewContent},templateType=#{template.templateType},templateStatus=#{template.templateStatus},comment=#{template.comment} WHERE uuid=#{template.uuid}")
|
||||
int updateFlowTemplate(@Param("template") SimulationFlowTemplate template);
|
||||
|
||||
int delFlowTemplateById(@Param("id") long id);
|
||||
@Delete("DELETE FROM simulation_flow_template WHERE uuid=#{uuid}")
|
||||
int deleteFlowTemplate(@Param("uuid") String uuid);
|
||||
|
||||
List<CapFlowTemplate> getFlowTemplateByRoute(@Param("route") String route, @Param("company") Long company);
|
||||
@Select("SELECT * FROM simulation_flow_template WHERE ${condition}")
|
||||
List<SimulationFlowTemplate> queryFlowTemplateByCondition(@Param("condition") String condition);
|
||||
|
||||
CapFlowTemplate getFlowTemplateById(Long id);
|
||||
@Select("SELECT templateVersion,approveType,uuid FROM simulation_flow_template WHERE templateName=#{templateName}")
|
||||
List<SimulationFlowTemplateBrief> queryFlowTemplateVersion(@Param("templateName") String templateName);
|
||||
|
||||
int getFlowTemplateByNameCount(@Param("name") String name, @Param("company") Long company);
|
||||
|
||||
int batchDelFlow(@Param("flowTemplateList") List<CapFlowTemplate> capFlowTemplateList);
|
||||
|
||||
List<CapFlowTemplate> getFlowTemplateByName(String name);
|
||||
|
||||
int deprecatedTemplate(@Param("id") long id, @Param("isDeprecated") byte isDeprecated, @Param("name") String name, @Param("targetPath") String targetPath, @Param("imagePath") String imagePath, @Param("updater") Long updater);
|
||||
|
||||
int updatePatentApplication(@Param("id") long id, @Param("isPatentApplication") byte isPatentApplication, @Param("updater") Long updater);
|
||||
|
||||
int getDeprecatedCount(@Param("name") String name);
|
||||
|
||||
int updateTemplateName(@Param("templateName") String templateName, @Param("oldTemplateName") String oldTemplateName, @Param("updater") Long updater);
|
||||
|
||||
String getFlowTemplateRouteById(Long id);
|
||||
|
||||
int getFlowTemplateCountByName(@Param("name") String name);
|
||||
}
|
||||
|
||||
@@ -24,14 +24,12 @@ public class AuthFilter implements Filter {
|
||||
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
|
||||
if (servletRequest instanceof HttpServletRequest) {
|
||||
HttpServletRequest req = (HttpServletRequest) servletRequest;
|
||||
String jobNumber = StringUtils.isEmpty(req.getHeader("jobNumber")) ? "" : req.getHeader("jobNumber");
|
||||
ThreadLocalContext.getCommonHeader().setJobNumber(jobNumber);
|
||||
ThreadLocalContext.getCommonHeader().setCompany(req.getHeader("company"));
|
||||
ThreadLocalContext.getCommonHeader().setSessionId(req.getHeader("sessionId"));
|
||||
// User user = userService.getUserByIdCode(idCode);
|
||||
// if (user != null) {
|
||||
// ThreadLocalContext.setUserContext(new UserContext(user));
|
||||
// }
|
||||
if(!ThreadLocalContext.verifyRequest(req))
|
||||
{
|
||||
servletResponse.getWriter().write("请求信息验证失败");
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
filterChain.doFilter(servletRequest, servletResponse);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.sdm.capability.model.entity;
|
||||
|
||||
import com.sdm.common.entity.pojo.BaseEntity;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Data
|
||||
public class SimulationFlowTemplate extends BaseEntity {
|
||||
|
||||
|
||||
public SimulationFlowTemplate() {
|
||||
init();
|
||||
}
|
||||
@Schema(description = "流程模版唯一ID")
|
||||
public String uuid;
|
||||
|
||||
@Schema(description = "流程模版名称")
|
||||
public String templateName;
|
||||
|
||||
@Schema(description = "流程模版版本")
|
||||
public String templateVersion;
|
||||
|
||||
@Schema(description = "流程模版内容")
|
||||
public String templateContent;
|
||||
|
||||
@Schema(description = "流程模版显示内容")
|
||||
public String viewContent;
|
||||
|
||||
@Schema(description = "父版本UUID")
|
||||
public String parentUuid;
|
||||
|
||||
@Schema(description = "模版状态")
|
||||
public int templateStatus = 1;
|
||||
|
||||
@Schema(description = "模版类型")
|
||||
public String templateType;
|
||||
|
||||
@Schema(description = "模版评审类型")
|
||||
public int approveType;
|
||||
|
||||
@Schema(description = "描述信息")
|
||||
public String comment;
|
||||
|
||||
@Schema(description = "升版类型 0:小版本 1:大版本")
|
||||
public int versionType;
|
||||
|
||||
@Schema(description = "评审流程模版名称")
|
||||
public String approveFlowTemplateName;
|
||||
|
||||
@Schema(description = "评审流程模版Id")
|
||||
public String approveFlowTemplateId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.sdm.capability.model.entity;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
public class SimulationFlowTemplateBrief {
|
||||
|
||||
@Schema(description = "流程模版版本")
|
||||
public String templateVersion;
|
||||
|
||||
@Schema(description = "评审状态")
|
||||
public int approveType;
|
||||
|
||||
@Schema(description = "流程模版唯一ID")
|
||||
public String uuid;
|
||||
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
package com.sdm.capability.model.req.flow;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
@Data
|
||||
public class AddFlowTemplateReq {
|
||||
|
||||
@NotBlank(message = "name不能为空")
|
||||
private String name;
|
||||
|
||||
@NotBlank(message = "creator不能为空")
|
||||
private String creator;
|
||||
|
||||
@NotBlank(message = "creatorName不能为空")
|
||||
private String creatorName;
|
||||
|
||||
@NotBlank(message = "path不能为空")
|
||||
private String path;
|
||||
|
||||
@NotNull(message = "type不能为空")
|
||||
private Byte type;
|
||||
|
||||
private String imagePath;
|
||||
private String description;
|
||||
private String updater;
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package com.sdm.capability.model.req.flow;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class BatchUpdateFlowTemplateReq {
|
||||
@NotNull(message = "id不能为空")
|
||||
private Long id;
|
||||
private String name;
|
||||
private String creator;
|
||||
private String creatorName;
|
||||
private String path;
|
||||
private Byte type;
|
||||
private Byte status;
|
||||
private String imagePath;
|
||||
private String description;
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package com.sdm.capability.model.req.flow;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class DelFlowTemplateByDirReq {
|
||||
|
||||
@NotBlank(message = "path不能为空")
|
||||
private String path;
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package com.sdm.capability.model.req.flow;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
@Data
|
||||
public class DelFlowTemplateReq {
|
||||
|
||||
@NotNull(message = "id不能为空")
|
||||
private Long id;
|
||||
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
package com.sdm.capability.model.req.flow;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class DeprecatedTemplateReq {
|
||||
|
||||
@NotNull(message = "id不能为空")
|
||||
private Long id;
|
||||
|
||||
@NotBlank(message = "name不能为空")
|
||||
private String name;
|
||||
|
||||
@NotNull(message = "isDeprecated不能为空")
|
||||
private Byte isDeprecated;
|
||||
|
||||
@NotBlank(message = "parentPath不能为空")
|
||||
private String parentPath;
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
package com.sdm.capability.model.req.flow;
|
||||
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class GetFlowTemplateByNameReq {
|
||||
|
||||
@NotBlank(message = "name不能为空")
|
||||
public String name;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.sdm.capability.model.req.flow;
|
||||
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class GetFlowTemplateReq {
|
||||
|
||||
|
||||
public String templateName;
|
||||
|
||||
public String templateType;
|
||||
|
||||
public int templateStatus;
|
||||
|
||||
public int approveType;
|
||||
|
||||
public long creator;
|
||||
|
||||
public String beginTime;
|
||||
|
||||
public String endTime;
|
||||
|
||||
public int type; //1:查询公共模版 2:查询个人
|
||||
|
||||
public int current;
|
||||
|
||||
public int size;
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package com.sdm.capability.model.req.flow;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class UpdateFlowTemplateReq {
|
||||
|
||||
@NotNull(message = "id不能为空")
|
||||
private Long id;
|
||||
private String name;
|
||||
private String creator;
|
||||
private String creatorName;
|
||||
private String path;
|
||||
private Byte type;
|
||||
private Byte status;
|
||||
private String imagePath;
|
||||
private String description;
|
||||
private String updater;
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
package com.sdm.capability.model.req.flow;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class UpdatePatentApplicationReq {
|
||||
|
||||
@NotNull(message = "id不能为空")
|
||||
private Long id;
|
||||
|
||||
@NotNull(message = "isPatentApplication不能为空")
|
||||
private Byte isPatentApplication;
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
package com.sdm.capability.service;
|
||||
|
||||
import com.sdm.capability.model.req.flow.DelFlowTemplateByDirReq;
|
||||
import com.sdm.capability.model.req.flow.DeprecatedTemplateReq;
|
||||
import com.sdm.capability.model.req.flow.GetFlowTemplateByNameReq;
|
||||
import com.sdm.capability.model.req.flow.UpdatePatentApplicationReq;
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.entity.pojo.capability.CapFlowTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public interface FlowService {
|
||||
|
||||
SdmResponse addFlowTemplate(String name, String creator, String creatorName, String path, byte type,
|
||||
String imagePath, String description, String updater, int approveStatus, String englishName);
|
||||
|
||||
int updateFlowTemplate(long id, String name, String imagePath, String path, String updater, byte type, String englishName);
|
||||
|
||||
int delFlowTemplateById(long id);
|
||||
|
||||
List<CapFlowTemplate> getFlowTemplateByRoute(String route);
|
||||
|
||||
SdmResponse getFlowTemplatePth();
|
||||
|
||||
SdmResponse updateFlowTemplatePath();
|
||||
|
||||
SdmResponse delFlowTemplateByDir(DelFlowTemplateByDirReq req);
|
||||
|
||||
SdmResponse getFlowTemplateByName(GetFlowTemplateByNameReq req);
|
||||
|
||||
SdmResponse deprecatedTemplate(DeprecatedTemplateReq req);
|
||||
|
||||
SdmResponse updatePatentApplication(UpdatePatentApplicationReq req);
|
||||
|
||||
String getFlowTemplateRouteById(Long id);
|
||||
|
||||
int getFlowTemplateCountByName(String name);
|
||||
|
||||
SdmResponse updateData(String path);
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package com.sdm.capability.service;
|
||||
|
||||
import com.sdm.capability.model.entity.SimulationFlowTemplate;
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.entity.req.system.LaunchApproveReq;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public interface IFlowService {
|
||||
|
||||
/**
|
||||
* 创建流程模版草稿
|
||||
* @param flowTemplate
|
||||
* @return
|
||||
*/
|
||||
SdmResponse createFlowTemplateDraft(SimulationFlowTemplate flowTemplate);
|
||||
/**
|
||||
* 添加流程模版草稿
|
||||
* @param flowTemplate
|
||||
* @return
|
||||
*/
|
||||
SdmResponse upgradeFlowTemplateDraft(SimulationFlowTemplate flowTemplate);
|
||||
|
||||
/**
|
||||
* 更新流程模版草稿
|
||||
* @param flowTemplate
|
||||
* @return
|
||||
*/
|
||||
SdmResponse updateFlowTemplateDraft(SimulationFlowTemplate flowTemplate);
|
||||
|
||||
/**
|
||||
* 删除流程模版
|
||||
* @param uuid
|
||||
* @return
|
||||
*/
|
||||
SdmResponse deleteFlowTemplateDraft(String uuid);
|
||||
|
||||
|
||||
/**
|
||||
* 发布流程模版
|
||||
* @param uuid
|
||||
* @return
|
||||
*/
|
||||
SdmResponse releaseFlowTemplate(String uuid,int versionType);
|
||||
|
||||
|
||||
/**
|
||||
* 通过类型获取发布流程模版
|
||||
* @param templateType
|
||||
* @param templateName
|
||||
* @param approveType
|
||||
* @param beginTime
|
||||
* @param endTime
|
||||
* @param creator
|
||||
* @return
|
||||
*/
|
||||
SdmResponse getReleaseFlowTemplateByCondition(String templateType,String templateName,int approveType,String beginTime,String endTime,long creator,int current,int size,int type,int templateStatus);
|
||||
|
||||
|
||||
/**
|
||||
* 弃用仿真流程模版
|
||||
* @param uuid
|
||||
* @return
|
||||
*/
|
||||
SdmResponse turnOnOffTemplate(String uuid,int status);
|
||||
|
||||
/**
|
||||
* 获取流程模版版本信息
|
||||
* @param uuid
|
||||
* @return
|
||||
*/
|
||||
SdmResponse getFlowTemplateVersions(String uuid);
|
||||
|
||||
/**
|
||||
* 获取流程模版详情
|
||||
* @param uuid
|
||||
* @return
|
||||
*/
|
||||
SdmResponse getFlowTemplateInfo(String uuid);
|
||||
|
||||
|
||||
/**
|
||||
* 处理评审结果
|
||||
* @param req
|
||||
*/
|
||||
public SdmResponse handleApproveResult(LaunchApproveReq req);
|
||||
}
|
||||
@@ -1,216 +1,343 @@
|
||||
package com.sdm.capability.service.impl;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.sdm.capability.dao.FlowMapper;
|
||||
import com.sdm.capability.model.bo.flow.DeprecatedTemplateRsp;
|
||||
import com.sdm.capability.model.bo.flow.FileResp;
|
||||
import com.sdm.capability.model.req.flow.DelFlowTemplateByDirReq;
|
||||
import com.sdm.capability.model.req.flow.DeprecatedTemplateReq;
|
||||
import com.sdm.capability.model.req.flow.GetFlowTemplateByNameReq;
|
||||
import com.sdm.capability.model.req.flow.UpdatePatentApplicationReq;
|
||||
import com.sdm.capability.service.FlowService;
|
||||
import com.sdm.capability.model.entity.SimulationFlowTemplate;
|
||||
import com.sdm.capability.model.entity.SimulationFlowTemplateBrief;
|
||||
import com.sdm.capability.service.IFlowService;
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.common.ThreadLocalContext;
|
||||
import com.sdm.common.entity.data.BaseData;
|
||||
import com.sdm.common.entity.data.FlowTemplateNode;
|
||||
import com.sdm.common.entity.data.IData;
|
||||
import com.sdm.common.entity.data.InheritDataNode;
|
||||
import com.sdm.common.entity.pojo.capability.CapFlowTemplate;
|
||||
import com.sdm.common.service.CommonService;
|
||||
import com.sdm.common.utils.RedisUtil;
|
||||
import com.sdm.common.entity.bo.DataPageInfo;
|
||||
import com.sdm.common.entity.req.system.LaunchApproveReq;
|
||||
import com.sdm.common.feign.impl.system.ApproveFeignClientImpl;
|
||||
import com.sdm.common.service.BaseService;
|
||||
import com.sdm.common.utils.Tools;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class FlowServiceImpl implements FlowService {
|
||||
public class FlowServiceImpl extends BaseService implements IFlowService {
|
||||
|
||||
@Resource
|
||||
@Autowired
|
||||
private FlowMapper flowMapper;
|
||||
|
||||
@Resource
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
@Value("${file.rootPath}")
|
||||
private String rootPath;
|
||||
|
||||
@Resource
|
||||
private CommonService commonService;
|
||||
|
||||
public static final String FLOW_TEMPLATE_PATH = "FLOW_TEMPLATE_PATH:";
|
||||
@Autowired
|
||||
private ApproveFeignClientImpl approveFeignClient;
|
||||
|
||||
@Override
|
||||
public SdmResponse addFlowTemplate(String name, String creator, String creatorName, String path, byte type,
|
||||
String imagePath, String description, String updater, int approveStatus, String englishName) {
|
||||
int count = flowMapper.getFlowTemplateByNameCount(name, ThreadLocalContext.getTenantId());
|
||||
if (count > 0) {
|
||||
return SdmResponse.failed("流程模板名称已存在");
|
||||
public SdmResponse createFlowTemplateDraft(SimulationFlowTemplate flowTemplate)
|
||||
{
|
||||
SdmResponse response = SdmResponse.success();
|
||||
String condition = "templateName='"+flowTemplate.templateName+"'";
|
||||
List<SimulationFlowTemplate> templates = flowMapper.queryFlowTemplateByCondition(condition);
|
||||
if(!templates.isEmpty())
|
||||
{
|
||||
response = SdmResponse.failed("仿真流程模版名称已存在");
|
||||
}
|
||||
if (flowMapper.addFlowTemplate(name, creator, path, type, imagePath, description, approveStatus, englishName) > 0) {
|
||||
redisUtil.del(FLOW_TEMPLATE_PATH + String.valueOf(ThreadLocalContext.getTenantId()));
|
||||
return SdmResponse.success();
|
||||
} else {
|
||||
return SdmResponse.failed("新增流程模板失败!");
|
||||
else
|
||||
{
|
||||
long tenantId = ThreadLocalContext.getTenantId();
|
||||
long creator = ThreadLocalContext.getUserId();
|
||||
String createName = ThreadLocalContext.getUserName();
|
||||
flowTemplate.setUuid(generateUuid("flow_template_"));
|
||||
flowTemplate.setCreator(creator);
|
||||
flowTemplate.setTenantId(tenantId);
|
||||
flowTemplate.setCreateName(createName);
|
||||
flowTemplate.setTemplateVersion("V1.0");
|
||||
flowTemplate.approveType = 0;
|
||||
if(flowMapper.addFlowTemplate(flowTemplate) <=0)
|
||||
{
|
||||
response = SdmResponse.failed("添加流程模版草稿失败");
|
||||
}
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int updateFlowTemplate(long id, String name, String imagePath, String path, String updater, byte type, String englishName) {
|
||||
return flowMapper.updateFlowTemplate(id, name, imagePath, path, updater, type, englishName);
|
||||
}
|
||||
public SdmResponse upgradeFlowTemplateDraft(SimulationFlowTemplate flowTemplate) {
|
||||
|
||||
@Override
|
||||
public int delFlowTemplateById(long id) {
|
||||
return flowMapper.delFlowTemplateById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CapFlowTemplate> getFlowTemplateByRoute(String route) {
|
||||
return flowMapper.getFlowTemplateByRoute(route, ThreadLocalContext.getTenantId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse getFlowTemplatePth() {
|
||||
String company = String.valueOf(ThreadLocalContext.getTenantId());
|
||||
String path = Tools.getRootPath(rootPath, company) + "/Flow/templateFlowLib";
|
||||
FileResp fileResp = new FileResp(path);
|
||||
if (ObjectUtils.isEmpty(redisUtil.get(FLOW_TEMPLATE_PATH + company))) {
|
||||
reverseGetPath(new File(path), fileResp, company);
|
||||
redisUtil.set(FLOW_TEMPLATE_PATH + company, JSON.toJSONString(fileResp.children));
|
||||
return SdmResponse.success(fileResp.children);
|
||||
SdmResponse response = SdmResponse.success();
|
||||
String templateName = flowTemplate.getTemplateName();
|
||||
String condition = "templateName='"+templateName+"' ORDER BY createTime DESC LIMIT 1" ;
|
||||
long tenantId = ThreadLocalContext.getTenantId();
|
||||
long creator = ThreadLocalContext.getUserId();
|
||||
String createName = ThreadLocalContext.getUserName();
|
||||
List<SimulationFlowTemplate> templates = flowMapper.queryFlowTemplateByCondition(condition);
|
||||
if (templates.isEmpty()) {
|
||||
flowTemplate.setTemplateVersion("V1.0");
|
||||
}
|
||||
List<FileResp> fileRespList = JSON.parseArray((String) redisUtil.get(FLOW_TEMPLATE_PATH + company), FileResp.class);
|
||||
return SdmResponse.success(fileRespList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse updateFlowTemplatePath() {
|
||||
String company = String.valueOf(ThreadLocalContext.getTenantId());
|
||||
redisUtil.del(FLOW_TEMPLATE_PATH + company);
|
||||
return SdmResponse.success();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse delFlowTemplateByDir(DelFlowTemplateByDirReq req) {
|
||||
log.info(ThreadLocalContext.getUserId() + " delFlowTemplateByDir");
|
||||
String path = Tools.getRootPath(rootPath, String.valueOf(ThreadLocalContext.getTenantId())) + req.getPath();
|
||||
File dir = new File(path);
|
||||
if (!dir.exists() || !dir.isDirectory()) {
|
||||
return SdmResponse.failed("文件夹不存在");
|
||||
} else {
|
||||
Tools.reverseDelFiles(dir);
|
||||
else
|
||||
{
|
||||
SimulationFlowTemplate template = templates.get(0);
|
||||
flowTemplate.setTemplateVersion(generateVersion(template.getTemplateVersion(),flowTemplate.getVersionType()));
|
||||
}
|
||||
if (!new File(path).exists()) {
|
||||
List<CapFlowTemplate> capFlowTemplateList = flowMapper.getFlowTemplateByRoute(req.getPath(), ThreadLocalContext.getTenantId());
|
||||
if(capFlowTemplateList != null && capFlowTemplateList.size()>0){
|
||||
if (flowMapper.batchDelFlow(capFlowTemplateList) <= 0) {
|
||||
return SdmResponse.failed("删除文件夹");
|
||||
} else {
|
||||
redisUtil.del(FLOW_TEMPLATE_PATH + String.valueOf(ThreadLocalContext.getTenantId()));
|
||||
flowTemplate.setUuid(generateUuid("flow_template_"));
|
||||
flowTemplate.setCreator(creator);
|
||||
flowTemplate.setTenantId(tenantId);
|
||||
flowTemplate.setCreateName(createName);
|
||||
if(flowMapper.addFlowTemplate(flowTemplate) <=0)
|
||||
{
|
||||
response = SdmResponse.failed("添加流程模版草稿失败");
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse updateFlowTemplateDraft(SimulationFlowTemplate flowTemplate) {
|
||||
SdmResponse response = SdmResponse.success();
|
||||
if(flowMapper.updateFlowTemplate(flowTemplate) <= 0)
|
||||
{
|
||||
response = SdmResponse.failed("更新路程模版草稿失败");
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse deleteFlowTemplateDraft(String uuid) {
|
||||
|
||||
SdmResponse response = SdmResponse.success();
|
||||
if(flowMapper.deleteFlowTemplate(uuid) <= 0)
|
||||
{
|
||||
response = SdmResponse.failed("删除流程模版草稿失败");
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse releaseFlowTemplate(String uuid,int versionType) {
|
||||
SdmResponse response = SdmResponse.success();
|
||||
String condition = "uuid='"+uuid+"'";
|
||||
List<SimulationFlowTemplate> templates = flowMapper.queryFlowTemplateByCondition(condition);
|
||||
if(templates.isEmpty())
|
||||
{
|
||||
response = SdmResponse.failed("流程模版草稿不存在");
|
||||
}
|
||||
else
|
||||
{
|
||||
SimulationFlowTemplate templateDraft = templates.get(0);
|
||||
templateDraft.setApproveType(1);
|
||||
if(flowMapper.updateFlowTemplate(templateDraft) <= 0)
|
||||
{
|
||||
response = SdmResponse.failed("添加流程模版失败");
|
||||
}
|
||||
else //发起评审
|
||||
{
|
||||
if(!launchApprove(templateDraft))
|
||||
{
|
||||
response = SdmResponse.failed("发起评审失败");
|
||||
templateDraft.setApproveType(0);
|
||||
flowMapper.updateFlowTemplate(templateDraft);
|
||||
}
|
||||
}
|
||||
}
|
||||
return SdmResponse.success();
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 发起评审
|
||||
* @param flowTemplate
|
||||
* @return
|
||||
*/
|
||||
private boolean launchApprove(SimulationFlowTemplate flowTemplate) {
|
||||
LaunchApproveReq approveReq = new LaunchApproveReq();
|
||||
approveReq.approveTitle = "仿真流程评审";
|
||||
approveReq.approveStatus = 1;
|
||||
approveReq.userId = ThreadLocalContext.getUserId();
|
||||
approveReq.approveType = 3;
|
||||
approveReq.approveAction = 1;
|
||||
approveReq.templateName = flowTemplate.approveFlowTemplateName;
|
||||
approveReq.templateId = flowTemplate.approveFlowTemplateId;
|
||||
approveReq.tenantId = ThreadLocalContext.getTenantId();
|
||||
approveReq.creator = ThreadLocalContext.getUserId();
|
||||
JSONObject flowTemplateJson = new JSONObject();
|
||||
flowTemplateJson.put("flowId", flowTemplate.uuid);
|
||||
flowTemplateJson.put("flowContents", flowTemplate.templateContent);
|
||||
flowTemplateJson.put("viewContents", flowTemplate.viewContent);
|
||||
approveReq.approveContents = flowTemplateJson.toJSONString();
|
||||
SdmResponse response = approveFeignClient.launchApproval(approveReq);
|
||||
return response.isSuccess();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse getFlowTemplateByName(GetFlowTemplateByNameReq req) {
|
||||
String name = req.getName();
|
||||
List<CapFlowTemplate> capFlowTemplateList = flowMapper.getFlowTemplateByName(name);
|
||||
return SdmResponse.success(capFlowTemplateList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse deprecatedTemplate(DeprecatedTemplateReq req) {
|
||||
long id = req.getId();
|
||||
CapFlowTemplate capFlowTemplateById = flowMapper.getFlowTemplateById(id);
|
||||
byte isDeprecated = req.getIsDeprecated();
|
||||
String name = req.getName() + "-弃用";
|
||||
int count = flowMapper.getDeprecatedCount(name);
|
||||
if(count > 0) {
|
||||
name = name + "-V" + count;
|
||||
public SdmResponse getReleaseFlowTemplateByCondition(String templateType,String templateName,int approveType,String beginTime,String endTime,long creator,int current,int size,int type,int templateStatus) {
|
||||
SdmResponse response = SdmResponse.success();
|
||||
String condition = "true";
|
||||
if(templateType != null && !templateType.isEmpty())
|
||||
{
|
||||
condition += " AND templateType='"+templateType+"' ";
|
||||
}
|
||||
String companyRootPath = Tools.getRootPath(rootPath, String.valueOf(ThreadLocalContext.getTenantId()));
|
||||
String sourcePath = companyRootPath + req.getParentPath() + File.separator + req.getName();
|
||||
String targetPath = companyRootPath + req.getParentPath() + File.separator + name;
|
||||
File sourceFile = new File(sourcePath);
|
||||
File targetFile = new File(targetPath);
|
||||
String imagePath = capFlowTemplateById.getImagePath().replace(sourcePath, targetPath);
|
||||
if(flowMapper.deprecatedTemplate(id, isDeprecated, name, targetPath.replace(companyRootPath, ""), imagePath, ThreadLocalContext.getUserId()) <= 0) {
|
||||
return SdmResponse.failed("弃用流程模板失败");
|
||||
}
|
||||
sourceFile.renameTo(targetFile);
|
||||
flowMapper.updateTemplateName(name, req.getName(), ThreadLocalContext.getUserId());
|
||||
redisUtil.del(FLOW_TEMPLATE_PATH + String.valueOf(ThreadLocalContext.getTenantId()));
|
||||
return SdmResponse.success(new DeprecatedTemplateRsp(id, name));
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse updatePatentApplication(UpdatePatentApplicationReq req) {
|
||||
long id = req.getId();
|
||||
Byte isPatentApplication = req.getIsPatentApplication();
|
||||
if(flowMapper.updatePatentApplication(id, isPatentApplication, ThreadLocalContext.getUserId()) <= 0) {
|
||||
return SdmResponse.failed("更新专利失败");
|
||||
if(templateName != null && !templateName.isEmpty())
|
||||
{
|
||||
condition += " AND templateName='"+templateName+"' ";
|
||||
}
|
||||
redisUtil.del(FLOW_TEMPLATE_PATH + String.valueOf(ThreadLocalContext.getTenantId()));
|
||||
return SdmResponse.success();
|
||||
}
|
||||
|
||||
private void reverseGetPath(File folder, FileResp fileResp, String company) {
|
||||
File[] files = folder.listFiles();
|
||||
if (files != null) {
|
||||
for (File file : files) {
|
||||
if(!file.getName().contains("review")) {
|
||||
if(file.isDirectory()) {
|
||||
BaseData baseData = commonService.readNodeData(file.getAbsolutePath());
|
||||
FileResp fileResp1 = new FileResp(file.getAbsolutePath().replace(Tools.getRootPath(rootPath, company), ""));
|
||||
if(baseData instanceof InheritDataNode || baseData.getType() != IData.DATA_TYPE.FLOW) {
|
||||
fileResp1.type = 0;
|
||||
fileResp1.folderName = file.getName();
|
||||
reverseGetPath(file, fileResp1, company);
|
||||
} else {
|
||||
fileResp1.type = 1;
|
||||
fileResp1.folderName = file.getName();
|
||||
List<CapFlowTemplate> capFlowTemplates = flowMapper.getFlowTemplateByName(file.getName());
|
||||
if(!CollectionUtils.isEmpty(capFlowTemplates)) {
|
||||
fileResp1.setIsDeprecated(capFlowTemplates.get(0).getIsDeprecated());
|
||||
fileResp1.setIsPatentApplication(capFlowTemplates.get(0).getIsPatentApplication());
|
||||
fileResp1.setEnglishName(capFlowTemplates.get(0).getEnglishName());
|
||||
}
|
||||
}
|
||||
fileResp.children.add(fileResp1);
|
||||
}
|
||||
}
|
||||
if(templateStatus >= 0)
|
||||
{
|
||||
condition += " AND templateStatus="+templateStatus;
|
||||
}
|
||||
|
||||
if(type == 1)
|
||||
{
|
||||
condition += " AND approveType=2 ";
|
||||
}
|
||||
else if(approveType >= 0)
|
||||
{
|
||||
condition += " AND approveType="+approveType;
|
||||
}
|
||||
|
||||
if(creator > 0)
|
||||
{
|
||||
condition += " AND creator="+creator;
|
||||
}
|
||||
|
||||
String timeCondition = Tools.timeRange("createTime",beginTime,endTime);
|
||||
if(!timeCondition.isEmpty())
|
||||
{
|
||||
condition += " AND " + timeCondition;
|
||||
}
|
||||
condition += " ORDER BY createTime DESC";
|
||||
List<SimulationFlowTemplate> templates = flowMapper.queryFlowTemplateByCondition(condition);
|
||||
List<SimulationFlowTemplate> latestVersions = filterLatestVersion(templates);
|
||||
int total = latestVersions.size();
|
||||
int beginPos = (current-1)*size;
|
||||
int endPos = beginPos + size;
|
||||
List<SimulationFlowTemplate> queryTemplate = new ArrayList<>();
|
||||
if(latestVersions.size() > beginPos)
|
||||
{
|
||||
if(latestVersions.size() > endPos)
|
||||
{
|
||||
queryTemplate = latestVersions.subList(beginPos,endPos+1);
|
||||
}
|
||||
else
|
||||
{
|
||||
queryTemplate = latestVersions.subList(beginPos,latestVersions.size());
|
||||
}
|
||||
}
|
||||
DataPageInfo<List<SimulationFlowTemplate>> pageInfo = new DataPageInfo<>();
|
||||
pageInfo.data = queryTemplate;
|
||||
pageInfo.total = total;
|
||||
response.setData(pageInfo);
|
||||
return response;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFlowTemplateRouteById(Long id) {
|
||||
return flowMapper.getFlowTemplateRouteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFlowTemplateCountByName(String name) {
|
||||
return flowMapper.getFlowTemplateCountByName(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse updateData(String path) {
|
||||
BaseData baseData = new FlowTemplateNode(IData.DATA_STATUS.WORK, path);
|
||||
String companyRootPath = Tools.getRootPath(rootPath, String.valueOf(ThreadLocalContext.getTenantId()));
|
||||
if(baseData.save(companyRootPath)) {
|
||||
return SdmResponse.success();
|
||||
} else {
|
||||
return SdmResponse.failed("更新文件type出错");
|
||||
/**
|
||||
* 过滤出最新的版本模版
|
||||
* @param templates
|
||||
* @return
|
||||
*/
|
||||
private List<SimulationFlowTemplate> filterLatestVersion(List<SimulationFlowTemplate> templates) {
|
||||
List<SimulationFlowTemplate> latestVersions = new ArrayList<>();
|
||||
Map<String,SimulationFlowTemplate> latestVersionMap = new HashMap<>();
|
||||
for(SimulationFlowTemplate template : templates)
|
||||
{
|
||||
String templateName = template.getTemplateName();
|
||||
SimulationFlowTemplate flowTemplate = latestVersionMap.get(templateName);
|
||||
if(flowTemplate == null)
|
||||
{
|
||||
latestVersionMap.put(templateName,template);
|
||||
latestVersions.add(template);
|
||||
}
|
||||
}
|
||||
return latestVersions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse turnOnOffTemplate(String uuid,int status) {
|
||||
SdmResponse response = SdmResponse.success();
|
||||
SimulationFlowTemplate flowTemplate = getFlowTemplateInfoByUuid(uuid);
|
||||
if(flowTemplate == null)
|
||||
{
|
||||
response = SdmResponse.failed("流程模版不存在");
|
||||
}
|
||||
else
|
||||
{
|
||||
flowTemplate.templateStatus = status;
|
||||
if(flowMapper.updateFlowTemplate(flowTemplate) <= 0)
|
||||
{
|
||||
response = SdmResponse.failed("设置流程模版状态失败");
|
||||
}
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public SdmResponse getFlowTemplateVersions(String uuid) {
|
||||
|
||||
SdmResponse response = SdmResponse.success();
|
||||
SimulationFlowTemplate template = getFlowTemplateInfoByUuid(uuid);
|
||||
if(template == null)
|
||||
{
|
||||
response = SdmResponse.failed("仿真流程模版不存在");
|
||||
}
|
||||
else
|
||||
{
|
||||
List<SimulationFlowTemplateBrief> versions = flowMapper.queryFlowTemplateVersion(template.templateName);
|
||||
response.setData(versions);
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过UUID获取流程模版详情
|
||||
* @param uuid
|
||||
* @return
|
||||
*/
|
||||
private SimulationFlowTemplate getFlowTemplateInfoByUuid(String uuid)
|
||||
{
|
||||
String condition = " uuid='"+uuid+"'";
|
||||
List<SimulationFlowTemplate> templates = flowMapper.queryFlowTemplateByCondition(condition);
|
||||
if(templates.isEmpty())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
return templates.get(0);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse getFlowTemplateInfo(String uuid)
|
||||
{
|
||||
SdmResponse response = SdmResponse.success();
|
||||
SimulationFlowTemplate flowTemplate = getFlowTemplateInfoByUuid(uuid);
|
||||
if(flowTemplate == null)
|
||||
{
|
||||
response = SdmResponse.failed("流程模版不存在");
|
||||
}
|
||||
else
|
||||
{
|
||||
response.setData(flowTemplate);
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse handleApproveResult(LaunchApproveReq req)
|
||||
{
|
||||
SdmResponse response = SdmResponse.success();
|
||||
int approveStatus = req.approveStatus;
|
||||
String approveContent = req.approveContents;
|
||||
JSONObject contentObj = JSONObject.parseObject(approveContent);
|
||||
if(contentObj != null && contentObj.containsKey("flowId"))
|
||||
{
|
||||
String flowTemplateUuid = contentObj.getString("flowId");
|
||||
SimulationFlowTemplate flowTemplate = getFlowTemplateInfoByUuid(flowTemplateUuid);
|
||||
if(flowTemplate != null)
|
||||
{
|
||||
flowTemplate.approveType = approveStatus;
|
||||
flowMapper.updateFlowTemplate(flowTemplate);
|
||||
}
|
||||
}
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,66 +2,5 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.sdm.capability.dao.FlowMapper">
|
||||
<insert id="addFlowTemplate">
|
||||
INSERT INTO cap_flow_template (name, creator, path, type, imagePath, description,approveStatus, englishName, company)
|
||||
VALUES (#{name}, #{creator}, #{path}, #{type}, #{imagePath}, #{description},#{approveStatus}, #{englishName}), #{company})
|
||||
</insert>
|
||||
|
||||
<update id="updateFlowTemplate">
|
||||
UPDATE cap_flow_template SET name = #{name}, imagePath = #{imagePath}, path = #{path}, updater = #{updater}, type = #{type}, englishName = #{englishName}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="delFlowTemplateById">
|
||||
DELETE FROM cap_flow_template WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
<select id="getFlowTemplateByRoute" resultType="com.sdm.common.entity.pojo.capability.CapFlowTemplate">
|
||||
SELECT * FROM cap_flow_template WHERE path LIKE #{route} "%" and company = #{company}
|
||||
</select>
|
||||
|
||||
<select id="getFlowTemplateById" resultType="com.sdm.common.entity.pojo.capability.CapFlowTemplate">
|
||||
SELECT * FROM cap_flow_template WHERE id = #{id} LIMIT 1
|
||||
</select>
|
||||
|
||||
<select id="getFlowTemplateByNameCount" resultType="int">
|
||||
SELECT COUNT(*) FROM cap_flow_template WHERE name = #{name} and company = #{company}
|
||||
</select>
|
||||
|
||||
<delete id="batchDelFlow">
|
||||
DELETE FROM cap_flow_template WHERE id in
|
||||
(
|
||||
<foreach collection="capFlowTemplateList" item="flowTemplate" separator=",">
|
||||
#{flowTemplate.id}
|
||||
</foreach>
|
||||
)
|
||||
</delete>
|
||||
|
||||
<select id="getFlowTemplateByName" resultType="com.sdm.common.entity.pojo.capability.CapFlowTemplate">
|
||||
SELECT * FROM cap_flow_template WHERE name=#{name}
|
||||
</select>
|
||||
|
||||
<update id="deprecatedTemplate">
|
||||
UPDATE cap_flow_template SET is_deprecated = #{isDeprecated}, name = #{name}, path = #{targetPath}, imag_pPath = #{imagePath} WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="updatePatentApplication">
|
||||
UPDATE cap_flow_template SET is_patent_Application = #{isPatentApplication} WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<select id="getDeprecatedCount" resultType="int">
|
||||
SELECT count(*) FROM cap_flow_template WHERE name LIKE #{name} "%"
|
||||
</select>
|
||||
|
||||
<update id="updateTemplateName">
|
||||
UPDATE pbs_run SET template_name = #{templateName} WHERE template_name = #{oldTemplateName}
|
||||
</update>
|
||||
|
||||
<select id="getFlowTemplateRouteById" resultType="String">
|
||||
SELECT path FROM cap_flow_template WHERE id = #{id} LIMIT 1
|
||||
</select>
|
||||
|
||||
<select id="getFlowTemplateCountByName" resultType="Integer">
|
||||
SELECT COUNT(*) FROM cap_flow_template WHERE name=#{name}
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user