| | |
| | | import com.zt.life.modules.mainPart.taskReliability.model.ModelLine; |
| | | import com.zt.life.modules.mainPart.taskReliability.model.ModelRbd; |
| | | import com.zt.life.modules.mainPart.taskReliability.service.ModelLineService; |
| | | import com.zt.life.modules.mainPart.taskReliability.service.ModelRbdNodeService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.scheduling.annotation.Async; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import springfox.documentation.annotations.ApiIgnore; |
| | | |
| | | import java.io.BufferedReader; |
| | | import java.io.InputStream; |
| | | import java.io.InputStreamReader; |
| | | |
| | | |
| | | /** |
| | |
| | | private ModelLineService modelLineService; |
| | | |
| | | @Autowired |
| | | // private PythonLib pythonLib; |
| | | private ModelRbdNodeService modelRbdNodeService; |
| | | |
| | | |
| | | @GetMapping("page") |
| | | @ApiOperation("分页") |
| | |
| | | return Result.ok(data); |
| | | } |
| | | |
| | | /* |
| | | @GetMapping("callPythonCalc") |
| | | @ApiOperation("信息") |
| | | public Result callPythonCalc() { |
| | | pythonLib.callPython(); |
| | | |
| | | return Result.ok(); |
| | | } |
| | | |
| | | @GetMapping("getPythonCalcResult") |
| | | @ApiOperation("信息") |
| | | public Result<String> getPythonCalcResult() { |
| | | String result = pythonLib.getPythonCalcResult(); |
| | | |
| | | return Result.ok(result); |
| | | } |
| | | */ |
| | | |
| | | @PostMapping |
| | | @ApiOperation("新增") |
| | | @LogOperation("新增") |
| | |
| | | ValidatorUtils.validateEntity(modelRbd, AddGroup.class, DefaultGroup.class); |
| | | modelRbd.setContent(modelRbd.getContent().replace(modelRbd.getUrlPref(), URL_REPLACE_STR)); |
| | | modelRbd.setContent(modelRbd.getContent().replaceAll(TOKEN_REPLACE_REGEX, TOKEN_REPLACE_STR)); |
| | | modelRbdNodeService.saveNodeArr(modelRbd); |
| | | modelLineService.insert(modelRbd); |
| | | |
| | | return Result.ok(); |
| | | } |
| | | |
| | |
| | | ValidatorUtils.validateEntity(modelRbd, UpdateGroup.class, DefaultGroup.class); |
| | | modelRbd.setContent(modelRbd.getContent().replace(modelRbd.getUrlPref(), URL_REPLACE_STR)); |
| | | modelRbd.setContent(modelRbd.getContent().replaceAll(TOKEN_REPLACE_REGEX, TOKEN_REPLACE_STR)); |
| | | modelRbdNodeService.saveNodeArr(modelRbd); |
| | | modelLineService.update(modelRbd); |
| | | |
| | | return Result.ok(); |
| | |
| | | @ApiOperation("解析") |
| | | @LogOperation("解析") |
| | | public Result analyze(@RequestBody ModelRbd modelRbd) { |
| | | modelLineService.update(modelRbd); |
| | | update(modelRbd); |
| | | boolean result = modelLineService.analyze(modelRbd); |
| | | return result ? Result.ok() : Result.error("解析失败"); |
| | | } |