|
@@ -538,6 +538,20 @@ public class PersonService {
|
|
|
* @return
|
|
|
*/
|
|
|
public boolean deleteById(Long id){
|
|
|
+ IdenPerson idenPerson = this.idenPersonService.getById(id);
|
|
|
+
|
|
|
+ QueryWrapper<IdenPersonCrowdRef> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.lambda().eq(IdenPersonCrowdRef::getPersonId,idenPerson.getId());
|
|
|
+ idenPersonCrowdRefService.remove(queryWrapper);
|
|
|
+
|
|
|
+ String image = idenPerson.getImage();
|
|
|
+ IdenCommunity idenCommunity = this.idenCommunityService.getById(idenPerson.getCommunityId());
|
|
|
+ if (StringUtils.isNotEmpty(image) && idenCommunity != null) {
|
|
|
+ File imageFile = new File(idenRoot + "data/final/person/image/" + idenCommunity.getCode() + "/" + image.substring(image.lastIndexOf("/")));
|
|
|
+ if(imageFile.exists()){
|
|
|
+ imageFile.delete();
|
|
|
+ }
|
|
|
+ }
|
|
|
return this.idenPersonService.removeById(id);
|
|
|
}
|
|
|
|
|
@@ -665,16 +679,13 @@ public class PersonService {
|
|
|
*/
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void updatePerson(PersonVO vo) throws BDException {
|
|
|
- Long communityId = vo.getCommunityId();
|
|
|
- if(communityId == null ){
|
|
|
- throw new BDException("必须选择小区");
|
|
|
- }
|
|
|
+ vo.setCommunityId(null);//不能修改小区
|
|
|
+
|
|
|
+ IdenPerson idenPerson = this.idenPersonService.getById(vo.getId());
|
|
|
+ Long communityId = idenPerson.getCommunityId();
|
|
|
IdenCommunity idenCommunity = this.idenCommunityService.getById(communityId);
|
|
|
- if(idenCommunity == null ){
|
|
|
- throw new BDException("小区不能为空");
|
|
|
- }
|
|
|
+
|
|
|
//保存人员
|
|
|
- IdenPerson idenPerson = new IdenPerson();
|
|
|
String oldImage = idenPerson.getImage();
|
|
|
BeanUtil.copyProperties(vo,idenPerson);
|
|
|
String newImage = vo.getImage();
|