From f81eef47b765e1af602c155a500f27fbb1b4cd7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E5=8D=9A?= Date: Sat, 19 Oct 2024 16:07:03 +0800 Subject: [PATCH] =?UTF-8?q?=E9=95=BF=E5=BA=86=E9=A1=B9=E7=9B=AE=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../httpapi/controler/HttpApiController.java | 6 +++ .../controller/member/CqMemberController.java | 6 +-- .../job/task/PersonSynchronousTask.java | 52 +++++++++++++++---- .../ten/controller/TenPersonController.java | 12 +++-- .../modules/ten/service/TenPersonService.java | 2 +- .../service/impl/TenDeviceServiceImpl.java | 50 +++++++++--------- .../service/impl/TenPersonServiceImpl.java | 13 +++-- 7 files changed, 95 insertions(+), 46 deletions(-) diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/httpapi/controler/HttpApiController.java b/shapelight-admin/src/main/java/net/shapelight/modules/httpapi/controler/HttpApiController.java index 73e71d0..a27a67a 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/httpapi/controler/HttpApiController.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/httpapi/controler/HttpApiController.java @@ -2081,4 +2081,10 @@ public class HttpApiController { return R.ok().put("data", page); } + + @GetMapping("/role") + public R roleList() { + + return R.ok(); + } } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/member/CqMemberController.java b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/member/CqMemberController.java index faa3f8c..c5f3271 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/member/CqMemberController.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/member/CqMemberController.java @@ -164,17 +164,17 @@ public class CqMemberController { } if (personTypeId != null){ - queryWrapper.eq("label_id", idCard); + queryWrapper.eq("label_id", personTypeId); } if (phone != null && !phone.isEmpty()){ queryWrapper.eq("mobile", phone); } - if (isvisitor == 1){ + /* if (isvisitor == 1){ Integer i = cqMemberMapper.speciallyForVisitors(); queryWrapper.eq("label_id", i); - } + }*/ if (isWatched != null){ queryWrapper.eq("is_watch_safe_video", isWatched); } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/job/task/PersonSynchronousTask.java b/shapelight-admin/src/main/java/net/shapelight/modules/job/task/PersonSynchronousTask.java index c51fb34..4798df4 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/job/task/PersonSynchronousTask.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/job/task/PersonSynchronousTask.java @@ -20,15 +20,12 @@ import net.shapelight.modules.face.service.FaceEngineService; import net.shapelight.modules.face.util.UserInfo; import net.shapelight.modules.face.util.UserRamGroup; import net.shapelight.modules.feignClient.CxFeignClient; +import net.shapelight.modules.nettyapi.service.ServerApiService; import net.shapelight.modules.sys.controller.AbstractController; -import net.shapelight.modules.ten.entity.TenCellEntity; -import net.shapelight.modules.ten.entity.TenPersonCert; -import net.shapelight.modules.ten.entity.TenPersonEntity; -import net.shapelight.modules.ten.entity.TenPersonTrain; -import net.shapelight.modules.ten.service.TenCellService; -import net.shapelight.modules.ten.service.TenPersonCertService; -import net.shapelight.modules.ten.service.TenPersonService; -import net.shapelight.modules.ten.service.TenPersonTrainService; +import net.shapelight.modules.ten.entity.*; +import net.shapelight.modules.ten.service.*; +import net.shapelight.modules.vo.TenDeviceVo; +import net.shapelight.modules.vo.TenPersonOperationVo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -60,11 +57,19 @@ public class PersonSynchronousTask extends AbstractController implements ITask { private TenPersonTrainService trainService; @Autowired private FaceEngineService faceEngineService; + @Autowired + private TenDeviceService tenDeviceService; + @Autowired + private TenPersonSyncService tenPersonSyncService; + @Autowired + private ServerApiService serverApiService; @Override public void run(String params) { - + getPmInternalPersonnelList("Person"); + getPmInternalPersonnelList("Contractor"); + getPmInternalPersonnelList("Supplier"); } private void getPmInternalPersonnelList(String type) { @@ -280,7 +285,34 @@ public class PersonSynchronousTask extends AbstractController implements ITask { inputStream.close(); tenPerson.setOrgImage(orgImageFileName); tenPerson.setFaceImage(orgImageFileName); - tenPersonService.saveOrUpdateByField(tenPerson,"openId"); + String flag = tenPersonService.saveOrUpdateByField(tenPerson,"openId"); + if(flag.equals("save")) { + //发送设备通知 + List devList = tenDeviceService.findByCellId(tenPerson.getCellId()); + //状态是0正常,发送推送 + if (tenPerson.getStatus().intValue() == Constant.PESON_SUATUS_NOMOR) { + for (TenDeviceVo dev : devList) { + //添加到同步表,下发设备通知 + TenPersonSyncEntity syncEntity = new TenPersonSyncEntity(); + syncEntity.setPersonId(tenPerson.getPersonId()); + syncEntity.setTenantId(tenPerson.getTenantId()); + syncEntity.setDeviceSn(dev.getSn()); + syncEntity.setDeviceId(dev.getDeviceId()); + syncEntity.setState(1); + syncEntity.setLastUpdateTime(tenPerson.getLastUpdateTime()); + tenPersonSyncService.insert(syncEntity); + + //下发通知 + List list = new ArrayList<>(); + TenPersonOperationVo vo = new TenPersonOperationVo(); + vo.setUid(syncEntity.getPersonId()); + vo.setOperation(1); + vo.setLast_update_stamp(syncEntity.getLastUpdateTime()); + list.add(vo); + serverApiService.personOperation(dev.getSn(), list); + } + } + } UserInfo userInfo = new UserInfo(); UserRamGroup.addUser(userInfo,tenPerson.getOrgId()!=null?UserRamGroup.getOrgCellMap(tenPerson.getOrgId()):null); }else{ 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 6df9ee0..a27f3c4 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 @@ -142,10 +142,14 @@ public class TenPersonController extends AbstractController { List personTypeList = new ArrayList<>(); List tenLabel = tenLabelService.list(new QueryWrapper() .eq("tenant_id",getUser().getTenantId())); - personTypeList.add(Constant.PERSON_TYPE_OWNER); - personTypeList.add(Constant.PERSON_TYPE_MEMBER); - personTypeList.add(Constant.PERSON_TYPE_TENANT); - params.put("personTypeList",personTypeList); + if(params.get("personType")!=null&& !Objects.equals(params.get("personType").toString(), "")) { + personTypeList.add(Integer.parseInt(params.get("personType").toString())); + } + //personTypeList.add(Constant.PERSON_TYPE_MEMBER); + //personTypeList.add(Constant.PERSON_TYPE_TENANT); + if(!personTypeList.isEmpty()) { + params.put("personTypeList",personTypeList); + } PageUtils page = tenPersonService.queryPage(params); return R.ok().put("data", page); 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 04cc7a0..c846fe6 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 @@ -163,7 +163,7 @@ public interface TenPersonService extends IService { List findDeptCount(String tenantId); - void saveOrUpdateByField(TenPersonEntity entity,String fieldName); + String saveOrUpdateByField(TenPersonEntity entity,String fieldName); } 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 40ea954..be0d1d3 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 @@ -414,7 +414,7 @@ public class TenDeviceServiceImpl extends ServiceImpl() .eq("device_id",deviceEntity.getDeviceId())); @@ -428,34 +428,34 @@ public class TenDeviceServiceImpl extends ServiceImpl list = tenPersonService.findAllPersonIdUpdateAll(deviceEntity.getCellId(), -// deviceEntity.getBuildId(), -// deviceEntity.getRoomId()); -//// List sList = new ArrayList<>(); -// //1.删除设备关联的人 -// //2.批量添加 -// List saveList = new ArrayList<>(); -// for (TenPersonIdUpdateAllVo vo : list) { -// TenPersonSyncEntity entity = new TenPersonSyncEntity(); -// entity.setDeviceId(deviceEntity.getDeviceId()); -// entity.setDeviceSn(deviceEntity.getSn()); -// entity.setLastUpdateTime(vo.getLast_update_stamp()); -// entity.setPersonId(vo.getUid()); -// entity.setState(0); -// entity.setTenantId(deviceEntity.getTenantId()); -//// sList.add(entity); -// saveList.add(entity); -//// tenPersonSyncService.insert(entity); -// } -// if (saveList.size() > 0) { -// tenPersonSyncService.insertBatch(saveList, deviceEntity.getTenantId()); -// } + List list = tenPersonService.findAllPersonIdUpdateAll(deviceEntity.getCellId(), + deviceEntity.getBuildId(), + deviceEntity.getRoomId()); +// List sList = new ArrayList<>(); + //1.删除设备关联的人 + //2.批量添加 + List saveList = new ArrayList<>(); + for (TenPersonIdUpdateAllVo vo : list) { + TenPersonSyncEntity entity = new TenPersonSyncEntity(); + entity.setDeviceId(deviceEntity.getDeviceId()); + entity.setDeviceSn(deviceEntity.getSn()); + entity.setLastUpdateTime(vo.getLast_update_stamp()); + entity.setPersonId(vo.getUid()); + entity.setState(0); + entity.setTenantId(deviceEntity.getTenantId()); +// sList.add(entity); + saveList.add(entity); +// tenPersonSyncService.insert(entity); + } + if (saveList.size() > 0) { + tenPersonSyncService.insertBatch(saveList, deviceEntity.getTenantId()); + } -// tenPersonSyncService.saveBatch(sList); + //tenPersonSyncService.insertBatch(saveList,); } @Override 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 2fed1d4..7924f4f 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 @@ -1080,8 +1080,13 @@ public class TenPersonServiceImpl extends ServiceImpl queryWrapper = new QueryWrapper<>(); queryWrapper.eq(fieldName, MyBeanUtils.getFieldValueByName(entity,fieldName)); TenPersonEntity existEntity = this.getOne(queryWrapper); if (existEntity == null) { this.save(entity); + return "save"; } else { this.updateById(entity); + return "update"; } } }