cay_branch #10

Merged
puf7keiya merged 3 commits from CAY into master 2 years ago

Binary file not shown.

@ -1,3 +0,0 @@
# 默认忽略的文件
/shelf/
/workspace.xml

@ -1,12 +0,0 @@
<component name="ArtifactManager">
<artifact type="jar" name="OCR_baidu:jar">
<output-path>$PROJECT_DIR$/out/artifacts/OCR_baidu_jar</output-path>
<root id="archive" name="OCR_baidu.jar">
<element id="module-output" name="OCR_baidu" />
<element id="extracted-dir" path="$PROJECT_DIR$/lib/json-20160810.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/lib/slf4j-simple-1.7.25.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/lib/aip-java-sdk-4.16.11.jar" path-in-jar="/" />
<element id="extracted-dir" path="$PROJECT_DIR$/lib/slf4j-api-1.7.25.jar" path-in-jar="/" />
</root>
</artifact>
</component>

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<annotationProcessing>
<profile default="true" name="Default" enabled="true" />
</annotationProcessing>
</component>
</project>

@ -1,9 +0,0 @@
<component name="libraryTable">
<library name="aip-java-sdk-4.16.11">
<CLASSES>
<root url="jar://$PROJECT_DIR$/lib/aip-java-sdk-4.16.11.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>

@ -1,11 +0,0 @@
<component name="libraryTable">
<library name="json-20160810">
<CLASSES>
<root url="jar://$PROJECT_DIR$/lib/json-20160810.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$PROJECT_DIR$/lib/json-20160810.jar!/" />
</SOURCES>
</library>
</component>

@ -1,9 +0,0 @@
<component name="libraryTable">
<library name="slf4j-api-1.7.25">
<CLASSES>
<root url="jar://$PROJECT_DIR$/lib/slf4j-api-1.7.25.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>

@ -1,9 +0,0 @@
<component name="libraryTable">
<library name="slf4j-simple-1.7.25">
<CLASSES>
<root url="jar://$PROJECT_DIR$/lib/slf4j-simple-1.7.25.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CodeInsightWorkspaceSettings">
<option name="optimizeImportsOnTheFly" value="true" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="11" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/OCR_baidu.iml" filepath="$PROJECT_DIR$/OCR_baidu.iml" />
</modules>
</component>
</project>

@ -1,124 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Palette2">
<group name="Swing">
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
</item>
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
</item>
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
</item>
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
<initial-values>
<property name="text" value="Button" />
</initial-values>
</item>
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="RadioButton" />
</initial-values>
</item>
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="CheckBox" />
</initial-values>
</item>
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
<initial-values>
<property name="text" value="Label" />
</initial-values>
</item>
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
</item>
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
</item>
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
<preferred-size width="-1" height="20" />
</default-constraints>
</item>
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
</item>
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
</item>
</group>
</component>
</project>

@ -1,3 +0,0 @@
Manifest-Version: 1.0
Main-Class: OCR

@ -1,15 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="aip-java-sdk-4.16.11" level="project" />
<orderEntry type="library" name="json-20160810" level="project" />
<orderEntry type="library" name="slf4j-api-1.7.25" level="project" />
<orderEntry type="library" name="slf4j-simple-1.7.25" level="project" />
</component>
</module>

@ -1,3 +0,0 @@
Manifest-Version: 1.0
Main-Class: HealthCode

@ -1,3 +0,0 @@
Manifest-Version: 1.0
Main-Class: HealthCode

File diff suppressed because it is too large Load Diff

@ -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<String, String>());
/*Map<String,Object> 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<str.length();i++)
{char c=str.charAt(i);
System.out.println(i);
System.out.println(c);
}*/
//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);
CovidTestRep CTR=new CovidTestRep();
for(int i=0;i<s.length();i++)
{
if(s.charAt(i)=='姓'&&s.charAt(i+1)=='名')
{
String Na= CTR.getName();
i=i+3;
for(;s.charAt(i)!=',';i++)
{
Na+=s.charAt(i);
}
CTR.setName(Na);
}
if(s.charAt(i)=='采'&&s.charAt(i+1)=='样'&&s.charAt(i+2)=='时'&&s.charAt(i+3)=='间')
{
String Da= CTR.getData();
i=i+5;
for(;s.charAt(i)!=',';i++)
{
Da+=s.charAt(i);
}
CTR.setData(Da);
}
if(s.charAt(i)=='检'&&s.charAt(i+1)=='测'&&s.charAt(i+2)=='结'&&s.charAt(i+3)=='果')
{
String St= CTR.getStatus();
i=i+5;
for(;s.charAt(i)!=']';i++)
{
St+=s.charAt(i);
}
CTR.setStatus(St);
}
}
return CTR;
}
}

@ -1,129 +0,0 @@
import com.baidu.aip.ocr.AipOcr;
import org.json.JSONObject;
import java.util.HashMap;
public class HealthCode {
private String Name;
private String Data;
private String Status;
public HealthCode() {
Name = "";
Data = "";
Status = "";
}
public String getName() {
return Name;
}
public String getData() {
return Data;
}
public String getStatus() {
return Status;
}
public void setStatus(String status) {
Status = status;
}
public void setName(String name) {
Name = name;
}
public void setData(String data) {
Data = data;
}
public void Print() {
System.out.println("Name:" + this.Name);
System.out.println("Data:" + this.Data);
System.out.println("Status:" + this.Status);
}
public static void main(String[] args) {
String path = "C:/Users//16491/eclipse-workspace/OCR_baidu/src/1.jpg";
System.out.println(Judge(path));
}
public static String Judge(String path) {
HealthCode H = new HealthCode();
H = ocr1(path);
String StatusNameData = "S"+H.Status + "," + H.Name + "," + H.Data+"E";
return StatusNameData;
}
/*class OCR {
//设置APPID/AK/SK
public OCR(){
}*/
public static HealthCode ocr1(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(60000);
// 可选:设置代理服务器地址, 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<String, String>());
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;
}
}

@ -1,3 +0,0 @@
Manifest-Version: 1.0
Main-Class: HealthCode

@ -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<String, String>());
//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;
}
}

@ -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

@ -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)

@ -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小时

@ -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()

@ -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

@ -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
Loading…
Cancel
Save