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 f6665d1..7c5721d 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 @@ -256,89 +256,89 @@ public class CarOpenApi { @PostMapping({"/pushCarRecord"}) @ApiOperation("第三方推送") - public Map pushCarRecord(@RequestBody Object object) { - Map res = new HashMap<>(); - res.put("code", "401"); - res.put("msg", "签名结果不一致"); - JSONObject msgJson = (JSONObject)JSONObject.toJSON(object); - log.debug("收到数据"+ msgJson.toString()); - String sign = msgJson.getString("sign"); - String pid = msgJson.getString("pid"); - Long timestamp = msgJson.getLong("timestamp"); - String serviceName = msgJson.getString("serviceName"); - JSONObject bizContent = msgJson.getJSONObject("bizContent"); - String parkCode = bizContent.getString("parkCode"); - String parkName = bizContent.getString("parkName"); - String orderNum = bizContent.getString("orderNum"); - String plateNum = bizContent.getString("plateNum"); - String channelName = bizContent.getString("channelName"); - int type = bizContent.getIntValue("type"); - int carType = bizContent.getIntValue("carType"); - String imgUrl = bizContent.getString("imgUrl"); - String fileName = "car/" + parkCode + "/" + UUIDUtil.uuid() + ".jpg"; - if (!StringUtils.isEmpty(imgUrl)) { - URL url = null; - InputStream is = null; - HttpURLConnection httpUrl = null; - try { - url = new URL(imgUrl); - httpUrl = (HttpURLConnection)url.openConnection(); - httpUrl.connect(); - httpUrl.getInputStream(); - is = httpUrl.getInputStream(); - PutObjectOptions putObjectOptions = new PutObjectOptions(is.available(), -1L); - putObjectOptions.setContentType("image/jpeg"); - this.minioClient.putObject(this.minioConfig - .getBucketName(), fileName, is, putObjectOptions); - } catch (Exception e) { - e.printStackTrace(); - fileName = ""; - } finally { - if (is != null) - try { - is.close(); - } catch (IOException e) { - e.printStackTrace(); - } - if (httpUrl != null) - httpUrl.disconnect(); + public Map pushCarRecord(@RequestBody Object object) { + Map res = new HashMap<>(); + res.put("code", "401"); + res.put("msg", "签名结果不一致"); + JSONObject msgJson = (JSONObject) JSONObject.toJSON(object); + log.debug("收到数据" + msgJson.toString()); + String sign = msgJson.getString("sign"); + String pid = msgJson.getString("pid"); + Long timestamp = msgJson.getLong("timestamp"); + String serviceName = msgJson.getString("serviceName"); + JSONObject bizContent = msgJson.getJSONObject("bizContent"); + String parkCode = bizContent.getString("parkCode"); + String parkName = bizContent.getString("parkName"); + String orderNum = bizContent.getString("orderNum"); + String plateNum = bizContent.getString("plateNum"); + String channelName = bizContent.getString("channelName"); + int type = bizContent.getIntValue("type"); + int carType = bizContent.getIntValue("carType"); + String imgUrl = bizContent.getString("imgUrl"); + String fileName = "car/" + parkCode + "/" + UUIDUtil.uuid() + ".jpg"; + if (!StringUtils.isEmpty(imgUrl)) { + URL url = null; + InputStream is = null; + HttpURLConnection httpUrl = null; + try { + url = new URL(imgUrl); + httpUrl = (HttpURLConnection) url.openConnection(); + httpUrl.connect(); + httpUrl.getInputStream(); + is = httpUrl.getInputStream(); + PutObjectOptions putObjectOptions = new PutObjectOptions(is.available(), -1L); + putObjectOptions.setContentType("image/jpeg"); + this.minioClient.putObject(this.minioConfig + .getBucketName(), fileName, is, putObjectOptions); + } catch (Exception e) { +// e.printStackTrace(); + fileName = ""; + } finally { + if (is != null) + try { + is.close(); + } catch (IOException e) { + e.printStackTrace(); + } + if (httpUrl != null) + httpUrl.disconnect(); + } } + if (serviceName.equals("enter")) { + long enterTimeLong = bizContent.getLongValue("enterTime"); + Date enterTime = new Date(enterTimeLong * 1000L); + TenPackRecordEnterEntity enter = new TenPackRecordEnterEntity(); + enter.setParkCode(parkCode); + enter.setParkName(parkName); + enter.setOrderNumber(orderNum); + enter.setPlateNumber(plateNum); + enter.setChannelName(channelName); + enter.setType(Integer.valueOf(type)); + enter.setCarType(Integer.valueOf(carType)); + enter.setEnterTime(enterTime); + if (fileName.length() > 0) + enter.setImage(fileName); + this.tenPackRecordEnterService.save(enter); + } else if (serviceName.equals("exit")) { + long exitTimeLong = bizContent.getLongValue("exitTime"); + Date exitTime = new Date(exitTimeLong * 1000L); + long parkTime = bizContent.getLongValue("parkTime"); + TenPackRecordExitEntity exit = new TenPackRecordExitEntity(); + exit.setParkCode(parkCode); + exit.setParkName(parkName); + exit.setOrderNumber(orderNum); + exit.setPlateNumber(plateNum); + exit.setChannelName(channelName); + exit.setType(Integer.valueOf(type)); + exit.setCarType(Integer.valueOf(carType)); + exit.setExitTime(exitTime); + exit.setPackTime(Long.valueOf(parkTime)); + if (fileName.length() > 0) + exit.setImage(fileName); + this.tenPackRecordExitService.save(exit); + } + res.put("code", "200"); + res.put("msg", "成功"); + return res; } - if (serviceName.equals("enter")) { - long enterTimeLong = bizContent.getLongValue("enterTime"); - Date enterTime = new Date(enterTimeLong * 1000L); - TenPackRecordEnterEntity enter = new TenPackRecordEnterEntity(); - enter.setParkCode(parkCode); - enter.setParkName(parkName); - enter.setOrderNumber(orderNum); - enter.setPlateNumber(plateNum); - enter.setChannelName(channelName); - enter.setType(Integer.valueOf(type)); - enter.setCarType(Integer.valueOf(carType)); - enter.setEnterTime(enterTime); - if (fileName.length() > 0) - enter.setImage(fileName); - this.tenPackRecordEnterService.save(enter); - } else if (serviceName.equals("exit")) { - long exitTimeLong = bizContent.getLongValue("exitTime"); - Date exitTime = new Date(exitTimeLong * 1000L); - long parkTime = bizContent.getLongValue("parkTime"); - TenPackRecordExitEntity exit = new TenPackRecordExitEntity(); - exit.setParkCode(parkCode); - exit.setParkName(parkName); - exit.setOrderNumber(orderNum); - exit.setPlateNumber(plateNum); - exit.setChannelName(channelName); - exit.setType(Integer.valueOf(type)); - exit.setCarType(Integer.valueOf(carType)); - exit.setExitTime(exitTime); - exit.setPackTime(Long.valueOf(parkTime)); - if (fileName.length() > 0) - exit.setImage(fileName); - this.tenPackRecordExitService.save(exit); - } - res.put("code", "200"); - res.put("msg", "成功"); - return res; -} } 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 3329d72..6462cb6 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 @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import io.minio.MinioClient; + import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; @@ -18,21 +19,11 @@ import net.shapelight.common.utils.DateUtils; import net.shapelight.modules.job.task.ITask; import net.shapelight.modules.sys.entity.SysUserEntity; import net.shapelight.modules.sys.service.SysUserService; -import net.shapelight.modules.ten.entity.TenCellEntity; -import net.shapelight.modules.ten.entity.TenPackRecordEntity; -import net.shapelight.modules.ten.entity.TenPersonEntity; -import net.shapelight.modules.ten.entity.TenRecordEntity; -import net.shapelight.modules.ten.service.TenCellService; -import net.shapelight.modules.ten.service.TenDeviceService; -import net.shapelight.modules.ten.service.TenDoorCardService; -import net.shapelight.modules.ten.service.TenPackRecordService; -import net.shapelight.modules.ten.service.TenPersonService; -import net.shapelight.modules.ten.service.TenRecordService; -import net.shapelight.modules.ten.service.TenRoomService; +import net.shapelight.modules.ten.entity.*; +import net.shapelight.modules.ten.service.*; import net.shapelight.modules.xian.service.XaApi; -import net.shapelight.modules.xian.vo.XaRYJCZPXX; -import net.shapelight.modules.xian.vo.XaRYRKPHOTO; -import net.shapelight.modules.xian.vo.XaTCCTCSBZPXX; +import net.shapelight.modules.xian.utils.XaUtils; +import net.shapelight.modules.xian.vo.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -61,6 +52,8 @@ public class XaImageTask implements ITask { private MinioConfig minioConfig; @Autowired private MinioClient minioClient; + @Autowired + private TenAddressService tenAddressService; public void run(String params) { log.debug("xaImageTask定时任务正在执行", params); @@ -74,14 +67,13 @@ public class XaImageTask implements ITask { String appSecret = object.getString("appSecret"); String fwikUrl = XaApi.getFwikUrl(appId, appSecret); if (fwikUrl != null) { - List allCells = this.tenCellService.list((Wrapper)(new QueryWrapper()) - + List allCells = this.tenCellService.list((Wrapper) (new QueryWrapper()) .eq("tenant_id", sysTenUser.getTenantId())); Long tenantId = sysTenUser.getTenantId(); for (TenCellEntity cellEntity : allCells) { String xqid = cellEntity.getThirdId(); Long cellId = cellEntity.getCellId(); - if (xqid == null || xqid.length() > 0); + if (xqid == null || xqid.length() > 0) ; } } } @@ -90,112 +82,342 @@ public class XaImageTask implements ITask { log.debug("xaImageTask定时任务执行完毕"); } - private void processRecordPerson(String appId, String appSecret, String xqid, String fwikUrl, Long cellId, Long tenantId) { + + //人员出入记录 + private void processRecordPersonImage(String appId, String appSecret, String xqid, String fwikUrl, Long cellId, Long tenantId) { List records = this.tenRecordService.getNotSyncImage(cellId, tenantId); - List syncrecords = new ArrayList<>(); + List syncRecords = new ArrayList(); + List updateRecords = new ArrayList<>(); int count = 0; for (TenRecordEntity record : records) { XaRYJCZPXX syncRecord = new XaRYJCZPXX(); - syncRecord.setLV_ZPSJ(DateUtils.format(record.getRecordTime(), "yyyyMMdd24HHmmss")); - syncRecord.setLV_MJXTWYBM(record.getRecordId().toString()); - String faceUrl = record.getRecordFace(); - if (faceUrl != null && !faceUrl.isEmpty()) { - String encode = ""; - InputStream inStream = null; - ByteArrayOutputStream outStream = null; - try { - this.minioClient.statObject(this.minioConfig.getBucketName(), faceUrl); - inStream = this.minioClient.getObject(this.minioConfig.getBucketName(), faceUrl); - outStream = new ByteArrayOutputStream(); - byte[] buffer = new byte[1024]; - int length; - while ((length = inStream.read(buffer)) != -1) - outStream.write(buffer, 0, length); - encode = Base64.getEncoder().encodeToString(outStream.toByteArray()); - syncRecord.setLV_ZPSJ(encode); - } catch (Exception e) { - log.error("底库不存在"+ faceUrl); - e.printStackTrace(); - } finally { - if (inStream != null) - try { - inStream.close(); - } catch (IOException e) { - log.debug("inputStream close IOException:" + e.getMessage()); - } - if (outStream != null) - try { - outStream.close(); - } catch (IOException e) { - log.debug("outStream close IOException:" + e.getMessage()); - } +// TenRoomEntity roomEntity = tenRoomService.getById(person.getRoomId(), person.getCellId()); +// TenAddressEntity addressEntity = tenAddressService.getById(roomEntity.getRoomId()); + + TenAddressEntity addressEntity = tenAddressService.getOne(new QueryWrapper() + .eq("xqid", xqid).last("LIMIT 1")); + String ssxqbm = addressEntity.getSsxqbm(); + + 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; + + 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()); + } + } + if (outStream != null) { + try { + outStream.close(); + } catch (IOException e) { + log.error("outStream close IOException:" + e.getMessage()); + } } } - syncrecords.add(syncRecord); + + if (base64Image.length() == 0) { + continue; + } + + syncRecord.setLV_ZPZP(base64Image);//base64图片 + + syncRecords.add(syncRecord); + updateRecords.add(record); count++; - if (count >= 60) + 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, "RYJCZPXX", "RYJCZPXX", appId, appSecret); +// 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 (TenRecordEntity recordEntity : updateRecords) { + recordEntity.setXaSyncImage(1); + tenRecordService.updateById(recordEntity); + } + } } - private void processRecordCar(String appId, String appSecret, String xqid, String fwikUrl, Long cellId) { - List records = this.tenPackRecordService.getNotSync(cellId); - List syncrecords = new ArrayList<>(); - int count = 0; - for (TenPackRecordEntity record : records) { - XaTCCTCSBZPXX syncRecord = new XaTCCTCSBZPXX(); - syncRecord.setLV_ZPSJ(DateUtils.format(record.getInTime(), "yyyyMMdd24HHmmss")); - syncrecords.add(syncRecord); - count++; - if (count >= 60) - break; - } - } +// 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("pack_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\"}]}"; +// 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("pack_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\"}]}"; +// 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); +// } +// } +// } - private void processPerson(String appId, String appSecret, String xqid, String fwikUrl, Long cellId) { + + private void processRealPersonImage(String appId, String appSecret, String xqid, String fwikUrl, Long cellId) { List persons = this.tenPersonService.getNotSyncImage(cellId); - List syncPersons = new ArrayList<>(); + List syncPersons = new ArrayList(); + List updatePersons = new ArrayList<>(); int count = 0; for (TenPersonEntity person : persons) { - XaRYRKPHOTO syncPerson = new XaRYRKPHOTO(); - syncPerson.setLV_GMSFHM(person.getIdCard()); - syncPerson.setLV_DJSJ(DateUtils.format(new Date(), "yyyyMMdd24HHmmss")); - String faceUrl = person.getFaceImage(); - if (faceUrl != null && !faceUrl.isEmpty()) { - String encode = ""; - InputStream inStream = null; - ByteArrayOutputStream outStream = null; - try { - this.minioClient.statObject(this.minioConfig.getBucketName(), faceUrl); - inStream = this.minioClient.getObject(this.minioConfig.getBucketName(), faceUrl); - outStream = new ByteArrayOutputStream(); - byte[] buffer = new byte[1024]; - int length; - while ((length = inStream.read(buffer)) != -1) - outStream.write(buffer, 0, length); - encode = Base64.getEncoder().encodeToString(outStream.toByteArray()); - syncPerson.setLV_ZP(encode); - } catch (Exception e) { - log.error("底库不存在"+ faceUrl); - e.printStackTrace(); - } finally { - if (inStream != null) - try { - inStream.close(); - } catch (IOException e) { - log.debug("inputStream close IOException:" + e.getMessage()); - } - if (outStream != null) - try { - outStream.close(); - } catch (IOException e) { - log.debug("outStream close IOException:" + e.getMessage()); - } + XaRYRKPHOTO realPerson = new XaRYRKPHOTO(); + TenRoomEntity roomEntity = tenRoomService.getById(person.getRoomId(), person.getCellId()); + TenAddressEntity addressEntity = tenAddressService.getById(roomEntity.getRoomId()); + + 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; + + 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()); + } + } + 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 >= 60) + if (count >= 50) break; + + } + XaData jsonData = new XaData(); + jsonData.setDatas(syncPersons); + + 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, "SYRK", "SYRK", appId, appSecret); +// 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 (TenPersonEntity personEntity : updatePersons) { + personEntity.setXaSyncImage(1); + tenPersonService.updateNonal(personEntity); + } } } } 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 2ca787d..56bf1ad 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 @@ -63,9 +63,13 @@ public class XaRealDataTask implements ITask { String xqid = cellEntity.getThirdId(); Long cellId = cellEntity.getCellId(); if (xqid != null && xqid.length() > 0) { + //实有房屋 processRealRoom(appId, appSecret, xqid, fwikUrl, cellId); + //门禁 processDoorCard(appId, appSecret, xqid, fwikUrl, cellId); + //实有人口 processRealPerson(appId, appSecret, xqid, fwikUrl, cellId); + //门禁设备 processDevice(appId, appSecret, xqid, fwikUrl, cellId); } } @@ -185,6 +189,9 @@ public class XaRealDataTask implements ITask { } String syrkbm = String.format("10%s%012d", idcard, addressEntity.getPId());//证件类型10+身份证号(18位)+p_id(12位) + + person.setUuid(syrkbm); + realPerson.setLV_SYRKBM(syrkbm); //实有人口编码 realPerson.setLV_GMSFHM(person.getIdCard()); //身份证号 realPerson.setLV_XM(person.getName()); //姓名 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 be1e067..f433fd6 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 @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import java.util.ArrayList; +import java.util.Date; import java.util.List; import lombok.extern.slf4j.Slf4j; @@ -11,19 +12,11 @@ import net.shapelight.common.utils.DateUtils; import net.shapelight.modules.job.task.ITask; import net.shapelight.modules.sys.entity.SysUserEntity; import net.shapelight.modules.sys.service.SysUserService; -import net.shapelight.modules.ten.entity.TenCellEntity; -import net.shapelight.modules.ten.entity.TenPackRecordEntity; -import net.shapelight.modules.ten.entity.TenRecordEntity; -import net.shapelight.modules.ten.service.TenCellService; -import net.shapelight.modules.ten.service.TenDeviceService; -import net.shapelight.modules.ten.service.TenDoorCardService; -import net.shapelight.modules.ten.service.TenPackRecordService; -import net.shapelight.modules.ten.service.TenPersonService; -import net.shapelight.modules.ten.service.TenRecordService; -import net.shapelight.modules.ten.service.TenRoomService; +import net.shapelight.modules.ten.entity.*; +import net.shapelight.modules.ten.service.*; import net.shapelight.modules.xian.service.XaApi; -import net.shapelight.modules.xian.vo.XaRYSKZPXX; -import net.shapelight.modules.xian.vo.XaTCCTCSBXX; +import net.shapelight.modules.xian.utils.XaUtils; +import net.shapelight.modules.xian.vo.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -37,7 +30,15 @@ public class XaRecordTask implements ITask { @Autowired private TenRecordService tenRecordService; @Autowired - private TenPackRecordService tenPackRecordService; + private TenPackRecordEnterService tenPackRecordEnterService; + @Autowired + private TenPackRecordExitService tenPackRecordExitService; + @Autowired + private TenAddressService tenAddressService; + @Autowired + private TenPackService tenPackService; + @Autowired + private TenPackChannalService tenPackChannalService; public void run(String params) { log.debug("xaRecordTask{}", params); @@ -49,16 +50,23 @@ public class XaRecordTask implements ITask { if (type.intValue() == 1) { String appId = object.getString("appId"); String appSecret = object.getString("appSecret"); - String fwikUrl = XaApi.getFwikUrl(appId, appSecret); +// String fwikUrl = XaApi.getFwikUrl(appId, appSecret); + String fwikUrl = "http://"; if (fwikUrl != null) { List allCells = this.tenCellService.list((Wrapper)(new QueryWrapper()) - .eq("tenant_id", sysTenUser.getTenantId())); Long tenantId = sysTenUser.getTenantId(); for (TenCellEntity cellEntity : allCells) { String xqid = cellEntity.getThirdId(); Long cellId = cellEntity.getCellId(); - if (xqid == null || xqid.length() > 0); + if (xqid == null || xqid.length() > 0){ + //人员出入记录 + processRecordPerson(appId, appSecret, xqid, fwikUrl, cellId,tenantId); + //车辆进入记录 + processRecordCarEnter(appId, appSecret, xqid, fwikUrl, cellId); + //车辆出场记录 + processRecordCarExit(appId, appSecret, xqid, fwikUrl, cellId); + } } } } @@ -68,42 +76,214 @@ public class XaRecordTask implements ITask { } private void processRecordPerson(String appId, String appSecret, String xqid, String fwikUrl, Long cellId, Long tenantId) { - List records = this.tenRecordService.getNotSync(cellId, tenantId); - List syncrecords = new ArrayList<>(); + + List records = this.tenRecordService.getNotSync(cellId,tenantId); + List syncRecords = new ArrayList(); + List updateRecords = new ArrayList<>(); int count = 0; for (TenRecordEntity record : records) { XaRYSKZPXX syncRecord = new XaRYSKZPXX(); +// TenRoomEntity roomEntity = tenRoomService.getById(person.getRoomId(), person.getCellId()); +// TenAddressEntity addressEntity = tenAddressService.getById(roomEntity.getRoomId()); + + TenAddressEntity addressEntity = tenAddressService.getOne(new QueryWrapper() + .eq("xqid",xqid).last("LIMIT 1")); + String ssxqbm = addressEntity.getSsxqbm(); + + syncRecord.setLV_SSXQBM(ssxqbm); //小区申报编码 syncRecord.setLV_MJBH(record.getDeviceSn()); - syncRecord.setLV_CRLB("1"); - syncRecord.setLV_ZPSJ(DateUtils.format(record.getRecordTime(), "yyyyMMdd24HHmmss")); - syncRecord.setLV_SBXT("10"); - syncRecord.setLV_MJXTWYBM(record.getRecordId().toString()); - syncRecord.setLV_RY_ID(record.getPersonId().toString()); - syncRecord.setLV_FFMS("1"); + 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); + + syncRecords.add(syncRecord); + updateRecords.add(record); count++; - if (count >= 60) + 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, "RYSKZPXX", "RYSKZPXX", appId, appSecret); +// 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 (TenRecordEntity recordEntity : updateRecords) { + recordEntity.setXaSync(1); + tenRecordService.updateById(recordEntity); + } + } } - private void processRecordCar(String appId, String appSecret, String xqid, String fwikUrl, Long cellId) { - List records = this.tenPackRecordService.getNotSync(cellId); - List syncrecords = new ArrayList<>(); + private void processRecordCarEnter(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 (TenPackRecordEntity record : records) { + for (TenPackRecordEnterEntity record : records) { XaTCCTCSBXX syncRecord = new XaTCCTCSBXX(); - syncRecord.setLV_CPHM(record.getVlp()); - syncRecord.setLV_CPLX(record.getVTypeName()); - syncRecord.setLV_GCSJ(DateUtils.format(record.getInTime(), "YYYYMMDDHHMMSS")); - syncRecord.setLV_GCLX("1"); - syncRecord.setLV_SBXT("10"); + + TenPackEntity packEntity = tenPackService.getOne(new QueryWrapper() + .eq("pack_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); + + syncRecords.add(syncRecord); + updateRecords.add(record); count++; - if (count >= 60) + 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\"}]}"; + 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 processRecordCarExit(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("pack_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\"}]}"; + 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); + } + } + } + + } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/nettyapi/config/ClientMap.java b/shapelight-admin/src/main/java/net/shapelight/modules/nettyapi/config/ClientMap.java index a86fee6..a5cbaea 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/nettyapi/config/ClientMap.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/nettyapi/config/ClientMap.java @@ -3,6 +3,7 @@ package net.shapelight.modules.nettyapi.config; import io.netty.channel.Channel; import io.netty.util.AttributeKey; import lombok.Data; +import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; import java.util.Collection; @@ -11,6 +12,7 @@ import java.util.concurrent.ConcurrentHashMap; @Component @Data +@Slf4j public class ClientMap { //用户id=>channel示例 @@ -43,6 +45,12 @@ public class ClientMap { this.channelMap.put(userId, channel); AttributeKey key = AttributeKey.valueOf("user"); channel.attr(key).set(userId); + + StringBuffer loginBuf = new StringBuffer(); + for (String sn : this.channelMap.keySet()) { + loginBuf.append(sn+"----"); + } + log.debug("当前登录:"+loginBuf.toString()+"\n\n"); } /** diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/nettyapi/config/MyServer.java b/shapelight-admin/src/main/java/net/shapelight/modules/nettyapi/config/MyServer.java index 1c4dc54..9f35ea9 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/nettyapi/config/MyServer.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/nettyapi/config/MyServer.java @@ -40,7 +40,7 @@ public class MyServer { // Encoder pipeline.addLast("encoder", new MyMessageEncoder()); //pipeline.addLast("idleStateHandler", new IdleStateHandler(6, 3, 0));//心跳机制 - pipeline.addLast("idleStateHandler", new IdleStateHandler(40, 40, 40));//心跳机制 + pipeline.addLast("idleStateHandler", new IdleStateHandler(40, 0, 0));//心跳机制 pipeline.addLast(new MyServerHandler()); } }).option(ChannelOption.SO_BACKLOG, 128) // (5)//BACKLOG用于构造服务端套接字ServerSocket对象,标识当服务器请求处理线程全满时,用于临时存放已完成三次握手的请求的队列的最大长度。如果未设置或所设置的值小于1,Java将使用默认值50。 diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/nettyapi/config/MyServerHandler.java b/shapelight-admin/src/main/java/net/shapelight/modules/nettyapi/config/MyServerHandler.java index a52b35f..1846047 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/nettyapi/config/MyServerHandler.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/nettyapi/config/MyServerHandler.java @@ -1,5 +1,6 @@ package net.shapelight.modules.nettyapi.config; +import io.netty.channel.Channel; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.SimpleChannelInboundHandler; import io.netty.channel.group.ChannelGroup; @@ -58,17 +59,26 @@ public class MyServerHandler extends SimpleChannelInboundHandler { @Override public void handlerAdded(ChannelHandlerContext ctx) throws Exception { clients.add(ctx.channel()); + StringBuffer logBuf = new StringBuffer(); + for(Channel channel: clients){ + logBuf.append(channel.remoteAddress()+"\n"); + } + log.debug("当前连接:"+logBuf.toString()); + + + } // 移除对应客户端的channel @Override public void handlerRemoved(ChannelHandlerContext ctx) throws Exception { // 长短id - System.out.println(ctx.channel().id().asLongText()); - System.out.println(ctx.channel().id().asShortText()); +// System.out.println("移除客户端"+ctx.channel().id().asLongText()); +// System.out.println(ctx.channel().id().asShortText()); + log.debug("移除客户端长id:"+ctx.channel().id().asLongText()+" 短id:"+ctx.channel().id().asShortText()); clients.remove(ctx.channel()); clientMap.offline(ctx.channel()); - log.info("客户端断开"); + } /** @@ -91,7 +101,7 @@ public class MyServerHandler extends SimpleChannelInboundHandler { if (e.state() == IdleState.READER_IDLE) {//没收到任何数据就关掉链接 ctx.close(); clientMap.offline(ctx.channel()); - log.info("无数据设备离线"); + log.debug("无数据设备离线"); } else if (e.state() == IdleState.WRITER_IDLE) { } } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/nettyapi/config/StartInit.java b/shapelight-admin/src/main/java/net/shapelight/modules/nettyapi/config/StartInit.java index 169008a..fc897b8 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/nettyapi/config/StartInit.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/nettyapi/config/StartInit.java @@ -107,6 +107,7 @@ public class StartInit implements ServletContextListener { new Thread() { public void run() { try { + sleep(20000); server.run(); } catch (Exception e) { e.printStackTrace(); diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/nettyapi/service/impl/DeviceApiServiceImpl.java b/shapelight-admin/src/main/java/net/shapelight/modules/nettyapi/service/impl/DeviceApiServiceImpl.java index d552d7d..9924bf4 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/nettyapi/service/impl/DeviceApiServiceImpl.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/nettyapi/service/impl/DeviceApiServiceImpl.java @@ -291,11 +291,15 @@ public class DeviceApiServiceImpl implements DeviceApiService { if(doorCardEntity!=null){ puser.setCard_id(doorCardEntity.getDoorCard()); }else{ - TenDoorCardEntity doorCardRoom = tenDoorCardService.getOne( + List doorCardRooms = tenDoorCardService.list( new QueryWrapper() .eq("room_id",p.getRoomId()) ); - if(doorCardEntity!=null){ + TenDoorCardEntity doorCardRoom = null; + if(doorCardRooms.size()>0){ + doorCardRoom = doorCardRooms.get(0); + } + if(doorCardRoom!=null){ puser.setCard_id(doorCardRoom.getDoorCard()); } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/nettyapi/service/impl/ServerApiServiceImpl.java b/shapelight-admin/src/main/java/net/shapelight/modules/nettyapi/service/impl/ServerApiServiceImpl.java index e3e6ecf..a164299 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/nettyapi/service/impl/ServerApiServiceImpl.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/nettyapi/service/impl/ServerApiServiceImpl.java @@ -64,8 +64,10 @@ public class ServerApiServiceImpl implements ServerApiService { @Override public int personOperation(String sn,List operationVoList) { + log.debug("下发同步信息:"+sn); Channel channel = clientMap.getChannelByUserId(sn); if(channel == null){ + log.debug("下发同步信息:"+sn+" 不在线"); return -1; } String content = JSONObject.toJSONString(operationVoList); diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenPackRecordEnterService.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenPackRecordEnterService.java index 674b84c..5ceb898 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenPackRecordEnterService.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenPackRecordEnterService.java @@ -2,11 +2,17 @@ package net.shapelight.modules.ten.service; import com.baomidou.mybatisplus.extension.service.IService; +import java.util.List; import java.util.Map; import net.shapelight.common.utils.PageUtils; import net.shapelight.modules.ten.entity.TenPackRecordEnterEntity; +import net.shapelight.modules.ten.entity.TenRecordEntity; public interface TenPackRecordEnterService extends IService { PageUtils queryPage(Map paramMap); + + List getNotSync(Long cellId); + + List getNotSyncImage(Long cellId); } \ No newline at end of file diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenPackRecordExitService.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenPackRecordExitService.java index 6978ff8..3cf7912 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenPackRecordExitService.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenPackRecordExitService.java @@ -2,11 +2,18 @@ package net.shapelight.modules.ten.service; import com.baomidou.mybatisplus.extension.service.IService; +import java.util.List; import java.util.Map; import net.shapelight.common.utils.PageUtils; import net.shapelight.modules.ten.entity.TenPackRecordExitEntity; +import net.shapelight.modules.ten.entity.TenRecordEntity; public interface TenPackRecordExitService extends IService { + PageUtils queryPage(Map paramMap); + + List getNotSync(Long cellId); + + List getNotSyncImage(Long cellId); } \ No newline at end of file diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenRecordService.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenRecordService.java index 22f6302..de31aaf 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenRecordService.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenRecordService.java @@ -34,9 +34,9 @@ public interface TenRecordService { List getLastRecord(Map params); - List getNotSync(Long paramLong1, Long paramLong2); + List getNotSync(Long cellId, Long tenantId); - List getNotSyncImage(Long paramLong1, Long paramLong2); + List getNotSyncImage(Long cellId, Long tenantId); } 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 82364cc..198a338 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 @@ -6,14 +6,18 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import java.util.ArrayList; +import java.util.Date; import java.util.List; import java.util.Map; + +import net.shapelight.common.utils.DateUtils; import net.shapelight.common.utils.PageUtils; import net.shapelight.common.utils.Query; import net.shapelight.modules.ten.dao.TenPackRecordEnterDao; import net.shapelight.modules.ten.entity.TenCellEntity; import net.shapelight.modules.ten.entity.TenPackChannalEntity; import net.shapelight.modules.ten.entity.TenPackRecordEnterEntity; +import net.shapelight.modules.ten.entity.TenRecordEntity; import net.shapelight.modules.ten.service.TenCellService; import net.shapelight.modules.ten.service.TenPackRecordEnterService; import org.springframework.beans.factory.annotation.Autowired; @@ -55,4 +59,26 @@ public class TenPackRecordEnterServiceImpl extends ServiceImpl getNotSync(Long cellId) { + String todayString = DateUtils.format(new Date(),DateUtils.DATE_PATTERN); + String todayStart = todayString+" 00:00:00"; + String todayEnd = todayString+" 23:59:59"; + return this.list(new QueryWrapper() + .eq("cell_id",cellId) + .eq("xa_sync",0) + .gt("enter_time",todayStart) + .lt("enter_time",todayEnd)); + } + @Override + public List getNotSyncImage(Long cellId) { + String todayString = DateUtils.format(new Date(),DateUtils.DATE_PATTERN); + String todayStart = todayString+" 00:00:00"; + String todayEnd = todayString+" 23:59:59"; + return this.list(new QueryWrapper() + .eq("cell_id",cellId) + .eq("xa_sync_image",0) + .gt("enter_time",todayStart) + .lt("enter_time",todayEnd)); + } } \ No newline at end of file diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenPackRecordExitServiceImpl.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenPackRecordExitServiceImpl.java index 2a41c40..1ddf54b 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenPackRecordExitServiceImpl.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenPackRecordExitServiceImpl.java @@ -14,6 +14,7 @@ import net.shapelight.modules.ten.dao.TenPackRecordExitDao; import net.shapelight.modules.ten.entity.TenCellEntity; import net.shapelight.modules.ten.entity.TenPackRecordEnterEntity; import net.shapelight.modules.ten.entity.TenPackRecordExitEntity; +import net.shapelight.modules.ten.entity.TenRecordEntity; import net.shapelight.modules.ten.service.TenCellService; import net.shapelight.modules.ten.service.TenPackRecordExitService; import org.springframework.beans.factory.annotation.Autowired; @@ -55,4 +56,17 @@ public class TenPackRecordExitServiceImpl extends ServiceImpl getNotSync(Long cellId) { + return this.list(new QueryWrapper() + .eq("cell_id",cellId) + .eq("xa_sync",0)); + } + @Override + public List getNotSyncImage(Long cellId) { + return this.list(new QueryWrapper() + .eq("cell_id",cellId) + .eq("xa_sync_image",0)); + } } \ No newline at end of file diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/xian/vo/XaCYRY.java b/shapelight-admin/src/main/java/net/shapelight/modules/xian/vo/XaCYRY.java index 3f2319f..cc3c5b2 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/xian/vo/XaCYRY.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/xian/vo/XaCYRY.java @@ -1,36 +1,51 @@ package net.shapelight.modules.xian.vo; +import com.alibaba.fastjson.annotation.JSONField; import lombok.Data; @Data public class XaCYRY { + @JSONField(name="LV_CYRYBM") private String LV_CYRYBM; + @JSONField(name="LV_GMSFHM") private String LV_GMSFHM; + @JSONField(name="LV_XM") private String LV_XM; + @JSONField(name="LV_DWBM") private String LV_DWBM; + @JSONField(name="LV_DWMC") private String LV_DWMC; + @JSONField(name="LV_ZY") private String LV_ZY; + @JSONField(name="LV_ZYLB") private String LV_ZYLB; + @JSONField(name="LV_DJDWGAJGJGDM") private String LV_DJDWGAJGJGDM; + @JSONField(name="LV_DJDWGAJGJGMC") private String LV_DJDWGAJGJGMC; + @JSONField(name="LV_DJR") private String LV_DJR; + @JSONField(name="LV_DJSJ") private String LV_DJSJ; + @JSONField(name="LV_LXFS") private String LV_LXFS; + @JSONField(name="LV_COMPUTERID") private String LV_COMPUTERID; + @JSONField(name="LV_PROCMODE") private String LV_PROCMODE = "PMINSERT"; } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/xian/vo/XaMJKXX.java b/shapelight-admin/src/main/java/net/shapelight/modules/xian/vo/XaMJKXX.java index 3f15cf1..a4640de 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/xian/vo/XaMJKXX.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/xian/vo/XaMJKXX.java @@ -1,21 +1,30 @@ package net.shapelight.modules.xian.vo; +import com.alibaba.fastjson.annotation.JSONField; import lombok.Data; @Data public class XaMJKXX { + @JSONField(name="LV_MJKLX") private String LV_MJKLX; + @JSONField(name="LV_DJSJ") private String LV_DJSJ; + @JSONField(name="LV_SSXQBM") private String LV_SSXQBM; + @JSONField(name="LV_SBXT") private String LV_SBXT; + @JSONField(name="LV_CKR") private String LV_CKR; + @JSONField(name="LV_BH") private String LV_BH; + + @JSONField(name="LV_PROCMODE") private String LV_PROCMODE = "PMINSERT"; } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/xian/vo/XaMJSBXX.java b/shapelight-admin/src/main/java/net/shapelight/modules/xian/vo/XaMJSBXX.java index 51770be..f1c9839 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/xian/vo/XaMJSBXX.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/xian/vo/XaMJSBXX.java @@ -1,23 +1,31 @@ package net.shapelight.modules.xian.vo; +import com.alibaba.fastjson.annotation.JSONField; import lombok.Data; @Data public class XaMJSBXX { + @JSONField(name="LV_MJMC") private String LV_MJMC; + @JSONField(name="LV_WZMS") private String LV_WZMS; + @JSONField(name="LV_SFYSXT") private String LV_SFYSXT; + @JSONField(name="LV_SSXQBM") private String LV_SSXQBM; + @JSONField(name="LV_SBXT") private String LV_SBXT; + @JSONField(name="LV_MJXTWYBM") private String LV_MJXTWYBM; + @JSONField(name="LV_PROCMODE") private String LV_PROCMODE = "PMINSERT"; } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/xian/vo/XaRYJCZPXX.java b/shapelight-admin/src/main/java/net/shapelight/modules/xian/vo/XaRYJCZPXX.java index b643e6a..1938cc9 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/xian/vo/XaRYJCZPXX.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/xian/vo/XaRYJCZPXX.java @@ -1,18 +1,23 @@ package net.shapelight.modules.xian.vo; +import com.alibaba.fastjson.annotation.JSONField; import lombok.Data; @Data public class XaRYJCZPXX { + @JSONField(name="LV_SSXQBM") private String LV_SSXQBM; + @JSONField(name="LV_MJXTWYBM") private String LV_MJXTWYBM; + @JSONField(name="LV_ZPZP") private String LV_ZPZP; + @JSONField(name="LV_ZPSJ") private String LV_ZPSJ; diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/xian/vo/XaRYRKPHOTO.java b/shapelight-admin/src/main/java/net/shapelight/modules/xian/vo/XaRYRKPHOTO.java index dee0fae..c73d1fb 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/xian/vo/XaRYRKPHOTO.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/xian/vo/XaRYRKPHOTO.java @@ -1,12 +1,23 @@ package net.shapelight.modules.xian.vo; +import com.alibaba.fastjson.annotation.JSONField; import lombok.Data; @Data public class XaRYRKPHOTO { + + @JSONField(name="LV_CASE_ID") private String LV_CASE_ID; + + @JSONField(name="LV_SSXQBM") private String LV_SSXQBM; + + @JSONField(name="LV_ZP") private String LV_ZP; + + @JSONField(name="LV_DJSJ") private String LV_DJSJ; + + @JSONField(name="LV_GMSFHM") private String LV_GMSFHM; } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/xian/vo/XaRYSKZPXX.java b/shapelight-admin/src/main/java/net/shapelight/modules/xian/vo/XaRYSKZPXX.java index 5fa49be..51fce50 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/xian/vo/XaRYSKZPXX.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/xian/vo/XaRYSKZPXX.java @@ -1,28 +1,37 @@ package net.shapelight.modules.xian.vo; +import com.alibaba.fastjson.annotation.JSONField; import lombok.Data; @Data public class XaRYSKZPXX { + @JSONField(name="LV_SSXQBM") private String LV_SSXQBM; + @JSONField(name="LV_MJBH") private String LV_MJBH; + @JSONField(name="LV_CRLB") private String LV_CRLB; + @JSONField(name="LV_ZPSJ") private String LV_ZPSJ; + @JSONField(name="LV_SBXT") private String LV_SBXT = "10"; + @JSONField(name="LV_MJXTWYBM") private String LV_MJXTWYBM; + @JSONField(name="LV_RY_ID") private String LV_RY_ID; + @JSONField(name="LV_FFMS") private String LV_FFMS; - + @JSONField(name="LV_PROCMODE") private String LV_PROCMODE = "PMINSERT"; } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/xian/vo/XaSYDW.java b/shapelight-admin/src/main/java/net/shapelight/modules/xian/vo/XaSYDW.java index fa2ee05..dc5ce07 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/xian/vo/XaSYDW.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/xian/vo/XaSYDW.java @@ -1,36 +1,49 @@ package net.shapelight.modules.xian.vo; +import com.alibaba.fastjson.annotation.JSONField; import lombok.Data; @Data public class XaSYDW { + @JSONField(name="LV_DWBM") private String LV_DWBM; + @JSONField(name="LV_DWMC") private String LV_DWMC; + @JSONField(name="LV_DWDZBM") private String LV_DWDZBM; + @JSONField(name="LV_DZLB") private String LV_DZLB; + @JSONField(name="LV_HZDWLX") private String LV_HZDWLX; + @JSONField(name="LV_DWXZ") private String LV_DWXZ; + @JSONField(name="LV_DJDWGAJGJGMC") private String LV_DJDWGAJGJGMC; + @JSONField(name="LV_DJDWGAJGJGDM") private String LV_DJDWGAJGJGDM; + @JSONField(name="LV_DJSJ") private String LV_DJSJ; + @JSONField(name="LV_DJR") private String LV_DJR; + @JSONField(name="LV_COMPUTERID") private String LV_COMPUTERID; + @JSONField(name="LV_SSXQBM") private String LV_SSXQBM; - + @JSONField(name="LV_PROCMODE") private String LV_PROCMODE = "PMINSERT"; diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/xian/vo/XaTCCTCSBXX.java b/shapelight-admin/src/main/java/net/shapelight/modules/xian/vo/XaTCCTCSBXX.java index 18b0e3c..c5f359a 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/xian/vo/XaTCCTCSBXX.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/xian/vo/XaTCCTCSBXX.java @@ -1,26 +1,36 @@ package net.shapelight.modules.xian.vo; +import com.alibaba.fastjson.annotation.JSONField; import lombok.Data; @Data public class XaTCCTCSBXX { + @JSONField(name="LV_TCCBH") private String LV_TCCBH; + @JSONField(name="LV_CPHM") private String LV_CPHM; + @JSONField(name="LV_CPLX") private String LV_CPLX; + @JSONField(name="LV_GCSJ") private String LV_GCSJ; + @JSONField(name="LV_GCLX") private String LV_GCLX; + @JSONField(name="LV_SBXT") private String LV_SBXT = "10"; + @JSONField(name="LV_KKSBBH") private String LV_KKSBBH; + @JSONField(name="LV_PROCMODE") private String LV_PROCMODE = "PMINSERT"; - + @JSONField(name="LV_JKBM") + private String LV_JKBM; } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/xian/vo/XaTCCTCSBXXEXIT.java b/shapelight-admin/src/main/java/net/shapelight/modules/xian/vo/XaTCCTCSBXXEXIT.java new file mode 100644 index 0000000..06b899f --- /dev/null +++ b/shapelight-admin/src/main/java/net/shapelight/modules/xian/vo/XaTCCTCSBXXEXIT.java @@ -0,0 +1,38 @@ +package net.shapelight.modules.xian.vo; + + +import com.alibaba.fastjson.annotation.JSONField; +import lombok.Data; + +@Data +public class XaTCCTCSBXXEXIT { + + @JSONField(name="LV_TCCBH") + private String LV_TCCBH; + + @JSONField(name="LV_CPHM") + private String LV_CPHM; + + @JSONField(name="LV_CPLX") + private String LV_CPLX; + + @JSONField(name="LV_GCSJ") + private String LV_GCSJ; + + @JSONField(name="LV_GCLX") + private String LV_GCLX; + + @JSONField(name="LV_SBXT") + private String LV_SBXT = "10"; + + @JSONField(name="LV_KKSBBH") + private String LV_KKSBBH; + + @JSONField(name="LV_PROCMODE") + private String LV_PROCMODE = "PMINSERT"; + + @JSONField(name="LV_CKBM") + private String LV_CKBM; + + +} diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/xian/vo/XaTCCTCSBZPXX.java b/shapelight-admin/src/main/java/net/shapelight/modules/xian/vo/XaTCCTCSBZPXX.java index ca41935..aa1cc85 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/xian/vo/XaTCCTCSBZPXX.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/xian/vo/XaTCCTCSBZPXX.java @@ -1,16 +1,20 @@ package net.shapelight.modules.xian.vo; +import com.alibaba.fastjson.annotation.JSONField; import lombok.Data; @Data public class XaTCCTCSBZPXX { + @JSONField(name="LV_TCCBH") private String LV_TCCBH; + @JSONField(name="LV_ZPZP") private String LV_ZPZP; + @JSONField(name="LV_ZPSJ") private String LV_ZPSJ; diff --git a/shapelight-admin/src/main/resources/mapper/ten/TenPersonDao.xml b/shapelight-admin/src/main/resources/mapper/ten/TenPersonDao.xml index 0a00b1c..5b7c841 100644 --- a/shapelight-admin/src/main/resources/mapper/ten/TenPersonDao.xml +++ b/shapelight-admin/src/main/resources/mapper/ten/TenPersonDao.xml @@ -929,6 +929,7 @@ where cell_id = #{cellId} and delete_flag = 0 and (person_type = 5000 || person_type = 5001) and xa_sync_image = 0 + and xa_sync = 1 diff --git a/shapelight-admin/src/main/resources/mapper/ten/TenRecordDao.xml b/shapelight-admin/src/main/resources/mapper/ten/TenRecordDao.xml index 192a556..fb97c58 100644 --- a/shapelight-admin/src/main/resources/mapper/ten/TenRecordDao.xml +++ b/shapelight-admin/src/main/resources/mapper/ten/TenRecordDao.xml @@ -409,12 +409,15 @@ select * from ten_record_${tenantId} where cell_id = #{cellId} and xa_sync = 0 + and TO_DAYS(record_time) = TO_DAYS(NOW())