src/main/java/com/fzzy/otherview/sh2023/ShApi1311.view.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/fzzy/otherview/sh2023/dto/ShApi2104.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/fzzy/otherview/sh2023/dto/ShApi2203.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/fzzy/otherview/sh2023/dto/ShApi2204.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/fzzy/otherview/sh2023/pr/SHApi1311PR.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/fzzy/push/sh2023/SH2023ApiRemoteService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/fzzy/push/sh2023/SH2023HttpClientUtil.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/fzzy/push/sh2023/dto/SH2023PullReqDto.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/fzzy/push/sh2023/dto/SH2023PullRespDto.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/fzzy/push/sh2023/dto/SH2023ShareApi1311.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/main/java/com/fzzy/otherview/sh2023/ShApi1311.view.xml
@@ -432,6 +432,18 @@ <Property name="exClassName">toolbar-button-push</Property> <Property name="width">100</Property> </ToolBarButton> <ToolBarButton> <ClientEvent name="onClick">var select = view.get("#dgMain").get("selection");
 view.get("#ajaxPull").set("parameter",select).execute(function(result){
 view.get("#dsMain").flushAsync();
 $notify(result);
 });
 </ClientEvent> <Property name="caption">å ±äº«æå</Property> <Property name="iconClass">fa fa-hand-o-up</Property> <Property name="exClassName">toolbar-button-push</Property> <Property name="width">100</Property> </ToolBarButton> <Fill/> <ToolBarButton> <Property name="caption">ä¸ä¼ è®°å½</Property> @@ -560,16 +572,6 @@ <Editor/> </AutoFormElement> <AutoFormElement> <Property name="name">tdmc</Property> <Property name="property">tdmc</Property> <Editor/> </AutoFormElement> <AutoFormElement> <Property name="name">jksbbm</Property> <Property name="property">jksbbm</Property> <Editor/> </AutoFormElement> <AutoFormElement> <Property name="name">jksbmc</Property> <Property name="property">jksbmc</Property> <Editor/> @@ -587,11 +589,6 @@ <AutoFormElement> <Property name="name">jkxh</Property> <Property name="property">jkxh</Property> <Editor/> </AutoFormElement> <AutoFormElement> <Property name="name">jkxlh</Property> <Property name="property">jkxlh</Property> <Editor/> </AutoFormElement> <AutoFormElement> @@ -699,6 +696,10 @@ <Property name="service">sHApi1311PR#pushData</Property> <Property name="confirmMessage">ç¡®å®è¦ä¸æ¥ä¹ï¼</Property> </AjaxAction> <AjaxAction id="ajaxPull"> <Property name="service">sHApi1311PR#pullData</Property> <Property name="confirmMessage">ç¡®å®è¦æåæ°æ®åï¼</Property> </AjaxAction> <AjaxAction id="ajaxDel"> <Property name="service">sHApi1311PR#delData</Property> <Property name="confirmMessage">å½åæ°æ®å é¤åæ æ³æ¢å¤ï¼è¯·ç¡®è®¤è¦å é¤ä¹ï¼</Property> src/main/java/com/fzzy/otherview/sh2023/dto/ShApi2104.java
ÎļþÒÑɾ³ý src/main/java/com/fzzy/otherview/sh2023/dto/ShApi2203.java
ÎļþÒÑɾ³ý src/main/java/com/fzzy/otherview/sh2023/dto/ShApi2204.java
ÎļþÒÑɾ³ý src/main/java/com/fzzy/otherview/sh2023/pr/SHApi1311PR.java
@@ -19,8 +19,10 @@ import com.fzzy.push.sh2023.SH2023Constant; import com.fzzy.push.sh2023.dto.SH2023Api1311; import com.fzzy.push.sh2023.dto.SH2023Api2101; import com.fzzy.push.sh2023.dto.SH2023ShareApi1311; import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.time.DateFormatUtils; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Pageable; @@ -172,7 +174,7 @@ } //å°è£ åæ° ApiParam param = new ApiParam(apiConf, "21", SH2023Constant.SH_2023_API_CODE_1311); ApiParam param = new ApiParam(apiConf, "13", SH2023Constant.SH_2023_API_CODE_1311); //è·åå®ç°æ¥å£ ApiRemoteService apiService = apiPushManager.getApiRemoteService(param.getPushProtocol()); @@ -201,4 +203,74 @@ return result; } /** * å ±äº«æåæ°æ® * sHApi1311PR#pullData * * @return */ @Expose public String pullData() { //è·åé ç½®ä¿¡æ¯ List<ApiConfs> apiConfs = apiCommonService.listCacheConf(); if (null == apiConfs || apiConfs.isEmpty()) { return "ç³»ç»æ²¡æè·åå°åºåºé 置信æ¯ï¼æ§è¡å¤±è´¥"; } ApiRemoteService apiService; ApiParam param; ResponseDto responseDto; ApiInfoData infoData; String result = ""; List<SH2023ShareApi1311> list; SH2023Api1311 sh2023Api1311; List<ApiInfoData> apiInfoDataList; for (ApiConfs apiConf : apiConfs) { apiService = apiPushManager.getApiRemoteService(apiConf.getPushProtocol()); if (null == apiService) { continue; } //å°è£ åæ° param = new ApiParam(apiConf, "13", SH2023Constant.SH_2023_API_CODE_1311); responseDto = apiService.pullData(param, apiConf); if (responseDto.getSuccess() == 0) { list = JSONObject.parseArray(responseDto.getData(), SH2023ShareApi1311.class); if(null != list && list.size() > 0){ for (SH2023ShareApi1311 shareData : list) { apiInfoDataList = apiInfoDataRep.getDataByDataId(shareData.getSxtbh()); if(null == apiInfoDataList || apiInfoDataList.isEmpty()){ sh2023Api1311 = new SH2023Api1311(); sh2023Api1311.setSpjksbid(shareData.getSxtbh()); sh2023Api1311.setCzbz(Constant.CZBZ_I); }else { sh2023Api1311 = JSONObject.parseObject(apiInfoDataList.get(0).getData(), SH2023Api1311.class); sh2023Api1311.setCzbz(apiInfoDataList.get(0).getCzbz()); } if(StringUtils.isNotEmpty(shareData.getHwdm())){ sh2023Api1311.setHwdm(shareData.getHwdm()); } sh2023Api1311.setJksbmc(shareData.getTdmc()); infoData = new ApiInfoData(); infoData.setId(sh2023Api1311.getSpjksbid()); infoData.setKqdm(apiConf.getKqdm()); infoData.setInteType("13"); infoData.setInteId(SH2023Constant.SH_2023_API_CODE_1311); infoData.setUpdateTime(new Date()); infoData.setDataId(sh2023Api1311.getSpjksbid()); infoData.setData(JSON.toJSONString(sh2023Api1311)); infoData.setCzbz(sh2023Api1311.getCzbz()); apiInfoDataRep.save(infoData); } } } result += responseDto.toString(); return result; } return null; } } src/main/java/com/fzzy/push/sh2023/SH2023ApiRemoteService.java
@@ -162,6 +162,64 @@ } } @Override public ResponseDto pullData(ApiParam param, ApiConfs conf) { String inteId = param.getInteId(); String kqdm = param.getKqdm(); try { if (null == conf) { conf = apiCommonService.getConf(kqdm); } //æ·»å æ¥å¿ ApiLog apiLog = new ApiLog(); apiLog.setId(ContextUtil.getUUID()); apiLog.setInteId(inteId); if (StringUtils.isEmpty(inteId)) { ResponseDto responseDto = new ResponseDto(99, "没æè·åå°æ¥å£"); apiLog.setStatus(99); apiLog.setResult("没æè·åå°æ¥å£"); apiLogRep.save(apiLog); return responseDto; } if (conf == null) { ResponseDto responseDto = new ResponseDto(99, "没æè·åå°ä¸ä¼ é ç½®"); apiLog.setStatus(99); apiLog.setResult("没æè·åå°ä¸ä¼ é ç½®"); apiLogRep.save(apiLog); return responseDto; } //æ¥è¯¢åºåºä¿¡æ¯è¡æ¿åºåç List<Api1102> api1102List = api1102Rep.findPushData(kqdm); //å°è£ æ°æ® SH2023PullReqDto reqData = new SH2023PullReqDto();; reqData.setName(conf.getUserName()); reqData.setPwd(conf.getAppCode()); log.info("æåå ±äº«æ°æ®è¯·æ±ä¿¡æ¯=" + JSON.toJSONString(reqData)); String url = conf.getApiUrl().replace("UPLOAD", "Shared"); SH2023PullRespDto responseDto = SH2023HttpClientUtil.postPullData(url + inteId, JSON.toJSONString(reqData)); apiLog.setStatus(responseDto.getRetcode() == 200 ? 0 : responseDto.getRetcode()); apiLog.setResult(responseDto.getRetMsg()); apiLogRep.save(apiLog); ResponseDto resd = new ResponseDto(); resd.setSuccess(responseDto.getRetcode() == 200 ? 0 : responseDto.getRetcode()); resd.setMsg(responseDto.getRetMsg()); resd.setData(responseDto.getData()); return resd; } catch (Exception e) { log.error(e.getMessage(), e); return new ResponseDto(99, e.getMessage()); } } /** * 转为JSON * @@ -1227,12 +1285,6 @@ } } return object; } @Override public ResponseDto pullData(ApiParam param, ApiConfs conf) { //该åè®®æ æ¤å®ç° return null; } } src/main/java/com/fzzy/push/sh2023/SH2023HttpClientUtil.java
@@ -2,7 +2,7 @@ import com.alibaba.fastjson.JSON; import com.fzzy.api.entity.ApiConfs; import com.fzzy.push.sh2023.dto.SH2023ReqDto; import com.fzzy.push.sh2023.dto.SH2023PullRespDto; import com.fzzy.push.sh2023.dto.SH2023RespDto; import lombok.extern.slf4j.Slf4j; import java.io.BufferedReader; @@ -87,4 +87,74 @@ connection = null; } } /** * æåæ°æ® * @param url * @param reqData * @return * @throws Exception */ @SuppressWarnings("resource") public static SH2023PullRespDto postPullData(String url, String reqData) throws Exception { log.info("---------æ¥å£è¯·æ±å°åï¼" +url+ "----------åæ°ï¼" + reqData +"---------"); BufferedReader in = null; URL urls = new URL(url); HttpURLConnection connection = null; OutputStream outputStream = null; String rs = ""; SH2023PullRespDto responseDto; try { connection = (HttpURLConnection) urls.openConnection(); connection.setRequestProperty("Content-Type", "application/json;charset=UTF-8"); connection.setDoOutput(true); connection.setDoInput(true); connection.setRequestProperty("Accept-Language", "zh-CN,zh;q=0.8"); connection.setRequestProperty("Accept", "*/*"); connection.setRequestProperty("Range", "bytes=" + ""); connection.setConnectTimeout(20000); connection.setReadTimeout(30000); connection.setRequestMethod("POST"); outputStream = connection.getOutputStream(); outputStream.write(reqData.getBytes("UTF-8")); try { connection.connect(); if (connection.getResponseCode() == 200) { in = new BufferedReader(new InputStreamReader(connection.getInputStream(), "UTF-8")); String line = ""; while ((line = in.readLine()) != null) { rs += line; } }else{ log.error("httpç¶æï¼" + connection.getResponseCode()); log.error("httpæ¶æ¯ï¼" + connection.getResponseMessage()); } } catch (Exception e) { System.out.println("åçå¼å¸¸"); log.error(e.getMessage(),e); rs = null; return new SH2023PullRespDto(99,e.getMessage(),null,null,null); } log.info("---------æ¥å£è¿åï¼" + rs +"---------"); responseDto = JSON.parseObject(rs,SH2023PullRespDto.class); if(responseDto == null ) return new SH2023PullRespDto(99,"æ¥å£è¯·æ±åçæªç¥é误",null,null,null); return responseDto; } finally { try { outputStream.close(); if (in != null){ in.close(); } } catch (Exception e) { } outputStream = null; if (connection != null) connection.disconnect(); connection = null; } } } src/main/java/com/fzzy/push/sh2023/dto/SH2023PullReqDto.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,25 @@ package com.fzzy.push.sh2023.dto; import lombok.Data; import java.io.Serializable; /** * 䏿µ·2023ççå¹³å°-å ±äº«æ°æ®å°è£ * @author czt * @date 2023/08/17 */ @Data public class SH2023PullReqDto implements Serializable { /** * */ private String name; /** * */ private String pwd; } src/main/java/com/fzzy/push/sh2023/dto/SH2023PullRespDto.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,37 @@ package com.fzzy.push.sh2023.dto; import lombok.Data; import java.io.Serializable; /** * 䏿¥åé¦ * @author czt * @date 2023/08/17 */ @Data public class SH2023PullRespDto<T> implements Serializable { /** * */ private static final long serialVersionUID = -6714158228489303453L; private int retcode ; private String retMsg; private String nextpointer; private String isTransmitComplete; private String data; public SH2023PullRespDto() { } public SH2023PullRespDto(int retcode, String retMsg, String nextpointer, String isTransmitComplete, String data) { this.retcode = retcode; this.retMsg = retMsg; this.nextpointer = nextpointer; this.isTransmitComplete = isTransmitComplete; this.data = data; } } src/main/java/com/fzzy/push/sh2023/dto/SH2023ShareApi1311.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,129 @@ package com.fzzy.push.sh2023.dto; import com.alibaba.fastjson.annotation.JSONField; import com.bstek.dorado.annotation.PropertyDef; import lombok.Data; import lombok.EqualsAndHashCode; import java.io.Serializable; import java.util.Date; /** * è§é¢çæ§ * * @Author:YAN */ @Data @EqualsAndHashCode(callSuper = false) public class SH2023ShareApi1311 implements Serializable { /** * */ private static final long serialVersionUID = 1L; @PropertyDef(label = "çæ§ç¼å·") private String sxtbh; @PropertyDef(label = "çæ§ç¼å·") private String tdmc; @PropertyDef(label = "çæ§ç¼å·") private String jkxlh; @PropertyDef(label = "çæ§ç¼å·") private String jksbbm; @PropertyDef(label = "è§é¢çæ§è®¾å¤id") private String spjksbid; @PropertyDef(label = "ééç¼å·") private Integer tdbh; @PropertyDef(label = "çæ§è®¾å¤åç§°") private String jksbmc; @PropertyDef(label = "åºåºä»£ç ") private String kqdm; /** * 1 海康, 2 大å, 3 å®è§ * 4 天å°ä¼ä¸,5 å为,9 å ¶ä» */ @PropertyDef(label = "çæ§åå") private String jkcs; @PropertyDef(label = "çæ§åå·") private String jkxh; /** * 1:ä»å ï¼2:ä¸å¡ï¼ * 3:å®é² */ @PropertyDef(label = "è§é¢çæ§ç±»å") private String spjklx; /** * 1:DVR 2:NVR */ @PropertyDef(label = "设å¤ç±»å") private String sblxbm; @PropertyDef(label = "å®è£ ä½ç½®") private String azwz; /** * ç²®åºå¤§é¨ï¼01ï¼ï¼æ¦æ ·æºï¼02ï¼ï¼åéªå®¤ï¼03ï¼ï¼ç»ç®å®¤ï¼04ï¼ï¼ * å°ç£ æ¿ï¼05ï¼ï¼åºåºä¸»å¹²éï¼06ï¼ï¼ä»é´çæ§ï¼07ï¼ï¼ä»å ï¼08ï¼ï¼ * è¯ååºï¼09ï¼ï¼å¨æåºï¼10ï¼ï¼å¶é«ç¹ï¼11ï¼ï¼å¨çï¼12ï¼ï¼å ¶ä»ï¼99ï¼ */ @PropertyDef(label = "å®è£ ä½ç½®ç±»å") private String azwzlx; @PropertyDef(label = "ç §å°åºå") private String zsqy; /** * Y/N */ @PropertyDef(label = "æ¯å¦å®è£ è¡¥å ç¯") private String sfazbgd; @PropertyDef(label = "å»é´ä»£ç ") private String ajdm; @PropertyDef(label = "è´§ä½ä»£ç ") private String hwdm; /** * 1 :æªæº 2 :çæº */ @PropertyDef(label = "çæ§ç±»åç¼ç ") private String jkjlxbm; @PropertyDef(label = "çæ§é¢ç½®ä½æ°é") private Integer jktyzw; @PropertyDef(label = "设å¤IPå°å") private String sbipdz; @PropertyDef(label = "设å¤ç«¯å£å·") private Integer sbdkh; @PropertyDef(label = "设å¤ç»å½åç§°") private String sbdlmc; @PropertyDef(label = "设å¤ç»å½å¯ç ") private String sbdlmm; @PropertyDef(label = "夿³¨") private String bz; @PropertyDef(label = "æ å¿ä½") private String bjw; @PropertyDef(label = "æä½æ å¿") private String czbz; @JSONField(format = "yyyy-MM-dd HH:mm:ss") @PropertyDef(label = "æåæ´æ°æ¶é´") private Date zhgxsj; }