|
@@ -14,6 +14,8 @@ import com.rongwei.rwcommon.base.BaseDo;
|
|
|
import com.rongwei.rwcommon.base.R;
|
|
|
import com.rongwei.rwcommon.base.exception.CustomException;
|
|
|
import com.rongwei.rwcommon.utils.SecurityUtil;
|
|
|
+import com.rongwei.rwcommonentity.commonservers.domain.TenantDo;
|
|
|
+import com.rongwei.zhsw.system.dao.CommonBusinessDao;
|
|
|
import com.rongwei.zhsw.system.dao.SwNotificationAnnouncementDao;
|
|
|
import com.rongwei.zhsw.system.service.impl.SwBillManagementUnpaidServiceImpl;
|
|
|
import com.rongwei.zhsw.system.service.impl.SwUserManagementServiceImpl;
|
|
@@ -30,6 +32,7 @@ import org.springframework.stereotype.Service;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* AccountServiceImpl class
|
|
@@ -52,7 +55,8 @@ public class AccountServiceImpl implements AccountService {
|
|
|
private SwBillManagementUnpaidServiceImpl swBillManagementUnpaidService;
|
|
|
@Autowired
|
|
|
private SwNotificationAnnouncementDao swNotificationAnnouncementDao;
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ private CommonBusinessDao commonBusinessDao;
|
|
|
@Override
|
|
|
public R bind(AccountBindVo accountBindVo) {
|
|
|
log.info("开始执行户号绑定:{}", accountBindVo);
|
|
@@ -110,16 +114,6 @@ public class AccountServiceImpl implements AccountService {
|
|
|
return R.ok(allOwnerByOpenId);
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 切换默认账户
|
|
|
- *
|
|
|
- * @param accountBindVo
|
|
|
- * @return
|
|
|
- */
|
|
|
- @Override
|
|
|
- public R changeDefaultAccount(AccountBindVo accountBindVo) {
|
|
|
- return null;
|
|
|
- }
|
|
|
|
|
|
/**
|
|
|
* 获取当前账户的信息
|
|
@@ -176,4 +170,24 @@ public class AccountServiceImpl implements AccountService {
|
|
|
List<SwUserManagementVo> allOwnerByOpenId = weChatLoginService.getAllOwnerByOpenId(currentWeChatOpenId, otherDsKeys);
|
|
|
return R.ok(allOwnerByOpenId);
|
|
|
}
|
|
|
+
|
|
|
+ public R setDefaultAccount(AccountUnbindVo accountUnbindVo){
|
|
|
+ String account = accountUnbindVo.getAccount();
|
|
|
+ String dsKey = accountUnbindVo.getDeKey();
|
|
|
+ if (StringUtils.isBlank(account)) {
|
|
|
+ throw new CustomException("解绑的户号为空");
|
|
|
+ }
|
|
|
+ //获取微信标识
|
|
|
+ String currentWeChatOpenId = WeChatUtils.getCurrentWeChatOpenId();
|
|
|
+ //微信标识下所有用户改为非默认用户
|
|
|
+ swUserManagementService.getBaseMapper().setDefaultAccount1(dsKey, currentWeChatOpenId);
|
|
|
+ //将微信标识下该户号用户设置为默认户号
|
|
|
+ swUserManagementService.getBaseMapper().setDefaultAccount0(dsKey, currentWeChatOpenId, account);
|
|
|
+ //刷新对应水务公司得业主信息
|
|
|
+ List<TenantDo> tenantDos = commonBusinessDao.getById(dsKey);
|
|
|
+ List<String> tenantDsKeys = tenantDos.stream().map(TenantDo::getDskey).collect(Collectors.toList());
|
|
|
+ ownerService.refreshByTenant(tenantDsKeys);
|
|
|
+ return R.ok();
|
|
|
+ }
|
|
|
+
|
|
|
}
|