对接西安接口

This commit is contained in:
gaoben 2021-03-31 19:17:13 +08:00
parent ba35f83af0
commit c1532ee4c9
65 changed files with 3617 additions and 935 deletions

View File

@ -54,6 +54,29 @@ public class MD5Utils {
return md5StrBuff.toString(); return md5StrBuff.toString();
} }
public static String md5Str(String str) {
MessageDigest messageDigest = null;
if (str == null) {
return null;
}
try {
messageDigest = MessageDigest.getInstance("MD5");
messageDigest.reset();
messageDigest.update(str.getBytes("UTF-8"));
}catch (Exception e) {
return str;
}
byte[] byteArray = messageDigest.digest();
StringBuffer md5StrBuff = new StringBuffer();
for (int i = 0; i < byteArray.length; i++) {
if (Integer.toHexString(0xFF & byteArray[i]).length() == 1)
md5StrBuff.append("0").append(Integer.toHexString(0xFF & byteArray[i]));
else
md5StrBuff.append(Integer.toHexString(0xFF & byteArray[i]));
}
return md5StrBuff.toString().toUpperCase();
}
private static byte[] md5(String s) private static byte[] md5(String s)
{ {

View File

@ -1,63 +1,78 @@
package net.shapelight.modules.car.controller; package net.shapelight.modules.car.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import io.minio.MinioClient;
import io.minio.PutObjectOptions;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import net.shapelight.common.utils.R;
import net.shapelight.modules.ten.entity.TenCarEntity;
import net.shapelight.modules.ten.entity.TenPackRecordEntity;
import net.shapelight.modules.ten.entity.TenRecordEntity;
import net.shapelight.modules.ten.service.TenCarService;
import net.shapelight.modules.ten.service.TenPackRecordService;
import net.shapelight.modules.ten.service.TenRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Date;
import java.util.HashMap;
import java.util.Map; import java.util.Map;
/**
* 停车接口 import net.shapelight.common.config.GlobalValue;
*/ import net.shapelight.common.config.MinioConfig;
import net.shapelight.common.utils.R;
import net.shapelight.common.utils.StringUtils;
import net.shapelight.common.utils.UUIDUtil;
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 org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController @RestController
@RequestMapping("/api/car/v1") @RequestMapping({"/api/car/v1"})
@Api("停车接口") @Api("停车接口")
@Slf4j
public class CarOpenApi { public class CarOpenApi {
private static final Logger log = LoggerFactory.getLogger(net.shapelight.modules.car.controller.CarOpenApi.class);
@Autowired @Autowired
private TenCarService tenCarService; private TenCarService tenCarService;
@Autowired @Autowired
private TenPackRecordService tenPackRecordService; private TenPackRecordService tenPackRecordService;
@PostMapping("/getMsg/{cellId}") @Autowired
@ApiOperation(value = "获取Msg") private GlobalValue globalValue;
@ApiImplicitParams({
@ApiImplicitParam(name = "sn", value = "设备SN", paramType = "query", dataType = "String", required = true),
})
public R getMsg(@PathVariable("cellId") Long cellId, @RequestParam Map<String, Object> params) {
@Autowired
private MinioClient minioClient;
@Autowired
private MinioConfig minioConfig;
@Autowired
private TenPackRecordEnterService tenPackRecordEnterService;
@Autowired
private TenPackRecordExitService tenPackRecordExitService;
@PostMapping({"/getMsg/{cellId}"})
@ApiOperation("获取MSG")
@ApiImplicitParams({@ApiImplicitParam(name = "sn", value = "设备sn", paramType = "query", dataType = "String", required = true)})
public R getMsg(@PathVariable("cellId") Long cellId, @RequestParam Map<String, Object> params) {
JSONObject msgJson = JSONObject.parseObject((String) params.get("Msg")); JSONObject msgJson = JSONObject.parseObject((String) params.get("Msg"));
int cmd = msgJson.getInteger("command"); int cmd = msgJson.getInteger("command").intValue();
/*
Msg='{"workstationid":1,
"message":"",
"VLP":"粤B66666",
"position":"0","method":"","username":"test",
"Ctypename":"月租车","model":"MAGOTAN","balance":"0.05",
"registertime":"2017-05-25","status":1,"vehiclename":"张三",
"parkid":1, "vehiclenumber":"1234567890123456789012",
"certificate":"12345678901234567","Vtypename":"小型车",
"result":0,"cardsn":"12","telephone":"13800000000",
"Vtype":1,"address":"深圳市龙华区民治街道","receivablefee":"0.00",
"password":"d41d8cd98f00b204e9800998ecf8427e","endtime":
"2017-06-24","command":13,"deposit":"0","mode":0,"color":"黑色","code":0,
"recordid":0,"Ctype":2,"starttime":"2017-05-25","actualfee":"0.00"}'
*/
if (cmd == 13 || cmd == 19 || cmd == 20) { if (cmd == 13 || cmd == 19 || cmd == 20) {
TenCarEntity car = new TenCarEntity(); TenCarEntity car = new TenCarEntity();
car.setCellId(cellId); car.setCellId(cellId);
@ -72,38 +87,24 @@ public class CarOpenApi {
car.setEndTime(msgJson.getDate("endtime")); car.setEndTime(msgJson.getDate("endtime"));
car.setParkName(msgJson.getString("parkname")); car.setParkName(msgJson.getString("parkname"));
car.setTelephone(msgJson.getString("telephone")); car.setTelephone(msgJson.getString("telephone"));
tenCarService.saveOrUpdate(car); this.tenCarService.saveOrUpdate(car);
} } else if (cmd == 1 || cmd == 2) {
/*
Msg= '{"outtime":"2017-04-19 23:21:45","workstationid":1,
VLP":"粤B12345"," username ":"test","method":"","Ctypename":"临时车","channeltype":0,
"operator":"管理员","inpicture1":"","direction":0,"password":"d41d8cd98f00b204e9800998ecf8427e",
"parkid":1,"inVLP":"","remainspace":100,"outchannel":2,"Vtypename":"小型车","cardsn":"116021386901",
"inchannelname":"停车场入口","outchannelname":"停车场入口","Vtype":1,"receivablefee":"5.00","command":1,
"outpicture":"","inchannel":1,"totalspace":100,"intime":"2017-04-19 23:21:45","mode":0,"code":1,
"recordid":70,"Ctype":3,"inpicture":"","actualfee":"5.00","consumefee":"0.00",
"consumetime":"2017-04-19 23:21:45","consumecode":"0","consumename":""} '
*/
else if (cmd == 1 || cmd == 2) { //识别记录
TenPackRecordEntity record = new TenPackRecordEntity(); TenPackRecordEntity record = new TenPackRecordEntity();
record.setParkId(msgJson.getString("parkid")); record.setParkId(msgJson.getString("parkid"));
record.setRecordId(msgJson.getString("recordid")); record.setRecordId(msgJson.getString("recordid"));
record.setCellId(cellId); record.setCellId(cellId);
record.setVlp(msgJson.getString("VLP")); record.setVlp(msgJson.getString("VLP"));
record.setCTypeName(msgJson.getString("Ctypename")); record.setCTypeName(msgJson.getString("Ctypename"));
record.setVTypeName(msgJson.getString("Vtypename")); record.setVTypeName(msgJson.getString("Vtypename"));
record.setOperator(msgJson.getString("operator")); record.setOperator(msgJson.getString("operator"));
record.setDirection(msgJson.getInteger("direction")); record.setDirection(msgJson.getInteger("direction"));
if (cmd ==1) { if (cmd == 1) {
record.setInChannelName(msgJson.getString("inchannelname")); record.setInChannelName(msgJson.getString("inchannelname"));
record.setInTime(msgJson.getDate("intime")); record.setInTime(msgJson.getDate("intime"));
record.setInPicture(msgJson.getString("inpicture")); record.setInPicture(msgJson.getString("inpicture"));
record.setInPictureBase64(msgJson.getString("inpicturedata")); record.setInPictureBase64(msgJson.getString("inpicturedata"));
record.setInPicturePlate(msgJson.getString("inpicture1")); record.setInPicturePlate(msgJson.getString("inpicture1"));
record.setInPicturePlateBase64(msgJson.getString("inpicturedata1")); record.setInPicturePlateBase64(msgJson.getString("inpicturedata1"));
} }
record.setOutChannelName(msgJson.getString("outchannelname")); record.setOutChannelName(msgJson.getString("outchannelname"));
record.setOutTime(msgJson.getDate("outtime")); record.setOutTime(msgJson.getDate("outtime"));
@ -111,18 +112,144 @@ public class CarOpenApi {
record.setOutPictureBase64(msgJson.getString("outpicturedata")); record.setOutPictureBase64(msgJson.getString("outpicturedata"));
record.setOutPicturePlate(msgJson.getString("outpicture1")); record.setOutPicturePlate(msgJson.getString("outpicture1"));
record.setOutPicturePlateBase64(msgJson.getString("outpicturedata1")); record.setOutPicturePlateBase64(msgJson.getString("outpicturedata1"));
record.setInVlp(msgJson.getString("inVLP")); record.setInVlp(msgJson.getString("inVLP"));
record.setParkName(msgJson.getString("parkname")); record.setParkName(msgJson.getString("parkname"));
record.setReceivableFee(msgJson.getString("receivablefee")); record.setReceivableFee(msgJson.getString("receivablefee"));
record.setActualFee(msgJson.getString("actualfee")); record.setActualFee(msgJson.getString("actualfee"));
this.tenPackRecordService.saveOrUpdateByRecordId(record);
tenPackRecordService.saveOrUpdateByRecordId(record);
} }
return R.ok(); 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");
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);
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();
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;
}
} }

View File

@ -0,0 +1,17 @@
package net.shapelight.modules.car.utils;
import java.util.Date;
import net.shapelight.common.utils.MD5Utils;
public class SignUtil {
public static int compareSign(String appKey, long timestamp, String sign) {
long nowLong = (new Date()).getTime() / 1000L;
if (timestamp < nowLong - 300L || timestamp > nowLong + 300L)
return 2;
String signMd5 = MD5Utils.getMD5Str(appKey + timestamp);
if (!signMd5.equalsIgnoreCase(signMd5))
return 3;
return 0;
}
}

View File

@ -0,0 +1,48 @@
package net.shapelight.modules.job.task;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
import net.shapelight.modules.sys.entity.SysUserEntity;
import net.shapelight.modules.sys.service.SysUserService;
import net.shapelight.modules.ten.entity.TenCellEntity;
import net.shapelight.modules.ten.service.TenCellService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component("xaAddressTask")
@Slf4j
public class XaAddressTask implements ITask {
@Autowired
private SysUserService sysUserService;
@Autowired
private TenCellService tenCellService;
public void run(String params) {
log.debug("xaApiTask定时任务正在执行", params);
List<SysUserEntity> allSysTenUser = this.sysUserService.findAllSysTenUser();
for (SysUserEntity sysTenUser : allSysTenUser) {
if (sysTenUser.getOpenId() != null && sysTenUser.getOpenId().length() > 0) {
JSONObject object = JSONObject.parseObject(sysTenUser.getOpenId());
Integer type = object.getInteger("type");
if (type.intValue() == 1) {
String appId = object.getString("appId");
String appSecret = object.getString("appSecret");
List<TenCellEntity> allCells = this.tenCellService.list((Wrapper) (new QueryWrapper())
.eq("tenant_id", sysTenUser.getTenantId()));
for (TenCellEntity cellEntity : allCells) {
String xqid = cellEntity.getThirdId();
if (xqid == null || xqid.length() > 0) ;
}
}
}
}
log.debug("xaApiTask定时任务执行完毕");
}
}

View File

@ -0,0 +1,201 @@
package net.shapelight.modules.job.task;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.minio.MinioClient;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Base64;
import java.util.Date;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
import net.shapelight.common.config.MinioConfig;
import net.shapelight.common.utils.DateUtils;
import net.shapelight.modules.job.task.ITask;
import net.shapelight.modules.sys.entity.SysUserEntity;
import net.shapelight.modules.sys.service.SysUserService;
import net.shapelight.modules.ten.entity.TenCellEntity;
import net.shapelight.modules.ten.entity.TenPackRecordEntity;
import net.shapelight.modules.ten.entity.TenPersonEntity;
import net.shapelight.modules.ten.entity.TenRecordEntity;
import net.shapelight.modules.ten.service.TenCellService;
import net.shapelight.modules.ten.service.TenDeviceService;
import net.shapelight.modules.ten.service.TenDoorCardService;
import net.shapelight.modules.ten.service.TenPackRecordService;
import net.shapelight.modules.ten.service.TenPersonService;
import net.shapelight.modules.ten.service.TenRecordService;
import net.shapelight.modules.ten.service.TenRoomService;
import net.shapelight.modules.xian.service.XaApi;
import net.shapelight.modules.xian.vo.XaRYJCZPXX;
import net.shapelight.modules.xian.vo.XaRYRKPHOTO;
import net.shapelight.modules.xian.vo.XaTCCTCSBZPXX;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Slf4j
@Component("xaImageTask")
public class XaImageTask implements ITask {
@Autowired
private SysUserService sysUserService;
@Autowired
private TenCellService tenCellService;
@Autowired
private TenRoomService tenRoomService;
@Autowired
private TenPersonService tenPersonService;
@Autowired
private TenDoorCardService tenDoorCardService;
@Autowired
private TenDeviceService tenDeviceService;
@Autowired
private TenRecordService tenRecordService;
@Autowired
private TenPackRecordService tenPackRecordService;
@Autowired
private MinioConfig minioConfig;
@Autowired
private MinioClient minioClient;
public void run(String params) {
log.debug("xaImageTask定时任务正在执行", params);
List<SysUserEntity> allSysTenUser = this.sysUserService.findAllSysTenUser();
for (SysUserEntity sysTenUser : allSysTenUser) {
if (sysTenUser.getOpenId() != null && sysTenUser.getOpenId().length() > 0) {
JSONObject object = JSONObject.parseObject(sysTenUser.getOpenId());
Integer type = object.getInteger("type");
if (type.intValue() == 1) {
String appId = object.getString("appId");
String appSecret = object.getString("appSecret");
String fwikUrl = XaApi.getFwikUrl(appId, appSecret);
if (fwikUrl != null) {
List<TenCellEntity> allCells = this.tenCellService.list((Wrapper)(new QueryWrapper())
.eq("tenant_id", sysTenUser.getTenantId()));
Long tenantId = sysTenUser.getTenantId();
for (TenCellEntity cellEntity : allCells) {
String xqid = cellEntity.getThirdId();
Long cellId = cellEntity.getCellId();
if (xqid == null || xqid.length() > 0);
}
}
}
}
}
log.debug("xaImageTask定时任务执行完毕");
}
private void processRecordPerson(String appId, String appSecret, String xqid, String fwikUrl, Long cellId, Long tenantId) {
List<TenRecordEntity> records = this.tenRecordService.getNotSyncImage(cellId, tenantId);
List<XaRYJCZPXX> syncrecords = new ArrayList<>();
int count = 0;
for (TenRecordEntity record : records) {
XaRYJCZPXX syncRecord = new XaRYJCZPXX();
syncRecord.setLV_ZPSJ(DateUtils.format(record.getRecordTime(), "yyyyMMdd24HHmmss"));
syncRecord.setLV_MJXTWYBM(record.getRecordId().toString());
String faceUrl = record.getRecordFace();
if (faceUrl != null && !faceUrl.isEmpty()) {
String encode = "";
InputStream inStream = null;
ByteArrayOutputStream outStream = null;
try {
this.minioClient.statObject(this.minioConfig.getBucketName(), faceUrl);
inStream = this.minioClient.getObject(this.minioConfig.getBucketName(), faceUrl);
outStream = new ByteArrayOutputStream();
byte[] buffer = new byte[1024];
int length;
while ((length = inStream.read(buffer)) != -1)
outStream.write(buffer, 0, length);
encode = Base64.getEncoder().encodeToString(outStream.toByteArray());
syncRecord.setLV_ZPSJ(encode);
} catch (Exception e) {
log.error("底库不存在"+ faceUrl);
e.printStackTrace();
} finally {
if (inStream != null)
try {
inStream.close();
} catch (IOException e) {
log.debug("inputStream close IOException:" + e.getMessage());
}
if (outStream != null)
try {
outStream.close();
} catch (IOException e) {
log.debug("outStream close IOException:" + e.getMessage());
}
}
}
syncrecords.add(syncRecord);
count++;
if (count >= 60)
break;
}
}
private void processRecordCar(String appId, String appSecret, String xqid, String fwikUrl, Long cellId) {
List<TenPackRecordEntity> records = this.tenPackRecordService.getNotSync(cellId);
List<XaTCCTCSBZPXX> syncrecords = new ArrayList<>();
int count = 0;
for (TenPackRecordEntity record : records) {
XaTCCTCSBZPXX syncRecord = new XaTCCTCSBZPXX();
syncRecord.setLV_ZPSJ(DateUtils.format(record.getInTime(), "yyyyMMdd24HHmmss"));
syncrecords.add(syncRecord);
count++;
if (count >= 60)
break;
}
}
private void processPerson(String appId, String appSecret, String xqid, String fwikUrl, Long cellId) {
List<TenPersonEntity> persons = this.tenPersonService.getNotSyncImage(cellId);
List<XaRYRKPHOTO> syncPersons = new ArrayList<>();
int count = 0;
for (TenPersonEntity person : persons) {
XaRYRKPHOTO syncPerson = new XaRYRKPHOTO();
syncPerson.setLV_GMSFHM(person.getIdCard());
syncPerson.setLV_DJSJ(DateUtils.format(new Date(), "yyyyMMdd24HHmmss"));
String faceUrl = person.getFaceImage();
if (faceUrl != null && !faceUrl.isEmpty()) {
String encode = "";
InputStream inStream = null;
ByteArrayOutputStream outStream = null;
try {
this.minioClient.statObject(this.minioConfig.getBucketName(), faceUrl);
inStream = this.minioClient.getObject(this.minioConfig.getBucketName(), faceUrl);
outStream = new ByteArrayOutputStream();
byte[] buffer = new byte[1024];
int length;
while ((length = inStream.read(buffer)) != -1)
outStream.write(buffer, 0, length);
encode = Base64.getEncoder().encodeToString(outStream.toByteArray());
syncPerson.setLV_ZP(encode);
} catch (Exception e) {
log.error("底库不存在"+ faceUrl);
e.printStackTrace();
} finally {
if (inStream != null)
try {
inStream.close();
} catch (IOException e) {
log.debug("inputStream close IOException:" + e.getMessage());
}
if (outStream != null)
try {
outStream.close();
} catch (IOException e) {
log.debug("outStream close IOException:" + e.getMessage());
}
}
}
count++;
if (count >= 60)
break;
}
}
}

View File

@ -0,0 +1,180 @@
package net.shapelight.modules.job.task;
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 lombok.extern.slf4j.Slf4j;
import net.shapelight.common.utils.DateUtils;
import net.shapelight.modules.sys.entity.SysUserEntity;
import net.shapelight.modules.sys.service.SysUserService;
import net.shapelight.modules.ten.entity.TenCellEntity;
import net.shapelight.modules.ten.entity.TenDeviceEntity;
import net.shapelight.modules.ten.entity.TenPersonEntity;
import net.shapelight.modules.ten.entity.TenRoomEntity;
import net.shapelight.modules.ten.service.TenCellService;
import net.shapelight.modules.ten.service.TenDeviceService;
import net.shapelight.modules.ten.service.TenDoorCardService;
import net.shapelight.modules.ten.service.TenPersonService;
import net.shapelight.modules.ten.service.TenRoomService;
import net.shapelight.modules.xian.service.XaApi;
import net.shapelight.modules.xian.vo.XaMJKXX;
import net.shapelight.modules.xian.vo.XaMJSBXX;
import net.shapelight.modules.xian.vo.XaPages;
import net.shapelight.modules.xian.vo.XaSYFW;
import net.shapelight.modules.xian.vo.XaSYRK;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Slf4j
@Component("xaRealDataTask")
public class XaRealDataTask implements ITask {
@Autowired
private SysUserService sysUserService;
@Autowired
private TenCellService tenCellService;
@Autowired
private TenRoomService tenRoomService;
@Autowired
private TenPersonService tenPersonService;
@Autowired
private TenDoorCardService tenDoorCardService;
@Autowired
private TenDeviceService tenDeviceService;
public void run(String params) {
log.debug("xaApiTask定时任务正在执行", params);
List<SysUserEntity> allSysTenUser = this.sysUserService.findAllSysTenUser();
for (SysUserEntity sysTenUser : allSysTenUser) {
if (sysTenUser.getOpenId() != null && sysTenUser.getOpenId().length() > 0) {
JSONObject object = JSONObject.parseObject(sysTenUser.getOpenId());
Integer type = object.getInteger("type");
if (type.intValue() == 1) {
String appId = object.getString("appId");
String appSecret = object.getString("appSecret");
String fwikUrl = "http://";
if (fwikUrl != null) {
List<TenCellEntity> allCells = this.tenCellService.list((Wrapper)(new QueryWrapper())
.eq("tenant_id", sysTenUser.getTenantId()));
for (TenCellEntity cellEntity : allCells) {
String xqid = cellEntity.getThirdId();
Long cellId = cellEntity.getCellId();
if (xqid != null && xqid.length() > 0) {
processRealRoom(appId, appSecret, xqid, fwikUrl, cellId);
processRealPerson(appId, appSecret, xqid, fwikUrl, cellId);
processDoorCard(appId, appSecret, xqid, fwikUrl, cellId);
processDevice(appId, appSecret, xqid, fwikUrl, cellId);
}
}
}
}
}
}
log.debug("xaApiTask定时任务执行完毕");
}
private void processRealRoom(String appId, String appSecret, String xqid, String fwikUrl, Long cellId) {
List<TenRoomEntity> rooms = this.tenRoomService.getNotSync(cellId);
List<XaSYFW> syncRooms = new ArrayList();
int count = 0;
for (TenRoomEntity room : rooms) {
TenPersonEntity owner = this.tenPersonService.getOwner(room.getRoomId());
if (owner != null) {
XaSYFW realRoom = new XaSYFW();
realRoom.setLV_FWLB("1");
realRoom.setLV_FWXZ("2");
realRoom.setLV_FWYT("4");
realRoom.setLV_SFCZF("");
realRoom.setLV_FZ_GMSFHM(owner.getIdCard());
realRoom.setLV_FZ_XM(owner.getName());
realRoom.setLV_FZ_ZJZL("10");
realRoom.setLV_FZ_ZJHM(owner.getIdCard());
realRoom.setLV_FZ_LXDH(owner.getMobile());
realRoom.setLV_DJSJ(DateUtils.format(new Date(), "yyyyMMddHHmmss"));
realRoom.setLV_FWXZZ("1000");
realRoom.setLV_FWJG("1");
realRoom.setLV_COMPUTERID(xqid);
realRoom.setLV_PROCMODE("PMINSERT");
syncRooms.add(realRoom);
count++;
if (count >= 60)
break;
}
}
Map<String, Object> xaData = new HashMap<>();
if (syncRooms.size() > 0)
xaData.put("datas", syncRooms);
XaPages xapage = new XaPages();
xapage.setPno("1");
xapage.setPsize(count);
xapage.setTcount(0);
xapage.setTsize(0);
String realRoomRes = XaApi.postData(fwikUrl, appId, appSecret, "1", "SYFW", "SYFW", xaData);
}
private void processRealPerson(String appId, String appSecret, String xqid, String fwikUrl, Long cellId) {
List<TenPersonEntity> realPersons = this.tenPersonService.getNotSync(cellId);
List<XaSYRK> syncPersons = new ArrayList<>();
int count = 0;
for (TenPersonEntity person : realPersons) {
TenRoomEntity room = this.tenRoomService.getById(person.getRoomId(), person.getCellId());
XaSYRK realPerson = new XaSYRK();
realPerson.setLV_GMSFHM(person.getIdCard());
realPerson.setLV_XM(person.getName());
realPerson.setLV_ZJZL("10");
realPerson.setLV_ZJHM(person.getIdCard());
realPerson.setLV_JZDZ_DZBM(room.getDzbm());
realPerson.setLV_DJSJ(DateUtils.format(new Date(), "yyyyMMddHHmmss"));
realPerson.setLV_COMPUTERID(xqid);
realPerson.setLV_PROCMODE("PMINSERT");
syncPersons.add(realPerson);
count++;
if (count >= 60)
break;
}
}
private void processDoorCard(String appId, String appSecret, String xqid, String fwikUrl, Long cellId) {
List<TenPersonEntity> realPersons = this.tenPersonService.getNotSyncCard(cellId);
List<XaMJKXX> syncDoorCard = new ArrayList<>();
int count = 0;
for (TenPersonEntity person : realPersons) {
XaMJKXX realCard = new XaMJKXX();
realCard.setLV_MJKLX("4");
realCard.setLV_DJSJ(DateUtils.format(new Date(), "yyyyMMddHHmmss"));
realCard.setLV_SBXT("10");
realCard.setLV_CKR(person.getIdCard());
realCard.setLV_BH(person.getPersonId().toString());
realCard.setLV_PROCMODE("PMINSERT");
syncDoorCard.add(realCard);
count++;
if (count >= 60)
break;
}
}
private void processDevice(String appId, String appSecret, String xqid, String fwikUrl, Long cellId) {
List<TenDeviceEntity> realDevices = this.tenDeviceService.getNotSync(cellId);
List<XaMJSBXX> syncDevices = new ArrayList<>();
int count = 0;
for (TenDeviceEntity device : realDevices) {
XaMJSBXX realDevice = new XaMJSBXX();
realDevice.setLV_MJMC(device.getName());
realDevice.setLV_WZMS("1");
realDevice.setLV_SFYSXT("1");
realDevice.setLV_SBXT("10");
realDevice.setLV_MJXTWYBM(device.getSn());
realDevice.setLV_PROCMODE("PMINSERT");
syncDevices.add(realDevice);
count++;
if (count >= 60)
break;
}
}
}

View File

@ -0,0 +1,109 @@
package net.shapelight.modules.job.task;
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.List;
import lombok.extern.slf4j.Slf4j;
import net.shapelight.common.utils.DateUtils;
import net.shapelight.modules.job.task.ITask;
import net.shapelight.modules.sys.entity.SysUserEntity;
import net.shapelight.modules.sys.service.SysUserService;
import net.shapelight.modules.ten.entity.TenCellEntity;
import net.shapelight.modules.ten.entity.TenPackRecordEntity;
import net.shapelight.modules.ten.entity.TenRecordEntity;
import net.shapelight.modules.ten.service.TenCellService;
import net.shapelight.modules.ten.service.TenDeviceService;
import net.shapelight.modules.ten.service.TenDoorCardService;
import net.shapelight.modules.ten.service.TenPackRecordService;
import net.shapelight.modules.ten.service.TenPersonService;
import net.shapelight.modules.ten.service.TenRecordService;
import net.shapelight.modules.ten.service.TenRoomService;
import net.shapelight.modules.xian.service.XaApi;
import net.shapelight.modules.xian.vo.XaRYSKZPXX;
import net.shapelight.modules.xian.vo.XaTCCTCSBXX;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Slf4j
@Component("xaRecordTask")
public class XaRecordTask implements ITask {
@Autowired
private SysUserService sysUserService;
@Autowired
private TenCellService tenCellService;
@Autowired
private TenRecordService tenRecordService;
@Autowired
private TenPackRecordService tenPackRecordService;
public void run(String params) {
log.debug("xaRecordTask{}", params);
List<SysUserEntity> allSysTenUser = this.sysUserService.findAllSysTenUser();
for (SysUserEntity sysTenUser : allSysTenUser) {
if (sysTenUser.getOpenId() != null && sysTenUser.getOpenId().length() > 0) {
JSONObject object = JSONObject.parseObject(sysTenUser.getOpenId());
Integer type = object.getInteger("type");
if (type.intValue() == 1) {
String appId = object.getString("appId");
String appSecret = object.getString("appSecret");
String fwikUrl = XaApi.getFwikUrl(appId, appSecret);
if (fwikUrl != null) {
List<TenCellEntity> allCells = this.tenCellService.list((Wrapper)(new QueryWrapper())
.eq("tenant_id", sysTenUser.getTenantId()));
Long tenantId = sysTenUser.getTenantId();
for (TenCellEntity cellEntity : allCells) {
String xqid = cellEntity.getThirdId();
Long cellId = cellEntity.getCellId();
if (xqid == null || xqid.length() > 0);
}
}
}
}
}
log.debug("xaRecordTask定时任务执行完毕");
}
private void processRecordPerson(String appId, String appSecret, String xqid, String fwikUrl, Long cellId, Long tenantId) {
List<TenRecordEntity> records = this.tenRecordService.getNotSync(cellId, tenantId);
List<XaRYSKZPXX> syncrecords = new ArrayList<>();
int count = 0;
for (TenRecordEntity record : records) {
XaRYSKZPXX syncRecord = new XaRYSKZPXX();
syncRecord.setLV_MJBH(record.getDeviceSn());
syncRecord.setLV_CRLB("1");
syncRecord.setLV_ZPSJ(DateUtils.format(record.getRecordTime(), "yyyyMMdd24HHmmss"));
syncRecord.setLV_SBXT("10");
syncRecord.setLV_MJXTWYBM(record.getRecordId().toString());
syncRecord.setLV_RY_ID(record.getPersonId().toString());
syncRecord.setLV_FFMS("1");
syncRecord.setLV_PROCMODE("PMINSERT");
syncrecords.add(syncRecord);
count++;
if (count >= 60)
break;
}
}
private void processRecordCar(String appId, String appSecret, String xqid, String fwikUrl, Long cellId) {
List<TenPackRecordEntity> records = this.tenPackRecordService.getNotSync(cellId);
List<XaTCCTCSBXX> syncrecords = new ArrayList<>();
int count = 0;
for (TenPackRecordEntity record : records) {
XaTCCTCSBXX syncRecord = new XaTCCTCSBXX();
syncRecord.setLV_CPHM(record.getVlp());
syncRecord.setLV_CPLX(record.getVTypeName());
syncRecord.setLV_GCSJ(DateUtils.format(record.getInTime(), "YYYYMMDDHHMMSS"));
syncRecord.setLV_GCLX("1");
syncRecord.setLV_SBXT("10");
syncRecord.setLV_PROCMODE("PMINSERT");
syncrecords.add(syncRecord);
count++;
if (count >= 60)
break;
}
}
}

View File

@ -8,6 +8,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import net.shapelight.common.utils.StringUtils;
import net.shapelight.modules.nettyapi.service.ServerApiService; import net.shapelight.modules.nettyapi.service.ServerApiService;
import net.shapelight.modules.sys.entity.SysDeviceEntity; import net.shapelight.modules.sys.entity.SysDeviceEntity;
import net.shapelight.modules.sys.service.SysDeviceService; import net.shapelight.modules.sys.service.SysDeviceService;
@ -72,8 +73,11 @@ public class SysDeviceController {
@RequiresPermissions("sys:device") @RequiresPermissions("sys:device")
@ApiOperation(value = "保存") @ApiOperation(value = "保存")
public R save(@RequestBody SysDeviceEntity sysDevice){ public R save(@RequestBody SysDeviceEntity sysDevice){
sysDeviceService.save(sysDevice); if (sysDevice.getDeviceTypeId() == null)
return R.error("设备类型不能为空");
if (StringUtils.isEmpty(sysDevice.getSn()))
return R.error("设备sn不能为空");
this.sysDeviceService.save(sysDevice);
return R.ok(); return R.ok();
} }

View File

@ -32,10 +32,7 @@ import org.apache.shiro.crypto.hash.Sha256Hash;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.Arrays; import java.util.*;
import java.util.Date;
import java.util.List;
import java.util.Map;
/** /**
* 系统用户 * 系统用户
@ -137,15 +134,17 @@ public class SysUserController extends AbstractController {
@RequiresPermissions("sys:user:save") @RequiresPermissions("sys:user:save")
@ApiOperation("保存用户") @ApiOperation("保存用户")
public R save(@RequestBody SysUserEntity user){ public R save(@RequestBody SysUserEntity user){
ValidatorUtils.validateEntity(user, AddGroup.class); ValidatorUtils.validateEntity(user, new Class[] { AddGroup.class });
long id = new SnowflakeIdWorker().nextId(); long id = (new SnowflakeIdWorker()).nextId();
user.setUserId(id); user.setUserId(Long.valueOf(id));
user.setCreateBy(getUser().getUsername()); user.setCreateBy(getUser().getUsername());
user.setCreateTime(new Date()); user.setCreateTime(new Date());
//user.setUserType(Constant.SYSTEM_USER); user.setUserType(Integer.valueOf(1));
user.setUserType(Constant.SYSTEM_USER); List<Long> roleIdList = new ArrayList<>();
//user.setStatus(1); Long role = Long.valueOf(100L);
sysUserService.saveUser(user); roleIdList.add(role);
user.setRoleIdList(roleIdList);
this.sysUserService.saveUser(user);
return R.ok(); return R.ok();
} }

View File

@ -96,11 +96,15 @@ public class SysTenUserController extends AbstractController {
public R save(@RequestBody SysUserEntity user){ public R save(@RequestBody SysUserEntity user){
ValidatorUtils.validateEntity(user, AddGroup.class); ValidatorUtils.validateEntity(user, AddGroup.class);
long id = new SnowflakeIdWorker().nextId(); long id = new SnowflakeIdWorker().nextId();
user.setUserId(id); user.setUserId(Long.valueOf(id));
user.setCreateBy(getUser().getNickName()); user.setCreateBy(getUser().getNickName());
user.setCreateTime(new Date()); user.setCreateTime(new Date());
user.setUserType(Constant.TENANT_ADMIN); user.setUserType(Integer.valueOf(2));
user.setTenantId(id); user.setTenantId(Long.valueOf(id));
List<Long> roleIdList = new ArrayList<>();
Long role = Long.valueOf(1000L);
roleIdList.add(role);
user.setRoleIdList(roleIdList);
try { try {
sysUserService.saveUserSysTen(user); sysUserService.saveUserSysTen(user);
}catch (DuplicateKeyException e){ }catch (DuplicateKeyException e){

View File

@ -0,0 +1,98 @@
package net.shapelight.modules.ten.controller;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import net.shapelight.common.utils.Constant;
import net.shapelight.common.utils.PageUtils;
import net.shapelight.common.utils.R;
import net.shapelight.modules.sys.controller.AbstractController;
import net.shapelight.modules.sys.entity.SysUserEntity;
import net.shapelight.modules.sys.service.SysUserRoleService;
import net.shapelight.modules.ten.entity.TenPackChannalEntity;
import net.shapelight.modules.ten.entity.TenPackEntity;
import net.shapelight.modules.ten.entity.TenUserScopeEntity;
import net.shapelight.modules.ten.service.TenPackChannalService;
import net.shapelight.modules.ten.service.TenUserScopeService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping({"ten/packchannal"})
@Api(value="停车场通道管理",tags="停车场通道管理")
public class TenPackChannalController extends AbstractController {
@Autowired
private TenPackChannalService tenPackChannalService;
@Autowired
private SysUserRoleService sysUserRoleService;
@Autowired
private TenUserScopeService tenUserScopeService;
@GetMapping({"/list"})
@RequiresPermissions({"ten:packchannal"})
@ApiOperation(value = "列表",response = TenPackChannalEntity.class)
@ApiImplicitParams({
@ApiImplicitParam(name="limit",value = "每页条数",paramType = "query",dataType = "String",required = true),
@ApiImplicitParam(name="page",value = "页码",paramType = "query",dataType = "String",required = true),
})
public R list(@RequestParam Map<String, Object> params) {
String tenantId = getUser().getTenantId()+"";
params.put("tenantId",tenantId+"");
SysUserEntity user = getUser();
List<Long> roleIdList = sysUserRoleService.queryRoleIdList(user.getUserId());
//小区管理员
if(roleIdList.get(0).longValue() == Constant.ROLE_TEN_CELL){
TenUserScopeEntity scope = tenUserScopeService.getOne(new QueryWrapper<TenUserScopeEntity>().eq("user_id",user.getUserId()));
params.put("cellId",scope.getCellId().toString());
}
PageUtils page = this.tenPackChannalService.queryPage(params);
return R.ok().put("data", page);
}
@GetMapping({"/info/{parkChannalId}"})
@RequiresPermissions({"ten:packchannal"})
@ApiOperation(value = "详细信息",response = TenPackChannalEntity.class)
public R info(@PathVariable("parkChannalId") Long parkChannalId) {
TenPackChannalEntity tenPackChannal = (TenPackChannalEntity)this.tenPackChannalService.getById(parkChannalId);
return R.ok().put("data", tenPackChannal);
}
@PostMapping({"/save"})
@RequiresPermissions({"ten:packchannal"})
@ApiOperation(value = "保存")
public R save(@RequestBody TenPackChannalEntity tenPackChannal) {
tenPackChannal.setTenantId(getUser().getTenantId());
this.tenPackChannalService.save(tenPackChannal);
return R.ok();
}
@PostMapping({"/update"})
@RequiresPermissions({"ten:packchannal"})
@ApiOperation(value = "修改")
public R update(@RequestBody TenPackChannalEntity tenPackChannal) {
this.tenPackChannalService.updateById(tenPackChannal);
return R.ok();
}
@PostMapping({"/delete"})
@RequiresPermissions({"ten:packchannal"})
@ApiOperation(value = "删除")
public R delete(@RequestBody Long[] parkChannalIds) {
this.tenPackChannalService.removeByIds(Arrays.asList(parkChannalIds));
return R.ok();
}
}

View File

@ -0,0 +1,104 @@
package net.shapelight.modules.ten.controller;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import net.shapelight.common.utils.Constant;
import net.shapelight.common.utils.PageUtils;
import net.shapelight.common.utils.R;
import net.shapelight.modules.sys.controller.AbstractController;
import net.shapelight.modules.sys.entity.SysUserEntity;
import net.shapelight.modules.sys.service.SysUserRoleService;
import net.shapelight.modules.ten.entity.TenNoticeEntity;
import net.shapelight.modules.ten.entity.TenPackEntity;
import net.shapelight.modules.ten.entity.TenUserScopeEntity;
import net.shapelight.modules.ten.service.TenPackService;
import net.shapelight.modules.ten.service.TenUserScopeService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping({"ten/pack"})
@Api(value="停车场管理",tags="停车场管理")
public class TenPackController extends AbstractController {
@Autowired
private TenPackService tenPackService;
@Autowired
private SysUserRoleService sysUserRoleService;
@Autowired
private TenUserScopeService tenUserScopeService;
@GetMapping({"/list"})
@RequiresPermissions({"ten:pack"})
@ApiOperation(value = "列表",response = TenPackEntity.class)
@ApiImplicitParams({
@ApiImplicitParam(name="limit",value = "每页条数",paramType = "query",dataType = "String",required = true),
@ApiImplicitParam(name="page",value = "页码",paramType = "query",dataType = "String",required = true),
})
public R list(@RequestParam Map<String, Object> params) {
String tenantId = getUser().getTenantId()+"";
params.put("tenantId",tenantId+"");
SysUserEntity user = getUser();
List<Long> roleIdList = sysUserRoleService.queryRoleIdList(user.getUserId());
//小区管理员
if(roleIdList.get(0).longValue() == Constant.ROLE_TEN_CELL){
TenUserScopeEntity scope = tenUserScopeService.getOne(new QueryWrapper<TenUserScopeEntity>().eq("user_id",user.getUserId()));
params.put("cellId",scope.getCellId().toString());
}
PageUtils page = this.tenPackService.queryPage(params);
return R.ok().put("data", page);
}
@GetMapping({"/info/{parkId}"})
@RequiresPermissions({"ten:pack"})
@ApiOperation(value = "详细信息",response = TenPackEntity.class)
public R info(@PathVariable("parkId") Long parkId) {
TenPackEntity tenPack = (TenPackEntity)this.tenPackService.getById(parkId);
return R.ok().put("data", tenPack);
}
@PostMapping({"/save"})
@ApiOperation(value = "保存")
@RequiresPermissions({"ten:pack"})
public R save(@RequestBody TenPackEntity tenPack) {
tenPack.setTenantId(getUser().getTenantId());
this.tenPackService.save(tenPack);
return R.ok();
}
@PostMapping({"/update"})
@ApiOperation(value = "修改")
@RequiresPermissions({"ten:pack"})
public R update(@RequestBody TenPackEntity tenPack) {
this.tenPackService.updateById(tenPack);
return R.ok();
}
@PostMapping({"/delete"})
@RequiresPermissions({"ten:pack"})
@ApiOperation(value = "删除")
public R delete(@RequestBody Long[] parkIds) {
this.tenPackService.removeByIds(Arrays.asList(parkIds));
return R.ok();
}
@GetMapping({"/selectByCellId/{cellId}"})
@ApiOperation(value = "通过小区id选择停车场",response = TenPackEntity.class)
public R selectByCellId(@PathVariable("cellId") Long cellId) {
List<TenPackEntity> tenPacks = this.tenPackService.list(new QueryWrapper<TenPackEntity>()
.eq("cell_id",cellId));
return R.ok().put("data", tenPacks);
}
}

View File

@ -0,0 +1,85 @@
package net.shapelight.modules.ten.controller;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import net.shapelight.common.utils.Constant;
import net.shapelight.common.utils.PageUtils;
import net.shapelight.common.utils.R;
import net.shapelight.modules.sys.controller.AbstractController;
import net.shapelight.modules.sys.entity.SysUserEntity;
import net.shapelight.modules.sys.service.SysUserRoleService;
import net.shapelight.modules.ten.entity.TenPackEntity;
import net.shapelight.modules.ten.entity.TenPackRecordEnterEntity;
import net.shapelight.modules.ten.entity.TenUserScopeEntity;
import net.shapelight.modules.ten.service.TenPackRecordEnterService;
import net.shapelight.modules.ten.service.TenUserScopeService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping({"ten/packrecordenter"})
@Api(value="车辆进场记录",tags="车辆进场记录")
public class TenPackRecordEnterController extends AbstractController {
@Autowired
private TenPackRecordEnterService tenPackRecordEnterService;
@Autowired
private SysUserRoleService sysUserRoleService;
@Autowired
private TenUserScopeService tenUserScopeService;
@GetMapping({"/list"})
@RequiresPermissions({"ten:packrecordenter"})
@ApiOperation(value = "列表",response = TenPackRecordEnterEntity.class)
public R list(@RequestParam Map<String, Object> params) {
String tenantId = getUser().getTenantId()+"";
params.put("tenantId",tenantId+"");
SysUserEntity user = getUser();
List<Long> roleIdList = sysUserRoleService.queryRoleIdList(user.getUserId());
//小区管理员
if(roleIdList.get(0).longValue() == Constant.ROLE_TEN_CELL){
TenUserScopeEntity scope = tenUserScopeService.getOne(new QueryWrapper<TenUserScopeEntity>().eq("user_id",user.getUserId()));
params.put("cellId",scope.getCellId().toString());
}
PageUtils page = this.tenPackRecordEnterService.queryPage(params);
return R.ok().put("data", page);
}
@GetMapping({"/info/{recordEnterId}"})
@RequiresPermissions({"ten:packrecordenter"})
public R info(@PathVariable("recordEnterId") Long recordEnterId) {
TenPackRecordEnterEntity tenPackRecordEnter = (TenPackRecordEnterEntity)this.tenPackRecordEnterService.getById(recordEnterId);
return R.ok().put("data", tenPackRecordEnter);
}
@PostMapping({"/save"})
@RequiresPermissions({"ten:packrecordenter"})
public R save(@RequestBody TenPackRecordEnterEntity tenPackRecordEnter) {
this.tenPackRecordEnterService.save(tenPackRecordEnter);
return R.ok();
}
@PostMapping({"/update"})
@RequiresPermissions({"ten:packrecordenter"})
public R update(@RequestBody TenPackRecordEnterEntity tenPackRecordEnter) {
this.tenPackRecordEnterService.updateById(tenPackRecordEnter);
return R.ok();
}
@PostMapping({"/delete"})
@RequiresPermissions({"ten:packrecordenter"})
public R delete(@RequestBody Long[] recordEnterIds) {
this.tenPackRecordEnterService.removeByIds(Arrays.asList(recordEnterIds));
return R.ok();
}
}

View File

@ -0,0 +1,87 @@
package net.shapelight.modules.ten.controller;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import net.shapelight.common.utils.Constant;
import net.shapelight.common.utils.PageUtils;
import net.shapelight.common.utils.R;
import net.shapelight.modules.sys.controller.AbstractController;
import net.shapelight.modules.sys.entity.SysUserEntity;
import net.shapelight.modules.sys.service.SysUserRoleService;
import net.shapelight.modules.ten.entity.TenPackRecordEnterEntity;
import net.shapelight.modules.ten.entity.TenPackRecordExitEntity;
import net.shapelight.modules.ten.entity.TenUserScopeEntity;
import net.shapelight.modules.ten.service.TenPackRecordExitService;
import net.shapelight.modules.ten.service.TenUserScopeService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping({"ten/packrecordexit"})
@Api(value="车辆离场记录",tags="车辆离场记录")
public class TenPackRecordExitController extends AbstractController {
@Autowired
private TenPackRecordExitService tenPackRecordExitService;
@Autowired
private SysUserRoleService sysUserRoleService;
@Autowired
private TenUserScopeService tenUserScopeService;
@GetMapping({"/list"})
@RequiresPermissions({"ten:packrecordexit"})
@ApiOperation(value = "列表",response = TenPackRecordExitEntity.class)
public R list(@RequestParam Map<String, Object> params) {
String tenantId = getUser().getTenantId()+"";
params.put("tenantId",tenantId+"");
SysUserEntity user = getUser();
List<Long> roleIdList = sysUserRoleService.queryRoleIdList(user.getUserId());
//小区管理员
if(roleIdList.get(0).longValue() == Constant.ROLE_TEN_CELL){
TenUserScopeEntity scope = tenUserScopeService.getOne(new QueryWrapper<TenUserScopeEntity>().eq("user_id",user.getUserId()));
params.put("cellId",scope.getCellId().toString());
}
PageUtils page = this.tenPackRecordExitService.queryPage(params);
return R.ok().put("data", page);
}
@GetMapping({"/info/{recordEnterId}"})
@RequiresPermissions({"ten:packrecordexit"})
@ApiOperation(value = "详细",response = TenPackRecordExitEntity.class)
public R info(@PathVariable("recordEnterId") Long recordEnterId) {
TenPackRecordExitEntity tenPackRecordExit = (TenPackRecordExitEntity)this.tenPackRecordExitService.getById(recordEnterId);
return R.ok().put("data", tenPackRecordExit);
}
@PostMapping({"/save"})
@RequiresPermissions({"ten:packrecordexit"})
public R save(@RequestBody TenPackRecordExitEntity tenPackRecordExit) {
this.tenPackRecordExitService.save(tenPackRecordExit);
return R.ok();
}
@PostMapping({"/update"})
@RequiresPermissions({"ten:packrecordexit"})
public R update(@RequestBody TenPackRecordExitEntity tenPackRecordExit) {
this.tenPackRecordExitService.updateById(tenPackRecordExit);
return R.ok();
}
@PostMapping({"/delete"})
@RequiresPermissions({"ten:packrecordexit"})
public R delete(@RequestBody Long[] recordEnterIds) {
this.tenPackRecordExitService.removeByIds(Arrays.asList(recordEnterIds));
return R.ok();
}
}

View File

@ -0,0 +1,9 @@
package net.shapelight.modules.ten.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import net.shapelight.modules.ten.entity.TenPackChannalEntity;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface TenPackChannalDao extends BaseMapper<TenPackChannalEntity> {
}

View File

@ -0,0 +1,10 @@
package net.shapelight.modules.ten.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import net.shapelight.modules.ten.entity.TenPackEntity;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface TenPackDao extends BaseMapper<TenPackEntity> {
}

View File

@ -24,4 +24,8 @@ public interface TenPackRecordDao {
TenPackRecordEntity selectByRecordIdAndPackId(@Param("recordId")String recordId, @Param("parkId")String parkId,@Param("cellId")Long cellId); TenPackRecordEntity selectByRecordIdAndPackId(@Param("recordId")String recordId, @Param("parkId")String parkId,@Param("cellId")Long cellId);
IPage<TenPackRecordEntity> findPageAll(Page page, @Param("cellIds") List<Long> cellIds, @Param("params") Map params); IPage<TenPackRecordEntity> findPageAll(Page page, @Param("cellIds") List<Long> cellIds, @Param("params") Map params);
List<TenPackRecordEntity> getNotSync(@Param("cellId") Long paramLong);
List<TenPackRecordEntity> getNotSyncImage(@Param("cellId") Long paramLong);
} }

View File

@ -0,0 +1,9 @@
package net.shapelight.modules.ten.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import net.shapelight.modules.ten.entity.TenPackRecordEnterEntity;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface TenPackRecordEnterDao extends BaseMapper<TenPackRecordEnterEntity> {
}

View File

@ -0,0 +1,9 @@
package net.shapelight.modules.ten.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import net.shapelight.modules.ten.entity.TenPackRecordExitEntity;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface TenPackRecordExitDao extends BaseMapper<TenPackRecordExitEntity> {
}

View File

@ -80,6 +80,14 @@ public interface TenPersonDao {
List<TenPersonEntity> getAllExpireGuest(); List<TenPersonEntity> getAllExpireGuest();
TenPersonEntity getOwner(@Param("roomId") Long paramLong);
List<TenPersonEntity> getNotSync(@Param("cellId") Long paramLong);
List<TenPersonEntity> getNotSyncCard(@Param("cellId") Long paramLong);
List<TenPersonEntity> getNotSyncImage(@Param("cellId") Long paramLong);
} }

View File

@ -11,26 +11,32 @@ import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
*
* *
*/ */
@Mapper @Mapper
public interface TenRecordDao{ public interface TenRecordDao {
int insert(TenRecordEntity tenRecordEntity); int insert(TenRecordEntity tenRecordEntity);
int deleteById(@Param("recordId")Long id, @Param("tenantId")Long tenantId);
int deleteById(@Param("recordId") Long id, @Param("tenantId") Long tenantId);
boolean updateById(TenRecordEntity entity); boolean updateById(TenRecordEntity entity);
TenRecordEntity selectById(@Param("recordId")Long recordId,@Param("tenantId")Long tenantId);
IPage<TenRecordEntity> findPageAll(Page page, @Param("cellIds")List<Long> cellIds, @Param("params") Map params);
List<TenRecordEntity> findAll(@Param("cellIds")List<Long> cellIds, @Param("params") Map params); TenRecordEntity selectById(@Param("recordId") Long recordId, @Param("tenantId") Long tenantId);
int findHourAll(@Param("cellIds")List<Long> cellIds, @Param("params") Map params); IPage<TenRecordEntity> findPageAll(Page page, @Param("cellIds") List<Long> cellIds, @Param("params") Map params);
IPage<TenRecordEntity> findPageBlackRecord(Page page, @Param("cellIds")List<Long> cellIds, @Param("params") Map params); List<TenRecordEntity> findAll(@Param("cellIds") List<Long> cellIds, @Param("params") Map params);
IPage<TenRecordEntity> findPageRoomRecord(Page page,@Param("params") Map params); int findHourAll(@Param("cellIds") List<Long> cellIds, @Param("params") Map params);
String findLastRecordTime(@Param("personId")Long personId,@Param("tenantId")Long tenantId); IPage<TenRecordEntity> findPageBlackRecord(Page page, @Param("cellIds") List<Long> cellIds, @Param("params") Map params);
IPage<TenRecordEntity> findPageRoomRecord(Page page, @Param("params") Map params);
String findLastRecordTime(@Param("personId") Long personId, @Param("tenantId") Long tenantId);
List<TenRecordEntity> getNotSync(@Param("cellId") Long paramLong1, @Param("tenantId") Long paramLong2);
List<TenRecordEntity> getNotSyncImage(@Param("cellId") Long paramLong1, @Param("tenantId") Long paramLong2);
} }

View File

@ -45,5 +45,7 @@ public interface TenRoomDao {
@Param("buildId")Long buildId, @Param("buildId")Long buildId,
@Param("cellId")Long cellId); @Param("cellId")Long cellId);
List<TenRoomEntity> getNotSync(@Param("cellId") Long paramLong);
} }

View File

@ -16,216 +16,216 @@ import net.shapelight.common.base.BaseEntity;
/** /**
* 设备表 * 设备表
*
*/ */
@Data @Data
@TableName("ten_device") @TableName("ten_device")
public class TenDeviceEntity extends BaseEntity implements Serializable { public class TenDeviceEntity extends BaseEntity implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* id * id
*/ */
@TableId @TableId
@JsonSerialize(using = ToStringSerializer.class) @JsonSerialize(using = ToStringSerializer.class)
@ApiModelProperty("设备ID") @ApiModelProperty("设备ID")
private Long deviceId; private Long deviceId;
/** /**
* 设备名称 * 设备名称
*/ */
@ApiModelProperty("设备名称") @ApiModelProperty("设备名称")
private String name; private String name;
/** /**
* 序列号 * 序列号
*/ */
@ApiModelProperty("设备序列号") @ApiModelProperty("设备序列号")
private String sn; private String sn;
/** /**
* mac地址 * mac地址
*/ */
@ApiModelProperty("设备MAC地址") @ApiModelProperty("设备MAC地址")
private String mac; private String mac;
/** /**
* 1大门2单元门3室内机 * 1大门2单元门3室内机
*/ */
@ApiModelProperty("设备类型") @ApiModelProperty("设备类型")
private Integer type; private Integer type;
/** /**
* 0进1出 * 0进1出
*/ */
@ApiModelProperty("进出方向") @ApiModelProperty("进出方向")
private Integer gateFlag; private Integer gateFlag;
/** /**
* 小区id * 小区id
*/ */
@JsonSerialize(using = ToStringSerializer.class) @JsonSerialize(using = ToStringSerializer.class)
@ApiModelProperty("小区ID") @ApiModelProperty("小区ID")
private Long cellId; private Long cellId;
/** /**
* 楼栋编号 * 楼栋编号
*/ */
@ApiModelProperty("楼栋编号") @ApiModelProperty("楼栋编号")
private String buildNumber; private String buildNumber;
/** /**
* 楼栋单元 * 楼栋单元
*/ */
@JsonSerialize(using = ToStringSerializer.class) @JsonSerialize(using = ToStringSerializer.class)
@ApiModelProperty("楼栋单元") @ApiModelProperty("楼栋单元")
private Long buildId; private Long buildId;
/** /**
* 户室ID * 户室ID
*/ */
@JsonSerialize(using = ToStringSerializer.class) @JsonSerialize(using = ToStringSerializer.class)
@ApiModelProperty("户室ID") @ApiModelProperty("户室ID")
private Long roomId; private Long roomId;
/** /**
* 运营商Id * 运营商Id
*/ */
@JsonSerialize(using = ToStringSerializer.class) @JsonSerialize(using = ToStringSerializer.class)
@ApiModelProperty("运营商ID") @ApiModelProperty("运营商ID")
private Long tenantId; private Long tenantId;
/** /**
* apk版本 * apk版本
*/ */
@ApiModelProperty("apk版本") @ApiModelProperty("apk版本")
private String apkVersion; private String apkVersion;
/** /**
* 人脸库 * 人脸库
*/ */
@ApiModelProperty("人脸库") @ApiModelProperty("人脸库")
private Integer faceCount; private Integer faceCount;
/** /**
* 算法版本 * 算法版本
*/ */
@ApiModelProperty("算法版本") @ApiModelProperty("算法版本")
private String algVersion; private String algVersion;
/** /**
* cpu温度 * cpu温度
*/ */
@ApiModelProperty("cpu温度") @ApiModelProperty("cpu温度")
private String cpuTemplate; private String cpuTemplate;
/** /**
* 摄像头状态1正常2异常 * 摄像头状态1正常2异常
*/ */
@ApiModelProperty("摄像头状态") @ApiModelProperty("摄像头状态")
private Integer cameraStatus; private Integer cameraStatus;
/** /**
* 系统类型 * 系统类型
*/ */
@ApiModelProperty("系统类型") @ApiModelProperty("系统类型")
private String osType; private String osType;
/** /**
* 固件版本 * 固件版本
*/ */
@ApiModelProperty("固件版本") @ApiModelProperty("固件版本")
private String firmwareVersion; private String firmwareVersion;
/** /**
* 授权序列号 * 授权序列号
*/ */
@ApiModelProperty("授权序列号") @ApiModelProperty("授权序列号")
private String licenseSerial; private String licenseSerial;
/** /**
* 活体开关0未开1开 * 活体开关0未开1开
*/ */
@ApiModelProperty("活体开关") @ApiModelProperty("活体开关")
private Integer livenessFlag; private Integer livenessFlag;
/** /**
* rgb活体阈值 * rgb活体阈值
*/ */
@ApiModelProperty("rgb活体阈值") @ApiModelProperty("rgb活体阈值")
private Float rgbLiveThd; private Float rgbLiveThd;
/** /**
* nir活体阈值 * nir活体阈值
*/ */
@ApiModelProperty("nir活体阈值") @ApiModelProperty("nir活体阈值")
private Float nirLiveThd; private Float nirLiveThd;
/** /**
* 识别阈值 * 识别阈值
*/ */
@ApiModelProperty("识别阈值") @ApiModelProperty("识别阈值")
private Float recThd; private Float recThd;
/** /**
* 最小人脸框尺寸 * 最小人脸框尺寸
*/ */
@ApiModelProperty("最小人脸框尺寸") @ApiModelProperty("最小人脸框尺寸")
private Integer minFaceWidth; private Integer minFaceWidth;
/** /**
* 心跳周期 * 心跳周期
*/ */
@ApiModelProperty("心跳周期") @ApiModelProperty("心跳周期")
private Integer heartbeatCycle; private Integer heartbeatCycle;
/** /**
* 补光灯亮度 * 补光灯亮度
*/ */
@ApiModelProperty("补光灯亮度") @ApiModelProperty("补光灯亮度")
private Integer lightScore; private Integer lightScore;
/** /**
* 声音开关 * 声音开关
*/ */
@ApiModelProperty("声音开关") @ApiModelProperty("声音开关")
private Integer songFlag; private Integer songFlag;
/** /**
* 开门声音 * 开门声音
*/ */
@ApiModelProperty("开门声音") @ApiModelProperty("开门声音")
private String songDoor; private String songDoor;
/** /**
* 1上传0不上传 * 1上传0不上传
*/ */
@ApiModelProperty("是否上传头像") @ApiModelProperty("是否上传头像")
private Integer uploadImageFlag; private Integer uploadImageFlag;
/** /**
* 1截取人脸0原图 * 1截取人脸0原图
*/ */
@ApiModelProperty("1截取人脸0原图") @ApiModelProperty("1截取人脸0原图")
private Integer cutFaceFlag; private Integer cutFaceFlag;
/** /**
* 音视频呼叫0否1是 * 音视频呼叫0否1是
*/ */
@ApiModelProperty("音视频呼叫") @ApiModelProperty("音视频呼叫")
private Integer avCallFlag; private Integer avCallFlag;
/** /**
* 识别间隔秒 * 识别间隔秒
*/ */
@ApiModelProperty("识别间隔秒") @ApiModelProperty("识别间隔秒")
private Integer recSpace; private Integer recSpace;
/** /**
* 是否抓拍陌生人0否1是 * 是否抓拍陌生人0否1是
*/ */
@ApiModelProperty("是否抓拍陌生人") @ApiModelProperty("是否抓拍陌生人")
private Integer strangerFlag; private Integer strangerFlag;
/** /**
* 是否删除 1已删除 0正常 * 是否删除 1已删除 0正常
*/ */
@TableLogic @TableLogic
@ApiModelProperty("删除标志") @ApiModelProperty("删除标志")
private Integer deleteFlag; private Integer deleteFlag;
@TableField(exist=false) @TableField(exist = false)
@ApiModelProperty("在线状态") @ApiModelProperty("在线状态")
private Integer status = 0; private Integer status = 0;
@ApiModelProperty("门常开电平0低1高") @ApiModelProperty("门常开电平0低1高")
private Integer doorOpenLevel; private Integer doorOpenLevel;
@ApiModelProperty("锁常开电平0低1高") @ApiModelProperty("锁常开电平0低1高")
private Integer lockOpenLevel; private Integer lockOpenLevel;
@ApiModelProperty("测温补偿") @ApiModelProperty("测温补偿")
private Float temperatureUp; private Float temperatureUp;
@ApiModelProperty("告警温度") @ApiModelProperty("告警温度")
private Float temperatureAlert; private Float temperatureAlert;
@ApiModelProperty("健康码1支持0不支持") @ApiModelProperty("健康码1支持0不支持")
private Integer healthCodeFlag; private Integer healthCodeFlag;
@ApiModelProperty("识别区域")
@TableField(exist=false)
private String scope;
@ApiModelProperty("识别区域")
@TableField(exist = false)
private String scope;
@ApiModelProperty("是否同步")
private Integer xaSync;
// @TableField(exist=false) // @TableField(exist=false)

View File

@ -0,0 +1,50 @@
package net.shapelight.modules.ten.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
@Data
@TableName("ten_pack_channal")
public class TenPackChannalEntity implements Serializable {
private static final long serialVersionUID = 1L;
@TableId
@ApiModelProperty("通道ID")
private Long parkChannalId;
@ApiModelProperty("停车场ID")
private Long packId;
@ApiModelProperty("通道名称")
private String channalName;
@ApiModelProperty("通道编码")
private String channalCode;
@ApiModelProperty("通道西安编码")
private String channalCodeXa;
@ApiModelProperty("方向")
private String direction;
@ApiModelProperty("小区id")
@JsonSerialize(using = ToStringSerializer.class)
private Long cellId;
@JsonSerialize(using = ToStringSerializer.class)
private Long tenantId;
@ApiModelProperty("小区名称")
@TableField(exist=false)
private String cellName;
}

View File

@ -0,0 +1,43 @@
package net.shapelight.modules.ten.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
@Data
@TableName("ten_pack")
public class TenPackEntity implements Serializable {
private static final long serialVersionUID = 1L;
@TableId
@ApiModelProperty("ID")
private Long parkId;
@ApiModelProperty("停车场编码")
private String parkCode;
@ApiModelProperty("停车场西安对接变价")
private String parkCodeXa;
@ApiModelProperty("停车场名称")
private String parkName;
@ApiModelProperty("小区id")
@JsonSerialize(using = ToStringSerializer.class)
private Long cellId;
@ApiModelProperty("运营商id")
@JsonSerialize(using = ToStringSerializer.class)
private Long tenantId;
@ApiModelProperty("小区名称")
@TableField(exist=false)
private String cellName;
}

View File

@ -0,0 +1,65 @@
package net.shapelight.modules.ten.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
@Data
@TableName("ten_pack_record_enter")
public class TenPackRecordEnterEntity implements Serializable {
private static final long serialVersionUID = 1L;
@TableId
@ApiModelProperty("入场记录id")
private Long recordEnterId;
@ApiModelProperty("停车场编码")
private String parkCode;
@ApiModelProperty("停车场名称")
private String parkName;
@ApiModelProperty("订单号")
private String orderNumber;
@ApiModelProperty("车牌号")
private String plateNumber;
@ApiModelProperty("通道名称")
private String channelName;
@ApiModelProperty("进入时间")
private Date enterTime;
@ApiModelProperty("类型")
private Integer type;
@ApiModelProperty("车辆类型")
private Integer carType;
@ApiModelProperty("图片")
private String image;
@ApiModelProperty("小区id")
@JsonSerialize(using = ToStringSerializer.class)
private Long cellId;
@JsonSerialize(using = ToStringSerializer.class)
private Long tenantId;
private Integer xaSync;
private Integer xaSyncImage;
@ApiModelProperty("小区名称")
@TableField(exist=false)
private String cellName;
}

View File

@ -107,140 +107,141 @@ import lombok.Data;
// private Long cellId; // private Long cellId;
/** /**
* 停车记录表 * 停车记录表
*
*/ */
@Data @Data
@TableName("ten_pack_record") @TableName("ten_pack_record")
public class TenPackRecordEntity implements Serializable { public class TenPackRecordEntity implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* 记录id * 记录id
*/ */
@TableId @TableId
@ApiModelProperty("记录id") @ApiModelProperty("记录id")
private String recordId; private String recordId;
/** /**
* 车厂编号 * 车厂编号
*/ */
@TableId @TableId
@ApiModelProperty("车厂") @ApiModelProperty("车厂")
private String parkId; private String parkId;
/** /**
* 车牌号 * 车牌号
*/ */
@ApiModelProperty("车牌号") @ApiModelProperty("车牌号")
private String vlp; private String vlp;
/** /**
* 车辆类型 * 车辆类型
*/ */
@ApiModelProperty("车辆类型") @ApiModelProperty("车辆类型")
private String vTypeName; private String vTypeName;
/** /**
* 车辆类别 * 车辆类别
*/ */
@ApiModelProperty("车辆类别") @ApiModelProperty("车辆类别")
private String cTypeName; private String cTypeName;
/** /**
* 停车场名称 * 停车场名称
*/ */
@ApiModelProperty("停车场名称") @ApiModelProperty("停车场名称")
private String parkName; private String parkName;
/** /**
* 0-进场1-出场 * 0-进场1-出场
*/ */
@ApiModelProperty("0-进场1-出场") @ApiModelProperty("0-进场1-出场")
private Integer direction; private Integer direction;
/** /**
* 进场通道名称 * 进场通道名称
*/ */
@ApiModelProperty("进场通道名称") @ApiModelProperty("进场通道名称")
private String inChannelName; private String inChannelName;
/** /**
* 进场全景图 * 进场全景图
*/ */
@ApiModelProperty("进场全景图") @ApiModelProperty("进场全景图")
private String inPicture; private String inPicture;
/** /**
* 进场车牌图 * 进场车牌图
*/ */
@ApiModelProperty("进场车牌图") @ApiModelProperty("进场车牌图")
private String inPicturePlate; private String inPicturePlate;
/** /**
* 进场时间 * 进场时间
*/ */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ApiModelProperty("进场时间") @ApiModelProperty("进场时间")
private Date inTime; private Date inTime;
/** /**
* 出场通道名称 * 出场通道名称
*/ */
@ApiModelProperty("出场通道名称") @ApiModelProperty("出场通道名称")
private String outChannelName; private String outChannelName;
/** /**
* 出场全景图 * 出场全景图
*/ */
@ApiModelProperty("出场全景图") @ApiModelProperty("出场全景图")
private String outPicture; private String outPicture;
/** /**
* 出场车牌图 * 出场车牌图
*/ */
@ApiModelProperty("出场车牌图") @ApiModelProperty("出场车牌图")
private String outPicturePlate; private String outPicturePlate;
/** /**
* 出场时间 * 出场时间
*/ */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ApiModelProperty("出场时间") @ApiModelProperty("出场时间")
private Date outTime; private Date outTime;
/** /**
* 进场识别错误车牌 * 进场识别错误车牌
*/ */
@ApiModelProperty("进场识别错误车牌") @ApiModelProperty("进场识别错误车牌")
private String inVlp; private String inVlp;
/** /**
* 应收 * 应收
*/ */
@ApiModelProperty("应收") @ApiModelProperty("应收")
private String receivableFee; private String receivableFee;
/** /**
* 实收 * 实收
*/ */
@ApiModelProperty("实收") @ApiModelProperty("实收")
private String actualFee; private String actualFee;
/** /**
* 操作员 * 操作员
*/ */
@ApiModelProperty("操作员") @ApiModelProperty("操作员")
private String operator; private String operator;
/** /**
* 小区id * 小区id
*/ */
@ApiModelProperty("小区id") @ApiModelProperty("小区id")
@JsonSerialize(using = ToStringSerializer.class) @JsonSerialize(using = ToStringSerializer.class)
private Long cellId; private Long cellId;
@TableField(exist = false) @TableField(exist = false)
private String inPictureBase64; private String inPictureBase64;
@TableField(exist = false) @TableField(exist = false)
private String inPicturePlateBase64; private String inPicturePlateBase64;
@TableField(exist = false) @TableField(exist = false)
private String outPictureBase64; private String outPictureBase64;
@TableField(exist = false) @TableField(exist = false)
private String outPicturePlateBase64; private String outPicturePlateBase64;
/** /**
* 小区名称 * 小区名称
*/ */
@ApiModelProperty("小区名称") @ApiModelProperty("小区名称")
private String cellName; private String cellName;
private Integer xaSync;
@ApiModelProperty("")
private Integer xaSyncImage;
} }

View File

@ -0,0 +1,82 @@
package net.shapelight.modules.ten.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
@Data
@TableName("ten_pack_record_exit")
public class TenPackRecordExitEntity implements Serializable {
private static final long serialVersionUID = 1L;
@TableId
@ApiModelProperty("出厂记录id")
private Long recordExitId;
@ApiModelProperty("停车场编码")
private String parkCode;
@ApiModelProperty("停车场名称")
private String parkName;
@ApiModelProperty("订单编码")
private String orderNumber;
@ApiModelProperty("车牌号")
private String plateNumber;
@ApiModelProperty("通道名称")
private String channelName;
@ApiModelProperty("出场时间")
private Date exitTime;
@ApiModelProperty("停车时间")
private Long packTime;
@ApiModelProperty("类型")
private Integer type;
@ApiModelProperty("车辆类型")
private Integer carType;
@ApiModelProperty("图片")
private String image;
private Double totalAmount;
private Double paidAmount;
private Double discountAmount;
private Double outDiscAmount;
private Double outPaidAmount;
private Double inDiscAmount;
private Double inPaidAmount;
@JsonSerialize(using = ToStringSerializer.class)
private Long cellId;
@JsonSerialize(using = ToStringSerializer.class)
private Long tenantId;
private Integer xaSync;
private Integer xaSyncImage;
@ApiModelProperty("小区名称")
@TableField(exist=false)
private String cellName;
}

View File

@ -324,6 +324,14 @@ public class TenPersonEntity extends BaseEntity implements Serializable {
@TableField(exist = false) @TableField(exist = false)
private List<TenPersonExtractEntity> extractList; private List<TenPersonExtractEntity> extractList;
@ApiModelProperty("")
private Integer xaSync;
@ApiModelProperty("")
private Integer xaSyncCard;
@ApiModelProperty("")
private Integer xaSyncImage;
} }

View File

@ -15,143 +15,148 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
/** /**
*
* *
*/ */
@Data @Data
@TableName("ten_record") @TableName("ten_record")
public class TenRecordEntity implements Serializable { public class TenRecordEntity implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* 记录id * 记录id
*/ */
@TableId(type = IdType.INPUT) @TableId(type = IdType.INPUT)
@JsonSerialize(using = ToStringSerializer.class) @JsonSerialize(using = ToStringSerializer.class)
@ApiModelProperty("记录ID") @ApiModelProperty("记录ID")
private Long recordId; private Long recordId;
/** /**
* 小区id * 小区id
*/ */
@JsonSerialize(using = ToStringSerializer.class) @JsonSerialize(using = ToStringSerializer.class)
@ApiModelProperty("小区ID") @ApiModelProperty("小区ID")
private Long cellId; private Long cellId;
/** /**
* 设备sn * 设备sn
*/ */
@ApiModelProperty("设备sn") @ApiModelProperty("设备sn")
private String deviceSn; private String deviceSn;
/** /**
* 人员ID * 人员ID
*/ */
@ApiModelProperty("人员ID") @ApiModelProperty("人员ID")
@JsonSerialize(using = ToStringSerializer.class) @JsonSerialize(using = ToStringSerializer.class)
private Long personId; private Long personId;
/** /**
* 户室ID * 户室ID
*/ */
@ApiModelProperty("户室ID") @ApiModelProperty("户室ID")
@JsonSerialize(using = ToStringSerializer.class) @JsonSerialize(using = ToStringSerializer.class)
private Long roomId; private Long roomId;
/** /**
* 开门方式 * 开门方式
*/ */
@ApiModelProperty("开门方式1人脸识别2远程一键开门") @ApiModelProperty("开门方式1人脸识别2远程一键开门")
private Integer openType; private Integer openType;
/** /**
* 识别人脸 * 识别人脸
*/ */
@ApiModelProperty("识别人脸") @ApiModelProperty("识别人脸")
private String recordFace; private String recordFace;
/** /**
* 体温 * 体温
*/ */
@ApiModelProperty("体温") @ApiModelProperty("体温")
private Float template; private Float template;
/** /**
* 识别视频 * 识别视频
*/ */
@ApiModelProperty("识别视频") @ApiModelProperty("识别视频")
private String recordVideo; private String recordVideo;
/** /**
* 识别时间 * 识别时间
*/ */
@ApiModelProperty("识别时间") @ApiModelProperty("识别时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date recordTime; private Date recordTime;
/** /**
* 识别概率 * 识别概率
*/ */
@ApiModelProperty("识别概率") @ApiModelProperty("识别概率")
private Float score; private Float score;
/** /**
* 运营商ID * 运营商ID
*/ */
@ApiModelProperty("运营商ID") @ApiModelProperty("运营商ID")
private Long tenantId; private Long tenantId;
/** /**
* 识别人脸base64 * 识别人脸base64
*/ */
@ApiModelProperty("识别人脸base64") @ApiModelProperty("识别人脸base64")
private String recordFaceStr; private String recordFaceStr;
/** /**
* 开门卡号 * 开门卡号
*/ */
@ApiModelProperty("开门卡号") @ApiModelProperty("开门卡号")
private String doorCard; private String doorCard;
/** /**
* 开门密码 * 开门密码
*/ */
@ApiModelProperty("开门密码") @ApiModelProperty("开门密码")
private String doorPassword; private String doorPassword;
/** /**
* 设备名称 * 设备名称
*/ */
@ApiModelProperty("设备名称") @ApiModelProperty("设备名称")
@TableField(exist=false) @TableField(exist = false)
private String deviceName; private String deviceName;
/** /**
* 设备出入口 * 设备出入口
*/ */
@ApiModelProperty("设备出入口0进1出") @ApiModelProperty("设备出入口0进1出")
@TableField(exist=false) @TableField(exist = false)
private Integer gateFlag; private Integer gateFlag;
/** /**
* 人员姓名 * 人员姓名
*/ */
// @ApiModelProperty("人员姓名") // @ApiModelProperty("人员姓名")
// @TableField(exist=false) // @TableField(exist=false)
// private String personName; // private String personName;
/** /**
* 手机号 * 手机号
*/ */
// @ApiModelProperty("手机号") // @ApiModelProperty("手机号")
// @TableField(exist=false) // @TableField(exist=false)
// private String mobile; // private String mobile;
/** /**
* 原始照片 * 原始照片
*/ */
// @ApiModelProperty("原始照片") // @ApiModelProperty("原始照片")
// @TableField(exist=false) // @TableField(exist=false)
// private String orgImage; // private String orgImage;
/** /**
* 人员信息 * 人员信息
*/ */
@ApiModelProperty("人员信息") @ApiModelProperty("人员信息")
@TableField(exist=false) @TableField(exist = false)
private TenPersonEntity person; private TenPersonEntity person;
/** /**
* 人员ID * 人员ID
*/ */
@ApiModelProperty("人员ID") @ApiModelProperty("人员ID")
@TableField(exist=false) @TableField(exist = false)
private Integer memberId; private Integer memberId;
@ApiModelProperty("")
private Integer xaSync;
@ApiModelProperty("")
private Integer xaSyncImage;
} }

View File

@ -13,124 +13,132 @@ import net.shapelight.common.base.BaseEntity;
/** /**
* 户室表 * 户室表
*
*/ */
@Data @Data
@TableName("ten_room") @TableName("ten_room")
public class TenRoomEntity extends BaseEntity implements Serializable { public class TenRoomEntity extends BaseEntity implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
/** /**
* ID * ID
*/ */
@TableId(type = IdType.INPUT) @TableId(type = IdType.INPUT)
@JsonSerialize(using = ToStringSerializer.class) @JsonSerialize(using = ToStringSerializer.class)
@ApiModelProperty("户室ID") @ApiModelProperty("户室ID")
private Long roomId; private Long roomId;
/** /**
* 楼栋ID * 楼栋ID
*/ */
@ApiModelProperty("楼栋ID") @ApiModelProperty("楼栋ID")
@JsonSerialize(using = ToStringSerializer.class) @JsonSerialize(using = ToStringSerializer.class)
private Long buildId; private Long buildId;
/** /**
* 小区ID * 小区ID
*/ */
@ApiModelProperty("小区ID") @ApiModelProperty("小区ID")
@JsonSerialize(using = ToStringSerializer.class) @JsonSerialize(using = ToStringSerializer.class)
private Long cellId; private Long cellId;
/** /**
* 房间号 * 房间号
*/ */
@ApiModelProperty("房间号") @ApiModelProperty("房间号")
private Integer roomNumber; private Integer roomNumber;
/** /**
* 房间名称 * 房间名称
*/ */
@ApiModelProperty("房间名称") @ApiModelProperty("房间名称")
private String roomName; private String roomName;
/** /**
* 所在楼层 * 所在楼层
*/ */
@ApiModelProperty("楼层") @ApiModelProperty("楼层")
private Integer layer; private Integer layer;
/** /**
* 面积 * 面积
*/ */
@ApiModelProperty("面积") @ApiModelProperty("面积")
private String area; private String area;
/** /**
* 类型:自住出租 * 类型:自住出租
*/ */
@ApiModelProperty("类型:自住,出租") @ApiModelProperty("类型:自住,出租")
private Integer type; private Integer type;
/** /**
* 房间人数 * 房间人数
*/ */
@ApiModelProperty("房间人数") @ApiModelProperty("房间人数")
private Integer personCount; private Integer personCount;
/** /**
* 门禁密码 * 门禁密码
*/ */
@ApiModelProperty("门禁密码") @ApiModelProperty("门禁密码")
private String roomPassword; private String roomPassword;
/** /**
* 几室 * 几室
*/ */
@ApiModelProperty("几室") @ApiModelProperty("几室")
private Integer roomCount; private Integer roomCount;
/** /**
* 几厅 * 几厅
*/ */
@ApiModelProperty("几厅") @ApiModelProperty("几厅")
private Integer livingCount; private Integer livingCount;
/** /**
* 几厨 * 几厨
*/ */
@ApiModelProperty("几厨") @ApiModelProperty("几厨")
private Integer kitchenCount; private Integer kitchenCount;
/** /**
* 几卫 * 几卫
*/ */
@ApiModelProperty("几卫") @ApiModelProperty("几卫")
private Integer bathCount; private Integer bathCount;
/** /**
* 几阳台 * 几阳台
*/ */
@ApiModelProperty("几阳台") @ApiModelProperty("几阳台")
private Integer balconyCount; private Integer balconyCount;
/** /**
* 房间照片 * 房间照片
*/ */
@ApiModelProperty("房间照片") @ApiModelProperty("房间照片")
private String picture; private String picture;
/** /**
* 备注 * 备注
*/ */
@ApiModelProperty("备注") @ApiModelProperty("备注")
private String remark; private String remark;
/** /**
* 0未删除1删除 * 0未删除1删除
*/ */
@TableLogic @TableLogic
@ApiModelProperty("0未删除1删除") @ApiModelProperty("0未删除1删除")
private Integer deleteFlag; private Integer deleteFlag;
/** /**
* 运营商ID * 运营商ID
*/ */
@ApiModelProperty("运营商ID") @ApiModelProperty("运营商ID")
private Long tenantId; private Long tenantId;
@TableField(exist=false) @TableField(exist = false)
@ApiModelProperty("楼栋名称") @ApiModelProperty("楼栋名称")
private String buildName; private String buildName;
@TableField(exist=false) @TableField(exist = false)
@ApiModelProperty("楼栋单元") @ApiModelProperty("楼栋单元")
private String buildUnit; private String buildUnit;
@TableField(exist=false) @TableField(exist = false)
@ApiModelProperty("小区名称") @ApiModelProperty("小区名称")
private String cellName; private String cellName;
@ApiModelProperty("是否同步")
private Integer xaSync;
@ApiModelProperty("地址序号")
private String pId;
@ApiModelProperty("地址编码")
private String dzbm;
} }

View File

@ -1,7 +1,6 @@
package net.shapelight.modules.ten.service; package net.shapelight.modules.ten.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import io.swagger.models.auth.In;
import net.shapelight.common.utils.PageUtils; import net.shapelight.common.utils.PageUtils;
import net.shapelight.modules.ten.entity.TenDeviceAlertEntity; import net.shapelight.modules.ten.entity.TenDeviceAlertEntity;
import net.shapelight.modules.ten.entity.TenDeviceEntity; import net.shapelight.modules.ten.entity.TenDeviceEntity;
@ -10,7 +9,6 @@ import net.shapelight.modules.ten.entity.TenRecordEntity;
import net.shapelight.modules.vo.TenDeviceVo; import net.shapelight.modules.vo.TenDeviceVo;
import net.shapelight.modules.vo.TenPersonIdUpdateVo; import net.shapelight.modules.vo.TenPersonIdUpdateVo;
import net.shapelight.modules.vo.TenPersonVo; import net.shapelight.modules.vo.TenPersonVo;
import org.springframework.cache.annotation.CacheEvict;
import java.io.Serializable; import java.io.Serializable;
import java.util.Collection; import java.util.Collection;
@ -57,7 +55,7 @@ public interface TenDeviceService extends IService<TenDeviceEntity> {
boolean evictRemoveByIds(Collection<? extends Serializable> idList); boolean evictRemoveByIds(Collection<? extends Serializable> idList);
public boolean evictRemoveByCellIds(Long[] idList); boolean evictRemoveByCellIds(Long[] idList);
int getDeviceCount(Map<String, Object> params); int getDeviceCount(Map<String, Object> params);
@ -67,7 +65,7 @@ public interface TenDeviceService extends IService<TenDeviceEntity> {
void evictupdateById(TenDeviceEntity tenDevice); void evictupdateById(TenDeviceEntity tenDevice);
List<TenDeviceEntity> getNotSync(Long paramLong);
} }

View File

@ -0,0 +1,10 @@
package net.shapelight.modules.ten.service;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.Map;
import net.shapelight.common.utils.PageUtils;
import net.shapelight.modules.ten.entity.TenPackChannalEntity;
public interface TenPackChannalService extends IService<TenPackChannalEntity> {
PageUtils queryPage(Map<String, Object> paramMap);
}

View File

@ -0,0 +1,12 @@
package net.shapelight.modules.ten.service;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.Map;
import net.shapelight.common.utils.PageUtils;
import net.shapelight.modules.ten.entity.TenPackRecordEnterEntity;
public interface TenPackRecordEnterService extends IService<TenPackRecordEnterEntity> {
PageUtils queryPage(Map<String, Object> paramMap);
}

View File

@ -0,0 +1,12 @@
package net.shapelight.modules.ten.service;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.Map;
import net.shapelight.common.utils.PageUtils;
import net.shapelight.modules.ten.entity.TenPackRecordExitEntity;
public interface TenPackRecordExitService extends IService<TenPackRecordExitEntity> {
PageUtils queryPage(Map<String, Object> paramMap);
}

View File

@ -28,5 +28,9 @@ public interface TenPackRecordService {
boolean saveOrUpdateByRecordId(TenPackRecordEntity entity); boolean saveOrUpdateByRecordId(TenPackRecordEntity entity);
List<TenPackRecordEntity> getNotSync(Long paramLong);
List<TenPackRecordEntity> getNotSyncImage(Long paramLong);
} }

View File

@ -0,0 +1,11 @@
package net.shapelight.modules.ten.service;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.Map;
import net.shapelight.common.utils.PageUtils;
import net.shapelight.modules.ten.entity.TenPackEntity;
public interface TenPackService extends IService<TenPackEntity> {
PageUtils queryPage(Map<String, Object> paramMap);
}

View File

@ -110,6 +110,14 @@ public interface TenPersonService {
List<TenPersonEntity> getAllExpireGuest(); List<TenPersonEntity> getAllExpireGuest();
TenPersonEntity getOwner(Long paramLong);
List<TenPersonEntity> getNotSync(Long paramLong);
List<TenPersonEntity> getNotSyncCard(Long paramLong);
List<TenPersonEntity> getNotSyncImage(Long paramLong);
} }

View File

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

View File

@ -9,7 +9,6 @@ import java.util.Map;
/** /**
* 户室表 * 户室表
*
*/ */
public interface TenRoomService { public interface TenRoomService {
@ -17,15 +16,17 @@ public interface TenRoomService {
boolean save(TenRoomEntity entity); boolean save(TenRoomEntity entity);
boolean removeById(Long roomId,Long cellId); boolean removeById(Long roomId, Long cellId);
boolean removeByBuildId(Long build,Long cellId);
boolean removeByBuildId(Long build, Long cellId);
boolean removeByCellId(Long cellId); boolean removeByCellId(Long cellId);
boolean removeByIdList(List<Map<String,String>> roomIdList); boolean removeByIdList(List<Map<String, String>> roomIdList);
boolean updateById(TenRoomEntity entity); boolean updateById(TenRoomEntity entity);
TenRoomEntity getById(Long id,Long cellId); TenRoomEntity getById(Long id, Long cellId);
TenRoomEntity queryByNumberAndLayer(Integer roomNumber, TenRoomEntity queryByNumberAndLayer(Integer roomNumber,
Integer layer, Integer layer,
@ -33,18 +34,19 @@ public interface TenRoomService {
Long cellId); Long cellId);
List<TenRoomEntity> getLayerRooms(Integer layer, List<TenRoomEntity> getLayerRooms(Integer layer,
Long buildId, Long buildId,
Long cellId); Long cellId);
String getRoomName(Long id, Long cellId); String getRoomName(Long id, Long cellId);
TenRoomEntity findByRoomName(String roomName, TenRoomEntity findByRoomName(String roomName,
Long buildId, Long buildId,
Long cellId); Long cellId);
int getAllCount(Map params); int getAllCount(Map params);
List<TenRoomEntity> getNotSync(Long paramLong);
} }

View File

@ -2,8 +2,6 @@ package net.shapelight.modules.ten.service.impl;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.shapelight.common.utils.*; import net.shapelight.common.utils.*;
//import net.shapelight.modules.dev.mqtt.CmdProcess;
//import net.shapelight.modules.dev.mqtt.EmqHttpApi;
import net.shapelight.modules.nettyapi.service.DeviceApiService; import net.shapelight.modules.nettyapi.service.DeviceApiService;
import net.shapelight.modules.nettyapi.service.ServerApiService; import net.shapelight.modules.nettyapi.service.ServerApiService;
import net.shapelight.modules.ten.entity.*; import net.shapelight.modules.ten.entity.*;
@ -45,8 +43,6 @@ public class TenDeviceServiceImpl extends ServiceImpl<TenDeviceDao, TenDeviceEnt
@Autowired @Autowired
private TenRoomService tenRoomService; private TenRoomService tenRoomService;
@Autowired @Autowired
private TenDeviceDao tenDeviceDao;
@Autowired
private TenPersonService tenPersonService; private TenPersonService tenPersonService;
@Autowired @Autowired
private TenRecordService tenRecordService; private TenRecordService tenRecordService;
@ -197,7 +193,7 @@ public class TenDeviceServiceImpl extends ServiceImpl<TenDeviceDao, TenDeviceEnt
@Override @Override
public List<String> findAllSn() { public List<String> findAllSn() {
return tenDeviceDao.findAllSn(); return baseMapper.findAllSn();
} }
@Override @Override
@ -267,6 +263,12 @@ public class TenDeviceServiceImpl extends ServiceImpl<TenDeviceDao, TenDeviceEnt
@CacheEvict(value="TenDevice",allEntries = true) @CacheEvict(value="TenDevice",allEntries = true)
public boolean evictRemoveByIds(Collection<? extends Serializable> idList) { public boolean evictRemoveByIds(Collection<? extends Serializable> idList) {
//删除同步人员
for(Long devId: (List<Long>)idList){
TenDeviceEntity deviceEntity = this.getById(devId);
tenPersonSyncService.removeByDeviceId(devId,deviceEntity.getTenantId());
}
return removeByIds(idList); return removeByIds(idList);
} }
@ -349,4 +351,11 @@ public class TenDeviceServiceImpl extends ServiceImpl<TenDeviceDao, TenDeviceEnt
public void evictupdateById(TenDeviceEntity tenDevice) { public void evictupdateById(TenDeviceEntity tenDevice) {
this.updateById(tenDevice); this.updateById(tenDevice);
} }
public List<TenDeviceEntity> getNotSync(Long cellId) {
return list(new QueryWrapper<TenDeviceEntity>()
.eq("cell_id", cellId)
.eq("xa_sync", 0)
.eq("delete_flag", 0));
}
} }

View File

@ -0,0 +1,60 @@
package net.shapelight.modules.ten.service.impl;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import net.shapelight.common.utils.PageUtils;
import net.shapelight.common.utils.Query;
import net.shapelight.modules.ten.dao.TenPackChannalDao;
import net.shapelight.modules.ten.entity.TenCellEntity;
import net.shapelight.modules.ten.entity.TenPackChannalEntity;
import net.shapelight.modules.ten.entity.TenPackEntity;
import net.shapelight.modules.ten.service.TenCellService;
import net.shapelight.modules.ten.service.TenPackChannalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service("tenPackChannalService")
public class TenPackChannalServiceImpl extends ServiceImpl<TenPackChannalDao, TenPackChannalEntity> implements TenPackChannalService {
@Autowired
private TenCellService tenCellService;
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()){
Long cellLong = Long.parseLong(cellId);
cellIds.add(cellLong);
}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);
}
IPage<TenPackChannalEntity> page = this.page(
new Query<TenPackChannalEntity>().getPage(params),
new QueryWrapper<TenPackChannalEntity>()
.eq("tenant_id",params.get("tenantId"))
.in("cell_id",cellIds)
);
for(TenPackChannalEntity entity: page.getRecords()){
TenCellEntity cell = tenCellService.getById(entity.getCellId());
entity.setCellName(cell.getName());
}
return new PageUtils(page);
}
}

View File

@ -0,0 +1,58 @@
package net.shapelight.modules.ten.service.impl;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import net.shapelight.common.utils.PageUtils;
import net.shapelight.common.utils.Query;
import net.shapelight.modules.ten.dao.TenPackRecordEnterDao;
import net.shapelight.modules.ten.entity.TenCellEntity;
import net.shapelight.modules.ten.entity.TenPackChannalEntity;
import net.shapelight.modules.ten.entity.TenPackRecordEnterEntity;
import net.shapelight.modules.ten.service.TenCellService;
import net.shapelight.modules.ten.service.TenPackRecordEnterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service("tenPackRecordEnterService")
public class TenPackRecordEnterServiceImpl extends ServiceImpl<TenPackRecordEnterDao, TenPackRecordEnterEntity> implements TenPackRecordEnterService {
@Autowired
private TenCellService tenCellService;
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()){
Long cellLong = Long.parseLong(cellId);
cellIds.add(cellLong);
}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);
}
IPage<TenPackRecordEnterEntity> page = this.page(
new Query<TenPackRecordEnterEntity>().getPage(params),
new QueryWrapper<TenPackRecordEnterEntity>()
.eq("tenant_id",params.get("tenantId"))
.in("cell_id",cellIds)
);
for(TenPackRecordEnterEntity entity: page.getRecords()){
TenCellEntity cell = tenCellService.getById(entity.getCellId());
entity.setCellName(cell.getName());
}
return new PageUtils(page);
}
}

View File

@ -0,0 +1,58 @@
package net.shapelight.modules.ten.service.impl;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import net.shapelight.common.utils.PageUtils;
import net.shapelight.common.utils.Query;
import net.shapelight.modules.ten.dao.TenPackRecordExitDao;
import net.shapelight.modules.ten.entity.TenCellEntity;
import net.shapelight.modules.ten.entity.TenPackRecordEnterEntity;
import net.shapelight.modules.ten.entity.TenPackRecordExitEntity;
import net.shapelight.modules.ten.service.TenCellService;
import net.shapelight.modules.ten.service.TenPackRecordExitService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service("tenPackRecordExitService")
public class TenPackRecordExitServiceImpl extends ServiceImpl<TenPackRecordExitDao, TenPackRecordExitEntity> implements TenPackRecordExitService {
@Autowired
private TenCellService tenCellService;
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()){
Long cellLong = Long.parseLong(cellId);
cellIds.add(cellLong);
}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);
}
IPage<TenPackRecordExitEntity> page = this.page(
new Query<TenPackRecordExitEntity>().getPage(params),
new QueryWrapper<TenPackRecordExitEntity>()
.eq("tenant_id",params.get("tenantId"))
.in("cell_id",cellIds)
);
for(TenPackRecordExitEntity entity: page.getRecords()){
TenCellEntity cell = tenCellService.getById(entity.getCellId());
entity.setCellName(cell.getName());
}
return new PageUtils(page);
}
}

View File

@ -213,6 +213,14 @@ public class TenPackRecordServiceImpl implements TenPackRecordService {
} }
return new PageUtils(page); return new PageUtils(page);
} }
@Override
public List<TenPackRecordEntity> getNotSync(Long cellId) {
return this.tenPackRecordDao.getNotSync(cellId);
}
@Override
public List<TenPackRecordEntity> getNotSyncImage(Long cellId) {
return this.tenPackRecordDao.getNotSyncImage(cellId);
}
} }

View File

@ -0,0 +1,60 @@
package net.shapelight.modules.ten.service.impl;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import net.shapelight.common.utils.PageUtils;
import net.shapelight.common.utils.Query;
import net.shapelight.modules.ten.dao.TenPackDao;
import net.shapelight.modules.ten.entity.TenCellEntity;
import net.shapelight.modules.ten.entity.TenDeviceEntity;
import net.shapelight.modules.ten.entity.TenPackEntity;
import net.shapelight.modules.ten.service.TenCellService;
import net.shapelight.modules.ten.service.TenPackService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service("tenPackService")
public class TenPackServiceImpl extends ServiceImpl<TenPackDao, TenPackEntity> implements TenPackService {
@Autowired
private TenCellService tenCellService;
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()){
Long cellLong = Long.parseLong(cellId);
cellIds.add(cellLong);
}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);
}
IPage<TenPackEntity> page = this.page(
new Query<TenPackEntity>().getPage(params),
new QueryWrapper<TenPackEntity>()
.eq("tenant_id",params.get("tenantId"))
.in("cell_id",cellIds)
);
for(TenPackEntity tenPackEntity: page.getRecords()){
TenCellEntity cell = tenCellService.getById(tenPackEntity.getCellId());
tenPackEntity.setCellName(cell.getName());
}
return new PageUtils(page);
}
}

View File

@ -121,15 +121,15 @@ public class TenPersonServiceImpl implements TenPersonService {
pageParam.setCurrent(Long.parseLong((String) params.get("page"))); pageParam.setCurrent(Long.parseLong((String) params.get("page")));
pageParam.setSize(Long.parseLong((String) params.get("limit"))); pageParam.setSize(Long.parseLong((String) params.get("limit")));
IPage<TenPersonEntity> page = tenPersonDao.findPageAll(pageParam, cellIds, params); IPage<TenPersonEntity> page = tenPersonDao.findPageAll(pageParam, cellIds, params);
for(TenPersonEntity personEntity: page.getRecords()){ for (TenPersonEntity personEntity : page.getRecords()) {
List<TenPersonExtractEntity> extracts = tenPersonExtractService.list( List<TenPersonExtractEntity> extracts = tenPersonExtractService.list(
new QueryWrapper<TenPersonExtractEntity>() new QueryWrapper<TenPersonExtractEntity>()
.eq("person_id",personEntity.getPersonId()) .eq("person_id", personEntity.getPersonId())
); );
if(extracts!=null){ if (extracts != null) {
personEntity.setExtractCount(extracts.size()); personEntity.setExtractCount(extracts.size());
personEntity.setExtractList(extracts); personEntity.setExtractList(extracts);
}else{ } else {
personEntity.setExtractCount(0); personEntity.setExtractCount(0);
personEntity.setExtractList(new ArrayList<>()); personEntity.setExtractList(new ArrayList<>());
} }
@ -332,7 +332,7 @@ public class TenPersonServiceImpl implements TenPersonService {
} }
String password = entity.getPassword(); String password = entity.getPassword();
entity.setPassword(""); entity.setPassword("");
Date now = new Date(); Date now = new Date();
entity.setCreateTime(now); entity.setCreateTime(now);
entity.setLastUpdateTime(now); entity.setLastUpdateTime(now);
@ -414,7 +414,7 @@ public class TenPersonServiceImpl implements TenPersonService {
//发送设备通知 //发送设备通知
List<TenDeviceVo> devList = tenDeviceService.findByCellId(entity.getCellId()); List<TenDeviceVo> devList = tenDeviceService.findByCellId(entity.getCellId());
//状态是0正常发送推送 //状态是0正常发送推送
if(entity.getStatus().intValue() == Constant.PESON_SUATUS_NOMOR){ if (entity.getStatus().intValue() == Constant.PESON_SUATUS_NOMOR) {
for (TenDeviceVo dev : devList) { for (TenDeviceVo dev : devList) {
//添加到同步表下发设备通知 //添加到同步表下发设备通知
TenPersonSyncEntity syncEntity = new TenPersonSyncEntity(); TenPersonSyncEntity syncEntity = new TenPersonSyncEntity();
@ -433,7 +433,7 @@ public class TenPersonServiceImpl implements TenPersonService {
vo.setOperation(1); vo.setOperation(1);
vo.setLast_update_stamp(syncEntity.getLastUpdateTime()); vo.setLast_update_stamp(syncEntity.getLastUpdateTime());
list.add(vo); list.add(vo);
serverApiService.personOperation(dev.getSn(),list); serverApiService.personOperation(dev.getSn(), list);
} }
} }
return 0; return 0;
@ -618,7 +618,7 @@ public class TenPersonServiceImpl implements TenPersonService {
//发送设备通知 //发送设备通知
List<TenDeviceVo> devList = tenDeviceService.findByCellId(entity.getCellId()); List<TenDeviceVo> devList = tenDeviceService.findByCellId(entity.getCellId());
//状态是0正常发送推送 //状态是0正常发送推送
if(entity.getStatus().intValue() == Constant.PESON_SUATUS_NOMOR){ if (entity.getStatus().intValue() == Constant.PESON_SUATUS_NOMOR) {
for (TenDeviceVo dev : devList) { for (TenDeviceVo dev : devList) {
//添加到同步表下发设备通知 //添加到同步表下发设备通知
TenPersonSyncEntity syncEntity = new TenPersonSyncEntity(); TenPersonSyncEntity syncEntity = new TenPersonSyncEntity();
@ -637,7 +637,7 @@ public class TenPersonServiceImpl implements TenPersonService {
vo.setOperation(1); vo.setOperation(1);
vo.setLast_update_stamp(syncEntity.getLastUpdateTime()); vo.setLast_update_stamp(syncEntity.getLastUpdateTime());
list.add(vo); list.add(vo);
serverApiService.personOperation(dev.getSn(),list); serverApiService.personOperation(dev.getSn(), list);
} }
} }
return true; return true;
@ -700,25 +700,28 @@ public class TenPersonServiceImpl implements TenPersonService {
//配置同步信息并推送 //配置同步信息并推送
List<Map<String,String>> snPersonsList = tenPersonSyncService.findGroupDevicePersons(personIds,tenantId); List<Map<String, String>> snPersonsList = tenPersonSyncService.findGroupDevicePersons(personIds, tenantId);
for(Map<String,String> snPersons: snPersonsList){ for (Map<String, String> snPersons : snPersonsList) {
String sn = snPersons.get("deviceSn"); String sn = snPersons.get("deviceSn");
TenDeviceEntity deviceEntity = tenDeviceService.findBySn(sn); TenDeviceEntity deviceEntity = tenDeviceService.findBySn(sn);
if(deviceEntity==null){
continue;
}
String[] persons = snPersons.get("plist").split(","); String[] persons = snPersons.get("plist").split(",");
List<TenPersonOperationVo> list = new ArrayList<>(); List<TenPersonOperationVo> list = new ArrayList<>();
for(String personStr: persons){ for (String personStr : persons) {
String[] personInfoStr = personStr.split("_"); String[] personInfoStr = personStr.split("_");
Long personId = Long.parseLong(personInfoStr[0]); Long personId = Long.parseLong(personInfoStr[0]);
Date lastUpdateTime = DateUtils.stringToDate(personInfoStr[1],DateUtils.DATE_TIME_PATTERN); Date lastUpdateTime = DateUtils.stringToDate(personInfoStr[1], DateUtils.DATE_TIME_PATTERN);
TenPersonSyncEntity syncEntity = tenPersonSyncService.findByDeviceIdAndPersonId(deviceEntity.getDeviceId(),personId,tenantId); TenPersonSyncEntity syncEntity = tenPersonSyncService.findByDeviceIdAndPersonId(deviceEntity.getDeviceId(), personId, tenantId);
syncEntity.setLastUpdateTime(lastUpdateTime); syncEntity.setLastUpdateTime(lastUpdateTime);
syncEntity.setState(Constant.PERSON_SYNC_DELETE); syncEntity.setState(Constant.PERSON_SYNC_DELETE);
tenPersonSyncService.updateById(syncEntity); tenPersonSyncService.updateById(syncEntity);
} }
//下发通知 //下发通知
List<TenPersonSyncEntity> allDelete = tenPersonSyncService.findDeviceAllDeletePersons(deviceEntity.getDeviceId(),deviceEntity.getTenantId()); List<TenPersonSyncEntity> allDelete = tenPersonSyncService.findDeviceAllDeletePersons(deviceEntity.getDeviceId(), deviceEntity.getTenantId());
for(TenPersonSyncEntity syncEntity: allDelete){ for (TenPersonSyncEntity syncEntity : allDelete) {
TenPersonOperationVo vo = new TenPersonOperationVo(); TenPersonOperationVo vo = new TenPersonOperationVo();
vo.setUid(syncEntity.getPersonId()); vo.setUid(syncEntity.getPersonId());
vo.setOperation(Constant.PERSON_SYNC_DELETE); vo.setOperation(Constant.PERSON_SYNC_DELETE);
@ -726,10 +729,10 @@ public class TenPersonServiceImpl implements TenPersonService {
list.add(vo); list.add(vo);
} }
int flag = serverApiService.personOperation(sn,list); int flag = serverApiService.personOperation(sn, list);
if(flag == 0){ if (flag == 0) {
//下发成功删除状态为删除的同步人员 //下发成功删除状态为删除的同步人员
tenPersonSyncService.removeAllDeletePersons(deviceEntity.getDeviceId(),tenantId); tenPersonSyncService.removeAllDeletePersons(deviceEntity.getDeviceId(), tenantId);
} }
} }
return true; return true;
@ -763,10 +766,10 @@ public class TenPersonServiceImpl implements TenPersonService {
} }
//下发设备通知 //下发设备通知
List<TenDeviceVo> devList = tenDeviceService.findByCellId(cellId); List<TenDeviceVo> devList = tenDeviceService.findByCellId(cellId);
for(TenDeviceVo deviceVo: devList){ for (TenDeviceVo deviceVo : devList) {
List<TenPersonSyncEntity> operationList = tenPersonSyncService.findDeviceAllAddPersons(deviceVo.getDeviceId(),deviceVo.getTenantId()); List<TenPersonSyncEntity> operationList = tenPersonSyncService.findDeviceAllAddPersons(deviceVo.getDeviceId(), deviceVo.getTenantId());
List<TenPersonOperationVo> voList = new ArrayList<>(); List<TenPersonOperationVo> voList = new ArrayList<>();
for(TenPersonSyncEntity syncEntity: operationList){ for (TenPersonSyncEntity syncEntity : operationList) {
TenPersonOperationVo vo = new TenPersonOperationVo(); TenPersonOperationVo vo = new TenPersonOperationVo();
vo.setUid(syncEntity.getPersonId()); vo.setUid(syncEntity.getPersonId());
vo.setOperation(syncEntity.getState()); vo.setOperation(syncEntity.getState());
@ -774,24 +777,21 @@ public class TenPersonServiceImpl implements TenPersonService {
voList.add(vo); voList.add(vo);
} }
int flag = serverApiService.personOperation(deviceVo.getSn(),voList); int flag = serverApiService.personOperation(deviceVo.getSn(), voList);
if(flag == 0){ if (flag == 0) {
//下发成功删除状态为删除的同步人员 //下发成功删除状态为删除的同步人员
// tenPersonSyncService.removeAllDeletePersons(deviceEntity.getDeviceId(),tenantId); // tenPersonSyncService.removeAllDeletePersons(deviceEntity.getDeviceId(),tenantId);
} }
} }
return true; return true;
} }
@Override @Override
@CacheEvict(value = "TenPerson", key = "#entity.personId+'-'+#entity.cellId") @CacheEvict(value = "TenPerson", key = "#entity.personId+'-'+#entity.cellId")
public String updateById(TenPersonEntity entity) { public String updateById(TenPersonEntity entity) {
if(entity.getUsername()!=null && entity.getUsername().isEmpty()){ if (entity.getUsername() != null && entity.getUsername().isEmpty()) {
entity.setUsername(null); entity.setUsername(null);
} }
@ -1026,21 +1026,21 @@ public class TenPersonServiceImpl implements TenPersonService {
//现在不支持删除app用户判断是否是管理员 //现在不支持删除app用户判断是否是管理员
AppUserEntity uEntity = appUserService.findByMobile(oldPerson.getMobile()); AppUserEntity uEntity = appUserService.findByMobile(oldPerson.getMobile());
List<AppUserScopeEntity> scopes = appUserScopeService.list(new QueryWrapper<AppUserScopeEntity>() List<AppUserScopeEntity> scopes = appUserScopeService.list(new QueryWrapper<AppUserScopeEntity>()
.eq("user_id",uEntity.getUserId())); .eq("user_id", uEntity.getUserId()));
if(scopes.size()>1){ if (scopes.size() > 1) {
for(AppUserScopeEntity scopeEntity: scopes){ for (AppUserScopeEntity scopeEntity : scopes) {
if(scopeEntity.getPersonId()!=null if (scopeEntity.getPersonId() != null
&& scopeEntity.getPersonId().longValue() == entity.getPersonId().longValue()){ && scopeEntity.getPersonId().longValue() == entity.getPersonId().longValue()) {
appUserScopeService.removeById(scopeEntity); appUserScopeService.removeById(scopeEntity);
break; break;
} }
} }
List<AppUserScopeEntity> scopesNew = appUserScopeService.list(new QueryWrapper<AppUserScopeEntity>() List<AppUserScopeEntity> scopesNew = appUserScopeService.list(new QueryWrapper<AppUserScopeEntity>()
.eq("user_id",uEntity.getUserId())); .eq("user_id", uEntity.getUserId()));
AppUserScopeEntity newScope = scopesNew.get(0); AppUserScopeEntity newScope = scopesNew.get(0);
uEntity.setCurrentScopeId(newScope.getUserScopeId()); uEntity.setCurrentScopeId(newScope.getUserScopeId());
appUserService.updateById(uEntity); appUserService.updateById(uEntity);
}else{ } else {
appUserService.removeById(uEntity); appUserService.removeById(uEntity);
appUserScopeService.remove(new QueryWrapper<AppUserScopeEntity>() appUserScopeService.remove(new QueryWrapper<AppUserScopeEntity>()
.eq("user_id", uEntity.getUserId())); .eq("user_id", uEntity.getUserId()));
@ -1049,7 +1049,7 @@ public class TenPersonServiceImpl implements TenPersonService {
} else { //以前不支持app现在支持app登录 } else { //以前不支持app现在支持app登录
if (entity.getAppFlag() == Constant.APP_LOGIN_YES) { if (entity.getAppFlag() == Constant.APP_LOGIN_YES) {
//默认密码123456 //默认密码123456
if(entity.getPassword()==null || entity.getPassword().length()==0){ if (entity.getPassword() == null || entity.getPassword().length() == 0) {
entity.setPassword("123456"); entity.setPassword("123456");
} }
//1.验证用户名 //1.验证用户名
@ -1096,9 +1096,9 @@ public class TenPersonServiceImpl implements TenPersonService {
.eq("person_id", entity.getPersonId())); .eq("person_id", entity.getPersonId()));
if (oldCard != null) { if (oldCard != null) {
//修改 卡号为空删除记录 //修改 卡号为空删除记录
if (entity.getDoorCardEntity().getDoorCard()==null || entity.getDoorCardEntity().getDoorCard().isEmpty()){ if (entity.getDoorCardEntity().getDoorCard() == null || entity.getDoorCardEntity().getDoorCard().isEmpty()) {
tenDoorCardService.removeById(oldCard); tenDoorCardService.removeById(oldCard);
}else{ } else {
//修改 //修改
if (!entity.getDoorCardEntity().getDoorCard().equals(oldCard.getDoorCard())) { if (!entity.getDoorCardEntity().getDoorCard().equals(oldCard.getDoorCard())) {
TenDoorCardEntity newCard = tenDoorCardService.getOne(new QueryWrapper<TenDoorCardEntity>() TenDoorCardEntity newCard = tenDoorCardService.getOne(new QueryWrapper<TenDoorCardEntity>()
@ -1106,19 +1106,19 @@ public class TenPersonServiceImpl implements TenPersonService {
if (newCard != null) { if (newCard != null) {
return "卡号已经使用"; return "卡号已经使用";
} else { } else {
if (entity.getDoorCardEntity().getValidBegin()==null) { if (entity.getDoorCardEntity().getValidBegin() == null) {
oldCard.setValidBegin(new Date()); oldCard.setValidBegin(new Date());
}else{ } else {
oldCard.setValidBegin(entity.getDoorCardEntity().getValidBegin()); oldCard.setValidBegin(entity.getDoorCardEntity().getValidBegin());
} }
if (entity.getDoorCardEntity().getValidEnd()==null) { if (entity.getDoorCardEntity().getValidEnd() == null) {
Date date = new Date(); Date date = new Date();
Calendar cal = Calendar.getInstance(); Calendar cal = Calendar.getInstance();
cal.setTime(date);//设置起时间 cal.setTime(date);//设置起时间
cal.add(Calendar.YEAR, 10);//增加一年 cal.add(Calendar.YEAR, 10);//增加一年
// System.out.println("输出::"+cal.getTime()); // System.out.println("输出::"+cal.getTime());
oldCard.setValidEnd(cal.getTime()); oldCard.setValidEnd(cal.getTime());
}else{ } else {
oldCard.setValidEnd(entity.getDoorCardEntity().getValidEnd()); oldCard.setValidEnd(entity.getDoorCardEntity().getValidEnd());
} }
oldCard.setDoorCard(entity.getDoorCardEntity().getDoorCard()); oldCard.setDoorCard(entity.getDoorCardEntity().getDoorCard());
@ -1126,19 +1126,19 @@ public class TenPersonServiceImpl implements TenPersonService {
tenDoorCardService.updateById(oldCard); tenDoorCardService.updateById(oldCard);
} }
} else { } else {
if (entity.getDoorCardEntity().getValidBegin()==null) { if (entity.getDoorCardEntity().getValidBegin() == null) {
oldCard.setValidBegin(new Date()); oldCard.setValidBegin(new Date());
}else{ } else {
oldCard.setValidBegin(entity.getDoorCardEntity().getValidBegin()); oldCard.setValidBegin(entity.getDoorCardEntity().getValidBegin());
} }
if (entity.getDoorCardEntity().getValidEnd()==null) { if (entity.getDoorCardEntity().getValidEnd() == null) {
Date date = new Date(); Date date = new Date();
Calendar cal = Calendar.getInstance(); Calendar cal = Calendar.getInstance();
cal.setTime(date);//设置起时间 cal.setTime(date);//设置起时间
cal.add(Calendar.YEAR, 20);//增加一年 cal.add(Calendar.YEAR, 20);//增加一年
// System.out.println("输出::"+cal.getTime()); // System.out.println("输出::"+cal.getTime());
oldCard.setValidEnd(cal.getTime()); oldCard.setValidEnd(cal.getTime());
}else{ } else {
oldCard.setValidEnd(entity.getDoorCardEntity().getValidEnd()); oldCard.setValidEnd(entity.getDoorCardEntity().getValidEnd());
} }
// oldCard.setValidEnd(entity.getDoorCardEntity().getValidEnd()); // oldCard.setValidEnd(entity.getDoorCardEntity().getValidEnd());
@ -1150,19 +1150,19 @@ public class TenPersonServiceImpl implements TenPersonService {
//增加 //增加
TenDoorCardEntity newCard = new TenDoorCardEntity(); TenDoorCardEntity newCard = new TenDoorCardEntity();
newCard.setPersonId(entity.getPersonId()); newCard.setPersonId(entity.getPersonId());
if (entity.getDoorCardEntity().getValidBegin()==null) { if (entity.getDoorCardEntity().getValidBegin() == null) {
newCard.setValidBegin(new Date()); newCard.setValidBegin(new Date());
}else{ } else {
newCard.setValidBegin(entity.getDoorCardEntity().getValidBegin()); newCard.setValidBegin(entity.getDoorCardEntity().getValidBegin());
} }
if (entity.getDoorCardEntity().getValidEnd()==null) { if (entity.getDoorCardEntity().getValidEnd() == null) {
Date date = new Date(); Date date = new Date();
Calendar cal = Calendar.getInstance(); Calendar cal = Calendar.getInstance();
cal.setTime(date);//设置起时间 cal.setTime(date);//设置起时间
cal.add(Calendar.YEAR, 10);//增加一年 cal.add(Calendar.YEAR, 10);//增加一年
// System.out.println("输出::"+cal.getTime()); // System.out.println("输出::"+cal.getTime());
newCard.setValidEnd(cal.getTime()); newCard.setValidEnd(cal.getTime());
}else{ } else {
newCard.setValidEnd(entity.getDoorCardEntity().getValidEnd()); newCard.setValidEnd(entity.getDoorCardEntity().getValidEnd());
} }
// newCard.setValidBegin(entity.getDoorCardEntity().getValidBegin()); // newCard.setValidBegin(entity.getDoorCardEntity().getValidBegin());
@ -1178,8 +1178,8 @@ public class TenPersonServiceImpl implements TenPersonService {
tenPersonDao.updateById(entity); tenPersonDao.updateById(entity);
//配置同步数据 //配置同步数据
List<TenPersonSyncEntity> syncEntitys = tenPersonSyncService.findByPersonId(entity.getPersonId(),entity.getTenantId()); List<TenPersonSyncEntity> syncEntitys = tenPersonSyncService.findByPersonId(entity.getPersonId(), entity.getTenantId());
for(TenPersonSyncEntity syncEn: syncEntitys){ for (TenPersonSyncEntity syncEn : syncEntitys) {
syncEn.setLastUpdateTime(entity.getLastUpdateTime()); syncEn.setLastUpdateTime(entity.getLastUpdateTime());
syncEn.setState(2); syncEn.setState(2);
tenPersonSyncService.updateById(syncEn); tenPersonSyncService.updateById(syncEn);
@ -1190,7 +1190,7 @@ public class TenPersonServiceImpl implements TenPersonService {
vo.setOperation(2); vo.setOperation(2);
vo.setLast_update_stamp(entity.getLastUpdateTime()); vo.setLast_update_stamp(entity.getLastUpdateTime());
list.add(vo); list.add(vo);
serverApiService.personOperation(syncEn.getDeviceSn(),list); serverApiService.personOperation(syncEn.getDeviceSn(), list);
} }
// List<TenDeviceVo> devList = tenDeviceService.findByCellId(entity.getCellId()); // List<TenDeviceVo> devList = tenDeviceService.findByCellId(entity.getCellId());
@ -1199,9 +1199,6 @@ public class TenPersonServiceImpl implements TenPersonService {
// } // }
return "OK"; return "OK";
} }
@ -1343,13 +1340,13 @@ public class TenPersonServiceImpl implements TenPersonService {
//升序排列 //升序排列
List<TenPersonVo> list = tenPersonDao.findUpdatePerson(cellId, buildId, roomId, lastUpdateTime); List<TenPersonVo> list = tenPersonDao.findUpdatePerson(cellId, buildId, roomId, lastUpdateTime);
// List<TenPersonVo> removeIndex = new ArrayList<>(); // List<TenPersonVo> removeIndex = new ArrayList<>();
if(list.size()>0){ if (list.size() > 0) {
TenPersonVo lastPerson = list.get(list.size()-1); TenPersonVo lastPerson = list.get(list.size() - 1);
String last = DateUtils.format(lastPerson.getLastUpdateTime(),DateUtils.DATE_TIME_PATTERN); String last = DateUtils.format(lastPerson.getLastUpdateTime(), DateUtils.DATE_TIME_PATTERN);
List<TenPersonVo> listAfter = tenPersonDao.findByLastUpdatePerson(cellId, buildId, roomId, last); List<TenPersonVo> listAfter = tenPersonDao.findByLastUpdatePerson(cellId, buildId, roomId, last);
for(TenPersonVo vo:listAfter){ for (TenPersonVo vo : listAfter) {
if(vo.getPersonId().longValue() != lastPerson.getPersonId().longValue() if (vo.getPersonId().longValue() != lastPerson.getPersonId().longValue()
&& vo.getLastUpdateTime().getTime() == lastPerson.getLastUpdateTime().getTime()){ && vo.getLastUpdateTime().getTime() == lastPerson.getLastUpdateTime().getTime()) {
list.add(vo); list.add(vo);
} }
} }
@ -1361,9 +1358,8 @@ public class TenPersonServiceImpl implements TenPersonService {
// } // }
// for (TenPersonVo vo : list) { // for (TenPersonVo vo : list) {
for (int i = 0;i<list.size();i++) { for (int i = 0; i < list.size(); i++) {
TenPersonVo vo = list.get(i); TenPersonVo vo = list.get(i);
// if(vo.getLastUpdateTime().getTime() == lastTime){ // if(vo.getLastUpdateTime().getTime() == lastTime){
// removeIndex.add(vo); // removeIndex.add(vo);
@ -1438,7 +1434,6 @@ public class TenPersonServiceImpl implements TenPersonService {
} }
} }
} }
//删除最后时间重复的项 //删除最后时间重复的项
@ -1507,23 +1502,22 @@ public class TenPersonServiceImpl implements TenPersonService {
} }
@Override @Override
public List<TenPersonVo> findAllPerson(Long cellId, Long buildId, Long roomId, String lastUpdateTime) { public List<TenPersonVo> findAllPerson(Long cellId, Long buildId, Long roomId, String lastUpdateTime) {
//升序排列 //升序排列
List<TenPersonVo> list = tenPersonDao.findUpdatePerson(cellId, buildId, roomId, lastUpdateTime); List<TenPersonVo> list = tenPersonDao.findUpdatePerson(cellId, buildId, roomId, lastUpdateTime);
if(list.size()>0){ if (list.size() > 0) {
TenPersonVo lastPerson = list.get(list.size()-1); TenPersonVo lastPerson = list.get(list.size() - 1);
String last = DateUtils.format(lastPerson.getLastUpdateTime(),DateUtils.DATE_TIME_PATTERN); String last = DateUtils.format(lastPerson.getLastUpdateTime(), DateUtils.DATE_TIME_PATTERN);
List<TenPersonVo> listAfter = tenPersonDao.findByLastUpdatePerson(cellId, buildId, roomId, last); List<TenPersonVo> listAfter = tenPersonDao.findByLastUpdatePerson(cellId, buildId, roomId, last);
for(TenPersonVo vo:listAfter){ for (TenPersonVo vo : listAfter) {
if(vo.getPersonId().longValue() != lastPerson.getPersonId().longValue() if (vo.getPersonId().longValue() != lastPerson.getPersonId().longValue()
&& vo.getLastUpdateTime().getTime() == lastPerson.getLastUpdateTime().getTime()){ && vo.getLastUpdateTime().getTime() == lastPerson.getLastUpdateTime().getTime()) {
list.add(vo); list.add(vo);
} }
} }
} }
for (int i = 0;i<list.size();i++) { for (int i = 0; i < list.size(); i++) {
TenPersonVo vo = list.get(i); TenPersonVo vo = list.get(i);
if (vo.getFaceImage() != null && !vo.getFaceImage().isEmpty()) { if (vo.getFaceImage() != null && !vo.getFaceImage().isEmpty()) {
String encode = ""; String encode = "";
@ -1540,7 +1534,7 @@ public class TenPersonServiceImpl implements TenPersonService {
outStream.write(buffer, 0, length); outStream.write(buffer, 0, length);
} }
// encode = Base64.getEncoder().encodeToString(outStream.toByteArray()); // encode = Base64.getEncoder().encodeToString(outStream.toByteArray());
vo.setFaceImageStr(outStream.size()/1000+""); vo.setFaceImageStr(outStream.size() / 1000 + "");
} catch (Exception e) { } catch (Exception e) {
log.error("底库不存在:" + vo.getFaceImage()); log.error("底库不存在:" + vo.getFaceImage());
e.printStackTrace(); e.printStackTrace();
@ -1573,7 +1567,7 @@ public class TenPersonServiceImpl implements TenPersonService {
outStream.write(buffer, 0, length); outStream.write(buffer, 0, length);
} }
// encode = Base64.getEncoder().encodeToString(outStream.toByteArray()); // encode = Base64.getEncoder().encodeToString(outStream.toByteArray());
vo.setOrgImageStr(outStream.size()/1000+""); vo.setOrgImageStr(outStream.size() / 1000 + "");
} catch (Exception e) { } catch (Exception e) {
log.error("原始照片不存在:" + vo.getOrgImage()); log.error("原始照片不存在:" + vo.getOrgImage());
e.printStackTrace(); e.printStackTrace();
@ -1600,7 +1594,6 @@ public class TenPersonServiceImpl implements TenPersonService {
} }
@Override @Override
public List<TenPersonIdUpdateVo> findAllPersonIdUpdate(Long cellId, Long buildId, Long roomId) { public List<TenPersonIdUpdateVo> findAllPersonIdUpdate(Long cellId, Long buildId, Long roomId) {
//升序排列 //升序排列
@ -1617,9 +1610,6 @@ public class TenPersonServiceImpl implements TenPersonService {
} }
@Override @Override
public List<TenPersonVo> findAllByCellId(Long cellId) { public List<TenPersonVo> findAllByCellId(Long cellId) {
return tenPersonDao.findAllByCellId(cellId); return tenPersonDao.findAllByCellId(cellId);
@ -1790,7 +1780,6 @@ public class TenPersonServiceImpl implements TenPersonService {
// log.info("原图"+tenPerson.getOrgImage()+"-"+personModel.getOrgImage()); // log.info("原图"+tenPerson.getOrgImage()+"-"+personModel.getOrgImage());
//2. 截取人脸图片 //2. 截取人脸图片
//检测图片人脸 //检测图片人脸
@ -1820,13 +1809,12 @@ public class TenPersonServiceImpl implements TenPersonService {
inputStreamFace.close(); inputStreamFace.close();
tenPerson.setFaceImage(faceImageFileName); tenPerson.setFaceImage(faceImageFileName);
} }
}else{ } else {
//windows 保存原始头像 //windows 保存原始头像
tenPerson.setFaceImage(orgImageFileName); tenPerson.setFaceImage(orgImageFileName);
} }
// int res = PicSDK.getFace(personModel.getOrgImage(), tempFaceFilePath); // int res = PicSDK.getFace(personModel.getOrgImage(), tempFaceFilePath);
// if (res != 0) { // if (res != 0) {
// return; // return;
@ -1852,16 +1840,14 @@ public class TenPersonServiceImpl implements TenPersonService {
// tenPerson.setFaceImage(faceImageFileName); // tenPerson.setFaceImage(faceImageFileName);
// tenPerson.setFaceImage(orgImageFileName); // tenPerson.setFaceImage(orgImageFileName);
//-------------------------------------------------------------------- //--------------------------------------------------------------------
//--------------------------------处理图片大小------------------------------------------------------ //--------------------------------处理图片大小------------------------------------------------------
if (tenPerson.getOrgImage() != null && !tenPerson.getOrgImage().isEmpty()) { if (tenPerson.getOrgImage() != null && !tenPerson.getOrgImage().isEmpty()) {
String orgFileStr = "/root/minio/data/cell/"+ tenPerson.getOrgImage(); String orgFileStr = "/root/minio/data/cell/" + tenPerson.getOrgImage();
// String orgFileStr = "/home/server001/minio/data/cell/"+ tenPerson.getOrgImage(); // String orgFileStr = "/home/server001/minio/data/cell/"+ tenPerson.getOrgImage();
try { try {
File picture = new File(orgFileStr); File picture = new File(orgFileStr);
@ -1873,7 +1859,7 @@ public class TenPersonServiceImpl implements TenPersonService {
.size(1080, 1080) .size(1080, 1080)
.toFile(orgFileStr); .toFile(orgFileStr);
} }
}catch (Exception e){ } catch (Exception e) {
log.error(e.getMessage()); log.error(e.getMessage());
} }
} }
@ -1888,7 +1874,7 @@ public class TenPersonServiceImpl implements TenPersonService {
tenPersonDao.insert(tenPerson); tenPersonDao.insert(tenPerson);
//门禁表 //门禁表
if(personModel.getDoorCard()!=null && personModel.getDoorCard().length()>0){ if (personModel.getDoorCard() != null && personModel.getDoorCard().length() > 0) {
TenDoorCardEntity doorCardEntity = new TenDoorCardEntity(); TenDoorCardEntity doorCardEntity = new TenDoorCardEntity();
doorCardEntity.setDoorCard(personModel.getDoorCard()); doorCardEntity.setDoorCard(personModel.getDoorCard());
doorCardEntity.setCellId(tenPerson.getCellId()); doorCardEntity.setCellId(tenPerson.getCellId());
@ -1914,10 +1900,10 @@ public class TenPersonServiceImpl implements TenPersonService {
//下发设备通知 //下发设备通知
List<TenDeviceVo> devList = tenDeviceService.findByCellId(cellId); List<TenDeviceVo> devList = tenDeviceService.findByCellId(cellId);
for(TenDeviceVo deviceVo: devList){ for (TenDeviceVo deviceVo : devList) {
List<TenPersonSyncEntity> operationList = tenPersonSyncService.findDeviceAllAddPersons(deviceVo.getDeviceId(),deviceVo.getTenantId()); List<TenPersonSyncEntity> operationList = tenPersonSyncService.findDeviceAllAddPersons(deviceVo.getDeviceId(), deviceVo.getTenantId());
List<TenPersonOperationVo> voList = new ArrayList<>(); List<TenPersonOperationVo> voList = new ArrayList<>();
for(TenPersonSyncEntity syncEntity: operationList){ for (TenPersonSyncEntity syncEntity : operationList) {
TenPersonOperationVo vo = new TenPersonOperationVo(); TenPersonOperationVo vo = new TenPersonOperationVo();
vo.setUid(syncEntity.getPersonId()); vo.setUid(syncEntity.getPersonId());
vo.setOperation(syncEntity.getState()); vo.setOperation(syncEntity.getState());
@ -1925,8 +1911,8 @@ public class TenPersonServiceImpl implements TenPersonService {
voList.add(vo); voList.add(vo);
} }
int flag = serverApiService.personOperation(deviceVo.getSn(),voList); int flag = serverApiService.personOperation(deviceVo.getSn(), voList);
if(flag == 0){ if (flag == 0) {
//下发成功删除状态为删除的同步人员 //下发成功删除状态为删除的同步人员
// tenPersonSyncService.removeAllDeletePersons(deviceEntity.getDeviceId(),tenantId); // tenPersonSyncService.removeAllDeletePersons(deviceEntity.getDeviceId(),tenantId);
} }
@ -1934,7 +1920,6 @@ public class TenPersonServiceImpl implements TenPersonService {
} }
@Override @Override
public int getAllCount(Map<String, Object> params) { public int getAllCount(Map<String, Object> params) {
List<Long> cellIds = new ArrayList<>(); List<Long> cellIds = new ArrayList<>();
@ -1973,4 +1958,21 @@ public class TenPersonServiceImpl implements TenPersonService {
public List<TenPersonEntity> getAllExpireGuest() { public List<TenPersonEntity> getAllExpireGuest() {
return tenPersonDao.getAllExpireGuest(); return tenPersonDao.getAllExpireGuest();
} }
public TenPersonEntity getOwner(Long roomId) {
return this.tenPersonDao.getOwner(roomId);
}
@Override
public List<TenPersonEntity> getNotSync(Long cellId) {
return this.tenPersonDao.getNotSync(cellId);
}
@Override
public List<TenPersonEntity> getNotSyncCard(Long cellId) {
return this.tenPersonDao.getNotSyncCard(cellId);
}
@Override
public List<TenPersonEntity> getNotSyncImage(Long cellId) {
return this.tenPersonDao.getNotSyncImage(cellId);
}
} }

View File

@ -360,4 +360,13 @@ public class TenRecordServiceImpl implements TenRecordService {
} }
return page.getRecords(); return page.getRecords();
} }
@Override
public List<TenRecordEntity> getNotSync(Long cellId, Long tenantId) {
return this.tenRecordDao.getNotSync(cellId, tenantId);
}
@Override
public List<TenRecordEntity> getNotSyncImage(Long cellId, Long tenantId) {
return this.tenRecordDao.getNotSyncImage(cellId, tenantId);
}
} }

View File

@ -182,4 +182,11 @@ public class TenRoomServiceImpl implements TenRoomService {
} }
return tenRoomDao.getAllCount(cellIds,params); return tenRoomDao.getAllCount(cellIds,params);
} }
@Override
public List<TenRoomEntity> getNotSync(Long cellId) {
return this.tenRoomDao.getNotSync(cellId);
}
} }

View File

@ -19,23 +19,54 @@ public class XaApi {
private static final String getFwikUrl = "http://117.34.12.66:10011/ywxzservice/get_fwjk_url.jsp"; private static final String getFwikUrl = "http://117.34.12.66:10011/ywxzservice/get_fwjk_url.jsp";
/**
* appid: 1297164778041095
* appsecret: 22971647780410956329716477804109
* xqid: 610113600000000004538
*/
public static String getAddress(String xqid, String appId, String appSecret) { public static String getAddress(String xqid, String appId, String appSecret) {
Map<String, String> postParameters = new HashMap<>(); // Map<String, String> postParameters = new HashMap<>();
// String appsecretMd5 = MD5Utils.getMD5Str(appSecret);
// postParameters.put("xqid", xqid);
// postParameters.put("appid", appId);
// postParameters.put("appsecret", appsecretMd5);
JSONObject postParameters = new JSONObject();
String appsecretMd5 = MD5Utils.getMD5Str(appSecret); String appsecretMd5 = MD5Utils.getMD5Str(appSecret);
postParameters.put("xqid", xqid); postParameters.put("xqid", xqid);
postParameters.put("appid", appId); postParameters.put("appid", appId);
postParameters.put("appsecret", appsecretMd5); postParameters.put("appsecret", appsecretMd5);
return XaHttpUtils.postHttp("http://117.34.12.66:10011/zhxqgl/interface/get_xq_addr.jsp", postParameters);
Map<String,String> headersMap = new HashMap<>();
headersMap.put("appId",appId);
String token = XaHttpUtils.getToken(appId,appSecret,"");
headersMap.put("token",token);
headersMap.put("tranId","202103310952250000000000000001");
return XaHttpUtils.postHttpEncryption("http://117.34.12.66:10011/zhxqgl/interface/get_xq_addr.jsp", headersMap,postParameters);
} }
public static String getFwikUrl(String appId, String appSecret) { public static String getFwikUrl(String appId, String appSecret) {
Map<String, String> postParameters = new HashMap<>(); JSONObject postParameters = new JSONObject();
String appsecretMd5 = MD5Utils.getMD5Str(appSecret); String appsecretMd5 = MD5Utils.md5Str(appSecret);
// postParameters.put("xqid", xqid);
postParameters.put("appid", appId); postParameters.put("appid", appId);
postParameters.put("appsecret", appsecretMd5); postParameters.put("appsecret", appsecretMd5);
String res = XaHttpUtils.postHttp("http://117.34.12.66:10011/ywxzservice/get_fwjk_url.jsp", postParameters);
Map<String,String> headersMap = new HashMap<>();
headersMap.put("appId",appId);
String token = XaHttpUtils.getToken(appId,appSecret,"");
headersMap.put("token",token);
headersMap.put("tranId","202103310952250000000000000001");
String res = XaHttpUtils.postHttpEncryption("http://117.34.12.66:10011/ywxzservice/get_fwjk_url.jsp", headersMap, postParameters);
JSONObject resObject = JSONObject.parseObject(res); JSONObject resObject = JSONObject.parseObject(res);
if (resObject != null) { if (resObject != null) {
log.debug(resObject.toJSONString());
JSONObject xmlObject = resObject.getJSONObject("xml"); JSONObject xmlObject = resObject.getJSONObject("xml");
String code = xmlObject.getString("code"); String code = xmlObject.getString("code");
if (code != null && code.equals("0000")) if (code != null && code.equals("0000"))
@ -58,7 +89,7 @@ public class XaApi {
String tokenStr = appId + appSecret + DateUtils.format(new Date(), "YYYYMMDD") + dataMiWen; String tokenStr = appId + appSecret + DateUtils.format(new Date(), "YYYYMMDD") + dataMiWen;
String token = MD5Utils.getMD5Str(tokenStr); String token = MD5Utils.getMD5Str(tokenStr);
Map<String, String> headerMaps = new HashMap<>(); Map<String, String> headerMaps = new HashMap<>();
headerMaps.put("appID", appId); headerMaps.put("appId", appId);
headerMaps.put("token", token); headerMaps.put("token", token);
headerMaps.put("tranId", tranId); headerMaps.put("tranId", tranId);
headerMaps.put("serviceId", serviceId); headerMaps.put("serviceId", serviceId);
@ -70,4 +101,23 @@ public class XaApi {
return null; return null;
} }
public static void main(String args[]){
/**
* appid: 1297164778041095
* appsecret: 22971647780410956329716477804109
* xqid: 610113600000000004538
*/
String appid = "1297164778041095";
String appsecret = "22971647780410956329716477804109";
String xqid = "610113600000000004538";
// String address = getAddress(xqid,appid,appsecret);
// System.out.println(address);
String apiUrl = getFwikUrl(appid,appsecret);
System.out.println(apiUrl);
}
} }

View File

@ -0,0 +1,190 @@
<%@ page language="java" import="java.util.*,java.net.*,java.text.*,java.io.*" pageEncoding="utf-8"%>
<%@page import="javax.crypto.KeyGenerator"%>
<%@page import="java.security.SecureRandom"%>
<%@page import="java.security.MessageDigest"%>
<%@page import="javax.crypto.SecretKey"%>
<%@page import="javax.crypto.spec.SecretKeySpec"%>
<%@page import="javax.crypto.Cipher"%>
<%@page import="org.apache.axis.encoding.Base64"%>
<title>返回数据页面</title>
<%!
protected static MessageDigest messageDigest = null;
public static String md5(String str) {
if (str == null) {
return null;
}
try {
messageDigest = MessageDigest.getInstance("MD5");
messageDigest.reset();
messageDigest.update(str.getBytes("UTF-8"));
}catch (Exception e) {
return str;
}
byte[] byteArray = messageDigest.digest();
StringBuffer md5StrBuff = new StringBuffer();
for (int i = 0; i < byteArray.length; i++) {
if (Integer.toHexString(0xFF & byteArray[i]).length() == 1)
md5StrBuff.append("0").append(Integer.toHexString(0xFF & byteArray[i]));
else
md5StrBuff.append(Integer.toHexString(0xFF & byteArray[i]));
}
return md5StrBuff.toString().toUpperCase();
}
/**
* 加密
*
* @param content
* 需要加密的内容
* @param password
* 加密密码
* @return
*/
private static byte[] encryptData_AES(String content, String password) {
try {
//SecretKey secretKey = getKey(password);
//byte[] enCodeFormat = secretKey.getEncoded();
byte[] enCodeFormat = parseHexStr2Byte(password);
//System.out.println("*-*-*-*-*-*-*-*"+enCodeFormat.toString);
/*MessageDigest md = MessageDigest.getInstance("MD5"); //lxl
byte[] enCodeFormat=md.digest(password.getBytes("utf-8"));//lxl*/
SecretKeySpec key = new SecretKeySpec(enCodeFormat, "AES");
Cipher cipher = Cipher.getInstance("AES");// 创建密码器
byte[] byteContent = content.getBytes("utf-8");
cipher.init(Cipher.ENCRYPT_MODE, key);// 初始化
byte[] result = cipher.doFinal(byteContent);
return result; // 加密
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
* 将16进制转换为二进制
*
* @param hexStr
* @return
*/
private static byte[] parseHexStr2Byte(String hexStr) {
if (hexStr.length() < 1)
return null;
byte[] result = new byte[hexStr.length() / 2];
for (int i = 0; i < hexStr.length() / 2; i++) {
int high = Integer.parseInt(hexStr.substring(i * 2, i * 2 + 1), 16);
int low = Integer.parseInt(hexStr.substring(i * 2 + 1, i * 2 + 2),
16);
result[i] = (byte) (high * 16 + low);
}
return result;
}
/**
* 将二进制转换成16进制
*
* @param buf
* @return
*/
private static String parseByte2HexStr(byte buf[]) {
StringBuffer sb = new StringBuffer();
for (int i = 0; i < buf.length; i++) {
String hex = Integer.toHexString(buf[i] & 0xFF);
if (hex.length() == 1) {
hex = '0' + hex;
}
sb.append(hex.toUpperCase());
}
return sb.toString();
}
/**
* 字符串加密
*
* @param srcStr
* 加密字符串
* @param password
* 加密密钥
* */
public static String encryptStr(String srcStr, String password) {
byte[] encryptResult = encryptData_AES(srcStr, password);
String encryptResultStr = parseByte2HexStr(encryptResult);
return encryptResultStr;
}
public static String httpPOST(String url, String json,String serviceId,String serviceValue,String appid,String secre){
String data = "";
try {
URL dataurl = new URL(url);
HttpURLConnection conn = (HttpURLConnection)dataurl.openConnection();
try{
conn.setRequestMethod("POST");
String currdate = new SimpleDateFormat("yyyyMMdd").format(new Date());
String token = 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);
conn.setRequestProperty("appid", appid);
conn.setRequestProperty("token", token);
conn.setRequestProperty("tranId", "12312321312321321321312");//可固定这么写
conn.setRequestProperty("serviceId", serviceId);
conn.setRequestProperty("serviceValue", serviceValue);
conn.setRequestProperty("versionCode", "");
conn.setDoOutput(true);
conn.setDoInput(true);
OutputStreamWriter os = new OutputStreamWriter(conn.getOutputStream(), "UTF-8");
os.write(json);
os.flush();
os.close();
//conn.setConnectTimeout(10000);
}catch(Exception ex){
System.out.println("errir="+ex.getMessage());
conn.disconnect();
return "";
}
InputStream is = conn.getInputStream();
DataInputStream dis = new DataInputStream(is);
byte bt[] = new byte[dis.available()];
dis.read(bt);
data = URLDecoder.decode(new String(bt,"UTF-8"),"UTF-8");
conn.disconnect();
is.close();
dis.close();
} catch (Exception e) {
data ="";
}
return data;
}
%>
<%
String name = "测试";
request.setCharacterEncoding("utf-8");
String url=request.getParameter("url");//http://117.34.12.66:10011/ywxzservice/dbClient.do
String json=request.getParameter("jsondata");//json字符串未加密的数据不同接口不同数据
//{"datas": [{数据填写地方}],"pages": [{"psize": "10","tcount": "","pno": "1","tsize": ""}]}
String serviceId=request.getParameter("serviceId");//调用的接口名称
String serviceValue=request.getParameter("serviceValue");//调用的接个名称(同上)
String appid=request.getParameter("appid");//appid 由天创公司提供
String secre=request.getParameter("secre");//APPSECRET 由天创公司提供
String aes=request.getParameter("aes");//APPSECRET 由天创公司提供
String b = encryptStr(json.trim(), aes);//数据的aes加密
String result = httpPOST(url,b,serviceId,serviceValue,appid,secre);//发送
out.println("result="+result);//返回结果
%>

View File

@ -2,25 +2,36 @@ package net.shapelight.modules.xian.utils;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.Date; import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.Map; import java.util.Map;
import net.shapelight.common.utils.DateUtils; import net.shapelight.common.utils.DateUtils;
import net.shapelight.common.utils.MD5Utils; import net.shapelight.common.utils.MD5Utils;
import net.shapelight.common.utils.RestTemplateUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.http.HttpEntity; import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders; import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.http.client.ClientHttpRequestFactory; import org.springframework.http.client.ClientHttpRequestFactory;
import org.springframework.http.client.ClientHttpResponse;
import org.springframework.http.client.SimpleClientHttpRequestFactory; import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.http.converter.StringHttpMessageConverter; import org.springframework.http.converter.StringHttpMessageConverter;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap; import org.springframework.util.MultiValueMap;
import org.springframework.web.client.DefaultResponseErrorHandler; import org.springframework.web.client.DefaultResponseErrorHandler;
import org.springframework.web.client.ResponseErrorHandler; import org.springframework.web.client.ResponseErrorHandler;
import org.springframework.web.client.RestClientException; import org.springframework.web.client.RestClientException;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
import javax.servlet.http.HttpServletResponse;
public class XaHttpUtils { public class XaHttpUtils {
@ -30,7 +41,7 @@ public class XaHttpUtils {
private static final String appSecret = "22971647780410956329716477804109"; private static final String appSecret = "22971647780410956329716477804109";
public static String postHttp(String url, Map<String, String> postParameters) { public static String postHttp(String url, MultiValueMap<String, String> postParameters) {
SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory(); SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
requestFactory.setConnectTimeout(180000); requestFactory.setConnectTimeout(180000);
requestFactory.setReadTimeout(180000); requestFactory.setReadTimeout(180000);
@ -53,32 +64,129 @@ public class XaHttpUtils {
return result; return result;
} }
public static String postHttp(String url, Map<String, String> postParameters, Map<String, String> headerMaps) {
SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
requestFactory.setConnectTimeout(180000); /**
requestFactory.setReadTimeout(180000); * 加密参数类型请求 application/x-www-form-urlencoded
RestTemplate restTemplate = new RestTemplate((ClientHttpRequestFactory)requestFactory); * MultiValueMap<String, Object>
restTemplate.getMessageConverters().set(1, new StringHttpMessageConverter(StandardCharsets.UTF_8)); * 采用 HttpEntity<MultiValueMap<String, Object>> 构造
restTemplate.setErrorHandler((ResponseErrorHandler)new DefaultResponseErrorHandler()); * http 请求 post
HttpHeaders requestHeaders = new HttpHeaders(); * @param url 地址
requestHeaders.add("Content-Type", "application/x-www-form-urlencoded"); * @param
for (String key : headerMaps.keySet()) { // * @param headersMap header
System.out.print(key + "-" + (String)headerMaps.get(key) + "\t"); // * @param connecTimeout 连接时间
requestHeaders.add("key", headerMaps.get(key)); // * @param readTimeout 读取时间
// * @param retryCount 重试机制
* @return String 类型
*/
public static String postHttpEncryption(String url, Map headersMap, JSONObject postParametersJson) {
SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory(); // 时间函数
requestFactory.setConnectTimeout(180000);
requestFactory.setReadTimeout(180000);
//内部实际实现为 HttpClient
RestTemplate restTemplate = new RestTemplate(requestFactory);
restTemplate.getMessageConverters().set(1, new StringHttpMessageConverter(StandardCharsets.UTF_8)); // 设置编码集
restTemplate.setErrorHandler(new XaHttpUtils.DefaultResponseErrorHandler()); // 异常处理的headers error 处理
// 设置·header信息
// HttpHeaders requestHeaders = new HttpHeaders();
// requestHeaders.setAll(headersMap);
HttpHeaders requestHeaders = new HttpHeaders();
requestHeaders.setAll(headersMap);
requestHeaders.add("Content-Type", "application/x-www-form-urlencoded");
MultiValueMap<String, String> postParameters = createMultiValueMap(postParametersJson);
HttpEntity<MultiValueMap<String, String>> requestEntity = new HttpEntity<>(postParameters, requestHeaders);
String result = null; // 返回值类型;
for (int i = 1; i <= 3; i++){
try {
result = restTemplate.postForObject(url, requestEntity, String.class);
return result;
} catch (RestClientException e) {
System.out.println("-----------开始-----------重试count: "+i);
e.printStackTrace();
} }
HttpEntity<Map<String, String>> requestEntity = new HttpEntity(postParameters, (MultiValueMap)requestHeaders);
String result = null;
for (int i = 1; i <= 3; i++) {
try {
result = (String)restTemplate.postForObject(url, requestEntity, String.class, new Object[0]);
return result;
} catch (RestClientException e) {
System.out.println("-----------" + i);
e.printStackTrace();
}
}
return result;
} }
return result;
}
/**
* @ClassName: DefaultResponseErrorHandler
* @Description: TODO
* @author:
* @date: 2
*/
private static class DefaultResponseErrorHandler implements ResponseErrorHandler {
/** 对response进行判断如果是异常情况返回true */
@Override
public boolean hasError(ClientHttpResponse response) throws IOException {
return response.getStatusCode().value() != HttpServletResponse.SC_OK;
}
/** 异常情况时的处理方法 */
@Override
public void handleError(ClientHttpResponse response) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(response.getBody()));
StringBuilder sb = new StringBuilder();
String str = null;
while ((str = br.readLine()) != null) {
sb.append(str);
}
try {
throw new Exception(sb.toString());
} catch (Exception e) {
e.printStackTrace();
}
}
}
private static MultiValueMap<String, String> createMultiValueMap(JSONObject params) {
MultiValueMap<String, String> map = new LinkedMultiValueMap<>();
for (String key : params.keySet()) {
if (params.get(key) instanceof List) {
for (Iterator<String> it = ((List<String>) params.get(key)).iterator(); it.hasNext(); ) {
String value = it.next();
map.add(key, value);
}
} else {
map.add(key, params.getString(key));
}
}
return map;
}
// public static String postHttp(String url, Map<String, String> postParameters, Map<String, String> headerMaps) {
// SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
// requestFactory.setConnectTimeout(180000);
// requestFactory.setReadTimeout(180000);
// RestTemplate restTemplate = new RestTemplate((ClientHttpRequestFactory)requestFactory);
// restTemplate.getMessageConverters().set(1, new StringHttpMessageConverter(StandardCharsets.UTF_8));
// restTemplate.setErrorHandler((ResponseErrorHandler)new DefaultResponseErrorHandler());
// HttpHeaders requestHeaders = new HttpHeaders();
// requestHeaders.add("Content-Type", "application/x-www-form-urlencoded");
// for (String key : headerMaps.keySet()) {
// System.out.print(key + "-" + (String)headerMaps.get(key) + "\t");
// requestHeaders.add("key", headerMaps.get(key));
// }
// HttpEntity<Map<String, String>> requestEntity = new HttpEntity(postParameters, (MultiValueMap)requestHeaders);
// String result = null;
// for (int i = 1; i <= 3; i++) {
// try {
// result = (String)restTemplate.postForObject(url, requestEntity, String.class, new Object[0]);
// return result;
// } catch (RestClientException e) {
// System.out.println("-----------" + i);
// e.printStackTrace();
// }
// }
// return result;
// }
public static String postHttp(String url, JSONObject params) { public static String postHttp(String url, JSONObject params) {
SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory(); SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory();
@ -103,13 +211,13 @@ public class XaHttpUtils {
return result; return result;
} }
public String getToken(String appId, String appSecret, String requestPackage) { public static String getToken(String appId, String appSecret, String requestPackage) {
return MD5Utils.getMD5Str(appId + appSecret + return MD5Utils.getMD5Str(appId + appSecret +
DateUtils.format(new Date(), "YYYYMMDD") + requestPackage); DateUtils.format(new Date(), "YYYYMMDD") + requestPackage);
} }
public String packageEncode(String appSecret, String packageString) { public static String packageEncode(String appSecret, String packageString) {
try { try {
String res = AESUtils.encrypt(packageString, appSecret); String res = AESUtils.encrypt(packageString, appSecret);
return res; return res;
@ -119,7 +227,7 @@ public class XaHttpUtils {
} }
} }
public String packageDecode(String appSecret, String packageString) { public static String packageDecode(String appSecret, String packageString) {
try { try {
String res = AESUtils.decrypt(packageString, appSecret); String res = AESUtils.decrypt(packageString, appSecret);
return res; return res;
@ -129,4 +237,6 @@ public class XaHttpUtils {
} }
} }
} }

View File

@ -0,0 +1,363 @@
package net.shapelight.modules.xian.utils;
import lombok.extern.slf4j.Slf4j;
import javax.crypto.Cipher;
import javax.crypto.spec.SecretKeySpec;
import java.io.DataInputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.security.MessageDigest;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@Slf4j
public class XaUtils {
protected static MessageDigest messageDigest = null;
public static String md5(String str) {
// MessageDigest messageDigest = null;
if (str == null) {
return null;
}
try {
messageDigest = MessageDigest.getInstance("MD5");
messageDigest.reset();
messageDigest.update(str.getBytes("UTF-8"));
} catch (Exception e) {
return str;
}
byte[] byteArray = messageDigest.digest();
StringBuffer md5StrBuff = new StringBuffer();
for (int i = 0; i < byteArray.length; i++) {
if (Integer.toHexString(0xFF & byteArray[i]).length() == 1)
md5StrBuff.append("0").append(Integer.toHexString(0xFF & byteArray[i]));
else
md5StrBuff.append(Integer.toHexString(0xFF & byteArray[i]));
}
return md5StrBuff.toString().toUpperCase();
}
/**
* 加密
*
* @param content 需要加密的内容
* @param password 加密密码
* @return
*/
private static byte[] encryptData_AES(String content, String password) {
try {
//SecretKey secretKey = getKey(password);
//byte[] enCodeFormat = secretKey.getEncoded();
byte[] enCodeFormat = parseHexStr2Byte(password);
//System.out.println("*-*-*-*-*-*-*-*"+enCodeFormat.toString);
/*MessageDigest md = MessageDigest.getInstance("MD5"); //lxl
byte[] enCodeFormat=md.digest(password.getBytes("utf-8"));//lxl*/
SecretKeySpec key = new SecretKeySpec(enCodeFormat, "AES");
Cipher cipher = Cipher.getInstance("AES");// 创建密码器
byte[] byteContent = content.getBytes("utf-8");
cipher.init(Cipher.ENCRYPT_MODE, key);// 初始化
byte[] result = cipher.doFinal(byteContent);
return result; // 加密
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
* 将16进制转换为二进制
*
* @param hexStr
* @return
*/
private static byte[] parseHexStr2Byte(String hexStr) {
if (hexStr.length() < 1)
return null;
byte[] result = new byte[hexStr.length() / 2];
for (int i = 0; i < hexStr.length() / 2; i++) {
int high = Integer.parseInt(hexStr.substring(i * 2, i * 2 + 1), 16);
int low = Integer.parseInt(hexStr.substring(i * 2 + 1, i * 2 + 2),
16);
result[i] = (byte) (high * 16 + low);
}
return result;
}
/**
* 将二进制转换成16进制
*
* @param buf
* @return
*/
private static String parseByte2HexStr(byte buf[]) {
StringBuffer sb = new StringBuffer();
for (int i = 0; i < buf.length; i++) {
String hex = Integer.toHexString(buf[i] & 0xFF);
if (hex.length() == 1) {
hex = '0' + hex;
}
sb.append(hex.toUpperCase());
}
return sb.toString();
}
/**
* 字符串加密
*
* @param srcStr 加密字符串
* @param password 加密密钥
*/
public static String encryptStr(String srcStr, String password) {
byte[] encryptResult = encryptData_AES(srcStr, password);
String encryptResultStr = parseByte2HexStr(encryptResult);
return encryptResultStr;
}
/**
*
* @param url
* @param json 加密后的json
* @param serviceId
* @param serviceValue
* @param appid
* @param secre
* @return
*/
public static String httpPOSTJson(String url, String json, String serviceId, String serviceValue, String appid, String secre) {
String data = "";
try {
URL dataurl = new URL(url);
HttpURLConnection conn = (HttpURLConnection) dataurl.openConnection();
try {
conn.setRequestMethod("POST");
String currdate = new SimpleDateFormat("yyyyMMdd").format(new Date());
String token = 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);
conn.setRequestProperty("appid", appid);
conn.setRequestProperty("token", token);
conn.setRequestProperty("tranId", "12312321312321321321312");//可固定这么写
conn.setRequestProperty("serviceId", serviceId);
conn.setRequestProperty("serviceValue", serviceValue);
conn.setRequestProperty("versionCode", "");
conn.setDoOutput(true);
conn.setDoInput(true);
// String params = "appid=" + URLEncoder.encode(appid, "UTF-8") + "&appsecret=" + URLEncoder.encode(secre, "UTF-8");
// OutputStream outputStream = conn.getOutputStream();
// outputStream.write(params.getBytes());
// outputStream.flush();
// outputStream.close();
OutputStreamWriter os = new OutputStreamWriter(conn.getOutputStream(), "UTF-8");
os.write(json);
os.flush();
os.close();
//conn.setConnectTimeout(10000);
} catch (Exception ex) {
System.out.println("errir=" + ex.getMessage());
conn.disconnect();
return "";
}
InputStream is = conn.getInputStream();
DataInputStream dis = new DataInputStream(is);
byte bt[] = new byte[dis.available()];
dis.read(bt);
data = URLDecoder.decode(new String(bt, "UTF-8"), "UTF-8");
conn.disconnect();
is.close();
dis.close();
} catch (Exception e) {
data = "";
}
return data;
}
/**
*
* @param url
// * @param json 加密后的json
// * @param serviceId
// * @param serviceValue
* @param appid
* @param secre
* @return
*/
public static String httpPOSTParam(String url, String appid, String secre, Map<String,String> mapParams) {
String data = "";
try {
URL dataurl = new URL(url);
HttpURLConnection conn = (HttpURLConnection) dataurl.openConnection();
try {
conn.setRequestMethod("POST");
String currdate = new SimpleDateFormat("yyyyMMdd").format(new Date());
String token = md5(appid + secre + currdate);
// System.out.println("json****" + json);
System.out.println("appid***" + appid);
System.out.println("token***" + token);
// System.out.println("333serviceId***" + serviceId);
// System.out.println("333serviceValue***" + serviceValue);
conn.setRequestProperty("appid", appid);
conn.setRequestProperty("token", token);
conn.setRequestProperty("tranId", "12312321312321321321312");//可固定这么写
// conn.setRequestProperty("serviceId", "");
// conn.setRequestProperty("serviceValue", "");
// conn.setRequestProperty("versionCode", "");
conn.setDoOutput(true);
conn.setDoInput(true);
StringBuffer paramsBuffer = new StringBuffer();
mapParams.forEach((key,value)->{
paramsBuffer.append("&"+key+"=");
try {
paramsBuffer.append(URLEncoder.encode(value, "UTF-8"));
}catch (Exception e){
log.error(e.getMessage());
}
// System.out.println(key);
// System.out.println(value);
});
String params = paramsBuffer.toString().substring(1);
System.out.println(params);
// String s = "appid=" + URLEncoder.encode(appid, "UTF-8") + "&appsecret=" + URLEncoder.encode(secre, "UTF-8");
OutputStream outputStream = conn.getOutputStream();
outputStream.write(params.getBytes());
outputStream.flush();
outputStream.close();
// OutputStreamWriter os = new OutputStreamWriter(conn.getOutputStream(), "UTF-8");
// os.write(json);
// os.flush();
// os.close();
//conn.setConnectTimeout(10000);
} catch (Exception ex) {
System.out.println("errir=" + ex.getMessage());
conn.disconnect();
return "";
}
InputStream is = conn.getInputStream();
DataInputStream dis = new DataInputStream(is);
byte bt[] = new byte[dis.available()];
dis.read(bt);
data = URLDecoder.decode(new String(bt, "UTF-8"), "UTF-8");
conn.disconnect();
is.close();
dis.close();
} catch (Exception e) {
data = "";
}
return data;
}
public static void main(String args[]){
/**
* appid: 1297164778041095
* appsecret: 22971647780410956329716477804109
* xqid: 610113600000000004538
*/
/*
String name = "测试";
request.setCharacterEncoding("utf-8");
String url=request.getParameter("url");//http://117.34.12.66:10011/ywxzservice/dbClient.do
String json=request.getParameter("jsondata");//json字符串未加密的数据不同接口不同数据
//{"datas": [{数据填写地方}],"pages": [{"psize": "10","tcount": "","pno": "1","tsize": ""}]}
String serviceId=request.getParameter("serviceId");//调用的接口名称
String serviceValue=request.getParameter("serviceValue");//调用的接个名称同上
String appid=request.getParameter("appid");//appid 由天创公司提供
String secre=request.getParameter("secre");//APPSECRET 由天创公司提供
String aes=request.getParameter("aes");//APPSECRET 由天创公司提供
String b = encryptStr(json.trim(), aes);//数据的aes加密
String result = httpPOST(url,b,serviceId,serviceValue,appid,secre);//发送
out.println("result="+result);//返回结果
*/
//获取借口接口地址
String appid = "1297164778041095";
String secre = "22971647780410956329716477804109";
// String secreMd5 = md5("22971647780410956329716477804109");
// System.out.println("secretMd5:"+secreMd5);
Map<String,String> paramMap = new HashMap<>();
paramMap.put("appid",appid);
paramMap.put("appsecret",md5(secre));
String FwjkUrl = httpPOSTParam("http://117.34.12.66:10011/ywxzservice/get_fwjk_url.jsp",
appid,secre,paramMap);
System.out.println("FwjkUrl:"+FwjkUrl);
//获取标准地址
String xqid = "610113600000000004538";
Map<String,String> addressMap = new HashMap<>();
addressMap.put("appid",appid);
addressMap.put("appsecret",md5(secre));
addressMap.put("xqid",xqid);
String address = httpPOSTParam("http://117.34.12.66:10011/zhxqgl/interface/get_xq_addr.jsp",
appid,secre,addressMap);
System.out.println("Address:"+address);
// String url = "http://117.34.12.66:10011/ywxzservice/dbClient.do";
// String appid = "1297164778041095";
// String secret = "22971647780410956329716477804109";
// String serviceId = "SYFW";
// String serviceValue = "SYFW";
// String dataMing = "";
//
// String dataMi = encryptStr(dataMing.trim(), secret);//数据的aes加密
//
// String result = httpPOSTJson(url,dataMi,serviceId,serviceValue,appid,secret);//发送
// System.out.println(result);
}
}

View File

@ -1,6 +1,9 @@
package net.shapelight.modules.xian.vo; package net.shapelight.modules.xian.vo;
import lombok.Data;
@Data
public class XaPages { public class XaPages {
/** /**
* pages 对象 4.1查询接口时需要 * pages 对象 4.1查询接口时需要

View File

@ -4,17 +4,9 @@ import lombok.Data;
@Data @Data
public class XaRYRKPHOTO { public class XaRYRKPHOTO {
private String LV_CASE_ID;
private String LV_SSXQBM;
private String LV_CASE_ID; private String LV_ZP;
private String LV_DJSJ;
private String LV_SSXQBM; private String LV_GMSFHM;
private String LV_ZP;
private String LV_DJSJ;
private String LV_GMSFHM;
} }

View File

@ -1,5 +1,8 @@
package net.shapelight.modules.xian.vo; package net.shapelight.modules.xian.vo;
import lombok.Data;
@Data
public class XaSYRK { public class XaSYRK {
/** /**
* 6.3.1 实有人口信息数据项 * 6.3.1 实有人口信息数据项
@ -110,5 +113,7 @@ public class XaSYRK {
*/ */
private String LV_PROCMODE = "PMINSERT"; private String LV_PROCMODE = "PMINSERT";
private String LV_ZJZL = "10";
} }

View File

@ -3,7 +3,7 @@
<mapper namespace="net.shapelight.modules.ten.dao.TenCellDao"> <mapper namespace="net.shapelight.modules.ten.dao.TenCellDao">
<!-- 可根据自己的需求,是否要使用 --> <!-- -->
<resultMap type="net.shapelight.modules.ten.entity.TenCellEntity" id="tenCellMap"> <resultMap type="net.shapelight.modules.ten.entity.TenCellEntity" id="tenCellMap">
<result property="cellId" column="cell_id"/> <result property="cellId" column="cell_id"/>
<result property="areaId" column="area_id"/> <result property="areaId" column="area_id"/>
@ -94,35 +94,35 @@
<!--<if test="groupId != null and groupId!=''">--> <!--<if test="groupId != null and groupId!=''">-->
<!--and group_id = #{groupId}--> <!--and group_id = #{groupId}-->
<!--</if>--> <!--</if>-->
<!--<if test="reviewFlag != null and reviewFlag!=''">--> <!--<if test="reviewFlag != null and reviewFlag!=''">-->
<!--and fence_review in--> <!--and fence_review in-->
<!--<foreach item="status" collection="reviewFlag" open="(" separator="," close=")">--> <!--<foreach item="status" collection="reviewFlag" open="(" separator="," close=")">-->
<!--#{status}--> <!--#{status}-->
<!--</foreach>--> <!--</foreach>-->
<!--</if>--> <!--</if>-->
<!--<choose>--> <!--<choose>-->
<!--<when test="createTimeStart != null and createTimeStart!='' and createTimeEnd != null and createTimeEnd!=''">--> <!--<when test="createTimeStart != null and createTimeStart!='' and createTimeEnd != null and createTimeEnd!=''">-->
<!--and create_time &gt;= #{createTimeStart} and create_time &lt;= DATE_SUB(#{createTimeEnd},INTERVAL -1 DAY)--> <!--and create_time &gt;= #{createTimeStart} and create_time &lt;= DATE_SUB(#{createTimeEnd},INTERVAL -1 DAY)-->
<!--</when>--> <!--</when>-->
<!--<otherwise>--> <!--<otherwise>-->
<!--<choose>--> <!--<choose>-->
<!--<when test="createTimeStart != null and createTimeStart!='' and (createTimeEnd == null or createTimeEnd=='')">--> <!--<when test="createTimeStart != null and createTimeStart!='' and (createTimeEnd == null or createTimeEnd=='')">-->
<!--and TO_DAYS(create_time) = TO_DAYS(#{createTimeStart})--> <!--and TO_DAYS(create_time) = TO_DAYS(#{createTimeStart})-->
<!--</when>--> <!--</when>-->
<!--<otherwise>--> <!--<otherwise>-->
<!--<choose>--> <!--<choose>-->
<!--<when test="(createTimeStart == null or createTimeStart=='') and createTimeEnd != null and createTimeEnd!=''">--> <!--<when test="(createTimeStart == null or createTimeStart=='') and createTimeEnd != null and createTimeEnd!=''">-->
<!--and TO_DAYS(create_time) = TO_DAYS(#{createTimeEnd})--> <!--and TO_DAYS(create_time) = TO_DAYS(#{createTimeEnd})-->
<!--</when>--> <!--</when>-->
<!--</choose>--> <!--</choose>-->
<!--</otherwise>--> <!--</otherwise>-->
<!--</choose>--> <!--</choose>-->
<!--</otherwise>--> <!--</otherwise>-->
<!--</choose>--> <!--</choose>-->
</select> </select>

View File

@ -3,7 +3,7 @@
<mapper namespace="net.shapelight.modules.ten.dao.TenDeviceDao"> <mapper namespace="net.shapelight.modules.ten.dao.TenDeviceDao">
<!-- 可根据自己的需求,是否要使用 --> <!-- 可根据自己的需求,是否要使用 -->
<resultMap type="net.shapelight.modules.ten.entity.TenDeviceEntity" id="tenDeviceMap"> <resultMap type="net.shapelight.modules.ten.entity.TenDeviceEntity" id="tenDeviceMap">
<result property="deviceId" column="device_id"/> <result property="deviceId" column="device_id"/>
<result property="name" column="name"/> <result property="name" column="name"/>
@ -50,6 +50,7 @@
<result property="temperatureAlert" column="temperature_alert"/> <result property="temperatureAlert" column="temperature_alert"/>
<result property="healthCodeFlag" column="health_code_flag"/> <result property="healthCodeFlag" column="health_code_flag"/>
<result column="xa_sync" property="xaSync"/>
</resultMap> </resultMap>

View File

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="net.shapelight.modules.ten.dao.TenPackChannalDao">
<!-- -->
<resultMap type="net.shapelight.modules.ten.entity.TenPackChannalEntity" id="tenPackChannalMap">
<result property="parkChannalId" column="park_channal_id"/>
<result property="packId" column="pack_id"/>
<result property="channalName" column="channal_name"/>
<result property="channalCode" column="channal_code"/>
<result property="channalCodeXa" column="channal_code_xa"/>
<result property="direction" column="direction"/>
<result property="cellId" column="cell_id"/>
<result property="tenantId" column="tenant_id"/>
</resultMap>
</mapper>

View File

@ -3,7 +3,7 @@
<mapper namespace="net.shapelight.modules.ten.dao.TenPackRecordDao"> <mapper namespace="net.shapelight.modules.ten.dao.TenPackRecordDao">
<!-- 可根据自己的需求,是否要使用 --> <!-- -->
<resultMap type="net.shapelight.modules.ten.entity.TenPackRecordEntity" id="tenPackRecordMap"> <resultMap type="net.shapelight.modules.ten.entity.TenPackRecordEntity" id="tenPackRecordMap">
<result property="recordId" column="record_id"/> <result property="recordId" column="record_id"/>
<result property="parkId" column="park_id"/> <result property="parkId" column="park_id"/>
@ -25,6 +25,8 @@
<result property="actualFee" column="actual_fee"/> <result property="actualFee" column="actual_fee"/>
<result property="operator" column="operator"/> <result property="operator" column="operator"/>
<result property="cellId" column="cell_id"/> <result property="cellId" column="cell_id"/>
<result property="xaSync" column="xa_sync"/>
<result property="xaSyncImage" column="xa_sync_iamge"/>
</resultMap> </resultMap>
@ -92,6 +94,12 @@
<if test="cellId != null"> <if test="cellId != null">
cell_id, cell_id,
</if> </if>
<if test="xaSync != null">
xa_sync,
</if>
<if test="xaSyncImage != null">
xa_sync_image,
</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="recordId != null"> <if test="recordId != null">
@ -154,13 +162,19 @@
<if test="cellId != null"> <if test="cellId != null">
#{cellId,jdbcType=BIGINT}, #{cellId,jdbcType=BIGINT},
</if> </if>
<if test="xaSync != null">
#{xaSync},
</if>
<if test="xaSyncImage != null">
#{xaSyncImage},
</if>
</trim> </trim>
</insert> </insert>
<!--<delete id="deleteById" parameterType="java.lang.Long">--> <!--<delete id="deleteById" parameterType="java.lang.Long">-->
<!--delete from ten_pack_record_${cellId}--> <!--delete from ten_pack_record_${cellId}-->
<!--where record_id = #{recordId,jdbcType=VARCHAR}--> <!--where record_id = #{recordId,jdbcType=VARCHAR}-->
<!--</delete>--> <!--</delete>-->
<update id="updateById" parameterType="net.shapelight.modules.ten.entity.TenPackRecordEntity"> <update id="updateById" parameterType="net.shapelight.modules.ten.entity.TenPackRecordEntity">
update ten_pack_record update ten_pack_record
@ -225,6 +239,12 @@
<if test="cellId != null"> <if test="cellId != null">
cell_id = #{cellId,jdbcType=BIGINT}, cell_id = #{cellId,jdbcType=BIGINT},
</if> </if>
<if test="xaSync != null">
xa_sync = #{xaSync},
</if>
<if test="xaSyncImage != null">
xa_sync_image = #{xaSyncImage},
</if>
</set> </set>
where record_id = #{recordId,jdbcType=VARCHAR} where record_id = #{recordId,jdbcType=VARCHAR}
</update> </update>
@ -238,11 +258,11 @@
<select id="findPageAll" resultMap="tenPackRecordMap"> <select id="findPageAll" resultMap="tenPackRecordMap">
<!--SELECT alias.* from (--> <!--SELECT alias.* from (-->
<!--<foreach collection="cellIds" item="item" index="index" separator="union all">--> <!--<foreach collection="cellIds" item="item" index="index" separator="union all">-->
<!--select * from ten_pack_record_${item}--> <!--select * from ten_pack_record_${item}-->
<!--</foreach>--> <!--</foreach>-->
<!--) alias where 1 = 1--> <!--) alias where 1 = 1-->
<!--<if test="params.plate != null and params.plate!=''">--> <!--<if test="params.plate != null and params.plate!=''">-->
<!--and vlp like CONCAT('%', '${params.plate}', '%')--> <!--and vlp like CONCAT('%', '${params.plate}', '%')-->
<!--</if>--> <!--</if>-->
<!--order by alias.in_time desc--> <!--order by alias.in_time desc-->
@ -258,7 +278,17 @@
</foreach> </foreach>
</if> </if>
order by in_time desc order by in_time desc
</select> </select>
<select id="getNotSync" resultMap="tenPackRecordMap">
select * from ten_pack_record
where xa_sync = 0 and cell_id = #{cellId}
</select>
<select id="getNotSyncImage" resultMap="tenPackRecordMap">
select * from ten_pack_record
where xa_sync_image = 0 and cell_id = #{cellId}
</select>
</mapper> </mapper>

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="net.shapelight.modules.ten.dao.TenPackRecordEnterDao">
<!-- -->
<resultMap type="net.shapelight.modules.ten.entity.TenPackRecordEnterEntity" id="tenPackRecordEnterMap">
<result property="recordEnterId" column="record_enter_id"/>
<result property="parkCode" column="park_code"/>
<result property="parkName" column="park_name"/>
<result property="orderNumber" column="order_number"/>
<result property="plateNumber" column="plate_number"/>
<result property="channelName" column="channel_name"/>
<result property="enterTime" column="enter_time"/>
<result property="type" column="type"/>
<result property="carType" column="car_type"/>
<result property="image" column="image"/>
<result property="cellId" column="cell_id"/>
<result property="tenantId" column="tenant_id"/>
<result property="xaSync" column="xa_sync"/>
<result property="xaSyncImage" column="xa_sync_image"/>
</resultMap>
</mapper>

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="net.shapelight.modules.ten.dao.TenPackRecordExitDao">
<!-- -->
<resultMap type="net.shapelight.modules.ten.entity.TenPackRecordExitEntity" id="tenPackRecordExitMap">
<result property="recordExitId" column="record_exit_id"/>
<result property="parkCode" column="park_code"/>
<result property="parkName" column="park_name"/>
<result property="orderNumber" column="order_number"/>
<result property="plateNumber" column="plate_number"/>
<result property="channelName" column="channel_name"/>
<result property="exitTime" column="exit_time"/>
<result property="type" column="type"/>
<result property="carType" column="car_type"/>
<result property="image" column="image"/>
<result property="cellId" column="cell_id"/>
<result property="tenantId" column="tenant_id"/>
<result property="xaSync" column="xa_sync"/>
<result property="xaSyncImage" column="xa_sync_image"/>
</resultMap>
</mapper>

View File

@ -44,6 +44,9 @@
<result column="register_type" jdbcType="TINYINT" property="registerType"/> <result column="register_type" jdbcType="TINYINT" property="registerType"/>
<result column="tenant_id" jdbcType="BIGINT" property="tenantId"/> <result column="tenant_id" jdbcType="BIGINT" property="tenantId"/>
<result column="face_failure" jdbcType="TINYINT" property="faceFailure"/> <result column="face_failure" jdbcType="TINYINT" property="faceFailure"/>
<result column="xa_sync" jdbcType="TINYINT" property="xaSync" />
<result column="xa_sync_card" jdbcType="TINYINT" property="xaSyncCard" />
<result column="xa_sync_image" jdbcType="TINYINT" property="xaSyncImage" />
<association property="cellName" javaType="String" <association property="cellName" javaType="String"
select="net.shapelight.modules.ten.dao.TenCellDao.getCellName" select="net.shapelight.modules.ten.dao.TenCellDao.getCellName"
column="cellId=cell_id"> column="cellId=cell_id">
@ -218,6 +221,15 @@
<if test="faceFailure != null"> <if test="faceFailure != null">
face_failure, face_failure,
</if> </if>
<if test="xaSync != null">
xa_sync,
</if>
<if test="xaSyncCard != null">
xa_sync_card,
</if>
<if test="xaSyncImage != null">
xa_sync_image,
</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="personId != null"> <if test="personId != null">
@ -337,6 +349,15 @@
<if test="faceFailure != null"> <if test="faceFailure != null">
#{faceFailure,jdbcType=TINYINT}, #{faceFailure,jdbcType=TINYINT},
</if> </if>
<if test="xaSync != null">
#{xaSync,jdbcType=TINYINT},
</if>
<if test="xaSyncCard != null">
#{xaSyncCard,jdbcType=TINYINT},
</if>
<if test="xaSyncImage != null">
#{xaSyncImage,jdbcType=TINYINT},
</if>
</trim> </trim>
</insert> </insert>
@ -461,6 +482,15 @@
<if test="faceFailure != null"> <if test="faceFailure != null">
face_failure = #{faceFailure,jdbcType=TINYINT}, face_failure = #{faceFailure,jdbcType=TINYINT},
</if> </if>
<if test="xaSync != null">
xa_sync = #{xaSync,jdbcType=TINYINT},
</if>
<if test="xaSyncCard != null">
xa_sync_card = #{xaSyncCard,jdbcType=TINYINT},
</if>
<if test="xaSyncImage != null">
xa_sync_image = #{xaSyncImage,jdbcType=TINYINT},
</if>
</set> </set>
where person_id = #{personId,jdbcType=BIGINT} where person_id = #{personId,jdbcType=BIGINT}
</update> </update>
@ -529,44 +559,44 @@
<select id="findPageAll" resultMap="BaseResultMap"> <select id="findPageAll" resultMap="BaseResultMap">
<!--SELECT alias.* from (--> <!--SELECT alias.* from (-->
<!--<foreach collection="cellIds" item="item" index="index" separator="union all">--> <!--<foreach collection="cellIds" item="item" index="index" separator="union all">-->
<!--select p.*,r.layer,r.room_name from ten_person_${item} p left join ten_room_${item} r--> <!--select p.*,r.layer,r.room_name from ten_person_${item} p left join ten_room_${item} r-->
<!--on p.room_id = r.room_id where p.delete_flag = 0--> <!--on p.room_id = r.room_id where p.delete_flag = 0-->
<!--<if test="params.buildId != null and params.buildId!=''">--> <!--<if test="params.buildId != null and params.buildId!=''">-->
<!--and r.build_id = #{params.buildId}--> <!--and r.build_id = #{params.buildId}-->
<!--</if>--> <!--</if>-->
<!--<if test="params.layer != null and params.layer!=''">--> <!--<if test="params.layer != null and params.layer!=''">-->
<!--and r.layer = #{params.layer}--> <!--and r.layer = #{params.layer}-->
<!--</if>--> <!--</if>-->
<!--<if test="params.roomName != null and params.roomName!=''">--> <!--<if test="params.roomName != null and params.roomName!=''">-->
<!--and r.room_name like CONCAT('%', '${params.roomName}', '%')--> <!--and r.room_name like CONCAT('%', '${params.roomName}', '%')-->
<!--</if>--> <!--</if>-->
<!--<if test="params.name != null and params.name!=''">--> <!--<if test="params.name != null and params.name!=''">-->
<!--and p.name like CONCAT('%', '${params.name}', '%')--> <!--and p.name like CONCAT('%', '${params.name}', '%')-->
<!--</if>--> <!--</if>-->
<!--<if test="params.gender != null and params.gender!=''">--> <!--<if test="params.gender != null and params.gender!=''">-->
<!--and p.gender = #{params.gender}--> <!--and p.gender = #{params.gender}-->
<!--</if>--> <!--</if>-->
<!--<if test="params.status != null and params.status!=''">--> <!--<if test="params.status != null and params.status!=''">-->
<!--and p.status = #{params.status}--> <!--and p.status = #{params.status}-->
<!--</if>--> <!--</if>-->
<!--<if test="params.idCard != null and params.idCard!=''">--> <!--<if test="params.idCard != null and params.idCard!=''">-->
<!--and p.id_card like CONCAT('%', '${params.idCard}', '%')--> <!--and p.id_card like CONCAT('%', '${params.idCard}', '%')-->
<!--</if>--> <!--</if>-->
<!--<if test="params.mobile != null and params.mobile!=''">--> <!--<if test="params.mobile != null and params.mobile!=''">-->
<!--and p.mobile like CONCAT('%', '${params.mobile}', '%')--> <!--and p.mobile like CONCAT('%', '${params.mobile}', '%')-->
<!--</if>--> <!--</if>-->
<!--<if test="params.personType != null and params.personType!=''">--> <!--<if test="params.personType != null and params.personType!=''">-->
<!--and p.person_type = #{params.personType}--> <!--and p.person_type = #{params.personType}-->
<!--</if>--> <!--</if>-->
<!--<if test="params.faceFailure != null and params.faceFailure!=''">--> <!--<if test="params.faceFailure != null and params.faceFailure!=''">-->
<!--and p.face_failure = #{params.faceFailure}--> <!--and p.face_failure = #{params.faceFailure}-->
<!--</if>--> <!--</if>-->
<!--<if test="params.personTypeList != null">--> <!--<if test="params.personTypeList != null">-->
<!--and p.person_type in--> <!--and p.person_type in-->
<!--<foreach item="personType" collection="params.personTypeList" open="(" separator="," close=")">--> <!--<foreach item="personType" collection="params.personTypeList" open="(" separator="," close=")">-->
<!--#{personType}--> <!--#{personType}-->
<!--</foreach>--> <!--</foreach>-->
<!--</if>--> <!--</if>-->
<!--</foreach>--> <!--</foreach>-->
<!--) alias where 1 = 1 order by alias.person_id desc--> <!--) alias where 1 = 1 order by alias.person_id desc-->
@ -627,19 +657,19 @@
<select id="findAllCount" resultType="int"> <select id="findAllCount" resultType="int">
<!--SELECT count(*) from (--> <!--SELECT count(*) from (-->
<!--<foreach collection="cellIds" item="item" index="index" separator="union all">--> <!--<foreach collection="cellIds" item="item" index="index" separator="union all">-->
<!--select person_id from ten_person_${item} where delete_flag = 0--> <!--select person_id from ten_person_${item} where delete_flag = 0-->
<!--<if test="params.status != null and params.status!=''">--> <!--<if test="params.status != null and params.status!=''">-->
<!--and status = #{params.status}--> <!--and status = #{params.status}-->
<!--</if>--> <!--</if>-->
<!--<if test="params.personType != null and params.personType!=''">--> <!--<if test="params.personType != null and params.personType!=''">-->
<!--and person_type = #{params.personType}--> <!--and person_type = #{params.personType}-->
<!--</if>--> <!--</if>-->
<!--<if test="params.personTypeList != null">--> <!--<if test="params.personTypeList != null">-->
<!--and person_type in--> <!--and person_type in-->
<!--<foreach item="personType" collection="params.personTypeList" open="(" separator="," close=")">--> <!--<foreach item="personType" collection="params.personTypeList" open="(" separator="," close=")">-->
<!--#{personType}--> <!--#{personType}-->
<!--</foreach>--> <!--</foreach>-->
<!--</if>--> <!--</if>-->
<!--</foreach>--> <!--</foreach>-->
<!--) alias where 1 = 1 order by alias.person_id desc--> <!--) alias where 1 = 1 order by alias.person_id desc-->
@ -670,20 +700,20 @@
<select id="findVerifyPageAll" resultMap="BaseResultMap"> <select id="findVerifyPageAll" resultMap="BaseResultMap">
<!--SELECT alias.* from (--> <!--SELECT alias.* from (-->
<!--<foreach collection="cellIds" item="item" index="index" separator="union all">--> <!--<foreach collection="cellIds" item="item" index="index" separator="union all">-->
<!--select p.*,r.layer,r.room_name from ten_person_${item} p left join ten_room_${item} r--> <!--select p.*,r.layer,r.room_name from ten_person_${item} p left join ten_room_${item} r-->
<!--on p.room_id = r.room_id where p.delete_flag = 0 and p.status != 0--> <!--on p.room_id = r.room_id where p.delete_flag = 0 and p.status != 0-->
<!--<if test="params.name != null and params.name!=''">--> <!--<if test="params.name != null and params.name!=''">-->
<!--and p.name like CONCAT('%', '${params.name}', '%')--> <!--and p.name like CONCAT('%', '${params.name}', '%')-->
<!--</if>--> <!--</if>-->
<!--<if test="params.gender != null and params.gender!=''">--> <!--<if test="params.gender != null and params.gender!=''">-->
<!--and p.gender = #{params.gender}--> <!--and p.gender = #{params.gender}-->
<!--</if>--> <!--</if>-->
<!--<if test="params.idCard != null and params.idCard!=''">--> <!--<if test="params.idCard != null and params.idCard!=''">-->
<!--and p.id_card like CONCAT('%', '${params.idCard}', '%')--> <!--and p.id_card like CONCAT('%', '${params.idCard}', '%')-->
<!--</if>--> <!--</if>-->
<!--<if test="params.mobile != null and params.mobile!=''">--> <!--<if test="params.mobile != null and params.mobile!=''">-->
<!--and p.mobile = #{params.mobile}--> <!--and p.mobile = #{params.mobile}-->
<!--</if>--> <!--</if>-->
<!--</foreach>--> <!--</foreach>-->
<!--) alias where 1 = 1 order by alias.person_id desc--> <!--) alias where 1 = 1 order by alias.person_id desc-->
@ -716,13 +746,13 @@
<select id="globalSearchPageAll" resultMap="BaseResultMap"> <select id="globalSearchPageAll" resultMap="BaseResultMap">
<!--SELECT alias.* from (--> <!--SELECT alias.* from (-->
<!--<foreach collection="cellIds" item="item" index="index" separator="union all">--> <!--<foreach collection="cellIds" item="item" index="index" separator="union all">-->
<!--select p.* from ten_person_${item} p--> <!--select p.* from ten_person_${item} p-->
<!--where p.delete_flag = 0--> <!--where p.delete_flag = 0-->
<!--<if test="params.key != null and params.key!=''">--> <!--<if test="params.key != null and params.key!=''">-->
<!--and (p.name like CONCAT('%', '${params.key}', '%')--> <!--and (p.name like CONCAT('%', '${params.key}', '%')-->
<!--or p.id_card like CONCAT('%', '${params.key}', '%')--> <!--or p.id_card like CONCAT('%', '${params.key}', '%')-->
<!--or p.mobile like CONCAT('%', '${params.key}', '%'))--> <!--or p.mobile like CONCAT('%', '${params.key}', '%'))-->
<!--</if>--> <!--</if>-->
<!--</foreach>--> <!--</foreach>-->
<!--) alias where 1 = 1--> <!--) alias where 1 = 1-->
@ -850,7 +880,7 @@
and person_type in(5000,5001,5002) and person_type in(5000,5001,5002)
and cell_id = #{cellId} and cell_id = #{cellId}
<!--<if test="cellId != null and cellId!=''">--> <!--<if test="cellId != null and cellId!=''">-->
<!--and cell_id = #{cellId}--> <!--and cell_id = #{cellId}-->
<!--</if>--> <!--</if>-->
</select> </select>
@ -869,4 +899,37 @@
and delete_flag = 0 and delete_flag = 0
</select> </select>
<select id="getOwner" resultType="net.shapelight.modules.ten.entity.TenPersonEntity">
select * from ten_person
where room_id = #{roomId}
and delete_flag = 0 and person_type = 5000
limit 1
</select>
<select id="getNotSync" resultType="net.shapelight.modules.ten.entity.TenPersonEntity">
select * from ten_person
where cell_id = #{cellId}
and delete_flag = 0 and (person_type = 5000 || person_type = 5001)
and xa_sync = 0
</select>
<select id="getNotSyncCard" resultType="net.shapelight.modules.ten.entity.TenPersonEntity">
select * from ten_person
where cell_id = #{cellId}
and delete_flag = 0 and (person_type = 5000 || person_type = 5001)
and xa_sync_card = 0
</select>
<select id="getNotSyncImage" resultType="net.shapelight.modules.ten.entity.TenPersonEntity">
select * from ten_person
where cell_id = #{cellId}
and delete_flag = 0 and (person_type = 5000 || person_type = 5001)
and xa_sync_image = 0
</select>
</mapper> </mapper>

View File

@ -3,7 +3,7 @@
<mapper namespace="net.shapelight.modules.ten.dao.TenRecordDao"> <mapper namespace="net.shapelight.modules.ten.dao.TenRecordDao">
<!-- 可根据自己的需求,是否要使用 --> <!-- -->
<resultMap type="net.shapelight.modules.ten.entity.TenRecordEntity" id="tenRecordMap"> <resultMap type="net.shapelight.modules.ten.entity.TenRecordEntity" id="tenRecordMap">
<result property="recordId" column="record_id"/> <result property="recordId" column="record_id"/>
<result property="cellId" column="cell_id"/> <result property="cellId" column="cell_id"/>
@ -17,6 +17,8 @@
<result property="recordTime" column="record_time"/> <result property="recordTime" column="record_time"/>
<result property="score" column="score"/> <result property="score" column="score"/>
<result property="tenantId" column="tenant_id"/> <result property="tenantId" column="tenant_id"/>
<result column="xa_sync" jdbcType="TINYINT" property="xaSync" />
<result column="xa_sync_image" jdbcType="TINYINT" property="xaSyncImage" />
</resultMap> </resultMap>
@ -59,6 +61,12 @@
<if test="tenantId != null"> <if test="tenantId != null">
tenant_id, tenant_id,
</if> </if>
<if test="xaSync != null">
xa_sync,
</if>
<if test="xaSyncImage != null">
xa_sync_image,
</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="recordId != null"> <if test="recordId != null">
@ -97,6 +105,12 @@
<if test="tenantId != null"> <if test="tenantId != null">
#{tenantId,jdbcType=BIGINT}, #{tenantId,jdbcType=BIGINT},
</if> </if>
<if test="xaSync != null">
#{xaSync},
</if>
<if test="xaSyncImage != null">
#{xaSyncImage},
</if>
</trim> </trim>
</insert> </insert>
@ -140,6 +154,12 @@
<if test="tenantId != null"> <if test="tenantId != null">
tenant_id = #{tenantId,jdbcType=BIGINT}, tenant_id = #{tenantId,jdbcType=BIGINT},
</if> </if>
<if test="xaSync != null">
xa_sync = #{xaSync,jdbcType=TINYINT},
</if>
<if test="xaSyncImage != null">
xa_sync_image = #{xaSyncImage,jdbcType=TINYINT},
</if>
</set> </set>
where record_id = #{recordId,jdbcType=BIGINT} where record_id = #{recordId,jdbcType=BIGINT}
</update> </update>
@ -159,20 +179,20 @@
<select id="findPageAll" resultMap="tenRecordMap"> <select id="findPageAll" resultMap="tenRecordMap">
<!--SELECT alias.* from (--> <!--SELECT alias.* from (-->
<!--<foreach collection="cellIds" item="item" index="index" separator="union all">--> <!--<foreach collection="cellIds" item="item" index="index" separator="union all">-->
<!--select r.*,t.name from ten_record_${item} r left join ten_person_${item} t on r.person_id = t.person_id--> <!--select r.*,t.name from ten_record_${item} r left join ten_person_${item} t on r.person_id = t.person_id-->
<!--</foreach>--> <!--</foreach>-->
<!--) alias where 1=1--> <!--) alias where 1=1-->
<!--<if test="params.cellId != null and params.cellId!=''">--> <!--<if test="params.cellId != null and params.cellId!=''">-->
<!--and alias.cell_id = #{params.cellId}--> <!--and alias.cell_id = #{params.cellId}-->
<!--</if>--> <!--</if>-->
<!--<if test="params.name != null and params.name!=''">--> <!--<if test="params.name != null and params.name!=''">-->
<!--and `name` like CONCAT('%', '${params.name}', '%')--> <!--and `name` like CONCAT('%', '${params.name}', '%')-->
<!--</if>--> <!--</if>-->
<!--<if test="params.recordTimeStart != null and params.recordTimeStart!=''">--> <!--<if test="params.recordTimeStart != null and params.recordTimeStart!=''">-->
<!--and `record_time` &gt;= #{params.recordTimeStart}--> <!--and `record_time` &gt;= #{params.recordTimeStart}-->
<!--</if>--> <!--</if>-->
<!--<if test="params.recordTimeEnd != null and params.recordTimeStart!=''">--> <!--<if test="params.recordTimeEnd != null and params.recordTimeStart!=''">-->
<!--and `record_time` &lt; #{params.recordTimeEnd}--> <!--and `record_time` &lt; #{params.recordTimeEnd}-->
<!--</if>--> <!--</if>-->
<!--order by record_time desc--> <!--order by record_time desc-->
@ -204,20 +224,20 @@
<select id="findAll" resultMap="tenRecordMap"> <select id="findAll" resultMap="tenRecordMap">
<!--SELECT alias.* from (--> <!--SELECT alias.* from (-->
<!--<foreach collection="cellIds" item="item" index="index" separator="union all">--> <!--<foreach collection="cellIds" item="item" index="index" separator="union all">-->
<!--select r.*,t.name from ten_record_${item} r left join ten_person_${item} t on r.person_id = t.person_id--> <!--select r.*,t.name from ten_record_${item} r left join ten_person_${item} t on r.person_id = t.person_id-->
<!--</foreach>--> <!--</foreach>-->
<!--) alias where 1=1--> <!--) alias where 1=1-->
<!--<if test="params.cellId != null and params.cellId!=''">--> <!--<if test="params.cellId != null and params.cellId!=''">-->
<!--and alias.cell_id = #{params.cellId}--> <!--and alias.cell_id = #{params.cellId}-->
<!--</if>--> <!--</if>-->
<!--<if test="params.name != null and params.name!=''">--> <!--<if test="params.name != null and params.name!=''">-->
<!--and `name` like CONCAT('%', '${params.name}', '%')--> <!--and `name` like CONCAT('%', '${params.name}', '%')-->
<!--</if>--> <!--</if>-->
<!--<if test="params.recordTimeStart != null and params.recordTimeStart!=''">--> <!--<if test="params.recordTimeStart != null and params.recordTimeStart!=''">-->
<!--and `record_time` &gt;= #{params.recordTimeStart}--> <!--and `record_time` &gt;= #{params.recordTimeStart}-->
<!--</if>--> <!--</if>-->
<!--<if test="params.recordTimeEnd != null and params.recordTimeStart!=''">--> <!--<if test="params.recordTimeEnd != null and params.recordTimeStart!=''">-->
<!--and `record_time` &lt; #{params.recordTimeEnd}--> <!--and `record_time` &lt; #{params.recordTimeEnd}-->
<!--</if>--> <!--</if>-->
<!--order by record_time desc--> <!--order by record_time desc-->
@ -249,17 +269,17 @@
<select id="findHourAll" resultType="int"> <select id="findHourAll" resultType="int">
<!--SELECT count(*) from (--> <!--SELECT count(*) from (-->
<!--<foreach collection="cellIds" item="item" index="index" separator="union all">--> <!--<foreach collection="cellIds" item="item" index="index" separator="union all">-->
<!--select record_id,cell_id,record_time from ten_record_${item}--> <!--select record_id,cell_id,record_time from ten_record_${item}-->
<!--</foreach>--> <!--</foreach>-->
<!--) alias where 1=1--> <!--) alias where 1=1-->
<!--<if test="params.cellId != null and params.cellId!=''">--> <!--<if test="params.cellId != null and params.cellId!=''">-->
<!--and alias.cell_id = #{params.cellId}--> <!--and alias.cell_id = #{params.cellId}-->
<!--</if>--> <!--</if>-->
<!--<if test="params.recordTimeStart != null and params.recordTimeStart!=''">--> <!--<if test="params.recordTimeStart != null and params.recordTimeStart!=''">-->
<!--and `record_time` &gt;= #{params.recordTimeStart}--> <!--and `record_time` &gt;= #{params.recordTimeStart}-->
<!--</if>--> <!--</if>-->
<!--<if test="params.recordTimeEnd != null and params.recordTimeStart!=''">--> <!--<if test="params.recordTimeEnd != null and params.recordTimeStart!=''">-->
<!--and `record_time` &lt; #{params.recordTimeEnd}--> <!--and `record_time` &lt; #{params.recordTimeEnd}-->
<!--</if>--> <!--</if>-->
<!--order by record_time desc--> <!--order by record_time desc-->
@ -286,23 +306,23 @@
<select id="findPageBlackRecord" resultMap="tenRecordMap"> <select id="findPageBlackRecord" resultMap="tenRecordMap">
<!--SELECT alias.* from (--> <!--SELECT alias.* from (-->
<!--<foreach collection="cellIds" item="item" index="index" separator="union all">--> <!--<foreach collection="cellIds" item="item" index="index" separator="union all">-->
<!--select r.*,t.name from ten_record_${item} r--> <!--select r.*,t.name from ten_record_${item} r-->
<!--left join ten_person_${item} t on r.person_id = t.person_id--> <!--left join ten_person_${item} t on r.person_id = t.person_id-->
<!--where t.delete_flag = 0--> <!--where t.delete_flag = 0-->
<!--and t.person_type = 5008--> <!--and t.person_type = 5008-->
<!--</foreach>--> <!--</foreach>-->
<!--) alias where 1=1--> <!--) alias where 1=1-->
<!--<if test="params.cellId != null and params.cellId!=''">--> <!--<if test="params.cellId != null and params.cellId!=''">-->
<!--and alias.cell_id = #{params.cellId}--> <!--and alias.cell_id = #{params.cellId}-->
<!--</if>--> <!--</if>-->
<!--<if test="params.name != null and params.name!=''">--> <!--<if test="params.name != null and params.name!=''">-->
<!--and `name` like CONCAT('%', '${params.name}', '%')--> <!--and `name` like CONCAT('%', '${params.name}', '%')-->
<!--</if>--> <!--</if>-->
<!--<if test="params.recordTimeStart != null and params.recordTimeStart!=''">--> <!--<if test="params.recordTimeStart != null and params.recordTimeStart!=''">-->
<!--and `record_time` &gt;= #{params.recordTimeStart}--> <!--and `record_time` &gt;= #{params.recordTimeStart}-->
<!--</if>--> <!--</if>-->
<!--<if test="params.recordTimeEnd != null and params.recordTimeStart!=''">--> <!--<if test="params.recordTimeEnd != null and params.recordTimeStart!=''">-->
<!--and `record_time` &lt; #{params.recordTimeEnd}--> <!--and `record_time` &lt; #{params.recordTimeEnd}-->
<!--</if>--> <!--</if>-->
<!--order by record_time desc--> <!--order by record_time desc-->
@ -340,19 +360,19 @@
<!--left join ten_person_${params.cellId} t on r.person_id = t.person_id--> <!--left join ten_person_${params.cellId} t on r.person_id = t.person_id-->
<!--where 1=1--> <!--where 1=1-->
<!--<if test="params.cellId != null and params.cellId!=''">--> <!--<if test="params.cellId != null and params.cellId!=''">-->
<!--and t.cell_id = #{params.cellId}--> <!--and t.cell_id = #{params.cellId}-->
<!--</if>--> <!--</if>-->
<!--<if test="params.roomId != null and params.roomId!=''">--> <!--<if test="params.roomId != null and params.roomId!=''">-->
<!--and t.room_id = #{params.roomId}--> <!--and t.room_id = #{params.roomId}-->
<!--</if>--> <!--</if>-->
<!--<if test="params.name != null and params.name!=''">--> <!--<if test="params.name != null and params.name!=''">-->
<!--and `name` like CONCAT('%', '${params.name}', '%')--> <!--and `name` like CONCAT('%', '${params.name}', '%')-->
<!--</if>--> <!--</if>-->
<!--<if test="params.recordTimeStart != null and params.recordTimeStart!=''">--> <!--<if test="params.recordTimeStart != null and params.recordTimeStart!=''">-->
<!--and `record_time` &gt;= #{params.recordTimeStart}--> <!--and `record_time` &gt;= #{params.recordTimeStart}-->
<!--</if>--> <!--</if>-->
<!--<if test="params.recordTimeEnd != null and params.recordTimeStart!=''">--> <!--<if test="params.recordTimeEnd != null and params.recordTimeStart!=''">-->
<!--and `record_time` &lt; #{params.recordTimeEnd}--> <!--and `record_time` &lt; #{params.recordTimeEnd}-->
<!--</if>--> <!--</if>-->
<!--order by record_time desc--> <!--order by record_time desc-->
@ -384,5 +404,17 @@
order by record_time desc limit 1 order by record_time desc limit 1
</select> </select>
<select id="getNotSync" resultType="net.shapelight.modules.ten.entity.TenRecordEntity">
select * from ten_record_${tenantId}
where cell_id = #{cellId}
and xa_sync = 0
</select>
<select id="getNotSyncImage" resultType="net.shapelight.modules.ten.entity.TenRecordEntity">
select * from ten_record_${tenantId}
where cell_id = #{cellId}
and xa_sync_image = 0
</select>
</mapper> </mapper>

View File

@ -27,6 +27,9 @@
<result column="remark" jdbcType="VARCHAR" property="remark" /> <result column="remark" jdbcType="VARCHAR" property="remark" />
<result column="delete_flag" jdbcType="TINYINT" property="deleteFlag" /> <result column="delete_flag" jdbcType="TINYINT" property="deleteFlag" />
<result column="tenant_id" jdbcType="BIGINT" property="tenantId" /> <result column="tenant_id" jdbcType="BIGINT" property="tenantId" />
<result column="xa_sync" jdbcType="TINYINT" property="xaSync" />
<result column="p_id" jdbcType="VARCHAR" property="pId" />
<result column="dzbm" jdbcType="VARCHAR" property="dzbm" />
<association property="buildName" javaType="String" <association property="buildName" javaType="String"
select="net.shapelight.modules.ten.dao.TenBuildDao.getBuildName" select="net.shapelight.modules.ten.dao.TenBuildDao.getBuildName"
column="buildId=build_id,cellId=cell_id"> column="buildId=build_id,cellId=cell_id">
@ -113,6 +116,15 @@
<if test="tenantId != null"> <if test="tenantId != null">
tenant_id, tenant_id,
</if> </if>
<if test="xaSync != null">
xa_sync,
</if>
<if test="pId != null">
p_id,
</if>
<if test="dzbm != null">
dzbm,
</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="roomId != null"> <if test="roomId != null">
@ -184,6 +196,15 @@
<if test="tenantId != null"> <if test="tenantId != null">
#{tenantId,jdbcType=BIGINT}, #{tenantId,jdbcType=BIGINT},
</if> </if>
<if test="xaSync != null">
#{xaSync,jdbcType=TINYINT},
</if>
<if test="pId != null">
#{pId,jdbcType=VARCHAR},
</if>
<if test="dzbm != null">
#{dzbm,jdbcType=VARCHAR},
</if>
</trim> </trim>
</insert> </insert>
@ -261,6 +282,15 @@
<if test="tenantId != null"> <if test="tenantId != null">
tenant_id = #{tenantId,jdbcType=BIGINT}, tenant_id = #{tenantId,jdbcType=BIGINT},
</if> </if>
<if test="xaSync != null">
xa_sync = #{xaSync,jdbcType=TINYINT},
</if>
<if test="pId != null">
p_id = #{pId,jdbcType=VARCHAR},
</if>
<if test="dzbm != null">
dabm = #{dzbm,jdbcType=VARCHAR},
</if>
</set> </set>
where room_id = #{roomId,jdbcType=BIGINT} where room_id = #{roomId,jdbcType=BIGINT}
</update> </update>
@ -276,7 +306,7 @@
</delete> </delete>
<delete id="logicDeleteById"> <delete id="logicDeleteById">
update ten_room_$ set delete_flag = 1 update ten_room set delete_flag = 1
where room_id = #{roomId,jdbcType=BIGINT} where room_id = #{roomId,jdbcType=BIGINT}
</delete> </delete>
@ -292,25 +322,25 @@
<!--<select id="findPageAll" resultMap="BaseResultMap">--> <!--<select id="findPageAll" resultMap="BaseResultMap">-->
<!--select * from ten_room_${cellId} where delete_flag = 0--> <!--select * from ten_room_${cellId} where delete_flag = 0-->
<!--</select>--> <!--</select>-->
<select id="findPageAll" resultMap="BaseResultMap" > <select id="findPageAll" resultMap="BaseResultMap" >
<!--SELECT alias.* from (--> <!--SELECT alias.* from (-->
<!--<foreach collection="cellIds" item="item" index="index" separator="union all">--> <!--<foreach collection="cellIds" item="item" index="index" separator="union all">-->
<!--select * from ten_room_${item}--> <!--select * from ten_room_${item}-->
<!--</foreach>--> <!--</foreach>-->
<!--) alias where delete_flag = 0--> <!--) alias where delete_flag = 0-->
<!--<if test="params.buildId != null and params.buildId!=''">--> <!--<if test="params.buildId != null and params.buildId!=''">-->
<!--and alias.build_id = #{params.buildId}--> <!--and alias.build_id = #{params.buildId}-->
<!--</if>--> <!--</if>-->
<!--<if test="params.layer != null and params.layer!=''">--> <!--<if test="params.layer != null and params.layer!=''">-->
<!--and alias.layer = #{params.layer}--> <!--and alias.layer = #{params.layer}-->
<!--</if>--> <!--</if>-->
<!--<if test="params.roomName != null and params.roomName!=''">--> <!--<if test="params.roomName != null and params.roomName!=''">-->
<!--and room_name like CONCAT('%', '${params.roomName}', '%')--> <!--and room_name like CONCAT('%', '${params.roomName}', '%')-->
<!--</if>--> <!--</if>-->
<!--<if test="params.roomNumber != null and params.roomNumber!=''">--> <!--<if test="params.roomNumber != null and params.roomNumber!=''">-->
<!--and room_number = #{params.roomNumber}--> <!--and room_number = #{params.roomNumber}-->
<!--</if>--> <!--</if>-->
select * from ten_room where delete_flag = 0 select * from ten_room where delete_flag = 0
@ -339,10 +369,10 @@
<select id="getAllCount" resultType="int" > <select id="getAllCount" resultType="int" >
<!--SELECT count(*) from (--> <!--SELECT count(*) from (-->
<!--<foreach collection="cellIds" item="item" index="index" separator="union all">--> <!--<foreach collection="cellIds" item="item" index="index" separator="union all">-->
<!--select room_id from ten_room_${item} where delete_flag = 0--> <!--select room_id from ten_room_${item} where delete_flag = 0-->
<!--<if test="params.type != null and params.type!=''">--> <!--<if test="params.type != null and params.type!=''">-->
<!--and type = #{params.type}--> <!--and type = #{params.type}-->
<!--</if>--> <!--</if>-->
<!--</foreach>--> <!--</foreach>-->
<!--) alias--> <!--) alias-->
@ -384,4 +414,13 @@
</select> </select>
<select id="getNotSync" resultType="net.shapelight.modules.ten.entity.TenRoomEntity">
select * from ten_room where delete_flag = 0
and xa_sync = 0
and cell_id = #{cellId}
</select>
</mapper> </mapper>