| | |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.panzhihua.common.model.vos.user.AdministratorsUserVO; |
| | | import com.panzhihua.common.service.user.UserService; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.ObjectUtils; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | |
| | | @Resource |
| | | private ComStreetDAO comStreetDAO; |
| | | |
| | | @Resource |
| | | private UserService userService; |
| | | |
| | | /** |
| | | * 新增社区 |
| | | * |
| | |
| | | * @return 新增结果 |
| | | */ |
| | | @Override |
| | | public R addStreet(ComStreetVO comStreetVO) { |
| | | @Transactional |
| | | public R<ComStreetVO> addStreet(ComStreetVO comStreetVO) { |
| | | String password = comStreetVO.getPassword(); |
| | | String encode = new BCryptPasswordEncoder().encode(password); |
| | | comStreetVO.setPassword(encode); |
| | |
| | | if (integer > 0) { |
| | | return R.fail(500, "街道已经存在"); |
| | | } |
| | | BeanUtils.copyProperties(comStreetVO, comStreetDO); |
| | | int insert = comStreetDAO.insert(comStreetDO); |
| | | if (insert > 0) { |
| | | ComStreetDO comStreetDO1 = comStreetDAO.selectOne(param); |
| | | BeanUtils.copyProperties(comStreetDO1, comStreetVO); |
| | | return R.ok(comStreetVO); |
| | | AdministratorsUserVO administratorsUserVO=new AdministratorsUserVO(); |
| | | administratorsUserVO.setType(3); |
| | | administratorsUserVO.setAccount(comStreetVO.getAccount()); |
| | | administratorsUserVO.setPassword(comStreetVO.getPassword()); |
| | | administratorsUserVO.setSocialType(1); |
| | | administratorsUserVO.setRoleId(777777777L); |
| | | administratorsUserVO.setStreetId(0L); |
| | | administratorsUserVO.setName(comStreetVO.getName()); |
| | | R r=userService.addUserBackstageProperty(administratorsUserVO); |
| | | if(R.isOk(r)){ |
| | | BeanUtils.copyProperties(comStreetVO, comStreetDO); |
| | | int insert = comStreetDAO.insert(comStreetDO); |
| | | if (insert > 0) { |
| | | ComStreetDO comStreetDO1 = comStreetDAO.selectOne(param); |
| | | BeanUtils.copyProperties(comStreetDO1, comStreetVO); |
| | | return R.ok(comStreetVO); |
| | | } |
| | | return R.fail(500, ""); |
| | | } |
| | | return R.fail(500, ""); |
| | | return R.fail("账号已存在"); |
| | | } |
| | | |
| | | /** |