| | |
| | | package com.zt.life.modules.mainPart.taskReliability.controller; |
| | | |
| | | |
| | | import cn.hutool.json.JSONObject; |
| | | import cn.hutool.json.XML; |
| | | import com.zt.common.annotation.LogOperation; |
| | | import com.zt.common.constant.Constant; |
| | | import com.zt.common.annotation.QueryParam; |
| | | import com.zt.common.db.query.QueryFilter; |
| | | import com.zt.common.servlet.Result; |
| | | import com.zt.common.servlet.PageResult; |
| | | import com.zt.common.utils.JsonUtils; |
| | | import com.zt.common.validator.AssertUtils; |
| | | import com.zt.common.validator.ValidatorUtils; |
| | | import com.zt.common.validator.group.DefaultGroup; |
| | |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.commons.io.IOUtils; |
| | | 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.web.bind.annotation.*; |
| | | import springfox.documentation.annotations.ApiIgnore; |
| | | |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | |
| | | |
| | | /** |
| | |
| | | |
| | | @Autowired |
| | | private PythonLib pythonLib; |
| | | |
| | | @Value("${data.reliaSimLib.resultHome}") |
| | | private String path; |
| | | |
| | | @Autowired |
| | | private SimulatAssessService simulatAssessService; |
| | |
| | | return result; |
| | | } |
| | | |
| | | @GetMapping("calculate") |
| | | public Result calculate(Long taskId, String List, String code, String errorMsg) { |
| | | SimulatAssess simulatAssess = new SimulatAssess(); |
| | | simulatAssess.setId(taskId); |
| | | simulatAssess.setCurveData(List); |
| | | simulatAssess.setCode(code); |
| | | simulatAssess.setErrorMsg(errorMsg); |
| | | simulatAssessService.insert(simulatAssess); |
| | | @GetMapping("getResultXML") |
| | | public Result getResultXML(Long taskId) { |
| | | String filePath = path + "/"+taskId+"/"+"result.xml"; |
| | | InputStream in = JsonUtils.class.getResourceAsStream(filePath); |
| | | String xml = null; |
| | | try { |
| | | xml = IOUtils.toString(in); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | JSONObject xmlJSONObj = XML.toJSONObject(xml); |
| | | |
| | | |
| | | return Result.ok(); |
| | | } |