|
@@ -1,35 +1,33 @@
|
|
|
package com.fjhx.account.service.account.impl;
|
|
|
|
|
|
+import cn.hutool.core.bean.BeanUtil;
|
|
|
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.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.fjhx.account.entity.account.bo.AccountRunningWaterBo;
|
|
|
+import com.fjhx.account.entity.account.dto.AccountRunningWaterDto;
|
|
|
+import com.fjhx.account.entity.account.dto.AccountRunningWaterSelectDto;
|
|
|
import com.fjhx.account.entity.account.po.AccountRemainder;
|
|
|
import com.fjhx.account.entity.account.po.AccountRunningWater;
|
|
|
+import com.fjhx.account.entity.account.vo.AccountRunningWaterVo;
|
|
|
import com.fjhx.account.mapper.account.AccountRunningWaterMapper;
|
|
|
import com.fjhx.account.service.account.AccountRemainderService;
|
|
|
import com.fjhx.account.service.account.AccountRunningWaterService;
|
|
|
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.fjhx.common.constant.SourceConstant;
|
|
|
import com.fjhx.item.util.excel.util.ExcelUtil;
|
|
|
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;
|
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
|
-import org.apache.commons.collections4.ListUtils;
|
|
|
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.AccountRunningWaterVo;
|
|
|
-import com.fjhx.account.entity.account.dto.AccountRunningWaterSelectDto;
|
|
|
-import com.ruoyi.common.utils.wrapper.IWrapper;
|
|
|
-import com.fjhx.account.entity.account.dto.AccountRunningWaterDto;
|
|
|
-import cn.hutool.core.bean.BeanUtil;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
+
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
@@ -53,7 +51,6 @@ public class AccountRunningWaterServiceImpl extends ServiceImpl<AccountRunningWa
|
|
|
private DictTenantDataService dictTenantDataService;
|
|
|
|
|
|
|
|
|
-
|
|
|
@Override
|
|
|
public Page<AccountRunningWaterVo> getPage(AccountRunningWaterSelectDto dto) {
|
|
|
QueryWrapper<Object> wrapper = Wrappers.query();
|
|
@@ -68,23 +65,23 @@ public class AccountRunningWaterServiceImpl extends ServiceImpl<AccountRunningWa
|
|
|
//是否认领
|
|
|
wrapper.eq(ObjectUtil.isNotEmpty(dto.getIsClaim()), "arw.is_claim", dto.getIsClaim());
|
|
|
//交易开始金额
|
|
|
- wrapper.ge(ObjectUtil.isNotEmpty(dto.getBeginAmount()),"arw.amount",dto.getBeginAmount());
|
|
|
+ wrapper.ge(ObjectUtil.isNotEmpty(dto.getBeginAmount()), "arw.amount", dto.getBeginAmount());
|
|
|
//交易结束金额
|
|
|
- wrapper.ge(ObjectUtil.isNotEmpty(dto.getEndAmount()),"arw.amount",dto.getEndAmount());
|
|
|
+ wrapper.ge(ObjectUtil.isNotEmpty(dto.getEndAmount()), "arw.amount", dto.getEndAmount());
|
|
|
//交易开始时间
|
|
|
- wrapper.ge(ObjectUtil.isNotEmpty(dto.getBeginTime()),"arw.create_time",dto.getBeginTime());
|
|
|
+ wrapper.ge(ObjectUtil.isNotEmpty(dto.getBeginTime()), "arw.create_time", dto.getBeginTime());
|
|
|
//交易结束金额
|
|
|
- wrapper.ge(ObjectUtil.isNotEmpty(dto.getEndTime()),"arw.create_time",dto.getEndTime());
|
|
|
+ wrapper.ge(ObjectUtil.isNotEmpty(dto.getEndTime()), "arw.create_time", dto.getEndTime());
|
|
|
//对方账户名称
|
|
|
- wrapper.ge(ObjectUtil.isNotEmpty(dto.getName()),"arw.name",dto.getName());
|
|
|
+ wrapper.ge(ObjectUtil.isNotEmpty(dto.getName()), "arw.name", dto.getName());
|
|
|
//摘要
|
|
|
- wrapper.ge(ObjectUtil.isNotEmpty(dto.getRemarks()),"arw.name",dto.getRemarks());
|
|
|
+ wrapper.ge(ObjectUtil.isNotEmpty(dto.getRemarks()), "arw.name", dto.getRemarks());
|
|
|
if (StringUtils.isNotEmpty(dto.getKeyword())) {
|
|
|
wrapper.and(wrapper1 -> wrapper1.like("arw.remarks", dto.getKeyword()).or().like("arw.name", dto.getKeyword()));
|
|
|
}
|
|
|
- if(ObjectUtil.isNotEmpty(dto.getDataType())&&dto.getDataType()==1){//到账认领数据
|
|
|
- wrapper.eq("arw.received",10);
|
|
|
- wrapper.orderByAsc("arw.is_claim","arw.create_time");
|
|
|
+ if (ObjectUtil.isNotEmpty(dto.getDataType()) && dto.getDataType() == 1) {//到账认领数据
|
|
|
+ wrapper.eq("arw.received", 10);
|
|
|
+ wrapper.orderByAsc("arw.is_claim", "arw.create_time");
|
|
|
}
|
|
|
Page<AccountRunningWaterVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
|
|
|
return page;
|
|
@@ -95,6 +92,7 @@ public class AccountRunningWaterServiceImpl extends ServiceImpl<AccountRunningWa
|
|
|
AccountRunningWaterVo result = baseMapper.getDetail(id);
|
|
|
return result;
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 账户资金流水表新增
|
|
|
*/
|
|
@@ -104,23 +102,23 @@ public class AccountRunningWaterServiceImpl extends ServiceImpl<AccountRunningWa
|
|
|
|
|
|
//修改账户余额表的余额
|
|
|
AccountRemainder accountRemainder = accountRemainderService.getOne(Wrappers.<AccountRemainder>lambdaQuery()
|
|
|
- .eq(AccountRemainder::getAccountManagementId,accountRunningWaterDto.getAccountManagementId())
|
|
|
- .eq(AccountRemainder::getCurrency,accountRunningWaterDto.getCurrency())
|
|
|
+ .eq(AccountRemainder::getAccountManagementId, accountRunningWaterDto.getAccountManagementId())
|
|
|
+ .eq(AccountRemainder::getCurrency, accountRunningWaterDto.getCurrency())
|
|
|
);
|
|
|
- if (ObjectUtil.isEmpty(accountRemainder)){
|
|
|
+ if (ObjectUtil.isEmpty(accountRemainder)) {
|
|
|
throw new ServiceException("账户余额不足");
|
|
|
}
|
|
|
accountRemainder.setStatus(accountRunningWaterDto.getStatus());
|
|
|
//修改变更余额
|
|
|
accountRemainder.setChangeRemainder(accountRunningWaterDto.getAmount());
|
|
|
- if (accountRunningWaterDto.getStatus().equals("10")){
|
|
|
+ if (accountRunningWaterDto.getStatus().equals("10")) {
|
|
|
accountRemainder.setRemainder(accountRemainder.getRemainder().add(accountRunningWaterDto.getAmount()));
|
|
|
- }else if (accountRunningWaterDto.getStatus().equals("20")){
|
|
|
- if (accountRemainder.getRemainder().compareTo(accountRunningWaterDto.getAmount()) ==-1){
|
|
|
- throw new ServiceException("账户余额不足");
|
|
|
- }else {
|
|
|
- accountRemainder.setRemainder(accountRemainder.getRemainder().subtract(accountRunningWaterDto.getAmount()));
|
|
|
- }
|
|
|
+ } else if (accountRunningWaterDto.getStatus().equals("20")) {
|
|
|
+ if (accountRemainder.getRemainder().compareTo(accountRunningWaterDto.getAmount()) == -1) {
|
|
|
+ throw new ServiceException("账户余额不足");
|
|
|
+ } else {
|
|
|
+ accountRemainder.setRemainder(accountRemainder.getRemainder().subtract(accountRunningWaterDto.getAmount()));
|
|
|
+ }
|
|
|
}
|
|
|
accountRemainderService.updateById(accountRemainder);
|
|
|
this.save(accountRunningWaterDto);
|
|
@@ -161,8 +159,8 @@ public class AccountRunningWaterServiceImpl extends ServiceImpl<AccountRunningWa
|
|
|
QueryWrapper<AccountRunningWater> query = Wrappers.query();
|
|
|
query.groupBy("is_claim");
|
|
|
query.select("is_claim,count(*) count");
|
|
|
- //到账认领统计
|
|
|
- return baseMapper.selectList(query);
|
|
|
+ //到账认领统计
|
|
|
+ return baseMapper.selectList(query);
|
|
|
|
|
|
}
|
|
|
|
|
@@ -180,30 +178,30 @@ public class AccountRunningWaterServiceImpl extends ServiceImpl<AccountRunningWa
|
|
|
//是否认领
|
|
|
wrapper.eq(ObjectUtil.isNotEmpty(dto.getIsClaim()), "arw.is_claim", dto.getIsClaim());
|
|
|
//交易开始金额
|
|
|
- wrapper.ge(ObjectUtil.isNotEmpty(dto.getBeginAmount()),"arw.amount",dto.getBeginAmount());
|
|
|
+ wrapper.ge(ObjectUtil.isNotEmpty(dto.getBeginAmount()), "arw.amount", dto.getBeginAmount());
|
|
|
//交易结束金额
|
|
|
- wrapper.ge(ObjectUtil.isNotEmpty(dto.getEndAmount()),"arw.amount",dto.getEndAmount());
|
|
|
+ wrapper.ge(ObjectUtil.isNotEmpty(dto.getEndAmount()), "arw.amount", dto.getEndAmount());
|
|
|
//交易开始时间
|
|
|
- wrapper.ge(ObjectUtil.isNotEmpty(dto.getBeginTime()),"arw.create_time",dto.getBeginTime());
|
|
|
+ wrapper.ge(ObjectUtil.isNotEmpty(dto.getBeginTime()), "arw.create_time", dto.getBeginTime());
|
|
|
//交易结束金额
|
|
|
- wrapper.ge(ObjectUtil.isNotEmpty(dto.getEndTime()),"arw.create_time",dto.getEndTime());
|
|
|
+ wrapper.ge(ObjectUtil.isNotEmpty(dto.getEndTime()), "arw.create_time", dto.getEndTime());
|
|
|
//对方账户名称
|
|
|
- wrapper.ge(ObjectUtil.isNotEmpty(dto.getName()),"arw.name",dto.getName());
|
|
|
+ wrapper.ge(ObjectUtil.isNotEmpty(dto.getName()), "arw.name", dto.getName());
|
|
|
//摘要
|
|
|
- wrapper.ge(ObjectUtil.isNotEmpty(dto.getRemarks()),"arw.name",dto.getRemarks());
|
|
|
+ wrapper.ge(ObjectUtil.isNotEmpty(dto.getRemarks()), "arw.name", dto.getRemarks());
|
|
|
if (StringUtils.isNotEmpty(dto.getKeyword())) {
|
|
|
wrapper.and(wrapper1 -> wrapper1.like("arw.remarks", dto.getKeyword()).or().like("arw.name", dto.getKeyword()));
|
|
|
}
|
|
|
- if(ObjectUtil.isNotEmpty(dto.getDataType())&&dto.getDataType()==1){//到账认领数据
|
|
|
- wrapper.eq("arw.received",10);
|
|
|
- wrapper.orderByAsc("arw.is_claim","arw.create_time");
|
|
|
+ if (ObjectUtil.isNotEmpty(dto.getDataType()) && dto.getDataType() == 1) {//到账认领数据
|
|
|
+ wrapper.eq("arw.received", 10);
|
|
|
+ wrapper.orderByAsc("arw.is_claim", "arw.create_time");
|
|
|
}
|
|
|
List<AccountRunningWaterVo> records = this.baseMapper.getList(wrapper);
|
|
|
|
|
|
//赋值字典数据
|
|
|
DynamicDataSourceContextHolder.push(SourceConstant.BASE);
|
|
|
List<DictTenantDataVo> dictTenantDataVos = getDict("account_currency");
|
|
|
- if (dictTenantDataVos.size() == 0){
|
|
|
+ if (dictTenantDataVos.size() == 0) {
|
|
|
throw new ServiceException("数据有误:没有配置币种字典,请先配置");
|
|
|
}
|
|
|
Map<String, List<DictTenantDataVo>> dictTenantDataVoMap = dictTenantDataVos.stream()
|
|
@@ -211,13 +209,19 @@ public class AccountRunningWaterServiceImpl extends ServiceImpl<AccountRunningWa
|
|
|
DynamicDataSourceContextHolder.poll();
|
|
|
for (AccountRunningWaterVo accountRunningWaterVo : records) {
|
|
|
List<DictTenantDataVo> dictTenantDataVoList = dictTenantDataVoMap.get(accountRunningWaterVo.getCurrency());
|
|
|
- if (ObjectUtil.isNotEmpty(dictTenantDataVoList)){
|
|
|
+ if (ObjectUtil.isNotEmpty(dictTenantDataVoList)) {
|
|
|
accountRunningWaterVo.setCurrency(dictTenantDataVoList.get(0).getDictValue());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//导出Excel
|
|
|
List<AccountRunningWaterBo> accountRunningWaterBos = BeanUtil.copyToList(records, AccountRunningWaterBo.class);
|
|
|
+ for (AccountRunningWaterBo accountRunningWaterBo : accountRunningWaterBos) {
|
|
|
+ //重新赋值收支类型
|
|
|
+ accountRunningWaterBo.setStatus("10".equals(accountRunningWaterBo.getStatus()) ? "收入" : "支出");
|
|
|
+ //重新赋值是否合同到账
|
|
|
+ accountRunningWaterBo.setReceived("10".equals(accountRunningWaterBo.getReceived()) ? "是" : "否");
|
|
|
+ }
|
|
|
ExcelUtil.export(httpServletResponse, accountRunningWaterBos, AccountRunningWaterBo.class);
|
|
|
}
|
|
|
|