Merge branch 'master' of http://8.140.179.55:20000/r/pipIrr-SV
1 文件已重命名
31个文件已修改
1个文件已添加
1个文件已删除
| | |
| | | case STATE_FAILONE: |
| | | return "ä¸å
æ»"; |
| | | case STATE_FAIL: |
| | | return "åçº§ä¸æ»"; |
| | | return "å¤å
æ»"; |
| | | case STATE_FAILOFFLINE: |
| | | return "离线失败"; |
| | | default: |
| | |
| | | public int overTotal ;//ææç»æï¼å
æ¬æå䏿æå¤±è´¥ï¼ |
| | | public int successTotal ;//æææå |
| | | public int failTotal ;//ææå¤±è´¥ï¼ä¸å
æ»å¤±è´¥+å¤å
æ»å¤±è´¥+ç¦»çº¿å¤±è´¥ï¼ |
| | | public int failOneTotal ;//ææä¸å
æ»å¤±è´¥ |
| | | public int failMultiTotal ;//ææå¤å
æ»å¤±è´¥ |
| | | public int dieOneTotal;//ææä¸å
æ» |
| | | public int dieMultiTotal;//ææå¤å
æ» |
| | | public int failOffTotal ;//ææç¦»çº¿å¤±è´¥ |
| | | |
| | | public Boolean allOver ;//ææé½ç»æï¼true:æ¯ï¼false:å¦ï¼ |
| | |
| | | this.overTotal = 0; |
| | | this.successTotal = 0; |
| | | this.failTotal = 0; |
| | | this.failOneTotal = 0; |
| | | this.failMultiTotal = 0; |
| | | this.dieOneTotal = 0; |
| | | this.dieMultiTotal = 0; |
| | | this.failOffTotal = 0; |
| | | this.allOver = false ; |
| | | } |
| | |
| | | sb.append(" \nå·²ç»ææ»æ°ï¼" + overTotal) ; |
| | | sb.append(" \næåæ»æ°ï¼" + successTotal) ; |
| | | sb.append(" \nå¤±è´¥æ»æ°ï¼" + failTotal) ; |
| | | sb.append(" \nä¸å
æ»å¤±è´¥æ»æ°ï¼" + failOneTotal) ; |
| | | sb.append(" \nå¤å
æ»å¤±è´¥æ»æ°ï¼" + failMultiTotal) ; |
| | | sb.append(" \nä¸å
æ»å¤±è´¥æ»æ°ï¼" + dieOneTotal) ; |
| | | sb.append(" \nå¤å
æ»å¤±è´¥æ»æ°ï¼" + dieMultiTotal) ; |
| | | sb.append(" \nç¦»çº¿å¤±è´¥æ»æ°ï¼" + failOffTotal) ; |
| | | sb.append(" \nå
¨ç»æï¼" + allOver) ; |
| | | return sb.toString() ; |
| | |
| | | |
| | | /* |
| | | public static void main(String[] args) { |
| | | System.out.println(CreateRandom.random(1, 0)); |
| | | System.out.println(CreateRandom.random(2, 0)); |
| | | System.out.println(CreateRandom.random(3, 0)); |
| | | System.out.println(CreateRandom.random(4, 0)); |
| | | System.out.println(CreateRandom.random(5, 0)); |
| | | System.out.println(CreateRandom.random(100, 0)); |
| | | System.out.println(CreateRandom.random(1256, 1234)); |
| | | // System.out.println(CreateRandom.random(1, 0)); |
| | | // System.out.println(CreateRandom.random(2, 0)); |
| | | // System.out.println(CreateRandom.random(3, 0)); |
| | | // System.out.println(CreateRandom.random(4, 0)); |
| | | // System.out.println(CreateRandom.random(5, 0)); |
| | | // System.out.println(CreateRandom.random(100, 0)); |
| | | // System.out.println(CreateRandom.random(1256, 1234)); |
| | | System.out.println("======================="); |
| | | System.out.println(create_between(10, 100)); |
| | | for(int i = 0 ; i < 100; i++){ |
| | | System.out.println(create_between(10, 100)); |
| | | } |
| | | } |
| | | */ |
| | | |
| | | |
| | | /** |
| | | * 4ä½éæºæ°æ® |
| | |
| | | if(max - min < min/2){ |
| | | return min ; |
| | | } |
| | | String minStr = String.valueOf(min) ; |
| | | int len = minStr.length() ; |
| | | char minFirst = minStr.charAt(0) ; |
| | | double d = Math.random(); |
| | | d = d * 10000000 ; |
| | | String s = String.valueOf(d); |
| | | s = minFirst + s ; |
| | | int len = String.valueOf(min).length() ; |
| | | String s = String.valueOf(Math.random() * 10000000); |
| | | s = s.substring(0 ,len) ; |
| | | int n = Integer.parseInt(s) ; |
| | | if(n < min || n > max){ |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.dy.pipIrrGlobal.pojoOp.OpeTaskType; |
| | | import com.dy.pipIrrGlobal.voOp.VoTaskType; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | |
| | | int updateByPrimaryKeySelective(OpeTaskType record); |
| | | |
| | | int updateByPrimaryKey(OpeTaskType record); |
| | | |
| | | /** |
| | | * è·åä»»å¡ç±»åå表 |
| | | * @return |
| | | */ |
| | | List<VoTaskType> getTaskTypes(); |
| | | |
| | | |
| | | } |
File was renamed from pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/rtuMw/ToRtuMwCom.java |
| | |
| | | * @Date: 2024/10/23 11:45 |
| | | * @Description |
| | | */ |
| | | public abstract class ToRtuMwCom { |
| | | public abstract class Web2RtuMw { |
| | | /** |
| | | * pro_mwï¼å±æ§ |
| | | * tag仿§å¶å¨ä¸è·å |
| | | * key_mwï¼urlçkey |
| | | */ |
| | | private static final String pro_mw = "mw"; |
| | | private static final String key_mw = "comSendUrl"; |
| | | private static final String keyUg_mw = "ugTaskSendUrl"; |
| | | private static final String pro_url = "url"; |
| | | |
| | | protected static final String ContextComSend = "/rtuMw/com/send"; |
| | | |
| | | protected static final String ContextRtuLogFile = "/rtuMw/com/rtuLogFile"; |
| | | protected static final String ContextRtuLogText = "/rtuMw/com/rtuLogText"; |
| | | |
| | | protected static final String ContextUgTaskSend = "/rtuMw/com/upgradeRtu"; |
| | | protected static final String ContextUgForceOver = "/rtuMw/com/ugForceOver"; |
| | | /** |
| | | * å¾å°åéä¿¡ä¸é´ä»¶åéæ°æ®çURL |
| | | * @param env |
| | | * @return |
| | | */ |
| | | protected String getToMwUrl(Environment env) { |
| | | return env.getProperty(pro_mw + "." + DataSourceContext.get() + "." + key_mw); |
| | | protected String get2MwUrl(Environment env) { |
| | | return env.getProperty(pro_mw + "." + DataSourceContext.get() + "." + pro_url); |
| | | } |
| | | /** |
| | | * å¾å°åéä¿¡ä¸é´ä»¶åé强å¶åæ¢å级çå½ä»¤URL |
| | | * @param env |
| | | * @return |
| | | */ |
| | | protected String get2MwRequestUrl(Environment env, String context) { |
| | | return get2MwUrl(env) + context; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * å¾å°åéä¿¡ä¸é´ä»¶åéæ°æ®çURL |
| | | * @param env |
| | | * åéä¿¡ä¸é´ä»¶åértuè¿ç¨åçº§ä»»å¡ |
| | | * @param restTemplate SpringBootçRestTemplate |
| | | * @param toMwUrl å°éä¿¡ä¸é´ä»¶çweb请æ±Url |
| | | * @param param 请æ±åæ° |
| | | * @return |
| | | */ |
| | | protected String getToMwUgUrl(Environment env) { |
| | | return env.getProperty(pro_mw + "." + DataSourceContext.get() + "." + keyUg_mw); |
| | | protected BaseResponse sendRequest2Mw(RestTemplate restTemplate, String toMwUrl, Object param) { |
| | | String url = UriComponentsBuilder.fromUriString(toMwUrl) |
| | | .build() |
| | | .toUriString(); |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | HttpEntity<?> httpEntity ; |
| | | if(param != null){ |
| | | httpEntity = new HttpEntity<>(param, headers); |
| | | }else{ |
| | | httpEntity = new HttpEntity<>(headers); |
| | | } |
| | | ResponseEntity<BaseResponse> response = null; |
| | | try { |
| | | // éè¿Postæ¹å¼è°ç¨æ¥å£ |
| | | response = restTemplate.exchange(url, HttpMethod.POST, httpEntity, BaseResponse.class); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return BaseResponseUtils.buildError("å端系ç»åºéï¼ä¸é´ä»¶è°ç¨å¼å¸¸"); |
| | | } |
| | | if(response == null){ |
| | | return BaseResponseUtils.buildError("å端系ç»åºéï¼ä¸é´ä»¶è°ç¨å¼å¸¸"); |
| | | }else{ |
| | | return response.getBody(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | return com ; |
| | | } |
| | | |
| | | /** |
| | | * åéå½ä»¤ |
| | | * |
| | | * @return |
| | | */ |
| | | protected BaseResponse sendCom2Mw(RestTemplate restTemplate, String comSendUrl, Command com) { |
| | | String url = UriComponentsBuilder.fromUriString(comSendUrl) |
| | | .build() |
| | | .toUriString(); |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | HttpEntity<Command> httpEntity = new HttpEntity<>(com, headers); |
| | | ResponseEntity<BaseResponse> response = null; |
| | | try { |
| | | // éè¿Postæ¹å¼è°ç¨æ¥å£ |
| | | response = restTemplate.exchange(url, HttpMethod.POST, httpEntity, BaseResponse.class); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return BaseResponseUtils.buildError("å端系ç»åºéï¼ä¸é´ä»¶è°ç¨å¼å¸¸"); |
| | | } |
| | | if(response == null){ |
| | | return BaseResponseUtils.buildError("å端系ç»åºéï¼ä¸é´ä»¶è°ç¨å¼å¸¸"); |
| | | }else{ |
| | | return response.getBody(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * åéä¿¡ä¸é´ä»¶åértuè¿ç¨åçº§ä»»å¡ |
| | | * @param restTemplate |
| | | * @param comSendUrl |
| | | * @param vo |
| | | * @return |
| | | */ |
| | | protected BaseResponse sendUpgradeTask2Mw(RestTemplate restTemplate, String comSendUrl, UpgradeTaskVo vo) { |
| | | String url = UriComponentsBuilder.fromUriString(comSendUrl) |
| | | .build() |
| | | .toUriString(); |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | HttpEntity<UpgradeTaskVo> httpEntity = new HttpEntity<>(vo, headers); |
| | | ResponseEntity<BaseResponse> response = null; |
| | | try { |
| | | // éè¿Postæ¹å¼è°ç¨æ¥å£ |
| | | response = restTemplate.exchange(url, HttpMethod.POST, httpEntity, BaseResponse.class); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return BaseResponseUtils.buildError("å端系ç»åºéï¼ä¸é´ä»¶è°ç¨å¼å¸¸"); |
| | | } |
| | | if(response == null){ |
| | | return BaseResponseUtils.buildError("å端系ç»åºéï¼ä¸é´ä»¶è°ç¨å¼å¸¸"); |
| | | }else{ |
| | | return response.getBody(); |
| | | } |
| | | } |
| | | } |
| | |
| | | public static final long serialVersionUID = 202411081500001L; |
| | | |
| | | /** |
| | | * é®é¢ç»æID |
| | | * å¤çç»æID |
| | | */ |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | private Long proResultId; |
| | |
| | | private Long workOrderId; |
| | | |
| | | /** |
| | | * å·¡æ£åID |
| | | * å·¡æ£å |
| | | */ |
| | | private String inspector; |
| | | |
New file |
| | |
| | | package com.dy.pipIrrGlobal.voOp; |
| | | |
| | | import com.alibaba.fastjson2.annotation.JSONField; |
| | | import com.alibaba.fastjson2.writer.ObjectWriterImplToString; |
| | | import com.dy.common.po.BaseEntity; |
| | | import com.fasterxml.jackson.annotation.JsonPropertyOrder; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author ZhuBaoMin |
| | | * @date 2024-11-28 14:39 |
| | | * @LastEditTime 2024-11-28 14:39 |
| | | * @Description ä»»å¡ç±»åè§å¾å¯¹è±¡ |
| | | */ |
| | | |
| | | @Data |
| | | @JsonPropertyOrder({"taskTypeId", "taskType"}) |
| | | public class VoTaskType implements BaseEntity { |
| | | public static final long serialVersionUID = 202411281440001L; |
| | | |
| | | /** |
| | | * ä»»å¡ç±»åID |
| | | */ |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | private Long taskTypeId; |
| | | |
| | | /** |
| | | * ä»»å¡ç±»å |
| | | */ |
| | | private String taskType; |
| | | } |
| | |
| | | */ |
| | | |
| | | @Data |
| | | @JsonPropertyOrder({"workOrderId", "dispatcherId", "dispatcher", "inspectorId", "inspector", "taskTypeId", "taskType", "taskContent", "completeCriteria", "deadLine", "clientReportId", "inspectorReportId", "completeTime", "dispatchTime", "rejectTimes", "state", "processingState"}) |
| | | @JsonPropertyOrder({"workOrderId", "dispatcherId", "dispatcher", "inspectorId", "inspector", "taskTypeId", "taskType", "taskContent", "completeCriteria", "deadLine", "clientReportId", "inspectorReportId", "completeTime", "dispatchTime", "rejectTimes", "state", "processingState", "proResultId"}) |
| | | public class VoWorkOrder implements BaseEntity { |
| | | public static final long serialVersionUID = 202411061524001L; |
| | | |
| | |
| | | * å¤çç¶æ |
| | | */ |
| | | private String processingState; |
| | | |
| | | /** |
| | | * å¤çç»æID |
| | | */ |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | private Long proResultId; |
| | | } |
| | |
| | | package com.dy.pipIrrGlobal.voUg; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelIgnore; |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | import com.alibaba.excel.annotation.write.style.ColumnWidth; |
| | | import com.alibaba.excel.annotation.write.style.ContentRowHeight; |
| | | import com.alibaba.excel.annotation.write.style.ContentStyle; |
| | | import com.alibaba.excel.annotation.write.style.HeadRowHeight; |
| | | import com.alibaba.excel.enums.poi.HorizontalAlignmentEnum; |
| | | import com.alibaba.excel.enums.poi.VerticalAlignmentEnum; |
| | | import com.alibaba.fastjson2.annotation.JSONField; |
| | | import com.alibaba.fastjson2.writer.ObjectWriterImplToString; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import com.fasterxml.jackson.annotation.JsonPropertyOrder; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @Author: liurunyu |
| | |
| | | */ |
| | | |
| | | @Data |
| | | @JsonPropertyOrder({ "id", "rtuAddr", "intakeName", "isOver", "isOverStr", "ugState", "ugStateStr", "overDt"}) |
| | | @HeadRowHeight(26) |
| | | @ContentRowHeight(22) |
| | | @JsonPropertyOrder({ "id", "intakeNum", "rtuAddr", "isOverStr", "ugStateStr", "overDt"}) |
| | | public class VoUgResult { |
| | | /** |
| | | * ä¸»é® |
| | | */ |
| | | @Schema(description = "主é®" ) |
| | | @JSONField(serializeUsing= ObjectWriterImplToString.class) |
| | | @ExcelIgnore() |
| | | public Long id; |
| | | |
| | | /** |
| | | * æ§å¶å¨å°å |
| | | */ |
| | | @Schema(description = "æ§å¶å¨å°å" ) |
| | | @ExcelProperty("æ§å¶å¨å°å") |
| | | @ColumnWidth(20) |
| | | @ContentStyle(horizontalAlignment = HorizontalAlignmentEnum.CENTER, verticalAlignment = VerticalAlignmentEnum.CENTER) |
| | | public String rtuAddr; |
| | | |
| | | /** |
| | | * åæ°´ç¼å· |
| | | */ |
| | | @Schema(description = "åæ°´å£ç¼å·") |
| | | @ExcelProperty("åæ°´ç¼å·") |
| | | @ColumnWidth(20) |
| | | @ContentStyle(horizontalAlignment = HorizontalAlignmentEnum.CENTER, verticalAlignment = VerticalAlignmentEnum.CENTER) |
| | | private String intakeNum; |
| | | |
| | | /** |
| | | * å级æ¯å¦ç»æ |
| | | */ |
| | | @Schema(description = "å级æ¯å¦ç»æ" ) |
| | | @JSONField(serialize = false) |
| | | @ExcelIgnore() |
| | | public Byte isOver; |
| | | |
| | | /** |
| | | * å级æ¯å¦ç»æ |
| | | */ |
| | | @Schema(description = "å级æ¯å¦ç»æ" ) |
| | | @TableField(exist = false) |
| | | @ExcelProperty("åçº§ç»æ") |
| | | @ColumnWidth(10) |
| | | @ContentStyle(horizontalAlignment = HorizontalAlignmentEnum.CENTER, verticalAlignment = VerticalAlignmentEnum.CENTER) |
| | | public String isOverStr; |
| | | |
| | | /** |
| | | * åçº§ç¶æ |
| | | */ |
| | | @Schema(description = "åçº§ç¶æ" ) |
| | | @JSONField(serialize = false) |
| | | @ExcelIgnore() |
| | | public Integer ugState; |
| | | |
| | | /** |
| | | * åçº§ç¶æ |
| | | */ |
| | | @Schema(description = "åçº§ç¶æ" ) |
| | | @ExcelProperty("åçº§ç»æ") |
| | | @ColumnWidth(16) |
| | | @ContentStyle(horizontalAlignment = HorizontalAlignmentEnum.CENTER, verticalAlignment = VerticalAlignmentEnum.CENTER) |
| | | public String ugStateStr; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Schema(description = "åçº§ç»ææ¶é´" ) |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:SS") |
| | | public Integer overDt; |
| | | @ExcelProperty("ç»ææ¶é´") |
| | | @ColumnWidth(30) |
| | | @ContentStyle(horizontalAlignment = HorizontalAlignmentEnum.CENTER, verticalAlignment = VerticalAlignmentEnum.CENTER) |
| | | public Date overDt; |
| | | |
| | | /** |
| | | * æ åæ°æ®æé æ¹æ³ |
| | |
| | | |
| | | @ExcelProperty("åçº§ç»æ") |
| | | @ColumnWidth(30) |
| | | @ContentStyle(horizontalAlignment = HorizontalAlignmentEnum.LEFT, verticalAlignment = VerticalAlignmentEnum.CENTER) |
| | | @ContentStyle(horizontalAlignment = HorizontalAlignmentEnum.CENTER, verticalAlignment = VerticalAlignmentEnum.CENTER) |
| | | public String result; |
| | | } |
| | |
| | | #é讯ä¸é´ä»¶ç¸å
³é
ç½® |
| | | #protocol: DYJS_2023,DYJS_2024 |
| | | mw: |
| | | #å½ä»¤åéå°å(ä¸ç¼æ¯æºætagï¼å
¶ä¹æ¯æ°æ®æºåç¼åç§°) |
| | | #å½ä»¤åééä¿¡ä¸é´ä»¶å°å |
| | | ym: |
| | | url: "http://127.0.0.1:8070" |
| | | comSendUrl: "http://127.0.0.1:8070/rtuMw/com/send" |
| | | ugTaskSendUrl: "http://127.0.0.1:8070/rtuMw/com/upgradeRtu" |
| | | rtuLogFileUrl: "http://127.0.0.1:8070/rtuMw/com/rtuLogFile" |
| | | rtuLogTextUrl: "http://127.0.0.1:8070/rtuMw/com/rtuLogText" |
| | | sp: |
| | | url: "http://127.0.0.1:8073" |
| | | comSendUrl: "http://127.0.0.1:8073/rtuMw/com/send" |
| | | ugTaskSendUrl: "http://127.0.0.1:8073/rtuMw/com/upgradeRtu" |
| | | rtuLogFileUrl: "http://127.0.0.1:8073/rtuMw/com/rtuLogFile" |
| | | rtuLogTextUrl: "http://127.0.0.1:8073/rtuMw/com/rtuLogText" |
| | | test: |
| | | url: "http://127.0.0.1:8072" |
| | | comSendUrl: "http://127.0.0.1:8072/rtuMw/com/send" |
| | | ugTaskSendUrl: "http://127.0.0.1:8072/rtuMw/com/upgradeRtu" |
| | | rtuLogFileUrl: "http://127.0.0.1:8072/rtuMw/com/rtuLogFile" |
| | | rtuLogTextUrl: "http://127.0.0.1:8072/rtuMw/com/rtuLogText" |
| | | #çæµæ§å¶æ¨¡ååè°å°å |
| | | rtuCallbackUrl_rm: "http://127.0.0.1:8081/remote/comRes/receive" |
| | | #rtuè¿ç¨å级模ååè°å°å |
| | |
| | | #é讯ä¸é´ä»¶ç¸å
³é
ç½® |
| | | #protocol: DYJS_2023,DYJS_2024 |
| | | mw: |
| | | #å½ä»¤åéå°å(ä¸ç¼æ¯æºætagï¼å
¶ä¹æ¯æ°æ®æºåç¼åç§°) |
| | | #å½ä»¤åééä¿¡ä¸é´ä»¶å°å |
| | | ym: |
| | | url: "http://127.0.0.1:8070" |
| | | comSendUrl: "http://127.0.0.1:8070/rtuMw/com/send" |
| | | ugTaskSendUrl: "http://127.0.0.1:8070/rtuMw/com/upgradeRtu" |
| | | rtuLogFileUrl: "http://127.0.0.1:8070/rtuMw/com/rtuLogFile" |
| | | rtuLogTextUrl: "http://127.0.0.1:8070/rtuMw/com/rtuLogText" |
| | | sp: |
| | | url: "http://127.0.0.1:8073" |
| | | comSendUrl: "http://127.0.0.1:8073/rtuMw/com/send" |
| | | ugTaskSendUrl: "http://127.0.0.1:8073/rtuMw/com/upgradeRtu" |
| | | rtuLogFileUrl: "http://127.0.0.1:8073/rtuMw/com/rtuLogFile" |
| | | rtuLogTextUrl: "http://127.0.0.1:8073/rtuMw/com/rtuLogText" |
| | | test: |
| | | url: "http://127.0.0.1:8072" |
| | | comSendUrl: "http://127.0.0.1:8072/rtuMw/com/send" |
| | | ugTaskSendUrl: "http://127.0.0.1:8072/rtuMw/com/upgradeRtu" |
| | | rtuLogFileUrl: "http://127.0.0.1:8072/rtuMw/com/rtuLogFile" |
| | | rtuLogTextUrl: "http://127.0.0.1:8072/rtuMw/com/rtuLogText" |
| | | #çæµæ§å¶æ¨¡ååè°å°å |
| | | rtuCallbackUrl_rm: "http://127.0.0.1:8081/remote/comRes/receive" |
| | | #rtuè¿ç¨å级模ååè°å°å |
| | |
| | | #é讯ä¸é´ä»¶ç¸å
³é
ç½® |
| | | #protocol: DYJS_2023,DYJS_2024 |
| | | mw: |
| | | #å½ä»¤åéå°å(ä¸ç¼æ¯æºætagï¼å
¶ä¹æ¯æ°æ®æºåç¼åç§°) |
| | | #å½ä»¤åééä¿¡ä¸é´ä»¶å°å |
| | | ym: |
| | | url: "http://127.0.0.1:8070" |
| | | comSendUrl: "http://127.0.0.1:8070/rtuMw/com/send" |
| | | ugTaskSendUrl: "http://127.0.0.1:8070/rtuMw/com/upgradeRtu" |
| | | rtuLogFileUrl: "http://127.0.0.1:8070/rtuMw/com/rtuLogFile" |
| | | rtuLogTextUrl: "http://127.0.0.1:8070/rtuMw/com/rtuLogText" |
| | | sp: |
| | | url: "http://127.0.0.1:8073" |
| | | comSendUrl: "http://127.0.0.1:8073/rtuMw/com/send" |
| | | ugTaskSendUrl: "http://127.0.0.1:8073/rtuMw/com/upgradeRtu" |
| | | rtuLogFileUrl: "http://127.0.0.1:8073/rtuMw/com/rtuLogFile" |
| | | rtuLogTextUrl: "http://127.0.0.1:8073/rtuMw/com/rtuLogText" |
| | | test: |
| | | url: "http://127.0.0.1:8072" |
| | | comSendUrl: "http://127.0.0.1:8072/rtuMw/com/send" |
| | | ugTaskSendUrl: "http://127.0.0.1:8072/rtuMw/com/upgradeRtu" |
| | | rtuLogFileUrl: "http://127.0.0.1:8072/rtuMw/com/rtuLogFile" |
| | | rtuLogTextUrl: "http://127.0.0.1:8072/rtuMw/com/rtuLogText" |
| | | #çæµæ§å¶æ¨¡ååè°å°å |
| | | rtuCallbackUrl_rm: "http://127.0.0.1:8081/remote/comRes/receive" |
| | | #rtuè¿ç¨å级模ååè°å°å |
| | |
| | | #é讯ä¸é´ä»¶ç¸å
³é
ç½® |
| | | #protocol: DYJS_2023,DYJS_2024 |
| | | mw: |
| | | #å½ä»¤åéå°å(ä¸ç¼æ¯æºætagï¼å
¶ä¹æ¯æ°æ®æºåç¼åç§°) |
| | | #å½ä»¤åééä¿¡ä¸é´ä»¶å°å |
| | | ym: |
| | | url: "http://127.0.0.1:8070" |
| | | comSendUrl: "http://127.0.0.1:8070/rtuMw/com/send" |
| | | ugTaskSendUrl: "http://127.0.0.1:8070/rtuMw/com/upgradeRtu" |
| | | rtuLogFileUrl: "http://127.0.0.1:8070/rtuMw/com/rtuLogFile" |
| | | rtuLogTextUrl: "http://127.0.0.1:8070/rtuMw/com/rtuLogText" |
| | | sp: |
| | | url: "http://127.0.0.1:8073" |
| | | comSendUrl: "http://127.0.0.1:8073/rtuMw/com/send" |
| | | ugTaskSendUrl: "http://127.0.0.1:8073/rtuMw/com/upgradeRtu" |
| | | rtuLogFileUrl: "http://127.0.0.1:8073/rtuMw/com/rtuLogFile" |
| | | rtuLogTextUrl: "http://127.0.0.1:8073/rtuMw/com/rtuLogText" |
| | | test: |
| | | url: "http://127.0.0.1:8072" |
| | | comSendUrl: "http://127.0.0.1:8072/rtuMw/com/send" |
| | | ugTaskSendUrl: "http://127.0.0.1:8072/rtuMw/com/upgradeRtu" |
| | | rtuLogFileUrl: "http://127.0.0.1:8072/rtuMw/com/rtuLogFile" |
| | | rtuLogTextUrl: "http://127.0.0.1:8072/rtuMw/com/rtuLogText" |
| | | #çæµæ§å¶æ¨¡ååè°å°å |
| | | rtuCallbackUrl_rm: "http://127.0.0.1:8081/remote/comRes/receive" |
| | | #rtuè¿ç¨å级模ååè°å°å |
| | |
| | | deleted = #{deleted,jdbcType=BIGINT} |
| | | where id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | <!--è·åä»»å¡ç±»åå表--> |
| | | <select id="getTaskTypes" resultType="com.dy.pipIrrGlobal.voOp.VoTaskType"> |
| | | SELECT |
| | | id AS taskTypeId, |
| | | task_type AS taskType |
| | | FROM ope_task_type |
| | | WHERE deleted = 0 |
| | | </select> |
| | | </mapper> |
| | |
| | | AND us2.name like CONCAT('%',#{inspector},'%') |
| | | </if> |
| | | |
| | | <if test = "state != null"> |
| | | AND ord.state = #{state} |
| | | </if> |
| | | |
| | | <if test = "timeStart != null and timeStop != null"> |
| | | AND ord.dispatch_time BETWEEN #{timeStart} AND #{timeStop} |
| | | </if> |
| | |
| | | WHEN res.state = 2 THEN 'å·²éè¿' |
| | | WHEN res.state = 3 THEN '已驳å' |
| | | ELSE 'æªä¸æ¥' |
| | | END AS processingState |
| | | END AS processingState, |
| | | res.id AS proResultId |
| | | FROM ope_work_order ord |
| | | INNER JOIN ba_user us1 ON us1.id = ord.dispatcher_id |
| | | INNER JOIN ba_user us2 ON us2.id = ord.inspector_id |
| | |
| | | AND us2.name like CONCAT('%',#{inspector},'%') |
| | | </if> |
| | | |
| | | <if test = "state != null"> |
| | | AND ord.state = #{state} |
| | | </if> |
| | | |
| | | <if test = "timeStart != null and timeStop != null"> |
| | | AND ord.dispatch_time BETWEEN #{timeStart} AND #{timeStop} |
| | | </if> |
| | |
| | | <!--@mbg.generated--> |
| | | select |
| | | count(*) |
| | | from ug_rtu_controller |
| | | from ug_rtu_controller ugCon |
| | | inner join ug_rtu_task ugTask on ugCon.task_id = ugTask.id |
| | | inner join pr_controller con on ugCon.controller_id = con.id |
| | | inner join pr_intake inta on con.intakeId = inta.id |
| | | <where> |
| | | <if test="taskId != null"> |
| | | AND task_id = #{taskId,jdbcType=BIGINT} |
| | | AND ugCon.task_id = #{taskId,jdbcType=BIGINT} |
| | | </if> |
| | | <if test="intakeNum != null and intakeNum != ''"> |
| | | AND inta.name = #{intakeNum,jdbcType=VARCHAR} |
| | | </if> |
| | | <if test="rtuAddr != null and rtuAddr != ''"> |
| | | AND ugCon.rtu_addr = #{rtuAddr,jdbcType=VARCHAR} |
| | | </if> |
| | | <if test="state != null and state == 1"> |
| | | AND ugCon.ug_state = 1 |
| | | </if> |
| | | <if test="state != null and state == 0"> |
| | | AND ugCon.ug_state != 1 |
| | | </if> |
| | | <if test="fail != null"> |
| | | AND ugCon.ug_state = #{fail,jdbcType=INTEGER} |
| | | </if> |
| | | </where> |
| | | </select> |
| | |
| | | <select id="selectControllerUpgradeResults" resultType="com.dy.pipIrrGlobal.voUg.VoUgResult"> |
| | | <!--@mbg.generated--> |
| | | select |
| | | ctb.id as id, |
| | | inTb.name as intakeNum, |
| | | ctb.rtu_addr as rtuAddr, |
| | | ctb.is_over as isOver, |
| | | ctb.ug_state as ugState, |
| | | ctb.over_dt as overDt |
| | | from ug_rtu_controller ctb |
| | | inner join pr_intake inTb on ctb.task_id = inTb.id |
| | | ugCon.id as id, |
| | | inta.name as intakeNum, |
| | | ugCon.rtu_addr as rtuAddr, |
| | | ugCon.is_over as isOver, |
| | | ugCon.ug_state as ugState, |
| | | ugCon.over_dt as overDt |
| | | from ug_rtu_controller ugCon |
| | | inner join ug_rtu_task ugTask on ugCon.task_id = ugTask.id |
| | | inner join pr_controller con on ugCon.controller_id = con.id |
| | | inner join pr_intake inta on con.intakeId = inta.id |
| | | <where> |
| | | <if test="taskId != null"> |
| | | AND ctb.task_id = #{taskId,jdbcType=BIGINT} |
| | | AND ugCon.task_id = #{taskId,jdbcType=BIGINT} |
| | | </if> |
| | | <if test="intakeNum != null and intakeNum != ''"> |
| | | AND inta.name = #{intakeNum,jdbcType=VARCHAR} |
| | | </if> |
| | | <if test="rtuAddr != null and rtuAddr != ''"> |
| | | AND ugCon.rtu_addr = #{rtuAddr,jdbcType=VARCHAR} |
| | | </if> |
| | | <if test="state != null and state == 1"> |
| | | AND ugCon.ug_state = 1 |
| | | </if> |
| | | <if test="state != null and state == 0"> |
| | | AND ugCon.ug_state != 1 |
| | | </if> |
| | | <if test="fail != null"> |
| | | AND ugCon.ug_state = #{fail,jdbcType=INTEGER} |
| | | </if> |
| | | </where> |
| | | ORDER BY ctb.id ASC |
| | | ORDER BY ugCon.id ASC |
| | | <trim prefix="limit " > |
| | | <if test="start != null and count != null"> |
| | | #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} |
| | |
| | | * å 为强å¶ç»æå级任å¡ï¼å¯¹ä¸ä¸ªæªåçº§å®æçRTUå°±ä¼å¡æ»ï¼ |
| | | * æä»¥å½å¼ºå¶ç»æå级任å¡ï¼ä»£ç é»è¾å¹¶æ²¡æå¼ºå¶ç»æRTUå级è¿ç¨ï¼å¦æå级è¿ç¨ä¹å¼ºå¶åæ¢ï¼é£ä¹RTUçä¼å¡æ» |
| | | */ |
| | | public void forceOverUpgradeTask() { |
| | | public String forceOverUpgradeTask() { |
| | | if(this.task != null){ |
| | | this.stop(); |
| | | this.task.forceOver(); |
| | | this.task.countRunningRtuCount(); |
| | | if(this.task.curUgRunningRtuTotal > 0){ |
| | | return "å½ååå¨å级ä¸ç设å¤ï¼ä¸è½ç»æå级任å¡" ; |
| | | }else{ |
| | | this.stop(); |
| | | this.task.forceOver(); |
| | | return null ; |
| | | } |
| | | }else{ |
| | | return "å½å没æå级任å¡" ; |
| | | } |
| | | this.task = null ; |
| | | } |
| | | |
| | | /** |
| | |
| | | /////////////////////////////////////////////////// |
| | | //以ä¸å
鍿§å¶ç¨ |
| | | @JSONField(serialize = false) |
| | | private int curUgRunningRtuTotal = 0 ;//å½åæ£å¨å级çRTUä¸ªæ° |
| | | protected int curUgRunningRtuTotal = 0 ;//å½åæ£å¨å级çRTUä¸ªæ° |
| | | |
| | | public UpgradeTask() { |
| | | this.curUgRunningRtuTotal = 0 ; |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 强å¶ç»æåçº§ä»»å¡ |
| | | */ |
| | |
| | | //this.upgradeState.clear(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * å½ååçº§ç¶æ |
| | |
| | | }else if(info.state == UpgradeRtu.STATE_SUCCESS) { |
| | | state.successTotal++; |
| | | }else if(info.state == UpgradeRtu.STATE_FAILONE) { |
| | | state.failOneTotal++; |
| | | state.failTotal++; |
| | | state.dieOneTotal++; |
| | | if(info.isOver){ |
| | | state.failTotal++; |
| | | } |
| | | }else if(info.state == UpgradeRtu.STATE_FAIL) { |
| | | state.failMultiTotal++; |
| | | state.failTotal++; |
| | | state.dieMultiTotal++; |
| | | if(info.isOver) { |
| | | state.failTotal++; |
| | | } |
| | | }else if(info.state == UpgradeRtu.STATE_FAILOFFLINE) { |
| | | state.failTotal++; |
| | | state.failOffTotal++; |
| | |
| | | |
| | | @Override |
| | | public void stop(UnitCallbackInterface callback) throws Exception { |
| | | overUpgradeTask() ; |
| | | forceOverUpgradeTask() ; |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | |
| | | /** |
| | | * 忢å½ååçº§ä»»å¡ |
| | | * ç»æå½ååçº§ä»»å¡ |
| | | * @throws Exception |
| | | * @return nullï¼ç»æä»»å¡æåï¼å¦åè¿å失败åå |
| | | */ |
| | | public void overUpgradeTask() throws Exception { |
| | | public String forceOverUpgradeTask() throws Exception { |
| | | if(manager != null ){ |
| | | manager.forceOverUpgradeTask() ; |
| | | return manager.forceOverUpgradeTask() ; |
| | | }else{ |
| | | return "éä¿¡ä¸é´ä»¶å
é¨é误" ; |
| | | } |
| | | } |
| | | |
| | |
| | | package com.dy.rtuMw.web.com; |
| | | |
| | | import com.dy.common.softUpgrade.state.UpgradeTaskVo; |
| | | import com.dy.common.webUtil.ResultCodeMsg; |
| | | import com.dy.rtuMw.resource.ResourceUnit; |
| | | import com.dy.rtuMw.server.ServerProperties; |
| | | import com.dy.rtuMw.server.forTcp.TcpSessionCache; |
| | |
| | | } |
| | | |
| | | /** |
| | | * æ¥æ¶webç³»ç»åæ¥å¼ºå¶ç»æåçº§ä»»å¡ |
| | | * @return |
| | | */ |
| | | @PostMapping(path = "ugForceOver", consumes = MediaType.APPLICATION_JSON_VALUE) |
| | | public BaseResponse<String> ugForceOver() { |
| | | log.info("æ¶å°åæ¢RTUå级任å¡å½ä»¤") ; |
| | | try{ |
| | | String mes = UpgradeUnit.getInstance().forceOverUpgradeTask(); |
| | | if(mes == null){ |
| | | mes = "忢åçº§ä»»å¡æå" ; |
| | | } |
| | | return BaseResponseUtils.buildResult(ResultCodeMsg.RsCode.SUCCESS_CODE, mes, mes); |
| | | }catch (Exception e){ |
| | | log.error("忢RTUåçº§ä»»å¡æ¶åçå¼å¸¸", e); |
| | | return BaseResponseUtils.buildError("忢RTUåçº§ä»»å¡æ¶åçå¼å¸¸" + (e.getMessage() == null?"":("ï¼" + e.getMessage()))); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æ¥æ¶webç³»ç»åæ¥çå½ä»¤ |
| | | * @param com |
| | | * @return |
| | |
| | | String cd = cdPre + cdSuf; |
| | | if(cd.equals("1601")){ |
| | | //å级é
ç½® |
| | | if(ServerProperties.argOneDie){ |
| | | UpHeartBeat.upHeartBeat = true ;//使è½ä¸è¡å¿è·³ |
| | | }else{ |
| | | UpCd9601.upData() ; |
| | | } |
| | | UpCd9601.upData() ; |
| | | |
| | | }else if(cd.equals("1602")){ |
| | | //åçº§æ°æ® |
| | | count9602 ++ ; |
| | | if(ServerProperties.argMultiDie){ |
| | | if(count9602 > 10){ |
| | | int random = CreateRandom.create_between(10, 100) ; |
| | | if(random > 50){ |
| | | UpHeartBeat.upHeartBeat = true ;//使è½ä¸è¡å¿è·³ |
| | | if(ServerProperties.argOneDie){ |
| | | UpHeartBeat.upHeartBeat = true ;//使è½ä¸è¡å¿è·³ |
| | | }else{ |
| | | if(ServerProperties.argMultiDie){ |
| | | if(count9602 > 10){ |
| | | int random = CreateRandom.create_between(10, 100) ; |
| | | if(random > 90){ |
| | | UpHeartBeat.upHeartBeat = true ;//使è½ä¸è¡å¿è·³ |
| | | }else{ |
| | | UpCd9602.upData() ; |
| | | } |
| | | }else{ |
| | | UpCd9602.upData() ; |
| | | } |
| | | }else{ |
| | | UpCd9602.upData() ; |
| | | } |
| | | }else{ |
| | | UpCd9602.upData() ; |
| | | } |
| | | }else if(cd.equals("1603")){ |
| | | //åçº§æ ¡éª |
| | |
| | | import com.dy.pipIrrGlobal.pojoOp.OpeProcessingResult; |
| | | import com.dy.pipIrrGlobal.pojoOp.OpeWorkOrder; |
| | | import com.dy.pipIrrGlobal.voOp.VoProcessingResult; |
| | | import com.dy.pipIrrGlobal.voOp.VoTaskType; |
| | | import com.dy.pipIrrGlobal.voOp.VoWorkOrder; |
| | | import jakarta.validation.Valid; |
| | | import lombok.RequiredArgsConstructor; |
| | |
| | | |
| | | return BaseResponseUtils.buildSuccess(true) ; |
| | | } |
| | | |
| | | /** |
| | | * è·åä»»å¡ç±»åå表 |
| | | * @return |
| | | */ |
| | | @GetMapping(path = "/getTaskTypes") |
| | | @SsoAop() |
| | | public BaseResponse<List<VoTaskType>> getTaskTypes() { |
| | | try { |
| | | return BaseResponseUtils.buildSuccess(workOrderSv.getTaskTypes()); |
| | | } catch (Exception e) { |
| | | log.error("è·åä»»å¡ç±»åå¼å¸¸", e); |
| | | return BaseResponseUtils.buildException(e.getMessage()); |
| | | } |
| | | } |
| | | } |
| | |
| | | import com.dy.pipIrrApp.workOrder.qo.QoWorkOrder; |
| | | import com.dy.pipIrrGlobal.daoOp.OpeApproveResultMapper; |
| | | import com.dy.pipIrrGlobal.daoOp.OpeProcessingResultMapper; |
| | | import com.dy.pipIrrGlobal.daoOp.OpeTaskTypeMapper; |
| | | import com.dy.pipIrrGlobal.daoOp.OpeWorkOrderMapper; |
| | | import com.dy.pipIrrGlobal.pojoOp.OpeApproveResult; |
| | | import com.dy.pipIrrGlobal.pojoOp.OpeProcessingResult; |
| | | import com.dy.pipIrrGlobal.pojoOp.OpeWorkOrder; |
| | | import com.dy.pipIrrGlobal.voOp.VoProcessingResult; |
| | | import com.dy.pipIrrGlobal.voOp.VoTaskType; |
| | | import com.dy.pipIrrGlobal.voOp.VoWorkOrder; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.dubbo.common.utils.PojoUtils; |
| | |
| | | |
| | | @Autowired |
| | | private OpeApproveResultMapper opeApproveResultMapper; |
| | | |
| | | @Autowired |
| | | private OpeTaskTypeMapper opeTaskTypeMapper; |
| | | |
| | | /** |
| | | * æ·»å å·¥åè®°å½ |
| | |
| | | |
| | | return "success"; |
| | | } |
| | | |
| | | /** |
| | | * è·åä»»å¡ç±»åå表 |
| | | * @return |
| | | */ |
| | | public List<VoTaskType> getTaskTypes() { |
| | | return opeTaskTypeMapper.getTaskTypes(); |
| | | } |
| | | } |
| | |
| | | private Long inspectorId; |
| | | |
| | | /** |
| | | * ç¶æï¼1-æªå®æï¼2-已宿 |
| | | */ |
| | | private Integer state; |
| | | |
| | | /** |
| | | * æ¥è¯¢å¼å§æ¶é´ |
| | | */ |
| | | private String timeStart; |
| | |
| | | @NoArgsConstructor |
| | | @AllArgsConstructor |
| | | @Builder |
| | | @Schema(name = "æ¥è¯¢å级任å¡RTUå级æ
åµçæ¡ä»¶") |
| | | @Schema(name = "æ¥è¯¢å级任å¡RTUåçº§ç»æçæ¡ä»¶") |
| | | public class QueryUgResultVo extends QueryConditionVo { |
| | | |
| | | @Schema(description = "å级任å¡id") |
| | |
| | | @Schema(description = "æ§å¶å¨å°å") |
| | | public String rtuAddr; |
| | | |
| | | @Schema(description = "åçº§ç»æï¼1å级æåï¼0å级失败") |
| | | public Integer state; |
| | | |
| | | @Schema(description = "失败类åï¼3ä¸å
æ»å¤±è´¥ï¼4å¤å
æ»å¤±è´¥ï¼5离线失败") |
| | | public Integer fail; |
| | | |
| | | } |
| | |
| | | package com.dy.pipIrrBase.rtuUpgrade.task; |
| | | |
| | | import com.alibaba.excel.EasyExcel; |
| | | import com.alibaba.excel.support.ExcelTypeEnum; |
| | | import com.dy.common.aop.SsoAop; |
| | | import com.dy.common.webUtil.BaseResponse; |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | |
| | | import com.dy.common.webUtil.ResultCodeMsg; |
| | | import com.dy.pipIrrGlobal.pojoUg.UgRtuTask; |
| | | import com.dy.pipIrrGlobal.voUg.VoUgResult; |
| | | import com.dy.pipIrrGlobal.voUg.VoUgRtuResult; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.media.Content; |
| | | import io.swagger.v3.oas.annotations.media.Schema; |
| | | import io.swagger.v3.oas.annotations.responses.ApiResponse; |
| | | import io.swagger.v3.oas.annotations.responses.ApiResponses; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.net.URLEncoder; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | if (vo.taskId == null) { |
| | | return BaseResponseUtils.buildErrorMsg("å级任å¡idä¸è½ä¸ºç©º"); |
| | | } |
| | | try { |
| | | QueryResultVo<List<VoUgResult>> res = this.sv.selectSome(vo); |
| | | return BaseResponseUtils.buildSuccess(res); |
| | | } catch (Exception e) { |
| | | log.error("æ¥è¯¢RTUå级任å¡å¼å¸¸", e); |
| | | return BaseResponseUtils.buildErrorMsg(e.getMessage()); |
| | | if(vo.state != null && vo.state == 1){ |
| | | //æ¥è¯¢å级æåç |
| | | vo.fail = null ; |
| | | } |
| | | if(vo.state == null && vo.fail != null){ |
| | | //æ¥è¯¢å级失败ç |
| | | vo.state = 0 ; |
| | | } |
| | | QueryResultVo<List<VoUgResult>> res = this.sv.selectSome(vo); |
| | | return BaseResponseUtils.buildSuccess(res); |
| | | } |
| | | |
| | | /** |
| | | * 导åºåçº§ç»æRTUå表 |
| | | * @param response |
| | | */ |
| | | @RequestMapping(value = "/exportAll", method = RequestMethod.GET) |
| | | @SsoAop() |
| | | public void exportAll(HttpServletResponse response, QueryUgResultVo vo) throws Exception { |
| | | if(vo.state != null && vo.state == 1){ |
| | | //æ¥è¯¢å级æåç |
| | | vo.fail = null ; |
| | | } |
| | | if(vo.state == null && vo.fail != null){ |
| | | //æ¥è¯¢å级失败ç |
| | | vo.state = 0 ; |
| | | } |
| | | setExcelRespProp(response, "åçº§ç»æå表"); |
| | | List<VoUgResult> rsList = this.sv.selectAll(vo); |
| | | EasyExcel.write(response.getOutputStream()) |
| | | .head(VoUgRtuResult.class) |
| | | .excelType(ExcelTypeEnum.XLSX) |
| | | .sheet("åçº§ç»æå表") |
| | | .doWrite(rsList); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 设置excelä¸è½½ååºå¤´å±æ§ |
| | | */ |
| | | private void setExcelRespProp(HttpServletResponse response, String rawFileName) throws UnsupportedEncodingException { |
| | | response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); |
| | | response.setCharacterEncoding("utf-8"); |
| | | String fileName = URLEncoder.encode(rawFileName, "UTF-8").replaceAll("\\+", "%20"); |
| | | response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx"); |
| | | } |
| | | } |
| | |
| | | private UgRtuControllerMapper dao ; |
| | | |
| | | /** |
| | | * å页æ¥è¯¢ä¸ä¸ªå级任å¡ä¸æææ§å¶å¨åçº§ç»æ¥ |
| | | * å页æ¥è¯¢ä¸ä¸ªå级任å¡ä¸ä¸äºæ§å¶å¨åçº§ç»æ¥ |
| | | * @return æ§å¶å¨åçº§ç»æ¥ |
| | | */ |
| | | public QueryResultVo<List<VoUgResult>> selectSome(QueryUgResultVo queryVo){ |
| | |
| | | |
| | | return rsVo ; |
| | | } |
| | | |
| | | /** |
| | | * å页æ¥è¯¢ä¸ä¸ªå级任å¡ä¸æææ§å¶å¨åçº§ç»æ¥ |
| | | * @return æ§å¶å¨åçº§ç»æ¥ |
| | | */ |
| | | public List<VoUgResult> selectAll(QueryUgResultVo queryVo){ |
| | | Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryVo) ; |
| | | List<VoUgResult> list = this.dao.selectControllerUpgradeResults(params) ; |
| | | if(list != null && list.size() > 0){ |
| | | for(VoUgResult vo : list){ |
| | | if(vo.isOver != null && vo.isOver.byteValue() == 1){ |
| | | vo.isOverStr = "æ¯" ; |
| | | }else{ |
| | | vo.isOverStr = "å¦" ; |
| | | } |
| | | if(vo.ugState != null){ |
| | | vo.ugStateStr = UpgradeRtu.getStateName(vo.ugState) ; |
| | | } |
| | | } |
| | | } |
| | | return list ; |
| | | } |
| | | } |
| | |
| | | import com.dy.common.webUtil.QueryResultVo; |
| | | import com.dy.pipIrrGlobal.daoPr.PrIntakeMapper; |
| | | import com.dy.pipIrrGlobal.rtuMw.CodeLocal; |
| | | import com.dy.pipIrrGlobal.rtuMw.ToRtuMwCom; |
| | | import com.dy.pipIrrGlobal.rtuMw.Web2RtuMw; |
| | | import com.dy.pipIrrGlobal.voPr.VoOnLineIntake; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.dubbo.common.utils.PojoUtils; |
| | |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | public class MonitorSv extends ToRtuMwCom { |
| | | public class MonitorSv extends Web2RtuMw { |
| | | |
| | | @Autowired |
| | | private PrIntakeMapper prIntakeMapper; |
| | |
| | | //åéä¿¡ä¸é´ä»¶åå
³å½ä»¤ï¼æ¥è¯¢é¨åRTUå¨çº¿æ
åµ |
| | | Command com = this.createInnerCommand(CodeLocal.onLinePart); |
| | | com.setParam(rtuAddrs) ; |
| | | String comSendUrl = this.getToMwUrl(this.env) ; |
| | | BaseResponse res = sendCom2Mw(restTemplate, comSendUrl, com) ; |
| | | String rqUrl = this.get2MwRequestUrl(this.env, ContextComSend) ; |
| | | BaseResponse res = sendRequest2Mw(restTemplate, rqUrl, com) ; |
| | | if(res != null){ |
| | | if(res.isSuccess()){ |
| | | Command reCom = JSON.parseObject(res.getContent() == null ? null : JSON.toJSONString(res.getContent()), Command.class) ; |
| | |
| | | private QueryResultVo<List<VoOnLineIntake>> selectIntakesOnOrOffLine(QueryVo vo) { |
| | | //åéä¿¡ä¸é´ä»¶åå
³å½ä»¤ï¼æ¥è¯¢é¨åRTUå¨çº¿æ
åµ |
| | | Command com = this.createInnerCommand(CodeLocal.onLineAll); |
| | | String comSendUrl = this.getToMwUrl(this.env) ; |
| | | BaseResponse res = sendCom2Mw(restTemplate, comSendUrl, com) ; |
| | | String rqUrl = this.get2MwRequestUrl(this.env, ContextComSend) ; |
| | | BaseResponse res = sendRequest2Mw(restTemplate, rqUrl, com) ; |
| | | if(res != null){ |
| | | if(res.isSuccess()){ |
| | | Command reCom = JSON.parseObject(res.getContent() == null ? null : JSON.toJSONString(res.getContent()), Command.class) ; |
| | |
| | | package com.dy.pipIrrRemote.rtu; |
| | | |
| | | import com.dy.common.aop.SsoAop; |
| | | import com.dy.common.multiDataSource.DataSourceContext; |
| | | import com.dy.common.webUtil.BaseResponse; |
| | | import com.dy.common.webUtil.BaseResponseUtils; |
| | | import com.dy.pipIrrGlobal.rtuMw.Web2RtuMw; |
| | | import jakarta.servlet.ServletOutputStream; |
| | | import jakarta.servlet.http.HttpServletRequest; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | |
| | | @Slf4j |
| | | @RestController |
| | | @RequestMapping(path="rtuLog") |
| | | public class RtuLogCtrl { |
| | | |
| | | private static final String pro_mw = "mw"; |
| | | private static final String key_mw_file = "rtuLogFileUrl"; |
| | | private static final String key_mw_text = "rtuLogTextUrl"; |
| | | public class RtuLogCtrl extends Web2RtuMw { |
| | | |
| | | private Environment env ; |
| | | private RestTemplate restTemplate; |
| | |
| | | @GetMapping(path = "file") |
| | | @SsoAop() |
| | | public BaseResponse<List<String>> rtuLogFile(String rtuAddr, HttpServletRequest req, HttpServletResponse rep){ |
| | | String mwUrlRtuLogFile = env.getProperty(pro_mw + "." + DataSourceContext.get() + "." + key_mw_file); |
| | | String rqUrl = this.get2MwRequestUrl(this.env, ContextRtuLogFile) ; |
| | | ServletOutputStream out = null ; |
| | | try{ |
| | | byte[] bs = this.requestMw4File(rtuAddr, mwUrlRtuLogFile) ; |
| | | byte[] bs = this.requestMw4File(rtuAddr, rqUrl) ; |
| | | if(bs != null && bs.length > 0){ |
| | | String fileReName = rtuAddr + ".log" ; |
| | | //URLEncoder.encodeå¯ä»¥é²æ¢ä¸æä¹±ç |
| | |
| | | @GetMapping(path="text") |
| | | @SsoAop() |
| | | public BaseResponse<List<String>> rtuLogText(String rtuAddr){ |
| | | String mwUrlRtuLogText = env.getProperty(pro_mw + "." + DataSourceContext.get() + "." + key_mw_text); |
| | | BaseResponse<List<String>> text = this.requestMw4Text(rtuAddr, mwUrlRtuLogText); |
| | | String rqUrl = this.get2MwRequestUrl(this.env, ContextRtuLogText) ; |
| | | //String mwUrlRtuLogText = env.getProperty(pro_mw + "." + DataSourceContext.get() + "." + key_mw_text); |
| | | BaseResponse<List<String>> text = this.requestMw4Text(rtuAddr, rqUrl); |
| | | if (text != null){ |
| | | if (text.getContent().get(0).contains("æ§å¶å¨")){ |
| | | return BaseResponseUtils.buildErrorMsg(""+text.getContent().get(0)+"") ; |
| | |
| | | }else { |
| | | return BaseResponseUtils.buildErrorMsg("è·åæ¥å¿æä»¶ä¸ºnull") ; |
| | | } |
| | | // return this.requestMw4Text(rtuAddr, mwUrlRtuLogText) ; |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | return (response==null?null:response.getBody()); |
| | | } |
| | | |
| | | } |
| | |
| | | import com.alibaba.excel.EasyExcel; |
| | | import com.alibaba.excel.support.ExcelTypeEnum; |
| | | import com.dy.common.aop.SsoAop; |
| | | import com.dy.common.softUpgrade.state.UpgradeRtu; |
| | | import com.dy.common.softUpgrade.state.UpgradeTaskVo; |
| | | import com.dy.common.springUtil.SpringContextUtil; |
| | | import com.dy.common.webUtil.BaseResponse; |
| | |
| | | import com.dy.common.webUtil.ResultCodeMsg; |
| | | import com.dy.pipIrrGlobal.pojoUg.UgRtuProgram; |
| | | import com.dy.pipIrrGlobal.pojoUg.UgRtuTask; |
| | | import com.dy.pipIrrGlobal.rtuMw.ToRtuMwCom; |
| | | import com.dy.pipIrrGlobal.voPr.VoDivide; |
| | | import com.dy.pipIrrGlobal.rtuMw.Web2RtuMw; |
| | | import com.dy.pipIrrGlobal.voUg.VoUgRtuResult; |
| | | import com.dy.pipIrrGlobal.voUg.VoWatch; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | |
| | | |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.net.URLEncoder; |
| | | import java.util.ArrayList; |
| | | import java.util.Base64; |
| | | import java.util.List; |
| | | |
| | |
| | | @Tag(name = "rtuè¿ç¨å级任å¡", description = "rtuè¿ç¨å级任å¡ç¸å
³æä½") |
| | | @RestController |
| | | @RequestMapping(path = "rtuUpgrade") |
| | | public class RtuUpgradeCtrl extends ToRtuMwCom { |
| | | public class RtuUpgradeCtrl extends Web2RtuMw { |
| | | @Autowired |
| | | private RtuUpgradeSv sv ; |
| | | |
| | |
| | | vo.rtuAddrList = taskRtuAddrs ; |
| | | vo.callbackWebUrl = ugCallbackUrl_rm ; |
| | | |
| | | String ugSendUrl = this.getToMwUgUrl(this.env) ; |
| | | BaseResponse res = sendUpgradeTask2Mw(restTemplate, ugSendUrl, vo) ; |
| | | String rqUrl = this.get2MwRequestUrl(this.env, ContextUgTaskSend) ; |
| | | BaseResponse res = sendRequest2Mw(restTemplate, rqUrl, vo) ; |
| | | if(res != null){ |
| | | if(res.isSuccess()){ |
| | | this.sv.setUpgradeTaskExecuted(id); |
| | |
| | | return BaseResponseUtils.buildErrorMsg("éä¿¡ä¸é´ä»¶è¿åç»æä¸ºnull") ; |
| | | } |
| | | } |
| | | /** |
| | | * ä¸å强å¶ç»æå½å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 = String.class))} |
| | | ) |
| | | }) |
| | | @GetMapping(path = "/forceOver") |
| | | @SsoAop() |
| | | public BaseResponse<String> forceOver() { |
| | | String rqUrl = this.get2MwRequestUrl(this.env, ContextUgForceOver) ; |
| | | BaseResponse res = sendRequest2Mw(restTemplate, rqUrl, null) ; |
| | | if(res != null){ |
| | | if(res.isSuccess()){ |
| | | return BaseResponseUtils.buildSuccess(true) ; |
| | | }else{ |
| | | String msg = res.getContent()==null?null:(String)res.getContent() ; |
| | | if(msg == null){ |
| | | msg = res.getMsg() ; |
| | | } |
| | | log.error("éä¿¡ä¸é´ä»¶æ§è¡ä¸å强å¶ç»æå½årtuè¿ç¨å级任å¡å¤±è´¥ï¼" + msg) ; |
| | | return BaseResponseUtils.buildErrorMsg("éä¿¡ä¸é´ä»¶æ§è¡å¼ºå¶ç»æå½årtuè¿ç¨å级任å¡å¤±è´¥ï¼" + msg) ; |
| | | } |
| | | }else{ |
| | | log.error("éä¿¡ä¸é´ä»¶è¿åç»æä¸ºnull") ; |
| | | return BaseResponseUtils.buildErrorMsg("éä¿¡ä¸é´ä»¶è¿åç»æä¸ºnull") ; |
| | | } |
| | | } |
| | | |
| | | |
| | | private void valueFromPo(UpgradeTaskVo vo, UgRtuTask tpo, UgRtuProgram ppo){ |
| | | vo.id = "" + tpo.id ; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Comparator; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | @Hidden //ä¸å
¬å¼æ¥å£ï¼å
¶åªæéä¿¡ä¸é´ä»¶è°ç¨ |
| | | @PostMapping(path = "/receive") |
| | | 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) { |
| | |
| | | } |
| | | } |
| | | } |
| | | */ |
| | | |
| | | //è¿è¡æåº |
| | | 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(cache == null){ |
| | | cache = info; |
| | | //æ¤æ¶ä¸å任塿ä½ï¼åªä¿écacheä¸ä¸ºç©ºï¼ çå¾
䏿¬¡åæ¥æ°æ® |
| | |
| | | } |
| | | } |
| | | }else{ |
| | | cache = info; |
| | | //å½cache䏿弿¶ï¼è¿è¡æ¯å¯¹åå¨ï¼å¯¹æ¯ç®çæ¯é²æ¢é夿使°æ®åº |
| | | if(info.ugRtuStateList != null && info.ugRtuStateList.size() > 0){ |
| | | //æ¤æ¶ä¿è¯ä¸¤ä¸ªéåé½ä¸ä¸ºnull |
| | | this.save2Db(info.ugTaskId, info.ugRtuStateList, cache.ugRtuStateList); |
| | | } |
| | | //cacheèµå¼å¿
é¡»æ¾å¨ä¸é¢å¤ççåé¢ï¼å¦åä¸é¢çæ¯è¾ä¸æå |
| | | cache = info; |
| | | if(info.ugOverallState != null && info.ugOverallState.allOver){ |
| | | this.saveTaskOver(info.ugTaskId) ; |
| | | } |
| | | } |
| | | return null; |
| | |
| | | */ |
| | | private void save2Db(String taskId, List<UpgradeRtu> newList, List<UpgradeRtu> oldList){ |
| | | List<UpgradeRtu> newOverList = newList.stream().filter(vo -> vo.isOver).collect(Collectors.toList()) ; |
| | | List<UpgradeRtu> oldNoOverList = newList.stream().filter(vo -> !vo.isOver).collect(Collectors.toList()) ; |
| | | boolean oldExist = false ; |
| | | for(UpgradeRtu nvo : newOverList){ |
| | | if(nvo != null) { |
| | | if(oldList.stream().anyMatch(vo -> vo.rtuAddr.equals(nvo.rtuAddr) && vo.isOver == false)){ |
| | | //䏿¬¡æ²¡æåçº§ç»æï¼èå½ååçº§ç»æäº |
| | | this.sv.saveRtuUpgradeState(Long.parseLong(taskId), nvo); |
| | | } |
| | | oldExist = false ; |
| | | if(oldNoOverList.stream().anyMatch(vo -> vo.rtuAddr.equals(nvo.rtuAddr))){ |
| | | oldExist = true ; |
| | | } |
| | | if(!oldExist){ |
| | | //䏿¬¡æ²¡æåçº§ç»æï¼èå½ååçº§ç»æäº |
| | | this.sv.saveRtuUpgradeState(Long.parseLong(taskId), nvo); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * ä¿åå级任å¡å·²ç»æ§è¡å®æ |
| | | * @param taskId |
| | | */ |
| | | private void saveTaskOver(String taskId){ |
| | | this.sv.updateTaskOver(taskId) ; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | ///////////////////////////////////////////////////// |
| | | // |
| | | // 以䏿¨¡ææ°æ® |
| | |
| | | }else if(rtu.state == UpgradeRtu.STATE_SUCCESS) { |
| | | cache.ugOverallState.successTotal++; |
| | | }else if(rtu.state == UpgradeRtu.STATE_FAILONE) { |
| | | cache.ugOverallState.failOneTotal++; |
| | | cache.ugOverallState.dieOneTotal++; |
| | | cache.ugOverallState.failTotal++; |
| | | }else if(rtu.state == UpgradeRtu.STATE_FAIL) { |
| | | cache.ugOverallState.failMultiTotal++; |
| | | cache.ugOverallState.dieMultiTotal++; |
| | | cache.ugOverallState.failTotal++; |
| | | } |
| | | if(rtu.isOver){ |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 设置å级任å¡å·²ç»å®æ |
| | | * @param taskId |
| | | */ |
| | | public void updateTaskOver(String taskId){ |
| | | tdao.overById(Long.valueOf(taskId)) ; |
| | | } |
| | | |
| | | ///////////////////////////////////////////////////// |
| | | // |
| | | // 以䏿¼ç¤ºå级åè½ç¨å° |