From b921b3ce8ac7eeff6f2683d49f232ed89cac30d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E5=8D=9A?= Date: Tue, 12 Nov 2024 13:05:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9E=B6=E6=9E=84=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/ten/dao/TenPersonSyncDao.java | 5 +++ .../ten/service/TenPersonSyncService.java | 2 ++ .../service/impl/TenPersonServiceImpl.java | 33 +++++++++++++++---- .../impl/TenPersonSyncServiceImpl.java | 5 +++ .../src/main/resources/application.yml | 24 +++++++------- .../resources/mapper/ten/TenPersonSyncDao.xml | 8 +++++ 6 files changed, 59 insertions(+), 18 deletions(-) diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/dao/TenPersonSyncDao.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/dao/TenPersonSyncDao.java index 92d2efc..3a80d53 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/dao/TenPersonSyncDao.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/dao/TenPersonSyncDao.java @@ -2,6 +2,7 @@ package net.shapelight.modules.ten.dao; import net.shapelight.modules.ten.entity.TenPersonSyncEntity; import net.shapelight.modules.vo.TenPersonIdUpdateAllVo; +import org.apache.ibatis.annotations.MapKey; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -29,8 +30,12 @@ public interface TenPersonSyncDao { List findByPersonId(@Param("personId")Long personId, @Param("cellId")Long cellId); + @MapKey("deviceSn") List> findGroupDevicePersons(@Param("personIds")List personIds, @Param("cellId")Long cellId); + @MapKey("deviceSn") + Map findGroupDevicePerson(@Param("personId")Long personId, @Param("cellId")Long cellId); + List findDeviceAllDeletePersons(@Param("deviceId")Long deviceId,@Param("cellId")Long cellId); List findDeviceAllAddPersons(@Param("deviceId")Long deviceId,@Param("cellId")Long cellId); diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenPersonSyncService.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenPersonSyncService.java index 753cecb..92b4132 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenPersonSyncService.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/TenPersonSyncService.java @@ -34,6 +34,8 @@ public interface TenPersonSyncService { List> findGroupDevicePersons(List personIds, Long tenantId); + Map findGroupDevicePerson(Long personId, Long tenantId); + List findDeviceAllDeletePersons(Long deviceId, Long cellId); List findDeviceAllAddPersons(Long deviceId, Long tenantId); 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 d173bd6..b6f7dc0 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 @@ -891,7 +891,7 @@ public class TenPersonServiceImpl implements TenPersonService { //记录所有人员id - /*Map personParams = new HashMap<>(); + /* Map personParams = new HashMap<>(); personParams.put("operation","delUserData"); personParams.put("accountNumber",globalValue.accountNumber); personParams.put("passKey", KeysEntity.passKey); @@ -909,14 +909,35 @@ public class TenPersonServiceImpl implements TenPersonService { personIds.add(personId); } }*/ + personIds.add(personId); tenPersonDao.logicDeleteById(personId, cellId); tenRelationMapper.delete(new LambdaQueryWrapper().eq(TenRelation::getStudentId,personId)); + Map snPersons = tenPersonSyncService.findGroupDevicePerson(personId,cellId); + 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) { + String[] personInfoStr = personStr.split("_"); + Long personCode = Long.parseLong(personInfoStr[0]); + Date lastUpdateTime = DateUtils.stringToDate(personInfoStr[1], DateUtils.DATE_TIME_PATTERN); + + TenPersonSyncEntity syncEntity = tenPersonSyncService.findByDeviceIdAndPersonId(deviceEntity.getDeviceId(), personCode, cellId); + syncEntity.setLastUpdateTime(lastUpdateTime); + syncEntity.setState(Constant.PERSON_SYNC_DELETE); + tenPersonSyncService.updateById(syncEntity); + } + + } //配置同步信息并推送 - List> snPersonsList = tenPersonSyncService.findGroupDevicePersons(personIds, cellId); + /*List> snPersonsList = tenPersonSyncService.findGroupDevicePersons(personIds, cellId); for (Map snPersons : snPersonsList) { String sn = snPersons.get("deviceSn"); TenDeviceEntity deviceEntity = tenDeviceService.findBySn(sn); @@ -935,7 +956,7 @@ public class TenPersonServiceImpl implements TenPersonService { syncEntity.setState(Constant.PERSON_SYNC_DELETE); tenPersonSyncService.updateById(syncEntity); } - /*//下发通知 + //下发通知 List allDelete = tenPersonSyncService.findDeviceAllDeletePersons(deviceEntity.getDeviceId(), deviceEntity.getTenantId()); for (TenPersonSyncEntity syncEntity : allDelete) { TenPersonOperationVo vo = new TenPersonOperationVo(); @@ -943,13 +964,13 @@ public class TenPersonServiceImpl implements TenPersonService { vo.setOperation(Constant.PERSON_SYNC_DELETE); vo.setLast_update_stamp(syncEntity.getLastUpdateTime()); list.add(vo); - }*/ + } - //int flag = serverApiService.personOperation(sn, list); + int flag = serverApiService.personOperation(sn, list); //下发成功,删除状态为删除的同步人员 tenPersonSyncService.removeAllDeletePersons(deviceEntity.getDeviceId(), cellId); - } + }*/ return true; } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenPersonSyncServiceImpl.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenPersonSyncServiceImpl.java index 1a4ac2e..295a1e5 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenPersonSyncServiceImpl.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenPersonSyncServiceImpl.java @@ -85,6 +85,11 @@ public class TenPersonSyncServiceImpl implements TenPersonSyncService { return tenPersonSyncDao.findGroupDevicePersons(personIds, cellId); } + @Override + public Map findGroupDevicePerson(Long personId, Long cellId) { + return tenPersonSyncDao.findGroupDevicePerson(personId, cellId); + } + @Override public List findDeviceAllDeletePersons(Long deviceId, Long cellId) { return tenPersonSyncDao.findDeviceAllDeletePersons(deviceId,cellId); diff --git a/shapelight-admin/src/main/resources/application.yml b/shapelight-admin/src/main/resources/application.yml index ceeda29..8659eb6 100644 --- a/shapelight-admin/src/main/resources/application.yml +++ b/shapelight-admin/src/main/resources/application.yml @@ -83,20 +83,20 @@ global: db_password: root db_host: localhost db_port: 3306 -# minio: -# endpoint: http://192.168.10.20:9000 -# port: 9000 -# accessKey: admin -# secretKey: admin@C501 -# bucketName: cell -# path: /root/minio/data/cell minio: - endpoint: https://c.xitu3d.com:19000 - port: 19000 - accessKey: 7885444af42e4b30c518c5be17c8850b - secretKey: 0fad3477fb9f60c7be75561db967e8d7 - bucketName: school + endpoint: http://192.168.10.20:9000 + port: 9000 + accessKey: admin + secretKey: admin@C501 + bucketName: cell path: /root/minio/data/cell +# minio: +# endpoint: https://c.xitu3d.com:19000 +# port: 19000 +# accessKey: 7885444af42e4b30c518c5be17c8850b +# secretKey: 0fad3477fb9f60c7be75561db967e8d7 +# bucketName: school +# path: /root/minio/data/cell device: appId: 8e9b941923abd appSecret: Mjk0ODIxOTcwMTQ0NjkwNzA1NDE0MzcyNjgxMTQ0MDc0MjE diff --git a/shapelight-admin/src/main/resources/mapper/ten/TenPersonSyncDao.xml b/shapelight-admin/src/main/resources/mapper/ten/TenPersonSyncDao.xml index bc682c4..db929eb 100644 --- a/shapelight-admin/src/main/resources/mapper/ten/TenPersonSyncDao.xml +++ b/shapelight-admin/src/main/resources/mapper/ten/TenPersonSyncDao.xml @@ -172,6 +172,14 @@ GROUP BY device_sn + +