From 7fce3006ecd0b670e33c2d3ba123778e79e2e943 Mon Sep 17 00:00:00 2001 From: 潘志宝 <979469083@qq.com> Date: 星期一, 06 一月 2025 09:18:25 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/controller/admin/StScheduleSchemeController.java | 18 ++++++++ iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/impl/StScheduleSchemeServiceImpl.java | 30 +++++++++++++++ iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/StScheduleSchemeService.java | 4 ++ iailab-module-model/iailab-module-model-biz/src/main/resources/template/cpp.vm | 12 ++++- 4 files changed, 60 insertions(+), 4 deletions(-) diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/controller/admin/StScheduleSchemeController.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/controller/admin/StScheduleSchemeController.java index 139dd39..3c45312 100644 --- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/controller/admin/StScheduleSchemeController.java +++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/controller/admin/StScheduleSchemeController.java @@ -83,7 +83,7 @@ @GetMapping("/export-excel") @Operation(summary = "导出调度方案 Excel") - @PreAuthorize("@ss.hasPermission('system:tenant:export')") + @PreAuthorize("@ss.hasPermission('sche:scheme:export')") @ApiAccessLog(operateType = EXPORT) public void exportTenantExcel(@Valid StScheduleSchemePageReqVO exportReqVO, HttpServletResponse response) throws IOException { @@ -93,4 +93,20 @@ ExcelUtils.write(response, "调度方案.xls", "数据", StScheduleSchemeEntity.class, BeanUtils.toBean(list, StScheduleSchemeEntity.class)); } + + @PreAuthorize("@ss.hasPermission('sche:scheme:update')") + @PutMapping("/enable") + @Operation(summary = "启用") + public CommonResult<Boolean> enable(@RequestBody String[] ids) { + stScheduleSchemeService.enableByIds(ids); + return success(true); + } + + @PreAuthorize("@ss.hasPermission('sche:scheme:update')") + @PutMapping("/disable") + @Operation(summary = "禁用") + public CommonResult<Boolean> disable(@RequestBody String[] ids) { + stScheduleSchemeService.disableByIds(ids); + return success(true); + } } \ No newline at end of file diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/StScheduleSchemeService.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/StScheduleSchemeService.java index 2670914..63e8012 100644 --- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/StScheduleSchemeService.java +++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/StScheduleSchemeService.java @@ -32,4 +32,8 @@ StScheduleSchemeEntity getByCode(String code); List<StScheduleSchemeDTO> list(Map<String, Object> params); + + void enableByIds(String[] ids); + + void disableByIds(String[] ids); } diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/impl/StScheduleSchemeServiceImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/impl/StScheduleSchemeServiceImpl.java index bb3ddd6..b395057 100644 --- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/impl/StScheduleSchemeServiceImpl.java +++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mcs/sche/service/impl/StScheduleSchemeServiceImpl.java @@ -1,5 +1,6 @@ package com.iailab.module.model.mcs.sche.service.impl; +import com.baomidou.dynamic.datasource.annotation.DSTransactional; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.iailab.framework.common.pojo.PageResult; import com.iailab.framework.common.service.impl.BaseServiceImpl; @@ -14,6 +15,7 @@ import com.iailab.module.model.mcs.sche.vo.StScheduleSchemePageReqVO; import com.iailab.module.model.mcs.sche.vo.StScheduleSchemeSaveReqVO; import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; import java.util.*; @@ -77,4 +79,32 @@ entity.setScheduleTime(scheduleTime); baseDao.updateById(entity); } + + @Override + @DSTransactional(rollbackFor = Exception.class) + public void enableByIds(String[] ids) { + if (CollectionUtils.isEmpty(Arrays.asList(ids))) { + return; + } + Arrays.asList(ids).forEach(item -> { + StScheduleSchemeEntity entity = new StScheduleSchemeEntity(); + entity.setId(item); + entity.setStatus(0); + baseDao.updateById(entity); + }); + } + + @Override + @DSTransactional(rollbackFor = Exception.class) + public void disableByIds(String[] ids) { + if (CollectionUtils.isEmpty(Arrays.asList(ids))) { + return; + } + Arrays.asList(ids).forEach(item -> { + StScheduleSchemeEntity entity = new StScheduleSchemeEntity(); + entity.setId(item); + entity.setStatus(1); + baseDao.updateById(entity); + }); + } } diff --git a/iailab-module-model/iailab-module-model-biz/src/main/resources/template/cpp.vm b/iailab-module-model/iailab-module-model-biz/src/main/resources/template/cpp.vm index ddf78cf..a3a8867 100644 --- a/iailab-module-model/iailab-module-model-biz/src/main/resources/template/cpp.vm +++ b/iailab-module-model/iailab-module-model-biz/src/main/resources/template/cpp.vm @@ -22,10 +22,16 @@ jmethodID getMID = env->GetMethodID(hashmapClass, "get", "(Ljava/lang/Object;)Ljava/lang/Object;"); jstring keyJString = env->NewStringUTF("pyFile"); jobject javaValueObj = env->CallObjectMethod(settings, getMID, keyJString); - const char* strValue = env->GetStringUTFChars((jstring)javaValueObj, NULL); - + jstring javaStringValue = (jstring)javaValueObj; + const char* strValue = env->GetStringUTFChars(javaStringValue, NULL); + //*************导入模型****************** PyObject* pModule = create_py_module(strValue); - /*PyObject* pModule = create_py_module("${pyModule}.${pyName}");*/ + // 释放java占用内存 + env->ReleaseStringUTFChars(javaStringValue, strValue); + env->DeleteLocalRef(javaStringValue); + env->DeleteLocalRef(javaValueObj); + env->DeleteLocalRef(keyJString); + env->DeleteLocalRef(hashmapClass); if (pModule == NULL) { cout << "model error" << endl; -- Gitblit v1.9.3