|
@@ -12,6 +12,7 @@ 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.enums.AccountRunningWaterEnum;
|
|
|
import com.fjhx.account.entity.account.po.AccountManagement;
|
|
|
import com.fjhx.account.entity.account.po.AccountRemainder;
|
|
|
import com.fjhx.account.entity.account.po.AccountRunningWater;
|
|
@@ -46,6 +47,7 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.stream.Collectors;
|
|
@@ -80,8 +82,11 @@ public class AccountRunningWaterServiceImpl extends ServiceImpl<AccountRunningWa
|
|
|
@Autowired
|
|
|
private TransactionDepartmentService transactionDepartmentService;
|
|
|
|
|
|
- @Override
|
|
|
- public Page<AccountRunningWaterVo> getPage(AccountRunningWaterSelectDto dto) {
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取分页搜索条件
|
|
|
+ */
|
|
|
+ QueryWrapper<Object> getPageWrapper(AccountRunningWaterSelectDto dto) {
|
|
|
QueryWrapper<Object> wrapper = Wrappers.query();
|
|
|
// 资金账户
|
|
|
wrapper.eq(ObjectUtil.isNotEmpty(dto.getAccountManagementId()), "arw.account_management_id", dto.getAccountManagementId());
|
|
@@ -119,6 +124,12 @@ public class AccountRunningWaterServiceImpl extends ServiceImpl<AccountRunningWa
|
|
|
else {
|
|
|
wrapper.orderByDesc("arw.transaction_time", "arw.id");
|
|
|
}
|
|
|
+ return wrapper;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Page<AccountRunningWaterVo> getPage(AccountRunningWaterSelectDto dto) {
|
|
|
+ QueryWrapper<Object> wrapper = getPageWrapper(dto);
|
|
|
|
|
|
Page<AccountRunningWaterVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
|
|
|
List<AccountRunningWaterVo> records = page.getRecords();
|
|
@@ -380,36 +391,8 @@ public class AccountRunningWaterServiceImpl extends ServiceImpl<AccountRunningWa
|
|
|
|
|
|
@Override
|
|
|
public void exportExcel(AccountRunningWaterSelectDto dto, HttpServletResponse httpServletResponse) {
|
|
|
- QueryWrapper<Object> wrapper = Wrappers.query();
|
|
|
- //资金账户
|
|
|
- wrapper.eq(ObjectUtil.isNotEmpty(dto.getAccountManagementId()), "arw.account_management_id", dto.getAccountManagementId());
|
|
|
- //交易类型
|
|
|
- wrapper.eq(ObjectUtil.isNotEmpty(dto.getStatus()), "arw.status", dto.getStatus());
|
|
|
- //是否合同到账
|
|
|
- wrapper.eq(ObjectUtil.isNotEmpty(dto.getReceived()), "arw.received", dto.getReceived());
|
|
|
- //币种
|
|
|
- wrapper.eq(ObjectUtil.isNotEmpty(dto.getCurrency()), "arw.currency", dto.getCurrency());
|
|
|
- //是否认领
|
|
|
- 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.getEndAmount()), "arw.amount", dto.getEndAmount());
|
|
|
- //交易开始时间
|
|
|
- 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.getName()), "arw.name", dto.getName());
|
|
|
- //摘要
|
|
|
- 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");
|
|
|
- }
|
|
|
+ QueryWrapper<Object> wrapper = getPageWrapper(dto);
|
|
|
+
|
|
|
List<AccountRunningWaterVo> records = this.baseMapper.getList(wrapper);
|
|
|
|
|
|
//赋值字典数据
|
|
@@ -608,4 +591,56 @@ public class AccountRunningWaterServiceImpl extends ServiceImpl<AccountRunningWa
|
|
|
Assert.eqTrue(update, "余额操作失败,请重试!!!");
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 结汇
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public void exchangeSettlement(AccountRunningWaterDto dto) {
|
|
|
+ dto.setTransactionTime(new Date());
|
|
|
+
|
|
|
+ //生成转出流水
|
|
|
+ dto.setStatus("20");//支出
|
|
|
+ dto.setType(AccountRunningWaterEnum.EXCHANGE_SETTLEMENT.getKey());
|
|
|
+ //操作余额
|
|
|
+ changeRemainder(dto);
|
|
|
+ this.save(dto);
|
|
|
+
|
|
|
+ //如果手续费不为0生成手续费
|
|
|
+ if (ObjectUtil.isNotEmpty(dto.getCommissionAmount()) && dto.getCommissionAmount().compareTo(BigDecimal.ZERO) != 0) {
|
|
|
+ AccountRunningWater commissionAccountRunningWater = new AccountRunningWater();
|
|
|
+ commissionAccountRunningWater.setStatus("20");
|
|
|
+ commissionAccountRunningWater.setType(AccountRunningWaterEnum.EXCHANGE_SETTLEMENT.getKey());
|
|
|
+ commissionAccountRunningWater.setRemarks(dto.getRemarks());
|
|
|
+ commissionAccountRunningWater.setTransactionTime(dto.getTransactionTime());
|
|
|
+ commissionAccountRunningWater.setAccountManagementId(dto.getAccountManagementId());
|
|
|
+ commissionAccountRunningWater.setAmount(dto.getCommissionAmount());
|
|
|
+ Assert.notEmpty(dto.getCommissionCurrency(), "手续费币种不能为空");
|
|
|
+ commissionAccountRunningWater.setCurrency(dto.getCommissionCurrency());
|
|
|
+ commissionAccountRunningWater.setRemarks("结汇手续费");
|
|
|
+ commissionAccountRunningWater.setBusinessId(dto.getBusinessId());
|
|
|
+ //操作余额
|
|
|
+ changeRemainder(commissionAccountRunningWater);
|
|
|
+ this.save(commissionAccountRunningWater);
|
|
|
+ }
|
|
|
+
|
|
|
+ //生成收入流水
|
|
|
+ AccountRunningWater inAccountRunningWater = new AccountRunningWater();
|
|
|
+ inAccountRunningWater.setStatus("10");
|
|
|
+ inAccountRunningWater.setType(AccountRunningWaterEnum.EXCHANGE_SETTLEMENT.getKey());
|
|
|
+ inAccountRunningWater.setRemarks(dto.getRemarks());
|
|
|
+ inAccountRunningWater.setTransactionTime(dto.getTransactionTime());
|
|
|
+ inAccountRunningWater.setAccountManagementId(dto.getInAccountManagementId());
|
|
|
+ inAccountRunningWater.setAmount(dto.getInAmount());
|
|
|
+ Assert.notEmpty(dto.getInCurrency(), "汇入入币种不能为空");
|
|
|
+ inAccountRunningWater.setCurrency(dto.getInCurrency());
|
|
|
+ inAccountRunningWater.setBusinessId(dto.getBusinessId());
|
|
|
+ //操作余额
|
|
|
+ changeRemainder(inAccountRunningWater);
|
|
|
+ this.save(inAccountRunningWater);
|
|
|
+ //修改合同为已结汇
|
|
|
+ DynamicDataSourceContextHolder.push(SourceConstant.SALE);
|
|
|
+ baseMapper.exchangeSettlementByContractId(dto.getBusinessId(), 1);
|
|
|
+ DynamicDataSourceContextHolder.poll();
|
|
|
+ }
|
|
|
+
|
|
|
}
|