|
@@ -4,6 +4,7 @@ import cn.hutool.core.collection.ListUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.fjhx.account.entity.account.po.AccountManagement;
|
|
@@ -17,6 +18,9 @@ import com.fjhx.account.service.account.AccountRunningWaterService;
|
|
|
import com.fjhx.common.constant.SourceConstant;
|
|
|
import com.fjhx.common.entity.corporation.po.Corporation;
|
|
|
import com.fjhx.common.service.corporation.CorporationService;
|
|
|
+import com.fjhx.tenant.entity.dict.dto.DictTenantDataSelectDto;
|
|
|
+import com.fjhx.tenant.entity.dict.vo.DictTenantDataVo;
|
|
|
+import com.fjhx.tenant.service.dict.DictTenantDataService;
|
|
|
import com.obs.services.internal.ServiceException;
|
|
|
import com.ruoyi.common.annotation.TenantIgnore;
|
|
|
import com.ruoyi.common.core.domain.BaseSelectDto;
|
|
@@ -35,8 +39,11 @@ import com.fjhx.account.entity.account.dto.AccountManagementDto;
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
@@ -57,10 +64,8 @@ public class AccountManagementServiceImpl extends ServiceImpl<AccountManagementM
|
|
|
private AccountRunningWaterService accountRunningWaterService;
|
|
|
|
|
|
@Autowired
|
|
|
- private CorporationService corporationService;
|
|
|
+ private DictTenantDataService dictTenantDataService;
|
|
|
|
|
|
- @Autowired
|
|
|
- private ISysUserService sysUserService;
|
|
|
|
|
|
/**
|
|
|
* 账户-管理表分页
|
|
@@ -73,7 +78,7 @@ public class AccountManagementServiceImpl extends ServiceImpl<AccountManagementM
|
|
|
wrapper.and(wrapper1 ->{
|
|
|
wrapper1.like(AccountManagement::getName,dto.getKeyword()).or()
|
|
|
.like(AccountManagement::getAlias,dto.getKeyword()).or()
|
|
|
- .like(AccountManagement::getAccountOpening,dto.getOpeningBank()).or()
|
|
|
+ .like(AccountManagement::getAccountOpening,dto.getKeyword()).or()
|
|
|
.like(AccountManagement::getOpeningBank,dto.getKeyword());
|
|
|
} );
|
|
|
}
|
|
@@ -158,6 +163,59 @@ public class AccountManagementServiceImpl extends ServiceImpl<AccountManagementM
|
|
|
.eq(AccountRemainder::getAccountManagementId,id));
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 账户统计(账户列表)
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public List<Map<String, Object>> managementStatistics(AccountManagementSelectDto dto) {
|
|
|
+ //存放账户统计数据
|
|
|
+ List<Map<String, Object>> list = new ArrayList<>();
|
|
|
+
|
|
|
+ QueryWrapper<AccountRemainder> query = Wrappers.query();
|
|
|
+ query.groupBy("currency");
|
|
|
+ query.select("currency,sum(remainder) remainder");
|
|
|
+ List<AccountRemainder> accountRemainderList = accountRemainderService.list(query);
|
|
|
+
|
|
|
+ //切换数据源
|
|
|
+ DynamicDataSourceContextHolder.push(SourceConstant.BASE);
|
|
|
+ //获取来源的字典数据
|
|
|
+ List<DictTenantDataVo> dictTenantDataVos = getDict("customer_source");
|
|
|
+ DynamicDataSourceContextHolder.poll();
|
|
|
+
|
|
|
+ if (dictTenantDataVos.size()==0){
|
|
|
+ throw new ServiceException("数据有误:没有配置币种字典,请先配置");
|
|
|
+ }
|
|
|
+
|
|
|
+ //赋值
|
|
|
+ for (DictTenantDataVo dictTenantDataVo : dictTenantDataVos) {
|
|
|
+ //赋初始值信息
|
|
|
+ Map<String,Object> map = new HashMap<>();
|
|
|
+ map.put("currencyKey",dictTenantDataVo.getDictKey());
|
|
|
+ map.put("currencyValue",dictTenantDataVo.getDictValue());
|
|
|
+ map.put("remainder",new BigDecimal(0));
|
|
|
+ //赋值余额信息
|
|
|
+ if (accountRemainderList.size()>0){
|
|
|
+ Map<String, List<AccountRemainder>> accountRemainderMap = accountRemainderList.stream()
|
|
|
+ .collect(Collectors.groupingBy(AccountRemainder::getCurrency));
|
|
|
+ List<AccountRemainder> accountRemainderList1 = accountRemainderMap.get(dictTenantDataVo.getDictKey());
|
|
|
+ if (ObjectUtil.isNotEmpty(accountRemainderList1)){
|
|
|
+ map.put("remainder",accountRemainderList1.get(0).getRemainder());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ list.add(map);
|
|
|
+ }
|
|
|
+
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
+ //根据字典编码获取字典的数据
|
|
|
+ private List<DictTenantDataVo> getDict(String code){
|
|
|
+ DictTenantDataSelectDto dto = new DictTenantDataSelectDto();
|
|
|
+ dto.setDictCode(code);
|
|
|
+ return dictTenantDataService.getList(dto);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
// /**
|
|
|
// * 导入账户表的数据
|
|
|
// */
|