1.netty延时启动 2.获取doorcard getone重复数据bug 3.公安接口

This commit is contained in:
gaoben 2021-04-08 19:29:13 +08:00
parent 2fab6df4a4
commit f4a96f4fea
27 changed files with 849 additions and 236 deletions

View File

@ -256,89 +256,89 @@ public class CarOpenApi {
@PostMapping({"/pushCarRecord"})
@ApiOperation("第三方推送")
public Map pushCarRecord(@RequestBody Object object) {
Map<String, String> 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<String, String> 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;
}
}

View File

@ -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<TenCellEntity> allCells = this.tenCellService.list((Wrapper)(new QueryWrapper())
List<TenCellEntity> 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<TenRecordEntity> records = this.tenRecordService.getNotSyncImage(cellId, tenantId);
List<XaRYJCZPXX> syncrecords = new ArrayList<>();
List<XaRYJCZPXX> syncRecords = new ArrayList();
List<TenRecordEntity> 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<TenAddressEntity>()
.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<XaPages> 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<TenPackRecordEntity> records = this.tenPackRecordService.getNotSync(cellId);
List<XaTCCTCSBZPXX> 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<TenPackRecordEnterEntity> records = this.tenPackRecordEnterService.getNotSync(cellId);
// List<XaTCCTCSBXX> syncRecords = new ArrayList();
// List<TenPackRecordEnterEntity> updateRecords = new ArrayList<>();
// int count = 0;
// for (TenPackRecordEnterEntity record : records) {
// XaTCCTCSBXX syncRecord = new XaTCCTCSBXX();
//
// TenPackEntity packEntity = tenPackService.getOne(new QueryWrapper<TenPackEntity>()
// .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<TenPackChannalEntity>()
// .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<XaPages> 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<TenPackRecordExitEntity> records = this.tenPackRecordExitService.getNotSync(cellId);
// List<XaTCCTCSBXXEXIT> syncRecords = new ArrayList();
// List<TenPackRecordExitEntity> updateRecords = new ArrayList<>();
// int count = 0;
// for (TenPackRecordExitEntity record : records) {
// XaTCCTCSBXXEXIT syncRecord = new XaTCCTCSBXXEXIT();
//
// TenPackEntity packEntity = tenPackService.getOne(new QueryWrapper<TenPackEntity>()
// .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<TenPackChannalEntity>()
// .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<XaPages> 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<TenPersonEntity> persons = this.tenPersonService.getNotSyncImage(cellId);
List<XaRYRKPHOTO> syncPersons = new ArrayList<>();
List<XaRYRKPHOTO> syncPersons = new ArrayList();
List<TenPersonEntity> 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<XaPages> 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);
}
}
}
}

View File

@ -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()); //姓名

View File

@ -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<TenCellEntity> 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<TenRecordEntity> records = this.tenRecordService.getNotSync(cellId, tenantId);
List<XaRYSKZPXX> syncrecords = new ArrayList<>();
List<TenRecordEntity> records = this.tenRecordService.getNotSync(cellId,tenantId);
List<XaRYSKZPXX> syncRecords = new ArrayList();
List<TenRecordEntity> 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<TenAddressEntity>()
.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<XaPages> 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<TenPackRecordEntity> records = this.tenPackRecordService.getNotSync(cellId);
List<XaTCCTCSBXX> syncrecords = new ArrayList<>();
private void processRecordCarEnter(String appId, String appSecret, String xqid, String fwikUrl, Long cellId) {
List<TenPackRecordEnterEntity> records = this.tenPackRecordEnterService.getNotSync(cellId);
List<XaTCCTCSBXX> syncRecords = new ArrayList();
List<TenPackRecordEnterEntity> 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<TenPackEntity>()
.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<TenPackChannalEntity>()
.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<XaPages> 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<TenPackRecordExitEntity> records = this.tenPackRecordExitService.getNotSync(cellId);
List<XaTCCTCSBXXEXIT> syncRecords = new ArrayList();
List<TenPackRecordExitEntity> updateRecords = new ArrayList<>();
int count = 0;
for (TenPackRecordExitEntity record : records) {
XaTCCTCSBXXEXIT syncRecord = new XaTCCTCSBXXEXIT();
TenPackEntity packEntity = tenPackService.getOne(new QueryWrapper<TenPackEntity>()
.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<TenPackChannalEntity>()
.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<XaPages> 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);
}
}
}
}

View File

@ -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<String> 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");
}
/**

View File

@ -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对象标识当服务器请求处理线程全满时用于临时存放已完成三次握手的请求的队列的最大长度如果未设置或所设置的值小于1Java将使用默认值50

View File

@ -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<MyMessage> {
@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<MyMessage> {
if (e.state() == IdleState.READER_IDLE) {//没收到任何数据就关掉链接
ctx.close();
clientMap.offline(ctx.channel());
log.info("无数据设备离线");
log.debug("无数据设备离线");
} else if (e.state() == IdleState.WRITER_IDLE) {
}
}

View File

@ -107,6 +107,7 @@ public class StartInit implements ServletContextListener {
new Thread() {
public void run() {
try {
sleep(20000);
server.run();
} catch (Exception e) {
e.printStackTrace();

View File

@ -291,11 +291,15 @@ public class DeviceApiServiceImpl implements DeviceApiService {
if(doorCardEntity!=null){
puser.setCard_id(doorCardEntity.getDoorCard());
}else{
TenDoorCardEntity doorCardRoom = tenDoorCardService.getOne(
List<TenDoorCardEntity> doorCardRooms = tenDoorCardService.list(
new QueryWrapper<TenDoorCardEntity>()
.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());
}

View File

@ -64,8 +64,10 @@ public class ServerApiServiceImpl implements ServerApiService {
@Override
public int personOperation(String sn,List<TenPersonOperationVo> operationVoList) {
log.debug("下发同步信息:"+sn);
Channel channel = clientMap.getChannelByUserId(sn);
if(channel == null){
log.debug("下发同步信息:"+sn+" 不在线");
return -1;
}
String content = JSONObject.toJSONString(operationVoList);

View File

@ -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<TenPackRecordEnterEntity> {
PageUtils queryPage(Map<String, Object> paramMap);
List<TenPackRecordEnterEntity> getNotSync(Long cellId);
List<TenPackRecordEnterEntity> getNotSyncImage(Long cellId);
}

View File

@ -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<TenPackRecordExitEntity> {
PageUtils queryPage(Map<String, Object> paramMap);
List<TenPackRecordExitEntity> getNotSync(Long cellId);
List<TenPackRecordExitEntity> getNotSyncImage(Long cellId);
}

View File

@ -34,9 +34,9 @@ public interface TenRecordService {
List<TenRecordEntity> getLastRecord(Map<String, Object> params);
List<TenRecordEntity> getNotSync(Long paramLong1, Long paramLong2);
List<TenRecordEntity> getNotSync(Long cellId, Long tenantId);
List<TenRecordEntity> getNotSyncImage(Long paramLong1, Long paramLong2);
List<TenRecordEntity> getNotSyncImage(Long cellId, Long tenantId);
}

View File

@ -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<TenPackRecordEnte
}
return new PageUtils(page);
}
@Override
public List<TenPackRecordEnterEntity> 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<TenPackRecordEnterEntity>()
.eq("cell_id",cellId)
.eq("xa_sync",0)
.gt("enter_time",todayStart)
.lt("enter_time",todayEnd));
}
@Override
public List<TenPackRecordEnterEntity> 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<TenPackRecordEnterEntity>()
.eq("cell_id",cellId)
.eq("xa_sync_image",0)
.gt("enter_time",todayStart)
.lt("enter_time",todayEnd));
}
}

View File

@ -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<TenPackRecordExitD
}
return new PageUtils(page);
}
@Override
public List<TenPackRecordExitEntity> getNotSync(Long cellId) {
return this.list(new QueryWrapper<TenPackRecordExitEntity>()
.eq("cell_id",cellId)
.eq("xa_sync",0));
}
@Override
public List<TenPackRecordExitEntity> getNotSyncImage(Long cellId) {
return this.list(new QueryWrapper<TenPackRecordExitEntity>()
.eq("cell_id",cellId)
.eq("xa_sync_image",0));
}
}

View File

@ -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";
}

View File

@ -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";
}

View File

@ -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";
}

View File

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

View File

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

View File

@ -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";
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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())
</select>
<select id="getNotSyncImage" resultType="net.shapelight.modules.ten.entity.TenRecordEntity">
select * from ten_record_${tenantId}
where cell_id = #{cellId}
and xa_sync_image = 0
and xa_sync = 1
and TO_DAYS(record_time) = TO_DAYS(NOW())
</select>