parent
a794fd4f66
commit
1e9f3c1822
|
@ -64,11 +64,13 @@ public class XaAddressTask implements ITask {
|
|||
// String address = "{\"xml\":{\"data\":\"信息验证失败\"}}";
|
||||
|
||||
// String address = "{\"xml\":{\"data\":{\"NEXTPAGE\":\"END\",\"HLWTable\":[{\"@JWSID\":\"610113600000000001202\",\"@SWJID\":\"610113003012013\",\"@SSXQBM\":\"A61011304538\",\"@XZQHNAME\":\"西安市雁塔区\",\"@DZSC\":\"殴风园\",\"@DZQC\":\"陕西省西安市雁塔区长安南路439号\",\"@P_ID\":\"1544038\",\"@JLXMC\":\"长安南路\",\"@WD\":\"34.207728945844494\",\"@DZJB\":\"10\",\"@MPHLX\":\"10\",\"@XQID\":\"610113600000000004538\",\"@DZGSDW\":\"610113600000\",\"@XT_ZHXGSJ\":\"2021-03-23 16:50:08\",\"@SJ\":\"\",\"@XZQH\":\"610113\",\"@XQ\":\"欧风园小区\",\"@JD\":\"108.94238923458721\",\"@JWSMC\":\"陕师大警务室\",\"@DZDM\":\"000268000029\",\"@JLXDM\":\"000268\"},{\"@JWSID\":\"610113600000000001202\",\"@SWJID\":\"610113003012013\",\"@SSXQBM\":\"A61011304538\",\"@XZQHNAME\":\"西安市雁塔区\",\"@DZSC\":\"\",\"@DZQC\":\"陕西省西安市雁塔区长安南路439号1栋\",\"@P_ID\":\"1820578255\",\"@JLXMC\":\"长安南路\",\"@WD\":\"34.206951\",\"@DZJB\":\"11\",\"@MPHLX\":\"10\",\"@XQID\":\"610113600000000004538\",\"@DZGSDW\":\"610113600000\",\"@XT_ZHXGSJ\":\"2021-03-23 16:50:08\",\"@SJ\":\"\",\"@XZQH\":\"610113\",\"@XQ\":\"欧风园小区\",\"@JD\":\"108.942541\",\"@JWSMC\":\"陕师大警务室\",\"@DZDM\":\"000268000029000010\",\"@JLXDM\":\"000268\"}]}}}";
|
||||
log.debug("获取小区标准地址-" + cellEntity.getName() + ":返回数据" + address);
|
||||
// log.debug("获取小区标准地址-" + cellEntity.getName() + ":返回数据" + address);
|
||||
|
||||
//解析json
|
||||
String jsonAddress = address.replace(" ","");
|
||||
// log.debug("获取小区标准地址-" + cellEntity.getName() + ":返回数据" + address);
|
||||
|
||||
JSONObject xml = JSONObject.parseObject(address);
|
||||
JSONObject xml = JSONObject.parseObject(jsonAddress);
|
||||
if (xml == null) {
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -71,8 +71,11 @@ public class TenPackRecordEnterServiceImpl extends ServiceImpl<TenPackRecordEnte
|
|||
.eq("cell_id", cellId)
|
||||
.eq("xa_sync", 0)
|
||||
.isNotNull("image")
|
||||
.ne("image","")
|
||||
.isNotNull("park_code_xa")
|
||||
.ne("park_code_xa","")
|
||||
.isNotNull("channal_code_xa")
|
||||
.ne("channal_code_xa","")
|
||||
.last(" and TO_DAYS(enter_time) = TO_DAYS(NOW())"));
|
||||
}
|
||||
|
||||
|
@ -82,8 +85,11 @@ public class TenPackRecordEnterServiceImpl extends ServiceImpl<TenPackRecordEnte
|
|||
.eq("cell_id", cellId)
|
||||
.eq("xa_sync_image", 0)
|
||||
.isNotNull("image")
|
||||
.ne("image","")
|
||||
.isNotNull("park_code_xa")
|
||||
.ne("park_code_xa","")
|
||||
.isNotNull("channal_code_xa")
|
||||
.ne("channal_code_xa","")
|
||||
.eq("xa_sync", 1)
|
||||
.last(" and TO_DAYS(enter_time) = TO_DAYS(NOW())"));
|
||||
}
|
||||
|
|
|
@ -64,8 +64,11 @@ public class TenPackRecordExitServiceImpl extends ServiceImpl<TenPackRecordExitD
|
|||
.eq("cell_id",cellId)
|
||||
.eq("xa_sync",0)
|
||||
.isNotNull("image")
|
||||
.ne("image","")
|
||||
.isNotNull("park_code_xa")
|
||||
.ne("park_code_xa","")
|
||||
.isNotNull("channal_code_xa")
|
||||
.ne("channal_code_xa","")
|
||||
.last(" and TO_DAYS(exit_time) = TO_DAYS(NOW())"));
|
||||
}
|
||||
@Override
|
||||
|
@ -75,8 +78,11 @@ public class TenPackRecordExitServiceImpl extends ServiceImpl<TenPackRecordExitD
|
|||
.eq("xa_sync_image",0)
|
||||
.eq("xa_sync",1)
|
||||
.isNotNull("image")
|
||||
.ne("image","")
|
||||
.isNotNull("park_code_xa")
|
||||
.ne("park_code_xa","")
|
||||
.isNotNull("channal_code_xa")
|
||||
.ne("channal_code_xa","")
|
||||
.last(" and TO_DAYS(exit_time) = TO_DAYS(NOW())"));
|
||||
}
|
||||
}
|
|
@ -1,10 +1,9 @@
|
|||
package net.shapelight.modules.xian.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.*;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.net.URLDecoder;
|
||||
|
@ -15,10 +14,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|||
import net.shapelight.common.utils.DateUtils;
|
||||
import net.shapelight.common.utils.MD5Utils;
|
||||
import net.shapelight.common.utils.UUIDUtil;
|
||||
import net.shapelight.modules.ten.entity.TenPackChannalEntity;
|
||||
import net.shapelight.modules.ten.entity.TenPackEntity;
|
||||
import net.shapelight.modules.ten.entity.TenPackRecordEnterEntity;
|
||||
import net.shapelight.modules.ten.entity.TenTranEntity;
|
||||
import net.shapelight.modules.ten.entity.*;
|
||||
import net.shapelight.modules.xian.utils.AESUtils;
|
||||
import net.shapelight.modules.xian.utils.XaHttpUtils;
|
||||
import net.shapelight.modules.xian.utils.XaUtils;
|
||||
|
@ -375,7 +371,7 @@ public class XaApi {
|
|||
{"sta":{"code":"9999","des":"失败","ErrorLineParameter": "1 " },"datas":[{"Result":"第1条记录出错储过程出错ORA-20001 停车场不存在!lv_tccbh"}],"pages":[{"psize":"1","tcount":"1","pno":"1","tsize":"0"}]}
|
||||
*/
|
||||
|
||||
String resJson = XaApi.httpPOSTJson(apiUrl, b, "TCCTCSBXX", "TCCTCSBXX", appid, appsecret,"202104140025");
|
||||
String resJson = XaApi.httpPOSTJson(apiUrl, b, "TCCTCSBXX", "TCCTCSBXX", appid, appsecret, "202104140025");
|
||||
System.out.println(resJson);
|
||||
|
||||
}
|
||||
|
@ -386,20 +382,23 @@ public class XaApi {
|
|||
* appid: 1297164778041095
|
||||
* appsecret: 22971647780410956329716477804109
|
||||
* xqid: 610113600000000004538
|
||||
*/
|
||||
*/
|
||||
String appid = "1297164778041095";
|
||||
String appsecret = "22971647780410956329716477804109";
|
||||
|
||||
//伟丰花园:610113600000000005977 欧风园:610113600000000004538
|
||||
//西安文理学院:610113630000000010348 绿地花都:610113610000000017653
|
||||
//景苑小区 610113530000000012479
|
||||
String xqid = "610113600000000004538";
|
||||
String address = getAddress(xqid, appid, appsecret);
|
||||
System.out.println(address);
|
||||
|
||||
//解析json
|
||||
|
||||
|
||||
//6.2 获取数据对接接口---------------------------------------------------------------------------
|
||||
String apiUrl = getFwikUrl(appid, appsecret);
|
||||
System.out.println(apiUrl);
|
||||
// String apiUrl = getFwikUrl(appid, appsecret);
|
||||
// System.out.println(apiUrl);
|
||||
//6.1 获取标准地址接口---------------------------------------------------------------------------
|
||||
// String addressCell = getAddress(xqid, appid, appsecret);
|
||||
// System.out.println(addressCell);
|
||||
|
@ -422,6 +421,65 @@ public class XaApi {
|
|||
//6.3.9 车辆出入记录-------------------------------------------------------------
|
||||
// processRecordCarEnter();
|
||||
|
||||
|
||||
StringBuffer stringBuffer = new StringBuffer();
|
||||
try {
|
||||
File file = new File("/home/huangyifang/gb/社区/景苑小区.txt");
|
||||
if (file.isFile() && file.exists()) {
|
||||
InputStreamReader isr = new InputStreamReader(new FileInputStream(file), "utf-8");
|
||||
BufferedReader br = new BufferedReader(isr);
|
||||
String lineTxt = null;
|
||||
while ((lineTxt = br.readLine()) != null) {
|
||||
stringBuffer.append(lineTxt.replace(" ",""));
|
||||
}
|
||||
br.close();
|
||||
} else {
|
||||
System.out.println("文件不存在!");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println("文件读取错误!");
|
||||
}
|
||||
|
||||
|
||||
//解析json
|
||||
|
||||
JSONObject xml = JSONObject.parseObject(stringBuffer.toString());
|
||||
JSONObject data = xml.getJSONObject("xml").getJSONObject("data");
|
||||
JSONArray hlwtable = data.getJSONArray("HLWTable");
|
||||
List<TenAddressEntity> list = new ArrayList<>();
|
||||
for (int i = 0; i < hlwtable.size(); i++) {
|
||||
JSONObject object = (JSONObject) hlwtable.get(i);
|
||||
|
||||
TenAddressEntity addressEntity = new TenAddressEntity();
|
||||
addressEntity.setJwsid(object.getString("@JWSID"));
|
||||
addressEntity.setSwjid(object.getString("@SWJID"));
|
||||
addressEntity.setSsxqbm(object.getString("@SSXQBM"));
|
||||
addressEntity.setXzqhname(object.getString("@XZQHNAME"));
|
||||
addressEntity.setDzsc(object.getString("@DZSC"));
|
||||
addressEntity.setDzqc(object.getString("@DZQC"));
|
||||
addressEntity.setPId(Long.parseLong(object.getString("@P_ID")));
|
||||
addressEntity.setJlxmc(object.getString("@JLXMC"));
|
||||
addressEntity.setWd(object.getString("@WD"));
|
||||
addressEntity.setDzjb(object.getString("@DZJB"));
|
||||
addressEntity.setMphlx(object.getString("@MPHLX"));
|
||||
addressEntity.setXqid(object.getString("@XQID"));
|
||||
addressEntity.setDzgsdw(object.getString("@DZGSDW"));
|
||||
addressEntity.setXtZhxgsj(object.getString("@XT_ZHXGSJ"));
|
||||
addressEntity.setSj(object.getString("@SJ"));
|
||||
addressEntity.setXzqh(object.getString("@XZQH"));
|
||||
addressEntity.setXq(object.getString("@XQ"));
|
||||
addressEntity.setJd(object.getString("@JD"));
|
||||
addressEntity.setJwsmc(object.getString("@JWSMC"));
|
||||
addressEntity.setDzdm(object.getString("@DZDM"));
|
||||
addressEntity.setJlxdm(object.getString("@JLXDM"));
|
||||
|
||||
list.add(addressEntity);
|
||||
// tenAddressService.saveOrUpdate(addressEntity);
|
||||
}
|
||||
|
||||
System.out.println(stringBuffer.toString());
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,10 +4,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.*;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.net.URLDecoder;
|
||||
|
@ -256,6 +253,7 @@ public class XaUtils {
|
|||
*/
|
||||
public static String httpPOSTParam(String url, String appid, String secre, Map<String,String> mapParams) {
|
||||
String data = "";
|
||||
String dataOrg = "";
|
||||
try {
|
||||
URL dataurl = new URL(url);
|
||||
HttpURLConnection conn = (HttpURLConnection) dataurl.openConnection();
|
||||
|
@ -283,14 +281,35 @@ public class XaUtils {
|
|||
conn.disconnect();
|
||||
return "";
|
||||
}
|
||||
InputStream is = conn.getInputStream();
|
||||
DataInputStream dis = new DataInputStream(is);
|
||||
byte bt[] = new byte[dis.available()];
|
||||
dis.read(bt);
|
||||
data = URLDecoder.decode(new String(bt, "UTF-8"), "UTF-8");
|
||||
|
||||
|
||||
|
||||
|
||||
// InputStream is = conn.getInputStream();
|
||||
// DataInputStream dis = new DataInputStream(is);
|
||||
// byte bt[] = new byte[dis.available()];
|
||||
// dis.read(bt);
|
||||
// data = URLDecoder.decode(new String(bt, "UTF-8"), "UTF-8");
|
||||
// dataOrg = new String(bt);
|
||||
|
||||
|
||||
|
||||
|
||||
String line="";
|
||||
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
while ((line = bufferedReader.readLine()) != null)
|
||||
{
|
||||
stringBuilder.append(line);
|
||||
}
|
||||
data = stringBuilder.toString().replace(" ","");
|
||||
|
||||
|
||||
|
||||
conn.disconnect();
|
||||
is.close();
|
||||
dis.close();
|
||||
// is.close();
|
||||
// dis.close();
|
||||
bufferedReader.close();
|
||||
} catch (Exception e) {
|
||||
data = "";
|
||||
}
|
||||
|
@ -298,6 +317,79 @@ public class XaUtils {
|
|||
}
|
||||
|
||||
|
||||
//
|
||||
// public JSONArray getJSONFromUrl(String endpoint, Map params)
|
||||
// throws IOException
|
||||
// {
|
||||
// JSONArray jsonArray = null;
|
||||
// String jsonString = null;
|
||||
// HttpURLConnection conn = null;
|
||||
// String line;
|
||||
// URL url;
|
||||
// try
|
||||
// {
|
||||
// url = new URL(endpoint);
|
||||
// }
|
||||
// catch (MalformedURLException e)
|
||||
// {
|
||||
// throw new IllegalArgumentException("invalid url: " + endpoint);
|
||||
// }
|
||||
// StringBuilder bodyBuilder = new StringBuilder();
|
||||
// Iterator> iterator = params.entrySet().iterator();
|
||||
//// constructs the POST body using the parameters
|
||||
// while (iterator.hasNext())
|
||||
// {
|
||||
// Map.Entry param = iterator.next();
|
||||
// bodyBuilder.append(param.getKey()).append('=')
|
||||
// .append(param.getValue());
|
||||
// if (iterator.hasNext()) {
|
||||
// bodyBuilder.append('&');
|
||||
// }
|
||||
// }
|
||||
// String body = bodyBuilder.toString();
|
||||
// byte[] bytes = body.getBytes();
|
||||
// try {
|
||||
// conn = (HttpURLConnection) url.openConnection();
|
||||
// conn.setDoOutput(true);
|
||||
// conn.setUseCaches(false);
|
||||
// conn.setFixedLengthStreamingMode(bytes.length);
|
||||
// conn.setRequestMethod("POST");
|
||||
// conn.setRequestProperty("Content-Type","application/x-www-form-urlencoded;charset=UTF-8");
|
||||
//// post the request
|
||||
// OutputStream out = conn.getOutputStream();
|
||||
// out.write(bytes);
|
||||
// out.close();
|
||||
//// handle the response
|
||||
// int status = conn.getResponseCode();
|
||||
// if (status != 200) {
|
||||
// throw new IOException("Post failed with error code " + status);
|
||||
// }
|
||||
// BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
|
||||
// StringBuilder stringBuilder = new StringBuilder();
|
||||
// while ((line = bufferedReader.readLine()) != null)
|
||||
// {
|
||||
// stringBuilder.append(line + '\n');
|
||||
//
|
||||
// }
|
||||
// jsonString = stringBuilder.toString();
|
||||
// } catch (MalformedURLException e) {
|
||||
// e.printStackTrace();
|
||||
// } catch (ProtocolException e) {
|
||||
// e.printStackTrace();
|
||||
// } catch (IOException e) {
|
||||
// e.printStackTrace();
|
||||
// } finally {
|
||||
// conn.disconnect();
|
||||
// }
|
||||
// try {
|
||||
// jsonArray = new JSONArray(jsonString);
|
||||
// } catch (JSONException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// return jsonArray;
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
<result property="recordTime" column="record_time"/>
|
||||
<result property="score" column="score"/>
|
||||
<result property="tenantId" column="tenant_id"/>
|
||||
<result column="xa_sync" jdbcType="TINYINT" property="xaSync" />
|
||||
<result column="xa_sync_image" jdbcType="TINYINT" property="xaSyncImage" />
|
||||
<result column="xa_sync" jdbcType="TINYINT" property="xaSync"/>
|
||||
<result column="xa_sync_image" jdbcType="TINYINT" property="xaSyncImage"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
|
@ -356,7 +356,6 @@
|
|||
order by r.record_time desc
|
||||
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
<select id="findPageRoomRecord" resultMap="tenRecordMap">
|
||||
|
@ -382,7 +381,7 @@
|
|||
|
||||
select r.*,t.name from ten_record_${params.tenantId} r
|
||||
left join ten_person t on r.person_id = t.person_id
|
||||
where 1=1
|
||||
where 1=1
|
||||
<if test="params.cellId != null and params.cellId!=''">
|
||||
and r.cell_id = #{params.cellId}
|
||||
</if>
|
||||
|
@ -408,15 +407,20 @@
|
|||
order by record_time desc limit 1
|
||||
</select>
|
||||
|
||||
<select id="getNotSync" resultType="net.shapelight.modules.ten.entity.TenRecordEntity">
|
||||
select * from ten_record_${tenantId}
|
||||
where cell_id = #{cellId}
|
||||
and xa_sync = 0
|
||||
and record_face is not null
|
||||
and TO_DAYS(record_time) = TO_DAYS(NOW())
|
||||
<select id="getNotSync" resultType="net.shapelight.modules.ten.entity.TenRecordEntity">
|
||||
|
||||
select tr.* from ten_record_${tenantId} tr left join ten_person tp
|
||||
on tr.person_id = tp.person_id
|
||||
where tr.cell_id = #{cellId}
|
||||
and tr.xa_sync = 0
|
||||
and tr.record_face is not null
|
||||
and TO_DAYS(tr.record_time) = TO_DAYS(NOW())
|
||||
and tp.xa_sync_card = 1
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
<select id="getNotSyncImage" resultType="net.shapelight.modules.ten.entity.TenRecordEntity">
|
||||
<select id="getNotSyncImage" resultType="net.shapelight.modules.ten.entity.TenRecordEntity">
|
||||
select * from ten_record_${tenantId}
|
||||
where cell_id = #{cellId}
|
||||
and xa_sync_image = 0
|
||||
|
|
Loading…
Reference in New Issue