|
@@ -3,17 +3,14 @@ package org.jeecg.modules.adweb.system.service.impl;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
-
|
|
|
import jakarta.annotation.Resource;
|
|
|
-
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
-
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
-import org.jeecg.common.system.api.ISysBaseAPI;
|
|
|
import org.jeecg.modules.adweb.system.entity.MasterSubAccountRelation;
|
|
|
import org.jeecg.modules.adweb.system.mapper.MasterSubAccountRelationMapper;
|
|
|
import org.jeecg.modules.adweb.system.service.IMasterSubAccountRelationService;
|
|
|
import org.jeecg.modules.adweb.system.service.SysAdwebApi;
|
|
|
+import org.springframework.context.annotation.Lazy;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.Arrays;
|
|
@@ -25,58 +22,56 @@ import java.util.stream.Collectors;
|
|
|
@Slf4j
|
|
|
public class MasterSubAccountRelationServiceImpl extends ServiceImpl<MasterSubAccountRelationMapper, MasterSubAccountRelation> implements IMasterSubAccountRelationService {
|
|
|
|
|
|
- @Resource
|
|
|
- private ISysBaseAPI sysBaseAPI;
|
|
|
-
|
|
|
+ @Lazy
|
|
|
@Resource
|
|
|
private SysAdwebApi sysAdwebApi;
|
|
|
|
|
|
@Override
|
|
|
- public String getMasterAccountIdBySub(String subId){
|
|
|
+ public String getMasterAccountIdBySub(String subId) {
|
|
|
String masterId = "";
|
|
|
LambdaQueryWrapper<MasterSubAccountRelation> query = new LambdaQueryWrapper<>();
|
|
|
- query.eq(MasterSubAccountRelation::getSubId,subId);
|
|
|
- query.eq(MasterSubAccountRelation::getStatus,1);
|
|
|
+ query.eq(MasterSubAccountRelation::getSubId, subId);
|
|
|
+ query.eq(MasterSubAccountRelation::getStatus, 1);
|
|
|
MasterSubAccountRelation relation = null;
|
|
|
try {
|
|
|
relation = this.getBaseMapper().selectOne(query);
|
|
|
- if(relation != null){
|
|
|
+ if (relation != null) {
|
|
|
masterId = relation.getMasterId();
|
|
|
}
|
|
|
- } catch (Exception e){
|
|
|
+ } catch (Exception e) {
|
|
|
log.error("通过子账户ID获取主账户ID失败");
|
|
|
}
|
|
|
return masterId;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public String getMasterAccountNameBySub(String subId){
|
|
|
+ public String getMasterAccountNameBySub(String subId) {
|
|
|
String masterName = "";
|
|
|
LambdaQueryWrapper<MasterSubAccountRelation> query = new LambdaQueryWrapper<>();
|
|
|
- query.eq(MasterSubAccountRelation::getSubId,subId);
|
|
|
- query.eq(MasterSubAccountRelation::getStatus,1);
|
|
|
+ query.eq(MasterSubAccountRelation::getSubId, subId);
|
|
|
+ query.eq(MasterSubAccountRelation::getStatus, 1);
|
|
|
MasterSubAccountRelation relation = null;
|
|
|
try {
|
|
|
relation = this.getBaseMapper().selectOne(query);
|
|
|
- if(relation != null){
|
|
|
+ if (relation != null) {
|
|
|
masterName = relation.getMasterName();
|
|
|
}
|
|
|
- } catch (Exception e){
|
|
|
+ } catch (Exception e) {
|
|
|
log.error("通过子账户ID获取主账户ID失败");
|
|
|
}
|
|
|
return masterName;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<String> getSubAccountIdByMaster(String masterId){
|
|
|
+ public List<String> getSubAccountIdByMaster(String masterId) {
|
|
|
List<String> subIdList = null;
|
|
|
LambdaQueryWrapper<MasterSubAccountRelation> query = new LambdaQueryWrapper<>();
|
|
|
- query.eq(MasterSubAccountRelation::getMasterId,masterId);
|
|
|
- query.eq(MasterSubAccountRelation::getStatus,1);
|
|
|
+ query.eq(MasterSubAccountRelation::getMasterId, masterId);
|
|
|
+ query.eq(MasterSubAccountRelation::getStatus, 1);
|
|
|
List<MasterSubAccountRelation> relationList = null;
|
|
|
try {
|
|
|
relationList = this.getBaseMapper().selectList(query);
|
|
|
- } catch (Exception e){
|
|
|
+ } catch (Exception e) {
|
|
|
log.error("通过主账户ID获取子账户ID失败");
|
|
|
}
|
|
|
subIdList = relationList.stream().map(MasterSubAccountRelation::getSubId).collect(Collectors.toList());
|
|
@@ -84,13 +79,13 @@ public class MasterSubAccountRelationServiceImpl extends ServiceImpl<MasterSubAc
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void insertAccountRelation(MasterSubAccountRelation relation){
|
|
|
+ public void insertAccountRelation(MasterSubAccountRelation relation) {
|
|
|
relation.setCreateTime(new Date());
|
|
|
try {
|
|
|
- if(relation != null){
|
|
|
+ if (relation != null) {
|
|
|
this.getBaseMapper().insert(relation);
|
|
|
}
|
|
|
- }catch (Exception e){
|
|
|
+ } catch (Exception e) {
|
|
|
log.error("保存主账户和子账户ID失败");
|
|
|
}
|
|
|
}
|