人员删除问题修改

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); tenPersonDao.logicDeleteById(personId, cellId);
tenRelationMapper.delete(new LambdaQueryWrapper<TenRelation>().eq(TenRelation::getStudentId,personId)); tenRelationMapper.delete(new LambdaQueryWrapper<TenRelation>().eq(TenRelation::getStudentId,personId));
Map<String, String> snPersons = tenPersonSyncService.findGroupDevicePerson(personId,cellId); Map<String, String> snPersons = tenPersonSyncService.findGroupDevicePerson(personId,cellId);
String sn = snPersons.get("deviceSn"); if(snPersons!=null) {
TenDeviceEntity deviceEntity = tenDeviceService.findBySn(sn); String sn = snPersons.get("deviceSn");
if(deviceEntity==null){ TenDeviceEntity deviceEntity = tenDeviceService.findBySn(sn);
continue; if(deviceEntity==null){
} continue;
String[] persons = snPersons.get("plist").split(","); }
List<TenPersonOperationVo> list = new ArrayList<>(); String[] persons = snPersons.get("plist").split(",");
for (String personStr : persons) { List<TenPersonOperationVo> list = new ArrayList<>();
String[] personInfoStr = personStr.split("_"); for (String personStr : persons) {
Long personCode = Long.parseLong(personInfoStr[0]); String[] personInfoStr = personStr.split("_");
Date lastUpdateTime = DateUtils.stringToDate(personInfoStr[1], DateUtils.DATE_TIME_PATTERN); Long personCode = Long.parseLong(personInfoStr[0]);
Date lastUpdateTime = DateUtils.stringToDate(personInfoStr[1], DateUtils.DATE_TIME_PATTERN);
TenPersonSyncEntity syncEntity = tenPersonSyncService.findByDeviceIdAndPersonId(deviceEntity.getDeviceId(), personCode, cellId); TenPersonSyncEntity syncEntity = tenPersonSyncService.findByDeviceIdAndPersonId(deviceEntity.getDeviceId(), personCode, cellId);
syncEntity.setLastUpdateTime(lastUpdateTime); syncEntity.setLastUpdateTime(lastUpdateTime);
syncEntity.setState(Constant.PERSON_SYNC_DELETE); syncEntity.setState(Constant.PERSON_SYNC_DELETE);
tenPersonSyncService.updateById(syncEntity); tenPersonSyncService.updateById(syncEntity);
}
} }
} }

View File

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