Commit f6bb0606 by huangjy

fix:平台端子女端列表编辑删除问题

parent 18e7380b
......@@ -162,18 +162,39 @@ public class PlatElderChildrenInfoServiceImpl extends ServiceImpl<PlatElderChild
//
// }
@Transactional
@Transactional(rollbackFor = Exception.class)
@Override
public void edit(PlatElderChildrenInfoDTOVO dto) {
check(BeanDtoVoUtils.convert(dto, PlatElderChildrenInfoDTOVO.class));
PlatElderChildrenInfo db = getById(dto.getId());
BeanUtils.copyProperties(dto, db);
List<PlatElderChildrenInfo> platElderChildrenInfoList = list(new QueryWrapper<PlatElderChildrenInfo>().lambda()
.eq(PlatElderChildrenInfo::getOpenid, db.getOpenid()));
List<String> idList = StreamUtil.map(platElderChildrenInfoList, BaseEntity::getId);
removeByIds(idList);
CommonUserVO commonUserVO = CommonUserUtil.getUser();
db.setCreateBy(commonUserVO.getName());
updateById(db);
ArrayList<String> elderIdList = Lists.newArrayList(dto.getElderId().split(","));
List<PlatElder> platElders = platElderService.listByIds(elderIdList);
Map<String, PlatElder> platElderMap = StreamUtil.toMap(platElders, BaseEntity::getId);
for (String elderId : elderIdList) {
PlatElderChildrenInfo elderChildrenInfo = new PlatElderChildrenInfo();
BeanUtils.copyProperties(db,elderChildrenInfo,"id");
PlatElder platElder = platElderMap.get(elderId);
if (platElder != null) {
elderChildrenInfo.setOrgId(platElder.getOrgId());
elderChildrenInfo.setCityOrgId(platElder.getCityOrgId());
elderChildrenInfo.setDistrictOrgId(platElder.getDistrictOrgId());
elderChildrenInfo.setStreetOrgId(platElder.getStreetOrgId());
elderChildrenInfo.setOrgPath(platElder.getOrgPath());
}
elderChildrenInfo.setPhone(dto.getPhone());
elderChildrenInfo.setName(dto.getName());
elderChildrenInfo.setElderId(elderId);
elderChildrenInfo.setCreateBy(commonUserVO.getName());
save(elderChildrenInfo);
}
}
@Transactional(rollbackFor = Exception.class)
......@@ -204,10 +225,15 @@ public class PlatElderChildrenInfoServiceImpl extends ServiceImpl<PlatElderChild
}
@Transactional
@Transactional(rollbackFor = Exception.class)
@Override
public void del(String id) {
removeById(id);
PlatElderChildrenInfo db = getById(id);
List<PlatElderChildrenInfo> platElderChildrenInfoList = list(new QueryWrapper<PlatElderChildrenInfo>().lambda()
.eq(PlatElderChildrenInfo::getOpenid, db.getOpenid()));
List<String> idList = StreamUtil.map(platElderChildrenInfoList, BaseEntity::getId);
removeByIds(idList);
}
/*子女端小程序*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment