xyc
2024-10-28 71f70458719aa6ce52d9ffd21eb5cd9d92a55fd0
modules/mainPart/src/main/java/com/zt/life/modules/mainPart/async/PythonLib.java
@@ -2,14 +2,13 @@
import com.alibaba.fastjson.JSONObject;
import com.zt.common.servlet.Result;
import com.zt.life.modules.mainPart.taskReliability.model.PythonResult;
import com.zt.life.modules.mainPart.taskReliability.model.ReliaSimLibResult;
import com.zt.life.modules.mainPart.taskReliability.model.SimulatAssess;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import java.io.BufferedReader;
@@ -66,7 +65,7 @@
//            if (exitCode == 0) {
                logger.info("启动python计算成功");
                if (line != null) {
                    PythonResult rtn = JSONObject.parseObject(line, PythonResult.class);
                    ReliaSimLibResult rtn = JSONObject.parseObject(line, ReliaSimLibResult.class);
                    if ("0".equals(rtn.getCode())) {
                        result = Result.ok();
                    } else {
@@ -115,7 +114,6 @@
    private void setParamToRedis(SimulatAssess simulatAssess) {
        String key = simulatAssess.getId().toString() + taskType;
        logger.info("redis key:" + key);
/*
        String xmlfile = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
                "<des name=\"General system\">\n" +
                "    <tasks>\n" +
@@ -244,7 +242,7 @@
                "        </repair_model>\n" +
                "    </repair_models>\n" +
                "</des>";
*/
/*
        String xmlfile = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
                "<des name=\"General system\">\n" +
                "    <tasks>\n" +
@@ -345,6 +343,7 @@
                "        </repair_model>\n" +
                "    </repair_models>\n" +
                "</des>";
*/
        JSONObject jsonObject = new JSONObject();
/*
        Long simulate_times = 10000L;