diff --git a/shapelight-admin/src/main/java/net/shapelight/common/utils/MD5Utils.java b/shapelight-admin/src/main/java/net/shapelight/common/utils/MD5Utils.java index 69d0537..a9f0212 100644 --- a/shapelight-admin/src/main/java/net/shapelight/common/utils/MD5Utils.java +++ b/shapelight-admin/src/main/java/net/shapelight/common/utils/MD5Utils.java @@ -54,6 +54,29 @@ public class MD5Utils { 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) { diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/car/controller/CarOpenApi.java b/shapelight-admin/src/main/java/net/shapelight/modules/car/controller/CarOpenApi.java index 0903068..5108b19 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/car/controller/CarOpenApi.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/car/controller/CarOpenApi.java @@ -1,63 +1,78 @@ package net.shapelight.modules.car.controller; - -import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; +import io.minio.MinioClient; +import io.minio.PutObjectOptions; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; 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 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 -@RequestMapping("/api/car/v1") +@RequestMapping({"/api/car/v1"}) @Api("停车接口") -@Slf4j public class CarOpenApi { + private static final Logger log = LoggerFactory.getLogger(net.shapelight.modules.car.controller.CarOpenApi.class); @Autowired private TenCarService tenCarService; + @Autowired private TenPackRecordService tenPackRecordService; - @PostMapping("/getMsg/{cellId}") - @ApiOperation(value = "获取Msg") - @ApiImplicitParams({ - @ApiImplicitParam(name = "sn", value = "设备SN", paramType = "query", dataType = "String", required = true), - }) - public R getMsg(@PathVariable("cellId") Long cellId, @RequestParam Map params) { + @Autowired + private GlobalValue globalValue; + @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 params) { JSONObject msgJson = JSONObject.parseObject((String) params.get("Msg")); - int cmd = msgJson.getInteger("command"); - /* - 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"}' - */ + int cmd = msgJson.getInteger("command").intValue(); if (cmd == 13 || cmd == 19 || cmd == 20) { TenCarEntity car = new TenCarEntity(); car.setCellId(cellId); @@ -72,38 +87,24 @@ public class CarOpenApi { car.setEndTime(msgJson.getDate("endtime")); car.setParkName(msgJson.getString("parkname")); car.setTelephone(msgJson.getString("telephone")); - tenCarService.saveOrUpdate(car); - } - /* - 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) { //识别记录 + this.tenCarService.saveOrUpdate(car); + } else if (cmd == 1 || cmd == 2) { TenPackRecordEntity record = new TenPackRecordEntity(); - record.setParkId(msgJson.getString("parkid")); record.setRecordId(msgJson.getString("recordid")); - record.setCellId(cellId); record.setVlp(msgJson.getString("VLP")); record.setCTypeName(msgJson.getString("Ctypename")); record.setVTypeName(msgJson.getString("Vtypename")); record.setOperator(msgJson.getString("operator")); record.setDirection(msgJson.getInteger("direction")); - if (cmd ==1) { + if (cmd == 1) { record.setInChannelName(msgJson.getString("inchannelname")); record.setInTime(msgJson.getDate("intime")); record.setInPicture(msgJson.getString("inpicture")); record.setInPictureBase64(msgJson.getString("inpicturedata")); record.setInPicturePlate(msgJson.getString("inpicture1")); record.setInPicturePlateBase64(msgJson.getString("inpicturedata1")); - } record.setOutChannelName(msgJson.getString("outchannelname")); record.setOutTime(msgJson.getDate("outtime")); @@ -111,18 +112,144 @@ public class CarOpenApi { record.setOutPictureBase64(msgJson.getString("outpicturedata")); record.setOutPicturePlate(msgJson.getString("outpicture1")); record.setOutPicturePlateBase64(msgJson.getString("outpicturedata1")); - record.setInVlp(msgJson.getString("inVLP")); record.setParkName(msgJson.getString("parkname")); - record.setReceivableFee(msgJson.getString("receivablefee")); record.setActualFee(msgJson.getString("actualfee")); - - tenPackRecordService.saveOrUpdateByRecordId(record); - - + this.tenPackRecordService.saveOrUpdateByRecordId(record); } - return R.ok(); } + + @PostMapping({"/pushEnterRecord"}) + @ApiOperation("第三方推送入场记录") + public Map pushEnterRecord(@RequestBody Object object) { + Map 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 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; + } } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/car/utils/SignUtil.java b/shapelight-admin/src/main/java/net/shapelight/modules/car/utils/SignUtil.java new file mode 100644 index 0000000..9bbe909 --- /dev/null +++ b/shapelight-admin/src/main/java/net/shapelight/modules/car/utils/SignUtil.java @@ -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; + } +} \ No newline at end of file diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/job/task/XaAddressTask.java b/shapelight-admin/src/main/java/net/shapelight/modules/job/task/XaAddressTask.java new file mode 100644 index 0000000..7adf13c --- /dev/null +++ b/shapelight-admin/src/main/java/net/shapelight/modules/job/task/XaAddressTask.java @@ -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 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 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定时任务执行完毕"); + } +} diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/job/task/XaImageTask.java b/shapelight-admin/src/main/java/net/shapelight/modules/job/task/XaImageTask.java new file mode 100644 index 0000000..3329d72 --- /dev/null +++ b/shapelight-admin/src/main/java/net/shapelight/modules/job/task/XaImageTask.java @@ -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 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 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 records = this.tenRecordService.getNotSyncImage(cellId, tenantId); + List 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 records = this.tenPackRecordService.getNotSync(cellId); + List syncrecords = new ArrayList<>(); + int count = 0; + for (TenPackRecordEntity record : records) { + XaTCCTCSBZPXX syncRecord = new XaTCCTCSBZPXX(); + syncRecord.setLV_ZPSJ(DateUtils.format(record.getInTime(), "yyyyMMdd24HHmmss")); + syncrecords.add(syncRecord); + count++; + if (count >= 60) + break; + } + } + + private void processPerson(String appId, String appSecret, String xqid, String fwikUrl, Long cellId) { + List persons = this.tenPersonService.getNotSyncImage(cellId); + List 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; + } + } +} diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/job/task/XaRealDataTask.java b/shapelight-admin/src/main/java/net/shapelight/modules/job/task/XaRealDataTask.java new file mode 100644 index 0000000..18af5d5 --- /dev/null +++ b/shapelight-admin/src/main/java/net/shapelight/modules/job/task/XaRealDataTask.java @@ -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 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 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 rooms = this.tenRoomService.getNotSync(cellId); + List 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 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 realPersons = this.tenPersonService.getNotSync(cellId); + List 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 realPersons = this.tenPersonService.getNotSyncCard(cellId); + List 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 realDevices = this.tenDeviceService.getNotSync(cellId); + List 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; + } + } +} diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/job/task/XaRecordTask.java b/shapelight-admin/src/main/java/net/shapelight/modules/job/task/XaRecordTask.java new file mode 100644 index 0000000..be1e067 --- /dev/null +++ b/shapelight-admin/src/main/java/net/shapelight/modules/job/task/XaRecordTask.java @@ -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 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 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 records = this.tenRecordService.getNotSync(cellId, tenantId); + List 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 records = this.tenPackRecordService.getNotSync(cellId); + List 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; + } + } +} diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/sys/controller/SysDeviceController.java b/shapelight-admin/src/main/java/net/shapelight/modules/sys/controller/SysDeviceController.java index fcd8e75..4c34d5f 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/sys/controller/SysDeviceController.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/sys/controller/SysDeviceController.java @@ -8,6 +8,7 @@ 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.StringUtils; import net.shapelight.modules.nettyapi.service.ServerApiService; import net.shapelight.modules.sys.entity.SysDeviceEntity; import net.shapelight.modules.sys.service.SysDeviceService; @@ -72,8 +73,11 @@ public class SysDeviceController { @RequiresPermissions("sys:device") @ApiOperation(value = "保存") 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(); } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/sys/controller/SysUserController.java b/shapelight-admin/src/main/java/net/shapelight/modules/sys/controller/SysUserController.java index e15d15e..ed48ef8 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/sys/controller/SysUserController.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/sys/controller/SysUserController.java @@ -32,10 +32,7 @@ import org.apache.shiro.crypto.hash.Sha256Hash; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; -import java.util.Arrays; -import java.util.Date; -import java.util.List; -import java.util.Map; +import java.util.*; /** * 系统用户 @@ -137,15 +134,17 @@ public class SysUserController extends AbstractController { @RequiresPermissions("sys:user:save") @ApiOperation("保存用户") public R save(@RequestBody SysUserEntity user){ - ValidatorUtils.validateEntity(user, AddGroup.class); - long id = new SnowflakeIdWorker().nextId(); - user.setUserId(id); + ValidatorUtils.validateEntity(user, new Class[] { AddGroup.class }); + long id = (new SnowflakeIdWorker()).nextId(); + user.setUserId(Long.valueOf(id)); user.setCreateBy(getUser().getUsername()); user.setCreateTime(new Date()); - //user.setUserType(Constant.SYSTEM_USER); - user.setUserType(Constant.SYSTEM_USER); - //user.setStatus(1); - sysUserService.saveUser(user); + user.setUserType(Integer.valueOf(1)); + List roleIdList = new ArrayList<>(); + Long role = Long.valueOf(100L); + roleIdList.add(role); + user.setRoleIdList(roleIdList); + this.sysUserService.saveUser(user); return R.ok(); } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/systen/controller/SysTenUserController.java b/shapelight-admin/src/main/java/net/shapelight/modules/systen/controller/SysTenUserController.java index 27e4c24..64488fe 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/systen/controller/SysTenUserController.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/systen/controller/SysTenUserController.java @@ -96,11 +96,15 @@ public class SysTenUserController extends AbstractController { public R save(@RequestBody SysUserEntity user){ ValidatorUtils.validateEntity(user, AddGroup.class); long id = new SnowflakeIdWorker().nextId(); - user.setUserId(id); + user.setUserId(Long.valueOf(id)); user.setCreateBy(getUser().getNickName()); user.setCreateTime(new Date()); - user.setUserType(Constant.TENANT_ADMIN); - user.setTenantId(id); + user.setUserType(Integer.valueOf(2)); + user.setTenantId(Long.valueOf(id)); + List roleIdList = new ArrayList<>(); + Long role = Long.valueOf(1000L); + roleIdList.add(role); + user.setRoleIdList(roleIdList); try { sysUserService.saveUserSysTen(user); }catch (DuplicateKeyException e){ diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenPackChannalController.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenPackChannalController.java new file mode 100644 index 0000000..420ad84 --- /dev/null +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenPackChannalController.java @@ -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 params) { + String tenantId = getUser().getTenantId()+""; + params.put("tenantId",tenantId+""); + SysUserEntity user = getUser(); + List roleIdList = sysUserRoleService.queryRoleIdList(user.getUserId()); + //小区管理员 + if(roleIdList.get(0).longValue() == Constant.ROLE_TEN_CELL){ + TenUserScopeEntity scope = tenUserScopeService.getOne(new QueryWrapper().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(); + } +} \ No newline at end of file diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenPackController.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenPackController.java new file mode 100644 index 0000000..198316a --- /dev/null +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenPackController.java @@ -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 params) { + String tenantId = getUser().getTenantId()+""; + params.put("tenantId",tenantId+""); + SysUserEntity user = getUser(); + List roleIdList = sysUserRoleService.queryRoleIdList(user.getUserId()); + //小区管理员 + if(roleIdList.get(0).longValue() == Constant.ROLE_TEN_CELL){ + TenUserScopeEntity scope = tenUserScopeService.getOne(new QueryWrapper().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 tenPacks = this.tenPackService.list(new QueryWrapper() + .eq("cell_id",cellId)); + return R.ok().put("data", tenPacks); + } +} \ No newline at end of file diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenPackRecordEnterController.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenPackRecordEnterController.java new file mode 100644 index 0000000..d8cdf0d --- /dev/null +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenPackRecordEnterController.java @@ -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 params) { + String tenantId = getUser().getTenantId()+""; + params.put("tenantId",tenantId+""); + SysUserEntity user = getUser(); + List roleIdList = sysUserRoleService.queryRoleIdList(user.getUserId()); + //小区管理员 + if(roleIdList.get(0).longValue() == Constant.ROLE_TEN_CELL){ + TenUserScopeEntity scope = tenUserScopeService.getOne(new QueryWrapper().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(); + } +} diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenPackRecordExitController.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenPackRecordExitController.java new file mode 100644 index 0000000..3dd8e88 --- /dev/null +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenPackRecordExitController.java @@ -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 params) { + String tenantId = getUser().getTenantId()+""; + params.put("tenantId",tenantId+""); + SysUserEntity user = getUser(); + List roleIdList = sysUserRoleService.queryRoleIdList(user.getUserId()); + //小区管理员 + if(roleIdList.get(0).longValue() == Constant.ROLE_TEN_CELL){ + TenUserScopeEntity scope = tenUserScopeService.getOne(new QueryWrapper().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(); + } +} \ No newline at end of file diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/dao/TenPackChannalDao.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/dao/TenPackChannalDao.java new file mode 100644 index 0000000..2cc36f1 --- /dev/null +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/dao/TenPackChannalDao.java @@ -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 { +} diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/dao/TenPackDao.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/dao/TenPackDao.java new file mode 100644 index 0000000..12ed088 --- /dev/null +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/dao/TenPackDao.java @@ -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 { +} \ No newline at end of file diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/dao/TenPackRecordDao.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/dao/TenPackRecordDao.java index 52dcad4..d318afb 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/dao/TenPackRecordDao.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/dao/TenPackRecordDao.java @@ -24,4 +24,8 @@ public interface TenPackRecordDao { TenPackRecordEntity selectByRecordIdAndPackId(@Param("recordId")String recordId, @Param("parkId")String parkId,@Param("cellId")Long cellId); IPage findPageAll(Page page, @Param("cellIds") List cellIds, @Param("params") Map params); + List getNotSync(@Param("cellId") Long paramLong); + + List getNotSyncImage(@Param("cellId") Long paramLong); + } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/dao/TenPackRecordEnterDao.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/dao/TenPackRecordEnterDao.java new file mode 100644 index 0000000..76b863a --- /dev/null +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/dao/TenPackRecordEnterDao.java @@ -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 { +} diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/dao/TenPackRecordExitDao.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/dao/TenPackRecordExitDao.java new file mode 100644 index 0000000..eb8ad4a --- /dev/null +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/dao/TenPackRecordExitDao.java @@ -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 { +} diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/dao/TenPersonDao.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/dao/TenPersonDao.java index 9b21cc1..03123a0 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/dao/TenPersonDao.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/dao/TenPersonDao.java @@ -80,6 +80,14 @@ public interface TenPersonDao { List getAllExpireGuest(); + TenPersonEntity getOwner(@Param("roomId") Long paramLong); + + List getNotSync(@Param("cellId") Long paramLong); + + List getNotSyncCard(@Param("cellId") Long paramLong); + + List getNotSyncImage(@Param("cellId") Long paramLong); + } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/dao/TenRecordDao.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/dao/TenRecordDao.java index 90f7719..18277a6 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/dao/TenRecordDao.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/dao/TenRecordDao.java @@ -11,26 +11,32 @@ import java.util.List; import java.util.Map; /** - * * */ @Mapper -public interface TenRecordDao{ +public interface TenRecordDao { 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); - TenRecordEntity selectById(@Param("recordId")Long recordId,@Param("tenantId")Long tenantId); - IPage findPageAll(Page page, @Param("cellIds")List cellIds, @Param("params") Map params); - List findAll(@Param("cellIds")List cellIds, @Param("params") Map params); + TenRecordEntity selectById(@Param("recordId") Long recordId, @Param("tenantId") Long tenantId); - int findHourAll(@Param("cellIds")List cellIds, @Param("params") Map params); + IPage findPageAll(Page page, @Param("cellIds") List cellIds, @Param("params") Map params); - IPage findPageBlackRecord(Page page, @Param("cellIds")List cellIds, @Param("params") Map params); + List findAll(@Param("cellIds") List cellIds, @Param("params") Map params); - IPage findPageRoomRecord(Page page,@Param("params") Map params); + int findHourAll(@Param("cellIds") List cellIds, @Param("params") Map params); - String findLastRecordTime(@Param("personId")Long personId,@Param("tenantId")Long tenantId); + IPage findPageBlackRecord(Page page, @Param("cellIds") List cellIds, @Param("params") Map params); + IPage findPageRoomRecord(Page page, @Param("params") Map params); + + String findLastRecordTime(@Param("personId") Long personId, @Param("tenantId") Long tenantId); + + List getNotSync(@Param("cellId") Long paramLong1, @Param("tenantId") Long paramLong2); + + List getNotSyncImage(@Param("cellId") Long paramLong1, @Param("tenantId") Long paramLong2); } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/dao/TenRoomDao.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/dao/TenRoomDao.java index 8756e4f..85a234d 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/dao/TenRoomDao.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/dao/TenRoomDao.java @@ -45,5 +45,7 @@ public interface TenRoomDao { @Param("buildId")Long buildId, @Param("cellId")Long cellId); + List getNotSync(@Param("cellId") Long paramLong); + } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/entity/TenDeviceEntity.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/entity/TenDeviceEntity.java index 2c6fa7c..ffa3049 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/entity/TenDeviceEntity.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/entity/TenDeviceEntity.java @@ -16,216 +16,216 @@ import net.shapelight.common.base.BaseEntity; /** * 设备表 - * */ @Data @TableName("ten_device") public class TenDeviceEntity extends BaseEntity implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - /** - * id - */ - @TableId - @JsonSerialize(using = ToStringSerializer.class) - @ApiModelProperty("设备ID") - private Long deviceId; - /** - * 设备名称 - */ - @ApiModelProperty("设备名称") - private String name; - /** - * 序列号 - */ - @ApiModelProperty("设备序列号") - private String sn; - /** - * mac地址 - */ - @ApiModelProperty("设备MAC地址") - private String mac; - /** - * 1大门2单元门3室内机 - */ - @ApiModelProperty("设备类型") - private Integer type; - /** - * 0进1出 - */ - @ApiModelProperty("进出方向") - private Integer gateFlag; - /** - * 小区id - */ - @JsonSerialize(using = ToStringSerializer.class) - @ApiModelProperty("小区ID") - private Long cellId; - /** - * 楼栋编号 - */ - @ApiModelProperty("楼栋编号") - private String buildNumber; - /** - * 楼栋单元 - */ - @JsonSerialize(using = ToStringSerializer.class) - @ApiModelProperty("楼栋单元") - private Long buildId; - /** - * 户室ID - */ - @JsonSerialize(using = ToStringSerializer.class) - @ApiModelProperty("户室ID") - private Long roomId; - /** - * 运营商Id - */ - @JsonSerialize(using = ToStringSerializer.class) - @ApiModelProperty("运营商ID") - private Long tenantId; - /** - * apk版本 - */ - @ApiModelProperty("apk版本") - private String apkVersion; - /** - * 人脸库 - */ - @ApiModelProperty("人脸库") - private Integer faceCount; - /** - * 算法版本 - */ - @ApiModelProperty("算法版本") - private String algVersion; - /** - * cpu温度 - */ - @ApiModelProperty("cpu温度") - private String cpuTemplate; - /** - * 摄像头状态1正常2异常 - */ - @ApiModelProperty("摄像头状态") - private Integer cameraStatus; - /** - * 系统类型 - */ - @ApiModelProperty("系统类型") - private String osType; - /** - * 固件版本 - */ - @ApiModelProperty("固件版本") - private String firmwareVersion; - /** - * 授权序列号 - */ - @ApiModelProperty("授权序列号") - private String licenseSerial; - /** - * 活体开关0未开1开 - */ - @ApiModelProperty("活体开关") - private Integer livenessFlag; - /** - * rgb活体阈值 - */ - @ApiModelProperty("rgb活体阈值") - private Float rgbLiveThd; - /** - * nir活体阈值 - */ - @ApiModelProperty("nir活体阈值") - private Float nirLiveThd; - /** - * 识别阈值 - */ - @ApiModelProperty("识别阈值") - private Float recThd; - /** - * 最小人脸框尺寸 - */ - @ApiModelProperty("最小人脸框尺寸") - private Integer minFaceWidth; - /** - * 心跳周期 - */ - @ApiModelProperty("心跳周期") - private Integer heartbeatCycle; - /** - * 补光灯亮度 - */ - @ApiModelProperty("补光灯亮度") - private Integer lightScore; - /** - * 声音开关 - */ - @ApiModelProperty("声音开关") - private Integer songFlag; - /** - * 开门声音 - */ - @ApiModelProperty("开门声音") - private String songDoor; - /** - * 1上传0不上传 - */ - @ApiModelProperty("是否上传头像") - private Integer uploadImageFlag; - /** - * 1截取人脸0原图 - */ - @ApiModelProperty("1截取人脸0原图") - private Integer cutFaceFlag; - /** - * 音视频呼叫0否1是 - */ - @ApiModelProperty("音视频呼叫") - private Integer avCallFlag; - /** - * 识别间隔秒 - */ - @ApiModelProperty("识别间隔秒") - private Integer recSpace; - /** - * 是否抓拍陌生人0否1是 - */ - @ApiModelProperty("是否抓拍陌生人") - private Integer strangerFlag; + /** + * id + */ + @TableId + @JsonSerialize(using = ToStringSerializer.class) + @ApiModelProperty("设备ID") + private Long deviceId; + /** + * 设备名称 + */ + @ApiModelProperty("设备名称") + private String name; + /** + * 序列号 + */ + @ApiModelProperty("设备序列号") + private String sn; + /** + * mac地址 + */ + @ApiModelProperty("设备MAC地址") + private String mac; + /** + * 1大门2单元门3室内机 + */ + @ApiModelProperty("设备类型") + private Integer type; + /** + * 0进1出 + */ + @ApiModelProperty("进出方向") + private Integer gateFlag; + /** + * 小区id + */ + @JsonSerialize(using = ToStringSerializer.class) + @ApiModelProperty("小区ID") + private Long cellId; + /** + * 楼栋编号 + */ + @ApiModelProperty("楼栋编号") + private String buildNumber; + /** + * 楼栋单元 + */ + @JsonSerialize(using = ToStringSerializer.class) + @ApiModelProperty("楼栋单元") + private Long buildId; + /** + * 户室ID + */ + @JsonSerialize(using = ToStringSerializer.class) + @ApiModelProperty("户室ID") + private Long roomId; + /** + * 运营商Id + */ + @JsonSerialize(using = ToStringSerializer.class) + @ApiModelProperty("运营商ID") + private Long tenantId; + /** + * apk版本 + */ + @ApiModelProperty("apk版本") + private String apkVersion; + /** + * 人脸库 + */ + @ApiModelProperty("人脸库") + private Integer faceCount; + /** + * 算法版本 + */ + @ApiModelProperty("算法版本") + private String algVersion; + /** + * cpu温度 + */ + @ApiModelProperty("cpu温度") + private String cpuTemplate; + /** + * 摄像头状态1正常2异常 + */ + @ApiModelProperty("摄像头状态") + private Integer cameraStatus; + /** + * 系统类型 + */ + @ApiModelProperty("系统类型") + private String osType; + /** + * 固件版本 + */ + @ApiModelProperty("固件版本") + private String firmwareVersion; + /** + * 授权序列号 + */ + @ApiModelProperty("授权序列号") + private String licenseSerial; + /** + * 活体开关0未开1开 + */ + @ApiModelProperty("活体开关") + private Integer livenessFlag; + /** + * rgb活体阈值 + */ + @ApiModelProperty("rgb活体阈值") + private Float rgbLiveThd; + /** + * nir活体阈值 + */ + @ApiModelProperty("nir活体阈值") + private Float nirLiveThd; + /** + * 识别阈值 + */ + @ApiModelProperty("识别阈值") + private Float recThd; + /** + * 最小人脸框尺寸 + */ + @ApiModelProperty("最小人脸框尺寸") + private Integer minFaceWidth; + /** + * 心跳周期 + */ + @ApiModelProperty("心跳周期") + private Integer heartbeatCycle; + /** + * 补光灯亮度 + */ + @ApiModelProperty("补光灯亮度") + private Integer lightScore; + /** + * 声音开关 + */ + @ApiModelProperty("声音开关") + private Integer songFlag; + /** + * 开门声音 + */ + @ApiModelProperty("开门声音") + private String songDoor; + /** + * 1上传0不上传 + */ + @ApiModelProperty("是否上传头像") + private Integer uploadImageFlag; + /** + * 1截取人脸0原图 + */ + @ApiModelProperty("1截取人脸0原图") + private Integer cutFaceFlag; + /** + * 音视频呼叫0否1是 + */ + @ApiModelProperty("音视频呼叫") + private Integer avCallFlag; + /** + * 识别间隔秒 + */ + @ApiModelProperty("识别间隔秒") + private Integer recSpace; + /** + * 是否抓拍陌生人0否1是 + */ + @ApiModelProperty("是否抓拍陌生人") + private Integer strangerFlag; - /** - * 是否删除 1:已删除 0:正常 - */ - @TableLogic - @ApiModelProperty("删除标志") - private Integer deleteFlag; + /** + * 是否删除 1:已删除 0:正常 + */ + @TableLogic + @ApiModelProperty("删除标志") + private Integer deleteFlag; - @TableField(exist=false) - @ApiModelProperty("在线状态") - private Integer status = 0; + @TableField(exist = false) + @ApiModelProperty("在线状态") + private Integer status = 0; - @ApiModelProperty("门常开电平0低1高") - private Integer doorOpenLevel; + @ApiModelProperty("门常开电平0低1高") + private Integer doorOpenLevel; - @ApiModelProperty("锁常开电平0低1高") - private Integer lockOpenLevel; + @ApiModelProperty("锁常开电平0低1高") + private Integer lockOpenLevel; - @ApiModelProperty("测温补偿") - private Float temperatureUp; + @ApiModelProperty("测温补偿") + private Float temperatureUp; - @ApiModelProperty("告警温度") - private Float temperatureAlert; + @ApiModelProperty("告警温度") + private Float temperatureAlert; - @ApiModelProperty("健康码1支持0不支持") - private Integer healthCodeFlag; - - @ApiModelProperty("识别区域") - @TableField(exist=false) - private String scope; + @ApiModelProperty("健康码1支持0不支持") + private Integer healthCodeFlag; + @ApiModelProperty("识别区域") + @TableField(exist = false) + private String scope; + @ApiModelProperty("是否同步") + private Integer xaSync; // @TableField(exist=false) diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/entity/TenPackChannalEntity.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/entity/TenPackChannalEntity.java new file mode 100644 index 0000000..1207de2 --- /dev/null +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/entity/TenPackChannalEntity.java @@ -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; + +} diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/entity/TenPackEntity.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/entity/TenPackEntity.java new file mode 100644 index 0000000..58876b6 --- /dev/null +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/entity/TenPackEntity.java @@ -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; +} \ No newline at end of file diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/entity/TenPackRecordEnterEntity.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/entity/TenPackRecordEnterEntity.java new file mode 100644 index 0000000..10046a2 --- /dev/null +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/entity/TenPackRecordEnterEntity.java @@ -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; +} \ No newline at end of file diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/entity/TenPackRecordEntity.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/entity/TenPackRecordEntity.java index 2fddae2..1dbdb4b 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/entity/TenPackRecordEntity.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/entity/TenPackRecordEntity.java @@ -107,140 +107,141 @@ import lombok.Data; // private Long cellId; - - - /** * 停车记录表 - * */ @Data @TableName("ten_pack_record") public class TenPackRecordEntity implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - /** - * 记录id - */ - @TableId - @ApiModelProperty("记录id") - private String recordId; - /** - * 车厂编号 - */ - @TableId - @ApiModelProperty("车厂") - private String parkId; - /** - * 车牌号 - */ - @ApiModelProperty("车牌号") - private String vlp; - /** - * 车辆类型 - */ - @ApiModelProperty("车辆类型") - private String vTypeName; - /** - * 车辆类别 - */ - @ApiModelProperty("车辆类别") - private String cTypeName; - /** - * 停车场名称 - */ - @ApiModelProperty("停车场名称") - private String parkName; - /** - * 0-进场,1-出场 - */ - @ApiModelProperty("0-进场,1-出场") - private Integer direction; - /** - * 进场通道名称 - */ - @ApiModelProperty("进场通道名称") - private String inChannelName; - /** - * 进场全景图 - */ - @ApiModelProperty("进场全景图") - private String inPicture; - /** - * 进场车牌图 - */ - @ApiModelProperty("进场车牌图") - private String inPicturePlate; - /** - * 进场时间 - */ - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") - @ApiModelProperty("进场时间") - private Date inTime; - /** - * 出场通道名称 - */ - @ApiModelProperty("出场通道名称") - private String outChannelName; - /** - * 出场全景图 - */ - @ApiModelProperty("出场全景图") - private String outPicture; - /** - * 出场车牌图 - */ + /** + * 记录id + */ + @TableId + @ApiModelProperty("记录id") + private String recordId; + /** + * 车厂编号 + */ + @TableId + @ApiModelProperty("车厂") + private String parkId; + /** + * 车牌号 + */ + @ApiModelProperty("车牌号") + private String vlp; + /** + * 车辆类型 + */ + @ApiModelProperty("车辆类型") + private String vTypeName; + /** + * 车辆类别 + */ + @ApiModelProperty("车辆类别") + private String cTypeName; + /** + * 停车场名称 + */ + @ApiModelProperty("停车场名称") + private String parkName; + /** + * 0-进场,1-出场 + */ + @ApiModelProperty("0-进场,1-出场") + private Integer direction; + /** + * 进场通道名称 + */ + @ApiModelProperty("进场通道名称") + private String inChannelName; + /** + * 进场全景图 + */ + @ApiModelProperty("进场全景图") + private String inPicture; + /** + * 进场车牌图 + */ + @ApiModelProperty("进场车牌图") + private String inPicturePlate; + /** + * 进场时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @ApiModelProperty("进场时间") + private Date inTime; + /** + * 出场通道名称 + */ + @ApiModelProperty("出场通道名称") + private String outChannelName; + /** + * 出场全景图 + */ + @ApiModelProperty("出场全景图") + private String outPicture; + /** + * 出场车牌图 + */ - @ApiModelProperty("出场车牌图") - private String outPicturePlate; - /** - * 出场时间 - */ - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") - @ApiModelProperty("出场时间") - private Date outTime; - /** - * 进场识别错误车牌 - */ - @ApiModelProperty("进场识别错误车牌") - private String inVlp; - /** - * 应收 - */ - @ApiModelProperty("应收") - private String receivableFee; - /** - * 实收 - */ - @ApiModelProperty("实收") - private String actualFee; - /** - * 操作员 - */ - @ApiModelProperty("操作员") - private String operator; - /** - * 小区id - */ - @ApiModelProperty("小区id") - @JsonSerialize(using = ToStringSerializer.class) - private Long cellId; + @ApiModelProperty("出场车牌图") + private String outPicturePlate; + /** + * 出场时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @ApiModelProperty("出场时间") + private Date outTime; + /** + * 进场识别错误车牌 + */ + @ApiModelProperty("进场识别错误车牌") + private String inVlp; + /** + * 应收 + */ + @ApiModelProperty("应收") + private String receivableFee; + /** + * 实收 + */ + @ApiModelProperty("实收") + private String actualFee; + /** + * 操作员 + */ + @ApiModelProperty("操作员") + private String operator; + /** + * 小区id + */ + @ApiModelProperty("小区id") + @JsonSerialize(using = ToStringSerializer.class) + private Long cellId; - @TableField(exist = false) - private String inPictureBase64; - @TableField(exist = false) - private String inPicturePlateBase64; - @TableField(exist = false) - private String outPictureBase64; - @TableField(exist = false) - private String outPicturePlateBase64; + @TableField(exist = false) + private String inPictureBase64; + @TableField(exist = false) + private String inPicturePlateBase64; + @TableField(exist = false) + private String outPictureBase64; + @TableField(exist = false) + private String outPicturePlateBase64; - /** - * 小区名称 - */ - @ApiModelProperty("小区名称") - private String cellName; + /** + * 小区名称 + */ + @ApiModelProperty("小区名称") + private String cellName; + + private Integer xaSync; + + @ApiModelProperty("") + private Integer xaSyncImage; } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/entity/TenPackRecordExitEntity.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/entity/TenPackRecordExitEntity.java new file mode 100644 index 0000000..d06fb42 --- /dev/null +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/entity/TenPackRecordExitEntity.java @@ -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; +} \ No newline at end of file diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/entity/TenPersonEntity.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/entity/TenPersonEntity.java index be53963..93cd317 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/entity/TenPersonEntity.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/entity/TenPersonEntity.java @@ -324,6 +324,14 @@ public class TenPersonEntity extends BaseEntity implements Serializable { @TableField(exist = false) private List extractList; + @ApiModelProperty("") + private Integer xaSync; + + @ApiModelProperty("") + private Integer xaSyncCard; + + @ApiModelProperty("") + private Integer xaSyncImage; } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/entity/TenRecordEntity.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/entity/TenRecordEntity.java index debb576..b46819c 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/entity/TenRecordEntity.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/entity/TenRecordEntity.java @@ -15,143 +15,148 @@ import io.swagger.annotations.ApiModelProperty; import lombok.Data; /** - * * */ @Data @TableName("ten_record") public class TenRecordEntity implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - /** - * 记录id - */ - @TableId(type = IdType.INPUT) - @JsonSerialize(using = ToStringSerializer.class) - @ApiModelProperty("记录ID") - private Long recordId; - /** - * 小区id - */ - @JsonSerialize(using = ToStringSerializer.class) - @ApiModelProperty("小区ID") - private Long cellId; - /** - * 设备sn - */ - @ApiModelProperty("设备sn") - private String deviceSn; + /** + * 记录id + */ + @TableId(type = IdType.INPUT) + @JsonSerialize(using = ToStringSerializer.class) + @ApiModelProperty("记录ID") + private Long recordId; + /** + * 小区id + */ + @JsonSerialize(using = ToStringSerializer.class) + @ApiModelProperty("小区ID") + private Long cellId; + /** + * 设备sn + */ + @ApiModelProperty("设备sn") + private String deviceSn; - /** - * 人员ID - */ - @ApiModelProperty("人员ID") - @JsonSerialize(using = ToStringSerializer.class) - private Long personId; + /** + * 人员ID + */ + @ApiModelProperty("人员ID") + @JsonSerialize(using = ToStringSerializer.class) + private Long personId; - /** - * 户室ID - */ - @ApiModelProperty("户室ID") - @JsonSerialize(using = ToStringSerializer.class) - private Long roomId; - /** - * 开门方式 - */ - @ApiModelProperty("开门方式1人脸识别2远程一键开门") - private Integer openType; - /** - * 识别人脸 - */ - @ApiModelProperty("识别人脸") - private String recordFace; - /** - * 体温 - */ - @ApiModelProperty("体温") - private Float template; - /** - * 识别视频 - */ - @ApiModelProperty("识别视频") - private String recordVideo; - /** - * 识别时间 - */ - @ApiModelProperty("识别时间") - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") - private Date recordTime; - /** - * 识别概率 - */ - @ApiModelProperty("识别概率") - private Float score; - /** - * 运营商ID - */ - @ApiModelProperty("运营商ID") - private Long tenantId; - /** - * 识别人脸base64 - */ - @ApiModelProperty("识别人脸base64") - private String recordFaceStr; - /** - * 开门卡号 - */ - @ApiModelProperty("开门卡号") - private String doorCard; - /** - * 开门密码 - */ - @ApiModelProperty("开门密码") - private String doorPassword; - /** - * 设备名称 - */ - @ApiModelProperty("设备名称") - @TableField(exist=false) - private String deviceName; - /** - * 设备出入口 - */ - @ApiModelProperty("设备出入口0进1出") - @TableField(exist=false) - private Integer gateFlag; + /** + * 户室ID + */ + @ApiModelProperty("户室ID") + @JsonSerialize(using = ToStringSerializer.class) + private Long roomId; + /** + * 开门方式 + */ + @ApiModelProperty("开门方式1人脸识别2远程一键开门") + private Integer openType; + /** + * 识别人脸 + */ + @ApiModelProperty("识别人脸") + private String recordFace; + /** + * 体温 + */ + @ApiModelProperty("体温") + private Float template; + /** + * 识别视频 + */ + @ApiModelProperty("识别视频") + private String recordVideo; + /** + * 识别时间 + */ + @ApiModelProperty("识别时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date recordTime; + /** + * 识别概率 + */ + @ApiModelProperty("识别概率") + private Float score; + /** + * 运营商ID + */ + @ApiModelProperty("运营商ID") + private Long tenantId; + /** + * 识别人脸base64 + */ + @ApiModelProperty("识别人脸base64") + private String recordFaceStr; + /** + * 开门卡号 + */ + @ApiModelProperty("开门卡号") + private String doorCard; + /** + * 开门密码 + */ + @ApiModelProperty("开门密码") + private String doorPassword; + /** + * 设备名称 + */ + @ApiModelProperty("设备名称") + @TableField(exist = false) + private String deviceName; + /** + * 设备出入口 + */ + @ApiModelProperty("设备出入口0进1出") + @TableField(exist = false) + private Integer gateFlag; - /** - * 人员姓名 - */ + /** + * 人员姓名 + */ // @ApiModelProperty("人员姓名") // @TableField(exist=false) // private String personName; - /** - * 手机号 - */ + /** + * 手机号 + */ // @ApiModelProperty("手机号") // @TableField(exist=false) // private String mobile; - /** - * 原始照片 - */ + /** + * 原始照片 + */ // @ApiModelProperty("原始照片") // @TableField(exist=false) // private String orgImage; - /** - * 人员信息 - */ - @ApiModelProperty("人员信息") - @TableField(exist=false) - private TenPersonEntity person; + /** + * 人员信息 + */ + @ApiModelProperty("人员信息") + @TableField(exist = false) + private TenPersonEntity person; - /** - * 人员ID - */ - @ApiModelProperty("人员ID") - @TableField(exist=false) - private Integer memberId; + /** + * 人员ID + */ + @ApiModelProperty("人员ID") + @TableField(exist = false) + private Integer memberId; + + @ApiModelProperty("") + private Integer xaSync; + + @ApiModelProperty("") + private Integer xaSyncImage; } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/entity/TenRoomEntity.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/entity/TenRoomEntity.java index 70ddaf6..8b82402 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/entity/TenRoomEntity.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/entity/TenRoomEntity.java @@ -13,124 +13,132 @@ import net.shapelight.common.base.BaseEntity; /** * 户室表 - * */ @Data @TableName("ten_room") public class TenRoomEntity extends BaseEntity implements Serializable { - private static final long serialVersionUID = 1L; + private static final long serialVersionUID = 1L; - /** - * ID - */ - @TableId(type = IdType.INPUT) - @JsonSerialize(using = ToStringSerializer.class) - @ApiModelProperty("户室ID") - private Long roomId; - /** - * 楼栋ID - */ - @ApiModelProperty("楼栋ID") - @JsonSerialize(using = ToStringSerializer.class) - private Long buildId; - /** - * 小区ID - */ - @ApiModelProperty("小区ID") - @JsonSerialize(using = ToStringSerializer.class) - private Long cellId; - /** - * 房间号 - */ - @ApiModelProperty("房间号") - private Integer roomNumber; - /** - * 房间名称 - */ - @ApiModelProperty("房间名称") - private String roomName; - /** - * 所在楼层 - */ - @ApiModelProperty("楼层") - private Integer layer; - /** - * 面积 - */ - @ApiModelProperty("面积") - private String area; - /** - * 类型:自住,出租 - */ - @ApiModelProperty("类型:自住,出租") - private Integer type; - /** - * 房间人数 - */ - @ApiModelProperty("房间人数") - private Integer personCount; - /** - * 门禁密码 - */ - @ApiModelProperty("门禁密码") - private String roomPassword; - /** - * 几室 - */ - @ApiModelProperty("几室") - private Integer roomCount; - /** - * 几厅 - */ - @ApiModelProperty("几厅") - private Integer livingCount; - /** - * 几厨 - */ - @ApiModelProperty("几厨") - private Integer kitchenCount; - /** - * 几卫 - */ - @ApiModelProperty("几卫") - private Integer bathCount; - /** - * 几阳台 - */ - @ApiModelProperty("几阳台") - private Integer balconyCount; - /** - * 房间照片 - */ - @ApiModelProperty("房间照片") - private String picture; - /** - * 备注 - */ - @ApiModelProperty("备注") - private String remark; - /** - * 0未删除1删除 - */ - @TableLogic - @ApiModelProperty("0未删除1删除") - private Integer deleteFlag; - /** - * 运营商ID - */ - @ApiModelProperty("运营商ID") - private Long tenantId; + /** + * ID + */ + @TableId(type = IdType.INPUT) + @JsonSerialize(using = ToStringSerializer.class) + @ApiModelProperty("户室ID") + private Long roomId; + /** + * 楼栋ID + */ + @ApiModelProperty("楼栋ID") + @JsonSerialize(using = ToStringSerializer.class) + private Long buildId; + /** + * 小区ID + */ + @ApiModelProperty("小区ID") + @JsonSerialize(using = ToStringSerializer.class) + private Long cellId; + /** + * 房间号 + */ + @ApiModelProperty("房间号") + private Integer roomNumber; + /** + * 房间名称 + */ + @ApiModelProperty("房间名称") + private String roomName; + /** + * 所在楼层 + */ + @ApiModelProperty("楼层") + private Integer layer; + /** + * 面积 + */ + @ApiModelProperty("面积") + private String area; + /** + * 类型:自住,出租 + */ + @ApiModelProperty("类型:自住,出租") + private Integer type; + /** + * 房间人数 + */ + @ApiModelProperty("房间人数") + private Integer personCount; + /** + * 门禁密码 + */ + @ApiModelProperty("门禁密码") + private String roomPassword; + /** + * 几室 + */ + @ApiModelProperty("几室") + private Integer roomCount; + /** + * 几厅 + */ + @ApiModelProperty("几厅") + private Integer livingCount; + /** + * 几厨 + */ + @ApiModelProperty("几厨") + private Integer kitchenCount; + /** + * 几卫 + */ + @ApiModelProperty("几卫") + private Integer bathCount; + /** + * 几阳台 + */ + @ApiModelProperty("几阳台") + private Integer balconyCount; + /** + * 房间照片 + */ + @ApiModelProperty("房间照片") + private String picture; + /** + * 备注 + */ + @ApiModelProperty("备注") + private String remark; + /** + * 0未删除1删除 + */ + @TableLogic + @ApiModelProperty("0未删除1删除") + private Integer deleteFlag; + /** + * 运营商ID + */ + @ApiModelProperty("运营商ID") + private Long tenantId; - @TableField(exist=false) - @ApiModelProperty("楼栋名称") - private String buildName; + @TableField(exist = false) + @ApiModelProperty("楼栋名称") + private String buildName; - @TableField(exist=false) - @ApiModelProperty("楼栋单元") - private String buildUnit; + @TableField(exist = false) + @ApiModelProperty("楼栋单元") + private String buildUnit; - @TableField(exist=false) - @ApiModelProperty("小区名称") - private String cellName; + @TableField(exist = false) + @ApiModelProperty("小区名称") + private String cellName; + + @ApiModelProperty("是否同步") + private Integer xaSync; + + @ApiModelProperty("地址序号") + private String pId; + + @ApiModelProperty("地址编码") + private String dzbm; } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenDeviceService.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenDeviceService.java index 318fe99..40b03e7 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenDeviceService.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenDeviceService.java @@ -1,7 +1,6 @@ package net.shapelight.modules.ten.service; import com.baomidou.mybatisplus.extension.service.IService; -import io.swagger.models.auth.In; import net.shapelight.common.utils.PageUtils; import net.shapelight.modules.ten.entity.TenDeviceAlertEntity; 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.TenPersonIdUpdateVo; import net.shapelight.modules.vo.TenPersonVo; -import org.springframework.cache.annotation.CacheEvict; import java.io.Serializable; import java.util.Collection; @@ -57,7 +55,7 @@ public interface TenDeviceService extends IService { boolean evictRemoveByIds(Collection idList); - public boolean evictRemoveByCellIds(Long[] idList); + boolean evictRemoveByCellIds(Long[] idList); int getDeviceCount(Map params); @@ -67,7 +65,7 @@ public interface TenDeviceService extends IService { void evictupdateById(TenDeviceEntity tenDevice); - + List getNotSync(Long paramLong); } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenPackChannalService.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenPackChannalService.java new file mode 100644 index 0000000..3ccd3cf --- /dev/null +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenPackChannalService.java @@ -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 { + PageUtils queryPage(Map paramMap); +} diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenPackRecordEnterService.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenPackRecordEnterService.java new file mode 100644 index 0000000..674b84c --- /dev/null +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenPackRecordEnterService.java @@ -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 { + PageUtils queryPage(Map paramMap); +} \ No newline at end of file diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenPackRecordExitService.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenPackRecordExitService.java new file mode 100644 index 0000000..6978ff8 --- /dev/null +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenPackRecordExitService.java @@ -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 { + PageUtils queryPage(Map paramMap); +} \ No newline at end of file diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenPackRecordService.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenPackRecordService.java index 80a1022..cc9aacf 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenPackRecordService.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenPackRecordService.java @@ -28,5 +28,9 @@ public interface TenPackRecordService { boolean saveOrUpdateByRecordId(TenPackRecordEntity entity); + List getNotSync(Long paramLong); + + List getNotSyncImage(Long paramLong); + } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenPackService.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenPackService.java new file mode 100644 index 0000000..bb8f57c --- /dev/null +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenPackService.java @@ -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 { + PageUtils queryPage(Map paramMap); +} \ No newline at end of file diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenPersonService.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenPersonService.java index 0dff100..8d9d753 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenPersonService.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenPersonService.java @@ -110,6 +110,14 @@ public interface TenPersonService { List getAllExpireGuest(); + TenPersonEntity getOwner(Long paramLong); + + List getNotSync(Long paramLong); + + List getNotSyncCard(Long paramLong); + + List getNotSyncImage(Long paramLong); + } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenRecordService.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenRecordService.java index 465bc51..22f6302 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenRecordService.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenRecordService.java @@ -34,5 +34,9 @@ public interface TenRecordService { List getLastRecord(Map params); + List getNotSync(Long paramLong1, Long paramLong2); + + List getNotSyncImage(Long paramLong1, Long paramLong2); + } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenRoomService.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenRoomService.java index 003cc0b..fa9cf18 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenRoomService.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenRoomService.java @@ -9,7 +9,6 @@ import java.util.Map; /** * 户室表 - * */ public interface TenRoomService { @@ -17,15 +16,17 @@ public interface TenRoomService { boolean save(TenRoomEntity entity); - boolean removeById(Long roomId,Long cellId); - boolean removeByBuildId(Long build,Long cellId); + boolean removeById(Long roomId, Long cellId); + + boolean removeByBuildId(Long build, Long cellId); + boolean removeByCellId(Long cellId); - boolean removeByIdList(List> roomIdList); + boolean removeByIdList(List> roomIdList); boolean updateById(TenRoomEntity entity); - TenRoomEntity getById(Long id,Long cellId); + TenRoomEntity getById(Long id, Long cellId); TenRoomEntity queryByNumberAndLayer(Integer roomNumber, Integer layer, @@ -33,18 +34,19 @@ public interface TenRoomService { Long cellId); List getLayerRooms(Integer layer, - Long buildId, - Long cellId); - + Long buildId, + Long cellId); String getRoomName(Long id, Long cellId); TenRoomEntity findByRoomName(String roomName, - Long buildId, - Long cellId); + Long buildId, + Long cellId); int getAllCount(Map params); + + List getNotSync(Long paramLong); } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenDeviceServiceImpl.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenDeviceServiceImpl.java index 4b289a4..18a3cbe 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenDeviceServiceImpl.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenDeviceServiceImpl.java @@ -2,8 +2,6 @@ package net.shapelight.modules.ten.service.impl; import lombok.extern.slf4j.Slf4j; 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.ServerApiService; import net.shapelight.modules.ten.entity.*; @@ -45,8 +43,6 @@ public class TenDeviceServiceImpl extends ServiceImpl findAllSn() { - return tenDeviceDao.findAllSn(); + return baseMapper.findAllSn(); } @Override @@ -267,6 +263,12 @@ public class TenDeviceServiceImpl extends ServiceImpl idList) { + //删除同步人员 + for(Long devId: (List)idList){ + TenDeviceEntity deviceEntity = this.getById(devId); + tenPersonSyncService.removeByDeviceId(devId,deviceEntity.getTenantId()); + } + return removeByIds(idList); } @@ -349,4 +351,11 @@ public class TenDeviceServiceImpl extends ServiceImpl getNotSync(Long cellId) { + return list(new QueryWrapper() + .eq("cell_id", cellId) + .eq("xa_sync", 0) + .eq("delete_flag", 0)); + } } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenPackChannalServiceImpl.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenPackChannalServiceImpl.java new file mode 100644 index 0000000..3048c69 --- /dev/null +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenPackChannalServiceImpl.java @@ -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 implements TenPackChannalService { + + @Autowired + private TenCellService tenCellService; + + public PageUtils queryPage(Map params) { + + List 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 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 page = this.page( + new Query().getPage(params), + new QueryWrapper() + .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); + } +} diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenPackRecordEnterServiceImpl.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenPackRecordEnterServiceImpl.java new file mode 100644 index 0000000..82364cc --- /dev/null +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenPackRecordEnterServiceImpl.java @@ -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 implements TenPackRecordEnterService { + + @Autowired + private TenCellService tenCellService; + + public PageUtils queryPage(Map params) { + List 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 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 page = this.page( + new Query().getPage(params), + new QueryWrapper() + .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); + } +} \ No newline at end of file diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenPackRecordExitServiceImpl.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenPackRecordExitServiceImpl.java new file mode 100644 index 0000000..2a41c40 --- /dev/null +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenPackRecordExitServiceImpl.java @@ -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 implements TenPackRecordExitService { + + @Autowired + private TenCellService tenCellService; + + public PageUtils queryPage(Map params) { + List 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 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 page = this.page( + new Query().getPage(params), + new QueryWrapper() + .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); + } +} \ No newline at end of file diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenPackRecordServiceImpl.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenPackRecordServiceImpl.java index c530302..c0417be 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenPackRecordServiceImpl.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenPackRecordServiceImpl.java @@ -213,6 +213,14 @@ public class TenPackRecordServiceImpl implements TenPackRecordService { } return new PageUtils(page); } + @Override + public List getNotSync(Long cellId) { + return this.tenPackRecordDao.getNotSync(cellId); + } + @Override + public List getNotSyncImage(Long cellId) { + return this.tenPackRecordDao.getNotSyncImage(cellId); + } } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenPackServiceImpl.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenPackServiceImpl.java new file mode 100644 index 0000000..40d2b05 --- /dev/null +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenPackServiceImpl.java @@ -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 implements TenPackService { + @Autowired + private TenCellService tenCellService; + + + public PageUtils queryPage(Map params) { + + List 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 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 page = this.page( + new Query().getPage(params), + new QueryWrapper() + .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); + } +} \ No newline at end of file diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenPersonServiceImpl.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenPersonServiceImpl.java index f5343c4..ad4c082 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenPersonServiceImpl.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenPersonServiceImpl.java @@ -121,15 +121,15 @@ public class TenPersonServiceImpl implements TenPersonService { pageParam.setCurrent(Long.parseLong((String) params.get("page"))); pageParam.setSize(Long.parseLong((String) params.get("limit"))); IPage page = tenPersonDao.findPageAll(pageParam, cellIds, params); - for(TenPersonEntity personEntity: page.getRecords()){ + for (TenPersonEntity personEntity : page.getRecords()) { List extracts = tenPersonExtractService.list( new QueryWrapper() - .eq("person_id",personEntity.getPersonId()) + .eq("person_id", personEntity.getPersonId()) ); - if(extracts!=null){ + if (extracts != null) { personEntity.setExtractCount(extracts.size()); personEntity.setExtractList(extracts); - }else{ + } else { personEntity.setExtractCount(0); personEntity.setExtractList(new ArrayList<>()); } @@ -332,7 +332,7 @@ public class TenPersonServiceImpl implements TenPersonService { } String password = entity.getPassword(); entity.setPassword(""); - Date now = new Date(); + Date now = new Date(); entity.setCreateTime(now); entity.setLastUpdateTime(now); @@ -414,7 +414,7 @@ public class TenPersonServiceImpl implements TenPersonService { //发送设备通知 List devList = tenDeviceService.findByCellId(entity.getCellId()); //状态是0正常,发送推送 - if(entity.getStatus().intValue() == Constant.PESON_SUATUS_NOMOR){ + if (entity.getStatus().intValue() == Constant.PESON_SUATUS_NOMOR) { for (TenDeviceVo dev : devList) { //添加到同步表,下发设备通知 TenPersonSyncEntity syncEntity = new TenPersonSyncEntity(); @@ -433,7 +433,7 @@ public class TenPersonServiceImpl implements TenPersonService { vo.setOperation(1); vo.setLast_update_stamp(syncEntity.getLastUpdateTime()); list.add(vo); - serverApiService.personOperation(dev.getSn(),list); + serverApiService.personOperation(dev.getSn(), list); } } return 0; @@ -618,7 +618,7 @@ public class TenPersonServiceImpl implements TenPersonService { //发送设备通知 List devList = tenDeviceService.findByCellId(entity.getCellId()); //状态是0正常,发送推送 - if(entity.getStatus().intValue() == Constant.PESON_SUATUS_NOMOR){ + if (entity.getStatus().intValue() == Constant.PESON_SUATUS_NOMOR) { for (TenDeviceVo dev : devList) { //添加到同步表,下发设备通知 TenPersonSyncEntity syncEntity = new TenPersonSyncEntity(); @@ -637,7 +637,7 @@ public class TenPersonServiceImpl implements TenPersonService { vo.setOperation(1); vo.setLast_update_stamp(syncEntity.getLastUpdateTime()); list.add(vo); - serverApiService.personOperation(dev.getSn(),list); + serverApiService.personOperation(dev.getSn(), list); } } return true; @@ -700,25 +700,28 @@ public class TenPersonServiceImpl implements TenPersonService { //配置同步信息并推送 - List> snPersonsList = tenPersonSyncService.findGroupDevicePersons(personIds,tenantId); - for(Map snPersons: snPersonsList){ + List> snPersonsList = tenPersonSyncService.findGroupDevicePersons(personIds, tenantId); + for (Map snPersons : snPersonsList) { String sn = snPersons.get("deviceSn"); TenDeviceEntity deviceEntity = tenDeviceService.findBySn(sn); + if(deviceEntity==null){ + continue; + } String[] persons = snPersons.get("plist").split(","); List list = new ArrayList<>(); - for(String personStr: persons){ + for (String personStr : persons) { String[] personInfoStr = personStr.split("_"); 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.setState(Constant.PERSON_SYNC_DELETE); tenPersonSyncService.updateById(syncEntity); } //下发通知 - List allDelete = tenPersonSyncService.findDeviceAllDeletePersons(deviceEntity.getDeviceId(),deviceEntity.getTenantId()); - for(TenPersonSyncEntity syncEntity: allDelete){ + List allDelete = tenPersonSyncService.findDeviceAllDeletePersons(deviceEntity.getDeviceId(), deviceEntity.getTenantId()); + for (TenPersonSyncEntity syncEntity : allDelete) { TenPersonOperationVo vo = new TenPersonOperationVo(); vo.setUid(syncEntity.getPersonId()); vo.setOperation(Constant.PERSON_SYNC_DELETE); @@ -726,10 +729,10 @@ public class TenPersonServiceImpl implements TenPersonService { list.add(vo); } - int flag = serverApiService.personOperation(sn,list); - if(flag == 0){ + int flag = serverApiService.personOperation(sn, list); + if (flag == 0) { //下发成功,删除状态为删除的同步人员 - tenPersonSyncService.removeAllDeletePersons(deviceEntity.getDeviceId(),tenantId); + tenPersonSyncService.removeAllDeletePersons(deviceEntity.getDeviceId(), tenantId); } } return true; @@ -763,10 +766,10 @@ public class TenPersonServiceImpl implements TenPersonService { } //下发设备通知 List devList = tenDeviceService.findByCellId(cellId); - for(TenDeviceVo deviceVo: devList){ - List operationList = tenPersonSyncService.findDeviceAllAddPersons(deviceVo.getDeviceId(),deviceVo.getTenantId()); + for (TenDeviceVo deviceVo : devList) { + List operationList = tenPersonSyncService.findDeviceAllAddPersons(deviceVo.getDeviceId(), deviceVo.getTenantId()); List voList = new ArrayList<>(); - for(TenPersonSyncEntity syncEntity: operationList){ + for (TenPersonSyncEntity syncEntity : operationList) { TenPersonOperationVo vo = new TenPersonOperationVo(); vo.setUid(syncEntity.getPersonId()); vo.setOperation(syncEntity.getState()); @@ -774,24 +777,21 @@ public class TenPersonServiceImpl implements TenPersonService { voList.add(vo); } - int flag = serverApiService.personOperation(deviceVo.getSn(),voList); - if(flag == 0){ + int flag = serverApiService.personOperation(deviceVo.getSn(), voList); + if (flag == 0) { //下发成功,删除状态为删除的同步人员 // tenPersonSyncService.removeAllDeletePersons(deviceEntity.getDeviceId(),tenantId); } } - - - return true; } @Override @CacheEvict(value = "TenPerson", key = "#entity.personId+'-'+#entity.cellId") public String updateById(TenPersonEntity entity) { - if(entity.getUsername()!=null && entity.getUsername().isEmpty()){ + if (entity.getUsername() != null && entity.getUsername().isEmpty()) { entity.setUsername(null); } @@ -1026,21 +1026,21 @@ public class TenPersonServiceImpl implements TenPersonService { //现在不支持,删除app用户,判断是否是管理员 AppUserEntity uEntity = appUserService.findByMobile(oldPerson.getMobile()); List scopes = appUserScopeService.list(new QueryWrapper() - .eq("user_id",uEntity.getUserId())); - if(scopes.size()>1){ - for(AppUserScopeEntity scopeEntity: scopes){ - if(scopeEntity.getPersonId()!=null - && scopeEntity.getPersonId().longValue() == entity.getPersonId().longValue()){ + .eq("user_id", uEntity.getUserId())); + if (scopes.size() > 1) { + for (AppUserScopeEntity scopeEntity : scopes) { + if (scopeEntity.getPersonId() != null + && scopeEntity.getPersonId().longValue() == entity.getPersonId().longValue()) { appUserScopeService.removeById(scopeEntity); break; } } List scopesNew = appUserScopeService.list(new QueryWrapper() - .eq("user_id",uEntity.getUserId())); + .eq("user_id", uEntity.getUserId())); AppUserScopeEntity newScope = scopesNew.get(0); uEntity.setCurrentScopeId(newScope.getUserScopeId()); appUserService.updateById(uEntity); - }else{ + } else { appUserService.removeById(uEntity); appUserScopeService.remove(new QueryWrapper() .eq("user_id", uEntity.getUserId())); @@ -1049,7 +1049,7 @@ public class TenPersonServiceImpl implements TenPersonService { } else { //以前不支持app现在支持app登录 if (entity.getAppFlag() == Constant.APP_LOGIN_YES) { //默认密码:123456 - if(entity.getPassword()==null || entity.getPassword().length()==0){ + if (entity.getPassword() == null || entity.getPassword().length() == 0) { entity.setPassword("123456"); } //1.验证用户名 @@ -1096,9 +1096,9 @@ public class TenPersonServiceImpl implements TenPersonService { .eq("person_id", entity.getPersonId())); if (oldCard != null) { //修改 ,卡号为空,删除记录 - if (entity.getDoorCardEntity().getDoorCard()==null || entity.getDoorCardEntity().getDoorCard().isEmpty()){ + if (entity.getDoorCardEntity().getDoorCard() == null || entity.getDoorCardEntity().getDoorCard().isEmpty()) { tenDoorCardService.removeById(oldCard); - }else{ + } else { //修改 if (!entity.getDoorCardEntity().getDoorCard().equals(oldCard.getDoorCard())) { TenDoorCardEntity newCard = tenDoorCardService.getOne(new QueryWrapper() @@ -1106,19 +1106,19 @@ public class TenPersonServiceImpl implements TenPersonService { if (newCard != null) { return "卡号已经使用"; } else { - if (entity.getDoorCardEntity().getValidBegin()==null) { + if (entity.getDoorCardEntity().getValidBegin() == null) { oldCard.setValidBegin(new Date()); - }else{ + } else { oldCard.setValidBegin(entity.getDoorCardEntity().getValidBegin()); } - if (entity.getDoorCardEntity().getValidEnd()==null) { + if (entity.getDoorCardEntity().getValidEnd() == null) { Date date = new Date(); Calendar cal = Calendar.getInstance(); cal.setTime(date);//设置起时间 cal.add(Calendar.YEAR, 10);//增加一年 // System.out.println("输出::"+cal.getTime()); oldCard.setValidEnd(cal.getTime()); - }else{ + } else { oldCard.setValidEnd(entity.getDoorCardEntity().getValidEnd()); } oldCard.setDoorCard(entity.getDoorCardEntity().getDoorCard()); @@ -1126,19 +1126,19 @@ public class TenPersonServiceImpl implements TenPersonService { tenDoorCardService.updateById(oldCard); } } else { - if (entity.getDoorCardEntity().getValidBegin()==null) { + if (entity.getDoorCardEntity().getValidBegin() == null) { oldCard.setValidBegin(new Date()); - }else{ + } else { oldCard.setValidBegin(entity.getDoorCardEntity().getValidBegin()); } - if (entity.getDoorCardEntity().getValidEnd()==null) { + if (entity.getDoorCardEntity().getValidEnd() == null) { Date date = new Date(); Calendar cal = Calendar.getInstance(); cal.setTime(date);//设置起时间 cal.add(Calendar.YEAR, 20);//增加一年 // System.out.println("输出::"+cal.getTime()); oldCard.setValidEnd(cal.getTime()); - }else{ + } else { oldCard.setValidEnd(entity.getDoorCardEntity().getValidEnd()); } // oldCard.setValidEnd(entity.getDoorCardEntity().getValidEnd()); @@ -1150,19 +1150,19 @@ public class TenPersonServiceImpl implements TenPersonService { //增加 TenDoorCardEntity newCard = new TenDoorCardEntity(); newCard.setPersonId(entity.getPersonId()); - if (entity.getDoorCardEntity().getValidBegin()==null) { + if (entity.getDoorCardEntity().getValidBegin() == null) { newCard.setValidBegin(new Date()); - }else{ + } else { newCard.setValidBegin(entity.getDoorCardEntity().getValidBegin()); } - if (entity.getDoorCardEntity().getValidEnd()==null) { + if (entity.getDoorCardEntity().getValidEnd() == null) { Date date = new Date(); Calendar cal = Calendar.getInstance(); cal.setTime(date);//设置起时间 cal.add(Calendar.YEAR, 10);//增加一年 // System.out.println("输出::"+cal.getTime()); newCard.setValidEnd(cal.getTime()); - }else{ + } else { newCard.setValidEnd(entity.getDoorCardEntity().getValidEnd()); } // newCard.setValidBegin(entity.getDoorCardEntity().getValidBegin()); @@ -1178,8 +1178,8 @@ public class TenPersonServiceImpl implements TenPersonService { tenPersonDao.updateById(entity); //配置同步数据 - List syncEntitys = tenPersonSyncService.findByPersonId(entity.getPersonId(),entity.getTenantId()); - for(TenPersonSyncEntity syncEn: syncEntitys){ + List syncEntitys = tenPersonSyncService.findByPersonId(entity.getPersonId(), entity.getTenantId()); + for (TenPersonSyncEntity syncEn : syncEntitys) { syncEn.setLastUpdateTime(entity.getLastUpdateTime()); syncEn.setState(2); tenPersonSyncService.updateById(syncEn); @@ -1190,7 +1190,7 @@ public class TenPersonServiceImpl implements TenPersonService { vo.setOperation(2); vo.setLast_update_stamp(entity.getLastUpdateTime()); list.add(vo); - serverApiService.personOperation(syncEn.getDeviceSn(),list); + serverApiService.personOperation(syncEn.getDeviceSn(), list); } // List devList = tenDeviceService.findByCellId(entity.getCellId()); @@ -1199,9 +1199,6 @@ public class TenPersonServiceImpl implements TenPersonService { // } - - - return "OK"; } @@ -1343,13 +1340,13 @@ public class TenPersonServiceImpl implements TenPersonService { //升序排列 List list = tenPersonDao.findUpdatePerson(cellId, buildId, roomId, lastUpdateTime); // List removeIndex = new ArrayList<>(); - if(list.size()>0){ - TenPersonVo lastPerson = list.get(list.size()-1); - String last = DateUtils.format(lastPerson.getLastUpdateTime(),DateUtils.DATE_TIME_PATTERN); + if (list.size() > 0) { + TenPersonVo lastPerson = list.get(list.size() - 1); + String last = DateUtils.format(lastPerson.getLastUpdateTime(), DateUtils.DATE_TIME_PATTERN); List listAfter = tenPersonDao.findByLastUpdatePerson(cellId, buildId, roomId, last); - for(TenPersonVo vo:listAfter){ - if(vo.getPersonId().longValue() != lastPerson.getPersonId().longValue() - && vo.getLastUpdateTime().getTime() == lastPerson.getLastUpdateTime().getTime()){ + for (TenPersonVo vo : listAfter) { + if (vo.getPersonId().longValue() != lastPerson.getPersonId().longValue() + && vo.getLastUpdateTime().getTime() == lastPerson.getLastUpdateTime().getTime()) { list.add(vo); } } @@ -1361,9 +1358,8 @@ public class TenPersonServiceImpl implements TenPersonService { // } - // for (TenPersonVo vo : list) { - for (int i = 0;i findAllPerson(Long cellId, Long buildId, Long roomId, String lastUpdateTime) { //升序排列 List list = tenPersonDao.findUpdatePerson(cellId, buildId, roomId, lastUpdateTime); - if(list.size()>0){ - TenPersonVo lastPerson = list.get(list.size()-1); - String last = DateUtils.format(lastPerson.getLastUpdateTime(),DateUtils.DATE_TIME_PATTERN); + if (list.size() > 0) { + TenPersonVo lastPerson = list.get(list.size() - 1); + String last = DateUtils.format(lastPerson.getLastUpdateTime(), DateUtils.DATE_TIME_PATTERN); List listAfter = tenPersonDao.findByLastUpdatePerson(cellId, buildId, roomId, last); - for(TenPersonVo vo:listAfter){ - if(vo.getPersonId().longValue() != lastPerson.getPersonId().longValue() - && vo.getLastUpdateTime().getTime() == lastPerson.getLastUpdateTime().getTime()){ + for (TenPersonVo vo : listAfter) { + if (vo.getPersonId().longValue() != lastPerson.getPersonId().longValue() + && vo.getLastUpdateTime().getTime() == lastPerson.getLastUpdateTime().getTime()) { list.add(vo); } } } - for (int i = 0;i findAllPersonIdUpdate(Long cellId, Long buildId, Long roomId) { //升序排列 @@ -1617,9 +1610,6 @@ public class TenPersonServiceImpl implements TenPersonService { } - - - @Override public List findAllByCellId(Long cellId) { return tenPersonDao.findAllByCellId(cellId); @@ -1790,7 +1780,6 @@ public class TenPersonServiceImpl implements TenPersonService { // log.info("原图"+tenPerson.getOrgImage()+"-"+personModel.getOrgImage()); - //2. 截取人脸图片 //检测图片人脸 @@ -1820,13 +1809,12 @@ public class TenPersonServiceImpl implements TenPersonService { inputStreamFace.close(); tenPerson.setFaceImage(faceImageFileName); } - }else{ + } else { //windows 保存原始头像 tenPerson.setFaceImage(orgImageFileName); } - // int res = PicSDK.getFace(personModel.getOrgImage(), tempFaceFilePath); // if (res != 0) { // return; @@ -1852,16 +1840,14 @@ public class TenPersonServiceImpl implements TenPersonService { // tenPerson.setFaceImage(faceImageFileName); - // tenPerson.setFaceImage(orgImageFileName); //-------------------------------------------------------------------- - //--------------------------------处理图片大小------------------------------------------------------ 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(); try { File picture = new File(orgFileStr); @@ -1873,7 +1859,7 @@ public class TenPersonServiceImpl implements TenPersonService { .size(1080, 1080) .toFile(orgFileStr); } - }catch (Exception e){ + } catch (Exception e) { log.error(e.getMessage()); } } @@ -1888,7 +1874,7 @@ public class TenPersonServiceImpl implements TenPersonService { tenPersonDao.insert(tenPerson); //门禁表 - if(personModel.getDoorCard()!=null && personModel.getDoorCard().length()>0){ + if (personModel.getDoorCard() != null && personModel.getDoorCard().length() > 0) { TenDoorCardEntity doorCardEntity = new TenDoorCardEntity(); doorCardEntity.setDoorCard(personModel.getDoorCard()); doorCardEntity.setCellId(tenPerson.getCellId()); @@ -1914,10 +1900,10 @@ public class TenPersonServiceImpl implements TenPersonService { //下发设备通知 List devList = tenDeviceService.findByCellId(cellId); - for(TenDeviceVo deviceVo: devList){ - List operationList = tenPersonSyncService.findDeviceAllAddPersons(deviceVo.getDeviceId(),deviceVo.getTenantId()); + for (TenDeviceVo deviceVo : devList) { + List operationList = tenPersonSyncService.findDeviceAllAddPersons(deviceVo.getDeviceId(), deviceVo.getTenantId()); List voList = new ArrayList<>(); - for(TenPersonSyncEntity syncEntity: operationList){ + for (TenPersonSyncEntity syncEntity : operationList) { TenPersonOperationVo vo = new TenPersonOperationVo(); vo.setUid(syncEntity.getPersonId()); vo.setOperation(syncEntity.getState()); @@ -1925,8 +1911,8 @@ public class TenPersonServiceImpl implements TenPersonService { voList.add(vo); } - int flag = serverApiService.personOperation(deviceVo.getSn(),voList); - if(flag == 0){ + int flag = serverApiService.personOperation(deviceVo.getSn(), voList); + if (flag == 0) { //下发成功,删除状态为删除的同步人员 // tenPersonSyncService.removeAllDeletePersons(deviceEntity.getDeviceId(),tenantId); } @@ -1934,7 +1920,6 @@ public class TenPersonServiceImpl implements TenPersonService { } - @Override public int getAllCount(Map params) { List cellIds = new ArrayList<>(); @@ -1973,4 +1958,21 @@ public class TenPersonServiceImpl implements TenPersonService { public List getAllExpireGuest() { return tenPersonDao.getAllExpireGuest(); } + + public TenPersonEntity getOwner(Long roomId) { + return this.tenPersonDao.getOwner(roomId); + } + + @Override + public List getNotSync(Long cellId) { + return this.tenPersonDao.getNotSync(cellId); + } + @Override + public List getNotSyncCard(Long cellId) { + return this.tenPersonDao.getNotSyncCard(cellId); + } + @Override + public List getNotSyncImage(Long cellId) { + return this.tenPersonDao.getNotSyncImage(cellId); + } } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenRecordServiceImpl.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenRecordServiceImpl.java index 3caae56..23e6813 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenRecordServiceImpl.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenRecordServiceImpl.java @@ -360,4 +360,13 @@ public class TenRecordServiceImpl implements TenRecordService { } return page.getRecords(); } + + @Override + public List getNotSync(Long cellId, Long tenantId) { + return this.tenRecordDao.getNotSync(cellId, tenantId); + } + @Override + public List getNotSyncImage(Long cellId, Long tenantId) { + return this.tenRecordDao.getNotSyncImage(cellId, tenantId); + } } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenRoomServiceImpl.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenRoomServiceImpl.java index d49a34a..eb185bf 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenRoomServiceImpl.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenRoomServiceImpl.java @@ -182,4 +182,11 @@ public class TenRoomServiceImpl implements TenRoomService { } return tenRoomDao.getAllCount(cellIds,params); } + + @Override + public List getNotSync(Long cellId) { + return this.tenRoomDao.getNotSync(cellId); + } + + } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/xian/service/XaApi.java b/shapelight-admin/src/main/java/net/shapelight/modules/xian/service/XaApi.java index 5d463da..0858dcc 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/xian/service/XaApi.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/xian/service/XaApi.java @@ -19,23 +19,54 @@ public class XaApi { 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) { - Map postParameters = new HashMap<>(); +// Map 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); postParameters.put("xqid", xqid); postParameters.put("appid", appId); postParameters.put("appsecret", appsecretMd5); - return XaHttpUtils.postHttp("http://117.34.12.66:10011/zhxqgl/interface/get_xq_addr.jsp", postParameters); + + Map 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) { - Map postParameters = new HashMap<>(); - String appsecretMd5 = MD5Utils.getMD5Str(appSecret); + JSONObject postParameters = new JSONObject(); + String appsecretMd5 = MD5Utils.md5Str(appSecret); +// postParameters.put("xqid", xqid); postParameters.put("appid", appId); postParameters.put("appsecret", appsecretMd5); - String res = XaHttpUtils.postHttp("http://117.34.12.66:10011/ywxzservice/get_fwjk_url.jsp", postParameters); + + Map 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); if (resObject != null) { + log.debug(resObject.toJSONString()); JSONObject xmlObject = resObject.getJSONObject("xml"); String code = xmlObject.getString("code"); if (code != null && code.equals("0000")) @@ -58,7 +89,7 @@ public class XaApi { String tokenStr = appId + appSecret + DateUtils.format(new Date(), "YYYYMMDD") + dataMiWen; String token = MD5Utils.getMD5Str(tokenStr); Map headerMaps = new HashMap<>(); - headerMaps.put("appID", appId); + headerMaps.put("appId", appId); headerMaps.put("token", token); headerMaps.put("tranId", tranId); headerMaps.put("serviceId", serviceId); @@ -70,4 +101,23 @@ public class XaApi { 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); + + + + } + } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/xian/service/test_return.jsp b/shapelight-admin/src/main/java/net/shapelight/modules/xian/service/test_return.jsp new file mode 100644 index 0000000..410e191 --- /dev/null +++ b/shapelight-admin/src/main/java/net/shapelight/modules/xian/service/test_return.jsp @@ -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"%> + +返回数据页面 +<%! +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);//返回结果 +%> + + + diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/xian/utils/XaHttpUtils.java b/shapelight-admin/src/main/java/net/shapelight/modules/xian/utils/XaHttpUtils.java index c424f31..52ab919 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/xian/utils/XaHttpUtils.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/xian/utils/XaHttpUtils.java @@ -2,25 +2,36 @@ package net.shapelight.modules.xian.utils; import com.alibaba.fastjson.JSONObject; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; import java.util.Date; +import java.util.Iterator; +import java.util.List; import java.util.Map; import net.shapelight.common.utils.DateUtils; import net.shapelight.common.utils.MD5Utils; +import net.shapelight.common.utils.RestTemplateUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; import org.springframework.http.client.ClientHttpRequestFactory; +import org.springframework.http.client.ClientHttpResponse; import org.springframework.http.client.SimpleClientHttpRequestFactory; import org.springframework.http.converter.StringHttpMessageConverter; +import org.springframework.util.LinkedMultiValueMap; import org.springframework.util.MultiValueMap; import org.springframework.web.client.DefaultResponseErrorHandler; import org.springframework.web.client.ResponseErrorHandler; import org.springframework.web.client.RestClientException; import org.springframework.web.client.RestTemplate; +import javax.servlet.http.HttpServletResponse; + public class XaHttpUtils { @@ -30,7 +41,7 @@ public class XaHttpUtils { private static final String appSecret = "22971647780410956329716477804109"; - public static String postHttp(String url, Map postParameters) { + public static String postHttp(String url, MultiValueMap postParameters) { SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory(); requestFactory.setConnectTimeout(180000); requestFactory.setReadTimeout(180000); @@ -53,32 +64,129 @@ public class XaHttpUtils { return result; } - public static String postHttp(String url, Map postParameters, Map 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)); + + + /** + * 加密参数类型请求 application/x-www-form-urlencoded + * MultiValueMap + * 采用 HttpEntity> 构造 + * http 请求 post + * @param url 地址 + * @param +// * @param headersMap header +// * @param connecTimeout 连接时间 +// * @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 postParameters = createMultiValueMap(postParametersJson); + HttpEntity> 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> 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 createMultiValueMap(JSONObject params) { + MultiValueMap map = new LinkedMultiValueMap<>(); + for (String key : params.keySet()) { + if (params.get(key) instanceof List) { + for (Iterator it = ((List) 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 postParameters, Map 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> 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) { SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory(); @@ -103,13 +211,13 @@ public class XaHttpUtils { 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 + DateUtils.format(new Date(), "YYYYMMDD") + requestPackage); } - public String packageEncode(String appSecret, String packageString) { + public static String packageEncode(String appSecret, String packageString) { try { String res = AESUtils.encrypt(packageString, appSecret); 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 { String res = AESUtils.decrypt(packageString, appSecret); return res; @@ -129,4 +237,6 @@ public class XaHttpUtils { } } + + } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/xian/utils/XaUtils.java b/shapelight-admin/src/main/java/net/shapelight/modules/xian/utils/XaUtils.java new file mode 100644 index 0000000..42997f8 --- /dev/null +++ b/shapelight-admin/src/main/java/net/shapelight/modules/xian/utils/XaUtils.java @@ -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 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 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 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); + + } +} diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/xian/vo/XaPages.java b/shapelight-admin/src/main/java/net/shapelight/modules/xian/vo/XaPages.java index 3a79c31..5214779 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/xian/vo/XaPages.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/xian/vo/XaPages.java @@ -1,6 +1,9 @@ package net.shapelight.modules.xian.vo; +import lombok.Data; + +@Data public class XaPages { /** * pages 否 对象 4.1查询接口时需要 diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/xian/vo/XaRYRKPHOTO.java b/shapelight-admin/src/main/java/net/shapelight/modules/xian/vo/XaRYRKPHOTO.java index 208493e..dee0fae 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/xian/vo/XaRYRKPHOTO.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/xian/vo/XaRYRKPHOTO.java @@ -4,17 +4,9 @@ import lombok.Data; @Data public class XaRYRKPHOTO { - - - private String LV_CASE_ID; - - private String LV_SSXQBM; - - private String LV_ZP; - - private String LV_DJSJ; - - private String LV_GMSFHM; - - + private String LV_CASE_ID; + private String LV_SSXQBM; + private String LV_ZP; + private String LV_DJSJ; + private String LV_GMSFHM; } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/xian/vo/XaSYRK.java b/shapelight-admin/src/main/java/net/shapelight/modules/xian/vo/XaSYRK.java index 1093fd1..041950e 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/xian/vo/XaSYRK.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/xian/vo/XaSYRK.java @@ -1,5 +1,8 @@ package net.shapelight.modules.xian.vo; +import lombok.Data; + +@Data public class XaSYRK { /** * 6.3.1 实有人口信息数据项 @@ -110,5 +113,7 @@ public class XaSYRK { */ private String LV_PROCMODE = "PMINSERT"; + private String LV_ZJZL = "10"; + } diff --git a/shapelight-admin/src/main/resources/mapper/ten/TenCellDao.xml b/shapelight-admin/src/main/resources/mapper/ten/TenCellDao.xml index 0264ce6..f5e1d83 100644 --- a/shapelight-admin/src/main/resources/mapper/ten/TenCellDao.xml +++ b/shapelight-admin/src/main/resources/mapper/ten/TenCellDao.xml @@ -3,7 +3,7 @@ - + @@ -94,35 +94,35 @@ - + - - - - + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + diff --git a/shapelight-admin/src/main/resources/mapper/ten/TenDeviceDao.xml b/shapelight-admin/src/main/resources/mapper/ten/TenDeviceDao.xml index 558ec27..efb868b 100644 --- a/shapelight-admin/src/main/resources/mapper/ten/TenDeviceDao.xml +++ b/shapelight-admin/src/main/resources/mapper/ten/TenDeviceDao.xml @@ -3,7 +3,7 @@ - + @@ -50,6 +50,7 @@ + diff --git a/shapelight-admin/src/main/resources/mapper/ten/TenPackChannalDao.xml b/shapelight-admin/src/main/resources/mapper/ten/TenPackChannalDao.xml new file mode 100644 index 0000000..362482c --- /dev/null +++ b/shapelight-admin/src/main/resources/mapper/ten/TenPackChannalDao.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/shapelight-admin/src/main/resources/mapper/ten/TenPackRecordDao.xml b/shapelight-admin/src/main/resources/mapper/ten/TenPackRecordDao.xml index 4ebd08c..372f41c 100644 --- a/shapelight-admin/src/main/resources/mapper/ten/TenPackRecordDao.xml +++ b/shapelight-admin/src/main/resources/mapper/ten/TenPackRecordDao.xml @@ -3,7 +3,7 @@ - + @@ -25,6 +25,8 @@ + + @@ -92,6 +94,12 @@ cell_id, + + xa_sync, + + + xa_sync_image, + @@ -154,13 +162,19 @@ #{cellId,jdbcType=BIGINT}, + + #{xaSync}, + + + #{xaSyncImage}, + - + update ten_pack_record @@ -225,6 +239,12 @@ cell_id = #{cellId,jdbcType=BIGINT}, + + xa_sync = #{xaSync}, + + + xa_sync_image = #{xaSyncImage}, + where record_id = #{recordId,jdbcType=VARCHAR} @@ -238,11 +258,11 @@ + + + + + diff --git a/shapelight-admin/src/main/resources/mapper/ten/TenPackRecordEnterDao.xml b/shapelight-admin/src/main/resources/mapper/ten/TenPackRecordEnterDao.xml new file mode 100644 index 0000000..76dc673 --- /dev/null +++ b/shapelight-admin/src/main/resources/mapper/ten/TenPackRecordEnterDao.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/shapelight-admin/src/main/resources/mapper/ten/TenPackRecordExitDao.xml b/shapelight-admin/src/main/resources/mapper/ten/TenPackRecordExitDao.xml new file mode 100644 index 0000000..cb20ea5 --- /dev/null +++ b/shapelight-admin/src/main/resources/mapper/ten/TenPackRecordExitDao.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/shapelight-admin/src/main/resources/mapper/ten/TenPersonDao.xml b/shapelight-admin/src/main/resources/mapper/ten/TenPersonDao.xml index 2e14692..d8d2806 100644 --- a/shapelight-admin/src/main/resources/mapper/ten/TenPersonDao.xml +++ b/shapelight-admin/src/main/resources/mapper/ten/TenPersonDao.xml @@ -44,6 +44,9 @@ + + + @@ -218,6 +221,15 @@ face_failure, + + xa_sync, + + + xa_sync_card, + + + xa_sync_image, + @@ -337,6 +349,15 @@ #{faceFailure,jdbcType=TINYINT}, + + #{xaSync,jdbcType=TINYINT}, + + + #{xaSyncCard,jdbcType=TINYINT}, + + + #{xaSyncImage,jdbcType=TINYINT}, + @@ -461,6 +482,15 @@ face_failure = #{faceFailure,jdbcType=TINYINT}, + + xa_sync = #{xaSync,jdbcType=TINYINT}, + + + xa_sync_card = #{xaSyncCard,jdbcType=TINYINT}, + + + xa_sync_image = #{xaSyncImage,jdbcType=TINYINT}, + where person_id = #{personId,jdbcType=BIGINT} @@ -529,44 +559,44 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + @@ -670,20 +700,20 @@ - - - - - - - + + + + + + + @@ -850,7 +880,7 @@ and person_type in(5000,5001,5002) and cell_id = #{cellId} - + @@ -869,4 +899,37 @@ and delete_flag = 0 + + + + + + + + + + + + + diff --git a/shapelight-admin/src/main/resources/mapper/ten/TenRecordDao.xml b/shapelight-admin/src/main/resources/mapper/ten/TenRecordDao.xml index 870d976..f97891f 100644 --- a/shapelight-admin/src/main/resources/mapper/ten/TenRecordDao.xml +++ b/shapelight-admin/src/main/resources/mapper/ten/TenRecordDao.xml @@ -3,7 +3,7 @@ - + @@ -17,6 +17,8 @@ + + @@ -59,6 +61,12 @@ tenant_id, + + xa_sync, + + + xa_sync_image, + @@ -97,6 +105,12 @@ #{tenantId,jdbcType=BIGINT}, + + #{xaSync}, + + + #{xaSyncImage}, + @@ -140,6 +154,12 @@ tenant_id = #{tenantId,jdbcType=BIGINT}, + + xa_sync = #{xaSync,jdbcType=TINYINT}, + + + xa_sync_image = #{xaSyncImage,jdbcType=TINYINT}, + where record_id = #{recordId,jdbcType=BIGINT} @@ -159,20 +179,20 @@ - + - + - + - + - + @@ -249,17 +269,17 @@ - - - - + + + + - + - + - + - + @@ -340,19 +360,19 @@ - + - + - + - + - + @@ -384,5 +404,17 @@ order by record_time desc limit 1 + + + + diff --git a/shapelight-admin/src/main/resources/mapper/ten/TenRoomDao.xml b/shapelight-admin/src/main/resources/mapper/ten/TenRoomDao.xml index a06bd36..169e7d4 100644 --- a/shapelight-admin/src/main/resources/mapper/ten/TenRoomDao.xml +++ b/shapelight-admin/src/main/resources/mapper/ten/TenRoomDao.xml @@ -27,6 +27,9 @@ + + + @@ -113,6 +116,15 @@ tenant_id, + + xa_sync, + + + p_id, + + + dzbm, + @@ -184,6 +196,15 @@ #{tenantId,jdbcType=BIGINT}, + + #{xaSync,jdbcType=TINYINT}, + + + #{pId,jdbcType=VARCHAR}, + + + #{dzbm,jdbcType=VARCHAR}, + @@ -261,6 +282,15 @@ tenant_id = #{tenantId,jdbcType=BIGINT}, + + xa_sync = #{xaSync,jdbcType=TINYINT}, + + + p_id = #{pId,jdbcType=VARCHAR}, + + + dabm = #{dzbm,jdbcType=VARCHAR}, + where room_id = #{roomId,jdbcType=BIGINT} @@ -276,7 +306,7 @@ - update ten_room_$ set delete_flag = 1 + update ten_room set delete_flag = 1 where room_id = #{roomId,jdbcType=BIGINT} @@ -292,25 +322,25 @@ - + - - - - + + + + @@ -384,4 +414,13 @@ + + + + +