|
@@ -20,9 +20,10 @@ 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.common.utils.Assert;
|
|
|
import com.fjhx.tenant.entity.dict.vo.DictTenantDataVo;
|
|
|
-import com.fjhx.tenant.service.dict.DictTenantDataService;
|
|
|
+import com.fjhx.tenant.utils.DictUtils;
|
|
|
+import com.ruoyi.common.core.domain.BaseIdPo;
|
|
|
import com.ruoyi.common.exception.ServiceException;
|
|
|
import com.ruoyi.common.utils.SecurityUtils;
|
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
@@ -31,6 +32,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
@@ -44,23 +46,19 @@ import java.util.stream.Collectors;
|
|
|
* 账户-管理表 服务实现类
|
|
|
* </p>
|
|
|
*
|
|
|
- * @author
|
|
|
+ * @author -
|
|
|
* @since 2023-04-06
|
|
|
*/
|
|
|
@Service
|
|
|
public class AccountManagementServiceImpl extends ServiceImpl<AccountManagementMapper, AccountManagement> implements AccountManagementService {
|
|
|
@Autowired
|
|
|
private AccountRemainderService accountRemainderService;
|
|
|
-
|
|
|
@Autowired
|
|
|
private AccountRunningWaterService accountRunningWaterService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private DictTenantDataService dictTenantDataService;
|
|
|
@Autowired
|
|
|
+ @Resource
|
|
|
private CorporationService corporationService;
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
* 账户-管理表分页
|
|
|
*/
|
|
@@ -69,12 +67,10 @@ public class AccountManagementServiceImpl extends ServiceImpl<AccountManagementM
|
|
|
IWrapper<AccountManagement> wrapper = getWrapper();
|
|
|
//根据关键字查询(查询的字段有账户别名、账户名称、账号)
|
|
|
if (StringUtils.isNotEmpty(dto.getKeyword())) {
|
|
|
- wrapper.and(wrapper1 -> {
|
|
|
- wrapper1.like(AccountManagement::getName, dto.getKeyword()).or()
|
|
|
- .like(AccountManagement::getAlias, dto.getKeyword()).or()
|
|
|
- .like(AccountManagement::getAccountOpening, dto.getKeyword()).or()
|
|
|
- .like(AccountManagement::getOpeningBank, dto.getKeyword());
|
|
|
- });
|
|
|
+ wrapper.and(wrapper1 -> wrapper1.like(AccountManagement::getName, dto.getKeyword()).or()
|
|
|
+ .like(AccountManagement::getAlias, dto.getKeyword()).or()
|
|
|
+ .like(AccountManagement::getAccountOpening, dto.getKeyword()).or()
|
|
|
+ .like(AccountManagement::getOpeningBank, dto.getKeyword()));
|
|
|
}
|
|
|
|
|
|
//权限过滤:资金账户
|
|
@@ -88,9 +84,7 @@ public class AccountManagementServiceImpl extends ServiceImpl<AccountManagementM
|
|
|
Page<AccountManagementVo> page = baseMapper.getPage(dto.getPage(), wrapper);
|
|
|
List<AccountManagementVo> records = page.getRecords();
|
|
|
//赋值归属公司名称
|
|
|
- corporationService.attributeAssign(records, AccountManagementVo::getCorporationId, (item, corporation) -> {
|
|
|
- item.setCorporationName(corporation.getName());
|
|
|
- });
|
|
|
+ corporationService.attributeAssign(records, AccountManagementVo::getCorporationId, (item, corporation) -> item.setCorporationName(corporation.getName()));
|
|
|
return page;
|
|
|
}
|
|
|
|
|
@@ -150,7 +144,7 @@ public class AccountManagementServiceImpl extends ServiceImpl<AccountManagementM
|
|
|
}
|
|
|
//删除账户-余额表的信息
|
|
|
List<AccountRemainder> accountRemainderList = accountManagementDto.getAccountRemainderList();
|
|
|
- List<Long> ids = accountRemainderList.stream().map(accountRemainder -> accountRemainder.getId()).collect(Collectors.toList());
|
|
|
+ List<Long> ids = accountRemainderList.stream().map(BaseIdPo::getId).collect(Collectors.toList());
|
|
|
accountRemainderService.remove(Wrappers.<AccountRemainder>lambdaQuery()
|
|
|
.eq(AccountRemainder::getAccountManagementId, accountManagementDto.getId())
|
|
|
.notIn(AccountRemainder::getId, ids)
|
|
@@ -195,7 +189,7 @@ public class AccountManagementServiceImpl extends ServiceImpl<AccountManagementM
|
|
|
//切换数据源
|
|
|
DynamicDataSourceContextHolder.push(SourceConstant.BASE);
|
|
|
//获取来源的字典数据
|
|
|
- List<DictTenantDataVo> dictTenantDataVos = getDict("customer_source");
|
|
|
+ List<DictTenantDataVo> dictTenantDataVos = DictUtils.getDictList("customer_source");
|
|
|
DynamicDataSourceContextHolder.poll();
|
|
|
|
|
|
if (dictTenantDataVos.size() == 0) {
|
|
@@ -224,117 +218,13 @@ public class AccountManagementServiceImpl extends ServiceImpl<AccountManagementM
|
|
|
return list;
|
|
|
}
|
|
|
|
|
|
- //根据字典编码获取字典的数据
|
|
|
- private List<DictTenantDataVo> getDict(String code) {
|
|
|
- DictTenantDataSelectDto dto = new DictTenantDataSelectDto();
|
|
|
- dto.setDictCode(code);
|
|
|
- return dictTenantDataService.getList(dto);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-// /**
|
|
|
-// * 导入账户表的数据
|
|
|
-// */
|
|
|
-// @Override
|
|
|
-// @Transactional(rollbackFor = {Exception.class})
|
|
|
-// @TenantIgnore
|
|
|
-// public void importsAmount(AccountManagementDto dto) {
|
|
|
-// //查询云帆账户表的数据
|
|
|
-//// List<FundAccount> fundAccounts = baseMapper.importsAmount(dto);
|
|
|
-//// for (FundAccount fundAccount : fundAccounts) {
|
|
|
-//// //添加资金账户表的数据
|
|
|
-//// AccountManagement accountManagement = new AccountManagement();
|
|
|
-//// //查询多公司表
|
|
|
-//// if (ObjectUtil.isNotEmpty(fundAccount.getCompanyId())){
|
|
|
-//// DynamicDataSourceContextHolder.push(SourceConstant.COMMON);
|
|
|
-////
|
|
|
-//// Corporation corporation = corporationService.getOne(Wrappers.<Corporation>lambdaQuery().eq(Corporation::getYfId,fundAccount.getCompanyId()));
|
|
|
-//// if(ObjectUtil.isNotEmpty(corporation)){
|
|
|
-//// accountManagement.setCorporationId(corporation.getId());
|
|
|
-//// }
|
|
|
-////
|
|
|
-//// DynamicDataSourceContextHolder.poll();
|
|
|
-//// }
|
|
|
-//// accountManagement.setTenantId(fundAccount.getTenantId());
|
|
|
-//// accountManagement.setYfId(fundAccount.getId());
|
|
|
-//// accountManagement.setAlias(fundAccount.getName());
|
|
|
-//// accountManagement.setAccountOpening(fundAccount.getAccountNumber());
|
|
|
-//// accountManagement.setCreateTime(fundAccount.getCreateTime());
|
|
|
-//// accountManagement.setUpdateTime(fundAccount.getUpdateTime());
|
|
|
-//// accountManagement.setAccountOpening(fundAccount.getAccountNumber());
|
|
|
-//// //查询用户
|
|
|
-//// if (ObjectUtil.isNotEmpty(fundAccount.getCreateUser())){
|
|
|
-//// DynamicDataSourceContextHolder.push(SourceConstant.BASE);
|
|
|
-//// SysUser sysUser = sysUserService.getOne(Wrappers.<SysUser>lambdaQuery().eq(SysUser::getYfUserId, fundAccount.getCreateUser()));
|
|
|
-//// accountManagement.setCreateUser(sysUser.getUserId());
|
|
|
-//// DynamicDataSourceContextHolder.poll();
|
|
|
-//// }
|
|
|
-////
|
|
|
-//// if (ObjectUtil.isNotEmpty(fundAccount.getUpdateUser())){
|
|
|
-//// DynamicDataSourceContextHolder.push(SourceConstant.BASE);
|
|
|
-//// SysUser sysUser = sysUserService.getOne(Wrappers.<SysUser>lambdaQuery().eq(SysUser::getYfUserId, fundAccount.getUpdateUser()));
|
|
|
-//// accountManagement.setCreateUser(sysUser.getUserId());
|
|
|
-//// DynamicDataSourceContextHolder.poll();
|
|
|
-//// }
|
|
|
-//// accountManagement.setCreateTime(fundAccount.getCreateTime());
|
|
|
-//// accountManagement.setUpdateTime(fundAccount.getUpdateTime());
|
|
|
-//// baseMapper.insert(accountManagement);
|
|
|
-////
|
|
|
-//// //添加资金账户余额表的信息
|
|
|
-//// AccountRemainder accountRemainder = new AccountRemainder();
|
|
|
-//// accountRemainder.setTenantId(fundAccount.getTenantId());
|
|
|
-//// accountRemainder.setAccountManagementId(accountManagement.getId());
|
|
|
-//// //查询用户
|
|
|
-//// if (ObjectUtil.isNotEmpty(fundAccount.getCreateUser())){
|
|
|
-//// DynamicDataSourceContextHolder.push(SourceConstant.BASE);
|
|
|
-//// SysUser sysUser = sysUserService.getOne(Wrappers.<SysUser>lambdaQuery().eq(SysUser::getYfUserId, fundAccount.getCreateUser()));
|
|
|
-//// accountRemainder.setCreateUser(sysUser.getUserId());
|
|
|
-//// DynamicDataSourceContextHolder.poll();
|
|
|
-//// }
|
|
|
-////
|
|
|
-//// if (ObjectUtil.isNotEmpty(fundAccount.getUpdateUser())){
|
|
|
-////
|
|
|
-//// DynamicDataSourceContextHolder.push(SourceConstant.BASE);
|
|
|
-//// SysUser sysUser = sysUserService.getOne(Wrappers.<SysUser>lambdaQuery().eq(SysUser::getYfUserId, fundAccount.getUpdateUser()));
|
|
|
-//// accountRemainder.setCreateUser(sysUser.getUserId());
|
|
|
-//// DynamicDataSourceContextHolder.poll();
|
|
|
-//// }
|
|
|
-//// if (ObjectUtil.isNotEmpty(fundAccount.getRmbAmount())){
|
|
|
-//// accountRemainder.setId(IdWorker.getId());
|
|
|
-//// accountRemainder.setRemainder(fundAccount.getRmbAmount());
|
|
|
-//// accountRemainder.setCurrency("RMB");
|
|
|
-//// accountRemainderService.save(accountRemainder);
|
|
|
-//// }
|
|
|
-//// if (ObjectUtil.isNotEmpty(fundAccount.getDollarAmount())){
|
|
|
-//// accountRemainder.setId(IdWorker.getId());
|
|
|
-//// accountRemainder.setRemainder(fundAccount.getDollarAmount());
|
|
|
-//// accountRemainder.setCurrency("USD");
|
|
|
-//// accountRemainderService.save(accountRemainder);
|
|
|
-//// }
|
|
|
-//// if (ObjectUtil.isNotEmpty(fundAccount.getEuroAmount())){
|
|
|
-//// accountRemainder.setId(IdWorker.getId());
|
|
|
-//// accountRemainder.setRemainder(fundAccount.getEuroAmount());
|
|
|
-//// accountRemainder.setCurrency("EUR");
|
|
|
-//// accountRemainderService.save(accountRemainder);
|
|
|
-//// }
|
|
|
-////
|
|
|
-//// if (ObjectUtil.isNotEmpty(fundAccount.getSterlingAmount())){
|
|
|
-//// accountRemainder.setId(IdWorker.getId());
|
|
|
-//// accountRemainder.setRemainder(fundAccount.getSterlingAmount());
|
|
|
-//// accountRemainder.setCurrency("GBP");
|
|
|
-//// accountRemainderService.save(accountRemainder);
|
|
|
-//// }
|
|
|
-//// }
|
|
|
-//
|
|
|
-// }
|
|
|
-
|
|
|
-
|
|
|
/**
|
|
|
* 添加账户-余额表的信息
|
|
|
*/
|
|
|
private void saveAccountRemainder(AccountManagementDto accountManagementDto) {
|
|
|
List<AccountRemainder> accountRemainderList = accountManagementDto.getAccountRemainderList();
|
|
|
accountRemainderList.forEach(accountRemainder -> {
|
|
|
+ Assert.notEmpty(accountRemainder.getCurrency(), "币种不能为空!");
|
|
|
accountRemainder.setAccountManagementId(accountManagementDto.getId());
|
|
|
accountRemainderService.add(accountRemainder);
|
|
|
});
|