diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/job/task/XaAddressTask.java b/shapelight-admin/src/main/java/net/shapelight/modules/job/task/XaAddressTask.java index db95216..5def6ab 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/job/task/XaAddressTask.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/job/task/XaAddressTask.java @@ -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; } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenPackRecordEnterServiceImpl.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenPackRecordEnterServiceImpl.java index 34761d8..73886d9 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenPackRecordEnterServiceImpl.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenPackRecordEnterServiceImpl.java @@ -71,8 +71,11 @@ public class TenPackRecordEnterServiceImpl extends ServiceImpl 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()); + + } } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/xian/utils/XaUtils.java b/shapelight-admin/src/main/java/net/shapelight/modules/xian/utils/XaUtils.java index 710b8b9..675dc39 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/xian/utils/XaUtils.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/xian/utils/XaUtils.java @@ -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 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; +// } + + diff --git a/shapelight-admin/src/main/resources/mapper/ten/TenRecordDao.xml b/shapelight-admin/src/main/resources/mapper/ten/TenRecordDao.xml index 682f1d7..7bb4f1e 100644 --- a/shapelight-admin/src/main/resources/mapper/ten/TenRecordDao.xml +++ b/shapelight-admin/src/main/resources/mapper/ten/TenRecordDao.xml @@ -17,8 +17,8 @@ - - + + @@ -356,7 +356,6 @@ order by r.record_time desc - - + + 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 * from ten_record_${tenantId} where cell_id = #{cellId} and xa_sync_image = 0