| | |
| | | import org.springframework.web.client.RestTemplate; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Base64; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | @GetMapping(path = "/issuedTask") |
| | | @SsoAop() |
| | | public BaseResponse<Boolean> issuedTask(String id){ |
| | | if(id == null || !id.trim().equals("")){ |
| | | if(id == null || id.trim().equals("")){ |
| | | return BaseResponseUtils.buildError("任务id不能为空") ; |
| | | } |
| | | UgRtuTask tpo = this.sv.selectTaskById(id) ; |
| | |
| | | return BaseResponseUtils.buildError("任务所涉及的控制器还未设置") ; |
| | | } |
| | | |
| | | String ugCallbackUrl_rm = env.getProperty("mw." + DataSourceContext.get() + ".ugCallbackUrl_rm" ); |
| | | String ugCallbackUrl_rm = env.getProperty("mw.ugCallbackUrl_rm" ); |
| | | if(ugCallbackUrl_rm == null || ugCallbackUrl_rm.trim().equals("")){ |
| | | return BaseResponseUtils.buildError("未配置升级任务回调网址") ; |
| | | } |
| | |
| | | this.sv.setUpgradeTaskExecuted(id); |
| | | return BaseResponseUtils.buildSuccess(true) ; |
| | | }else{ |
| | | log.error("通信中间件执行下发升级任务失败" + (res.getMsg() == null? "" : ("," + res.getMsg()))) ; |
| | | return BaseResponseUtils.buildFail("通信中间件执行失败" + (res.getMsg() == null? "" : ("," + res.getMsg()))) ; |
| | | String msg = res.getContent()==null?null:(String)res.getContent() ; |
| | | if(msg == null){ |
| | | msg = res.getMsg() ; |
| | | } |
| | | log.error("通信中间件执行下发升级任务失败" + msg) ; |
| | | return BaseResponseUtils.buildFail("通信中间件执行失败" + msg) ; |
| | | } |
| | | }else{ |
| | | log.error("通信中间件返回结果为null") ; |
| | |
| | | vo.softFileName = ppo.hexFileName ; |
| | | vo.softStoreAddr = ppo.storeRamAddr ; |
| | | vo.softStartAddr = ppo.startRamAddr ; |
| | | vo.softFileData = ppo.programBytes ; |
| | | vo.softFileData64 = Base64.getEncoder().encodeToString(ppo.programBytes) ; |
| | | //vo.softFileData = ppo.programBytes ; |
| | | vo.softBytesCalculate = ppo.programCalculateBytes ; |
| | | vo.softByteSrc16 = ppo.programCrc16 ; |
| | | } |