From bbeec0ecf6530545d6ecfd1076da4e427ee2cd5a Mon Sep 17 00:00:00 2001 From: gaoben Date: Wed, 28 Apr 2021 18:01:26 +0800 Subject: [PATCH] =?UTF-8?q?v2.0.2=201.=E4=BF=AE=E6=94=B9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- .../app/controller/AppApiController.java | 24 +- .../modules/car/controller/CarOpenApi.java | 30 +- .../modules/job/task/XaAddressTask.java | 6 +- .../modules/job/task/XaImageTask.java | 502 +++++++++--------- .../modules/job/task/XaRealDataTask.java | 20 +- .../modules/job/task/XaRecordTask.java | 44 +- .../ten/controller/TenBuildController.java | 3 + .../service/impl/TenDeviceServiceImpl.java | 123 +++-- .../modules/xian/service/XaApi.java | 13 +- 10 files changed, 415 insertions(+), 352 deletions(-) diff --git a/pom.xml b/pom.xml index c5ebfb9..72a0c76 100644 --- a/pom.xml +++ b/pom.xml @@ -31,7 +31,7 @@ 2.9.0 1.1.13 3.1.2 - 8.0.16 + 8.0.19 4.0 11.2.0.3 2.6 diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/app/controller/AppApiController.java b/shapelight-admin/src/main/java/net/shapelight/modules/app/controller/AppApiController.java index 198503c..2274214 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/app/controller/AppApiController.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/app/controller/AppApiController.java @@ -222,6 +222,9 @@ public class AppApiController { //Map params = new HashMap<>(); // params.put("tenantId",tenantId+""); List buildList = tenBuildService.selectByCellId(cellId); + for(TenBuildEntity buildEntity: buildList){ + buildEntity.setName(buildEntity.getName()+buildEntity.getUnit()+"单元"); + } return R.ok().put("data", buildList); } @@ -668,15 +671,18 @@ public class AppApiController { } AppUserScopeEntity scope = appUserScopeService.getById(user.getCurrentScopeId()); //不能删除自己 - for (Map param : params) { - Long personId = Long.parseLong(param.get("personId")); - Long cellId = Long.parseLong(param.get("cellId")); - if(scope.getPersonId().longValue() == personId.longValue()){ - return R.error("不能删除自己"); - } - TenPersonEntity personEntity = tenPersonService.getById(personId,cellId); - if(scope.getRoleId().intValue()>personEntity.getPersonType().intValue()){ - return R.error("您无权删除"+personEntity.getName()); + if (scope.getRoleId().intValue() != Constant.ROLE_TEN_CELL) { + //住户,家属 + for (Map param : params) { + Long personId = Long.parseLong(param.get("personId")); + Long cellId = Long.parseLong(param.get("cellId")); + if(scope.getPersonId().longValue() == personId.longValue()){ + return R.error("不能删除自己"); + } + TenPersonEntity personEntity = tenPersonService.getById(personId,cellId); + if(scope.getRoleId().intValue()>personEntity.getPersonType().intValue()){ + return R.error("您无权删除"+personEntity.getName()); + } } } tenPersonService.removeByIdList(params); diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/car/controller/CarOpenApi.java b/shapelight-admin/src/main/java/net/shapelight/modules/car/controller/CarOpenApi.java index af0debd..7fef292 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/car/controller/CarOpenApi.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/car/controller/CarOpenApi.java @@ -1,6 +1,7 @@ package net.shapelight.modules.car.controller; import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import io.minio.MinioClient; import io.minio.PutObjectOptions; import io.swagger.annotations.Api; @@ -23,14 +24,8 @@ import java.util.Map; import net.shapelight.common.config.GlobalValue; import net.shapelight.common.config.MinioConfig; import net.shapelight.common.utils.*; -import net.shapelight.modules.ten.entity.TenCarEntity; -import net.shapelight.modules.ten.entity.TenPackRecordEnterEntity; -import net.shapelight.modules.ten.entity.TenPackRecordEntity; -import net.shapelight.modules.ten.entity.TenPackRecordExitEntity; -import net.shapelight.modules.ten.service.TenCarService; -import net.shapelight.modules.ten.service.TenPackRecordEnterService; -import net.shapelight.modules.ten.service.TenPackRecordExitService; -import net.shapelight.modules.ten.service.TenPackRecordService; +import net.shapelight.modules.ten.entity.*; +import net.shapelight.modules.ten.service.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -70,6 +65,9 @@ public class CarOpenApi { @Autowired private TenPackRecordExitService tenPackRecordExitService; + @Autowired + private TenPackService tenPackService; + @PostMapping({"/getMsg/{cellId}"}) @ApiOperation("获取MSG") @ApiImplicitParams({@ApiImplicitParam(name = "sn", value = "设备sn", paramType = "query", dataType = "String", required = true)}) @@ -304,6 +302,8 @@ public class CarOpenApi { */ + //https://c.xitu3d.com:1002/cell/api/car/v1/pushCarRecord + @PostMapping({"/pushCarRecord"}) @ApiOperation("第三方推送") public Map pushCarRecord(@RequestBody Object object) { @@ -379,6 +379,16 @@ public class CarOpenApi { httpUrl.disconnect(); } } + + // + Long cellId = null; + Long tenantId = null; + TenPackEntity packEntity = tenPackService.getOne(new QueryWrapper() + .eq("park_code",parkCode)); + if(packEntity!=null){ + cellId = packEntity.getCellId(); + tenantId = packEntity.getTenantId(); + } if (serviceName.equals("enter")) { long enterTimeLong = bizContent.getLongValue("enterTime"); Date enterTime = new Date(enterTimeLong * 1000L); @@ -391,6 +401,8 @@ public class CarOpenApi { enter.setType(Integer.valueOf(type)); enter.setCarType(Integer.valueOf(carType)); enter.setEnterTime(enterTime); + enter.setCellId(cellId); + enter.setTenantId(tenantId); if (fileName.length() > 0) enter.setImage(fileName); this.tenPackRecordEnterService.save(enter); @@ -408,6 +420,8 @@ public class CarOpenApi { exit.setCarType(Integer.valueOf(carType)); exit.setExitTime(exitTime); exit.setPackTime(Long.valueOf(parkTime)); + exit.setCellId(cellId); + exit.setTenantId(tenantId); if (fileName.length() > 0) exit.setImage(fileName); this.tenPackRecordExitService.save(exit); 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 01c3f1c..db95216 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 @@ -60,10 +60,10 @@ public class XaAddressTask implements ITask { if (xqid != null && xqid.length() > 0) { //调用第三方接口获取所有信息 //6.1 获取标准地址接口--------------------------------------------------------------------------- -// String address = XaApi.getAddress(xqid, appId, appSecret); -// String address = "{\"xml\":{\"data\":\"信息验证失败\"}}"; + String address = XaApi.getAddress(xqid, appId, appSecret); +// 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\"}]}}}"; +// 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); //解析json diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/job/task/XaImageTask.java b/shapelight-admin/src/main/java/net/shapelight/modules/job/task/XaImageTask.java index 9ee8c7d..293f95f 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/job/task/XaImageTask.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/job/task/XaImageTask.java @@ -56,6 +56,14 @@ public class XaImageTask implements ITask { private TenAddressService tenAddressService; @Autowired private TenTranService tenTranService; + @Autowired + private TenPackRecordEnterService tenPackRecordEnterService; + @Autowired + private TenPackRecordExitService tenPackRecordExitService; + @Autowired + private TenPackService tenPackService; + @Autowired + private TenPackChannalService tenPackChannalService; public void run(String params) { log.debug("xaImageTask定时任务正在执行", params); @@ -77,10 +85,14 @@ public class XaImageTask implements ITask { String xqid = cellEntity.getThirdId(); Long cellId = cellEntity.getCellId(); if (xqid == null || xqid.length() > 0){ - //人员 + //人员记录图片 processRecordPersonImage(appId, appSecret, xqid, fwikUrl, cellId,tenantId); - // + //人员图片 processRealPersonImage(appId, appSecret, xqid, fwikUrl, cellId); + //车辆进入图片 + processRecordCarEnterImage(appId, appSecret, xqid, fwikUrl, cellId); + //车辆离开图片 + processRecordCarExitImage(appId, appSecret, xqid, fwikUrl, cellId); } } } @@ -104,55 +116,57 @@ public class XaImageTask implements ITask { TenAddressEntity addressEntity = tenAddressService.getOne(new QueryWrapper() .eq("xqid", xqid).last("LIMIT 1")); - String ssxqbm = addressEntity.getSsxqbm(); + if(addressEntity!=null){ + String ssxqbm = addressEntity.getSsxqbm(); - syncRecord.setLV_SSXQBM(ssxqbm); //小区申报编码 - syncRecord.setLV_ZPSJ(DateUtils.format(record.getRecordTime(), "yyyyMMddHHmmss")); - syncRecord.setLV_MJXTWYBM(record.getRecordId() + "");//出入记录主键 + syncRecord.setLV_SSXQBM(ssxqbm); //小区申报编码 + syncRecord.setLV_ZPSJ(DateUtils.format(record.getRecordTime(), "yyyyMMddHHmmss")); + syncRecord.setLV_MJXTWYBM(record.getRecordId() + "");//出入记录主键 - String base64Image = ""; - InputStream inStream = null; - ByteArrayOutputStream outStream = null; + String base64Image = ""; + InputStream inStream = null; + ByteArrayOutputStream outStream = null; - try { - minioClient.statObject(minioConfig.getBucketName(), record.getRecordFace()); + try { + minioClient.statObject(minioConfig.getBucketName(), record.getRecordFace()); - inStream = minioClient.getObject(minioConfig.getBucketName(), record.getRecordFace()); - outStream = new ByteArrayOutputStream(); - byte[] buffer = new byte[1024]; - int length; - while ((length = inStream.read(buffer)) != -1) { - outStream.write(buffer, 0, length); - } - base64Image = Base64.getEncoder().encodeToString(outStream.toByteArray()); - } catch (Exception e) { - log.error("照片不存在:" + record.getRecordFace()); - e.printStackTrace(); - } finally { - if (inStream != null) { - try { - inStream.close(); - } catch (IOException e) { - log.error("inputStream close IOException:" + e.getMessage()); + inStream = minioClient.getObject(minioConfig.getBucketName(), record.getRecordFace()); + outStream = new ByteArrayOutputStream(); + byte[] buffer = new byte[1024]; + int length; + while ((length = inStream.read(buffer)) != -1) { + outStream.write(buffer, 0, length); + } + base64Image = Base64.getEncoder().encodeToString(outStream.toByteArray()); + } catch (Exception e) { + log.error("照片不存在:" + record.getRecordFace()); + e.printStackTrace(); + } finally { + if (inStream != null) { + try { + inStream.close(); + } catch (IOException e) { + log.error("inputStream close IOException:" + e.getMessage()); + } + } + if (outStream != null) { + try { + outStream.close(); + } catch (IOException e) { + log.error("outStream close IOException:" + e.getMessage()); + } } } - if (outStream != null) { - try { - outStream.close(); - } catch (IOException e) { - log.error("outStream close IOException:" + e.getMessage()); - } + if (base64Image.length() == 0) { + continue; } + syncRecord.setLV_ZPZP(base64Image);//base64图片 + syncRecords.add(syncRecord); + updateRecords.add(record); + count++; + if (count >= 30) + break; } - if (base64Image.length() == 0) { - continue; - } - syncRecord.setLV_ZPZP(base64Image);//base64图片 - syncRecords.add(syncRecord); - updateRecords.add(record); - count++; - if (count >= 30) - break; } if(count == 0){ return; @@ -174,8 +188,8 @@ public class XaImageTask implements ITask { TenTranEntity tranEntity = tenTranService.saveApi(fwikUrl,"","RYJCZPXX", "RYJCZPXX", appId, appSecret); String tranId = String.format("%s%016d",DateUtils.format(tranEntity.getTranDate(),"yyyyMMddHHmmss"),tranEntity.getTranId()); -// String resJson = XaApi.httpPOSTJson(fwikUrl, enJson, "RYJCZPXX", "RYJCZPXX", appId, appSecret,tranId); - String resJson = "{\"sta\":{\"code\":\"0000\",\"des\":\"成功\",\"ErrorLineParameter\":\"empty\"},\"datas\":[{\"Result\":\"接收成功\"}],\"pages\":[{\"psize\":\"1\",\"tcount\":\"1\",\"pno\":\"1\",\"tsize\":\"0\"}]}"; + String resJson = XaApi.httpPOSTJson(fwikUrl, enJson, "RYJCZPXX", "RYJCZPXX", appId, appSecret,tranId); +// String resJson = "{\"sta\":{\"code\":\"0000\",\"des\":\"成功\",\"ErrorLineParameter\":\"empty\"},\"datas\":[{\"Result\":\"接收成功\"}],\"pages\":[{\"psize\":\"1\",\"tcount\":\"1\",\"pno\":\"1\",\"tsize\":\"0\"}]}"; // String resJson = "23232"; // System.out.println(s); log.debug("上传人员识别记录返回数据:" + resJson); @@ -190,156 +204,163 @@ public class XaImageTask implements ITask { } } -// private void processRecordCarEnterImage(String appId, String appSecret, String xqid, String fwikUrl, Long cellId) { -// List records = this.tenPackRecordEnterService.getNotSync(cellId); -// List syncRecords = new ArrayList(); -// List updateRecords = new ArrayList<>(); -// int count = 0; -// for (TenPackRecordEnterEntity record : records) { -// XaTCCTCSBXX syncRecord = new XaTCCTCSBXX(); -// -// TenPackEntity packEntity = tenPackService.getOne(new QueryWrapper() -// .eq("park_code",record.getParkCode())); -// -// if(packEntity==null){ -// continue; -// } -// String packCodeXa = packEntity.getParkCodeXa(); -// if(packCodeXa==null || packCodeXa.length()==0){ -// continue; -// } -// -// TenPackChannalEntity channalEntity = tenPackChannalService.getOne(new QueryWrapper() -// .eq("channal_name",record.getChannelName())); -// if(channalEntity==null){ -// continue; -// } -// String channalCodeXa = channalEntity.getChannalCodeXa(); -// if(channalCodeXa==null || channalCodeXa.length()==0){ -// continue; -// } -// -// -// syncRecord.setLV_TCCBH(packCodeXa); -// syncRecord.setLV_CPHM(record.getPlateNumber()); -// syncRecord.setLV_CPLX("03");//01 大型汽车号牌 2 小型汽车号牌 03 使馆汽车号牌 04 领馆汽车号牌 -// syncRecord.setLV_GCSJ(DateUtils.format(record.getEnterTime(), "yyyyMMddHHmmss")); -// syncRecord.setLV_GCLX("1");//1进场2出场 -// syncRecord.setLV_JKBM(record.getRecordEnterId()+""); -// syncRecord.setLV_SBXT("10");//申报系统,默认10 -// syncRecord.setLV_KKSBBH(channalCodeXa); -// syncRecord.setLV_PROCMODE("PMINSERT"); -// -// syncRecords.add(syncRecord); -// updateRecords.add(record); -// count++; -// if (count >= 30) -// break; -// } -// XaData jsonData = new XaData(); -// jsonData.setDatas(syncRecords); -// -// List listPages = new ArrayList<>(); -// XaPages pages = new XaPages(); -// pages.setPno("1"); -// pages.setPsize("1"); -// listPages.add(pages); -// jsonData.setPages(listPages); -// -// String json = JSONObject.toJSONString(jsonData); -// -// String enJson = XaUtils.encryptStr(json.trim(), appSecret); -// -//// String resJson = XaApi.httpPOSTJson(fwikUrl, enJson, "TCCTCSBXX", "TCCTCSBXX", appId, appSecret); -//// String resJson = "{\"sta\":{\"code\":\"0000\",\"des\":\"成功\",\"ErrorLineParameter\":\"empty\"},\"datas\":[{\"Result\":\"接收成功\"}],\"pages\":[{\"psize\":\"1\",\"tcount\":\"1\",\"pno\":\"1\",\"tsize\":\"0\"}]}"; + private void processRecordCarEnterImage(String appId, String appSecret, String xqid, String fwikUrl, Long cellId) { + List records = this.tenPackRecordEnterService.getNotSync(cellId); + List syncRecords = new ArrayList(); + List updateRecords = new ArrayList<>(); + int count = 0; + for (TenPackRecordEnterEntity record : records) { + XaTCCTCSBXX syncRecord = new XaTCCTCSBXX(); + + TenPackEntity packEntity = tenPackService.getOne(new QueryWrapper() + .eq("park_code",record.getParkCode())); + + if(packEntity==null){ + continue; + } + String packCodeXa = packEntity.getParkCodeXa(); + if(packCodeXa==null || packCodeXa.length()==0){ + continue; + } + + TenPackChannalEntity channalEntity = tenPackChannalService.getOne(new QueryWrapper() + .eq("channal_name",record.getChannelName())); + if(channalEntity==null){ + continue; + } + String channalCodeXa = channalEntity.getChannalCodeXa(); + if(channalCodeXa==null || channalCodeXa.length()==0){ + continue; + } + + + syncRecord.setLV_TCCBH(packCodeXa); + syncRecord.setLV_CPHM(record.getPlateNumber()); + syncRecord.setLV_CPLX("03");//01 大型汽车号牌 2 小型汽车号牌 03 使馆汽车号牌 04 领馆汽车号牌 + syncRecord.setLV_GCSJ(DateUtils.format(record.getEnterTime(), "yyyyMMddHHmmss")); + syncRecord.setLV_GCLX("1");//1进场2出场 + syncRecord.setLV_JKBM(record.getRecordEnterId()+""); + syncRecord.setLV_SBXT("10");//申报系统,默认10 + syncRecord.setLV_KKSBBH(channalCodeXa); + syncRecord.setLV_PROCMODE("PMINSERT"); + + syncRecords.add(syncRecord); + updateRecords.add(record); + count++; + if (count >= 30) + break; + } + XaData jsonData = new XaData(); + jsonData.setDatas(syncRecords); + + List listPages = new ArrayList<>(); + XaPages pages = new XaPages(); + pages.setPno("1"); + pages.setPsize("1"); + listPages.add(pages); + jsonData.setPages(listPages); + + String json = JSONObject.toJSONString(jsonData); + + String enJson = XaUtils.encryptStr(json.trim(), appSecret); + + TenTranEntity tranEntity = tenTranService.saveApi(fwikUrl,"","TCCTCSBXX", "TCCTCSBXX", appId, appSecret); + String tranId = String.format("%s%016d",DateUtils.format(tranEntity.getTranDate(),"yyyyMMddHHmmss"),tranEntity.getTranId()); + + String resJson = XaApi.httpPOSTJson(fwikUrl, enJson, "TCCTCSBXX", "TCCTCSBXX", appId, appSecret,tranId); +// String resJson = "{\"sta\":{\"code\":\"0000\",\"des\":\"成功\",\"ErrorLineParameter\":\"empty\"},\"datas\":[{\"Result\":\"接收成功\"}],\"pages\":[{\"psize\":\"1\",\"tcount\":\"1\",\"pno\":\"1\",\"tsize\":\"0\"}]}"; // String resJson = "23232"; -//// System.out.println(s); -// log.debug("上传车辆进场记录返回数据:" + resJson); -// //上传成功,修改sync状态 -// if (resJson.contains("\"code\":\"0000\"")) { -// for (TenPackRecordEnterEntity recordEntity : updateRecords) { -// recordEntity.setXaSync(1); -// tenPackRecordEnterService.updateById(recordEntity); -// } -// } -// } -// -// -// -// -// private void processRecordCarExitImage(String appId, String appSecret, String xqid, String fwikUrl, Long cellId) { -// List records = this.tenPackRecordExitService.getNotSync(cellId); -// List syncRecords = new ArrayList(); -// List updateRecords = new ArrayList<>(); -// int count = 0; -// for (TenPackRecordExitEntity record : records) { -// XaTCCTCSBXXEXIT syncRecord = new XaTCCTCSBXXEXIT(); -// -// TenPackEntity packEntity = tenPackService.getOne(new QueryWrapper() -// .eq("park_code",record.getParkCode())); -// -// if(packEntity==null){ -// continue; -// } -// String packCodeXa = packEntity.getParkCodeXa(); -// if(packCodeXa==null || packCodeXa.length()==0){ -// continue; -// } -// -// TenPackChannalEntity channalEntity = tenPackChannalService.getOne(new QueryWrapper() -// .eq("channal_name",record.getChannelName())); -// if(channalEntity==null){ -// continue; -// } -// String channalCodeXa = channalEntity.getChannalCodeXa(); -// if(channalCodeXa==null || channalCodeXa.length()==0){ -// continue; -// } -// -// -// syncRecord.setLV_TCCBH(packCodeXa); -// syncRecord.setLV_CPHM(record.getPlateNumber()); -// syncRecord.setLV_CPLX("03");//01 大型汽车号牌 2 小型汽车号牌 03 使馆汽车号牌 04 领馆汽车号牌 -// syncRecord.setLV_GCSJ(DateUtils.format(record.getExitTime(), "yyyyMMddHHmmss")); -// syncRecord.setLV_GCLX("1");//1进场2出场 -// syncRecord.setLV_CKBM(record.getRecordExitId()+""); -// syncRecord.setLV_SBXT("10");//申报系统,默认10 -// syncRecord.setLV_KKSBBH(channalCodeXa); -// syncRecord.setLV_PROCMODE("PMINSERT"); -// -// syncRecords.add(syncRecord); -// updateRecords.add(record); -// count++; -// if (count >= 30) -// break; -// } -// XaData jsonData = new XaData(); -// jsonData.setDatas(syncRecords); -// -// List listPages = new ArrayList<>(); -// XaPages pages = new XaPages(); -// pages.setPno("1"); -// pages.setPsize("1"); -// listPages.add(pages); -// jsonData.setPages(listPages); -// -// String json = JSONObject.toJSONString(jsonData); -// -// String enJson = XaUtils.encryptStr(json.trim(), appSecret); -// -//// String resJson = XaApi.httpPOSTJson(fwikUrl, enJson, "TCCTCSBXX", "TCCTCSBXX", appId, appSecret); -//// String resJson = "{\"sta\":{\"code\":\"0000\",\"des\":\"成功\",\"ErrorLineParameter\":\"empty\"},\"datas\":[{\"Result\":\"接收成功\"}],\"pages\":[{\"psize\":\"1\",\"tcount\":\"1\",\"pno\":\"1\",\"tsize\":\"0\"}]}"; +// System.out.println(s); + log.debug("上传车辆进场记录返回数据:" + resJson); + //上传成功,修改sync状态 + if (resJson.contains("\"code\":\"0000\"")) { + for (TenPackRecordEnterEntity recordEntity : updateRecords) { + recordEntity.setXaSync(1); + tenPackRecordEnterService.updateById(recordEntity); + } + } + } + + + + + private void processRecordCarExitImage(String appId, String appSecret, String xqid, String fwikUrl, Long cellId) { + List records = this.tenPackRecordExitService.getNotSync(cellId); + List syncRecords = new ArrayList(); + List updateRecords = new ArrayList<>(); + int count = 0; + for (TenPackRecordExitEntity record : records) { + XaTCCTCSBXXEXIT syncRecord = new XaTCCTCSBXXEXIT(); + + TenPackEntity packEntity = tenPackService.getOne(new QueryWrapper() + .eq("park_code",record.getParkCode())); + + if(packEntity==null){ + continue; + } + String packCodeXa = packEntity.getParkCodeXa(); + if(packCodeXa==null || packCodeXa.length()==0){ + continue; + } + + TenPackChannalEntity channalEntity = tenPackChannalService.getOne(new QueryWrapper() + .eq("channal_name",record.getChannelName())); + if(channalEntity==null){ + continue; + } + String channalCodeXa = channalEntity.getChannalCodeXa(); + if(channalCodeXa==null || channalCodeXa.length()==0){ + continue; + } + + + syncRecord.setLV_TCCBH(packCodeXa); + syncRecord.setLV_CPHM(record.getPlateNumber()); + syncRecord.setLV_CPLX("03");//01 大型汽车号牌 2 小型汽车号牌 03 使馆汽车号牌 04 领馆汽车号牌 + syncRecord.setLV_GCSJ(DateUtils.format(record.getExitTime(), "yyyyMMddHHmmss")); + syncRecord.setLV_GCLX("1");//1进场2出场 + syncRecord.setLV_CKBM(record.getRecordExitId()+""); + syncRecord.setLV_SBXT("10");//申报系统,默认10 + syncRecord.setLV_KKSBBH(channalCodeXa); + syncRecord.setLV_PROCMODE("PMINSERT"); + + syncRecords.add(syncRecord); + updateRecords.add(record); + count++; + if (count >= 30) + break; + } + XaData jsonData = new XaData(); + jsonData.setDatas(syncRecords); + + List listPages = new ArrayList<>(); + XaPages pages = new XaPages(); + pages.setPno("1"); + pages.setPsize("1"); + listPages.add(pages); + jsonData.setPages(listPages); + + String json = JSONObject.toJSONString(jsonData); + + String enJson = XaUtils.encryptStr(json.trim(), appSecret); + + TenTranEntity tranEntity = tenTranService.saveApi(fwikUrl,"","TCCTCSBXX", "TCCTCSBXX", appId, appSecret); + String tranId = String.format("%s%016d",DateUtils.format(tranEntity.getTranDate(),"yyyyMMddHHmmss"),tranEntity.getTranId()); + + + String resJson = XaApi.httpPOSTJson(fwikUrl, enJson, "TCCTCSBXX", "TCCTCSBXX", appId, appSecret,tranId); +// String resJson = "{\"sta\":{\"code\":\"0000\",\"des\":\"成功\",\"ErrorLineParameter\":\"empty\"},\"datas\":[{\"Result\":\"接收成功\"}],\"pages\":[{\"psize\":\"1\",\"tcount\":\"1\",\"pno\":\"1\",\"tsize\":\"0\"}]}"; // String resJson = "23232"; -//// System.out.println(s); -// log.debug("上传车辆进场记录返回数据:" + resJson); -// //上传成功,修改sync状态 -// if (resJson.contains("\"code\":\"0000\"")) { -// for (TenPackRecordExitEntity recordEntity : updateRecords) { -// recordEntity.setXaSync(1); -// tenPackRecordExitService.updateById(recordEntity); -// } -// } -// } +// System.out.println(s); + log.debug("上传车辆进场记录返回数据:" + resJson); + //上传成功,修改sync状态 + if (resJson.contains("\"code\":\"0000\"")) { + for (TenPackRecordExitEntity recordEntity : updateRecords) { + recordEntity.setXaSync(1); + tenPackRecordExitService.updateById(recordEntity); + } + } + } private void processRealPersonImage(String appId, String appSecret, String xqid, String fwikUrl, Long cellId) { @@ -352,60 +373,61 @@ public class XaImageTask implements ITask { TenRoomEntity roomEntity = tenRoomService.getById(person.getRoomId(), person.getCellId()); TenAddressEntity addressEntity = tenAddressService.getById(roomEntity.getPId()); - realPerson.setLV_CASE_ID(person.getUuid()); //实有人口编码 - realPerson.setLV_GMSFHM(person.getIdCard()); //身份证号 - realPerson.setLV_DJSJ(DateUtils.format(new Date(), "yyyyMMddHHmmss")); - realPerson.setLV_SSXQBM(addressEntity.getSsxqbm()); + if(addressEntity!=null){ + realPerson.setLV_CASE_ID(person.getUuid()); //实有人口编码 + realPerson.setLV_GMSFHM(person.getIdCard()); //身份证号 + realPerson.setLV_DJSJ(DateUtils.format(new Date(), "yyyyMMddHHmmss")); + realPerson.setLV_SSXQBM(addressEntity.getSsxqbm()); - String base64Image = ""; - InputStream inStream = null; - ByteArrayOutputStream outStream = null; + String base64Image = ""; + InputStream inStream = null; + ByteArrayOutputStream outStream = null; - try { - minioClient.statObject(minioConfig.getBucketName(), person.getOrgImage()); + try { + minioClient.statObject(minioConfig.getBucketName(), person.getOrgImage()); - inStream = minioClient.getObject(minioConfig.getBucketName(), person.getOrgImage()); - outStream = new ByteArrayOutputStream(); - byte[] buffer = new byte[1024]; - int length; - while ((length = inStream.read(buffer)) != -1) { - outStream.write(buffer, 0, length); - } - base64Image = Base64.getEncoder().encodeToString(outStream.toByteArray()); - } catch (Exception e) { - log.error("照片不存在:" + person.getOrgImage()); - e.printStackTrace(); - } finally { - if (inStream != null) { - try { - inStream.close(); - } catch (IOException e) { - log.error("inputStream close IOException:" + e.getMessage()); + inStream = minioClient.getObject(minioConfig.getBucketName(), person.getOrgImage()); + outStream = new ByteArrayOutputStream(); + byte[] buffer = new byte[1024]; + int length; + while ((length = inStream.read(buffer)) != -1) { + outStream.write(buffer, 0, length); + } + base64Image = Base64.getEncoder().encodeToString(outStream.toByteArray()); + } catch (Exception e) { + log.error("照片不存在:" + person.getOrgImage()); + e.printStackTrace(); + } finally { + if (inStream != null) { + try { + inStream.close(); + } catch (IOException e) { + log.error("inputStream close IOException:" + e.getMessage()); + } + } + if (outStream != null) { + try { + outStream.close(); + } catch (IOException e) { + log.error("outStream close IOException:" + e.getMessage()); + } } } - if (outStream != null) { - try { - outStream.close(); - } catch (IOException e) { - log.error("outStream close IOException:" + e.getMessage()); - } + + if (base64Image.length() == 0) { + continue; } + + realPerson.setLV_ZP(base64Image); + + syncPersons.add(realPerson); + updatePersons.add(person); + + + count++; + if (count >= 50) + break; } - - if (base64Image.length() == 0) { - continue; - } - - realPerson.setLV_ZP(base64Image); - - syncPersons.add(realPerson); - updatePersons.add(person); - - - count++; - if (count >= 50) - break; - } if(count == 0){ return; diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/job/task/XaRealDataTask.java b/shapelight-admin/src/main/java/net/shapelight/modules/job/task/XaRealDataTask.java index d550e6b..e89ac26 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/job/task/XaRealDataTask.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/job/task/XaRealDataTask.java @@ -54,8 +54,8 @@ public class XaRealDataTask implements ITask { String appSecret = object.getString("appSecret"); //6.2 获取数据对接接口--------------------------------------------------------------------------- -// String fwikUrl = XaApi.getFwikUrl(appId, appSecret); - String fwikUrl = "http://"; + String fwikUrl = XaApi.getFwikUrl(appId, appSecret); +// String fwikUrl = "http://"; if (fwikUrl != null) { List allCells = this.tenCellService.list((Wrapper) (new QueryWrapper()) @@ -160,8 +160,8 @@ public class XaRealDataTask implements ITask { TenTranEntity tranEntity = tenTranService.saveApi(fwikUrl,jsonData,"SYFW", "SYFW", appId, appSecret); String tranId = String.format("%s%016d",DateUtils.format(tranEntity.getTranDate(),"yyyyMMddHHmmss"),tranEntity.getTranId()); -// String resJson = XaApi.httpPOSTJson(fwikUrl, enJson, "SYFW", "SYFW", appId, appSecret,tranId); - String resJson = "{\"sta\":{\"code\":\"0000\",\"des\":\"成功\",\"ErrorLineParameter\":\"empty\"},\"datas\":[{\"Result\":\"接收成功\"}],\"pages\":[{\"psize\":\"1\",\"tcount\":\"1\",\"pno\":\"1\",\"tsize\":\"0\"}]}"; + String resJson = XaApi.httpPOSTJson(fwikUrl, enJson, "SYFW", "SYFW", appId, appSecret,tranId); +// String resJson = "{\"sta\":{\"code\":\"0000\",\"des\":\"成功\",\"ErrorLineParameter\":\"empty\"},\"datas\":[{\"Result\":\"接收成功\"}],\"pages\":[{\"psize\":\"1\",\"tcount\":\"1\",\"pno\":\"1\",\"tsize\":\"0\"}]}"; // String resJson = "23232"; // System.out.println(s); log.debug("上传实有房屋返回数据:" + resJson); @@ -245,8 +245,8 @@ public class XaRealDataTask implements ITask { TenTranEntity tranEntity = tenTranService.saveApi(fwikUrl,jsonData,"SYRK", "SYRK", appId, appSecret); String tranId = String.format("%s%016d",DateUtils.format(tranEntity.getTranDate(),"yyyyMMddHHmmss"),tranEntity.getTranId()); -// String resJson = XaApi.httpPOSTJson(fwikUrl, enJson, "SYRK", "SYRK", appId, appSecret,tranId); - String resJson = "{\"sta\":{\"code\":\"0000\",\"des\":\"成功\",\"ErrorLineParameter\":\"empty\"},\"datas\":[{\"Result\":\"接收成功\"}],\"pages\":[{\"psize\":\"1\",\"tcount\":\"1\",\"pno\":\"1\",\"tsize\":\"0\"}]}"; + String resJson = XaApi.httpPOSTJson(fwikUrl, enJson, "SYRK", "SYRK", appId, appSecret,tranId); +// String resJson = "{\"sta\":{\"code\":\"0000\",\"des\":\"成功\",\"ErrorLineParameter\":\"empty\"},\"datas\":[{\"Result\":\"接收成功\"}],\"pages\":[{\"psize\":\"1\",\"tcount\":\"1\",\"pno\":\"1\",\"tsize\":\"0\"}]}"; // String resJson = "23232"; // System.out.println(s); log.debug("上传实有房屋返回数据:" + resJson); @@ -308,8 +308,8 @@ public class XaRealDataTask implements ITask { TenTranEntity tranEntity = tenTranService.saveApi(fwikUrl,jsonData,"MJKXX", "MJKXX", appId, appSecret); String tranId = String.format("%s%016d",DateUtils.format(tranEntity.getTranDate(),"yyyyMMddHHmmss"),tranEntity.getTranId()); -// String resJson = XaApi.httpPOSTJson(fwikUrl, enJson, "MJKXX", "MJKXX", appId, appSecret,tranId); - String resJson = "{\"sta\":{\"code\":\"0000\",\"des\":\"成功\",\"ErrorLineParameter\":\"empty\"},\"datas\":[{\"Result\":\"接收成功\"}],\"pages\":[{\"psize\":\"1\",\"tcount\":\"1\",\"pno\":\"1\",\"tsize\":\"0\"}]}"; + String resJson = XaApi.httpPOSTJson(fwikUrl, enJson, "MJKXX", "MJKXX", appId, appSecret,tranId); +// String resJson = "{\"sta\":{\"code\":\"0000\",\"des\":\"成功\",\"ErrorLineParameter\":\"empty\"},\"datas\":[{\"Result\":\"接收成功\"}],\"pages\":[{\"psize\":\"1\",\"tcount\":\"1\",\"pno\":\"1\",\"tsize\":\"0\"}]}"; // String resJson = "23232"; // System.out.println(s); log.debug("上传实有房屋返回数据:" + resJson); @@ -372,8 +372,8 @@ public class XaRealDataTask implements ITask { TenTranEntity tranEntity = tenTranService.saveApi(fwikUrl,jsonData,"MJSBXX", "MJSBXX", appId, appSecret); String tranId = String.format("%s%016d",DateUtils.format(tranEntity.getTranDate(),"yyyyMMddHHmmss"),tranEntity.getTranId()); -// String resJson = XaApi.httpPOSTJson(fwikUrl, enJson, "MJSBXX", "MJSBXX", appId, appSecret,tranId); - String resJson = "{\"sta\":{\"code\":\"0000\",\"des\":\"成功\",\"ErrorLineParameter\":\"empty\"},\"datas\":[{\"Result\":\"接收成功\"}],\"pages\":[{\"psize\":\"1\",\"tcount\":\"1\",\"pno\":\"1\",\"tsize\":\"0\"}]}"; + String resJson = XaApi.httpPOSTJson(fwikUrl, enJson, "MJSBXX", "MJSBXX", appId, appSecret,tranId); +// String resJson = "{\"sta\":{\"code\":\"0000\",\"des\":\"成功\",\"ErrorLineParameter\":\"empty\"},\"datas\":[{\"Result\":\"接收成功\"}],\"pages\":[{\"psize\":\"1\",\"tcount\":\"1\",\"pno\":\"1\",\"tsize\":\"0\"}]}"; // String resJson = "23232"; // System.out.println(s); log.debug("上传实有房屋返回数据:" + resJson); diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/job/task/XaRecordTask.java b/shapelight-admin/src/main/java/net/shapelight/modules/job/task/XaRecordTask.java index 3bd6826..6c2db3a 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/job/task/XaRecordTask.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/job/task/XaRecordTask.java @@ -90,23 +90,25 @@ public class XaRecordTask implements ITask { TenAddressEntity addressEntity = tenAddressService.getOne(new QueryWrapper() .eq("xqid",xqid).last("LIMIT 1")); - String ssxqbm = addressEntity.getSsxqbm(); + if(addressEntity!=null){ + String ssxqbm = addressEntity.getSsxqbm(); - syncRecord.setLV_SSXQBM(ssxqbm); //小区申报编码 - syncRecord.setLV_MJBH(record.getDeviceSn()); - syncRecord.setLV_CRLB("1");//1进2出 - syncRecord.setLV_ZPSJ(DateUtils.format(record.getRecordTime(), "yyyyMMddHHmmss")); - syncRecord.setLV_SBXT("10");//申报系统,默认10 - syncRecord.setLV_MJXTWYBM(record.getRecordId()+"");//出入记录主键 - syncRecord.setLV_RY_ID(record.getPersonId()+""); - syncRecord.setLV_FFMS("1");//1住户2访客 - syncRecord.setLV_PROCMODE("PMINSERT"); + syncRecord.setLV_SSXQBM(ssxqbm); //小区申报编码 + syncRecord.setLV_MJBH(record.getDeviceSn()); + syncRecord.setLV_CRLB("1");//1进2出 + syncRecord.setLV_ZPSJ(DateUtils.format(record.getRecordTime(), "yyyyMMddHHmmss")); + syncRecord.setLV_SBXT("10");//申报系统,默认10 + syncRecord.setLV_MJXTWYBM(record.getRecordId()+"");//出入记录主键 + syncRecord.setLV_RY_ID(record.getPersonId()+""); + syncRecord.setLV_FFMS("1");//1住户2访客 + syncRecord.setLV_PROCMODE("PMINSERT"); - syncRecords.add(syncRecord); - updateRecords.add(record); - count++; - if (count >= 30) - break; + syncRecords.add(syncRecord); + updateRecords.add(record); + count++; + if (count >= 30) + break; + } } if(count == 0){ return; @@ -128,8 +130,8 @@ public class XaRecordTask implements ITask { TenTranEntity tranEntity = tenTranService.saveApi(fwikUrl,jsonData,"RYSKZPXX", "RYSKZPXX", appId, appSecret); String tranId = String.format("%s%016d",DateUtils.format(tranEntity.getTranDate(),"yyyyMMddHHmmss"),tranEntity.getTranId()); -// String resJson = XaApi.httpPOSTJson(fwikUrl, enJson, "RYSKZPXX", "RYSKZPXX", appId, appSecret,tranId); - String resJson = "{\"sta\":{\"code\":\"0000\",\"des\":\"成功\",\"ErrorLineParameter\":\"empty\"},\"datas\":[{\"Result\":\"接收成功\"}],\"pages\":[{\"psize\":\"1\",\"tcount\":\"1\",\"pno\":\"1\",\"tsize\":\"0\"}]}"; + String resJson = XaApi.httpPOSTJson(fwikUrl, enJson, "RYSKZPXX", "RYSKZPXX", appId, appSecret,tranId); +// String resJson = "{\"sta\":{\"code\":\"0000\",\"des\":\"成功\",\"ErrorLineParameter\":\"empty\"},\"datas\":[{\"Result\":\"接收成功\"}],\"pages\":[{\"psize\":\"1\",\"tcount\":\"1\",\"pno\":\"1\",\"tsize\":\"0\"}]}"; // String resJson = "23232"; // System.out.println(s); log.debug("上传人员识别记录返回数据:" + resJson); @@ -210,8 +212,8 @@ public class XaRecordTask implements ITask { TenTranEntity tranEntity = tenTranService.saveApi(fwikUrl,jsonData,"TCCTCSBXX", "TCCTCSBXX", appId, appSecret); String tranId = String.format("%s%016d",DateUtils.format(tranEntity.getTranDate(),"yyyyMMddHHmmss"),tranEntity.getTranId()); -// String resJson = XaApi.httpPOSTJson(fwikUrl, enJson, "TCCTCSBXX", "TCCTCSBXX", appId, appSecret,tranId); - String resJson = "{\"sta\":{\"code\":\"0000\",\"des\":\"成功\",\"ErrorLineParameter\":\"empty\"},\"datas\":[{\"Result\":\"接收成功\"}],\"pages\":[{\"psize\":\"1\",\"tcount\":\"1\",\"pno\":\"1\",\"tsize\":\"0\"}]}"; + String resJson = XaApi.httpPOSTJson(fwikUrl, enJson, "TCCTCSBXX", "TCCTCSBXX", appId, appSecret,tranId); +// String resJson = "{\"sta\":{\"code\":\"0000\",\"des\":\"成功\",\"ErrorLineParameter\":\"empty\"},\"datas\":[{\"Result\":\"接收成功\"}],\"pages\":[{\"psize\":\"1\",\"tcount\":\"1\",\"pno\":\"1\",\"tsize\":\"0\"}]}"; // String resJson = "23232"; // System.out.println(s); log.debug("上传车辆进场记录返回数据:" + resJson); @@ -295,8 +297,8 @@ public class XaRecordTask implements ITask { TenTranEntity tranEntity = tenTranService.saveApi(fwikUrl,jsonData,"TCCTCSBXX", "TCCTCSBXX", appId, appSecret); String tranId = String.format("%s%016d",DateUtils.format(tranEntity.getTranDate(),"yyyyMMddHHmmss"),tranEntity.getTranId()); -// String resJson = XaApi.httpPOSTJson(fwikUrl, enJson, "TCCTCSBXX", "TCCTCSBXX", appId, appSecret,tranId); - String resJson = "{\"sta\":{\"code\":\"0000\",\"des\":\"成功\",\"ErrorLineParameter\":\"empty\"},\"datas\":[{\"Result\":\"接收成功\"}],\"pages\":[{\"psize\":\"1\",\"tcount\":\"1\",\"pno\":\"1\",\"tsize\":\"0\"}]}"; + String resJson = XaApi.httpPOSTJson(fwikUrl, enJson, "TCCTCSBXX", "TCCTCSBXX", appId, appSecret,tranId); +// String resJson = "{\"sta\":{\"code\":\"0000\",\"des\":\"成功\",\"ErrorLineParameter\":\"empty\"},\"datas\":[{\"Result\":\"接收成功\"}],\"pages\":[{\"psize\":\"1\",\"tcount\":\"1\",\"pno\":\"1\",\"tsize\":\"0\"}]}"; // String resJson = "23232"; // System.out.println(s); log.debug("上传车辆进场记录返回数据:" + resJson); diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenBuildController.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenBuildController.java index 913bb03..2adacdc 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenBuildController.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenBuildController.java @@ -120,6 +120,9 @@ public class TenBuildController extends AbstractController { Map params = new HashMap<>(); params.put("tenantId",tenantId+""); List buildList = tenBuildService.selectByCellId(cellId); +// for(TenBuildEntity buildEntity: buildList){ +// buildEntity.setName(buildEntity.getName()+buildEntity.getUnit()+"单元"); +// } return R.ok().put("data", buildList); } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenDeviceServiceImpl.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenDeviceServiceImpl.java index e718158..0935000 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenDeviceServiceImpl.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenDeviceServiceImpl.java @@ -11,6 +11,7 @@ import net.shapelight.modules.vo.TenPersonIdUpdateAllVo; import net.shapelight.modules.vo.TenPersonIdUpdateVo; import net.shapelight.modules.vo.TenPersonVo; import org.apache.commons.beanutils.BeanUtils; +import org.apache.commons.lang.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cache.annotation.CacheEvict; import org.springframework.cache.annotation.Cacheable; @@ -22,6 +23,7 @@ import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Map; + import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -46,7 +48,7 @@ public class TenDeviceServiceImpl extends ServiceImpl params) { List cellIds = new ArrayList<>(); // cellIds.add(709832651506188289L); - String cellId = (String)params.get("cellId"); - if (cellId!=null && !cellId.isEmpty()){ + String cellId = (String) params.get("cellId"); + String key = (String) params.get("key"); +// if(key == null){ +// key = ""; +// } + if (cellId != null && !cellId.isEmpty()) { Long cellLong = Long.parseLong(cellId); cellIds.add(cellLong); - }else { + } else { List cells = tenCellService.queryAll(params); for (TenCellEntity cell : cells) { cellIds.add(cell.getCellId()); } } if (cellIds.size() == 0) { - return new PageUtils(new ArrayList<>(),0,0,0); + return new PageUtils(new ArrayList<>(), 0, 0, 0); } IPage page = this.page( new Query().getPage(params), new QueryWrapper() - .eq("tenant_id",params.get("tenantId")) - .in("cell_id",cellIds) + .eq("tenant_id", params.get("tenantId")) + .in("cell_id", cellIds) + .and(StringUtils.isNotBlank(key), + i -> i + .like("sn", key) + .or() + .like("name", key) + ) ); - for(TenDeviceEntity dev : page.getRecords()){ + for (TenDeviceEntity dev : page.getRecords()) { StringBuffer scope = new StringBuffer(); - if(dev.getCellId()!=null){ + if (dev.getCellId() != null) { String cellName = tenCellService.getCellName(dev.getCellId().toString()); scope.append(cellName); } - if(dev.getBuildId()!=null){ - TenBuildEntity build = tenBuildService.getById(dev.getBuildId(),dev.getCellId()); + if (dev.getBuildId() != null) { + TenBuildEntity build = tenBuildService.getById(dev.getBuildId(), dev.getCellId()); // dev.setBuildName(build.getName()); // dev.setBuildUnit(build.getUnit()); scope.append(build.getName()); scope.append(build.getUnit()); scope.append("单元"); } - if(dev.getRoomId()!=null){ - String roomName = tenRoomService.getRoomName(dev.getRoomId(),dev.getCellId()); + if (dev.getRoomId() != null) { + String roomName = tenRoomService.getRoomName(dev.getRoomId(), dev.getCellId()); // dev.setRoomName(roomName); scope.append(roomName); } @@ -113,23 +125,23 @@ public class TenDeviceServiceImpl extends ServiceImpl findByCellId(long cellId) { - List devList = this.list(new QueryWrapper() - .eq("cell_id",cellId)); + List devList = this.list(new QueryWrapper() + .eq("cell_id", cellId)); List resList = new ArrayList<>(); - if(devList.size()>0){ - for(TenDeviceEntity dev: devList){ + if (devList.size() > 0) { + for (TenDeviceEntity dev : devList) { // boolean onlineFlag = emqHttpApi.getClient(dev.getSn()); // if(onlineFlag){ // dev.setStatus(1); @@ -140,12 +152,12 @@ public class TenDeviceServiceImpl extends ServiceImpl().eq("sn",sn)); + return this.getOne(new QueryWrapper().eq("sn", sn)); } @@ -230,9 +242,9 @@ public class TenDeviceServiceImpl extends ServiceImpl memberIdList) { TenDeviceEntity dev = findBySn(sn); Long cellId = dev.getCellId(); - for(Integer memberId: memberIdList){ - TenPersonEntity person = tenPersonService.getByMemberId(memberId,cellId); - log.info("不合格人脸:"+person.getPersonId()); + for (Integer memberId : memberIdList) { + TenPersonEntity person = tenPersonService.getByMemberId(memberId, cellId); + log.info("不合格人脸:" + person.getPersonId()); // TenPersonEntity person = new TenPersonEntity(); // person.setPersonId(personId); // person.setCellId(cellId); @@ -251,23 +263,24 @@ public class TenDeviceServiceImpl extends ServiceImpl idList) { //删除同步人员 - for(Long devId: (List)idList){ + for (Long devId : (List) idList) { TenDeviceEntity deviceEntity = this.getById(devId); - tenPersonSyncService.removeByDeviceId(devId,deviceEntity.getTenantId()); + tenPersonSyncService.removeByDeviceId(devId, deviceEntity.getTenantId()); //清除通知: serverApiService.cleanData(deviceEntity.getSn()); } @@ -275,10 +288,10 @@ public class TenDeviceServiceImpl extends ServiceImpl() - .in("cell_id",idList)); + return this.remove(new QueryWrapper() + .in("cell_id", idList)); // return removeByIds(idList); } @@ -289,12 +302,12 @@ public class TenDeviceServiceImpl extends ServiceImpl list = this.list(new QueryWrapper() - .eq("tenant_id",params.get("tenantId")) - .in("cell_id",cellIds)); + .eq("tenant_id", params.get("tenantId")) + .in("cell_id", cellIds)); return list.size(); } } @@ -307,15 +320,15 @@ public class TenDeviceServiceImpl extends ServiceImpl0){ + if (cellIds.size() > 0) { List list = this.list(new QueryWrapper() - .eq("tenant_id",params.get("tenantId")) - .in("cell_id",cellIds)); - if (list.size()>=0) { - for(TenDeviceEntity dev: list){ + .eq("tenant_id", params.get("tenantId")) + .in("cell_id", cellIds)); + if (list.size() >= 0) { + for (TenDeviceEntity dev : list) { // boolean onlineFlag = emqHttpApi.getClient(dev.getSn()); boolean onlineFlag = deviceApiService.isOnline(dev.getSn()); - if(onlineFlag){ + if (onlineFlag) { onlineCount++; } } @@ -326,7 +339,7 @@ public class TenDeviceServiceImpl extends ServiceImpl saveList = new ArrayList<>(); - for(TenPersonIdUpdateAllVo vo:list){ + for (TenPersonIdUpdateAllVo vo : list) { TenPersonSyncEntity entity = new TenPersonSyncEntity(); entity.setDeviceId(deviceEntity.getDeviceId()); entity.setDeviceSn(deviceEntity.getSn()); @@ -350,15 +363,15 @@ public class TenDeviceServiceImpl extends ServiceImpl0){ - tenPersonSyncService.insertBatch(saveList,deviceEntity.getTenantId()); + if (saveList.size() > 0) { + tenPersonSyncService.insertBatch(saveList, deviceEntity.getTenantId()); } // tenPersonSyncService.saveBatch(sList); } @Override - @CacheEvict(value="TenDevice",allEntries = true) + @CacheEvict(value = "TenDevice", allEntries = true) public void evictupdateById(TenDeviceEntity tenDevice) { this.updateById(tenDevice); } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/xian/service/XaApi.java b/shapelight-admin/src/main/java/net/shapelight/modules/xian/service/XaApi.java index a58bfab..8da8bfa 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/xian/service/XaApi.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/xian/service/XaApi.java @@ -335,7 +335,7 @@ public class XaApi { syncRecord.setLV_TCCBH("610113100000000000267"); - syncRecord.setLV_CPHM("陕A66GB0"); + syncRecord.setLV_CPHM("陕AK8L34"); syncRecord.setLV_CPLX("03");//01 大型汽车号牌 2 小型汽车号牌 03 使馆汽车号牌 04 领馆汽车号牌 syncRecord.setLV_GCSJ(DateUtils.format(new Date(), "yyyyMMddHHmmss")); syncRecord.setLV_GCLX("1");//1进场2出场 @@ -389,6 +389,9 @@ public class XaApi { */ String appid = "1297164778041095"; String appsecret = "22971647780410956329716477804109"; + + //伟丰花园:610113600000000005977 欧风园:610113600000000004538 + //西安文理学院:610113630000000010348 绿地花都:610113610000000017653 String xqid = "610113600000000004538"; String address = getAddress(xqid, appid, appsecret); System.out.println(address); @@ -398,8 +401,8 @@ public class XaApi { String apiUrl = getFwikUrl(appid, appsecret); System.out.println(apiUrl); //6.1 获取标准地址接口--------------------------------------------------------------------------- -// String address = getAddress(xqid, appid, appsecret); -// System.out.println(address); + String addressCell = getAddress(xqid, appid, appsecret); + System.out.println(addressCell); //6.3.1 实有房屋信息---------------------------------------------------------------------------- // 1820591355 610113600000000001202 610113003012013 陕西省西安市雁塔区长安南路439号4栋1单元3层4131号 长安南路 108.942481 34.207741 14 10 610113600000000004538 欧风园小区 610113 陕师大警务室 000268000029000013000001000003000002 000268 A61011304538 西安市雁塔区 610113600000 2021-03-23 16:50:08 /* @@ -413,11 +416,11 @@ public class XaApi { 1820580970 610113600000000001202 610113003012013 陕西省西安市雁塔区长安南路439号1栋1单元4层1142号 长安南路 108.942541 34.206951 14 10 610113600000000004538 欧风园小区 610113 陕师大警务室 000268000029000010000001000004000002 000268 A61011304538 西安市雁塔区 610113600000 2021-03-23 16:50:08 1820581243 610113600000000001202 610113003012013 陕西省西安市雁塔区长安南路439号1栋1单元5层1152号 长安南路 108.942541 34.206951 14 10 610113600000000004538 欧风园小区 610113 陕师大警务室 000268000029000010000001000005000001 000268 A61011304538 西安市雁塔区 610113600000 2021-03-23 16:50:08 */ - syncRoom(); +// syncRoom(); //6.3.2 实有人口信息---------------------------------------------------------------------------- // syncPerson(); //6.3.9 车辆出入记录------------------------------------------------------------- - processRecordCarEnter(); +// processRecordCarEnter(); }