|
@@ -1,11 +1,19 @@
|
|
|
package com.fjhx.account.service.account.impl;
|
|
|
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
+import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.fjhx.account.entity.account.po.AccountDeptRunningWater;
|
|
|
+import com.fjhx.account.entity.account.vo.AccountRequestFundsVo;
|
|
|
+import com.fjhx.account.entity.account.vo.AccountRunningWaterVo;
|
|
|
import com.fjhx.account.mapper.account.AccountDeptRunningWaterMapper;
|
|
|
import com.fjhx.account.service.account.AccountDeptRunningWaterService;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.fjhx.common.constant.SourceConstant;
|
|
|
+import com.ruoyi.common.core.domain.entity.SysDept;
|
|
|
+import com.ruoyi.system.service.ISysDeptService;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.fjhx.account.entity.account.vo.AccountDeptRunningWaterVo;
|
|
@@ -14,6 +22,10 @@ import com.ruoyi.common.utils.wrapper.IWrapper;
|
|
|
import com.fjhx.account.entity.account.dto.AccountDeptRunningWaterDto;
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
@@ -26,11 +38,26 @@ import cn.hutool.core.bean.BeanUtil;
|
|
|
@Service
|
|
|
public class AccountDeptRunningWaterServiceImpl extends ServiceImpl<AccountDeptRunningWaterMapper, AccountDeptRunningWater> implements AccountDeptRunningWaterService {
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ISysDeptService sysDeptService;
|
|
|
+
|
|
|
@Override
|
|
|
- public Page<AccountDeptRunningWaterVo> getPage(AccountDeptRunningWaterSelectDto dto) {
|
|
|
+ public Page<AccountRunningWaterVo> getPage(AccountDeptRunningWaterSelectDto dto) {
|
|
|
QueryWrapper<Object> wrapper = Wrappers.query();
|
|
|
- Page<AccountDeptRunningWaterVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
|
|
|
+ Page<AccountRunningWaterVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
|
|
|
+ //切换数据源
|
|
|
+ DynamicDataSourceContextHolder.push(SourceConstant.BASE);
|
|
|
+ //查询部门信息
|
|
|
+ List<SysDept> sysDeptList = sysDeptService.list();
|
|
|
+ Map<Long, List<SysDept>> sysDeptMap = sysDeptList.stream().collect(Collectors.groupingBy(SysDept::getDeptId));
|
|
|
|
|
|
+ List<AccountRunningWaterVo> records = page.getRecords();
|
|
|
+ for (AccountRunningWaterVo record : records) {
|
|
|
+ List<SysDept> sysDepts = sysDeptMap.get(record.getDeptId());
|
|
|
+ if (ObjectUtil.isNotEmpty(sysDepts)) {
|
|
|
+ record.setDeptName(sysDepts.get(0).getDeptName());
|
|
|
+ }
|
|
|
+ }
|
|
|
return page;
|
|
|
}
|
|
|
|
|
@@ -41,9 +68,17 @@ public class AccountDeptRunningWaterServiceImpl extends ServiceImpl<AccountDeptR
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 部门-资金流水关联表新增
|
|
|
+ */
|
|
|
@Override
|
|
|
public void add(AccountDeptRunningWaterDto accountDeptRunningWaterDto) {
|
|
|
- this.save(accountDeptRunningWaterDto);
|
|
|
+ if (ObjectUtil.isNotEmpty(accountDeptRunningWaterDto.getId())){
|
|
|
+ this.updateById(accountDeptRunningWaterDto);
|
|
|
+ }else {
|
|
|
+ this.save(accountDeptRunningWaterDto);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
@Override
|