1.修改bug
This commit is contained in:
gaoben 2021-04-28 18:01:26 +08:00
parent 33b9d1bb76
commit bbeec0ecf6
10 changed files with 415 additions and 352 deletions

View File

@ -31,7 +31,7 @@
<jedis.version>2.9.0</jedis.version>
<druid.version>1.1.13</druid.version>
<mybatisplus.version>3.1.2</mybatisplus.version>
<mysql.version>8.0.16</mysql.version>
<mysql.version>8.0.19</mysql.version>
<mssql.version>4.0</mssql.version>
<oracle.version>11.2.0.3</oracle.version>
<commons.lang.version>2.6</commons.lang.version>

View File

@ -222,6 +222,9 @@ public class AppApiController {
//Map<String,Object> params = new HashMap<>();
// params.put("tenantId",tenantId+"");
List<TenBuildEntity> buildList = tenBuildService.selectByCellId(cellId);
for(TenBuildEntity buildEntity: buildList){
buildEntity.setName(buildEntity.getName()+buildEntity.getUnit()+"单元");
}
return R.ok().put("data", buildList);
}
@ -668,15 +671,18 @@ public class AppApiController {
}
AppUserScopeEntity scope = appUserScopeService.getById(user.getCurrentScopeId());
//不能删除自己
for (Map<String, String> param : params) {
Long personId = Long.parseLong(param.get("personId"));
Long cellId = Long.parseLong(param.get("cellId"));
if(scope.getPersonId().longValue() == personId.longValue()){
return R.error("不能删除自己");
}
TenPersonEntity personEntity = tenPersonService.getById(personId,cellId);
if(scope.getRoleId().intValue()>personEntity.getPersonType().intValue()){
return R.error("您无权删除"+personEntity.getName());
if (scope.getRoleId().intValue() != Constant.ROLE_TEN_CELL) {
//住户家属
for (Map<String, String> param : params) {
Long personId = Long.parseLong(param.get("personId"));
Long cellId = Long.parseLong(param.get("cellId"));
if(scope.getPersonId().longValue() == personId.longValue()){
return R.error("不能删除自己");
}
TenPersonEntity personEntity = tenPersonService.getById(personId,cellId);
if(scope.getRoleId().intValue()>personEntity.getPersonType().intValue()){
return R.error("您无权删除"+personEntity.getName());
}
}
}
tenPersonService.removeByIdList(params);

View File

@ -1,6 +1,7 @@
package net.shapelight.modules.car.controller;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.minio.MinioClient;
import io.minio.PutObjectOptions;
import io.swagger.annotations.Api;
@ -23,14 +24,8 @@ import java.util.Map;
import net.shapelight.common.config.GlobalValue;
import net.shapelight.common.config.MinioConfig;
import net.shapelight.common.utils.*;
import net.shapelight.modules.ten.entity.TenCarEntity;
import net.shapelight.modules.ten.entity.TenPackRecordEnterEntity;
import net.shapelight.modules.ten.entity.TenPackRecordEntity;
import net.shapelight.modules.ten.entity.TenPackRecordExitEntity;
import net.shapelight.modules.ten.service.TenCarService;
import net.shapelight.modules.ten.service.TenPackRecordEnterService;
import net.shapelight.modules.ten.service.TenPackRecordExitService;
import net.shapelight.modules.ten.service.TenPackRecordService;
import net.shapelight.modules.ten.entity.*;
import net.shapelight.modules.ten.service.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -70,6 +65,9 @@ public class CarOpenApi {
@Autowired
private TenPackRecordExitService tenPackRecordExitService;
@Autowired
private TenPackService tenPackService;
@PostMapping({"/getMsg/{cellId}"})
@ApiOperation("获取MSG")
@ApiImplicitParams({@ApiImplicitParam(name = "sn", value = "设备sn", paramType = "query", dataType = "String", required = true)})
@ -304,6 +302,8 @@ public class CarOpenApi {
*/
//https://c.xitu3d.com:1002/cell/api/car/v1/pushCarRecord
@PostMapping({"/pushCarRecord"})
@ApiOperation("第三方推送")
public Map pushCarRecord(@RequestBody Object object) {
@ -379,6 +379,16 @@ public class CarOpenApi {
httpUrl.disconnect();
}
}
//
Long cellId = null;
Long tenantId = null;
TenPackEntity packEntity = tenPackService.getOne(new QueryWrapper<TenPackEntity>()
.eq("park_code",parkCode));
if(packEntity!=null){
cellId = packEntity.getCellId();
tenantId = packEntity.getTenantId();
}
if (serviceName.equals("enter")) {
long enterTimeLong = bizContent.getLongValue("enterTime");
Date enterTime = new Date(enterTimeLong * 1000L);
@ -391,6 +401,8 @@ public class CarOpenApi {
enter.setType(Integer.valueOf(type));
enter.setCarType(Integer.valueOf(carType));
enter.setEnterTime(enterTime);
enter.setCellId(cellId);
enter.setTenantId(tenantId);
if (fileName.length() > 0)
enter.setImage(fileName);
this.tenPackRecordEnterService.save(enter);
@ -408,6 +420,8 @@ public class CarOpenApi {
exit.setCarType(Integer.valueOf(carType));
exit.setExitTime(exitTime);
exit.setPackTime(Long.valueOf(parkTime));
exit.setCellId(cellId);
exit.setTenantId(tenantId);
if (fileName.length() > 0)
exit.setImage(fileName);
this.tenPackRecordExitService.save(exit);

View File

@ -60,10 +60,10 @@ public class XaAddressTask implements ITask {
if (xqid != null && xqid.length() > 0) {
//调用第三方接口获取所有信息
//6.1 获取标准地址接口---------------------------------------------------------------------------
// String address = XaApi.getAddress(xqid, appId, appSecret);
// String address = "{\"xml\":{\"data\":\"信息验证失败\"}}";
String address = XaApi.getAddress(xqid, appId, appSecret);
// String address = "{\"xml\":{\"data\":\"信息验证失败\"}}";
String address = "{\"xml\":{\"data\":{\"NEXTPAGE\":\"END\",\"HLWTable\":[{\"@JWSID\":\"610113600000000001202\",\"@SWJID\":\"610113003012013\",\"@SSXQBM\":\"A61011304538\",\"@XZQHNAME\":\"西安市雁塔区\",\"@DZSC\":\"殴风园\",\"@DZQC\":\"陕西省西安市雁塔区长安南路439号\",\"@P_ID\":\"1544038\",\"@JLXMC\":\"长安南路\",\"@WD\":\"34.207728945844494\",\"@DZJB\":\"10\",\"@MPHLX\":\"10\",\"@XQID\":\"610113600000000004538\",\"@DZGSDW\":\"610113600000\",\"@XT_ZHXGSJ\":\"2021-03-23 16:50:08\",\"@SJ\":\"\",\"@XZQH\":\"610113\",\"@XQ\":\"欧风园小区\",\"@JD\":\"108.94238923458721\",\"@JWSMC\":\"陕师大警务室\",\"@DZDM\":\"000268000029\",\"@JLXDM\":\"000268\"},{\"@JWSID\":\"610113600000000001202\",\"@SWJID\":\"610113003012013\",\"@SSXQBM\":\"A61011304538\",\"@XZQHNAME\":\"西安市雁塔区\",\"@DZSC\":\"\",\"@DZQC\":\"陕西省西安市雁塔区长安南路439号1栋\",\"@P_ID\":\"1820578255\",\"@JLXMC\":\"长安南路\",\"@WD\":\"34.206951\",\"@DZJB\":\"11\",\"@MPHLX\":\"10\",\"@XQID\":\"610113600000000004538\",\"@DZGSDW\":\"610113600000\",\"@XT_ZHXGSJ\":\"2021-03-23 16:50:08\",\"@SJ\":\"\",\"@XZQH\":\"610113\",\"@XQ\":\"欧风园小区\",\"@JD\":\"108.942541\",\"@JWSMC\":\"陕师大警务室\",\"@DZDM\":\"000268000029000010\",\"@JLXDM\":\"000268\"}]}}}";
// String address = "{\"xml\":{\"data\":{\"NEXTPAGE\":\"END\",\"HLWTable\":[{\"@JWSID\":\"610113600000000001202\",\"@SWJID\":\"610113003012013\",\"@SSXQBM\":\"A61011304538\",\"@XZQHNAME\":\"西安市雁塔区\",\"@DZSC\":\"殴风园\",\"@DZQC\":\"陕西省西安市雁塔区长安南路439号\",\"@P_ID\":\"1544038\",\"@JLXMC\":\"长安南路\",\"@WD\":\"34.207728945844494\",\"@DZJB\":\"10\",\"@MPHLX\":\"10\",\"@XQID\":\"610113600000000004538\",\"@DZGSDW\":\"610113600000\",\"@XT_ZHXGSJ\":\"2021-03-23 16:50:08\",\"@SJ\":\"\",\"@XZQH\":\"610113\",\"@XQ\":\"欧风园小区\",\"@JD\":\"108.94238923458721\",\"@JWSMC\":\"陕师大警务室\",\"@DZDM\":\"000268000029\",\"@JLXDM\":\"000268\"},{\"@JWSID\":\"610113600000000001202\",\"@SWJID\":\"610113003012013\",\"@SSXQBM\":\"A61011304538\",\"@XZQHNAME\":\"西安市雁塔区\",\"@DZSC\":\"\",\"@DZQC\":\"陕西省西安市雁塔区长安南路439号1栋\",\"@P_ID\":\"1820578255\",\"@JLXMC\":\"长安南路\",\"@WD\":\"34.206951\",\"@DZJB\":\"11\",\"@MPHLX\":\"10\",\"@XQID\":\"610113600000000004538\",\"@DZGSDW\":\"610113600000\",\"@XT_ZHXGSJ\":\"2021-03-23 16:50:08\",\"@SJ\":\"\",\"@XZQH\":\"610113\",\"@XQ\":\"欧风园小区\",\"@JD\":\"108.942541\",\"@JWSMC\":\"陕师大警务室\",\"@DZDM\":\"000268000029000010\",\"@JLXDM\":\"000268\"}]}}}";
log.debug("获取小区标准地址-" + cellEntity.getName() + ":返回数据" + address);
//解析json

View File

@ -56,6 +56,14 @@ public class XaImageTask implements ITask {
private TenAddressService tenAddressService;
@Autowired
private TenTranService tenTranService;
@Autowired
private TenPackRecordEnterService tenPackRecordEnterService;
@Autowired
private TenPackRecordExitService tenPackRecordExitService;
@Autowired
private TenPackService tenPackService;
@Autowired
private TenPackChannalService tenPackChannalService;
public void run(String params) {
log.debug("xaImageTask定时任务正在执行", params);
@ -77,10 +85,14 @@ public class XaImageTask implements ITask {
String xqid = cellEntity.getThirdId();
Long cellId = cellEntity.getCellId();
if (xqid == null || xqid.length() > 0){
//人员
//人员记录图片
processRecordPersonImage(appId, appSecret, xqid, fwikUrl, cellId,tenantId);
//
//人员图片
processRealPersonImage(appId, appSecret, xqid, fwikUrl, cellId);
//车辆进入图片
processRecordCarEnterImage(appId, appSecret, xqid, fwikUrl, cellId);
//车辆离开图片
processRecordCarExitImage(appId, appSecret, xqid, fwikUrl, cellId);
}
}
}
@ -104,55 +116,57 @@ public class XaImageTask implements ITask {
TenAddressEntity addressEntity = tenAddressService.getOne(new QueryWrapper<TenAddressEntity>()
.eq("xqid", xqid).last("LIMIT 1"));
String ssxqbm = addressEntity.getSsxqbm();
if(addressEntity!=null){
String ssxqbm = addressEntity.getSsxqbm();
syncRecord.setLV_SSXQBM(ssxqbm); //小区申报编码
syncRecord.setLV_ZPSJ(DateUtils.format(record.getRecordTime(), "yyyyMMddHHmmss"));
syncRecord.setLV_MJXTWYBM(record.getRecordId() + "");//出入记录主键
syncRecord.setLV_SSXQBM(ssxqbm); //小区申报编码
syncRecord.setLV_ZPSJ(DateUtils.format(record.getRecordTime(), "yyyyMMddHHmmss"));
syncRecord.setLV_MJXTWYBM(record.getRecordId() + "");//出入记录主键
String base64Image = "";
InputStream inStream = null;
ByteArrayOutputStream outStream = null;
String base64Image = "";
InputStream inStream = null;
ByteArrayOutputStream outStream = null;
try {
minioClient.statObject(minioConfig.getBucketName(), record.getRecordFace());
try {
minioClient.statObject(minioConfig.getBucketName(), record.getRecordFace());
inStream = minioClient.getObject(minioConfig.getBucketName(), record.getRecordFace());
outStream = new ByteArrayOutputStream();
byte[] buffer = new byte[1024];
int length;
while ((length = inStream.read(buffer)) != -1) {
outStream.write(buffer, 0, length);
}
base64Image = Base64.getEncoder().encodeToString(outStream.toByteArray());
} catch (Exception e) {
log.error("照片不存在:" + record.getRecordFace());
e.printStackTrace();
} finally {
if (inStream != null) {
try {
inStream.close();
} catch (IOException e) {
log.error("inputStream close IOException:" + e.getMessage());
inStream = minioClient.getObject(minioConfig.getBucketName(), record.getRecordFace());
outStream = new ByteArrayOutputStream();
byte[] buffer = new byte[1024];
int length;
while ((length = inStream.read(buffer)) != -1) {
outStream.write(buffer, 0, length);
}
base64Image = Base64.getEncoder().encodeToString(outStream.toByteArray());
} catch (Exception e) {
log.error("照片不存在:" + record.getRecordFace());
e.printStackTrace();
} finally {
if (inStream != null) {
try {
inStream.close();
} catch (IOException e) {
log.error("inputStream close IOException:" + e.getMessage());
}
}
if (outStream != null) {
try {
outStream.close();
} catch (IOException e) {
log.error("outStream close IOException:" + e.getMessage());
}
}
}
if (outStream != null) {
try {
outStream.close();
} catch (IOException e) {
log.error("outStream close IOException:" + e.getMessage());
}
if (base64Image.length() == 0) {
continue;
}
syncRecord.setLV_ZPZP(base64Image);//base64图片
syncRecords.add(syncRecord);
updateRecords.add(record);
count++;
if (count >= 30)
break;
}
if (base64Image.length() == 0) {
continue;
}
syncRecord.setLV_ZPZP(base64Image);//base64图片
syncRecords.add(syncRecord);
updateRecords.add(record);
count++;
if (count >= 30)
break;
}
if(count == 0){
return;
@ -174,8 +188,8 @@ public class XaImageTask implements ITask {
TenTranEntity tranEntity = tenTranService.saveApi(fwikUrl,"","RYJCZPXX", "RYJCZPXX", appId, appSecret);
String tranId = String.format("%s%016d",DateUtils.format(tranEntity.getTranDate(),"yyyyMMddHHmmss"),tranEntity.getTranId());
// String resJson = XaApi.httpPOSTJson(fwikUrl, enJson, "RYJCZPXX", "RYJCZPXX", appId, appSecret,tranId);
String resJson = "{\"sta\":{\"code\":\"0000\",\"des\":\"成功\",\"ErrorLineParameter\":\"empty\"},\"datas\":[{\"Result\":\"接收成功\"}],\"pages\":[{\"psize\":\"1\",\"tcount\":\"1\",\"pno\":\"1\",\"tsize\":\"0\"}]}";
String resJson = XaApi.httpPOSTJson(fwikUrl, enJson, "RYJCZPXX", "RYJCZPXX", appId, appSecret,tranId);
// String resJson = "{\"sta\":{\"code\":\"0000\",\"des\":\"成功\",\"ErrorLineParameter\":\"empty\"},\"datas\":[{\"Result\":\"接收成功\"}],\"pages\":[{\"psize\":\"1\",\"tcount\":\"1\",\"pno\":\"1\",\"tsize\":\"0\"}]}";
// String resJson = "23232";
// System.out.println(s);
log.debug("上传人员识别记录返回数据:" + resJson);
@ -190,156 +204,163 @@ public class XaImageTask implements ITask {
}
}
// private void processRecordCarEnterImage(String appId, String appSecret, String xqid, String fwikUrl, Long cellId) {
// List<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("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;
// }
//
//
// 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\"}]}";
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("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;
}
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);
TenTranEntity tranEntity = tenTranService.saveApi(fwikUrl,"","TCCTCSBXX", "TCCTCSBXX", appId, appSecret);
String tranId = String.format("%s%016d",DateUtils.format(tranEntity.getTranDate(),"yyyyMMddHHmmss"),tranEntity.getTranId());
String resJson = XaApi.httpPOSTJson(fwikUrl, enJson, "TCCTCSBXX", "TCCTCSBXX", appId, appSecret,tranId);
// String resJson = "{\"sta\":{\"code\":\"0000\",\"des\":\"成功\",\"ErrorLineParameter\":\"empty\"},\"datas\":[{\"Result\":\"接收成功\"}],\"pages\":[{\"psize\":\"1\",\"tcount\":\"1\",\"pno\":\"1\",\"tsize\":\"0\"}]}";
// String resJson = "23232";
//// System.out.println(s);
// log.debug("上传车辆进场记录返回数据:" + resJson);
// //上传成功修改sync状态
// if (resJson.contains("\"code\":\"0000\"")) {
// for (TenPackRecordEnterEntity recordEntity : updateRecords) {
// recordEntity.setXaSync(1);
// tenPackRecordEnterService.updateById(recordEntity);
// }
// }
// }
//
//
//
//
// private void processRecordCarExitImage(String appId, String appSecret, String xqid, String fwikUrl, Long cellId) {
// List<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("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;
// }
//
//
// 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\"}]}";
// 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("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;
}
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);
TenTranEntity tranEntity = tenTranService.saveApi(fwikUrl,"","TCCTCSBXX", "TCCTCSBXX", appId, appSecret);
String tranId = String.format("%s%016d",DateUtils.format(tranEntity.getTranDate(),"yyyyMMddHHmmss"),tranEntity.getTranId());
String resJson = XaApi.httpPOSTJson(fwikUrl, enJson, "TCCTCSBXX", "TCCTCSBXX", appId, appSecret,tranId);
// String resJson = "{\"sta\":{\"code\":\"0000\",\"des\":\"成功\",\"ErrorLineParameter\":\"empty\"},\"datas\":[{\"Result\":\"接收成功\"}],\"pages\":[{\"psize\":\"1\",\"tcount\":\"1\",\"pno\":\"1\",\"tsize\":\"0\"}]}";
// String resJson = "23232";
//// System.out.println(s);
// log.debug("上传车辆进场记录返回数据:" + resJson);
// //上传成功修改sync状态
// if (resJson.contains("\"code\":\"0000\"")) {
// for (TenPackRecordExitEntity recordEntity : updateRecords) {
// recordEntity.setXaSync(1);
// tenPackRecordExitService.updateById(recordEntity);
// }
// }
// }
// System.out.println(s);
log.debug("上传车辆进场记录返回数据:" + resJson);
//上传成功修改sync状态
if (resJson.contains("\"code\":\"0000\"")) {
for (TenPackRecordExitEntity recordEntity : updateRecords) {
recordEntity.setXaSync(1);
tenPackRecordExitService.updateById(recordEntity);
}
}
}
private void processRealPersonImage(String appId, String appSecret, String xqid, String fwikUrl, Long cellId) {
@ -352,60 +373,61 @@ public class XaImageTask implements ITask {
TenRoomEntity roomEntity = tenRoomService.getById(person.getRoomId(), person.getCellId());
TenAddressEntity addressEntity = tenAddressService.getById(roomEntity.getPId());
realPerson.setLV_CASE_ID(person.getUuid()); //实有人口编码
realPerson.setLV_GMSFHM(person.getIdCard()); //身份证号
realPerson.setLV_DJSJ(DateUtils.format(new Date(), "yyyyMMddHHmmss"));
realPerson.setLV_SSXQBM(addressEntity.getSsxqbm());
if(addressEntity!=null){
realPerson.setLV_CASE_ID(person.getUuid()); //实有人口编码
realPerson.setLV_GMSFHM(person.getIdCard()); //身份证号
realPerson.setLV_DJSJ(DateUtils.format(new Date(), "yyyyMMddHHmmss"));
realPerson.setLV_SSXQBM(addressEntity.getSsxqbm());
String base64Image = "";
InputStream inStream = null;
ByteArrayOutputStream outStream = null;
String base64Image = "";
InputStream inStream = null;
ByteArrayOutputStream outStream = null;
try {
minioClient.statObject(minioConfig.getBucketName(), person.getOrgImage());
try {
minioClient.statObject(minioConfig.getBucketName(), person.getOrgImage());
inStream = minioClient.getObject(minioConfig.getBucketName(), person.getOrgImage());
outStream = new ByteArrayOutputStream();
byte[] buffer = new byte[1024];
int length;
while ((length = inStream.read(buffer)) != -1) {
outStream.write(buffer, 0, length);
}
base64Image = Base64.getEncoder().encodeToString(outStream.toByteArray());
} catch (Exception e) {
log.error("照片不存在:" + person.getOrgImage());
e.printStackTrace();
} finally {
if (inStream != null) {
try {
inStream.close();
} catch (IOException e) {
log.error("inputStream close IOException:" + e.getMessage());
inStream = minioClient.getObject(minioConfig.getBucketName(), person.getOrgImage());
outStream = new ByteArrayOutputStream();
byte[] buffer = new byte[1024];
int length;
while ((length = inStream.read(buffer)) != -1) {
outStream.write(buffer, 0, length);
}
base64Image = Base64.getEncoder().encodeToString(outStream.toByteArray());
} catch (Exception e) {
log.error("照片不存在:" + person.getOrgImage());
e.printStackTrace();
} finally {
if (inStream != null) {
try {
inStream.close();
} catch (IOException e) {
log.error("inputStream close IOException:" + e.getMessage());
}
}
if (outStream != null) {
try {
outStream.close();
} catch (IOException e) {
log.error("outStream close IOException:" + e.getMessage());
}
}
}
if (outStream != null) {
try {
outStream.close();
} catch (IOException e) {
log.error("outStream close IOException:" + e.getMessage());
}
if (base64Image.length() == 0) {
continue;
}
realPerson.setLV_ZP(base64Image);
syncPersons.add(realPerson);
updatePersons.add(person);
count++;
if (count >= 50)
break;
}
if (base64Image.length() == 0) {
continue;
}
realPerson.setLV_ZP(base64Image);
syncPersons.add(realPerson);
updatePersons.add(person);
count++;
if (count >= 50)
break;
}
if(count == 0){
return;

View File

@ -54,8 +54,8 @@ public class XaRealDataTask implements ITask {
String appSecret = object.getString("appSecret");
//6.2 获取数据对接接口---------------------------------------------------------------------------
// String fwikUrl = XaApi.getFwikUrl(appId, appSecret);
String fwikUrl = "http://";
String fwikUrl = XaApi.getFwikUrl(appId, appSecret);
// String fwikUrl = "http://";
if (fwikUrl != null) {
List<TenCellEntity> allCells = this.tenCellService.list((Wrapper) (new QueryWrapper())
@ -160,8 +160,8 @@ public class XaRealDataTask implements ITask {
TenTranEntity tranEntity = tenTranService.saveApi(fwikUrl,jsonData,"SYFW", "SYFW", appId, appSecret);
String tranId = String.format("%s%016d",DateUtils.format(tranEntity.getTranDate(),"yyyyMMddHHmmss"),tranEntity.getTranId());
// String resJson = XaApi.httpPOSTJson(fwikUrl, enJson, "SYFW", "SYFW", appId, appSecret,tranId);
String resJson = "{\"sta\":{\"code\":\"0000\",\"des\":\"成功\",\"ErrorLineParameter\":\"empty\"},\"datas\":[{\"Result\":\"接收成功\"}],\"pages\":[{\"psize\":\"1\",\"tcount\":\"1\",\"pno\":\"1\",\"tsize\":\"0\"}]}";
String resJson = XaApi.httpPOSTJson(fwikUrl, enJson, "SYFW", "SYFW", appId, appSecret,tranId);
// String resJson = "{\"sta\":{\"code\":\"0000\",\"des\":\"成功\",\"ErrorLineParameter\":\"empty\"},\"datas\":[{\"Result\":\"接收成功\"}],\"pages\":[{\"psize\":\"1\",\"tcount\":\"1\",\"pno\":\"1\",\"tsize\":\"0\"}]}";
// String resJson = "23232";
// System.out.println(s);
log.debug("上传实有房屋返回数据:" + resJson);
@ -245,8 +245,8 @@ public class XaRealDataTask implements ITask {
TenTranEntity tranEntity = tenTranService.saveApi(fwikUrl,jsonData,"SYRK", "SYRK", appId, appSecret);
String tranId = String.format("%s%016d",DateUtils.format(tranEntity.getTranDate(),"yyyyMMddHHmmss"),tranEntity.getTranId());
// String resJson = XaApi.httpPOSTJson(fwikUrl, enJson, "SYRK", "SYRK", appId, appSecret,tranId);
String resJson = "{\"sta\":{\"code\":\"0000\",\"des\":\"成功\",\"ErrorLineParameter\":\"empty\"},\"datas\":[{\"Result\":\"接收成功\"}],\"pages\":[{\"psize\":\"1\",\"tcount\":\"1\",\"pno\":\"1\",\"tsize\":\"0\"}]}";
String resJson = XaApi.httpPOSTJson(fwikUrl, enJson, "SYRK", "SYRK", appId, appSecret,tranId);
// String resJson = "{\"sta\":{\"code\":\"0000\",\"des\":\"成功\",\"ErrorLineParameter\":\"empty\"},\"datas\":[{\"Result\":\"接收成功\"}],\"pages\":[{\"psize\":\"1\",\"tcount\":\"1\",\"pno\":\"1\",\"tsize\":\"0\"}]}";
// String resJson = "23232";
// System.out.println(s);
log.debug("上传实有房屋返回数据:" + resJson);
@ -308,8 +308,8 @@ public class XaRealDataTask implements ITask {
TenTranEntity tranEntity = tenTranService.saveApi(fwikUrl,jsonData,"MJKXX", "MJKXX", appId, appSecret);
String tranId = String.format("%s%016d",DateUtils.format(tranEntity.getTranDate(),"yyyyMMddHHmmss"),tranEntity.getTranId());
// String resJson = XaApi.httpPOSTJson(fwikUrl, enJson, "MJKXX", "MJKXX", appId, appSecret,tranId);
String resJson = "{\"sta\":{\"code\":\"0000\",\"des\":\"成功\",\"ErrorLineParameter\":\"empty\"},\"datas\":[{\"Result\":\"接收成功\"}],\"pages\":[{\"psize\":\"1\",\"tcount\":\"1\",\"pno\":\"1\",\"tsize\":\"0\"}]}";
String resJson = XaApi.httpPOSTJson(fwikUrl, enJson, "MJKXX", "MJKXX", appId, appSecret,tranId);
// String resJson = "{\"sta\":{\"code\":\"0000\",\"des\":\"成功\",\"ErrorLineParameter\":\"empty\"},\"datas\":[{\"Result\":\"接收成功\"}],\"pages\":[{\"psize\":\"1\",\"tcount\":\"1\",\"pno\":\"1\",\"tsize\":\"0\"}]}";
// String resJson = "23232";
// System.out.println(s);
log.debug("上传实有房屋返回数据:" + resJson);
@ -372,8 +372,8 @@ public class XaRealDataTask implements ITask {
TenTranEntity tranEntity = tenTranService.saveApi(fwikUrl,jsonData,"MJSBXX", "MJSBXX", appId, appSecret);
String tranId = String.format("%s%016d",DateUtils.format(tranEntity.getTranDate(),"yyyyMMddHHmmss"),tranEntity.getTranId());
// String resJson = XaApi.httpPOSTJson(fwikUrl, enJson, "MJSBXX", "MJSBXX", appId, appSecret,tranId);
String resJson = "{\"sta\":{\"code\":\"0000\",\"des\":\"成功\",\"ErrorLineParameter\":\"empty\"},\"datas\":[{\"Result\":\"接收成功\"}],\"pages\":[{\"psize\":\"1\",\"tcount\":\"1\",\"pno\":\"1\",\"tsize\":\"0\"}]}";
String resJson = XaApi.httpPOSTJson(fwikUrl, enJson, "MJSBXX", "MJSBXX", appId, appSecret,tranId);
// String resJson = "{\"sta\":{\"code\":\"0000\",\"des\":\"成功\",\"ErrorLineParameter\":\"empty\"},\"datas\":[{\"Result\":\"接收成功\"}],\"pages\":[{\"psize\":\"1\",\"tcount\":\"1\",\"pno\":\"1\",\"tsize\":\"0\"}]}";
// String resJson = "23232";
// System.out.println(s);
log.debug("上传实有房屋返回数据:" + resJson);

View File

@ -90,23 +90,25 @@ public class XaRecordTask implements ITask {
TenAddressEntity addressEntity = tenAddressService.getOne(new QueryWrapper<TenAddressEntity>()
.eq("xqid",xqid).last("LIMIT 1"));
String ssxqbm = addressEntity.getSsxqbm();
if(addressEntity!=null){
String ssxqbm = addressEntity.getSsxqbm();
syncRecord.setLV_SSXQBM(ssxqbm); //小区申报编码
syncRecord.setLV_MJBH(record.getDeviceSn());
syncRecord.setLV_CRLB("1");//1进2出
syncRecord.setLV_ZPSJ(DateUtils.format(record.getRecordTime(), "yyyyMMddHHmmss"));
syncRecord.setLV_SBXT("10");//申报系统,默认10
syncRecord.setLV_MJXTWYBM(record.getRecordId()+"");//出入记录主键
syncRecord.setLV_RY_ID(record.getPersonId()+"");
syncRecord.setLV_FFMS("1");//1住户2访客
syncRecord.setLV_PROCMODE("PMINSERT");
syncRecord.setLV_SSXQBM(ssxqbm); //小区申报编码
syncRecord.setLV_MJBH(record.getDeviceSn());
syncRecord.setLV_CRLB("1");//1进2出
syncRecord.setLV_ZPSJ(DateUtils.format(record.getRecordTime(), "yyyyMMddHHmmss"));
syncRecord.setLV_SBXT("10");//申报系统,默认10
syncRecord.setLV_MJXTWYBM(record.getRecordId()+"");//出入记录主键
syncRecord.setLV_RY_ID(record.getPersonId()+"");
syncRecord.setLV_FFMS("1");//1住户2访客
syncRecord.setLV_PROCMODE("PMINSERT");
syncRecords.add(syncRecord);
updateRecords.add(record);
count++;
if (count >= 30)
break;
syncRecords.add(syncRecord);
updateRecords.add(record);
count++;
if (count >= 30)
break;
}
}
if(count == 0){
return;
@ -128,8 +130,8 @@ public class XaRecordTask implements ITask {
TenTranEntity tranEntity = tenTranService.saveApi(fwikUrl,jsonData,"RYSKZPXX", "RYSKZPXX", appId, appSecret);
String tranId = String.format("%s%016d",DateUtils.format(tranEntity.getTranDate(),"yyyyMMddHHmmss"),tranEntity.getTranId());
// String resJson = XaApi.httpPOSTJson(fwikUrl, enJson, "RYSKZPXX", "RYSKZPXX", appId, appSecret,tranId);
String resJson = "{\"sta\":{\"code\":\"0000\",\"des\":\"成功\",\"ErrorLineParameter\":\"empty\"},\"datas\":[{\"Result\":\"接收成功\"}],\"pages\":[{\"psize\":\"1\",\"tcount\":\"1\",\"pno\":\"1\",\"tsize\":\"0\"}]}";
String resJson = XaApi.httpPOSTJson(fwikUrl, enJson, "RYSKZPXX", "RYSKZPXX", appId, appSecret,tranId);
// String resJson = "{\"sta\":{\"code\":\"0000\",\"des\":\"成功\",\"ErrorLineParameter\":\"empty\"},\"datas\":[{\"Result\":\"接收成功\"}],\"pages\":[{\"psize\":\"1\",\"tcount\":\"1\",\"pno\":\"1\",\"tsize\":\"0\"}]}";
// String resJson = "23232";
// System.out.println(s);
log.debug("上传人员识别记录返回数据:" + resJson);
@ -210,8 +212,8 @@ public class XaRecordTask implements ITask {
TenTranEntity tranEntity = tenTranService.saveApi(fwikUrl,jsonData,"TCCTCSBXX", "TCCTCSBXX", appId, appSecret);
String tranId = String.format("%s%016d",DateUtils.format(tranEntity.getTranDate(),"yyyyMMddHHmmss"),tranEntity.getTranId());
// String resJson = XaApi.httpPOSTJson(fwikUrl, enJson, "TCCTCSBXX", "TCCTCSBXX", appId, appSecret,tranId);
String resJson = "{\"sta\":{\"code\":\"0000\",\"des\":\"成功\",\"ErrorLineParameter\":\"empty\"},\"datas\":[{\"Result\":\"接收成功\"}],\"pages\":[{\"psize\":\"1\",\"tcount\":\"1\",\"pno\":\"1\",\"tsize\":\"0\"}]}";
String resJson = XaApi.httpPOSTJson(fwikUrl, enJson, "TCCTCSBXX", "TCCTCSBXX", appId, appSecret,tranId);
// String resJson = "{\"sta\":{\"code\":\"0000\",\"des\":\"成功\",\"ErrorLineParameter\":\"empty\"},\"datas\":[{\"Result\":\"接收成功\"}],\"pages\":[{\"psize\":\"1\",\"tcount\":\"1\",\"pno\":\"1\",\"tsize\":\"0\"}]}";
// String resJson = "23232";
// System.out.println(s);
log.debug("上传车辆进场记录返回数据:" + resJson);
@ -295,8 +297,8 @@ public class XaRecordTask implements ITask {
TenTranEntity tranEntity = tenTranService.saveApi(fwikUrl,jsonData,"TCCTCSBXX", "TCCTCSBXX", appId, appSecret);
String tranId = String.format("%s%016d",DateUtils.format(tranEntity.getTranDate(),"yyyyMMddHHmmss"),tranEntity.getTranId());
// String resJson = XaApi.httpPOSTJson(fwikUrl, enJson, "TCCTCSBXX", "TCCTCSBXX", appId, appSecret,tranId);
String resJson = "{\"sta\":{\"code\":\"0000\",\"des\":\"成功\",\"ErrorLineParameter\":\"empty\"},\"datas\":[{\"Result\":\"接收成功\"}],\"pages\":[{\"psize\":\"1\",\"tcount\":\"1\",\"pno\":\"1\",\"tsize\":\"0\"}]}";
String resJson = XaApi.httpPOSTJson(fwikUrl, enJson, "TCCTCSBXX", "TCCTCSBXX", appId, appSecret,tranId);
// String resJson = "{\"sta\":{\"code\":\"0000\",\"des\":\"成功\",\"ErrorLineParameter\":\"empty\"},\"datas\":[{\"Result\":\"接收成功\"}],\"pages\":[{\"psize\":\"1\",\"tcount\":\"1\",\"pno\":\"1\",\"tsize\":\"0\"}]}";
// String resJson = "23232";
// System.out.println(s);
log.debug("上传车辆进场记录返回数据:" + resJson);

View File

@ -120,6 +120,9 @@ public class TenBuildController extends AbstractController {
Map<String,Object> params = new HashMap<>();
params.put("tenantId",tenantId+"");
List<TenBuildEntity> buildList = tenBuildService.selectByCellId(cellId);
// for(TenBuildEntity buildEntity: buildList){
// buildEntity.setName(buildEntity.getName()+buildEntity.getUnit()+"单元");
// }
return R.ok().put("data", buildList);
}

View File

@ -11,6 +11,7 @@ import net.shapelight.modules.vo.TenPersonIdUpdateAllVo;
import net.shapelight.modules.vo.TenPersonIdUpdateVo;
import net.shapelight.modules.vo.TenPersonVo;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
@ -22,6 +23,7 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@ -46,7 +48,7 @@ public class TenDeviceServiceImpl extends ServiceImpl<TenDeviceDao, TenDeviceEnt
private TenPersonService tenPersonService;
@Autowired
private TenRecordService tenRecordService;
// @Autowired
// @Autowired
// private EmqHttpApi emqHttpApi;
@Autowired
private TenDeviceAlertService tenDeviceAlertService;
@ -61,42 +63,52 @@ public class TenDeviceServiceImpl extends ServiceImpl<TenDeviceDao, TenDeviceEnt
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");
String key = (String) params.get("key");
// if(key == null){
// key = "";
// }
if (cellId != null && !cellId.isEmpty()) {
Long cellLong = Long.parseLong(cellId);
cellIds.add(cellLong);
}else {
} else {
List<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<TenDeviceEntity> page = this.page(
new Query<TenDeviceEntity>().getPage(params),
new QueryWrapper<TenDeviceEntity>()
.eq("tenant_id",params.get("tenantId"))
.in("cell_id",cellIds)
.eq("tenant_id", params.get("tenantId"))
.in("cell_id", cellIds)
.and(StringUtils.isNotBlank(key),
i -> i
.like("sn", key)
.or()
.like("name", key)
)
);
for(TenDeviceEntity dev : page.getRecords()){
for (TenDeviceEntity dev : page.getRecords()) {
StringBuffer scope = new StringBuffer();
if(dev.getCellId()!=null){
if (dev.getCellId() != null) {
String cellName = tenCellService.getCellName(dev.getCellId().toString());
scope.append(cellName);
}
if(dev.getBuildId()!=null){
TenBuildEntity build = tenBuildService.getById(dev.getBuildId(),dev.getCellId());
if (dev.getBuildId() != null) {
TenBuildEntity build = tenBuildService.getById(dev.getBuildId(), dev.getCellId());
// dev.setBuildName(build.getName());
// dev.setBuildUnit(build.getUnit());
scope.append(build.getName());
scope.append(build.getUnit());
scope.append("单元");
}
if(dev.getRoomId()!=null){
String roomName = tenRoomService.getRoomName(dev.getRoomId(),dev.getCellId());
if (dev.getRoomId() != null) {
String roomName = tenRoomService.getRoomName(dev.getRoomId(), dev.getCellId());
// dev.setRoomName(roomName);
scope.append(roomName);
}
@ -113,23 +125,23 @@ public class TenDeviceServiceImpl extends ServiceImpl<TenDeviceDao, TenDeviceEnt
Boolean flag = deviceApiService.isOnline(dev.getSn());
if (flag) {
dev.setStatus(1);
}else{
} else {
dev.setStatus(0);
}
}
}
return new PageUtils(page);
}
@Override
public List<TenDeviceVo> findByCellId(long cellId) {
List<TenDeviceEntity> devList = this.list(new QueryWrapper<TenDeviceEntity>()
.eq("cell_id",cellId));
List<TenDeviceEntity> devList = this.list(new QueryWrapper<TenDeviceEntity>()
.eq("cell_id", cellId));
List<TenDeviceVo> resList = new ArrayList<>();
if(devList.size()>0){
for(TenDeviceEntity dev: devList){
if (devList.size() > 0) {
for (TenDeviceEntity dev : devList) {
// boolean onlineFlag = emqHttpApi.getClient(dev.getSn());
// if(onlineFlag){
// dev.setStatus(1);
@ -140,12 +152,12 @@ public class TenDeviceServiceImpl extends ServiceImpl<TenDeviceDao, TenDeviceEnt
Boolean flag = deviceApiService.isOnline(dev.getSn());
if (flag) {
dev.setStatus(1);
}else{
} else {
dev.setStatus(0);
}
TenDeviceVo vo = new TenDeviceVo();
try {
BeanUtils.copyProperties(vo,dev);
BeanUtils.copyProperties(vo, dev);
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
@ -158,22 +170,22 @@ public class TenDeviceServiceImpl extends ServiceImpl<TenDeviceDao, TenDeviceEnt
}
@Override
public boolean remoteOpenDoor(String deviceSn,Long personId,Integer memberId) {
public boolean remoteOpenDoor(String deviceSn, Long personId, Integer memberId) {
// CmdProcess.publishRemoteOpenDoor(deviceSn,memberId);
//远程开门
int r = serverApiService.openDoor(deviceSn,personId);
int r = serverApiService.openDoor(deviceSn, personId);
// if(r == -1){
// return R.error("设备离线");
// }
// return R.ok();
Object open = null;
for(int i = 0;i<30;i++) {
for (int i = 0; i < 30; i++) {
try {
Thread.sleep(200);
open = redisUtils.get(personId+"-"+deviceSn);
if(open!=null){
open = redisUtils.get(personId + "-" + deviceSn);
if (open != null) {
return true;
}
} catch (InterruptedException e) {
@ -185,9 +197,9 @@ public class TenDeviceServiceImpl extends ServiceImpl<TenDeviceDao, TenDeviceEnt
}
@Override
@Cacheable(value="TenDevice", key="#sn")
@Cacheable(value = "TenDevice", key = "#sn")
public TenDeviceEntity findBySn(String sn) {
return this.getOne(new QueryWrapper<TenDeviceEntity>().eq("sn",sn));
return this.getOne(new QueryWrapper<TenDeviceEntity>().eq("sn", sn));
}
@ -230,9 +242,9 @@ public class TenDeviceServiceImpl extends ServiceImpl<TenDeviceDao, TenDeviceEnt
public void updateFailurePerson(String sn, List<Integer> memberIdList) {
TenDeviceEntity dev = findBySn(sn);
Long cellId = dev.getCellId();
for(Integer memberId: memberIdList){
TenPersonEntity person = tenPersonService.getByMemberId(memberId,cellId);
log.info("不合格人脸:"+person.getPersonId());
for (Integer memberId : memberIdList) {
TenPersonEntity person = tenPersonService.getByMemberId(memberId, cellId);
log.info("不合格人脸:" + person.getPersonId());
// TenPersonEntity person = new TenPersonEntity();
// person.setPersonId(personId);
// person.setCellId(cellId);
@ -251,23 +263,24 @@ public class TenDeviceServiceImpl extends ServiceImpl<TenDeviceDao, TenDeviceEnt
}
@Override
@Cacheable(value="TenDevice", key="#memberId+'-'+#cellId")
@Cacheable(value = "TenDevice", key = "#memberId+'-'+#cellId")
public TenPersonEntity getByMemberId(Integer memberId, Long cellId) {
return tenPersonService.getByMemberId(memberId, cellId);
}
@Override
@Cacheable(value="TenDevice", key="#psersonId+'-'+#cellId")
@Cacheable(value = "TenDevice", key = "#psersonId+'-'+#cellId")
public TenPersonEntity getByPersonId(Long psersonId, Long cellId) {
return tenPersonService.getById(psersonId,cellId);
return tenPersonService.getById(psersonId, cellId);
}
@CacheEvict(value="TenDevice",allEntries = true)
@CacheEvict(value = "TenDevice", allEntries = true)
@Transactional(rollbackFor = Exception.class)
public boolean evictRemoveByIds(Collection<? extends Serializable> idList) {
//删除同步人员
for(Long devId: (List<Long>)idList){
for (Long devId : (List<Long>) idList) {
TenDeviceEntity deviceEntity = this.getById(devId);
tenPersonSyncService.removeByDeviceId(devId,deviceEntity.getTenantId());
tenPersonSyncService.removeByDeviceId(devId, deviceEntity.getTenantId());
//清除通知
serverApiService.cleanData(deviceEntity.getSn());
}
@ -275,10 +288,10 @@ public class TenDeviceServiceImpl extends ServiceImpl<TenDeviceDao, TenDeviceEnt
return removeByIds(idList);
}
@CacheEvict(value="TenDevice",allEntries = true)
@CacheEvict(value = "TenDevice", allEntries = true)
public boolean evictRemoveByCellIds(Long[] idList) {
return this.remove(new QueryWrapper<TenDeviceEntity>()
.in("cell_id",idList));
return this.remove(new QueryWrapper<TenDeviceEntity>()
.in("cell_id", idList));
// return removeByIds(idList);
}
@ -289,12 +302,12 @@ public class TenDeviceServiceImpl extends ServiceImpl<TenDeviceDao, TenDeviceEnt
for (TenCellEntity cell : cells) {
cellIds.add(cell.getCellId());
}
if(cellIds.size()==0){
if (cellIds.size() == 0) {
return 0;
}else{
} else {
List<TenDeviceEntity> list = this.list(new QueryWrapper<TenDeviceEntity>()
.eq("tenant_id",params.get("tenantId"))
.in("cell_id",cellIds));
.eq("tenant_id", params.get("tenantId"))
.in("cell_id", cellIds));
return list.size();
}
}
@ -307,15 +320,15 @@ public class TenDeviceServiceImpl extends ServiceImpl<TenDeviceDao, TenDeviceEnt
for (TenCellEntity cell : cells) {
cellIds.add(cell.getCellId());
}
if(cellIds.size()>0){
if (cellIds.size() > 0) {
List<TenDeviceEntity> list = this.list(new QueryWrapper<TenDeviceEntity>()
.eq("tenant_id",params.get("tenantId"))
.in("cell_id",cellIds));
if (list.size()>=0) {
for(TenDeviceEntity dev: list){
.eq("tenant_id", params.get("tenantId"))
.in("cell_id", cellIds));
if (list.size() >= 0) {
for (TenDeviceEntity dev : list) {
// boolean onlineFlag = emqHttpApi.getClient(dev.getSn());
boolean onlineFlag = deviceApiService.isOnline(dev.getSn());
if(onlineFlag){
if (onlineFlag) {
onlineCount++;
}
}
@ -326,7 +339,7 @@ public class TenDeviceServiceImpl extends ServiceImpl<TenDeviceDao, TenDeviceEnt
@Override
@CacheEvict(value="TenDevice",allEntries = true)
@CacheEvict(value = "TenDevice", allEntries = true)
@Transactional(rollbackFor = Exception.class)
public void evictSave(TenDeviceEntity deviceEntity) {
this.save(deviceEntity);
@ -338,7 +351,7 @@ public class TenDeviceServiceImpl extends ServiceImpl<TenDeviceDao, TenDeviceEnt
//1.删除设备关联的人
//2.批量添加
List<TenPersonSyncEntity> saveList = new ArrayList<>();
for(TenPersonIdUpdateAllVo vo:list){
for (TenPersonIdUpdateAllVo vo : list) {
TenPersonSyncEntity entity = new TenPersonSyncEntity();
entity.setDeviceId(deviceEntity.getDeviceId());
entity.setDeviceSn(deviceEntity.getSn());
@ -350,15 +363,15 @@ public class TenDeviceServiceImpl extends ServiceImpl<TenDeviceDao, TenDeviceEnt
saveList.add(entity);
// tenPersonSyncService.insert(entity);
}
if(saveList.size()>0){
tenPersonSyncService.insertBatch(saveList,deviceEntity.getTenantId());
if (saveList.size() > 0) {
tenPersonSyncService.insertBatch(saveList, deviceEntity.getTenantId());
}
// tenPersonSyncService.saveBatch(sList);
}
@Override
@CacheEvict(value="TenDevice",allEntries = true)
@CacheEvict(value = "TenDevice", allEntries = true)
public void evictupdateById(TenDeviceEntity tenDevice) {
this.updateById(tenDevice);
}

View File

@ -335,7 +335,7 @@ public class XaApi {
syncRecord.setLV_TCCBH("610113100000000000267");
syncRecord.setLV_CPHM("陕A66GB0");
syncRecord.setLV_CPHM("陕AK8L34");
syncRecord.setLV_CPLX("03");//01 大型汽车号牌 2 小型汽车号牌 03 使馆汽车号牌 04 领馆汽车号牌
syncRecord.setLV_GCSJ(DateUtils.format(new Date(), "yyyyMMddHHmmss"));
syncRecord.setLV_GCLX("1");//1进场2出场
@ -389,6 +389,9 @@ public class XaApi {
*/
String appid = "1297164778041095";
String appsecret = "22971647780410956329716477804109";
//伟丰花园610113600000000005977 欧风园610113600000000004538
//西安文理学院610113630000000010348 绿地花都610113610000000017653
String xqid = "610113600000000004538";
String address = getAddress(xqid, appid, appsecret);
System.out.println(address);
@ -398,8 +401,8 @@ public class XaApi {
String apiUrl = getFwikUrl(appid, appsecret);
System.out.println(apiUrl);
//6.1 获取标准地址接口---------------------------------------------------------------------------
// String address = getAddress(xqid, appid, appsecret);
// System.out.println(address);
String addressCell = getAddress(xqid, appid, appsecret);
System.out.println(addressCell);
//6.3.1 实有房屋信息----------------------------------------------------------------------------
// 1820591355 610113600000000001202 610113003012013 陕西省西安市雁塔区长安南路439号4栋1单元3层4131号 长安南路 108.942481 34.207741 14 10 610113600000000004538 欧风园小区 610113 陕师大警务室 000268000029000013000001000003000002 000268 A61011304538 西安市雁塔区 610113600000 2021-03-23 16:50:08
/*
@ -413,11 +416,11 @@ public class XaApi {
1820580970 610113600000000001202 610113003012013 陕西省西安市雁塔区长安南路439号1栋1单元4层1142号 长安南路 108.942541 34.206951 14 10 610113600000000004538 欧风园小区 610113 陕师大警务室 000268000029000010000001000004000002 000268 A61011304538 西安市雁塔区 610113600000 2021-03-23 16:50:08
1820581243 610113600000000001202 610113003012013 陕西省西安市雁塔区长安南路439号1栋1单元5层1152号 长安南路 108.942541 34.206951 14 10 610113600000000004538 欧风园小区 610113 陕师大警务室 000268000029000010000001000005000001 000268 A61011304538 西安市雁塔区 610113600000 2021-03-23 16:50:08
*/
syncRoom();
// syncRoom();
//6.3.2 实有人口信息----------------------------------------------------------------------------
// syncPerson();
//6.3.9 车辆出入记录-------------------------------------------------------------
processRecordCarEnter();
// processRecordCarEnter();
}