From 8172572f01c0baa527085243e010afa4bec5efcc Mon Sep 17 00:00:00 2001
From: czt <czt18638530771@163.com>
Date: 星期五, 31 十月 2025 17:33:38 +0800
Subject: [PATCH] 陕西2025版接口调整3-新增接口页面
---
src/main/java/com/fzzy/api/view/pr/Api1109PR.java | 185 ++++++++++-----------------------------------
1 files changed, 43 insertions(+), 142 deletions(-)
diff --git a/src/main/java/com/fzzy/api/view/pr/Api1109PR.java b/src/main/java/com/fzzy/api/view/pr/Api1109PR.java
index c8d1101..20ab7b8 100644
--- a/src/main/java/com/fzzy/api/view/pr/Api1109PR.java
+++ b/src/main/java/com/fzzy/api/view/pr/Api1109PR.java
@@ -23,12 +23,10 @@
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Component;
-import sun.misc.BASE64Encoder;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
-import java.io.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@@ -85,12 +83,12 @@
predicates.add(predicate2);
}
if (null != param.getStart()) {
- Predicate predicate3 = cb.greaterThan(root.<Date>get("qdrq"), ContextUtil.getCurZero(param.getStart()));
+ Predicate predicate3 = cb.greaterThan(root.<Date>get("zhgxsj"), ContextUtil.getCurZero(param.getStart()));
predicates.add(predicate3);
}
if (null != param.getEnd()) {
- Predicate predicate4 = cb.lessThan(root.<Date>get("qdrq"), ContextUtil.getNextZero(param.getEnd()));
+ Predicate predicate4 = cb.lessThan(root.<Date>get("zhgxsj"), ContextUtil.getNextZero(param.getEnd()));
predicates.add(predicate4);
}
return cb.and(predicates.toArray(new Predicate[0]));
@@ -135,7 +133,7 @@
}
/**
- *
+ *
* 鏇存柊鍒犻櫎鏍囪 api1109PR#delUpdate
*
* @param entity
@@ -159,22 +157,35 @@
*/
@Expose
public String pushData(List<Api1109> items) {
- ResponseDto responseDto;
- String result = "";
- Api1109 d;
+
//鑾峰彇閰嶇疆
String kqdm = items.get(0).getKqdm();
ApiConfs apiConf = apiCommonService.getConf(kqdm);
if (null == apiConf) return "绯荤粺娌℃湁鑾峰彇鍒板綋鍓嶅簱鍖洪厤缃俊鎭紝鎵ц澶辫触";
- //灏佽鍙傛暟
- ApiParam param = new ApiParam(apiConf, Constant.API_CATEGORY_11, Constant.API_CODE_1109);
-
//鑾峰彇瀹炵幇鎺ュ彛
- ApiRemoteService apiRemoteService = apiPushManager.getApiRemoteService(param.getPushProtocol());
+ ApiRemoteService apiRemoteService = apiPushManager.getApiRemoteService(apiConf.getPushProtocol());
if (null == apiRemoteService) return "绯荤粺娌℃湁褰撳墠鎺ㄩ�佸崗璁厤缃紝鎵ц澶辫触";
+ return pushDataSingle(items,apiRemoteService,apiConf);
+ }
+
+ /**
+ * 鍗曟潯鏁版嵁json鎺ㄩ��
+ *
+ * @param items
+ * @param apiRemoteService
+ * @param apiConf
+ * @return
+ */
+ private String pushDataSingle(List<Api1109> items, ApiRemoteService apiRemoteService, ApiConfs apiConf) {
+ ResponseDto responseDto;
+ String result = "";
+
+ //灏佽鍙傛暟
+ ApiParam param = new ApiParam(apiConf, Constant.API_CATEGORY_11, Constant.API_CODE_1109);
+ Api1109 d;
for (Api1109 data : items) {
d = new Api1109();
BeanUtils.copyProperties(data, d);
@@ -191,141 +202,31 @@
return result;
}
-
/**
- * imgFile 鍥剧墖鏈湴瀛樺偍璺緞
+ * 澶氭潯鏁版嵁json鎺ㄩ��
+ *
+ * @param items
+ * @param apiRemoteService
+ * @param apiConf
+ * @return
*/
- public static String getImgFileToBase64(String imgFile) {
- //灏嗗浘鐗囨枃浠惰浆鍖栦负瀛楄妭鏁扮粍瀛楃涓诧紝骞跺鍏惰繘琛孊ase64缂栫爜澶勭悊
- InputStream inputStream = null;
- byte[] buffer = null;
- //璇诲彇鍥剧墖瀛楄妭鏁扮粍
- try {
- inputStream = new FileInputStream(imgFile);
- int count = 0;
- while (count == 0) {
- count = inputStream.available();
- }
- buffer = new byte[count];
- inputStream.read(buffer);
- } catch (IOException e) {
- log.error(e.getMessage(),e);
- } finally {
- if (inputStream != null) {
- try {
- // 鍏抽棴inputStream娴�
- inputStream.close();
- } catch (IOException e) {
- e.printStackTrace();
+ private String pushDataList(List<Api1109> items, ApiRemoteService apiRemoteService, ApiConfs apiConf) {
+
+ //灏佽鍙傛暟
+ ApiParam param = new ApiParam(apiConf, Constant.API_CATEGORY_11, Constant.API_CODE_1109);
+
+ //鎺ㄩ�侊紝鏁版嵁涓洪泦鍚堝舰寮�
+ ResponseDto responseDto = apiRemoteService.pushData(param, apiConf, items);
+ if (responseDto.getSuccess() == 0) {
+ //鎺ㄩ�佹垚鍔燂紝鏇存柊鏁版嵁涓婁紶鐘舵��
+ for (Api1109 data : items) {
+ if (Constant.CZBZ_I.equals(data.getCzbz())) {
+ //鏇存柊鐘舵��
+ api1109Rep.updateStatus(data.getId(), Constant.CZBZ_U);
}
}
}
- // 瀵瑰瓧鑺傛暟缁凚ase64缂栫爜
- //return Base64Utils.encodeToString(buffer);
- return new BASE64Encoder().encode(buffer);
+ return responseDto.toString();
}
- /**
- * 鑾峰彇鍥剧墖鐨勪簩杩涘埗娴�
- * @param imgPath
- * @return
- */
- @SuppressWarnings("resource")
- public String imgToIo(String imgPath){
- //鍥剧墖杞寲涓轰簩杩涘埗
- byte[] imageBytes = null;
- try {
- FileInputStream fileInputStream = new FileInputStream(new File(imgPath));
- imageBytes = new byte[fileInputStream.available()];
- fileInputStream.read(imageBytes);
- } catch (IOException e) {
- System.out.println(e);
- return null;
- }
- return UnicodeByteToStr(imageBytes);
- }
-
- private static String UnicodeByteToStr(byte[] b){
- StringBuilder sb = new StringBuilder();
- for(int i=0;i<b.length;i++) {
- sb.append(String.format("%02x", b[i]));
- }
- return sb.toString();
- }
-
- /**
- * 鏍规嵁鏂囦欢璺緞灏嗘枃浠惰浆涓轰簩杩涘埗鏁扮粍
- * @param filePath:鏂囦欢璺緞
- * @return
- */
- public static byte[] file2byte(String filePath) {
- byte[] buffer = null;
- try {
- File file = new File(filePath);
- FileInputStream fis = new FileInputStream(file);
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- byte[] b = new byte[1024];
- int n;
- while ((n = fis.read(b)) != -1) {
- bos.write(b, 0, n);
- }
- fis.close();
- bos.close();
- buffer = bos.toByteArray();
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }
- return buffer;
- }
-
- /**
- * 灏嗕簩杩涘埗鏁扮粍杞负瀛楃涓�
- * @param b
- * @return
- */
- public static String toHexString(byte[] b) {
- StringBuilder sb = new StringBuilder();
- String stmp="";
- for (int n=0;n<b.length;n++) {
- stmp=(Integer.toHexString(b[n] & 0XFF));
- if (stmp.length()==1) sb.append("0"+stmp);
- else sb.append(stmp);
- }
- return sb.toString().toUpperCase();
- }
-
-
- public static void main(String[] args) {
- String hex = toHexString(file2byte("E://91511424746940066Y001.jpg"));
- System.out.println(hex);
- saveToImgFile(hex,"E://dd.jpg");
- }
-
-
- public static void saveToImgFile(String src,String output){
- if(src==null||src.length()==0){
- return;
- }
- try{
- FileOutputStream out = new FileOutputStream(new File(output));
- byte[] bytes = src.getBytes();
- for(int i=0;i<bytes.length;i+=2){
- out.write(charToInt(bytes[i])*16+charToInt(bytes[i+1]));
- }
- out.close();
- }catch(Exception e){
- e.printStackTrace();
- }
- }
- private static int charToInt(byte ch){
- int val = 0;
- if(ch>=0x30&&ch<=0x39){
- val=ch-0x30;
- }else if(ch>=0x41&&ch<=0x46){
- val=ch-0x41+10;
- }
- return val;
- }
}
--
Gitblit v1.9.3