|
@@ -831,7 +831,6 @@ public class StoreUserServiceImpl extends ServiceImpl<StoreUserMapper, StoreUser
|
|
|
vo.setSerialNumber(++serialNumber);
|
|
vo.setSerialNumber(++serialNumber);
|
|
|
vo.setParentAccountId(mainAccount != null ? mainAccount.getId() : null);
|
|
vo.setParentAccountId(mainAccount != null ? mainAccount.getId() : null);
|
|
|
vo.setParentAccountPhone(mainAccount != null ? mainAccount.getPhone() : null);
|
|
vo.setParentAccountPhone(mainAccount != null ? mainAccount.getPhone() : null);
|
|
|
- vo.setSubAccountId(subAccount.getId());
|
|
|
|
|
vo.setPhone(subAccount.getPhone());
|
|
vo.setPhone(subAccount.getPhone());
|
|
|
vo.setCreatedTime(subAccount.getCreatedTime() != null ? subAccount.getCreatedTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime().format(formatter) : null);
|
|
vo.setCreatedTime(subAccount.getCreatedTime() != null ? subAccount.getCreatedTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime().format(formatter) : null);
|
|
|
int rowStatus = (subAccount.getStatus() != null && subAccount.getStatus() == -1) ? -1
|
|
int rowStatus = (subAccount.getStatus() != null && subAccount.getStatus() == -1) ? -1
|
|
@@ -1075,7 +1074,7 @@ public class StoreUserServiceImpl extends ServiceImpl<StoreUserMapper, StoreUser
|
|
|
*/
|
|
*/
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
- public boolean deleteStoreAccountInfo(StoreUserVo storeUserVo) {
|
|
|
|
|
|
|
+ public String deleteStoreAccountInfo(StoreUserVo storeUserVo) {
|
|
|
// 解析用户:优先用子账号联系方式 phone 查;未传 phone 时用 id/subAccountId 查 store_user,后端从库中拿到子账号联系方式(phone)
|
|
// 解析用户:优先用子账号联系方式 phone 查;未传 phone 时用 id/subAccountId 查 store_user,后端从库中拿到子账号联系方式(phone)
|
|
|
StoreUser storeUser = null;
|
|
StoreUser storeUser = null;
|
|
|
if ((storeUserVo.getId() != null || storeUserVo.getSubAccountId() != null)) {
|
|
if ((storeUserVo.getId() != null || storeUserVo.getSubAccountId() != null)) {
|
|
@@ -1088,7 +1087,7 @@ public class StoreUserServiceImpl extends ServiceImpl<StoreUserMapper, StoreUser
|
|
|
}
|
|
}
|
|
|
if (storeUserVo == null) {
|
|
if (storeUserVo == null) {
|
|
|
log.warn("deleteStoreAccountInfo 用户不存在或已删除,请传子账号联系电话(phone)或用户id");
|
|
log.warn("deleteStoreAccountInfo 用户不存在或已删除,请传子账号联系电话(phone)或用户id");
|
|
|
- return false;
|
|
|
|
|
|
|
+ return "删除失败";
|
|
|
}
|
|
}
|
|
|
// 通过 phone 再尝试解析用户(前端可能只传 phone)
|
|
// 通过 phone 再尝试解析用户(前端可能只传 phone)
|
|
|
if (storeUser == null && storeUserVo.getPhone() != null) {
|
|
if (storeUser == null && storeUserVo.getPhone() != null) {
|
|
@@ -1097,7 +1096,7 @@ public class StoreUserServiceImpl extends ServiceImpl<StoreUserMapper, StoreUser
|
|
|
}
|
|
}
|
|
|
if (storeUser == null) {
|
|
if (storeUser == null) {
|
|
|
log.warn("deleteStoreAccountInfo 用户不存在或已删除,请传子账号联系电话(phone)或用户id");
|
|
log.warn("deleteStoreAccountInfo 用户不存在或已删除,请传子账号联系电话(phone)或用户id");
|
|
|
- return false;
|
|
|
|
|
|
|
+ return "删除失败";
|
|
|
}
|
|
}
|
|
|
Integer userId = storeUser.getId();
|
|
Integer userId = storeUser.getId();
|
|
|
|
|
|
|
@@ -1105,14 +1104,14 @@ public class StoreUserServiceImpl extends ServiceImpl<StoreUserMapper, StoreUser
|
|
|
if (storeUserVo.getAccountType() != null && storeUserVo.getAccountType() == 1) {
|
|
if (storeUserVo.getAccountType() != null && storeUserVo.getAccountType() == 1) {
|
|
|
if (storeUser.getStoreId() != null) {
|
|
if (storeUser.getStoreId() != null) {
|
|
|
log.error("该主账号下存在店铺,禁止删除");
|
|
log.error("该主账号下存在店铺,禁止删除");
|
|
|
- return false;
|
|
|
|
|
|
|
+ return "当前账号下存在店铺 禁止删除";
|
|
|
}
|
|
}
|
|
|
Integer mainIdForCheck = storeUserVo.getId();
|
|
Integer mainIdForCheck = storeUserVo.getId();
|
|
|
if (mainIdForCheck != null) {
|
|
if (mainIdForCheck != null) {
|
|
|
List<StoreUser> subAccounts = getSubAccountsByMainAccountId(mainIdForCheck);
|
|
List<StoreUser> subAccounts = getSubAccountsByMainAccountId(mainIdForCheck);
|
|
|
if (subAccounts != null && !subAccounts.isEmpty()) {
|
|
if (subAccounts != null && !subAccounts.isEmpty()) {
|
|
|
log.error("该主账号下存在关联子账号,禁止删除");
|
|
log.error("该主账号下存在关联子账号,禁止删除");
|
|
|
- return false;
|
|
|
|
|
|
|
+ return "当前账号下存在子账号禁止删除";
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -1121,7 +1120,7 @@ public class StoreUserServiceImpl extends ServiceImpl<StoreUserMapper, StoreUser
|
|
|
Integer mainAccountId = storeUser.getSubAccountId() != null ? storeUser.getSubAccountId() : storeUserVo.getParentAccountId();
|
|
Integer mainAccountId = storeUser.getSubAccountId() != null ? storeUser.getSubAccountId() : storeUserVo.getParentAccountId();
|
|
|
if (mainAccountId == null) {
|
|
if (mainAccountId == null) {
|
|
|
log.warn("deleteStoreAccountInfo 无法确定主账号,请传 parentAccountId 或保证子账号 store_user.sub_account_id 有值");
|
|
log.warn("deleteStoreAccountInfo 无法确定主账号,请传 parentAccountId 或保证子账号 store_user.sub_account_id 有值");
|
|
|
- return false;
|
|
|
|
|
|
|
+ return "删除失败";
|
|
|
}
|
|
}
|
|
|
// 查询主账号下的子账号数量(按 store_user 统计:account_type=2 且 sub_account_id=主账号id)
|
|
// 查询主账号下的子账号数量(按 store_user 统计:account_type=2 且 sub_account_id=主账号id)
|
|
|
List<StoreUser> subAccountsUnderMain = getSubAccountsByMainAccountId(mainAccountId);
|
|
List<StoreUser> subAccountsUnderMain = getSubAccountsByMainAccountId(mainAccountId);
|
|
@@ -1152,8 +1151,7 @@ public class StoreUserServiceImpl extends ServiceImpl<StoreUserMapper, StoreUser
|
|
|
} else {
|
|
} else {
|
|
|
log.info("主账号下子账号数不为1,仅逻辑删除 store_platform_user_role,不删 store_user: mainAccountId={}, subAccountCount={}", mainAccountId, subAccountCount);
|
|
log.info("主账号下子账号数不为1,仅逻辑删除 store_platform_user_role,不删 store_user: mainAccountId={}, subAccountCount={}", mainAccountId, subAccountCount);
|
|
|
}
|
|
}
|
|
|
- return true;
|
|
|
|
|
-
|
|
|
|
|
|
|
+ return "删除失败";
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|