diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/app/controller/AppInfoApiController.java b/shapelight-admin/src/main/java/net/shapelight/modules/app/controller/AppInfoApiController.java index e82082b..8d66942 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/app/controller/AppInfoApiController.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/app/controller/AppInfoApiController.java @@ -288,7 +288,7 @@ public class AppInfoApiController { AppUserScopeEntity scope = appUserScopeService.getById(user.getCurrentScopeId()); TenCellEntity cellEntity = tenCellService.getById(scope.getCellId()); if(cellEntity!=null){ - params.put("tenantId",cellEntity.getTenantId()); + params.put("cellId",cellEntity.getCellId()); int during = Integer.parseInt((String)params.get("during")); String recordTimeStart = null; String recordTimeEnd = null; 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 73a905e..e211cba 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 @@ -262,7 +262,7 @@ public class HttpApiController { log.debug("全量获取:"+sn); TenDeviceEntity deviceEntity = tenDeviceService.findBySn(sn); //----------------------------------------以下业务----------------------------------------------------- - List all = tenPersonSyncService.getDeviceAllPersonIdUpdateTime(deviceEntity.getDeviceId(),deviceEntity.getTenantId()); + List all = tenPersonSyncService.getDeviceAllPersonIdUpdateTime(deviceEntity.getDeviceId(),deviceEntity.getCellId()); List resAll = new ArrayList<>(); for(TenPersonIdUpdateAllVo vo: all){ TenPersonAllVo oVo = new TenPersonAllVo(); @@ -271,7 +271,7 @@ public class HttpApiController { resAll.add(oVo); } //删除状态为删除的人员 - tenPersonSyncService.removeAllDeletePersons(deviceEntity.getDeviceId(),deviceEntity.getTenantId()); + tenPersonSyncService.removeAllDeletePersons(deviceEntity.getDeviceId(),deviceEntity.getCellId()); Map allPersons = new HashMap<>(); allPersons.put("allPerson",resAll); return R.ok().put("data",allPersons); @@ -429,7 +429,7 @@ public class HttpApiController { TenPersonSyncEntity syncEntity = tenPersonSyncService.findByDeviceIdAndPersonId(deviceEntity.getDeviceId(), - p.getPersonId(),deviceEntity.getTenantId()); + p.getPersonId(),deviceEntity.getCellId()); syncEntity.setState(Constant.PERSON_SYNC_OK); tenPersonSyncService.updateById(syncEntity); diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/nettyapi/service/impl/DeviceApiServiceImpl.java b/shapelight-admin/src/main/java/net/shapelight/modules/nettyapi/service/impl/DeviceApiServiceImpl.java index b922683..c8e51ee 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/nettyapi/service/impl/DeviceApiServiceImpl.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/nettyapi/service/impl/DeviceApiServiceImpl.java @@ -264,10 +264,10 @@ public class DeviceApiServiceImpl implements DeviceApiService { // List all = tenPersonService.findAllPersonIdUpdateAll(cellEntity.getCellId(),null,null); - List all = tenPersonSyncService.getDeviceAllPersonIdUpdateTime(deviceEntity.getDeviceId(),deviceEntity.getTenantId()); + List all = tenPersonSyncService.getDeviceAllPersonIdUpdateTime(deviceEntity.getDeviceId(),deviceEntity.getCellId()); //删除状态为删除的人员 - tenPersonSyncService.removeAllDeletePersons(deviceEntity.getDeviceId(),deviceEntity.getTenantId()); + tenPersonSyncService.removeAllDeletePersons(deviceEntity.getDeviceId(),deviceEntity.getCellId()); Result res = new Result(); res.put("data",all); @@ -391,7 +391,7 @@ public class DeviceApiServiceImpl implements DeviceApiService { // .eq("person_id",p.getPersonId())); TenPersonSyncEntity syncEntity = tenPersonSyncService.findByDeviceIdAndPersonId(deviceEntity.getDeviceId(), - p.getPersonId(),deviceEntity.getTenantId()); + p.getPersonId(),deviceEntity.getCellId()); syncEntity.setState(Constant.PERSON_SYNC_OK); tenPersonSyncService.updateById(syncEntity); @@ -708,7 +708,7 @@ public class DeviceApiServiceImpl implements DeviceApiService { channel.writeAndFlush(message); //配置同步数据 - List syncEntitys = tenPersonSyncService.findByPersonId(p.getPersonId(), p.getTenantId()); + List syncEntitys = tenPersonSyncService.findByPersonId(p.getPersonId(), p.getCellId()); for (TenPersonSyncEntity syncEn : syncEntitys) { syncEn.setLastUpdateTime(p.getLastUpdateTime()); syncEn.setState(2); diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/nettyapi/service/impl/ServerApiServiceImpl.java b/shapelight-admin/src/main/java/net/shapelight/modules/nettyapi/service/impl/ServerApiServiceImpl.java index a164299..2c9fe95 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/nettyapi/service/impl/ServerApiServiceImpl.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/nettyapi/service/impl/ServerApiServiceImpl.java @@ -170,7 +170,7 @@ public class ServerApiServiceImpl implements ServerApiService { //1.删除同步表中数据 // tenPersonSyncService.remove(new QueryWrapper() // .eq("device_id",deviceEntity.getDeviceId())); - tenPersonSyncService.removeByDeviceId(deviceEntity.getDeviceId(),deviceEntity.getTenantId()); + tenPersonSyncService.removeByDeviceId(deviceEntity.getDeviceId(),deviceEntity.getCellId()); //2.在同步表中插入所有信息 List list = tenPersonService.findAllPersonIdUpdateAll(deviceEntity.getCellId(), deviceEntity.getBuildId(), @@ -182,6 +182,7 @@ public class ServerApiServiceImpl implements ServerApiService { entity.setDeviceSn(deviceEntity.getSn()); entity.setLastUpdateTime(vo.getLast_update_stamp()); entity.setPersonId(vo.getUid()); + entity.setCellId(deviceEntity.getCellId()); entity.setState(0); entity.setTenantId(deviceEntity.getTenantId()); tenPersonSyncService.insert(entity); diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/sys/service/impl/SysUserServiceImpl.java b/shapelight-admin/src/main/java/net/shapelight/modules/sys/service/impl/SysUserServiceImpl.java index 38d7d8e..84a2cab 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/sys/service/impl/SysUserServiceImpl.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/sys/service/impl/SysUserServiceImpl.java @@ -215,7 +215,7 @@ public class SysUserServiceImpl extends ServiceImpl i userScopeEntity.setUserId(user.getUserId()); - /* //小区管理员 + //小区管理员 if (user.getRoleIdList().get(0).longValue() == Constant.ROLE_TEN_CELL) { TenCellEntity cell = tenCellService.getById(user.getCellId()); userScopeEntity.setAreaId(cell.getAreaId()); @@ -251,7 +251,7 @@ public class SysUserServiceImpl extends ServiceImpl i appUser.setCurrentScopeId(appScope.getUserScopeId()); appUserService.updateById(appUser); - }*/ + } } @Override diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenCheckController.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenCheckController.java index 2d72249..44bc955 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenCheckController.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenCheckController.java @@ -87,7 +87,7 @@ public class TenCheckController extends AbstractController { @RequiresPermissions("ten:check:list") @ApiOperation(value = "考勤详细信息,所有考勤识别记录",response = TenRecordEntity.class) public R checkDetail(@PathVariable("checkId") Long checkId){ - Long tenantId = getUser().getTenantId(); + Long cellId = getUser().getCellId(); TenCheckEntity tenCheck = tenCheckService.getById(checkId); // List recordIds = new ArrayList<>(); List csList = tenCheckScheduleService.list( @@ -99,13 +99,13 @@ public class TenCheckController extends AbstractController { // recordIds.add(ss.getDutyOnRecordId()); // recordIds.add(ss.getDutyOffRecordId()); if (ss.getDutyOnRecordId()!=null) { - TenRecordEntity recordEntityOn = tenRecordService.getById(ss.getDutyOnRecordId(),tenantId); + TenRecordEntity recordEntityOn = tenRecordService.getById(ss.getDutyOnRecordId(),cellId); if (recordEntityOn!=null) { records.add(recordEntityOn); } } if(ss.getDutyOffRecordId()!=null){ - TenRecordEntity recordEntityOff = tenRecordService.getById(ss.getDutyOffRecordId(),tenantId); + TenRecordEntity recordEntityOff = tenRecordService.getById(ss.getDutyOffRecordId(),cellId); if(recordEntityOff!=null){ records.add(recordEntityOff); } 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 58ae7ef..aa0da51 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 @@ -145,8 +145,8 @@ public class TenPersonController extends AbstractController { 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()); + //TenUserScopeEntity scope = tenUserScopeService.getOne(new QueryWrapper().eq("user_id", user.getUserId())); + params.put("cellId", getUser().getCellId()); } List personTypeList = new ArrayList<>(); List tenLabel = tenLabelService.list(new QueryWrapper() @@ -307,7 +307,7 @@ public class TenPersonController extends AbstractController { } person.setDoorCardEntity(doorCard); - String lastRecordTime = tenRecordService.findLastRecordTime(personId,person.getTenantId()); + String lastRecordTime = tenRecordService.findLastRecordTime(personId,person.getCellId()); person.setLastRecordTime(lastRecordTime); String lastLoginTime = appUserService.findLastLoginTime(personId, cellId); @@ -578,7 +578,7 @@ public class TenPersonController extends AbstractController { //状态是0正常,发送推送 for (TenDeviceVo dev : devList) { //添加到同步表,下发设备通知 - TenPersonSyncEntity syncEntity = tenPersonSyncService.findByDeviceIdAndPersonId(dev.getDeviceId(),tenPerson.getPersonId(),tenPerson.getTenantId()); + TenPersonSyncEntity syncEntity = tenPersonSyncService.findByDeviceIdAndPersonId(dev.getDeviceId(),tenPerson.getPersonId(),tenPerson.getCellId()); if(syncEntity==null){ syncEntity = new TenPersonSyncEntity(); syncEntity.setPersonId(tenPerson.getPersonId()); @@ -587,6 +587,7 @@ public class TenPersonController extends AbstractController { syncEntity.setDeviceId(dev.getDeviceId()); syncEntity.setState(Constant.PERSON_SYNC_ADD); syncEntity.setLastUpdateTime(tenPerson.getLastUpdateTime()); + syncEntity.setCellId(tenPerson.getCellId()); tenPersonSyncService.insert(syncEntity); //下发通知 @@ -617,7 +618,7 @@ public class TenPersonController extends AbstractController { else{ for (TenDeviceVo dev : devList) { //添加到同步表,下发设备通知 - TenPersonSyncEntity syncEntity = tenPersonSyncService.findByDeviceIdAndPersonId(dev.getDeviceId(),tenPerson.getPersonId(),tenPerson.getTenantId()); + TenPersonSyncEntity syncEntity = tenPersonSyncService.findByDeviceIdAndPersonId(dev.getDeviceId(),tenPerson.getPersonId(),tenPerson.getCellId()); if(syncEntity!=null){ syncEntity.setState(Constant.PERSON_SYNC_DELETE); syncEntity.setLastUpdateTime(tenPerson.getLastUpdateTime()); @@ -631,7 +632,7 @@ public class TenPersonController extends AbstractController { list.add(vo); int flag = serverApiService.personOperation(dev.getSn(),list); if(flag!= -1){ - tenPersonSyncService.removeByPersonSyncId(syncEntity.getPersonSyncId(),syncEntity.getTenantId()); + tenPersonSyncService.removeByPersonSyncId(syncEntity.getPersonSyncId(),syncEntity.getCellId()); } } } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenRecordController.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenRecordController.java index b7bf09d..264cacc 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenRecordController.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenRecordController.java @@ -172,7 +172,7 @@ public class TenRecordController extends AbstractController { String start = yearMonth+"-01 00:00:0l"; String end = yearMonthLastDay+" 23:59:59"; - List monthRecords = tenRecordService.getMonthRecords(start,end,tenantId); + List monthRecords = tenRecordService.getMonthRecords(start,end,getUser().getCellId().toString()); for(TenRecordEntity recordEntity: monthRecords){ if (recordEntity.getRecordFace()!=null && recordEntity.getRecordFace().length()>0) { @@ -203,7 +203,7 @@ public class TenRecordController extends AbstractController { @PostMapping("/copy3dZip") public R copy3dZip(@RequestParam("yearMonth") String yearMonth){ - String tenantId = getUser().getTenantId()+""; + String cellId = getUser().getCellId()+""; int count = 0; String[] yearMonthArray = yearMonth.split("-"); int year = Integer.parseInt(yearMonthArray[0]); @@ -213,7 +213,7 @@ public class TenRecordController extends AbstractController { String start = yearMonth+"-01 00:00:0l"; String end = yearMonthLastDay+" 23:59:59"; - List monthRecords = tenRecordService.getMonthRecords(start,end,tenantId); + List monthRecords = tenRecordService.getMonthRecords(start,end,cellId); for(TenRecordEntity recordEntity: monthRecords){ diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenRoomController.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenRoomController.java index a4e7ce2..71e5cc1 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenRoomController.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/controller/TenRoomController.java @@ -248,7 +248,7 @@ public class TenRoomController extends AbstractController { //配置同步数据 for(TenPersonEntity entity: roomPersonList){ - List syncEntitys = tenPersonSyncService.findByPersonId(entity.getPersonId(), entity.getTenantId()); + List syncEntitys = tenPersonSyncService.findByPersonId(entity.getPersonId(), entity.getCellId()); for (TenPersonSyncEntity syncEn : syncEntitys) { syncEn.setLastUpdateTime(entity.getLastUpdateTime()); syncEn.setState(Constant.PERSON_SYNC_MODIFY); diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/dao/TenCellDao.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/dao/TenCellDao.java index bb9b827..3dd4ed6 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/dao/TenCellDao.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/dao/TenCellDao.java @@ -25,6 +25,9 @@ public interface TenCellDao extends BaseMapper { void createTenPackRecord(@Param("tenantId")String tenantId); void createTenPersonExtract(@Param("tenantId")String tenantId); void createTenPersonSync(@Param("tenantId")String tenantId); + void createTenCellDept(@Param("cellId")String cellId); + void createTenParent(@Param("cellId")String celId); + void createTenRelation(@Param("cellId")String celId); 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 eec9713..92d2efc 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 @@ -1,7 +1,6 @@ package net.shapelight.modules.ten.dao; import net.shapelight.modules.ten.entity.TenPersonSyncEntity; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; import net.shapelight.modules.vo.TenPersonIdUpdateAllVo; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -16,31 +15,31 @@ import java.util.Map; @Mapper public interface TenPersonSyncDao { - List getDeviceAllPersonIdUpdateTime(@Param("deviceId")Long deviceId,@Param("tenantId")Long tenantId); + List getDeviceAllPersonIdUpdateTime(@Param("deviceId")Long deviceId,@Param("cellId")Long tenantId); int insert(TenPersonSyncEntity tenLicenseEntity); - int insertBatch(@Param("list")List list,@Param("tenantId")Long tenantId); + int insertBatch(@Param("list")List list,@Param("cellId")Long cellId); int updateById(TenPersonSyncEntity entity); - void removeByDeviceId(@Param("deviceId")Long deviceId,@Param("tenantId")Long tenantId); + void removeByDeviceId(@Param("deviceId")Long deviceId,@Param("cellId")Long cellId); - void removeAllDeletePersons(@Param("deviceId")Long deviceId,@Param("tenantId")Long tenantId); + void removeAllDeletePersons(@Param("deviceId")Long deviceId,@Param("cellId")Long cellId); - TenPersonSyncEntity findByDeviceIdAndPersonId(@Param("deviceId")Long deviceId, @Param("personId")Long personId, @Param("tenantId")Long tenantId); + TenPersonSyncEntity findByDeviceIdAndPersonId(@Param("deviceId")Long deviceId, @Param("personId")Long personId, @Param("cellId")Long cellId); - List findByPersonId(@Param("personId")Long personId, @Param("tenantId")Long tenantId); + List findByPersonId(@Param("personId")Long personId, @Param("cellId")Long cellId); - List> findGroupDevicePersons(@Param("personIds")List personIds, @Param("tenantId")Long tenantId); + List> findGroupDevicePersons(@Param("personIds")List personIds, @Param("cellId")Long cellId); - List findDeviceAllDeletePersons(@Param("deviceId")Long deviceId,@Param("tenantId")Long tenantId); + List findDeviceAllDeletePersons(@Param("deviceId")Long deviceId,@Param("cellId")Long cellId); - List findDeviceAllAddPersons(@Param("deviceId")Long deviceId,@Param("tenantId")Long tenantId); + List findDeviceAllAddPersons(@Param("deviceId")Long deviceId,@Param("cellId")Long cellId); - void removePersonSyncId(@Param("personSyncId")Long personSyncId,@Param("tenantId")Long tenantId); + void removePersonSyncId(@Param("personSyncId")Long personSyncId,@Param("cellId")Long cellId); List findTwo(@Param("tenantId")Long tenantId); - List findByDeviceIdAndPersonIdTwo(@Param("deviceId")Long deviceId, @Param("personId")Long personId, @Param("tenantId")Long tenantId); + List findByDeviceIdAndPersonIdTwo(@Param("deviceId")Long deviceId, @Param("personId")Long personId, @Param("cellId")Long tenantId); 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 cbbda6a..6a2bd56 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 @@ -17,11 +17,11 @@ import java.util.Map; public interface TenRecordDao { int insert(TenRecordEntity tenRecordEntity); - int deleteById(@Param("recordId") Long id, @Param("tenantId") Long tenantId); + int deleteById(@Param("recordId") Long id, @Param("cellId") Long cellId); boolean updateById(TenRecordEntity entity); - TenRecordEntity selectById(@Param("recordId") Long recordId, @Param("tenantId") Long tenantId); + TenRecordEntity selectById(@Param("recordId") Long recordId, @Param("cellId") Long cellId); IPage findPageAll(Page page, @Param("cellIds") List cellIds, @Param("params") Map params); @@ -37,13 +37,13 @@ public interface TenRecordDao { IPage findPageRoomRecord(Page page, @Param("params") Map params); - String findLastRecordTime(@Param("personId") Long personId, @Param("tenantId") Long tenantId); + String findLastRecordTime(@Param("personId") Long personId, @Param("cellId") Long cellId); List getNotSync(@Param("cellId") Long paramLong1, @Param("tenantId") Long paramLong2); List getNotSyncImage(@Param("cellId") Long paramLong1, @Param("tenantId") Long paramLong2); - List getMonthRecords(@Param("start") String start, @Param("end") String end, @Param("tenantId") String tenantId); + List getMonthRecords(@Param("start") String start, @Param("end") String end, @Param("cellId") String cellId); IPage findPageDeptRecord(Page page, @Param("params") Map params); diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/entity/TenPersonSyncEntity.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/entity/TenPersonSyncEntity.java index 36af167..a3d3261 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/entity/TenPersonSyncEntity.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/entity/TenPersonSyncEntity.java @@ -55,4 +55,8 @@ public class TenPersonSyncEntity implements Serializable { @JsonSerialize(using = ToStringSerializer.class) private Long tenantId; + @ApiModelProperty("学校ID") + @JsonSerialize(using = ToStringSerializer.class) + private 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 dbd5223..753cecb 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 @@ -16,10 +16,10 @@ import java.util.Map; public interface TenPersonSyncService { - List getDeviceAllPersonIdUpdateTime(Long deviceId,Long tenantId); + List getDeviceAllPersonIdUpdateTime(Long deviceId,Long cellId); int insert(TenPersonSyncEntity tenLicenseEntity); - int insertBatch(List list,Long tenantId); + int insertBatch(List list,Long cellId); int updateById(TenPersonSyncEntity entity); void removeByDeviceId(Long deviceId, Long tenantId); @@ -34,7 +34,7 @@ public interface TenPersonSyncService { List> findGroupDevicePersons(List personIds, Long tenantId); - List findDeviceAllDeletePersons(Long deviceId, 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/TenCellServiceImpl.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenCellServiceImpl.java index 8597887..d6010f6 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenCellServiceImpl.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/service/impl/TenCellServiceImpl.java @@ -87,6 +87,9 @@ public class TenCellServiceImpl extends ServiceImpl i // tenCellDao.createTenPackRecord(cellId); tenCellDao.createTenPersonExtract(cellId); tenCellDao.createTenPersonSync(cellId); + tenCellDao.createTenParent(cellId); + tenCellDao.createTenRelation(cellId); + //tenCellDao.createTenCellDept(cellId); return super.save(entity); } 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 68f9e21..c3452e8 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 @@ -342,7 +342,7 @@ public class TenDeviceServiceImpl extends ServiceImpl0){ for (Long devId : (List) idList) { TenDeviceEntity deviceEntity = this.getById(devId); - tenPersonSyncService.removeByDeviceId(devId, deviceEntity.getTenantId()); + tenPersonSyncService.removeByDeviceId(devId, deviceEntity.getCellId()); //清除通知: serverApiService.cleanData(deviceEntity.getSn()); } @@ -430,7 +430,7 @@ public class TenDeviceServiceImpl extends ServiceImpl 0) { - tenPersonSyncService.insertBatch(saveList, deviceEntity.getTenantId()); + tenPersonSyncService.insertBatch(saveList, deviceEntity.getCellId()); } // tenPersonSyncService.saveBatch(sList); 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 349ad21..48534c4 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 @@ -31,6 +31,7 @@ import net.shapelight.modules.face.dto.FaceRecognitionResDTO; import net.shapelight.modules.face.service.FaceEngineService; import net.shapelight.modules.job.entity.KeysEntity; import net.shapelight.modules.nettyapi.service.ServerApiService; +import net.shapelight.modules.sys.controller.AbstractController; import net.shapelight.modules.sys.entity.SysDictEntity; import net.shapelight.modules.sys.service.impl.SysDictServiceImpl; import net.shapelight.modules.ten.dao.TenRelationMapper; @@ -491,6 +492,7 @@ public class TenPersonServiceImpl implements TenPersonService { syncEntity.setDeviceId(dev.getDeviceId()); syncEntity.setState(1); syncEntity.setLastUpdateTime(entity.getLastUpdateTime()); + syncEntity.setCellId(entity.getCellId()); tenPersonSyncService.insert(syncEntity); /* //下发通知 @@ -582,6 +584,7 @@ public class TenPersonServiceImpl implements TenPersonService { syncEntity.setDeviceId(dev.getDeviceId()); syncEntity.setState(1); syncEntity.setLastUpdateTime(entity.getLastUpdateTime()); + syncEntity.setCellId(entity.getCellId()); tenPersonSyncService.insert(syncEntity); //下发通知 @@ -612,7 +615,7 @@ public class TenPersonServiceImpl implements TenPersonService { if (flag == 1) { //发送设备通知 //配置同步数据 - List syncEntitys = tenPersonSyncService.findByPersonId(entity.getPersonId(), entity.getTenantId()); + List syncEntitys = tenPersonSyncService.findByPersonId(entity.getPersonId(), entity.getCellId()); for (TenPersonSyncEntity syncEn : syncEntitys) { syncEn.setLastUpdateTime(entity.getLastUpdateTime()); syncEn.setState(2); @@ -824,6 +827,7 @@ public class TenPersonServiceImpl implements TenPersonService { syncEntity.setDeviceId(dev.getDeviceId()); syncEntity.setState(1); syncEntity.setLastUpdateTime(entity.getLastUpdateTime()); + syncEntity.setCellId(entity.getCellId()); tenPersonSyncService.insert(syncEntity); /* //下发通知 @@ -919,7 +923,7 @@ public class TenPersonServiceImpl implements TenPersonService { //配置同步信息并推送 - List> snPersonsList = tenPersonSyncService.findGroupDevicePersons(personIds, tenantId); + List> snPersonsList = tenPersonSyncService.findGroupDevicePersons(personIds, cellId); for (Map snPersons : snPersonsList) { String sn = snPersons.get("deviceSn"); TenDeviceEntity deviceEntity = tenDeviceService.findBySn(sn); @@ -933,7 +937,7 @@ public class TenPersonServiceImpl implements TenPersonService { Long personId = Long.parseLong(personInfoStr[0]); 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, cellId); syncEntity.setLastUpdateTime(lastUpdateTime); syncEntity.setState(Constant.PERSON_SYNC_DELETE); tenPersonSyncService.updateById(syncEntity); @@ -951,7 +955,7 @@ public class TenPersonServiceImpl implements TenPersonService { //int flag = serverApiService.personOperation(sn, list); //下发成功,删除状态为删除的同步人员 - tenPersonSyncService.removeAllDeletePersons(deviceEntity.getDeviceId(), tenantId); + tenPersonSyncService.removeAllDeletePersons(deviceEntity.getDeviceId(), cellId); } return true; } @@ -979,13 +983,14 @@ public class TenPersonServiceImpl implements TenPersonService { syncEntity.setDeviceId(dev.getDeviceId()); syncEntity.setState(Constant.PERSON_SYNC_ADD); syncEntity.setLastUpdateTime(entity.getLastUpdateTime()); + syncEntity.setCellId(entity.getCellId()); tenPersonSyncService.insert(syncEntity); } } //下发设备通知 List devList = tenDeviceService.findByCellId(cellId); for (TenDeviceVo deviceVo : devList) { - List operationList = tenPersonSyncService.findDeviceAllAddPersons(deviceVo.getDeviceId(), deviceVo.getTenantId()); + List operationList = tenPersonSyncService.findDeviceAllAddPersons(deviceVo.getDeviceId(), deviceVo.getCellId()); List voList = new ArrayList<>(); for (TenPersonSyncEntity syncEntity : operationList) { TenPersonOperationVo vo = new TenPersonOperationVo(); @@ -1444,7 +1449,7 @@ public class TenPersonServiceImpl implements TenPersonService { tenPersonDao.updateById(entity); //配置同步数据 - List syncEntitys = tenPersonSyncService.findByPersonId(entity.getPersonId(), entity.getTenantId()); + List syncEntitys = tenPersonSyncService.findByPersonId(entity.getPersonId(), entity.getCellId()); for (TenPersonSyncEntity syncEn : syncEntitys) { syncEn.setLastUpdateTime(entity.getLastUpdateTime()); syncEn.setState(2); @@ -2234,6 +2239,7 @@ public class TenPersonServiceImpl implements TenPersonService { syncEntity.setDeviceId(dev.getDeviceId()); syncEntity.setState(1); syncEntity.setLastUpdateTime(tenPerson.getLastUpdateTime()); + syncEntity.setCellId(tenPerson.getCellId()); tenPersonSyncService.insert(syncEntity); } } @@ -2242,7 +2248,7 @@ public class TenPersonServiceImpl implements TenPersonService { //下发设备通知 List devList = tenDeviceService.findByCellId(cellId); for (TenDeviceVo deviceVo : devList) { - List operationList = tenPersonSyncService.findDeviceAllAddPersons(deviceVo.getDeviceId(), deviceVo.getTenantId()); + List operationList = tenPersonSyncService.findDeviceAllAddPersons(deviceVo.getDeviceId(), deviceVo.getCellId()); List voList = new ArrayList<>(); for (TenPersonSyncEntity syncEntity : operationList) { TenPersonOperationVo vo = new TenPersonOperationVo(); 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 22b1886..1a4ac2e 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 @@ -34,7 +34,7 @@ public class TenPersonSyncServiceImpl implements TenPersonSyncService { public int insert(TenPersonSyncEntity tenPersonSyncEntity) { TenPersonSyncEntity entity = this.findByDeviceIdAndPersonId(tenPersonSyncEntity.getDeviceId(), tenPersonSyncEntity.getPersonId(), - tenPersonSyncEntity.getTenantId()); + tenPersonSyncEntity.getCellId()); if(entity==null){ return tenPersonSyncDao.insert(tenPersonSyncEntity); }else{ @@ -45,8 +45,8 @@ public class TenPersonSyncServiceImpl implements TenPersonSyncService { } @Override - public int insertBatch(List list,Long tenantId) { - return tenPersonSyncDao.insertBatch(list,tenantId); + public int insertBatch(List list,Long cellId) { + return tenPersonSyncDao.insertBatch(list,cellId); } @Override @@ -56,52 +56,52 @@ public class TenPersonSyncServiceImpl implements TenPersonSyncService { @Override @Transactional(rollbackFor = Exception.class) - public void removeByDeviceId(Long deviceId,Long tenantId) { - tenPersonSyncDao.removeByDeviceId(deviceId,tenantId); + public void removeByDeviceId(Long deviceId,Long cellId) { + tenPersonSyncDao.removeByDeviceId(deviceId,cellId); } @Override - public void removeByPersonSyncId(Long personSyncId, Long tenantId) { - tenPersonSyncDao.removePersonSyncId(personSyncId, tenantId); + public void removeByPersonSyncId(Long personSyncId, Long cellId) { + tenPersonSyncDao.removePersonSyncId(personSyncId, cellId); } @Override - public void removeAllDeletePersons(Long deviceId, Long tenantId) { - tenPersonSyncDao.removeAllDeletePersons(deviceId, tenantId); + public void removeAllDeletePersons(Long deviceId, Long cellId) { + tenPersonSyncDao.removeAllDeletePersons(deviceId, cellId); } @Override - public TenPersonSyncEntity findByDeviceIdAndPersonId(Long deviceId, Long personId, Long tenantId) { - return tenPersonSyncDao.findByDeviceIdAndPersonId(deviceId, personId, tenantId); + public TenPersonSyncEntity findByDeviceIdAndPersonId(Long deviceId, Long personId, Long cellId) { + return tenPersonSyncDao.findByDeviceIdAndPersonId(deviceId, personId, cellId); } @Override - public List findByPersonId(Long personId, Long tenantId) { - return tenPersonSyncDao.findByPersonId(personId, tenantId); + public List findByPersonId(Long personId, Long cellId) { + return tenPersonSyncDao.findByPersonId(personId, cellId); } @Override - public List> findGroupDevicePersons(List personIds, Long tenantId) { - return tenPersonSyncDao.findGroupDevicePersons(personIds, tenantId); + public List> findGroupDevicePersons(List personIds, Long cellId) { + return tenPersonSyncDao.findGroupDevicePersons(personIds, cellId); } @Override - public List findDeviceAllDeletePersons(Long deviceId, Long tenantId) { - return tenPersonSyncDao.findDeviceAllDeletePersons(deviceId,tenantId); + public List findDeviceAllDeletePersons(Long deviceId, Long cellId) { + return tenPersonSyncDao.findDeviceAllDeletePersons(deviceId,cellId); } @Override - public List findDeviceAllAddPersons(Long deviceId, Long tenantId) { - return tenPersonSyncDao.findDeviceAllAddPersons(deviceId,tenantId); + public List findDeviceAllAddPersons(Long deviceId, Long cellId) { + return tenPersonSyncDao.findDeviceAllAddPersons(deviceId,cellId); } @Override - public List findTwo(Long tenantId) { - return tenPersonSyncDao.findTwo(tenantId); + public List findTwo(Long cellId) { + return tenPersonSyncDao.findTwo(cellId); } @Override - public List findByDeviceIdAndPersonIdList(Long deviceId, Long personId, Long tenantId) { - return tenPersonSyncDao.findByDeviceIdAndPersonIdTwo(deviceId, personId, tenantId); + public List findByDeviceIdAndPersonIdList(Long deviceId, Long personId, Long cellId) { + return tenPersonSyncDao.findByDeviceIdAndPersonIdTwo(deviceId, personId, 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 a8bb0c4..552252f 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 @@ -279,13 +279,13 @@ public class TenRecordServiceImpl implements TenRecordService { } @Override - public TenRecordEntity getById(Long id, Long tenantId) { - return tenRecordDao.selectById(id, tenantId); + public TenRecordEntity getById(Long id, Long cellId) { + return tenRecordDao.selectById(id, cellId); } @Override - public String findLastRecordTime(Long personId, Long tenantId) { - return tenRecordDao.findLastRecordTime(personId, tenantId); + public String findLastRecordTime(Long personId, Long cellId) { + return tenRecordDao.findLastRecordTime(personId, cellId); } @Override @@ -433,8 +433,8 @@ public class TenRecordServiceImpl implements TenRecordService { } @Override - public List getMonthRecords(String start, String end, String tenantId) { - return this.tenRecordDao.getMonthRecords(start, end, tenantId); + public List getMonthRecords(String start, String end, String cellId) { + return this.tenRecordDao.getMonthRecords(start, end, cellId); } @Override @@ -481,8 +481,8 @@ public class TenRecordServiceImpl implements TenRecordService { Page pageParam = new Page(); pageParam.setCurrent(Long.parseLong((String) params.get("page"))); pageParam.setSize(Long.parseLong((String) params.get("limit"))); - List list = (List) params.get("personIds"); - Long cellId = Long.parseLong(params.get("tenantId").toString()); + //List list = (List) params.get("personIds"); + //Long cellId = Long.parseLong(params.get("tenantId").toString()); int during = Integer.parseInt((String)params.get("during")); String recordTimeStart = null; String recordTimeEnd = null; diff --git a/shapelight-admin/src/main/resources/mapper/ten/TenBuildDao.xml b/shapelight-admin/src/main/resources/mapper/ten/TenBuildDao.xml index c3b1736..7579873 100644 --- a/shapelight-admin/src/main/resources/mapper/ten/TenBuildDao.xml +++ b/shapelight-admin/src/main/resources/mapper/ten/TenBuildDao.xml @@ -54,7 +54,7 @@ - insert into ten_build + insert into ten_build_${cellId} build_id, @@ -166,7 +166,7 @@ - update ten_build + update ten_build_${cellId} build_id = #{buildId,jdbcType=BIGINT}, @@ -225,37 +225,37 @@ - update ten_build set delete_flag = 1 + update ten_build_${cellId} set delete_flag = 1 where build_id = #{buildId,jdbcType=BIGINT} - update ten_build set delete_flag = 1 + update ten_build_${cellId} set delete_flag = 1 where cell_id = #{cellId,jdbcType=BIGINT} - delete from ten_build + delete from ten_build_${cellId} where build_id = #{buildId,jdbcType=BIGINT} @@ -265,33 +265,33 @@ @@ -320,7 +320,7 @@ - select * from ten_build + select * from ten_build_${cellId} where delete_flag = 0 and cell_id in @@ -331,7 +331,7 @@ diff --git a/shapelight-admin/src/main/resources/mapper/ten/TenCellDao.xml b/shapelight-admin/src/main/resources/mapper/ten/TenCellDao.xml index f5e1d83..43099db 100644 --- a/shapelight-admin/src/main/resources/mapper/ten/TenCellDao.xml +++ b/shapelight-admin/src/main/resources/mapper/ten/TenCellDao.xml @@ -68,6 +68,17 @@ create table if not exists `ten_person_sync_${tenantId}` like `ten_person_sync_0`; + + create table if not exists `ten_cell_dept_${cellId}` like `ten_cell_dept_0`; + + + create table if not exists `ten_parent_${cellId}` like `ten_parent_0`; + + + + create table if not exists `ten_relation_${cellId}` like `ten_relation_0`; + + - select p.*,r.layer,r.room_name from ten_person p left join ten_room r + select p.*,r.layer,r.room_name from ten_person_${cellId} p left join ten_room r on p.room_id = r.room_id where person_id = #{personId} - select * from ten_person + select * from ten_person_${cellId} where room_id = #{roomId} and delete_flag = 0 and name = #{name} and (person_type = 5000 or person_type = 5001 or person_type = 5002) @@ -661,7 +659,7 @@ @@ -798,7 +796,7 @@ - select count(*) from ten_person where delete_flag = 0 + select count(*) from ten_person_${cellId} where delete_flag = 0 and status = #{params.status} @@ -847,7 +845,7 @@ - select p.*,r.layer,r.room_name from ten_person p left join ten_room r + select p.*,r.layer,r.room_name from ten_person_${cellId} p left join ten_room r on p.room_id = r.room_id where p.delete_flag = 0 and p.status != 0 and p.name like CONCAT('%', '${params.name}', '%') @@ -886,7 +884,7 @@ - select * from ten_person + select * from ten_person_${cellId} where delete_flag = 0 and (name like CONCAT('%', '${params.key}', '%') @@ -903,7 +901,7 @@ - select member_id,last_update_time from ten_person + select member_id,last_update_time from ten_person_${cellId} where 1=1 and cell_id = #{cellId} @@ -939,7 +937,7 @@ - select * from ten_person + select * from ten_person_${cellId} where 1=1 and cell_id = #{cellId} @@ -971,12 +969,12 @@ - SELECT * FROM ten_person + SELECT * FROM ten_person_${cellId} where person_type = 5005 and live_end < NOW() and delete_flag = 0 @@ -1030,14 +1028,14 @@ - select * from ten_person + select * from ten_person_${cellId} where room_id = #{roomId} and trim(mobile) != '' @@ -1072,7 +1070,7 @@ select count(*) from (select if (CHAR_LENGTH(id_card) < 18,(substring(now(),1,4)-(1900+substring(id_card,7,2)))-(substring(id_card,9,4)-date_format(now(),'%m%d')>0),(substring(now(),1,4)-substring(id_card,7,4))-(substring(id_card,11,4)-date_format(now(),'%m%d')>0)) as age - from ten_person where delete_flag = 0 + from ten_person_${cellId} where delete_flag = 0 and cell_id in @@ -1091,7 +1089,7 @@ - select MONTH(NOW()) as m,count(*) as c from ten_person where delete_flag = 1 and MONTH(last_update_time) = MONTH(NOW()) + select MONTH(NOW()) as m,count(*) as c from ten_person_${cellId} where delete_flag = 1 and MONTH(last_update_time) = MONTH(NOW()) and cell_id in @@ -1158,7 +1156,7 @@ UNION - select MONTH(DATE_SUB(NOW(), INTERVAL 1 MONTH)) as m,count(*) as c from ten_person where delete_flag = 1 and MONTH(last_update_time) = MONTH(DATE_SUB(NOW(), INTERVAL 1 MONTH)) + select MONTH(DATE_SUB(NOW(), INTERVAL 1 MONTH)) as m,count(*) as c from ten_person_${cellId} where delete_flag = 1 and MONTH(last_update_time) = MONTH(DATE_SUB(NOW(), INTERVAL 1 MONTH)) and cell_id in @@ -1166,7 +1164,7 @@ UNION - select MONTH(DATE_SUB(NOW(), INTERVAL 2 MONTH)) as m,count(*) as c from ten_person where delete_flag = 1 and MONTH(last_update_time) = MONTH(DATE_SUB(NOW(), INTERVAL 2 MONTH)) + select MONTH(DATE_SUB(NOW(), INTERVAL 2 MONTH)) as m,count(*) as c from ten_person_${cellId} where delete_flag = 1 and MONTH(last_update_time) = MONTH(DATE_SUB(NOW(), INTERVAL 2 MONTH)) and cell_id in @@ -1174,7 +1172,7 @@ UNION - select MONTH(DATE_SUB(NOW(), INTERVAL 3 MONTH)) as m,count(*) as c from ten_person where delete_flag = 1 and MONTH(last_update_time) = MONTH(DATE_SUB(NOW(), INTERVAL 3 MONTH)) + select MONTH(DATE_SUB(NOW(), INTERVAL 3 MONTH)) as m,count(*) as c from ten_person_${cellId} where delete_flag = 1 and MONTH(last_update_time) = MONTH(DATE_SUB(NOW(), INTERVAL 3 MONTH)) and cell_id in @@ -1182,7 +1180,7 @@ UNION - select MONTH(DATE_SUB(NOW(), INTERVAL 4 MONTH)) as m,count(*) as c from ten_person where delete_flag = 1 and MONTH(last_update_time) = MONTH(DATE_SUB(NOW(), INTERVAL 4 MONTH)) + select MONTH(DATE_SUB(NOW(), INTERVAL 4 MONTH)) as m,count(*) as c from ten_person_${cellId} where delete_flag = 1 and MONTH(last_update_time) = MONTH(DATE_SUB(NOW(), INTERVAL 4 MONTH)) and cell_id in @@ -1190,7 +1188,7 @@ UNION - select MONTH(DATE_SUB(NOW(), INTERVAL 5 MONTH)) as m,count(*) as c from ten_person where delete_flag = 1 and MONTH(last_update_time) = MONTH(DATE_SUB(NOW(), INTERVAL 5 MONTH)) + select MONTH(DATE_SUB(NOW(), INTERVAL 5 MONTH)) as m,count(*) as c from ten_person_${cellId} where delete_flag = 1 and MONTH(last_update_time) = MONTH(DATE_SUB(NOW(), INTERVAL 5 MONTH)) and cell_id in @@ -1198,7 +1196,7 @@ UNION - select MONTH(DATE_SUB(NOW(), INTERVAL 6 MONTH)) as m,count(*) as c from ten_person where delete_flag = 1 and MONTH(last_update_time) = MONTH(DATE_SUB(NOW(), INTERVAL 6 MONTH)) + select MONTH(DATE_SUB(NOW(), INTERVAL 6 MONTH)) as m,count(*) as c from ten_person_${cellId} where delete_flag = 1 and MONTH(last_update_time) = MONTH(DATE_SUB(NOW(), INTERVAL 6 MONTH)) and cell_id in @@ -1209,27 +1207,27 @@ - select * from ten_person where delete_flag = 0 + select * from ten_person_${cellId} where delete_flag = 0 and id_card = #{idCard} - select person_id,last_update_time from ten_person_sync_${tenantId} + select person_id,last_update_time from ten_person_sync_${cellId} where 1=1 and device_id = #{deviceId} @@ -129,25 +129,25 @@ - delete from ten_person_sync_${tenantId} + delete from ten_person_sync_${cellId} where device_id = #{deviceId} and state = 3 - delete from ten_person_sync_${tenantId} + delete from ten_person_sync_${cellId} where device_id = #{deviceId} - delete from ten_person_sync_${tenantId} + delete from ten_person_sync_${cellId} where person_sync_id = #{personSyncId} diff --git a/shapelight-admin/src/main/resources/mapper/ten/TenRecordDao.xml b/shapelight-admin/src/main/resources/mapper/ten/TenRecordDao.xml index d12a8af..91e480c 100644 --- a/shapelight-admin/src/main/resources/mapper/ten/TenRecordDao.xml +++ b/shapelight-admin/src/main/resources/mapper/ten/TenRecordDao.xml @@ -38,7 +38,7 @@ - insert into ten_record_${tenantId} + insert into ten_record_${cellId} record_id, @@ -183,7 +183,7 @@ - update ten_record_${tenantId} + update ten_record_${cellId} record_id = #{recordId,jdbcType=BIGINT}, @@ -233,64 +233,64 @@ - delete from ten_record_${tenantId} + delete from ten_record_${cellId} where record_id = #{recordId,jdbcType=BIGINT} @@ -504,7 +524,7 @@ - + @@ -526,8 +546,8 @@ - select rec.* from (select r.*,t.name from ten_record_${params.tenantId} r - left join ten_person t on r.person_id = t.person_id + select rec.* from (select r.*,t.name from ten_record_${params.cellId} r + left join ten_person_${cellId} t on r.person_id = t.person_id where 1 = 1 and r.cell_id = #{params.cellId} @@ -553,14 +573,14 @@ - select rec.* from (select r.*,t.name from ten_record_${params.tenantId} r + select rec.* from (select r.*,t.name from ten_record_${params.cellId} r left join ten_person t on r.person_id = t.person_id where 1 = 1 @@ -639,7 +659,7 @@ - select * from ten_room + select * from ten_room_${cellId} where room_id = #{roomId,jdbcType=BIGINT} - delete from ten_room + delete from ten_room_${cellId} where room_id = #{roomId,jdbcType=BIGINT} - update ten_room set delete_flag = 1 + update ten_room_${cellId} set delete_flag = 1 where room_id = #{roomId,jdbcType=BIGINT} - update ten_room set delete_flag = 1 + update ten_room_${cellId} set delete_flag = 1 where build_id = #{buildId,jdbcType=BIGINT} - update ten_room set delete_flag = 1 + update ten_room_${cellId} set delete_flag = 1 where cell_id = #{cellId,jdbcType=BIGINT} @@ -329,25 +329,25 @@ @@ -421,51 +421,51 @@ diff --git a/shapelight-admin/src/test/java/gb/SyncBatchAdd.java b/shapelight-admin/src/test/java/gb/SyncBatchAdd.java index f7d5853..cad3000 100644 --- a/shapelight-admin/src/test/java/gb/SyncBatchAdd.java +++ b/shapelight-admin/src/test/java/gb/SyncBatchAdd.java @@ -57,12 +57,12 @@ select * from ten_person where person_id = 1144346910165827586 List allSysTenUser = sysUserService.findAllSysTenUser(); for (SysUserEntity sysTenUser : allSysTenUser) { System.out.println("处理运营商:"+sysTenUser.getUsername()+" tenantId:"+sysTenUser.getTenantId()); - List towList = tenPersonSyncService.findTwo(sysTenUser.getTenantId()); + List towList = tenPersonSyncService.findTwo(sysTenUser.getCellId()); for(TenPersonSyncEntity personEntity: towList){ - List haveTwo = tenPersonSyncService.findByDeviceIdAndPersonIdList(personEntity.getDeviceId(),personEntity.getPersonId(),sysTenUser.getTenantId()); + List haveTwo = tenPersonSyncService.findByDeviceIdAndPersonIdList(personEntity.getDeviceId(),personEntity.getPersonId(),sysTenUser.getCellId()); if(haveTwo.size()>1){ TenPersonSyncEntity entity = haveTwo.get(0); - tenPersonSyncService.removeByPersonSyncId(entity.getPersonSyncId(),entity.getTenantId()); + tenPersonSyncService.removeByPersonSyncId(entity.getPersonSyncId(),entity.getCellId()); System.out.println("删除同步信息:"+entity.getPersonSyncId()); } }