|
@@ -186,7 +186,7 @@ public class WxUserOpenService {
|
|
|
}
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
|
|
|
- public Long createYWHRule(Long userId) throws Exception {
|
|
|
+ public int createYWHRule(Long userId) throws Exception {
|
|
|
/** 创建业委会资格
|
|
|
* 1.当前用户有无家庭角色,无则退出
|
|
|
* 2.小区已有业委会,退出
|
|
@@ -199,12 +199,13 @@ public class WxUserOpenService {
|
|
|
boolean hasFamily = false;
|
|
|
Long myUptownId = 0L;
|
|
|
Long myOwnerId = 0L;
|
|
|
+ Long myHouseId = 0L;
|
|
|
if (lstUserRole.size() > 0) {
|
|
|
//判断该用户是否创建了业委会的角色
|
|
|
for (UserRole item : lstUserRole) {
|
|
|
if (item.getRoleId() == 1L) {
|
|
|
hasFamily = true;
|
|
|
- myUptownId = item.getPropertyId();
|
|
|
+ myHouseId = item.getPropertyId();
|
|
|
}
|
|
|
if (item.getRoleId() == 2L) {
|
|
|
myOwnerId = item.getPropertyId();
|
|
@@ -214,8 +215,13 @@ public class WxUserOpenService {
|
|
|
if (!hasFamily) {
|
|
|
throw new Exception("请先完善家庭地址!");
|
|
|
}
|
|
|
+ if (myHouseId == 0L) {
|
|
|
+ throw new Exception("家庭地址中尚未生成门牌号!");
|
|
|
+ }
|
|
|
+ //根据门牌找小区id
|
|
|
+ myUptownId = sysUptownUnitMapper.getUptownIdByHouseId(myHouseId);
|
|
|
if (myUptownId == 0L) {
|
|
|
- throw new Exception("家庭地址中尚未选择小区!");
|
|
|
+ throw new Exception("家庭所在小区未找到!");
|
|
|
}
|
|
|
//判断业委会是否已经建立
|
|
|
List<Owner> lstSysOwner = ownerMapper.getOwnerByUptownId(myUptownId);
|
|
@@ -223,13 +229,13 @@ public class WxUserOpenService {
|
|
|
for (Owner item : lstSysOwner) {
|
|
|
if (item.getUserId() == sysUserId && item.getType() == 1) {
|
|
|
//业委会负责人的绑定用户是自己
|
|
|
- return 1L; //该小区已成立业委会,且业委会负责人的绑定用户是自己,可以进入编辑
|
|
|
+ return 1; //该小区已成立业委会,且业委会负责人的绑定用户是自己,可以进入编辑
|
|
|
// break;
|
|
|
}
|
|
|
}
|
|
|
throw new Exception("小区业委会已建立,非业委会负责人不能编辑!");
|
|
|
} else {
|
|
|
- return 1L; //该小区没有成立业委会,可以进入新增
|
|
|
+ return 1; //该小区没有成立业委会,可以进入新增
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -244,6 +250,7 @@ public class WxUserOpenService {
|
|
|
* */
|
|
|
Long sysUserId = queryUser(userId);
|
|
|
Long myUptownId = 0L;
|
|
|
+ Long myHouseId = 0L;
|
|
|
if (uptownId <= 0L) {
|
|
|
throw new Exception("小区id为空!");
|
|
|
}
|
|
@@ -263,13 +270,19 @@ public class WxUserOpenService {
|
|
|
throw new Exception("业委会用户角色已存在!"); //todo 暂时只允许一个用户角色绑定一个业委会
|
|
|
}
|
|
|
if (item.getRoleId() == 1L) {
|
|
|
- myUptownId = item.getPropertyId();
|
|
|
+
|
|
|
+ myHouseId = item.getPropertyId();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if (myUptownId == 0L) {
|
|
|
+ if (myHouseId == 0L) {
|
|
|
throw new Exception("请先创建家庭用户!");
|
|
|
}
|
|
|
+ //根据门牌找小区id
|
|
|
+ myUptownId = sysUptownUnitMapper.getUptownIdByHouseId(myHouseId);
|
|
|
+ if (myUptownId == 0L) {
|
|
|
+ throw new Exception("家庭所在小区未找到!");
|
|
|
+ }
|
|
|
if (myUptownId != uptownId) {
|
|
|
throw new Exception("家庭所在小区和业委会所在小区不一致!");
|
|
|
}
|
|
@@ -456,8 +469,7 @@ public class WxUserOpenService {
|
|
|
}
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
|
|
|
- public Long editFamily(Long userId, Long unitId, String doorPlate, String linkMan, Integer helpNum, String
|
|
|
- phone, Long urId) throws Exception {
|
|
|
+ public Long editFamily(Long userId, Long unitId, String doorPlate, String linkMan, Integer helpNum, String phone, Long urId) throws Exception {
|
|
|
Long sysUserId = queryUser(userId);
|
|
|
if (urId == 0L) {
|
|
|
throw new Exception("尚未建立家庭用户角色,无法编辑");
|
|
@@ -480,7 +492,10 @@ public class WxUserOpenService {
|
|
|
if (uptownHouse == null) {
|
|
|
throw new Exception("尚未创建门牌号");
|
|
|
}
|
|
|
- if (uptownHouse.getUnitId() != unitId || uptownHouse.getDoorplate() != doorPlate) {
|
|
|
+ if (uptownHouse.getUnitId() != unitId) {
|
|
|
+ throw new Exception("小区选择后不允许修改");
|
|
|
+ }
|
|
|
+ if (uptownHouse.getDoorplate() != doorPlate) {
|
|
|
//查找更换之后的单元、门牌是否被占用
|
|
|
List<UptownHouse> lstUptownHouse = uptownHouseMapper.getUptownHouseBy(unitId, doorPlate);
|
|
|
if (lstUptownHouse != null && lstUptownHouse.size() > 0) {
|