人员删除问题修改

This commit is contained in:
张博 2024-11-12 16:15:28 +08:00
parent b921b3ce8a
commit 65cc7d4f54
2 changed files with 19 additions and 17 deletions

View File

@ -913,25 +913,26 @@ public class TenPersonServiceImpl implements TenPersonService {
tenPersonDao.logicDeleteById(personId, cellId);
tenRelationMapper.delete(new LambdaQueryWrapper<TenRelation>().eq(TenRelation::getStudentId,personId));
Map<String, String> 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<TenPersonOperationVo> 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);
if(snPersons!=null) {
String sn = snPersons.get("deviceSn");
TenDeviceEntity deviceEntity = tenDeviceService.findBySn(sn);
if(deviceEntity==null){
continue;
}
String[] persons = snPersons.get("plist").split(",");
List<TenPersonOperationVo> 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);
TenPersonSyncEntity syncEntity = tenPersonSyncService.findByDeviceIdAndPersonId(deviceEntity.getDeviceId(), personCode, cellId);
syncEntity.setLastUpdateTime(lastUpdateTime);
syncEntity.setState(Constant.PERSON_SYNC_DELETE);
tenPersonSyncService.updateById(syncEntity);
}
}
}

View File

@ -175,9 +175,10 @@
<select id="findGroupDevicePerson" resultType="map">
select device_sn as deviceSn,group_concat(person_id,"_",last_update_time separator ",") as plist
from ten_person_sync_${cellId} where 1= 1
<if test="personIds != null">
<if test="personId != null">
and person_id = #{personId}
</if>
group by device_sn
</select>
<select id="findDeviceAllDeletePersons" resultType="net.shapelight.modules.ten.entity.TenPersonSyncEntity">