| | |
| | | |
| | | import com.dy.common.aop.SsoAop; |
| | | import com.dy.common.multiDataSource.DataSourceContext; |
| | | import com.dy.common.softUpgrade.state.UpgradeInfo; |
| | | import com.dy.common.softUpgrade.state.UpgradeTaskVo; |
| | | import com.dy.common.springUtil.SpringContextUtil; |
| | | import com.dy.common.webUtil.BaseResponse; |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | | import com.dy.common.webUtil.ResultCodeMsg; |
| | | import com.dy.pipIrrGlobal.pojoRm.UgRtuProgram; |
| | | import com.dy.pipIrrGlobal.pojoRm.UgRtuTask; |
| | | import com.dy.pipIrrGlobal.rtuMw.ToRtuMwCom; |
| | | import com.dy.pipIrrGlobal.voRm.VoUpgradeDetail; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.media.Content; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | |
| | | BaseResponse res = sendUpgradeTask2Mw(restTemplate, ugSendUrl, vo) ; |
| | | if(res != null){ |
| | | if(res.isSuccess()){ |
| | | this.sv.setUpgradeTaskExecuted(id); |
| | | return BaseResponseUtils.buildSuccess(true) ; |
| | | }else{ |
| | | log.error("通信中间件执行下发升级任务失败" + (res.getMsg() == null? "" : ("," + res.getMsg()))) ; |
| | |
| | | vo.softByteSrc16 = ppo.programCrc16 ; |
| | | } |
| | | |
| | | /** |
| | | * 当前rtu远程升级任务执行状态 |
| | | * @return 操作结果 |
| | | */ |
| | | @Operation(summary = "当前rtu远程升级任务执行状态", description = "当前rtu远程升级任务执行状态") |
| | | @ApiResponses(value = { |
| | | @ApiResponse( |
| | | responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, |
| | | description = "返回操作成功与否数据(BaseResponse.content:Boolean)", |
| | | content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, |
| | | schema = @Schema(implementation = Boolean.class))} |
| | | ) |
| | | }) |
| | | @GetMapping(path = "/curUpgradeState") |
| | | @SsoAop() |
| | | public BaseResponse<UpgradeInfo> curUpgradeState(){ |
| | | if(RtuUpgradeStateReceiverCtrl.cache == null){ |
| | | //return BaseResponseUtils.buildError("当前没有升级任务") ; |
| | | //正式运行时,下面两行去掉,上面一行打开 |
| | | RtuUpgradeStateReceiverCtrl ctrl = SpringContextUtil.getBean(RtuUpgradeStateReceiverCtrl.class); |
| | | ctrl.demo(); |
| | | } |
| | | CurUpgradeStateVo vo = new CurUpgradeStateVo() ; |
| | | List<VoUpgradeDetail> list = this.sv.selectTaskDetail(RtuUpgradeStateReceiverCtrl.cache.ugTaskId); |
| | | if(list != null && list.size() > 0){ |
| | | vo.upgrade = list.get(0) ; |
| | | } |
| | | vo.ugOverallState = RtuUpgradeStateReceiverCtrl.cache.ugOverallState ; |
| | | vo.ugRtuStateList = RtuUpgradeStateReceiverCtrl.cache.ugRtuStateList ; |
| | | return BaseResponseUtils.buildSuccess(vo) ; |
| | | } |
| | | } |