parent
2090cffd3c
commit
96fd9ff546
|
@ -68,6 +68,9 @@ public class CarOpenApi {
|
|||
@Autowired
|
||||
private TenPackService tenPackService;
|
||||
|
||||
@Autowired
|
||||
private TenPackChannalService tenPackChannalService;
|
||||
|
||||
@PostMapping({"/getMsg/{cellId}"})
|
||||
@ApiOperation("获取MSG")
|
||||
@ApiImplicitParams({@ApiImplicitParam(name = "sn", value = "设备sn", paramType = "query", dataType = "String", required = true)})
|
||||
|
@ -122,68 +125,135 @@ public class CarOpenApi {
|
|||
return R.ok();
|
||||
}
|
||||
|
||||
@PostMapping({"/pushEnterRecord"})
|
||||
@ApiOperation("第三方推送入场记录")
|
||||
public Map pushEnterRecord(@RequestBody Object object) {
|
||||
Map<String, String> res = new HashMap<>();
|
||||
res.put("code", "401");
|
||||
res.put("msg", "签名结果不一致");
|
||||
JSONObject msgJson = (JSONObject) JSONObject.toJSON(object);
|
||||
String sign = msgJson.getString("sign");
|
||||
String appKey = msgJson.getString("appKey");
|
||||
Long timestamp = msgJson.getLong("timestamp");
|
||||
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");
|
||||
long enterTimeLong = bizContent.getLongValue("enterTime");
|
||||
Date enterTime = new Date(enterTimeLong * 1000L);
|
||||
int type = bizContent.getIntValue("type");
|
||||
int carType = bizContent.getIntValue("carType");
|
||||
String imgUrl = bizContent.getString("imgUrl");
|
||||
|
||||
//去掉 amp;
|
||||
imgUrl = imgUrl.replace("amp;", "");
|
||||
|
||||
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 (!StringUtils.isEmpty(imgUrl)) {
|
||||
URL url = null;
|
||||
InputStream is = null;
|
||||
HttpURLConnection httpUrl = null;
|
||||
try {
|
||||
url = new URL(imgUrl);
|
||||
|
||||
BufferedImage image = ImageIO.read(url);
|
||||
//获取图片的宽、高
|
||||
System.out.println("Width: " + image.getWidth());
|
||||
System.out.println("Height: " + image.getHeight());
|
||||
int w = image.getWidth();
|
||||
int h = image.getHeight();
|
||||
//调整尺寸不能大于1024
|
||||
if(w>1024 || h>1024){
|
||||
image = ThumbnailsUtils.resizeImageOne(image,1024,1024);
|
||||
}
|
||||
|
||||
String fileName = "car/" + enter.getParkCode() + "/" + UUIDUtil.uuid() + ".jpg";
|
||||
|
||||
byte[] data = ImageUtils.imageToBytes(image);
|
||||
is = new ByteArrayInputStream(data);
|
||||
int rl = is.available();
|
||||
PutObjectOptions putObjectOptions = new PutObjectOptions(rl, -1L);
|
||||
putObjectOptions.setContentType("image/jpeg");
|
||||
this.minioClient.putObject(this.minioConfig
|
||||
.getBucketName(), fileName, is, putObjectOptions);
|
||||
|
||||
// @PostMapping({"/pushEnterRecord"})
|
||||
// @ApiOperation("第三方推送入场记录")
|
||||
// public Map pushEnterRecord(@RequestBody Object object) {
|
||||
// Map<String, String> res = new HashMap<>();
|
||||
// res.put("code", "401");
|
||||
// res.put("msg", "签名结果不一致");
|
||||
// JSONObject msgJson = (JSONObject) JSONObject.toJSON(object);
|
||||
// String sign = msgJson.getString("sign");
|
||||
// String appKey = msgJson.getString("appKey");
|
||||
// Long timestamp = msgJson.getLong("timestamp");
|
||||
// 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");
|
||||
// long enterTimeLong = bizContent.getLongValue("enterTime");
|
||||
// Date enterTime = new Date(enterTimeLong * 1000L);
|
||||
// int type = bizContent.getIntValue("type");
|
||||
// int carType = bizContent.getIntValue("carType");
|
||||
// String imgUrl = bizContent.getString("imgUrl");
|
||||
//
|
||||
// //去掉 amp;
|
||||
// imgUrl = imgUrl.replace("amp;", "");
|
||||
//
|
||||
// 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 (!StringUtils.isEmpty(imgUrl)) {
|
||||
// URL url = null;
|
||||
// InputStream is = null;
|
||||
// HttpURLConnection httpUrl = null;
|
||||
// try {
|
||||
// url = new URL(imgUrl);
|
||||
//
|
||||
// BufferedImage image = ImageIO.read(url);
|
||||
// //获取图片的宽、高
|
||||
// System.out.println("Width: " + image.getWidth());
|
||||
// System.out.println("Height: " + image.getHeight());
|
||||
// int w = image.getWidth();
|
||||
// int h = image.getHeight();
|
||||
// //调整尺寸不能大于1024
|
||||
// if(w>1024 || h>1024){
|
||||
// image = ThumbnailsUtils.resizeImageOne(image,1024,1024);
|
||||
// }
|
||||
//
|
||||
// String fileName = "car/" + enter.getParkCode() + "/" + UUIDUtil.uuid() + ".jpg";
|
||||
//
|
||||
// byte[] data = ImageUtils.imageToBytes(image);
|
||||
// is = new ByteArrayInputStream(data);
|
||||
// int rl = is.available();
|
||||
// PutObjectOptions putObjectOptions = new PutObjectOptions(rl, -1L);
|
||||
// putObjectOptions.setContentType("image/jpeg");
|
||||
// this.minioClient.putObject(this.minioConfig
|
||||
// .getBucketName(), fileName, is, putObjectOptions);
|
||||
//
|
||||
//// httpUrl = (HttpURLConnection) url.openConnection();
|
||||
//// httpUrl.connect();
|
||||
//// httpUrl.getInputStream();
|
||||
//// is = httpUrl.getInputStream();
|
||||
//// String fileName = "car/" + enter.getParkCode() + "/" + UUIDUtil.uuid() + ".jpg";
|
||||
//// PutObjectOptions putObjectOptions = new PutObjectOptions(is.available(), -1L);
|
||||
//// putObjectOptions.setContentType("image/jpeg");
|
||||
//// this.minioClient.putObject(this.minioConfig
|
||||
//// .getBucketName(), fileName, is, putObjectOptions);
|
||||
// enter.setImage(fileName);
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// } finally {
|
||||
// if (is != null)
|
||||
// try {
|
||||
// is.close();
|
||||
// } catch (IOException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// if (httpUrl != null)
|
||||
// httpUrl.disconnect();
|
||||
// }
|
||||
// }
|
||||
// this.tenPackRecordEnterService.save(enter);
|
||||
// res.put("code", "200");
|
||||
// res.put("msg", "成功");
|
||||
// return res;
|
||||
// }
|
||||
//
|
||||
// @PostMapping({"/pushExitRecord"})
|
||||
// @ApiOperation("第三方推送出场记录")
|
||||
// public Map pushExitRecord(@RequestBody Object object) {
|
||||
// Map<String, String> res = new HashMap<>();
|
||||
// res.put("code", "401");
|
||||
// res.put("msg", "签名结果不一致");
|
||||
// JSONObject msgJson = (JSONObject) JSONObject.toJSON(object);
|
||||
// String sign = msgJson.getString("sign");
|
||||
// String appKey = msgJson.getString("appKey");
|
||||
// Long timestamp = msgJson.getLong("timestamp");
|
||||
// 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");
|
||||
// long exitTimeLong = bizContent.getLongValue("exitTime");
|
||||
// Date exitTime = new Date(exitTimeLong * 1000L);
|
||||
// int type = bizContent.getIntValue("type");
|
||||
// int carType = bizContent.getIntValue("carType");
|
||||
// long parkTime = bizContent.getLongValue("parkTime");
|
||||
// String imgUrl = bizContent.getString("imgUrl");
|
||||
// TenPackRecordExitEntity enter = new TenPackRecordExitEntity();
|
||||
// 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.setExitTime(exitTime);
|
||||
// enter.setPackTime(Long.valueOf(parkTime));
|
||||
// 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();
|
||||
|
@ -193,92 +263,25 @@ public class CarOpenApi {
|
|||
// putObjectOptions.setContentType("image/jpeg");
|
||||
// this.minioClient.putObject(this.minioConfig
|
||||
// .getBucketName(), fileName, is, putObjectOptions);
|
||||
enter.setImage(fileName);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (is != null)
|
||||
try {
|
||||
is.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (httpUrl != null)
|
||||
httpUrl.disconnect();
|
||||
}
|
||||
}
|
||||
this.tenPackRecordEnterService.save(enter);
|
||||
res.put("code", "200");
|
||||
res.put("msg", "成功");
|
||||
return res;
|
||||
}
|
||||
|
||||
@PostMapping({"/pushExitRecord"})
|
||||
@ApiOperation("第三方推送出场记录")
|
||||
public Map pushExitRecord(@RequestBody Object object) {
|
||||
Map<String, String> res = new HashMap<>();
|
||||
res.put("code", "401");
|
||||
res.put("msg", "签名结果不一致");
|
||||
JSONObject msgJson = (JSONObject) JSONObject.toJSON(object);
|
||||
String sign = msgJson.getString("sign");
|
||||
String appKey = msgJson.getString("appKey");
|
||||
Long timestamp = msgJson.getLong("timestamp");
|
||||
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");
|
||||
long exitTimeLong = bizContent.getLongValue("exitTime");
|
||||
Date exitTime = new Date(exitTimeLong * 1000L);
|
||||
int type = bizContent.getIntValue("type");
|
||||
int carType = bizContent.getIntValue("carType");
|
||||
long parkTime = bizContent.getLongValue("parkTime");
|
||||
String imgUrl = bizContent.getString("imgUrl");
|
||||
TenPackRecordExitEntity enter = new TenPackRecordExitEntity();
|
||||
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.setExitTime(exitTime);
|
||||
enter.setPackTime(Long.valueOf(parkTime));
|
||||
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();
|
||||
String fileName = "car/" + enter.getParkCode() + "/" + UUIDUtil.uuid() + ".jpg";
|
||||
PutObjectOptions putObjectOptions = new PutObjectOptions(is.available(), -1L);
|
||||
putObjectOptions.setContentType("image/jpeg");
|
||||
this.minioClient.putObject(this.minioConfig
|
||||
.getBucketName(), fileName, is, putObjectOptions);
|
||||
enter.setImage(fileName);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (is != null)
|
||||
try {
|
||||
is.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (httpUrl != null)
|
||||
httpUrl.disconnect();
|
||||
}
|
||||
}
|
||||
this.tenPackRecordExitService.save(enter);
|
||||
res.put("code", "200");
|
||||
res.put("msg", "成功");
|
||||
return res;
|
||||
}
|
||||
// enter.setImage(fileName);
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// } finally {
|
||||
// if (is != null)
|
||||
// try {
|
||||
// is.close();
|
||||
// } catch (IOException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// if (httpUrl != null)
|
||||
// httpUrl.disconnect();
|
||||
// }
|
||||
// }
|
||||
// this.tenPackRecordExitService.save(enter);
|
||||
// res.put("code", "200");
|
||||
// res.put("msg", "成功");
|
||||
// return res;
|
||||
// }
|
||||
|
||||
|
||||
/*
|
||||
|
@ -383,11 +386,22 @@ public class CarOpenApi {
|
|||
//
|
||||
Long cellId = null;
|
||||
Long tenantId = null;
|
||||
String parkCodeXa = null;
|
||||
String channalCodeXa = null;
|
||||
TenPackEntity packEntity = tenPackService.getOne(new QueryWrapper<TenPackEntity>()
|
||||
.eq("park_code",parkCode));
|
||||
if(packEntity!=null){
|
||||
cellId = packEntity.getCellId();
|
||||
tenantId = packEntity.getTenantId();
|
||||
parkCodeXa = packEntity.getParkCodeXa();
|
||||
TenPackChannalEntity channalEntity = tenPackChannalService.getOne(
|
||||
new QueryWrapper<TenPackChannalEntity>()
|
||||
.eq("channal_name",channelName)
|
||||
.eq("pack_id",packEntity.getParkId())
|
||||
);
|
||||
if(channalEntity!=null){
|
||||
channalCodeXa = channalEntity.getChannalCodeXa();
|
||||
}
|
||||
}
|
||||
if (serviceName.equals("enter")) {
|
||||
long enterTimeLong = bizContent.getLongValue("enterTime");
|
||||
|
@ -403,6 +417,8 @@ public class CarOpenApi {
|
|||
enter.setEnterTime(enterTime);
|
||||
enter.setCellId(cellId);
|
||||
enter.setTenantId(tenantId);
|
||||
enter.setParkCodeXa(parkCodeXa);
|
||||
enter.setChannalCodeXa(channalCodeXa);
|
||||
if (fileName.length() > 0)
|
||||
enter.setImage(fileName);
|
||||
this.tenPackRecordEnterService.save(enter);
|
||||
|
|
|
@ -8,10 +8,7 @@ import io.minio.MinioClient;
|
|||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Base64;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.shapelight.common.config.MinioConfig;
|
||||
|
@ -164,7 +161,7 @@ public class XaImageTask implements ITask {
|
|||
syncRecords.add(syncRecord);
|
||||
updateRecords.add(record);
|
||||
count++;
|
||||
if (count >= 30)
|
||||
if (count >= 10)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -185,71 +182,133 @@ public class XaImageTask implements ITask {
|
|||
|
||||
String enJson = XaUtils.encryptStr(json.trim(), appSecret);
|
||||
|
||||
TenTranEntity tranEntity = tenTranService.saveApi(fwikUrl,"","RYJCZPXX", "RYJCZPXX", appId, appSecret);
|
||||
List<XaRYJCZPXX> syncRecordsUpdates = jsonData.getDatas();
|
||||
for(XaRYJCZPXX xx: syncRecordsUpdates){
|
||||
xx.setLV_ZPZP("");
|
||||
}
|
||||
|
||||
TenTranEntity tranEntity = tenTranService.saveApi(fwikUrl,jsonData,"RYJCZPXX", "RYJCZPXX", appId, appSecret);
|
||||
String tranId = String.format("%s%016d",DateUtils.format(tranEntity.getTranDate(),"yyyyMMddHHmmss"),tranEntity.getTranId());
|
||||
|
||||
String resJson = XaApi.httpPOSTJson(fwikUrl, enJson, "RYJCZPXX", "RYJCZPXX", appId, appSecret,tranId);
|
||||
// String resJson = "{\"sta\":{\"code\":\"0000\",\"des\":\"成功\",\"ErrorLineParameter\":\"empty\"},\"datas\":[{\"Result\":\"接收成功\"}],\"pages\":[{\"psize\":\"1\",\"tcount\":\"1\",\"pno\":\"1\",\"tsize\":\"0\"}]}";
|
||||
// String resJson = "23232";
|
||||
// System.out.println(s);
|
||||
log.debug("上传人员识别记录返回数据:" + resJson);
|
||||
log.debug("上传人员识别记录图片返回数据:" + resJson);
|
||||
tranEntity.setTranResult(resJson);
|
||||
tenTranService.updateById(tranEntity);
|
||||
//上传成功,修改sync状态
|
||||
if (resJson.contains("\"code\":\"0000\"")) {
|
||||
for (TenRecordEntity recordEntity : updateRecords) {
|
||||
recordEntity.setXaSyncImage(1);
|
||||
tenRecordService.updateById(recordEntity);
|
||||
// if (resJson.contains("\"code\":\"0000\"")) {
|
||||
// for (TenRecordEntity recordEntity : updateRecords) {
|
||||
// recordEntity.setXaSyncImage(1);
|
||||
// tenRecordService.updateById(recordEntity);
|
||||
// }
|
||||
// }
|
||||
if(resJson.contains("ErrorLineParameter")){
|
||||
JSONObject resJsonObject = JSONObject.parseObject(resJson);
|
||||
String errLine = resJsonObject.getJSONObject("sta").getString("ErrorLineParameter").trim();
|
||||
if(errLine.equals("empty")){
|
||||
for (TenRecordEntity recordEntity : updateRecords) {
|
||||
recordEntity.setXaSyncImage(1);
|
||||
tenRecordService.updateById(recordEntity);
|
||||
}
|
||||
}else{
|
||||
String[] lines = errLine.split(",");
|
||||
List<String> lineList = Arrays.asList(lines);
|
||||
for (int i = 0;i<updateRecords.size();i++) {
|
||||
if(lineList.contains(i+1+"")){
|
||||
continue;
|
||||
}else {
|
||||
TenRecordEntity recordEntity = updateRecords.get(i);
|
||||
recordEntity.setXaSyncImage(1);
|
||||
tenRecordService.updateById(recordEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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> records = this.tenPackRecordEnterService.getNotSyncImage(cellId);
|
||||
List<XaTCCTCSBZPXX> syncRecords = new ArrayList();
|
||||
List<TenPackRecordEnterEntity> updateRecords = new ArrayList<>();
|
||||
int count = 0;
|
||||
for (TenPackRecordEnterEntity record : records) {
|
||||
XaTCCTCSBXX syncRecord = new XaTCCTCSBXX();
|
||||
XaTCCTCSBZPXX syncRecord = new XaTCCTCSBZPXX();
|
||||
|
||||
TenPackEntity packEntity = tenPackService.getOne(new QueryWrapper<TenPackEntity>()
|
||||
.eq("park_code",record.getParkCode()));
|
||||
// TenPackEntity packEntity = tenPackService.getOne(new QueryWrapper<TenPackEntity>()
|
||||
// .eq("park_code",record.getParkCode()));
|
||||
//
|
||||
// if(packEntity==null){
|
||||
// continue;
|
||||
// }
|
||||
// String packCodeXa = packEntity.getParkCodeXa();
|
||||
// if(packCodeXa==null || packCodeXa.length()==0){
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// TenPackChannalEntity channalEntity = tenPackChannalService.getOne(new QueryWrapper<TenPackChannalEntity>()
|
||||
// .eq("channal_name",record.getChannelName()));
|
||||
// if(channalEntity==null){
|
||||
// continue;
|
||||
// }
|
||||
// String channalCodeXa = channalEntity.getChannalCodeXa();
|
||||
// if(channalCodeXa==null || channalCodeXa.length()==0){
|
||||
// continue;
|
||||
// }
|
||||
|
||||
if(packEntity==null){
|
||||
|
||||
syncRecord.setLV_TCCBH(record.getParkCodeXa());
|
||||
syncRecord.setLV_ZPSJ(DateUtils.format(record.getEnterTime(), "yyyyMMddHHmmss"));
|
||||
|
||||
String base64Image = "";
|
||||
InputStream inStream = null;
|
||||
ByteArrayOutputStream outStream = null;
|
||||
|
||||
try {
|
||||
minioClient.statObject(minioConfig.getBucketName(), record.getImage());
|
||||
|
||||
inStream = minioClient.getObject(minioConfig.getBucketName(), record.getImage());
|
||||
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.getImage());
|
||||
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;
|
||||
}
|
||||
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");
|
||||
syncRecord.setLV_ZPZP(base64Image);//base64图片
|
||||
|
||||
syncRecords.add(syncRecord);
|
||||
updateRecords.add(record);
|
||||
count++;
|
||||
if (count >= 30)
|
||||
if (count >= 10)
|
||||
break;
|
||||
}
|
||||
if(count == 0){
|
||||
return;
|
||||
}
|
||||
XaData jsonData = new XaData();
|
||||
jsonData.setDatas(syncRecords);
|
||||
|
||||
|
@ -264,19 +323,43 @@ public class XaImageTask implements ITask {
|
|||
|
||||
String enJson = XaUtils.encryptStr(json.trim(), appSecret);
|
||||
|
||||
TenTranEntity tranEntity = tenTranService.saveApi(fwikUrl,"","TCCTCSBXX", "TCCTCSBXX", appId, appSecret);
|
||||
List<XaTCCTCSBZPXX> syncRecordsUpdates = jsonData.getDatas();
|
||||
for(XaTCCTCSBZPXX xx: syncRecordsUpdates){
|
||||
xx.setLV_ZPZP("");
|
||||
}
|
||||
|
||||
|
||||
TenTranEntity tranEntity = tenTranService.saveApi(fwikUrl,jsonData,"TCCTCSBZPXX", "TCCTCSBZPXX", appId, appSecret);
|
||||
String tranId = String.format("%s%016d",DateUtils.format(tranEntity.getTranDate(),"yyyyMMddHHmmss"),tranEntity.getTranId());
|
||||
|
||||
String resJson = XaApi.httpPOSTJson(fwikUrl, enJson, "TCCTCSBXX", "TCCTCSBXX", appId, appSecret,tranId);
|
||||
String resJson = XaApi.httpPOSTJson(fwikUrl, enJson, "TCCTCSBZPXX", "TCCTCSBZPXX", appId, appSecret,tranId);
|
||||
// String resJson = "{\"sta\":{\"code\":\"0000\",\"des\":\"成功\",\"ErrorLineParameter\":\"empty\"},\"datas\":[{\"Result\":\"接收成功\"}],\"pages\":[{\"psize\":\"1\",\"tcount\":\"1\",\"pno\":\"1\",\"tsize\":\"0\"}]}";
|
||||
// String resJson = "23232";
|
||||
// System.out.println(s);
|
||||
log.debug("上传车辆进场记录返回数据:" + resJson);
|
||||
log.debug("上传车辆进场图片返回数据:" + resJson);
|
||||
tranEntity.setTranResult(resJson);
|
||||
tenTranService.updateById(tranEntity);
|
||||
//上传成功,修改sync状态
|
||||
if (resJson.contains("\"code\":\"0000\"")) {
|
||||
for (TenPackRecordEnterEntity recordEntity : updateRecords) {
|
||||
recordEntity.setXaSync(1);
|
||||
tenPackRecordEnterService.updateById(recordEntity);
|
||||
if(resJson.contains("ErrorLineParameter")){
|
||||
JSONObject resJsonObject = JSONObject.parseObject(resJson);
|
||||
String errLine = resJsonObject.getJSONObject("sta").getString("ErrorLineParameter").trim();
|
||||
if(errLine.equals("empty")){
|
||||
for (TenPackRecordEnterEntity recordEntity : updateRecords) {
|
||||
recordEntity.setXaSyncImage(1);
|
||||
tenPackRecordEnterService.updateById(recordEntity);
|
||||
}
|
||||
}else{
|
||||
String[] lines = errLine.split(",");
|
||||
List<String> lineList = Arrays.asList(lines);
|
||||
for (int i = 0;i<updateRecords.size();i++) {
|
||||
if(lineList.contains(i+1+"")){
|
||||
continue;
|
||||
}else {
|
||||
TenPackRecordEnterEntity recordEntity = updateRecords.get(i);
|
||||
recordEntity.setXaSyncImage(1);
|
||||
tenPackRecordEnterService.updateById(recordEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -285,51 +368,86 @@ public class XaImageTask implements ITask {
|
|||
|
||||
|
||||
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> records = this.tenPackRecordExitService.getNotSyncImage(cellId);
|
||||
List<XaTCCTCSBZPXX> syncRecords = new ArrayList();
|
||||
List<TenPackRecordExitEntity> updateRecords = new ArrayList<>();
|
||||
int count = 0;
|
||||
for (TenPackRecordExitEntity record : records) {
|
||||
XaTCCTCSBXXEXIT syncRecord = new XaTCCTCSBXXEXIT();
|
||||
XaTCCTCSBZPXX syncRecord = new XaTCCTCSBZPXX();
|
||||
|
||||
TenPackEntity packEntity = tenPackService.getOne(new QueryWrapper<TenPackEntity>()
|
||||
.eq("park_code",record.getParkCode()));
|
||||
// TenPackEntity packEntity = tenPackService.getOne(new QueryWrapper<TenPackEntity>()
|
||||
// .eq("park_code",record.getParkCode()));
|
||||
//
|
||||
// if(packEntity==null){
|
||||
// continue;
|
||||
// }
|
||||
// String packCodeXa = packEntity.getParkCodeXa();
|
||||
// if(packCodeXa==null || packCodeXa.length()==0){
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// TenPackChannalEntity channalEntity = tenPackChannalService.getOne(new QueryWrapper<TenPackChannalEntity>()
|
||||
// .eq("channal_name",record.getChannelName()));
|
||||
// if(channalEntity==null){
|
||||
// continue;
|
||||
// }
|
||||
// String channalCodeXa = channalEntity.getChannalCodeXa();
|
||||
// if(channalCodeXa==null || channalCodeXa.length()==0){
|
||||
// continue;
|
||||
// }
|
||||
|
||||
if(packEntity==null){
|
||||
|
||||
syncRecord.setLV_TCCBH(record.getParkCodeXa());
|
||||
syncRecord.setLV_ZPSJ(DateUtils.format(record.getExitTime(), "yyyyMMddHHmmss"));
|
||||
|
||||
String base64Image = "";
|
||||
InputStream inStream = null;
|
||||
ByteArrayOutputStream outStream = null;
|
||||
|
||||
try {
|
||||
minioClient.statObject(minioConfig.getBucketName(), record.getImage());
|
||||
|
||||
inStream = minioClient.getObject(minioConfig.getBucketName(), record.getImage());
|
||||
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.getImage());
|
||||
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;
|
||||
}
|
||||
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");
|
||||
syncRecord.setLV_ZPZP(base64Image);//base64图片
|
||||
|
||||
syncRecords.add(syncRecord);
|
||||
updateRecords.add(record);
|
||||
count++;
|
||||
if (count >= 30)
|
||||
if (count >= 10)
|
||||
break;
|
||||
}
|
||||
if(count == 0){
|
||||
return;
|
||||
}
|
||||
XaData jsonData = new XaData();
|
||||
jsonData.setDatas(syncRecords);
|
||||
|
||||
|
@ -344,7 +462,12 @@ public class XaImageTask implements ITask {
|
|||
|
||||
String enJson = XaUtils.encryptStr(json.trim(), appSecret);
|
||||
|
||||
TenTranEntity tranEntity = tenTranService.saveApi(fwikUrl,"","TCCTCSBXX", "TCCTCSBXX", appId, appSecret);
|
||||
List<XaTCCTCSBZPXX> syncRecordsUpdates = jsonData.getDatas();
|
||||
for(XaTCCTCSBZPXX xx: syncRecordsUpdates){
|
||||
xx.setLV_ZPZP("");
|
||||
}
|
||||
|
||||
TenTranEntity tranEntity = tenTranService.saveApi(fwikUrl,jsonData,"TCCTCSBXX", "TCCTCSBXX", appId, appSecret);
|
||||
String tranId = String.format("%s%016d",DateUtils.format(tranEntity.getTranDate(),"yyyyMMddHHmmss"),tranEntity.getTranId());
|
||||
|
||||
|
||||
|
@ -352,12 +475,36 @@ public class XaImageTask implements ITask {
|
|||
// 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);
|
||||
log.debug("上传车辆出场记录返回数据:" + resJson);
|
||||
tranEntity.setTranResult(resJson);
|
||||
tenTranService.updateById(tranEntity);
|
||||
//上传成功,修改sync状态
|
||||
if (resJson.contains("\"code\":\"0000\"")) {
|
||||
for (TenPackRecordExitEntity recordEntity : updateRecords) {
|
||||
recordEntity.setXaSync(1);
|
||||
tenPackRecordExitService.updateById(recordEntity);
|
||||
// if (resJson.contains("\"code\":\"0000\"")) {
|
||||
// for (TenPackRecordExitEntity recordEntity : updateRecords) {
|
||||
// recordEntity.setXaSync(1);
|
||||
// tenPackRecordExitService.updateById(recordEntity);
|
||||
// }
|
||||
// }
|
||||
if(resJson.contains("ErrorLineParameter")){
|
||||
JSONObject resJsonObject = JSONObject.parseObject(resJson);
|
||||
String errLine = resJsonObject.getJSONObject("sta").getString("ErrorLineParameter").trim();
|
||||
if(errLine.equals("empty")){
|
||||
for (TenPackRecordExitEntity recordEntity : updateRecords) {
|
||||
recordEntity.setXaSyncImage(1);
|
||||
tenPackRecordExitService.updateById(recordEntity);
|
||||
}
|
||||
}else{
|
||||
String[] lines = errLine.split(",");
|
||||
List<String> lineList = Arrays.asList(lines);
|
||||
for (int i = 0;i<updateRecords.size();i++) {
|
||||
if(lineList.contains(i+1+"")){
|
||||
continue;
|
||||
}else {
|
||||
TenPackRecordExitEntity recordEntity = updateRecords.get(i);
|
||||
recordEntity.setXaSyncImage(1);
|
||||
tenPackRecordExitService.updateById(recordEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -384,9 +531,9 @@ public class XaImageTask implements ITask {
|
|||
ByteArrayOutputStream outStream = null;
|
||||
|
||||
try {
|
||||
minioClient.statObject(minioConfig.getBucketName(), person.getOrgImage());
|
||||
minioClient.statObject(minioConfig.getBucketName(), person.getFaceImage());
|
||||
|
||||
inStream = minioClient.getObject(minioConfig.getBucketName(), person.getOrgImage());
|
||||
inStream = minioClient.getObject(minioConfig.getBucketName(), person.getFaceImage());
|
||||
outStream = new ByteArrayOutputStream();
|
||||
byte[] buffer = new byte[1024];
|
||||
int length;
|
||||
|
@ -425,7 +572,7 @@ public class XaImageTask implements ITask {
|
|||
|
||||
|
||||
count++;
|
||||
if (count >= 50)
|
||||
if (count >= 10)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -446,21 +593,49 @@ public class XaImageTask implements ITask {
|
|||
|
||||
String enJson = XaUtils.encryptStr(json.trim(), appSecret);
|
||||
|
||||
TenTranEntity tranEntity = tenTranService.saveApi(fwikUrl,"","SYRK", "SYRK", appId, appSecret);
|
||||
List<XaTCCTCSBZPXX> syncRecordsUpdates = jsonData.getDatas();
|
||||
for(XaTCCTCSBZPXX xx: syncRecordsUpdates){
|
||||
xx.setLV_ZPZP("");
|
||||
}
|
||||
|
||||
|
||||
TenTranEntity tranEntity = tenTranService.saveApi(fwikUrl,jsonData,"RYRKPHOTO", "RYRKPHOTO", appId, appSecret);
|
||||
String tranId = String.format("%s%016d",DateUtils.format(tranEntity.getTranDate(),"yyyyMMddHHmmss"),tranEntity.getTranId());
|
||||
|
||||
String resJson = XaApi.httpPOSTJson(fwikUrl, enJson, "SYRK", "SYRK", appId, appSecret,tranId);
|
||||
String resJson = XaApi.httpPOSTJson(fwikUrl, enJson, "RYRKPHOTO", "RYRKPHOTO", appId, appSecret,tranId);
|
||||
// String resJson = "{\"sta\":{\"code\":\"0000\",\"des\":\"成功\",\"ErrorLineParameter\":\"empty\"},\"datas\":[{\"Result\":\"接收成功\"}],\"pages\":[{\"psize\":\"1\",\"tcount\":\"1\",\"pno\":\"1\",\"tsize\":\"0\"}]}";
|
||||
// String resJson = "23232";
|
||||
// System.out.println(s);
|
||||
log.debug("processRealPersonImage:" + resJson);
|
||||
log.debug("上传实有人口返回数据:" + resJson);
|
||||
tranEntity.setTranResult(resJson);
|
||||
tenTranService.updateById(tranEntity);
|
||||
//上传成功,修改sync状态
|
||||
if (resJson.contains("\"code\":\"0000\"")) {
|
||||
for (TenPersonEntity personEntity : updatePersons) {
|
||||
personEntity.setXaSyncImage(1);
|
||||
tenPersonService.updateNonal(personEntity);
|
||||
// if (resJson.contains("\"code\":\"0000\"")) {
|
||||
// for (TenPersonEntity personEntity : updatePersons) {
|
||||
// personEntity.setXaSyncImage(1);
|
||||
// tenPersonService.updateNonal(personEntity);
|
||||
// }
|
||||
// }
|
||||
if(resJson.contains("ErrorLineParameter")){
|
||||
JSONObject resJsonObject = JSONObject.parseObject(resJson);
|
||||
String errLine = resJsonObject.getJSONObject("sta").getString("ErrorLineParameter").trim();
|
||||
if(errLine.equals("empty")){
|
||||
for (TenPersonEntity recordEntity : updatePersons) {
|
||||
recordEntity.setXaSyncImage(1);
|
||||
tenPersonService.updateById(recordEntity);
|
||||
}
|
||||
}else{
|
||||
String[] lines = errLine.split(",");
|
||||
List<String> lineList = Arrays.asList(lines);
|
||||
for (int i = 0;i<updatePersons.size();i++) {
|
||||
if(lineList.contains(i+1+"")){
|
||||
continue;
|
||||
}else {
|
||||
TenPersonEntity recordEntity = updatePersons.get(i);
|
||||
recordEntity.setXaSyncImage(1);
|
||||
tenPersonService.updateById(recordEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,11 +5,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.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.shapelight.common.utils.DateUtils;
|
||||
|
@ -168,10 +164,32 @@ public class XaRealDataTask implements ITask {
|
|||
tranEntity.setTranResult(resJson);
|
||||
tenTranService.updateById(tranEntity);
|
||||
//上传成功,修改sync状态
|
||||
if (resJson.contains("\"code\":\"0000\"")) {
|
||||
for (TenRoomEntity room : updateRooms) {
|
||||
room.setXaSync(1);
|
||||
tenRoomService.updateById(room);
|
||||
// if (resJson.contains("\"code\":\"0000\"")) {
|
||||
// for (TenRoomEntity room : updateRooms) {
|
||||
// room.setXaSync(1);
|
||||
// tenRoomService.updateById(room);
|
||||
// }
|
||||
// }
|
||||
if(resJson.contains("ErrorLineParameter")){
|
||||
JSONObject resJsonObject = JSONObject.parseObject(resJson);
|
||||
String errLine = resJsonObject.getJSONObject("sta").getString("ErrorLineParameter").trim();
|
||||
if(errLine.equals("empty")){
|
||||
for (TenRoomEntity recordEntity : updateRooms) {
|
||||
recordEntity.setXaSync(1);
|
||||
tenRoomService.updateById(recordEntity);
|
||||
}
|
||||
}else{
|
||||
String[] lines = errLine.split(",");
|
||||
List<String> lineList = Arrays.asList(lines);
|
||||
for (int i = 0;i<updateRooms.size();i++) {
|
||||
if(lineList.contains(i+1+"")){
|
||||
continue;
|
||||
}else {
|
||||
TenRoomEntity recordEntity = updateRooms.get(i);
|
||||
recordEntity.setXaSync(1);
|
||||
tenRoomService.updateById(recordEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -249,14 +267,36 @@ public class XaRealDataTask implements ITask {
|
|||
// 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);
|
||||
log.debug("上传实有人口返回数据:" + resJson);
|
||||
tranEntity.setTranResult(resJson);
|
||||
tenTranService.updateById(tranEntity);
|
||||
//上传成功,修改sync状态
|
||||
if (resJson.contains("\"code\":\"0000\"")) {
|
||||
for (TenPersonEntity personEntity : updatePersons) {
|
||||
personEntity.setXaSync(1);
|
||||
tenPersonService.updateNonal(personEntity);
|
||||
// if (resJson.contains("\"code\":\"0000\"")) {
|
||||
// for (TenPersonEntity personEntity : updatePersons) {
|
||||
// personEntity.setXaSync(1);
|
||||
// tenPersonService.updateNonal(personEntity);
|
||||
// }
|
||||
// }
|
||||
if(resJson.contains("ErrorLineParameter")){
|
||||
JSONObject resJsonObject = JSONObject.parseObject(resJson);
|
||||
String errLine = resJsonObject.getJSONObject("sta").getString("ErrorLineParameter").trim();
|
||||
if(errLine.equals("empty")){
|
||||
for (TenPersonEntity recordEntity : updatePersons) {
|
||||
recordEntity.setXaSync(1);
|
||||
tenPersonService.updateById(recordEntity);
|
||||
}
|
||||
}else{
|
||||
String[] lines = errLine.split(",");
|
||||
List<String> lineList = Arrays.asList(lines);
|
||||
for (int i = 0;i<updatePersons.size();i++) {
|
||||
if(lineList.contains(i+1+"")){
|
||||
continue;
|
||||
}else {
|
||||
TenPersonEntity recordEntity = updatePersons.get(i);
|
||||
recordEntity.setXaSync(1);
|
||||
tenPersonService.updateById(recordEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -312,14 +352,36 @@ public class XaRealDataTask implements ITask {
|
|||
// 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);
|
||||
log.debug("上传门禁返回数据:" + resJson);
|
||||
tranEntity.setTranResult(resJson);
|
||||
tenTranService.updateById(tranEntity);
|
||||
//上传成功,修改sync状态
|
||||
if (resJson.contains("\"code\":\"0000\"")) {
|
||||
for (TenPersonEntity personEntity : updatePersons) {
|
||||
personEntity.setXaSyncCard(1);
|
||||
tenPersonService.updateNonal(personEntity);
|
||||
// if (resJson.contains("\"code\":\"0000\"")) {
|
||||
// for (TenPersonEntity personEntity : updatePersons) {
|
||||
// personEntity.setXaSyncCard(1);
|
||||
// tenPersonService.updateNonal(personEntity);
|
||||
// }
|
||||
// }
|
||||
if(resJson.contains("ErrorLineParameter")){
|
||||
JSONObject resJsonObject = JSONObject.parseObject(resJson);
|
||||
String errLine = resJsonObject.getJSONObject("sta").getString("ErrorLineParameter").trim();
|
||||
if(errLine.equals("empty")){
|
||||
for (TenPersonEntity recordEntity : updatePersons) {
|
||||
recordEntity.setXaSyncCard(1);
|
||||
tenPersonService.updateById(recordEntity);
|
||||
}
|
||||
}else{
|
||||
String[] lines = errLine.split(",");
|
||||
List<String> lineList = Arrays.asList(lines);
|
||||
for (int i = 0;i<updatePersons.size();i++) {
|
||||
if(lineList.contains(i+1+"")){
|
||||
continue;
|
||||
}else {
|
||||
TenPersonEntity recordEntity = updatePersons.get(i);
|
||||
recordEntity.setXaSyncCard(1);
|
||||
tenPersonService.updateById(recordEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -376,14 +438,36 @@ public class XaRealDataTask implements ITask {
|
|||
// 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);
|
||||
log.debug("上传设备信息返回数据:" + resJson);
|
||||
tranEntity.setTranResult(resJson);
|
||||
tenTranService.updateById(tranEntity);
|
||||
//上传成功,修改sync状态
|
||||
if (resJson.contains("\"code\":\"0000\"")) {
|
||||
for (TenDeviceEntity deviceEntity : updateDevices) {
|
||||
deviceEntity.setXaSync(1);
|
||||
tenDeviceService.evictupdateById(deviceEntity);
|
||||
// if (resJson.contains("\"code\":\"0000\"")) {
|
||||
// for (TenDeviceEntity deviceEntity : updateDevices) {
|
||||
// deviceEntity.setXaSync(1);
|
||||
// tenDeviceService.evictupdateById(deviceEntity);
|
||||
// }
|
||||
// }
|
||||
if(resJson.contains("ErrorLineParameter")){
|
||||
JSONObject resJsonObject = JSONObject.parseObject(resJson);
|
||||
String errLine = resJsonObject.getJSONObject("sta").getString("ErrorLineParameter").trim();
|
||||
if(errLine.equals("empty")){
|
||||
for (TenDeviceEntity recordEntity : updateDevices) {
|
||||
recordEntity.setXaSync(1);
|
||||
tenDeviceService.updateById(recordEntity);
|
||||
}
|
||||
}else{
|
||||
String[] lines = errLine.split(",");
|
||||
List<String> lineList = Arrays.asList(lines);
|
||||
for (int i = 0;i<updateDevices.size();i++) {
|
||||
if(lineList.contains(i+1+"")){
|
||||
continue;
|
||||
}else {
|
||||
TenDeviceEntity recordEntity = updateDevices.get(i);
|
||||
recordEntity.setXaSync(1);
|
||||
tenDeviceService.updateById(recordEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -52,8 +53,8 @@ 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 = "http://";
|
||||
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()));
|
||||
|
@ -138,10 +139,32 @@ public class XaRecordTask implements ITask {
|
|||
tranEntity.setTranResult(resJson);
|
||||
tenTranService.updateById(tranEntity);
|
||||
//上传成功,修改sync状态
|
||||
if (resJson.contains("\"code\":\"0000\"")) {
|
||||
for (TenRecordEntity recordEntity : updateRecords) {
|
||||
recordEntity.setXaSync(1);
|
||||
tenRecordService.updateById(recordEntity);
|
||||
// if (resJson.contains("\"code\":\"0000\"")) {
|
||||
// for (TenRecordEntity recordEntity : updateRecords) {
|
||||
// recordEntity.setXaSync(1);
|
||||
// tenRecordService.updateById(recordEntity);
|
||||
// }
|
||||
// }
|
||||
if(resJson.contains("ErrorLineParameter")){
|
||||
JSONObject resJsonObject = JSONObject.parseObject(resJson);
|
||||
String errLine = resJsonObject.getJSONObject("sta").getString("ErrorLineParameter").trim();
|
||||
if(errLine.equals("empty")){
|
||||
for (TenRecordEntity recordEntity : updateRecords) {
|
||||
recordEntity.setXaSync(1);
|
||||
tenRecordService.updateById(recordEntity);
|
||||
}
|
||||
}else{
|
||||
String[] lines = errLine.split(",");
|
||||
List<String> lineList = Arrays.asList(lines);
|
||||
for (int i = 0;i<updateRecords.size();i++) {
|
||||
if(lineList.contains(i+1+"")){
|
||||
continue;
|
||||
}else {
|
||||
TenRecordEntity recordEntity = updateRecords.get(i);
|
||||
recordEntity.setXaSync(1);
|
||||
tenRecordService.updateById(recordEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -220,10 +243,32 @@ public class XaRecordTask implements ITask {
|
|||
tranEntity.setTranResult(resJson);
|
||||
tenTranService.updateById(tranEntity);
|
||||
//上传成功,修改sync状态
|
||||
if (resJson.contains("\"code\":\"0000\"")) {
|
||||
for (TenPackRecordEnterEntity recordEntity : updateRecords) {
|
||||
recordEntity.setXaSync(1);
|
||||
tenPackRecordEnterService.updateById(recordEntity);
|
||||
// if (resJson.contains("\"code\":\"0000\"")) {
|
||||
// for (TenPackRecordEnterEntity recordEntity : updateRecords) {
|
||||
// recordEntity.setXaSync(1);
|
||||
// tenPackRecordEnterService.updateById(recordEntity);
|
||||
// }
|
||||
// }
|
||||
if(resJson.contains("ErrorLineParameter")){
|
||||
JSONObject resJsonObject = JSONObject.parseObject(resJson);
|
||||
String errLine = resJsonObject.getJSONObject("sta").getString("ErrorLineParameter").trim();
|
||||
if(errLine.equals("empty")){
|
||||
for (TenPackRecordEnterEntity recordEntity : updateRecords) {
|
||||
recordEntity.setXaSync(1);
|
||||
tenPackRecordEnterService.updateById(recordEntity);
|
||||
}
|
||||
}else{
|
||||
String[] lines = errLine.split(",");
|
||||
List<String> lineList = Arrays.asList(lines);
|
||||
for (int i = 0;i<updateRecords.size();i++) {
|
||||
if(lineList.contains(i+1+"")){
|
||||
continue;
|
||||
}else {
|
||||
TenPackRecordEnterEntity recordEntity = updateRecords.get(i);
|
||||
recordEntity.setXaSync(1);
|
||||
tenPackRecordEnterService.updateById(recordEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -301,17 +346,37 @@ public class XaRecordTask implements ITask {
|
|||
// 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);
|
||||
log.debug("上传车辆出场记录返回数据:" + resJson);
|
||||
tranEntity.setTranResult(resJson);
|
||||
tenTranService.updateById(tranEntity);
|
||||
//上传成功,修改sync状态
|
||||
if (resJson.contains("\"code\":\"0000\"")) {
|
||||
for (TenPackRecordExitEntity recordEntity : updateRecords) {
|
||||
recordEntity.setXaSync(1);
|
||||
tenPackRecordExitService.updateById(recordEntity);
|
||||
// if (resJson.contains("\"code\":\"0000\"")) {
|
||||
// for (TenPackRecordExitEntity recordEntity : updateRecords) {
|
||||
// recordEntity.setXaSync(1);
|
||||
// tenPackRecordExitService.updateById(recordEntity);
|
||||
// }
|
||||
// }
|
||||
if(resJson.contains("ErrorLineParameter")){
|
||||
JSONObject resJsonObject = JSONObject.parseObject(resJson);
|
||||
String errLine = resJsonObject.getJSONObject("sta").getString("ErrorLineParameter").trim();
|
||||
if(errLine.equals("empty")){
|
||||
for (TenPackRecordExitEntity recordEntity : updateRecords) {
|
||||
recordEntity.setXaSync(1);
|
||||
tenPackRecordExitService.updateById(recordEntity);
|
||||
}
|
||||
}else{
|
||||
String[] lines = errLine.split(",");
|
||||
List<String> lineList = Arrays.asList(lines);
|
||||
for (int i = 0;i<updateRecords.size();i++) {
|
||||
if(lineList.contains(i+1+"")){
|
||||
continue;
|
||||
}else {
|
||||
TenPackRecordExitEntity recordEntity = updateRecords.get(i);
|
||||
recordEntity.setXaSync(1);
|
||||
tenPackRecordExitService.updateById(recordEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -59,6 +59,15 @@ public class TenPackRecordEnterEntity implements Serializable {
|
|||
|
||||
private Integer xaSyncImage;
|
||||
|
||||
@ApiModelProperty("停车场西安对接变价")
|
||||
private String parkCodeXa;
|
||||
|
||||
@ApiModelProperty("通道西安编码")
|
||||
private String channalCodeXa;
|
||||
|
||||
@ApiModelProperty("通道编码")
|
||||
private String channalCode;
|
||||
|
||||
@ApiModelProperty("小区名称")
|
||||
@TableField(exist=false)
|
||||
private String cellName;
|
||||
|
|
|
@ -76,6 +76,15 @@ public class TenPackRecordExitEntity implements Serializable {
|
|||
|
||||
private Integer xaSyncImage;
|
||||
|
||||
@ApiModelProperty("停车场西安对接变价")
|
||||
private String parkCodeXa;
|
||||
|
||||
@ApiModelProperty("通道西安编码")
|
||||
private String channalCodeXa;
|
||||
|
||||
@ApiModelProperty("通道编码")
|
||||
private String channalCode;
|
||||
|
||||
@ApiModelProperty("小区名称")
|
||||
@TableField(exist=false)
|
||||
private String cellName;
|
||||
|
|
|
@ -32,53 +32,59 @@ public class TenPackRecordEnterServiceImpl extends ServiceImpl<TenPackRecordEnte
|
|||
public PageUtils queryPage(Map<String, Object> params) {
|
||||
List<Long> cellIds = new ArrayList<>();
|
||||
// cellIds.add(709832651506188289L);
|
||||
String cellId = (String)params.get("cellId");
|
||||
if (cellId!=null && !cellId.isEmpty()){
|
||||
String cellId = (String) params.get("cellId");
|
||||
if (cellId != null && !cellId.isEmpty()) {
|
||||
Long cellLong = Long.parseLong(cellId);
|
||||
cellIds.add(cellLong);
|
||||
}else {
|
||||
} else {
|
||||
List<TenCellEntity> cells = tenCellService.queryAll(params);
|
||||
for (TenCellEntity cell : cells) {
|
||||
cellIds.add(cell.getCellId());
|
||||
}
|
||||
}
|
||||
if (cellIds.size() == 0) {
|
||||
return new PageUtils(new ArrayList<>(),0,0,0);
|
||||
return new PageUtils(new ArrayList<>(), 0, 0, 0);
|
||||
}
|
||||
|
||||
IPage<TenPackRecordEnterEntity> page = this.page(
|
||||
new Query<TenPackRecordEnterEntity>().getPage(params),
|
||||
new QueryWrapper<TenPackRecordEnterEntity>()
|
||||
.eq("tenant_id",params.get("tenantId"))
|
||||
.in("cell_id",cellIds)
|
||||
.eq("tenant_id", params.get("tenantId"))
|
||||
.in("cell_id", cellIds)
|
||||
.orderByDesc("enter_time")
|
||||
|
||||
);
|
||||
|
||||
for(TenPackRecordEnterEntity entity: page.getRecords()){
|
||||
for (TenPackRecordEnterEntity entity : page.getRecords()) {
|
||||
TenCellEntity cell = tenCellService.getById(entity.getCellId());
|
||||
entity.setCellName(cell.getName());
|
||||
}
|
||||
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)
|
||||
.isNotNull("image")
|
||||
.last(" and TO_DAYS(enter_time) = TO_DAYS(NOW())"));
|
||||
.eq("cell_id", cellId)
|
||||
.eq("xa_sync", 0)
|
||||
.isNotNull("image")
|
||||
.isNotNull("park_code_xa")
|
||||
.isNotNull("channal_code_xa")
|
||||
.last(" and TO_DAYS(enter_time) = TO_DAYS(NOW())"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TenPackRecordEnterEntity> getNotSyncImage(Long cellId) {
|
||||
return this.list(new QueryWrapper<TenPackRecordEnterEntity>()
|
||||
.eq("cell_id",cellId)
|
||||
.eq("xa_sync_image",0)
|
||||
.eq("cell_id", cellId)
|
||||
.eq("xa_sync_image", 0)
|
||||
.isNotNull("image")
|
||||
.eq("xa_sync",1)
|
||||
.isNotNull("park_code_xa")
|
||||
.isNotNull("channal_code_xa")
|
||||
.eq("xa_sync", 1)
|
||||
.last(" and TO_DAYS(enter_time) = TO_DAYS(NOW())"));
|
||||
}
|
||||
}
|
|
@ -63,6 +63,9 @@ public class TenPackRecordExitServiceImpl extends ServiceImpl<TenPackRecordExitD
|
|||
return this.list(new QueryWrapper<TenPackRecordExitEntity>()
|
||||
.eq("cell_id",cellId)
|
||||
.eq("xa_sync",0)
|
||||
.isNotNull("image")
|
||||
.isNotNull("park_code_xa")
|
||||
.isNotNull("channal_code_xa")
|
||||
.last(" and TO_DAYS(exit_time) = TO_DAYS(NOW())"));
|
||||
}
|
||||
@Override
|
||||
|
@ -71,6 +74,9 @@ public class TenPackRecordExitServiceImpl extends ServiceImpl<TenPackRecordExitD
|
|||
.eq("cell_id",cellId)
|
||||
.eq("xa_sync_image",0)
|
||||
.eq("xa_sync",1)
|
||||
.isNotNull("image")
|
||||
.isNotNull("park_code_xa")
|
||||
.isNotNull("channal_code_xa")
|
||||
.last(" and TO_DAYS(exit_time) = TO_DAYS(NOW())"));
|
||||
}
|
||||
}
|
|
@ -109,11 +109,11 @@ public class XaApi {
|
|||
conn.setRequestMethod("POST");
|
||||
String currdate = new SimpleDateFormat("yyyyMMdd").format(new Date());
|
||||
String token = XaUtils.md5(appid + secre + currdate + json.replaceAll("\r\n", ""));
|
||||
System.out.println("json****" + json);
|
||||
System.out.println("333appid***" + appid);
|
||||
System.out.println("333token***" + token);
|
||||
System.out.println("333serviceId***" + serviceId);
|
||||
System.out.println("333serviceValue***" + serviceValue);
|
||||
// System.out.println("json****" + json);
|
||||
// System.out.println("333appid***" + appid);
|
||||
// System.out.println("333token***" + token);
|
||||
// System.out.println("333serviceId***" + serviceId);
|
||||
// System.out.println("333serviceValue***" + serviceValue);
|
||||
|
||||
conn.setRequestProperty("appid", appid);
|
||||
conn.setRequestProperty("token", token);
|
||||
|
|
Loading…
Reference in New Issue