| | |
| | | package com.dy.pipIrrRemote.rtuUpgrage; |
| | | |
| | | import com.dy.common.contant.Constant; |
| | | import com.dy.common.multiDataSource.DataSourceContext; |
| | | import com.dy.common.softUpgrade.state.UpgradeInfo; |
| | | import com.dy.common.softUpgrade.state.UpgradeRtu; |
| | | import com.dy.common.softUpgrade.state.UpgradeState; |
| | |
| | | import com.dy.pipIrrGlobal.pojoUg.UgRtuTask; |
| | | import io.swagger.v3.oas.annotations.Hidden; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.servlet.http.HttpServletRequest; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | */ |
| | | @Hidden //不公开接口,其只有通信中间件调用 |
| | | @PostMapping(path = "/receive") |
| | | public BaseResponse<Boolean> receive(@RequestBody UpgradeInfo info){ |
| | | log.info("接收到的RTU远程升级状态数据为:{}", info.toString()); |
| | | public BaseResponse<Boolean> receive(@RequestBody UpgradeInfo info, HttpServletRequest req, HttpServletResponse rep){ |
| | | log.info("接收到的RTU远程升级状态数据为:{}", info.toString("532328000214")); |
| | | //进行排序 |
| | | //Comparator<UpgradeRtu> comparator = Comparator.comparing(UpgradeRtu::getRtuAddr, Comparator.naturalOrder()); |
| | | //info.ugRtuStateList = info.ugRtuStateList.stream().sorted(comparator).collect(Collectors.toList()); |
| | | |
| | | //通信中间件传过来的机构tag,以用于查找数据源 |
| | | String token = req.getHeader(Constant.UserTokenKeyInHeader); |
| | | DataSourceContext.set(token); |
| | | |
| | | if(info.ugRtuStateList != null && info.ugRtuStateList.size() > 0){ |
| | | if(info.ugRtuStateList.size() < 10){ |
| | | for (UpgradeRtu rtuVo : info.ugRtuStateList) { |