diff --git a/cell_db_v1.0.sql b/cell_db_v1.0.sql index 37f256c..57468a2 100644 --- a/cell_db_v1.0.sql +++ b/cell_db_v1.0.sql @@ -11,7 +11,7 @@ Target Server Version : 50725 File Encoding : 65001 - Date: 26/04/2021 09:40:34 + Date: 26/04/2021 11:08:15 */ SET NAMES utf8mb4; @@ -7710,10 +7710,10 @@ CREATE TABLE `sys_role` ( -- Records of sys_role -- ---------------------------- BEGIN; -INSERT INTO `sys_role` VALUES (100, '平台管理员', 100, '平台管理员', NULL, '2020-05-14 11:03:54', '路人甲', NULL, NULL, NULL); -INSERT INTO `sys_role` VALUES (1000, '运营商管理员', 1000, '所有功能及数据', NULL, '2020-04-02 21:31:47', '路人甲', NULL, NULL, NULL); -INSERT INTO `sys_role` VALUES (2000, '区域管理员', 2000, '管理指定区域及以下区域所有数据', NULL, '2020-04-02 21:11:16', '路人甲', NULL, NULL, NULL); -INSERT INTO `sys_role` VALUES (3000, '小区主管', 3000, '管理指定小区数据', NULL, '2020-04-02 21:11:16', '路人甲', NULL, NULL, NULL); +INSERT INTO `sys_role` VALUES (100, '平台管理员', 100, '平台管理员', NULL, '2020-05-14 11:03:54', 'admin', NULL, NULL, NULL); +INSERT INTO `sys_role` VALUES (1000, '运营商管理员', 1000, '所有功能及数据', NULL, '2020-04-02 21:31:47', 'admin', NULL, NULL, NULL); +INSERT INTO `sys_role` VALUES (2000, '区域管理员', 2000, '管理指定区域及以下区域所有数据', NULL, '2020-04-02 21:11:16', 'admin', NULL, NULL, NULL); +INSERT INTO `sys_role` VALUES (3000, '小区主管', 3000, '管理指定小区数据', NULL, '2020-04-02 21:11:16', 'admin', NULL, NULL, NULL); COMMIT; -- ---------------------------- @@ -7940,7 +7940,7 @@ CREATE TABLE `sys_user` ( -- Records of sys_user -- ---------------------------- BEGIN; -INSERT INTO `sys_user` VALUES (1, 1, 'admin', 'js1hFvoKLUSRIfluuWO5', '424424a14ae460df93b3b734f1e46162c412c6eb1cf4ae5ce3bfac96836cdad7', '路人甲', NULL, NULL, '路人甲', '1@163.com', '15822222223', 1, NULL, 'admin', '2020-01-01 12:01:01', 'admin', '2020-01-01 12:01:01', NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `sys_user` VALUES (1, 1, 'admin', 'js1hFvoKLUSRIfluuWO5', '424424a14ae460df93b3b734f1e46162c412c6eb1cf4ae5ce3bfac96836cdad7', '路人甲', NULL, NULL, '平台超管', '1@163.com', '15822222223', 1, NULL, 'admin', '2020-01-01 12:01:01', 'admin', '2020-01-01 12:01:01', NULL, NULL, NULL, NULL, NULL, NULL, NULL); COMMIT; -- ---------------------------- @@ -7959,7 +7959,7 @@ CREATE TABLE `sys_user_role` ( -- Records of sys_user_role -- ---------------------------- BEGIN; -INSERT INTO `sys_user_role` VALUES (239, 1, 100, NULL); +INSERT INTO `sys_user_role` VALUES (1, 1, 100, NULL); COMMIT; -- ---------------------------- @@ -7979,7 +7979,6 @@ CREATE TABLE `sys_user_token` ( -- Records of sys_user_token -- ---------------------------- BEGIN; -INSERT INTO `sys_user_token` VALUES (1, '3f737bbc960e1129d4d0f5420de212c4', '2021-04-26 17:07:25', '2021-04-25 17:07:25'); COMMIT; -- ---------------------------- diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/app/controller/AppApiController.java b/shapelight-admin/src/main/java/net/shapelight/modules/app/controller/AppApiController.java index 61bd353..198503c 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/app/controller/AppApiController.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/app/controller/AppApiController.java @@ -140,6 +140,14 @@ public class AppApiController { return R.error("姓名在此房间已存在"); } + if(tenPerson.getIdCard()!=null){ + TenPersonEntity tenPersonIdcard = tenPersonService.findByIdCard(tenPerson.getIdCard(), + tenPerson.getRoomId(),tenPerson.getCellId()); + if(tenPersonIdcard!=null){ + return R.error("身份证在此房间已存在"); + } + } + int res = tenPersonService.save(tenPerson); if (res==2) { return R.error("照片未检测到人脸"); @@ -479,6 +487,14 @@ public class AppApiController { return R.error("姓名在此房间已存在"); } + if(tenPerson.getIdCard()!=null){ + TenPersonEntity tenPersonIdcard = tenPersonService.findByIdCard(tenPerson.getIdCard(), + tenPerson.getRoomId(),tenPerson.getCellId()); + if(tenPersonIdcard!=null){ + return R.error("身份证在此房间已存在"); + } + } + long id = new SnowflakeIdWorker().nextId(); tenPerson.setPersonId(id); tenPerson.setUuid(UUIDUtil.uuid()); @@ -544,6 +560,14 @@ public class AppApiController { return R.error("姓名在此房间已存在"); } + if(tenPerson.getIdCard()!=null){ + TenPersonEntity tenPersonIdcard = tenPersonService.findByIdCard(tenPerson.getIdCard(), + tenPerson.getRoomId(),tenPerson.getCellId()); + if(tenPersonIdcard!=null){ + return R.error("身份证在此房间已存在"); + } + } + int res = tenPersonService.save(tenPerson); 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 2e4b0fe..af0debd 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 @@ -326,7 +326,9 @@ public class CarOpenApi { int carType = bizContent.getIntValue("carType"); String imgUrl = bizContent.getString("imgUrl"); //去掉 amp; - imgUrl = imgUrl.replace("amp;", ""); + if(imgUrl!=null){ + imgUrl = imgUrl.replace("amp;", ""); + } String fileName = "car/" + parkCode + "/" + UUIDUtil.uuid() + ".jpg"; if (!StringUtils.isEmpty(imgUrl)) { diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/excel/listener/PersonExcelListener.java b/shapelight-admin/src/main/java/net/shapelight/modules/excel/listener/PersonExcelListener.java index 045ebc6..de89277 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/excel/listener/PersonExcelListener.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/excel/listener/PersonExcelListener.java @@ -5,6 +5,7 @@ import com.alibaba.excel.event.AnalysisEventListener; import com.alibaba.fastjson.JSONObject; import io.minio.PutObjectOptions; import lombok.Getter; +import net.shapelight.common.utils.R; import net.shapelight.common.utils.UUIDUtil; import net.shapelight.commons.engine.sdk.PicSDK; import net.shapelight.modules.excel.model.PersonModel; @@ -133,6 +134,15 @@ public class PersonExcelListener extends AnalysisEventListener { return; } + + TenPersonEntity tenPersonEntityIdCord = tenPersonService.findByIdCard(personModel.getIdCard(), + tenRoomEntity.getRoomId(),cellEntity.getCellId()); + if(tenPersonEntityIdCord!=null){ + personModel.setMessage("身份证在此房间已存在"); + list.add(personModel); + return; + } + String gender = personModel.getGender(); if(gender==null){ personModel.setMessage("性别为空"); 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 index 8496312..d550e6b 100644 --- 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 @@ -185,44 +185,46 @@ public class XaRealDataTask implements ITask { XaSYRK realPerson = new XaSYRK(); TenRoomEntity roomEntity = tenRoomService.getById(person.getRoomId(), person.getCellId()); TenAddressEntity addressEntity = tenAddressService.getById(roomEntity.getPId()); + if(addressEntity!=null){ + String idcard = person.getIdCard(); + if (idcard.length() >= 18) { + idcard = idcard.substring(0, 18); + } else { + StringBuffer zeroBuf = new StringBuffer(); + for (int i = 0; i < 18 - idcard.length(); i++) { + zeroBuf.append("0"); + } + zeroBuf.append(idcard); + idcard = zeroBuf.toString(); - String idcard = person.getIdCard(); - if (idcard.length() >= 18) { - idcard = idcard.substring(0, 18); - } else { - StringBuffer zeroBuf = new StringBuffer(); - for (int i = 0; i < 18 - idcard.length(); i++) { - zeroBuf.append("0"); } - zeroBuf.append(idcard); - idcard = zeroBuf.toString(); + String syrkbm = String.format("10%s%012d", idcard, addressEntity.getPId());//证件类型10+身份证号(18位)+p_id(12位) + person.setUuid(syrkbm); + + realPerson.setLV_SYRKBM(syrkbm); //实有人口编码 + realPerson.setLV_GMSFHM(person.getIdCard()); //身份证号 + realPerson.setLV_XM(person.getName()); //姓名 + realPerson.setLV_ZJZL("10"); + realPerson.setLV_ZJHM(person.getIdCard()); //身份证号 + realPerson.setLV_JZDZ_DZBM(addressEntity.getDzdm()); //地址编码 DZDM + realPerson.setLV_JZDZ_SSXQ(addressEntity.getXzqh()); //行政区划 XZQH + realPerson.setLV_JZDZ_QHLXXDZ(addressEntity.getDzqc()); //地址名称 DZQC + realPerson.setLV_DJDWGAJGJGMC("西图之光智能科技有限公司"); //承建商名称 + realPerson.setLV_DJDWGAJGJGDM("xtzg"); + realPerson.setLV_DJSJ(DateUtils.format(new Date(), "yyyyMMddHHmmss")); + realPerson.setLV_COMPUTERID(xqid); //XQID + realPerson.setLV_PROCMODE("PMINSERT"); + + syncPersons.add(realPerson); + updatePersons.add(person); + + count++; + if (count >= 50) + break; + }else{ + continue; } - String syrkbm = String.format("10%s%012d", idcard, addressEntity.getPId());//证件类型10+身份证号(18位)+p_id(12位) - - person.setUuid(syrkbm); - - realPerson.setLV_SYRKBM(syrkbm); //实有人口编码 - realPerson.setLV_GMSFHM(person.getIdCard()); //身份证号 - realPerson.setLV_XM(person.getName()); //姓名 - realPerson.setLV_ZJZL("10"); - realPerson.setLV_ZJHM(person.getIdCard()); //身份证号 - realPerson.setLV_JZDZ_DZBM(addressEntity.getDzdm()); //地址编码 DZDM - realPerson.setLV_JZDZ_SSXQ(addressEntity.getXzqh()); //行政区划 XZQH - realPerson.setLV_JZDZ_QHLXXDZ(addressEntity.getDzqc()); //地址名称 DZQC - realPerson.setLV_DJDWGAJGJGMC("西图之光智能科技有限公司"); //承建商名称 - realPerson.setLV_DJDWGAJGJGDM("xtzg"); - realPerson.setLV_DJSJ(DateUtils.format(new Date(), "yyyyMMddHHmmss")); - realPerson.setLV_COMPUTERID(xqid); //XQID - realPerson.setLV_PROCMODE("PMINSERT"); - - syncPersons.add(realPerson); - updatePersons.add(person); - - count++; - if (count >= 50) - break; - } if(count == 0){ return; @@ -267,22 +269,23 @@ public class XaRealDataTask implements ITask { for (TenPersonEntity person : persons) { TenRoomEntity roomEntity = tenRoomService.getById(person.getRoomId(), person.getCellId()); TenAddressEntity addressEntity = tenAddressService.getById(roomEntity.getPId()); + if(addressEntity!=null){ + XaMJKXX realCard = new XaMJKXX(); + realCard.setLV_MJKLX("4"); + realCard.setLV_DJSJ(DateUtils.format(new Date(), "yyyyMMddHHmmss")); + realCard.setLV_SSXQBM(addressEntity.getSsxqbm()); + realCard.setLV_SBXT("10"); + realCard.setLV_CKR(person.getIdCard()); + realCard.setLV_BH(person.getPersonId().toString()); + realCard.setLV_PROCMODE("PMINSERT"); - XaMJKXX realCard = new XaMJKXX(); - realCard.setLV_MJKLX("4"); - realCard.setLV_DJSJ(DateUtils.format(new Date(), "yyyyMMddHHmmss")); - realCard.setLV_SSXQBM(addressEntity.getSsxqbm()); - realCard.setLV_SBXT("10"); - realCard.setLV_CKR(person.getIdCard()); - realCard.setLV_BH(person.getPersonId().toString()); - realCard.setLV_PROCMODE("PMINSERT"); + syncDoorCards.add(realCard); + updatePersons.add(person); - syncDoorCards.add(realCard); - updatePersons.add(person); - - count++; - if (count >= 50) - break; + count++; + if (count >= 50) + break; + } } if(count == 0){ diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenPersonController.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenPersonController.java index 3d58a49..fb50370 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenPersonController.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenPersonController.java @@ -349,6 +349,14 @@ public class TenPersonController extends AbstractController { } + if(tenPerson.getIdCard()!=null){ + TenPersonEntity tenPersonIdcard = tenPersonService.findByIdCard(tenPerson.getIdCard(), + tenPerson.getRoomId(),tenPerson.getCellId()); + if(tenPersonIdcard!=null){ + return R.error("身份证在此房间已存在"); + } + } + long id = new SnowflakeIdWorker().nextId(); tenPerson.setPersonId(id); @@ -388,6 +396,18 @@ public class TenPersonController extends AbstractController { } } + if(tenPerson.getIdCard()!=null){ + TenPersonEntity oldPerson = tenPersonService.getById(tenPerson.getPersonId(),tenPerson.getCellId()); + if(!tenPerson.getIdCard().equals(oldPerson.getIdCard())){ + TenPersonEntity tenPersonEntityIdCard = tenPersonService.findByIdCard(tenPerson.getIdCard(), + oldPerson.getRoomId(),oldPerson.getCellId()); + if(tenPersonEntityIdCard!=null){ + return R.error("身份证在此房间已存在"); + } + } + } + + //验证卡号 if(tenPerson.getDoorCardEntity()!=null){ TenDoorCardEntity oldDoorCard = tenDoorCardService.getOne(new QueryWrapper() 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 03123a0..a496694 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 @@ -77,6 +77,10 @@ public interface TenPersonDao { @Param("roomId")Long roomId, @Param("cellId")Long cellId); + TenPersonEntity findByIdCard(@Param("idCard")String idCard, + @Param("roomId")Long roomId, + @Param("cellId")Long cellId); + List getAllExpireGuest(); 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 5ee0e81..c21fe2c 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 @@ -89,14 +89,16 @@ public interface TenPersonService { Long roomId, Long cellId); + TenPersonEntity findByIdCard(String idCard, + Long roomId, + Long cellId); + TenCellEntity findCellByCellName(String name, String tenantId); TenBuildEntity findBuildByNameAndUnit(String name, String unit, Long cellId); TenRoomEntity findRoomByRoomName(String roomName, Long buildId, Long cellId); - - List processUploadFile(Map> fileMap, String tenantId); 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 index 2c92447..e1b4dde 100644 --- 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 @@ -67,6 +67,7 @@ public class TenPackRecordEnterServiceImpl extends ServiceImpl() .eq("cell_id",cellId) .eq("xa_sync",0) + .isNotNull("image") .last(" and TO_DAYS(enter_time) = TO_DAYS(NOW())")); } @Override @@ -74,6 +75,7 @@ public class TenPackRecordEnterServiceImpl extends ServiceImpl() .eq("cell_id",cellId) .eq("xa_sync_image",0) + .isNotNull("image") .eq("xa_sync",1) .last(" and TO_DAYS(enter_time) = TO_DAYS(NOW())")); } 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 bf2f688..7422c3c 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 @@ -1696,6 +1696,13 @@ public class TenPersonServiceImpl implements TenPersonService { return tenPersonDao.findByName(name, roomId, cellId); } + @Override + public TenPersonEntity findByIdCard(String idCard, + Long roomId, + Long cellId){ + return tenPersonDao.findByIdCard(idCard, roomId, cellId); + } + @Override public TenCellEntity findCellByCellName(String name, String tenantId) { return tenCellService.findByCellName(name, tenantId); diff --git a/shapelight-admin/src/main/resources/mapper/ten/TenPersonDao.xml b/shapelight-admin/src/main/resources/mapper/ten/TenPersonDao.xml index 5b7c841..b3d8cee 100644 --- a/shapelight-admin/src/main/resources/mapper/ten/TenPersonDao.xml +++ b/shapelight-admin/src/main/resources/mapper/ten/TenPersonDao.xml @@ -544,6 +544,14 @@ and name = #{name} and (person_type = 5000 or person_type = 5001 or person_type = 5002) + + + +