| | |
| | | import com.zt.common.validator.group.UpdateGroup; |
| | | import com.zt.life.modules.mainPart.async.PythonLib; |
| | | import com.zt.life.modules.mainPart.taskReliability.dto.*; |
| | | import com.zt.life.modules.mainPart.taskReliability.model.CurveParam; |
| | | import com.zt.life.modules.mainPart.taskReliability.model.SimulatAssess; |
| | | import com.zt.life.modules.mainPart.taskReliability.model.Task; |
| | | import com.zt.life.modules.mainPart.taskReliability.model.TimeDiagram; |
| | | import com.zt.life.modules.mainPart.taskReliability.model.*; |
| | | import com.zt.life.modules.mainPart.taskReliability.service.SimulatAssessService; |
| | | import com.zt.life.modules.mainPart.taskReliability.service.TaskService; |
| | | import io.swagger.annotations.Api; |
| | |
| | | @Autowired |
| | | private RedisTemplate redisTemplate; |
| | | |
| | | @Autowired |
| | | private PythonLib pythonLib; |
| | | |
| | | @Autowired |
| | | private TaskService taskService; |
| | | |
| | | |
| | | @Autowired |
| | | private SimulatAssessService simulatAssessService; |
| | |
| | | return Result.ok(data); |
| | | } |
| | | |
| | | @GetMapping("verify") |
| | | public Result<String> verify(Long taskId) { |
| | | String result = simulatAssessService.verify(taskId); |
| | | result = result.replaceAll("\n", "<br>"); |
| | | return Result.ok(result); |
| | | } |
| | | |
| | | @PostMapping("analyze") |
| | | public Result<Long> analyze(@RequestBody SimulatAssess simulatAssess) { |
| | | public Result<Object> analyze(@RequestBody SimulatAssess simulatAssess) { |
| | | //效验数据 |
| | | // Result result = pythonLib.callPython(simulatAssess); |
| | | Result result = simulatAssessService.simulate(simulatAssess); |
| | | |
| | | return result; |
| | | List<TaskModelCheckResultDto> result = simulatAssessService.simulateChecK(simulatAssess); |
| | | if (result != null) { |
| | | return Result.ok(result); |
| | | } |
| | | Boolean result2 = simulatAssessService.simulate(simulatAssess); |
| | | if (result2) |
| | | return Result.ok(); |
| | | else |
| | | return Result.error(); |
| | | } |
| | | |
| | | @PostMapping("getResultXML") |
| | |
| | | } |
| | | |
| | | @GetMapping("getStatus") |
| | | public Result<TimeDiagramDto> getTimeDiagram(Long productId, Long taskId, Long fzId, double smallWidth,double minPointNum) { |
| | | TimeDiagramDto data = simulatAssessService.getTimeDiagram(productId, taskId, fzId, smallWidth,minPointNum); |
| | | public Result<TimeDiagramDto> getTimeDiagram(Long productId, Long taskId, Long fzId, double smallWidth, double minPointNum) { |
| | | TimeDiagramDto data = simulatAssessService.getTimeDiagram(productId, taskId, fzId, smallWidth, minPointNum); |
| | | return Result.ok(data); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @GetMapping("getCalcProgress") |
| | | public Result getCalcProgress(Long taskId) { |
| | | String key = taskId.toString() + simulatAssessService.RELIA_SIM_TASK_TYPE_PROGRESS; |
| | | String progress = (String) redisTemplate.opsForValue().get(key); |
| | | if (progress == null) progress = "0"; |
| | | if (Objects.equals(progress, "100")) { |
| | | simulatAssessService.deleteSimInfoInRedis(taskId); |
| | | public Result getCalcProgress(@RequestParam("taskList[]") Long[] taskList) { |
| | | Integer progress = 0; |
| | | String progress2 = ""; |
| | | String key = null; |
| | | if (taskList.length == 1) { |
| | | key = taskList[0].toString() + simulatAssessService.RELIA_SIM_TASK_TYPE_PROGRESS; |
| | | progress2 = (String) redisTemplate.opsForValue().get(key); |
| | | progress = Integer.parseInt(progress2); |
| | | if (progress == null) progress = 0; |
| | | if (progress == 100) { |
| | | //simulatAssessService.deleteSimInfoInRedis(taskId); |
| | | } |
| | | } else { |
| | | for (Long taskId : taskList) { |
| | | key = taskId.toString() + simulatAssessService.RELIA_SIM_TASK_TYPE_PROGRESS; |
| | | progress2 = (String) redisTemplate.opsForValue().get(key); |
| | | progress = progress + Integer.parseInt(progress2); |
| | | } |
| | | progress = progress / taskList.length; |
| | | if (progress == 100) { |
| | | //simulatAssessService.deleteSimInfoInRedis(taskId); |
| | | } |
| | | } |
| | | return Result.ok(progress); |
| | | |
| | | return Result.ok(progress.toString()); |
| | | } |
| | | |
| | | @GetMapping("ReliabilityWeakness") |
| | |
| | | } |
| | | |
| | | @GetMapping("SchemeCompar") |
| | | public Result<SchemeComparDto> SchemeCompar(@RequestParam("taskList[]") String[] taskList,Long showProductId) { |
| | | SchemeComparDto data = simulatAssessService.SchemeCompar(taskList,showProductId); |
| | | public Result<SimulatResult> SchemeCompar(@RequestParam("taskList[]") String[] taskList, Long showProductId, Integer samplPeriod, Integer simulatFrequency) { |
| | | SimulatResult data = simulatAssessService.SchemeCompar(taskList, showProductId, samplPeriod, simulatFrequency); |
| | | return Result.ok(data); |
| | | } |
| | | |
| | | |
| | | |
| | | @GetMapping("getEcharts") |
| | | public Result<SchemeComparDto> getEcharts(@RequestParam("taskList[]") String[] taskList, Long showProductId) { |
| | | SchemeComparDto data = simulatAssessService.getEcharts(taskList, showProductId); |
| | | return Result.ok(data); |
| | | } |
| | | |
| | | @PutMapping |
| | | @ApiOperation("修改") |