From d542ab5fc0d39be88b1fac70162fa862d46b84a9 Mon Sep 17 00:00:00 2001 From: zjh <15615273395@163.com> Date: Sun, 14 Dec 2025 20:38:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=81=A2=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/UserPermissionGetter.java | 4 +- .../controller/DeleteController.java | 117 ------------------ .../TemplateApprovalController.java | 11 +- .../controller/TemplateController.java | 22 ---- .../feign/ApaasMyTokenFeign.java | 17 --- .../feign/dto/FileDataDTO.java | 2 +- .../feign/dto/ProcessLaunchRequest.java | 15 --- .../feign/dto/ProcessLaunchResponse.java | 24 ---- .../pojo/ModelCommonParameters.java | 4 +- .../service/TemplateService.java | 3 + .../service/impl/TemplateServiceImpl.java | 22 +++- 11 files changed, 28 insertions(+), 213 deletions(-) delete mode 100644 src/main/java/com/xdap/self_development/feign/dto/ProcessLaunchRequest.java delete mode 100644 src/main/java/com/xdap/self_development/feign/dto/ProcessLaunchResponse.java diff --git a/src/main/java/com/xdap/self_development/common/UserPermissionGetter.java b/src/main/java/com/xdap/self_development/common/UserPermissionGetter.java index 77e74c7..acaa05f 100644 --- a/src/main/java/com/xdap/self_development/common/UserPermissionGetter.java +++ b/src/main/java/com/xdap/self_development/common/UserPermissionGetter.java @@ -23,8 +23,8 @@ public class UserPermissionGetter { private RuntimeAppContextService runtimeAppContextService; public String getCurrentUserId() { - return runtimeAppContextService.getCurrentUserId(); -// return "zjh"; +// return runtimeAppContextService.getCurrentUserId(); + return "zjh"; } // 获取子系统下的参数权限 diff --git a/src/main/java/com/xdap/self_development/controller/DeleteController.java b/src/main/java/com/xdap/self_development/controller/DeleteController.java index ab8869b..75c72ac 100644 --- a/src/main/java/com/xdap/self_development/controller/DeleteController.java +++ b/src/main/java/com/xdap/self_development/controller/DeleteController.java @@ -1,27 +1,18 @@ package com.xdap.self_development.controller; -import com.definesys.mpaas.common.http.Response; import com.definesys.mpaas.query.MpaasQueryFactory; import com.xdap.motor.entity.SnowflakeIdWorker; import com.xdap.runtime.service.RuntimeAppContextService; import com.xdap.self_development.common.UserPermissionGetter; import com.xdap.self_development.config.BusinessDatabase; import com.xdap.self_development.feign.ApaasMyTokenFeign; -import com.xdap.self_development.feign.dto.AppTokenDTO; -import com.xdap.self_development.feign.dto.ProcessLaunchRequest; -import com.xdap.self_development.feign.dto.ProcessLaunchResponse; -import com.xdap.self_development.feign.dto.UserTokenDT0; -import com.xdap.self_development.pojo.ApprovalParameterChangeDetails; -import com.xdap.self_development.pojo.ApprovalPerson; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; -import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; -import java.util.*; @Slf4j @RestController @@ -44,112 +35,4 @@ public class DeleteController { private String clientId; @Value("${apaas.token.clientSecred}") private String clientSecret; - - @GetMapping("submitApproval") - public Response submitApproval() { - String currentTenantId = runtimeAppContextService.getCurrentTenantId(); - String currentUserId = getter.getCurrentUserId(); - AppTokenDTO token = apaasMyTokenFeign.getAppToken( - "client_credentials", - clientId, - clientSecret - ); - - UserTokenDT0 userToken = apaasMyTokenFeign.getUserToken( - token.getAccess_token(), - currentUserId - ); - String formId = "693cce312153aa5a1ac8599b"; - String documentId = snowflakeIdWorker.nextId(); - ApprovalPerson approvalPerson = new ApprovalPerson(); - approvalPerson.getDetails().setParameterName("测试参数名11"); - approvalPerson.setPz(Collections.singletonList("100771325212057665536")); - approvalPerson.setSh(Collections.singletonList("100771325212057665536")); - approvalPerson.setJd(Collections.singletonList("100771325212057665536")); - approvalPerson.setDocumentId(documentId); - bd.getBusinessDatabase().doInsert(approvalPerson); - List documentIds = Collections.singletonList(documentId); - - // 调用接口 - ProcessLaunchResponse response = batchLaunch(userToken.getAccess_token(), formId, documentIds); - - // 处理响应 - if (response.isSuccess()) { - return Response.ok().data("流程批量发起成功:" + response.getMessage()); - } else { - return Response.error("流程批量发起失败:" + response.getMessage()); - } - } - - public ProcessLaunchResponse batchLaunch(String userToken, String formId, List documentIds) { - // 1. 构造请求头参数 - // 毫秒级时间戳(必填,来源:系统当前时间戳,Java8通过System.currentTimeMillis()获取) - String xdapTimestamp = String.valueOf(System.currentTimeMillis()); - // 构造Authorization(格式:bearer + 空格 + token) - String authorization = "Bearer " + userToken; - - // 2. 构造请求体参数 - ProcessLaunchRequest request = - new ProcessLaunchRequest(formId, documentIds); - - // 3. 调用Feign接口 - return apaasMyTokenFeign.batchLaunchProcess( - "application/json;charset=UTF-8", - authorization, - xdapTimestamp, - request - ); - } - - @GetMapping("/submitPro") - public Response submitPro() { - List tableNames = getTablesWithFormId(); - - Map> params = new HashMap<>(); - params.put("tableNames", new ArrayList<>()); - tableNames.forEach(tableName -> { - String table = countFormIdInTable(tableName, "693cce312153aa5a1ac8599b"); - if (table != null) { - params.get("tableNames").add(table); - } - }); - return Response.ok().data(params); - } - - public List getTablesWithFormId() { - // 查询所有包含 form_id 字段的表 - String sql = "SELECT TABLE_NAME FROM INFORMATION_SCHEMA.COLUMNS " + - "WHERE COLUMN_NAME = 'form_id' " + - "AND TABLE_SCHEMA = DATABASE()"; - - List> tables = bd.getBusinessDatabase().sql(sql).doQuery(); - System.out.println(tables); - List tableNames = new ArrayList<>(); - for (Map table : tables) { - tableNames.add((String) table.get("TABLE_NAME")); - } - - return tableNames; - } - - public String countFormIdInTable(String tableName, String formIdValue) { - // 构建查询语句 - String sql = "SELECT form_id FROM "+tableName+" WHERE form_id = '" + formIdValue +"'"; - - try { - System.out.println(sql); - List> result = bd.getBusinessDatabase() - .sql(sql) - .doQuery(); - - if (!result.isEmpty()) { - return tableName; - } - } catch (Exception e) { - // 记录日志,表可能不存在或没有form_id字段 - System.err.println("查询表 " + tableName + " 时出错: " + e.getMessage()); - } - - return null; - } } diff --git a/src/main/java/com/xdap/self_development/controller/TemplateApprovalController.java b/src/main/java/com/xdap/self_development/controller/TemplateApprovalController.java index 2758114..2b6f080 100644 --- a/src/main/java/com/xdap/self_development/controller/TemplateApprovalController.java +++ b/src/main/java/com/xdap/self_development/controller/TemplateApprovalController.java @@ -26,15 +26,7 @@ public class TemplateApprovalController { @Resource private RuntimeDatasourceService runtimeDatasourceService; - @GetMapping("/saveApprovalId") - public Response saveApprovalId( - @NotBlank String documentId - ) { - ApprovalFlow approvalFlow = new ApprovalFlow(); - approvalFlow.setId(documentId); - return Response.ok(); - } - + // 获取用户和部门 @GetMapping("/getUsersByCondition") public Response getUsersByCondition( @RequestParam String name @@ -133,5 +125,4 @@ public class TemplateApprovalController { ApprovalFlowView approvalFlowView = templateApprovalService.getApprovalProcess(form); return Response.ok().data(approvalFlowView); } - } diff --git a/src/main/java/com/xdap/self_development/controller/TemplateController.java b/src/main/java/com/xdap/self_development/controller/TemplateController.java index 0490525..c140fe2 100644 --- a/src/main/java/com/xdap/self_development/controller/TemplateController.java +++ b/src/main/java/com/xdap/self_development/controller/TemplateController.java @@ -30,28 +30,6 @@ public class TemplateController { @Resource private BusinessDatabase bd; - // 更新模板状态 - @GetMapping("/updateTemplateStatus") - public Response updateTemplateStatus( - @NotBlank String templateId, - @NotBlank String status - ) { - if (Objects.equals(status, "COMPLETE")) { - Template template = bd.getBusinessDatabase().eq("id", templateId).doQueryFirst(Template.class); - bd.getBusinessDatabase() - .eq("template_name", template.getTemplateName()) - .update("status", "HISTORY") - .doUpdate(Template.class); - - } - bd.getBusinessDatabase() - .eq("id", templateId) - .update("status", status) - .doUpdate(Template.class); - return Response.ok(); - } - // ------------------------------------------ - // 模板名的模糊搜索 @GetMapping("/getTemplateByCondition") public Response getTemplateByCondition( diff --git a/src/main/java/com/xdap/self_development/feign/ApaasMyTokenFeign.java b/src/main/java/com/xdap/self_development/feign/ApaasMyTokenFeign.java index 760e9c1..781c1da 100644 --- a/src/main/java/com/xdap/self_development/feign/ApaasMyTokenFeign.java +++ b/src/main/java/com/xdap/self_development/feign/ApaasMyTokenFeign.java @@ -43,21 +43,4 @@ public interface ApaasMyTokenFeign { @RequestPart("tenantId") String tenantId, @RequestPart("userId") String userId ); - - /** - * 批量发起流程(无流程实例的单据) - * @param contentType 请求体格式(固定application/json;charset=UTF-8) - * @param access_token 用户token(非必填,格式:bearer + 空格 + token值) - * @param xdapTimestamp 毫秒级时间戳(必填,如:1744238901000) - * @param requestParam 请求体参数 - * @return 响应结果 - */ - @PostMapping(value = "/xdap-open/open/process/v1/batch/pureLaunchProcess", - consumes = "application/json;charset=UTF-8") - ProcessLaunchResponse batchLaunchProcess( - @RequestHeader("Content-Type") String contentType, - @RequestHeader(value = "Authorization") String access_token, - @RequestHeader("xdaptimestamp") String xdapTimestamp, - @RequestBody ProcessLaunchRequest requestParam - ); } \ No newline at end of file diff --git a/src/main/java/com/xdap/self_development/feign/dto/FileDataDTO.java b/src/main/java/com/xdap/self_development/feign/dto/FileDataDTO.java index 627d8cf..294efbf 100644 --- a/src/main/java/com/xdap/self_development/feign/dto/FileDataDTO.java +++ b/src/main/java/com/xdap/self_development/feign/dto/FileDataDTO.java @@ -13,4 +13,4 @@ public class FileDataDTO { private String fileSizeStr; private String ossBucketName; private String ossObjectName; -} +} \ No newline at end of file diff --git a/src/main/java/com/xdap/self_development/feign/dto/ProcessLaunchRequest.java b/src/main/java/com/xdap/self_development/feign/dto/ProcessLaunchRequest.java deleted file mode 100644 index f83fcb6..0000000 --- a/src/main/java/com/xdap/self_development/feign/dto/ProcessLaunchRequest.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.xdap.self_development.feign.dto; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.util.List; - -@Data -@AllArgsConstructor -@NoArgsConstructor -public class ProcessLaunchRequest { - private String formId; - private List documentIds; -} \ No newline at end of file diff --git a/src/main/java/com/xdap/self_development/feign/dto/ProcessLaunchResponse.java b/src/main/java/com/xdap/self_development/feign/dto/ProcessLaunchResponse.java deleted file mode 100644 index 12954ca..0000000 --- a/src/main/java/com/xdap/self_development/feign/dto/ProcessLaunchResponse.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.xdap.self_development.feign.dto; - -import com.definesys.mpaas.query.annotation.RowID; -import com.definesys.mpaas.query.annotation.RowIDType; -import com.definesys.mpaas.query.annotation.Table; -import com.definesys.mpaas.query.model.MpaasBasePojo; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.NoArgsConstructor; -import org.checkerframework.checker.units.qual.A; - -@Data -@AllArgsConstructor -@NoArgsConstructor -public class ProcessLaunchResponse { - private String code; - private String message; - - // 快捷判断是否成功 - public boolean isSuccess() { - return "ok".equals(this.code); - } - } \ No newline at end of file diff --git a/src/main/java/com/xdap/self_development/pojo/ModelCommonParameters.java b/src/main/java/com/xdap/self_development/pojo/ModelCommonParameters.java index bb49a53..8c6c5fb 100644 --- a/src/main/java/com/xdap/self_development/pojo/ModelCommonParameters.java +++ b/src/main/java/com/xdap/self_development/pojo/ModelCommonParameters.java @@ -7,7 +7,7 @@ import lombok.EqualsAndHashCode; @SQLQuery(value = { @SQL(view = "getCommonAndParameters", - sql = "SELECT ymcp.*, ymp.parameter_name AS \"parameterName\", ymp.parameter_type AS \"parameterType\", ymp.subsystem_name AS \"subsystemName\" FROM yfsjglpt_model_common_parameters ymcp LEFT JOIN yfsjglpt_model_parameter ymp ON ymcp.parameter_id = ymp.id WHERE ymcp.common_id IN (#ids)"), + sql = "SELECT ymcp.*, ymp.parameter_name, ymp.parameter_type, ymp.subsystem_name, ymp.parts_name FROM yfsjglpt_model_common_parameters ymcp LEFT JOIN yfsjglpt_model_parameter ymp ON ymcp.parameter_id = ymp.id WHERE ymcp.common_id IN (#ids)"), @SQL(view = "getCommonById", sql = "SELECT ymcp.*, ymp.parameter_name as 'parameterName', ymp.parameter_type as 'parameterType', ymp.subsystem_name as 'subsystemName' FROM yfsjglpt_model_common_parameters ymcp LEFT JOIN yfsjglpt_model_parameter ymp ON ymcp.parameter_id = ymp.id WHERE ymcp.user_id = #userId") }) @@ -26,4 +26,6 @@ public class ModelCommonParameters extends MpaasBasePojo { private String parameterType; @Column(type = ColumnType.CALCULATE) private String subsystemName; + @Column(type = ColumnType.CALCULATE) + private String partsName; } diff --git a/src/main/java/com/xdap/self_development/service/TemplateService.java b/src/main/java/com/xdap/self_development/service/TemplateService.java index b776086..07f9f93 100644 --- a/src/main/java/com/xdap/self_development/service/TemplateService.java +++ b/src/main/java/com/xdap/self_development/service/TemplateService.java @@ -8,6 +8,7 @@ import com.xdap.self_development.pojo.Template; import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletResponse; +import javax.validation.constraints.NotBlank; import java.util.List; public interface TemplateService { @@ -25,4 +26,6 @@ public interface TemplateService { void exportTemplate(ExportTemplateForm form, HttpServletResponse response); List