| | |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import static java.util.Objects.isNull; |
| | | import static java.util.Objects.nonNull; |
| | | import static org.apache.commons.lang3.StringUtils.isNotBlank; |
| | | |
| | | /** |
| | | * (ComProperty)表服务实现类 |
| | | * |
| | |
| | | if(comPropertyVO!=null){ |
| | | ComProperty comProperty=new ComProperty(); |
| | | BeanUtils.copyProperties(comPropertyVO,comProperty); |
| | | AdministratorsUserVO administratorsUserVO=new AdministratorsUserVO(); |
| | | administratorsUserVO.setType(3); |
| | | administratorsUserVO.setAccount(comPropertyVO.getAccount()); |
| | | administratorsUserVO.setPassword(comPropertyVO.getPassword()); |
| | | administratorsUserVO.setRoleId(comPropertyVO.getRoleId()); |
| | | administratorsUserVO.setCommunityId(comPropertyVO.getCommunityId()); |
| | | administratorsUserVO.setAreaId(comPropertyVO.getAreaId()); |
| | | administratorsUserVO.setName(comPropertyVO.getContactName()); |
| | | administratorsUserVO.setPhone(comPropertyVO.getPhone()); |
| | | R r=userService.addUserBackstageProperty(administratorsUserVO); |
| | | if(R.isOk(r)){ |
| | | comProperty.setUserId(Long.parseLong(r.getData().toString())); |
| | | if (isNotBlank(comPropertyVO.getAccount())) { |
| | | AdministratorsUserVO administratorsUserVO=new AdministratorsUserVO(); |
| | | administratorsUserVO.setType(3); |
| | | administratorsUserVO.setAccount(comPropertyVO.getAccount()); |
| | | administratorsUserVO.setPassword(comPropertyVO.getPassword()); |
| | | administratorsUserVO.setRoleId(comPropertyVO.getRoleId()); |
| | | administratorsUserVO.setCommunityId(comPropertyVO.getCommunityId()); |
| | | administratorsUserVO.setAreaId(comPropertyVO.getAreaId()); |
| | | administratorsUserVO.setName(comPropertyVO.getContactName()); |
| | | administratorsUserVO.setPhone(comPropertyVO.getPhone()); |
| | | R r=userService.addUserBackstageProperty(administratorsUserVO); |
| | | if(R.isOk(r)){ |
| | | comProperty.setUserId(Long.parseLong(r.getData().toString())); |
| | | comProperty.setCreateTime(DateUtil.date()); |
| | | this.comPropertyDao.insert(comProperty); |
| | | return R.ok(); |
| | | } |
| | | } else { |
| | | comProperty.setCreateTime(DateUtil.date()); |
| | | this.comPropertyDao.insert(comProperty); |
| | | return R.ok(); |
| | |
| | | administratorsUserVO.setUserId(comProperty.getUserId()); |
| | | administratorsUserVO.setCommunityId(comProperty.getCommunityId()); |
| | | userService.deleteUserBackstage(administratorsUserVO); |
| | | this.comPropertyDao.deleteById(id); |
| | | return R.ok(); |
| | | } |
| | | this.comPropertyDao.deleteById(id); |
| | | return R.ok(); |
| | | } |
| | | return R.fail("用户账号错误"); |
| | | } |
| | | |
| | | /** |
| | | * 物业公司详情 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @Override |
| | | public R detailProperty(Long id) { |
| | | ComProperty comProperty = comPropertyDao.selectById(id); |
| | | if (isNull(comProperty)) { |
| | | return R.fail("资源不存在"); |
| | | } |
| | | ComPropertyVO comPropertyVO = new ComPropertyVO(); |
| | | BeanUtils.copyProperties(comProperty, comPropertyVO); |
| | | comPropertyVO.setPassword(null); |
| | | return R.ok(comPropertyVO); |
| | | } |
| | | } |