|
|
@@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import org.springblade.client.entity.CorpsDesc;
|
|
|
+import org.springblade.core.secure.BladeUser;
|
|
|
import org.springblade.core.secure.utils.AuthUtil;
|
|
|
import org.springblade.core.secure.utils.SecureUtil;
|
|
|
import org.springblade.core.tool.api.R;
|
|
|
@@ -717,41 +718,40 @@ public class CorpsDescServiceImpl extends ServiceImpl<CorpsDescMapper, PjCorpsDe
|
|
|
*/
|
|
|
@Override
|
|
|
public R getDetails() {
|
|
|
+ BladeUser bladeUser = AuthUtil.getUser();
|
|
|
PjCorpsAttn corpsAttn = corpsAttnService.getOne(new LambdaQueryWrapper<PjCorpsAttn>().eq(PjCorpsAttn::getIsDeleted, 0)
|
|
|
- .eq(PjCorpsAttn::getTenantId, AuthUtil.getTenantId())
|
|
|
- .eq(PjCorpsAttn::getUserId, AuthUtil.getUserId()));
|
|
|
- if (ObjectUtils.isNotNull(corpsAttn)) {
|
|
|
- PjCorpsDesc corpsDesc = baseMapper.getCorpId(corpsAttn.getPid());
|
|
|
- if (ObjectUtils.isNotNull(corpsDesc)) {
|
|
|
- PjCorpsAddr corpsAddr = corpsAddrService.getOne(new LambdaQueryWrapper<PjCorpsAddr>().eq(PjCorpsAddr::getIsDeleted, 0)
|
|
|
- .eq(PjCorpsAddr::getTenantId, AuthUtil.getTenantId())
|
|
|
- .eq(PjCorpsAddr::getPid, corpsDesc.getId())
|
|
|
- .eq(PjCorpsAddr::getDefaultAddres, "1")
|
|
|
- .orderByDesc(PjCorpsAddr::getCreateTime)
|
|
|
- .last(" limit 1"));
|
|
|
- if (ObjectUtils.isNotNull(corpsAddr)) {
|
|
|
- corpsDesc.setAttn(corpsAttn.getCname());
|
|
|
- corpsDesc.setTel(corpsAttn.getTel());
|
|
|
- corpsDesc.setAddr(corpsAddr.getBelongtoarea());
|
|
|
- corpsDesc.setDetails(corpsAddr.getDetailedAddress());
|
|
|
- }
|
|
|
- return R.data(corpsDesc);
|
|
|
- } else {
|
|
|
- CorpsDesc corpsDesc1 = new CorpsDesc();
|
|
|
- R<User> res = userClient.userInfoById(AuthUtil.getUserId());
|
|
|
- if (res.isSuccess() && ObjectUtils.isNotNull(res.getData())) {
|
|
|
- corpsDesc1.setTel(res.getData().getPhone());
|
|
|
- }
|
|
|
- return R.data(corpsDesc1);
|
|
|
- }
|
|
|
- } else {
|
|
|
- PjCorpsDesc corpsDesc1 = new PjCorpsDesc();
|
|
|
- R<User> res = userClient.userInfoById(AuthUtil.getUserId());
|
|
|
- if (res.isSuccess() && ObjectUtils.isNotNull(res.getData())) {
|
|
|
- corpsDesc1.setTel(res.getData().getPhone());
|
|
|
- }
|
|
|
- return R.data(corpsDesc1);
|
|
|
+ .eq(PjCorpsAttn::getTenantId, bladeUser.getTenantId())
|
|
|
+ .eq(PjCorpsAttn::getUserId, bladeUser.getUserId()));
|
|
|
+
|
|
|
+ R<User> res = userClient.userInfoById(AuthUtil.getUserId());
|
|
|
+ User user = ObjectUtils.isNotNull(res.getData()) ? res.getData() : null;
|
|
|
+ if (ObjectUtils.isNull(corpsAttn)) {
|
|
|
+ PjCorpsDesc corpsDesc = new PjCorpsDesc();
|
|
|
+ corpsDesc.setTel(user != null ? user.getPhone() : "");
|
|
|
+ return R.data(corpsDesc);
|
|
|
+ }
|
|
|
+ PjCorpsDesc corpsDesc = baseMapper.getCorpId(corpsAttn.getPid());
|
|
|
+ if (ObjectUtils.isNull(corpsDesc)) {
|
|
|
+ corpsDesc = new PjCorpsDesc();
|
|
|
+ corpsDesc.setTel(user != null ? user.getPhone() : "");
|
|
|
+ return R.data(corpsDesc);
|
|
|
}
|
|
|
+ corpsDesc.setTel(user != null ? user.getPhone() : "");
|
|
|
+ corpsDesc.setAvatar(user != null ? user.getAvatar() : "");
|
|
|
+ corpsDesc.setUserId(user != null ? user.getId() : null);
|
|
|
+ PjCorpsAddr corpsAddr = corpsAddrService.getOne(new LambdaQueryWrapper<PjCorpsAddr>().eq(PjCorpsAddr::getIsDeleted, 0)
|
|
|
+ .eq(PjCorpsAddr::getTenantId, bladeUser.getTenantId())
|
|
|
+ .eq(PjCorpsAddr::getPid, corpsDesc.getId())
|
|
|
+ .eq(PjCorpsAddr::getDefaultAddres, "1")
|
|
|
+ .orderByDesc(PjCorpsAddr::getCreateTime)
|
|
|
+ .last(" limit 1"));
|
|
|
+ if (ObjectUtils.isNotNull(corpsAddr)) {
|
|
|
+ corpsDesc.setAttn(corpsAttn.getCname());
|
|
|
+ corpsDesc.setTel(corpsAttn.getTel());
|
|
|
+ corpsDesc.setAddr(corpsAddr.getBelongtoarea());
|
|
|
+ corpsDesc.setDetails(corpsAddr.getDetailedAddress());
|
|
|
+ }
|
|
|
+ return R.data(corpsDesc);
|
|
|
}
|
|
|
|
|
|
@Override
|