diff --git a/model/常态化疫情下的大学生出入校管理系统“入校申请”用例的顺序图.vsdx b/model/常态化疫情下的大学生出入校管理系统“入校申请”用例的顺序图.vsdx new file mode 100644 index 0000000..284b362 Binary files /dev/null and b/model/常态化疫情下的大学生出入校管理系统“入校申请”用例的顺序图.vsdx differ diff --git a/model/常态化疫情下的大学生出入校管理系统“出校申请”用例的顺序图.vsdx b/model/常态化疫情下的大学生出入校管理系统“出校申请”用例的顺序图.vsdx new file mode 100644 index 0000000..a6c882c Binary files /dev/null and b/model/常态化疫情下的大学生出入校管理系统“出校申请”用例的顺序图.vsdx differ diff --git a/model/常态化疫情下的大学生出入校管理系统“扫码”用例的顺序图.vsdx b/model/常态化疫情下的大学生出入校管理系统“扫码”用例的顺序图.vsdx new file mode 100644 index 0000000..33cf2fa Binary files /dev/null and b/model/常态化疫情下的大学生出入校管理系统“扫码”用例的顺序图.vsdx differ diff --git a/model/常态化疫情下的大学生出入校管理系统“更新疫情信息”用例的顺序图.vsdx b/model/常态化疫情下的大学生出入校管理系统“更新疫情信息”用例的顺序图.vsdx new file mode 100644 index 0000000..166bad0 Binary files /dev/null and b/model/常态化疫情下的大学生出入校管理系统“更新疫情信息”用例的顺序图.vsdx differ diff --git a/src/OCR_baidu.jar b/src/OCR_baidu.jar deleted file mode 100644 index b997942..0000000 Binary files a/src/OCR_baidu.jar and /dev/null differ diff --git a/src/OCR_baidu/.idea/.gitignore b/src/OCR_baidu/.idea/.gitignore deleted file mode 100644 index 359bb53..0000000 --- a/src/OCR_baidu/.idea/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -# 默认忽略的文件 -/shelf/ -/workspace.xml diff --git a/src/OCR_baidu/.idea/artifacts/OCR_baidu_jar.xml b/src/OCR_baidu/.idea/artifacts/OCR_baidu_jar.xml deleted file mode 100644 index 89136c5..0000000 --- a/src/OCR_baidu/.idea/artifacts/OCR_baidu_jar.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - $PROJECT_DIR$/out/artifacts/OCR_baidu_jar - - - - - - - - - \ No newline at end of file diff --git a/src/OCR_baidu/.idea/compiler.xml b/src/OCR_baidu/.idea/compiler.xml deleted file mode 100644 index a1757ae..0000000 --- a/src/OCR_baidu/.idea/compiler.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/src/OCR_baidu/.idea/libraries/aip_java_sdk_4_16_11.xml b/src/OCR_baidu/.idea/libraries/aip_java_sdk_4_16_11.xml deleted file mode 100644 index 6052cd7..0000000 --- a/src/OCR_baidu/.idea/libraries/aip_java_sdk_4_16_11.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/src/OCR_baidu/.idea/libraries/json_20160810.xml b/src/OCR_baidu/.idea/libraries/json_20160810.xml deleted file mode 100644 index fc37fb4..0000000 --- a/src/OCR_baidu/.idea/libraries/json_20160810.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/src/OCR_baidu/.idea/libraries/slf4j_api_1_7_25.xml b/src/OCR_baidu/.idea/libraries/slf4j_api_1_7_25.xml deleted file mode 100644 index 72c9c27..0000000 --- a/src/OCR_baidu/.idea/libraries/slf4j_api_1_7_25.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/src/OCR_baidu/.idea/libraries/slf4j_simple_1_7_25.xml b/src/OCR_baidu/.idea/libraries/slf4j_simple_1_7_25.xml deleted file mode 100644 index b804740..0000000 --- a/src/OCR_baidu/.idea/libraries/slf4j_simple_1_7_25.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/src/OCR_baidu/.idea/misc.xml b/src/OCR_baidu/.idea/misc.xml deleted file mode 100644 index f76f386..0000000 --- a/src/OCR_baidu/.idea/misc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/src/OCR_baidu/.idea/modules.xml b/src/OCR_baidu/.idea/modules.xml deleted file mode 100644 index b39853e..0000000 --- a/src/OCR_baidu/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/src/OCR_baidu/.idea/uiDesigner.xml b/src/OCR_baidu/.idea/uiDesigner.xml deleted file mode 100644 index e96534f..0000000 --- a/src/OCR_baidu/.idea/uiDesigner.xml +++ /dev/null @@ -1,124 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/OCR_baidu/META-INF/MANIFEST.MF b/src/OCR_baidu/META-INF/MANIFEST.MF deleted file mode 100644 index 9b8fcba..0000000 --- a/src/OCR_baidu/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Main-Class: OCR - diff --git a/src/OCR_baidu/OCR_baidu.iml b/src/OCR_baidu/OCR_baidu.iml deleted file mode 100644 index 025727a..0000000 --- a/src/OCR_baidu/OCR_baidu.iml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/OCR_baidu/lib/aip-java-sdk-4.16.11.jar b/src/OCR_baidu/lib/aip-java-sdk-4.16.11.jar deleted file mode 100644 index 1fe3884..0000000 Binary files a/src/OCR_baidu/lib/aip-java-sdk-4.16.11.jar and /dev/null differ diff --git a/src/OCR_baidu/lib/json-20160810.jar b/src/OCR_baidu/lib/json-20160810.jar deleted file mode 100644 index a90e448..0000000 Binary files a/src/OCR_baidu/lib/json-20160810.jar and /dev/null differ diff --git a/src/OCR_baidu/lib/slf4j-api-1.7.25.jar b/src/OCR_baidu/lib/slf4j-api-1.7.25.jar deleted file mode 100644 index 0143c09..0000000 Binary files a/src/OCR_baidu/lib/slf4j-api-1.7.25.jar and /dev/null differ diff --git a/src/OCR_baidu/lib/slf4j-simple-1.7.25.jar b/src/OCR_baidu/lib/slf4j-simple-1.7.25.jar deleted file mode 100644 index a7260f3..0000000 Binary files a/src/OCR_baidu/lib/slf4j-simple-1.7.25.jar and /dev/null differ diff --git a/src/OCR_baidu/out/META-INF/MANIFEST.MF b/src/OCR_baidu/out/META-INF/MANIFEST.MF deleted file mode 100644 index a30bfa7..0000000 --- a/src/OCR_baidu/out/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Main-Class: HealthCode - diff --git a/src/OCR_baidu/out/production/OCR_baidu/AipOcr.class b/src/OCR_baidu/out/production/OCR_baidu/AipOcr.class deleted file mode 100644 index 9cfd8dc..0000000 Binary files a/src/OCR_baidu/out/production/OCR_baidu/AipOcr.class and /dev/null differ diff --git a/src/OCR_baidu/out/production/OCR_baidu/CovidTestRep.class b/src/OCR_baidu/out/production/OCR_baidu/CovidTestRep.class deleted file mode 100644 index 4253a2d..0000000 Binary files a/src/OCR_baidu/out/production/OCR_baidu/CovidTestRep.class and /dev/null differ diff --git a/src/OCR_baidu/out/production/OCR_baidu/HealthCode.class b/src/OCR_baidu/out/production/OCR_baidu/HealthCode.class deleted file mode 100644 index 74a26f1..0000000 Binary files a/src/OCR_baidu/out/production/OCR_baidu/HealthCode.class and /dev/null differ diff --git a/src/OCR_baidu/out/production/OCR_baidu/META-INF/MANIFEST.MF b/src/OCR_baidu/out/production/OCR_baidu/META-INF/MANIFEST.MF deleted file mode 100644 index a30bfa7..0000000 --- a/src/OCR_baidu/out/production/OCR_baidu/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Main-Class: HealthCode - diff --git a/src/OCR_baidu/out/production/OCR_baidu/TripCode.class b/src/OCR_baidu/out/production/OCR_baidu/TripCode.class deleted file mode 100644 index c207233..0000000 Binary files a/src/OCR_baidu/out/production/OCR_baidu/TripCode.class and /dev/null differ diff --git a/src/OCR_baidu/src/AipOcr.java b/src/OCR_baidu/src/AipOcr.java deleted file mode 100644 index 262f815..0000000 --- a/src/OCR_baidu/src/AipOcr.java +++ /dev/null @@ -1,1841 +0,0 @@ -// -// Source code recreated from a .class file by IntelliJ IDEA -// (powered by FernFlower decompiler) -// - -import com.baidu.aip.client.BaseClient; -import com.baidu.aip.contentcensor.EImgType; -import com.baidu.aip.error.AipError; -import com.baidu.aip.http.AipRequest; -import com.baidu.aip.util.Base64Util; -import com.baidu.aip.util.Util; -import org.json.JSONObject; - -import java.io.IOException; -import java.util.Calendar; -import java.util.HashMap; - -public class AipOcr extends BaseClient { - public AipOcr(String appId, String apiKey, String secretKey) { - super(appId, apiKey, secretKey); - } - - public JSONObject basicGeneral(byte[] image, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - String base64Content = Base64Util.encode(image); - request.addBody("image", base64Content); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/general_basic"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject basicGeneral(String image, HashMap options) { - try { - byte[] data = Util.readFileByBytes(image); - return this.basicGeneral(data, options); - } catch (IOException var4) { - var4.printStackTrace(); - return AipError.IMAGE_READ_ERROR.toJsonResult(); - } - } - - public JSONObject basicGeneralUrl(String url, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - request.addBody("url", url); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/general_basic"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject basicAccurateGeneral(byte[] image, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - String base64Content = Base64Util.encode(image); - request.addBody("image", base64Content); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/accurate_basic"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject basicAccurateGeneral(String image, HashMap options) { - try { - byte[] data = Util.readFileByBytes(image); - return this.basicAccurateGeneral(data, options); - } catch (IOException var4) { - var4.printStackTrace(); - return AipError.IMAGE_READ_ERROR.toJsonResult(); - } - } - - public JSONObject general(byte[] image, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - String base64Content = Base64Util.encode(image); - request.addBody("image", base64Content); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/general"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject general(String image, HashMap options) { - try { - byte[] data = Util.readFileByBytes(image); - return this.general(data, options); - } catch (IOException var4) { - var4.printStackTrace(); - return AipError.IMAGE_READ_ERROR.toJsonResult(); - } - } - - public JSONObject generalUrl(String url, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - request.addBody("url", url); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/general"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject accurateGeneral(byte[] image, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - String base64Content = Base64Util.encode(image); - request.addBody("image", base64Content); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/accurate"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject accurateGeneral(String image, HashMap options) { - try { - byte[] data = Util.readFileByBytes(image); - return this.accurateGeneral(data, options); - } catch (IOException var4) { - var4.printStackTrace(); - return AipError.IMAGE_READ_ERROR.toJsonResult(); - } - } - - public JSONObject enhancedGeneral(byte[] image, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - String base64Content = Base64Util.encode(image); - request.addBody("image", base64Content); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/general_enhanced"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject enhancedGeneral(String image, HashMap options) { - try { - byte[] data = Util.readFileByBytes(image); - return this.enhancedGeneral(data, options); - } catch (IOException var4) { - var4.printStackTrace(); - return AipError.IMAGE_READ_ERROR.toJsonResult(); - } - } - - public JSONObject enhancedGeneralUrl(String url, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - request.addBody("url", url); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/general_enhanced"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject webImage(byte[] image, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - String base64Content = Base64Util.encode(image); - request.addBody("image", base64Content); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/webimage"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject webImage(String image, HashMap options) { - try { - byte[] data = Util.readFileByBytes(image); - return this.webImage(data, options); - } catch (IOException var4) { - var4.printStackTrace(); - return AipError.IMAGE_READ_ERROR.toJsonResult(); - } - } - - public JSONObject webImageUrl(String url, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - request.addBody("url", url); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/webimage"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject idcard(byte[] image, String idCardSide, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - String base64Content = Base64Util.encode(image); - request.addBody("image", base64Content); - request.addBody("id_card_side", idCardSide); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/idcard"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject idcard(String image, String idCardSide, HashMap options) { - try { - byte[] data = Util.readFileByBytes(image); - return this.idcard(data, idCardSide, options); - } catch (IOException var5) { - var5.printStackTrace(); - return AipError.IMAGE_READ_ERROR.toJsonResult(); - } - } - - public JSONObject bankcard(byte[] image, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - String base64Content = Base64Util.encode(image); - request.addBody("image", base64Content); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/bankcard"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject bankcard(String image, HashMap options) { - try { - byte[] data = Util.readFileByBytes(image); - return this.bankcard(data, options); - } catch (IOException var4) { - var4.printStackTrace(); - return AipError.IMAGE_READ_ERROR.toJsonResult(); - } - } - - public JSONObject drivingLicense(byte[] image, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - String base64Content = Base64Util.encode(image); - request.addBody("image", base64Content); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/driving_license"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject drivingLicense(String image, HashMap options) { - try { - byte[] data = Util.readFileByBytes(image); - return this.drivingLicense(data, options); - } catch (IOException var4) { - var4.printStackTrace(); - return AipError.IMAGE_READ_ERROR.toJsonResult(); - } - } - - public JSONObject vehicleLicense(byte[] image, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - String base64Content = Base64Util.encode(image); - request.addBody("image", base64Content); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/vehicle_license"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject vehicleLicense(String image, HashMap options) { - try { - byte[] data = Util.readFileByBytes(image); - return this.vehicleLicense(data, options); - } catch (IOException var4) { - var4.printStackTrace(); - return AipError.IMAGE_READ_ERROR.toJsonResult(); - } - } - - public JSONObject plateLicense(byte[] image, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - String base64Content = Base64Util.encode(image); - request.addBody("image", base64Content); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/license_plate"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject plateLicense(String image, HashMap options) { - try { - byte[] data = Util.readFileByBytes(image); - return this.plateLicense(data, options); - } catch (IOException var4) { - var4.printStackTrace(); - return AipError.IMAGE_READ_ERROR.toJsonResult(); - } - } - - public JSONObject businessLicense(byte[] image, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - String base64Content = Base64Util.encode(image); - request.addBody("image", base64Content); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/business_license"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject businessLicense(String image, HashMap options) { - try { - byte[] data = Util.readFileByBytes(image); - return this.businessLicense(data, options); - } catch (IOException var4) { - var4.printStackTrace(); - return AipError.IMAGE_READ_ERROR.toJsonResult(); - } - } - - public JSONObject receipt(byte[] image, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - String base64Content = Base64Util.encode(image); - request.addBody("image", base64Content); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/receipt"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject receipt(String image, HashMap options) { - try { - byte[] data = Util.readFileByBytes(image); - return this.receipt(data, options); - } catch (IOException var4) { - var4.printStackTrace(); - return AipError.IMAGE_READ_ERROR.toJsonResult(); - } - } - - public JSONObject trainTicket(byte[] image, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - String base64Content = Base64Util.encode(image); - request.addBody("image", base64Content); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/train_ticket"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject trainTicket(String image, EImgType type, HashMap options) { - return this.ocrByUrlOrFile(image, type, "https://aip.baidubce.com/rest/2.0/ocr/v1/train_ticket", options); - } - - public JSONObject taxiReceipt(byte[] image, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - String base64Content = Base64Util.encode(image); - request.addBody("image", base64Content); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/taxi_receipt"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject taxiReceipt(String image, EImgType type, HashMap options) { - return this.ocrByUrlOrFile(image, type, "https://aip.baidubce.com/rest/2.0/ocr/v1/taxi_receipt", options); - } - - public JSONObject form(byte[] image, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - String base64Content = Base64Util.encode(image); - request.addBody("image", base64Content); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/form"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject form(String image, HashMap options) { - try { - byte[] data = Util.readFileByBytes(image); - return this.form(data, options); - } catch (IOException var4) { - var4.printStackTrace(); - return AipError.IMAGE_READ_ERROR.toJsonResult(); - } - } - - public JSONObject tableRecognitionAsync(byte[] image, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - String base64Content = Base64Util.encode(image); - request.addBody("image", base64Content); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/solution/v1/form_ocr/request"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject tableRecognitionAsync(String image, HashMap options) { - try { - byte[] data = Util.readFileByBytes(image); - return this.tableRecognitionAsync(data, options); - } catch (IOException var4) { - var4.printStackTrace(); - return AipError.IMAGE_READ_ERROR.toJsonResult(); - } - } - - public JSONObject tableResultGet(String requestId, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - request.addBody("request_id", requestId); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/solution/v1/form_ocr/get_request_result"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject vinCode(byte[] image, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - String base64Content = Base64Util.encode(image); - request.addBody("image", base64Content); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/vin_code"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject vinCode(String image, EImgType type, HashMap options) { - return this.ocrByUrlOrFile(image, type, "https://aip.baidubce.com/rest/2.0/ocr/v1/vin_code", options); - } - - public JSONObject quotaInvoice(byte[] image, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - String base64Content = Base64Util.encode(image); - request.addBody("image", base64Content); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/quota_invoice"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject quotaInvoice(String image, HashMap options) { - try { - byte[] data = Util.readFileByBytes(image); - return this.quotaInvoice(data, options); - } catch (IOException var4) { - var4.printStackTrace(); - return AipError.IMAGE_READ_ERROR.toJsonResult(); - } - } - - public JSONObject householdRegister(byte[] image, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - String base64Content = Base64Util.encode(image); - request.addBody("image", base64Content); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/household_register"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject householdRegister(String image, HashMap options) { - try { - byte[] data = Util.readFileByBytes(image); - return this.householdRegister(data, options); - } catch (IOException var4) { - var4.printStackTrace(); - return AipError.IMAGE_READ_ERROR.toJsonResult(); - } - } - - public JSONObject HKMacauExitentrypermit(byte[] image, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - String base64Content = Base64Util.encode(image); - request.addBody("image", base64Content); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/HK_Macau_exitentrypermit"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject HKMacauExitentrypermit(String image, HashMap options) { - try { - byte[] data = Util.readFileByBytes(image); - return this.HKMacauExitentrypermit(data, options); - } catch (IOException var4) { - var4.printStackTrace(); - return AipError.IMAGE_READ_ERROR.toJsonResult(); - } - } - - public JSONObject taiwanExitentrypermit(byte[] image, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - String base64Content = Base64Util.encode(image); - request.addBody("image", base64Content); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/taiwan_exitentrypermit"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject taiwanExitentrypermit(String image, HashMap options) { - try { - byte[] data = Util.readFileByBytes(image); - return this.taiwanExitentrypermit(data, options); - } catch (IOException var4) { - var4.printStackTrace(); - return AipError.IMAGE_READ_ERROR.toJsonResult(); - } - } - - public JSONObject birthCertificate(byte[] image, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - String base64Content = Base64Util.encode(image); - request.addBody("image", base64Content); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/birth_certificate"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject birthCertificate(String image, HashMap options) { - try { - byte[] data = Util.readFileByBytes(image); - return this.birthCertificate(data, options); - } catch (IOException var4) { - var4.printStackTrace(); - return AipError.IMAGE_READ_ERROR.toJsonResult(); - } - } - - public JSONObject vehicleInvoice(byte[] image, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - String base64Content = Base64Util.encode(image); - request.addBody("image", base64Content); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/vehicle_invoice"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject vehicleInvoice(String image, HashMap options) { - try { - byte[] data = Util.readFileByBytes(image); - return this.vehicleInvoice(data, options); - } catch (IOException var4) { - var4.printStackTrace(); - return AipError.IMAGE_READ_ERROR.toJsonResult(); - } - } - - public JSONObject vehicleCertificate(byte[] image, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - String base64Content = Base64Util.encode(image); - request.addBody("image", base64Content); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/vehicle_certificate"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject vehicleCertificate(String image, HashMap options) { - try { - byte[] data = Util.readFileByBytes(image); - return this.vehicleCertificate(data, options); - } catch (IOException var4) { - var4.printStackTrace(); - return AipError.IMAGE_READ_ERROR.toJsonResult(); - } - } - - public JSONObject invoice(byte[] image, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - String base64Content = Base64Util.encode(image); - request.addBody("image", base64Content); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/invoice"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject invoice(String image, HashMap options) { - try { - byte[] data = Util.readFileByBytes(image); - return this.invoice(data, options); - } catch (IOException var4) { - var4.printStackTrace(); - return AipError.IMAGE_READ_ERROR.toJsonResult(); - } - } - - public JSONObject airTicket(byte[] image, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - String base64Content = Base64Util.encode(image); - request.addBody("image", base64Content); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/air_ticket"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject airTicket(String image, HashMap options) { - try { - byte[] data = Util.readFileByBytes(image); - return this.airTicket(data, options); - } catch (IOException var4) { - var4.printStackTrace(); - return AipError.IMAGE_READ_ERROR.toJsonResult(); - } - } - - public JSONObject insuranceDocuments(byte[] image, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - String base64Content = Base64Util.encode(image); - request.addBody("image", base64Content); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/insurance_documents"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject insuranceDocuments(String image, HashMap options) { - try { - byte[] data = Util.readFileByBytes(image); - return this.insuranceDocuments(data, options); - } catch (IOException var4) { - var4.printStackTrace(); - return AipError.IMAGE_READ_ERROR.toJsonResult(); - } - } - - public JSONObject vatInvoice(String image, EImgType type, HashMap options) { - if (type == EImgType.PDF) { - AipRequest request = new AipRequest(); - this.preOperation(request); - if (options != null) { - request.addBody(options); - } - - try { - byte[] data = Util.readFileByBytes(image); - String base64Content = Base64Util.encode(data); - request.addBody("pdf_file", base64Content); - } catch (IOException var7) { - var7.printStackTrace(); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/vat_invoice"); - this.postOperation(request); - return this.requestServer(request); - } else { - return this.ocrByUrlOrFile(image, type, "https://aip.baidubce.com/rest/2.0/ocr/v1/vat_invoice", options); - } - } - - public JSONObject vatInvoice(byte[] image, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - String base64Content = Base64Util.encode(image); - request.addBody("image", base64Content); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/vat_invoice"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject vatInvoice(String image, HashMap options) { - try { - byte[] data = Util.readFileByBytes(image); - return this.vatInvoice(data, options); - } catch (IOException var4) { - var4.printStackTrace(); - return AipError.IMAGE_READ_ERROR.toJsonResult(); - } - } - - public JSONObject qrcode(byte[] image, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - String base64Content = Base64Util.encode(image); - request.addBody("image", base64Content); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/qrcode"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject qrcode(String image, HashMap options) { - try { - byte[] data = Util.readFileByBytes(image); - return this.qrcode(data, options); - } catch (IOException var4) { - var4.printStackTrace(); - return AipError.IMAGE_READ_ERROR.toJsonResult(); - } - } - - public JSONObject numbers(byte[] image, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - String base64Content = Base64Util.encode(image); - request.addBody("image", base64Content); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/numbers"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject numbers(String image, HashMap options) { - try { - byte[] data = Util.readFileByBytes(image); - return this.numbers(data, options); - } catch (IOException var4) { - var4.printStackTrace(); - return AipError.IMAGE_READ_ERROR.toJsonResult(); - } - } - - public JSONObject lottery(byte[] image, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - String base64Content = Base64Util.encode(image); - request.addBody("image", base64Content); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/lottery"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject lottery(String image, HashMap options) { - try { - byte[] data = Util.readFileByBytes(image); - return this.lottery(data, options); - } catch (IOException var4) { - var4.printStackTrace(); - return AipError.IMAGE_READ_ERROR.toJsonResult(); - } - } - - public JSONObject passport(byte[] image, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - String base64Content = Base64Util.encode(image); - request.addBody("image", base64Content); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/passport"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject passport(String image, HashMap options) { - try { - byte[] data = Util.readFileByBytes(image); - return this.passport(data, options); - } catch (IOException var4) { - var4.printStackTrace(); - return AipError.IMAGE_READ_ERROR.toJsonResult(); - } - } - - public JSONObject businessCard(byte[] image, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - String base64Content = Base64Util.encode(image); - request.addBody("image", base64Content); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/business_card"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject businessCard(String image, HashMap options) { - try { - byte[] data = Util.readFileByBytes(image); - return this.businessCard(data, options); - } catch (IOException var4) { - var4.printStackTrace(); - return AipError.IMAGE_READ_ERROR.toJsonResult(); - } - } - - public JSONObject handwriting(byte[] image, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - String base64Content = Base64Util.encode(image); - request.addBody("image", base64Content); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/handwriting"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject handwriting(String image, HashMap options) { - try { - byte[] data = Util.readFileByBytes(image); - return this.handwriting(data, options); - } catch (IOException var4) { - var4.printStackTrace(); - return AipError.IMAGE_READ_ERROR.toJsonResult(); - } - } - - public JSONObject custom(byte[] image, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - String base64Content = Base64Util.encode(image); - request.addBody("image", base64Content); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/solution/v1/iocr/recognise"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject custom(String image, HashMap options) { - try { - byte[] data = Util.readFileByBytes(image); - return this.custom(data, options); - } catch (IOException var4) { - var4.printStackTrace(); - return AipError.IMAGE_READ_ERROR.toJsonResult(); - } - } - - public JSONObject getTableRecognitionJsonResult(String requestId) { - return this.getTableResultHelper(requestId, "json"); - } - - public JSONObject getTableRecognitionExcelResult(String requestId) { - return this.getTableResultHelper(requestId, "excel"); - } - - private JSONObject getTableResultHelper(String requestId, String resultType) { - AipRequest request = new AipRequest(); - this.preOperation(request); - request.addBody("request_id", requestId); - request.addBody("result_type", resultType); - request.setUri("https://aip.baidubce.com/rest/2.0/solution/v1/form_ocr/get_request_result"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject tableRecognizeToJson(String imgPath, long timeoutMiliseconds) { - try { - byte[] imgData = Util.readFileByBytes(imgPath); - return this.tableRecognizeToJson(imgData, timeoutMiliseconds); - } catch (IOException var5) { - var5.printStackTrace(); - return AipError.IMAGE_READ_ERROR.toJsonResult(); - } - } - - public JSONObject tableRecognizeToJson(byte[] imgData, long timeoutMiliseconds) { - return this.tableRecSyncHelper(imgData, timeoutMiliseconds, "json"); - } - - public JSONObject tableRecognizeToExcelUrl(String imgPath, long timeoutMiliseconds) { - try { - byte[] imgData = Util.readFileByBytes(imgPath); - return this.tableRecognizeToExcelUrl(imgData, timeoutMiliseconds); - } catch (IOException var5) { - var5.printStackTrace(); - return AipError.IMAGE_READ_ERROR.toJsonResult(); - } - } - - public JSONObject tableRecognizeToExcelUrl(byte[] imgData, long timeoutMiliseconds) { - return this.tableRecSyncHelper(imgData, timeoutMiliseconds, "excel"); - } - - private JSONObject tableRecSyncHelper(byte[] imgData, long timeout, String resultType) { - JSONObject res = this.tableRecognitionAsync((byte[])imgData, (HashMap)null); - if (res.has("error_code")) { - return res; - } else { - String reqId = res.getJSONArray("result").getJSONObject(0).getString("request_id"); - long start = Calendar.getInstance().getTimeInMillis(); - long sleepInterval = 2000L; - - while(true) { - long now = Calendar.getInstance().getTimeInMillis(); - if (now - start > timeout) { - return AipError.ASYNC_TIMEOUT_ERROR.toJsonResult(); - } - - JSONObject result = this.getTableResultHelper(reqId, resultType); - if (result.has("error_code")) { - return result; - } - - int retCode = result.getJSONObject("result").getInt("ret_code"); - if (retCode == 3) { - return result; - } - - try { - Thread.sleep(sleepInterval); - } catch (InterruptedException var16) { - var16.printStackTrace(); - } - } - } - } - - public JSONObject docAnalysis(String image, HashMap options) { - try { - byte[] data = Util.readFileByBytes(image); - return this.docAnalysis(data, options); - } catch (IOException var4) { - var4.printStackTrace(); - return AipError.IMAGE_READ_ERROR.toJsonResult(); - } - } - - public JSONObject docAnalysis(byte[] image, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - String base64Content = Base64Util.encode(image); - request.addBody("image", base64Content); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/doc_analysis"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject meter(String image, HashMap options) { - try { - byte[] data = Util.readFileByBytes(image); - return this.meter(data, options); - } catch (IOException var4) { - var4.printStackTrace(); - return AipError.IMAGE_READ_ERROR.toJsonResult(); - } - } - - public JSONObject meter(byte[] image, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - String base64Content = Base64Util.encode(image); - request.addBody("image", base64Content); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/meter"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject webimageLoc(String image, HashMap options) { - try { - byte[] data = Util.readFileByBytes(image); - return this.webimageLoc(data, options); - } catch (IOException var4) { - var4.printStackTrace(); - return AipError.IMAGE_READ_ERROR.toJsonResult(); - } - } - - public JSONObject webimageLoc(byte[] image, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - String base64Content = Base64Util.encode(image); - request.addBody("image", base64Content); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/webimage_loc"); - this.postOperation(request); - return this.requestServer(request); - } - - private JSONObject ocrByUrlOrFile(String image, EImgType type, String targetUrl, HashMap options) { - return type == EImgType.FILE ? this.ocrByFile(image, targetUrl, options) : this.ocrByUrl(image, targetUrl, options); - } - - private JSONObject ocrByUrl(String imageUrl, String targetUrl, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - request.addBody("url", imageUrl); - if (options != null) { - request.addBody(options); - } - - request.setUri(targetUrl); - this.postOperation(request); - return this.requestServer(request); - } - - private JSONObject ocrByFile(String image, String targetUrl, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - - try { - byte[] data = Util.readFileByBytes(image); - String base64Content = Base64Util.encode(data); - request.addBody("image", base64Content); - } catch (IOException var7) { - var7.printStackTrace(); - return AipError.IMAGE_READ_ERROR.toJsonResult(); - } - - if (options != null) { - request.addBody(options); - } - - request.setUri(targetUrl); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject qrcodeUrl(String url, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - request.addBody("url", url); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/qrcode"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject docAnalysisUrl(String url, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - request.addBody("url", url); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/doc_analysis"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject vehicleInvoiceUrl(String url, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - request.addBody("url", url); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/vehicle_invoice"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject vehicleCertificateUrl(String url, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - request.addBody("url", url); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/vehicle_certificate"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject householdRegisterUrl(String url, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - request.addBody("url", url); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/household_register"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject handwritingUrl(String url, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - request.addBody("url", url); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/handwriting"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject airTicketUrl(String url, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - request.addBody("url", url); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/air_ticket"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject invoiceUrl(String url, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - request.addBody("url", url); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/invoice"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject passportUrl(String url, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - request.addBody("url", url); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/passport"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject onlineTaxiItinerary(byte[] image) { - AipRequest request = new AipRequest(); - this.preOperation(request); - String base64Content = Base64Util.encode(image); - request.addBody("image", base64Content); - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/online_taxi_itinerary"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject onlineTaxiItineraryUrl(String url) { - AipRequest request = new AipRequest(); - this.preOperation(request); - request.addBody("url", url); - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/online_taxi_itinerary"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject onlineTaxiItineraryPdf(byte[] pdfFile, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - String base64Content = Base64Util.encode(pdfFile); - request.addBody("pdf_file", base64Content); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/online_taxi_itinerary"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject weightNote(byte[] image, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - String base64Content = Base64Util.encode(image); - request.addBody("image", base64Content); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/weight_note"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject weightNoteUrl(String url, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - request.addBody("url", url); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/weight_note"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject weightNotePdf(byte[] pdfFile, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - String base64Content = Base64Util.encode(pdfFile); - request.addBody("pdf_file", base64Content); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/weight_note"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject medicalDetail(byte[] image, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - String base64Content = Base64Util.encode(image); - request.addBody("image", base64Content); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/medical_detail"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject medicalDetailUrl(String url, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - request.addBody("url", url); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/medical_detail"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject docAnalysisOffice(String image, HashMap options) { - try { - byte[] data = Util.readFileByBytes(image); - return this.docAnalysisOffice(data, options); - } catch (IOException var4) { - var4.printStackTrace(); - return AipError.IMAGE_READ_ERROR.toJsonResult(); - } - } - - public JSONObject docAnalysisOffice(byte[] image, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - String base64Content = Base64Util.encode(image); - request.addBody("image", base64Content); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/doc_analysis_office"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject docAnalysisOfficeUrl(String url, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - request.addBody("url", url); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/doc_analysis_office"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject docAnalysisOfficePdf(String pdf, int pdfFileNum, HashMap options) { - try { - byte[] data = Util.readFileByBytes(pdf); - return this.docAnalysisOfficePdf(data, pdfFileNum, options); - } catch (IOException var5) { - var5.printStackTrace(); - return AipError.IMAGE_READ_ERROR.toJsonResult(); - } - } - - public JSONObject docAnalysisOfficePdf(byte[] pdf, int pdfFileNum, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - String base64Content = Base64Util.encode(pdf); - request.addBody("pdf_file", base64Content); - request.addBody("pdf_file_num", pdfFileNum); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/doc_analysis_office"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject seal(String image) { - try { - byte[] data = Util.readFileByBytes(image); - return this.seal(data); - } catch (IOException var3) { - var3.printStackTrace(); - return AipError.IMAGE_READ_ERROR.toJsonResult(); - } - } - - public JSONObject seal(byte[] image) { - AipRequest request = new AipRequest(); - this.preOperation(request); - String base64Content = Base64Util.encode(image); - request.addBody("image", base64Content); - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/seal"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject sealUrl(String url) { - AipRequest request = new AipRequest(); - this.preOperation(request); - request.addBody("url", url); - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/seal"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject sealPdf(String pdf, int pdfFileNum) { - try { - byte[] data = Util.readFileByBytes(pdf); - return this.sealPdf(data, pdfFileNum); - } catch (IOException var4) { - var4.printStackTrace(); - return AipError.IMAGE_READ_ERROR.toJsonResult(); - } - } - - public JSONObject sealPdf(byte[] pdf, int pdfFileNum) { - AipRequest request = new AipRequest(); - this.preOperation(request); - String base64Content = Base64Util.encode(pdf); - request.addBody("pdf_file", base64Content); - request.addBody("pdf_file_num", pdfFileNum); - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/seal"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject multiIdcard(String image, HashMap options) { - try { - byte[] data = Util.readFileByBytes(image); - return this.multiIdcard(data, options); - } catch (IOException var4) { - var4.printStackTrace(); - return AipError.IMAGE_READ_ERROR.toJsonResult(); - } - } - - public JSONObject multiIdcard(byte[] image, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - String base64Content = Base64Util.encode(image); - request.addBody("image", base64Content); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/multi_idcard"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject multiIdcardUrl(String url, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - request.addBody("url", url); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/multi_idcard"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject mixedMultiVehicle(String image, HashMap options) { - try { - byte[] data = Util.readFileByBytes(image); - return this.mixedMultiVehicle(data, options); - } catch (IOException var4) { - var4.printStackTrace(); - return AipError.IMAGE_READ_ERROR.toJsonResult(); - } - } - - public JSONObject mixedMultiVehicle(byte[] image, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - String base64Content = Base64Util.encode(image); - request.addBody("image", base64Content); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/mixed_multi_vehicle"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject mixedMultiVehicleUrl(String url, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - request.addBody("url", url); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/mixed_multi_vehicle"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject vehicleRegistrationCertificate(String image) { - try { - byte[] data = Util.readFileByBytes(image); - return this.vehicleRegistrationCertificate(data); - } catch (IOException var3) { - var3.printStackTrace(); - return AipError.IMAGE_READ_ERROR.toJsonResult(); - } - } - - public JSONObject vehicleRegistrationCertificate(byte[] image) { - AipRequest request = new AipRequest(); - this.preOperation(request); - String base64Content = Base64Util.encode(image); - request.addBody("image", base64Content); - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/vehicle_registration_certificate"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject vehicleRegistrationCertificateUrl(String url) { - AipRequest request = new AipRequest(); - this.preOperation(request); - request.addBody("url", url); - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/vehicle_registration_certificate"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject multipleInvoice(String image, HashMap options) { - try { - byte[] data = Util.readFileByBytes(image); - return this.multipleInvoice(data, options); - } catch (IOException var4) { - var4.printStackTrace(); - return AipError.IMAGE_READ_ERROR.toJsonResult(); - } - } - - public JSONObject multipleInvoice(byte[] image, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - String base64Content = Base64Util.encode(image); - request.addBody("image", base64Content); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/multiple_invoice"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject multipleInvoiceUrl(String url, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - request.addBody("url", url); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/multiple_invoice"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject multipleInvoicePdf(String pdf, int pdfFileNum, HashMap options) { - try { - byte[] data = Util.readFileByBytes(pdf); - return this.multipleInvoicePdf(data, pdfFileNum, options); - } catch (IOException var5) { - var5.printStackTrace(); - return AipError.IMAGE_READ_ERROR.toJsonResult(); - } - } - - public JSONObject multipleInvoicePdf(byte[] pdf, int pdfFileNum, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - String base64Content = Base64Util.encode(pdf); - request.addBody("pdf_file", base64Content); - request.addBody("pdf_file_num", pdfFileNum); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/multiple_invoice"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject vatInvoiceVerification(String invoiceCode, String invoiceNum, String invoiceDate, String invoiceType, String checkCode, String totalAmount) { - AipRequest request = new AipRequest(); - this.preOperation(request); - request.addBody("invoice_code", invoiceCode); - request.addBody("invoice_num", invoiceNum); - request.addBody("invoice_date", invoiceDate); - request.addBody("invoice_type", invoiceType); - request.addBody("check_code", checkCode); - request.addBody("total_amount", totalAmount); - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/vat_invoice_verification"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject busTicket(String image) { - try { - byte[] data = Util.readFileByBytes(image); - return this.busTicket(data); - } catch (IOException var3) { - var3.printStackTrace(); - return AipError.IMAGE_READ_ERROR.toJsonResult(); - } - } - - public JSONObject busTicket(byte[] image) { - AipRequest request = new AipRequest(); - this.preOperation(request); - String base64Content = Base64Util.encode(image); - request.addBody("image", base64Content); - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/bus_ticket"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject busTicketUrl(String url) { - AipRequest request = new AipRequest(); - this.preOperation(request); - request.addBody("url", url); - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/bus_ticket"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject medicalInvoice(String image, HashMap options) { - try { - byte[] data = Util.readFileByBytes(image); - return this.medicalInvoice(data, options); - } catch (IOException var4) { - var4.printStackTrace(); - return AipError.IMAGE_READ_ERROR.toJsonResult(); - } - } - - public JSONObject medicalInvoice(byte[] image, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - String base64Content = Base64Util.encode(image); - request.addBody("image", base64Content); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/medical_invoice"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject medicalInvoiceUrl(String url, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - request.addBody("url", url); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/medical_invoice"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject formula(String image, HashMap options) { - try { - byte[] data = Util.readFileByBytes(image); - return this.formula(data, options); - } catch (IOException var4) { - var4.printStackTrace(); - return AipError.IMAGE_READ_ERROR.toJsonResult(); - } - } - - public JSONObject formula(byte[] image, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - String base64Content = Base64Util.encode(image); - request.addBody("image", base64Content); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/formula"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject formulaUrl(String url, HashMap options) { - AipRequest request = new AipRequest(); - this.preOperation(request); - request.addBody("url", url); - if (options != null) { - request.addBody(options); - } - - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/formula"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject travelCard(String image) { - try { - byte[] data = Util.readFileByBytes(image); - return this.travelCard(data); - } catch (IOException var3) { - var3.printStackTrace(); - return AipError.IMAGE_READ_ERROR.toJsonResult(); - } - } - - public JSONObject travelCard(byte[] image) { - AipRequest request = new AipRequest(); - this.preOperation(request); - String base64Content = Base64Util.encode(image); - request.addBody("image", base64Content); - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/travel_card"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject facade(String image) { - try { - byte[] data = Util.readFileByBytes(image); - return this.facade(data); - } catch (IOException var3) { - var3.printStackTrace(); - return AipError.IMAGE_READ_ERROR.toJsonResult(); - } - } - - public JSONObject facade(byte[] image) { - AipRequest request = new AipRequest(); - this.preOperation(request); - String base64Content = Base64Util.encode(image); - request.addBody("image", base64Content); - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/facade"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject healthCode(String image) { - try { - byte[] data = Util.readFileByBytes(image); - return this.healthCode(data); - } catch (IOException var3) { - var3.printStackTrace(); - return AipError.IMAGE_READ_ERROR.toJsonResult(); - } - } - - public JSONObject healthCode(byte[] image) { - AipRequest request = new AipRequest(); - this.preOperation(request); - String base64Content = Base64Util.encode(image); - request.addBody("image", base64Content); - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/health_code"); - this.postOperation(request); - return this.requestServer(request); - } - - public JSONObject covidTest(String image) { - try { - byte[] data = Util.readFileByBytes(image); - return this.covidTest(data); - } catch (IOException var3) { - var3.printStackTrace(); - return AipError.IMAGE_READ_ERROR.toJsonResult(); - } - } - - public JSONObject covidTest(byte[] image) { - AipRequest request = new AipRequest(); - this.preOperation(request); - String base64Content = Base64Util.encode(image); - request.addBody("image", base64Content); - request.setUri("https://aip.baidubce.com/rest/2.0/ocr/v1/covid_test"); - this.postOperation(request); - return this.requestServer(request); - } -} diff --git a/src/OCR_baidu/src/CovidTestRep.java b/src/OCR_baidu/src/CovidTestRep.java deleted file mode 100644 index 61e8a9e..0000000 --- a/src/OCR_baidu/src/CovidTestRep.java +++ /dev/null @@ -1,138 +0,0 @@ -import com.baidu.aip.ocr.AipOcr; -import org.json.JSONObject; - -import java.util.HashMap; - -public class CovidTestRep { - private String Name; - private String Time; - private String Status; - public CovidTestRep() { - Name = ""; - Time = ""; - Status = ""; - } - - public String getName() { - return Name; - } - - public String getData() { - return Time; - } - - public String getStatus() { - return Status; - } - - public void setStatus(String status) { - Status = status; - } - - public void setName(String name) { - Name = name; - } - - public void setData(String data) { - Time = data; - } - - public void Print() { - System.out.println("Name:" + this.Name); - System.out.println("Data:" + this.Time); - System.out.println("Status:" + this.Status); - } - - - public static void main(String[] args) { - String path = "C:/Users//16491/eclipse-workspace/OCR_baidu/src/3.jpg";// 初始化一个AipOcr - ocr3(path); - } - public static String Judge(String path) { - CovidTestRep Ctr=new CovidTestRep(); - Ctr=ocr3(path); - String StatusNameTime=Ctr.Status+","+Ctr.Name+","+Ctr.Time; - return StatusNameTime; - } - public static CovidTestRep ocr3(String path) { - final String APP_ID = "28049220"; - final String API_KEY = "qyKlUy6xSapA89DTPomExteq"; - final String SECRET_KEY = "q5EYpXULVh5gC3firLU1nGaymwIwOMBd"; - AipOcr client = new AipOcr(APP_ID, API_KEY, SECRET_KEY); - - // 可选:设置网络连接参数 - client.setConnectionTimeoutInMillis(2000); - client.setSocketTimeoutInMillis(10000); - - // 可选:设置代理服务器地址, http和socket二选一,或者均不设置 - // client.setHttpProxy("proxy_host", proxy_port); // 设置http代理 - // client.setSocketProxy("proxy_host", proxy_port); // 设置socket代理 - - // 可选:设置log4j日志输出格式,若不设置,则使用默认配置 - // 也可以直接通过jvm启动参数设置此环境变量 - System.setProperty("aip.log4j.conf", "path/to/your/log4j.properties"); - - // 调用接口 - JSONObject res = client.basicGeneral(path, new HashMap()); - /*Map m=res.toMap(); - Set s=m.entrySet();*//* - - for (Object str : s) { - System.out.println(str); - } - //System.out.println(s);*/ - String str= res.toString(0); - /*for(int i=0;i='a'&&c<='z')||(c>='A'&&c<='Z')||c=='{'||c=='"'||c==':'||c=='}'||c==':'||c=='_'){ - continue; - } - else - s+=c; - if(c==']')break; - } - //System.out.println(s); - CovidTestRep CTR=new CovidTestRep(); - for(int i=0;i()); - String str= res.toString(0); - - int flag = 0; - int flag1 = 0; - int flag2 = 0; - HealthCode HC = new HealthCode(); - for (int i = 16; i < str.length(); i++) { - char c = str.charAt(i); - if (c == '[' && flag == 0) { - flag = 1; - } else if (flag == 1 && c == ']') { - break; - } else { - if (i == 27) { - String N = HC.getName(); - for (; str.charAt(i) != '\"'; i++) { - N = N + str.charAt(i); - - } - HC.setName(N); - } - - - if (str.charAt(i) == '-' && flag1 == 0) { - flag1 = 1; - String D = HC.getData(); - for (i = i - 4; str.charAt(i) != '\"'; i++) { - D = D + str.charAt(i); - } - HC.setData(D); - } - if (str.charAt(i) == '码' && flag2 == 0) { - flag2 = 1; - String S = HC.getStatus(); - S = S + str.charAt(i - 1); - HC.setStatus(S); - } - } - } - return HC; - } -} \ No newline at end of file diff --git a/src/OCR_baidu/src/META-INF/MANIFEST.MF b/src/OCR_baidu/src/META-INF/MANIFEST.MF deleted file mode 100644 index a30bfa7..0000000 --- a/src/OCR_baidu/src/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Main-Class: HealthCode - diff --git a/src/OCR_baidu/src/TripCode.java b/src/OCR_baidu/src/TripCode.java deleted file mode 100644 index 6cd45a4..0000000 --- a/src/OCR_baidu/src/TripCode.java +++ /dev/null @@ -1,146 +0,0 @@ -import com.baidu.aip.ocr.AipOcr; -import org.json.JSONObject; - -import java.util.HashMap; -public class TripCode { - private String Status; - private String Telephone; - private String Time; - private String District; - - public TripCode() { - Status = ""; - Telephone = ""; - Time = ""; - District = ""; - } - - public void setStatus(String status) { - Status = status; - } - - public void setTelephone(String telephone) { - Telephone = telephone; - } - - public void setTime(String time) { - Time = time; - } - - public void setDistrict(String district) { - District = district; - } - - public String getTelephone() { - return Telephone; - } - - public String getStatus() { - return Status; - } - - public String getDistrict() { - return District; - } - - public String getTime() { - return Time; - } - - public void Print() { - System.out.println("Status:" + this.Status); - System.out.println("Telephone:" + this.Telephone); - System.out.println("Time:" + this.Time); - System.out.println("District:" + this.District); - } - - public static void main(String[] args) { - String path = "C:\\Users\\16491\\Desktop\\1.jpg"; - System.out.println(Judge(path)); - } - - /*}; - class OCR2 { - //设置APPID/AK/SK*/ - public static String Judge(String path) { - TripCode T = new TripCode(); - T = ocr2(path); - String InfM = T.Status + "," + T.Telephone + "," + T.Time + "," + T.District; - return InfM; - } - - public static TripCode ocr2(String path) { - final String APP_ID = "28049220"; - final String API_KEY = "qyKlUy6xSapA89DTPomExteq"; - final String SECRET_KEY = "q5EYpXULVh5gC3firLU1nGaymwIwOMBd"; - - - // 初始化一个AipOcr - AipOcr client = new AipOcr(APP_ID, API_KEY, SECRET_KEY); - - // 可选:设置网络连接参数 - client.setConnectionTimeoutInMillis(2000); - client.setSocketTimeoutInMillis(10000); - - // 可选:设置代理服务器地址, http和socket二选一,或者均不设置 - // client.setHttpProxy("proxy_host", proxy_port); // 设置http代理 - // client.setSocketProxy("proxy_host", proxy_port); // 设置socket代理 - - // 可选:设置log4j日志输出格式,若不设置,则使用默认配置 - // 也可以直接通过jvm启动参数设置此环境变量 - System.setProperty("aip.log4j.conf", "path/to/your/log4j.properties"); - - // 调用接口 - JSONObject res = client.basicGeneral(path, new HashMap()); - //System.out.println(res); - String str = res.toString(0); - //System.out.println(str); - String s = ""; - for (int i = 0; i < str.length(); i++) { - char c = str.charAt(i); - if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '{' || c == '"' || c == ':' || c == '}' || c == ':' || c == '_') { - continue; - } else - s += c; - if (c == ']') break; - } - //System.out.println(s); - TripCode TC = new TripCode(); - for (int i = 0; i < s.length(); i++) { - if (s.charAt(i) == '的' && s.charAt(i + 1) == '动' && s.charAt(i + 2) == '态' && s.charAt(i + 3) == '行' && s.charAt(i + 4) == '程' && s.charAt(i + 5) == '卡') { - String tel = TC.getTelephone(); - for(;s.charAt(i)!=',';i--); - i++; - for (; s.charAt(i) != ','; i++) { - tel += s.charAt(i); - } - TC.setTelephone(tel); - } - if (s.charAt(i) == '请' && s.charAt(i + 1) == '收' && s.charAt(i + 2) == '下') { - String St = TC.getStatus(); - i = i + 3; - for (; s.charAt(i) != ','; i++) { - St += s.charAt(i); - } - TC.setStatus(St); - } - if (s.charAt(i) == '更' && s.charAt(i + 1) == '新' && s.charAt(i + 2) == '于') { - String Data = TC.getTime(); - i = i + 3; - for (; s.charAt(i) != ','; i++) { - Data += s.charAt(i); - } - TC.setTime(Data); - } - if (s.charAt(i) == '到' && s.charAt(i + 1) == '达' && s.charAt(i + 2) == '或' && s.charAt(i + 3) == '途' && s.charAt(i + 4) == '经') { - String Dis = TC.getDistrict(); - i = i + 5; - for (; s.charAt(i) != ']'; i++) { - Dis += s.charAt(i); - } - TC.setDistrict(Dis); - } - } - return TC; - } -} diff --git a/src/client/admin_log.py b/src/client/admin_log.py new file mode 100644 index 0000000..e990c40 --- /dev/null +++ b/src/client/admin_log.py @@ -0,0 +1,53 @@ +from codecs import ignore_errors +from pickle import TRUE +import turtle +from xmlrpc.client import boolean +import numpy as np +from asyncore import write +import xlrd +import pandas as pd +import openpyxl +from xlrd import Book +import datetime +import time +import time +from flask import Flask,request +from encodings import utf_8 +import pymssql +import json +import base64 +import jpype +class admin_log(): + def admin_log1(c,a): + b={ + 'test1':[], + 'text':'2' + } + # 把数据装载成json格式并回传 + #a='{"a":{"test":1},"b":2,"c":3,"d":4,"e":5}' + conn =pymssql.connect( + server="LAPTOP-FLH9FTB4",#本地服务器 + user="sa",password="as2799094948", + database="software_project", + charset="utf8" + ) + if conn: + print('连接数据库成功!')#测试是否连接上 + cursor =conn.cursor() #使用cursor()方法获取操作游标 + a= request.json + username=a['username'] + passwd=a['password'] + sql_select="SELECT [password] FROM admin where username = '{}'".format(username) #数据库查询语句 + cursor.execute(sql_select) #执行语句 + results =cursor.fetchall() #获取所有记录列表 + if len(results)==0: + b['text']=1 + elif results[0][0]==passwd: + b['text']=2 + else: b['text']=3 + conn.commit() + cursor.close() + conn.close() + # 把数据装载成json格式并回传 + a1=json.dumps(b,ensure_ascii=False) + return a1 \ No newline at end of file diff --git a/src/client/ceshi.py b/src/client/ceshi.py new file mode 100644 index 0000000..c2ea60a --- /dev/null +++ b/src/client/ceshi.py @@ -0,0 +1,16 @@ +'''b={ + 'test1':[], + 'text':'2', + 'image':[] + } +b['test1'].append(['学号:200340001','姓名:白雪健','电话:13080337680','时间:2020','校门:南','市:天津','区:东丽区','详细地址:中国民航大学']) +print(b)''' +b={ + 'test1':[], + 'text':'2', + 'image':[] + } +b['test1'].append([]) +b['test1'][0].append('申请表类型') +b['test1'][0].append('申请表类型') +print(b) \ No newline at end of file diff --git a/src/client/getmes.py b/src/client/getmes.py new file mode 100644 index 0000000..a336a00 --- /dev/null +++ b/src/client/getmes.py @@ -0,0 +1,88 @@ +import time +import requests +import pymssql +import re +from bs4 import BeautifulSoup +cookies = { + 'security_session_verify': '2b416949a891a8c262d984ce4252acc6', + '__yjs_duid': '1_0b113b04c0c0e5c875c1b9485d5285781666539190108', + 'Hm_lvt_133c8ee1fed22328c57193e7ed6ce0c5': '1666539138,1666540035', + 'Hm_lpvt_133c8ee1fed22328c57193e7ed6ce0c5': '1666540145', +} + +headers = { + 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9', + 'Accept-Language': 'zh-CN,zh;q=0.9', + 'Cache-Control': 'max-age=0', + 'Connection': 'keep-alive', + # Requests sorts cookies= alphabetically + # 'Cookie': 'security_session_verify=2b416949a891a8c262d984ce4252acc6; __yjs_duid=1_0b113b04c0c0e5c875c1b9485d5285781666539190108; Hm_lvt_133c8ee1fed22328c57193e7ed6ce0c5=1666539138,1666540035; Hm_lpvt_133c8ee1fed22328c57193e7ed6ce0c5=1666540145', + 'Referer': 'http://tj.bendibao.com/news/gelizhengce/fengxianmingdan.php?isqg=0', + 'Upgrade-Insecure-Requests': '1', + 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36', +} + +params = { + 'isqg': '1', + 'qu': '全部', +} +t=0 +while True: + conn =pymssql.connect( + server="LAPTOP-FLH9FTB4",#本地服务器 + user="sa",password="as2799094948", + database="software_project", + charset="utf8" + #这里设置全局的GBK,如果设置的是UTF—8需要将数据库默认的GBK转化成UTF-8 + ) + if conn: + print('连接数据库成功!')#测试是否连接上 + res = requests.get('http://tj.bendibao.com/news/gelizhengce/fengxianmingdan.php', params=params, cookies=cookies, headers=headers) + res.encoding='utf-8' + soup = BeautifulSoup(res.text, 'html.parser') + # 使用cursor()方法获取操作游标 + cursor =conn.cursor() + # 高风险地区信息 + # 清除原有数据 + cursor.execute("truncate table height") + conn.commit() + # 存入新数据 + content='#info > div.height.info-item > div > div > div > div' + a=soup.select(content) + for i in range(1,len(a)): + a[i] = a[i].text.strip().replace("\n", "") + if len(a[i])!=0: + area=re.search(r'.*?区',a[i]).group() + cursor.execute("insert into height values('{0}','{1}')".format(area,a[i])) + conn.commit() + # 中风险地区信息 + # 清除原有数据 + cursor.execute("truncate table middle") + conn.commit() + # 存入新数据 + content='#info > div.middle.info-item > div > div > div > div' + a=soup.select(content) + for i in range(1,len(a)): + a[i] = a[i].text.strip().replace("\n", "") + if len(a[i])!=0: + area=re.search(r'.*?区',a[i]).group() + cursor.execute("insert into middle values('{0}','{1}')".format(area,a[i])) + conn.commit() + # 低风险地区信息 + # 清除原有数据 + cursor.execute("truncate table low") + conn.commit() + # 存入新数据 + content='#info > div.low.info-item > div > div > div > div' + a=soup.select(content) + for i in range(1,len(a)): + a[i] = a[i].text.strip().replace("\n", "") + if len(a[i])!=0: + area=re.search(r'.*?区',a[i]).group() + cursor.execute("insert into low values('{0}','{1}')".format(area,a[i])) + conn.commit() + cursor.close() + # 断开数据库连接 + conn.close() +# 设置休眠时间,定时执行 + time.sleep(43200) #12小时 diff --git a/src/client/main1.py b/src/client/main1.py new file mode 100644 index 0000000..e3ddf2f --- /dev/null +++ b/src/client/main1.py @@ -0,0 +1,41 @@ +import os + +import jpype + +jarpath = r"D:\tupian\OCR_baidu.jar" # jar包地址 +jvmPath = jpype.getDefaultJVMPath() +jpype.startJVM(jvmPath, "-ea", "-Djava.class.path=%s" % (jarpath)) +java1 = jpype.JClass("HealthCode") +java2 = jpype.JClass("TripCode") +java3 = jpype.JClass("CovidTestRep") +j1 = java1() +j2 = java2() +j3 = java3() +str1 = str(j1.Judge(r"D:\tupian\12.jpg")) # 健康码地址,不要包含中文 下同 +str2 = str(j2.Judge(r"D:\tupian\13.jpg")) # 行程码地址 +str3 = str(j3.Judge(r"D:\tupian\11.jpg")) # 核酸结果地址 +# if str2==",," or str3==',,':图片有误 +''' +Hst, Hname, Hdata 对应健康码颜色,姓名,日期 +Tst, Ttel, Tdata, Tdis 对应行程码颜色,电话,日期,去过的地方 +Cst, Cname, Cdata 对应 核酸结果 姓名 核酸日期 +''' +# 为方便分割,Hst前加了一个大写字符S,判断时应注意,如绿码 Hst为:S绿 +Hst, Hname, Hdata = str1.split(',') +Tst, Ttel, Tdata, Tdis = str2.split(',') +Cst, Cname, Cdata = str3.split(',') +Hdata = Hdata[0:10] # 只要求精确到日,不考虑小时。 +Tdata = Tdata[0:10] +Cdata = Cdata[0:10] + +print(Hst) +print(Hname) +print(Hdata) +print(Tst) +print(Ttel) +print(Tdis) +print(Tdata) +print(Cst) +print(Cname) +print(Cdata) +jpype.shutdownJVM() diff --git a/src/client/scan_the_code.py b/src/client/scan_the_code.py new file mode 100644 index 0000000..92e1ffa --- /dev/null +++ b/src/client/scan_the_code.py @@ -0,0 +1,70 @@ +from audioop import add +import base64 +import os +import json +from unicodedata import name +from codecs import ignore_errors +from pickle import TRUE +import turtle +from xmlrpc.client import boolean +import numpy as np +from asyncore import write +import xlrd +import pandas as pd +import openpyxl +from xlrd import Book +import datetime +import time +from flask import Flask,request +from encodings import utf_8 +import pymssql +import json +import base64 +from out_school import out_school +from in_school import in_school +import time +class scan_the_code: + def scan_the_code1(p,data): + sno=data['sno'] + res={ + 'result':[] + } + Conn = pymssql.connect(server="LAPTOP-FLH9FTB4",#本地服务器 + user="sa",password="as2799094948", + database="software_project", + charset="utf8") + if Conn: + print ("连接成功") + cur = Conn.cursor() + #cur.execute("delete student where state='出' and pass='2' ") + #1在校,2审批通过 + if data['shuju']=='5YWl5qCh5LqM57u056CB': + cur.execute("select * from Form , [user] where state='出校' and pass='2' and sno='{}' and username=sno".format(sno)) + results=cur.fetchall() + if(len(results)==0): + res['result'].append('您没有入校资格') + else: + cur.execute("update [user] set state='入校' where username='{}' ".format(sno)) + cur.execute("delete from Form where sno='{}'".format(sno)) + res['result'].append('入校成功') + elif data['shuju']=='5Ye65qCh5LqM57u056CB': + cur.execute("select * from Form , [user] where state='入校' and pass='2'and sno='{}' and username=sno".format(sno)) + results=cur.fetchall() + if(len(results)==0): + print('无出校资格') + res['result'].append('您没有出校资格') + else: + # 测试时不更改数据 + cur.execute("update [user] set state='出校' where username='{}' ".format(sno)) + cur.execute("delete from Form where sno='{}'".format(sno)) + print('出校成功') + res['result'].append('出校成功') + else: + print('二维码无效') + res['result'].append('二维码无效') + print ("成功") + Conn.commit() + cur.close() + Conn.close() + b=json.dumps(res,ensure_ascii=False) + return b \ No newline at end of file diff --git a/src/client/user_log.py b/src/client/user_log.py new file mode 100644 index 0000000..18c353a --- /dev/null +++ b/src/client/user_log.py @@ -0,0 +1,54 @@ +from codecs import ignore_errors +from pickle import TRUE +import turtle +from xmlrpc.client import boolean +import numpy as np +from asyncore import write +import xlrd +import pandas as pd +import openpyxl +from xlrd import Book +import datetime +import time +import time +from flask import Flask,request +from encodings import utf_8 +import pymssql +import json +import base64 +import jpype +class user_log(): + def user_log1(p,a): + b={ + 'test1':[], + 'text':'2' + } + # 把数据装载成json格式并回传 + #a='{"a":{"test":1},"b":2,"c":3,"d":4,"e":5}' + conn =pymssql.connect( + server="LAPTOP-FLH9FTB4",#本地服务器 + user="sa",password="as2799094948", + database="software_project", + charset="utf8" + ) + if conn: + print('连接数据库成功!')#测试是否连接上 + cursor =conn.cursor() #使用cursor()方法获取操作游标 + a= request.json + username=a['username'] + passwd=a['password'] + sql_select="SELECT password FROM [user] where username = '{}'".format(username) #数据库查询语句 + cursor.execute(sql_select) #执行语句 + results =cursor.fetchall() #获取所有记录列表 + if len(results)==0: + b['text']=1 + elif results[0][0]==passwd: + b['text']=2 + else: b['text']=3 + conn.commit() + cursor.close() + conn.close() + # 把数据装载成json格式并回传 + a1=json.dumps(b,ensure_ascii=False) + #a='{"a":{"test":1},"b":2,"c":3,"d":4,"e":5}' + return a1 \ No newline at end of file