|
|
@@ -1,240 +1,264 @@
|
|
|
-package org.jeecg.modules.hlgcpmanager.service.impl;
|
|
|
-
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
-import org.jeecg.common.util.businessAccountUtils;
|
|
|
-import org.jeecg.modules.hlgcpmanager.entity.HlgCpAccount;
|
|
|
-import org.jeecg.modules.hlgcpmanager.entity.HlgCpAccountDetail;
|
|
|
-import org.jeecg.modules.hlgcpmanager.entity.HlgCpAccountDetailExport;
|
|
|
-import org.jeecg.modules.hlgcpmanager.entity.HlgCpSetting;
|
|
|
-import org.jeecg.modules.hlgcpmanager.mapper.HlgCpAccountDetailMapper;
|
|
|
-import org.jeecg.modules.hlgcpmanager.service.IHlgCpAccountDetailService;
|
|
|
-import org.jeecg.modules.hlgcpmanager.service.IHlgCpAccountService;
|
|
|
-import org.jeecg.modules.hlgcpmanager.service.IHlgCpSettingService;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.stereotype.Service;
|
|
|
-
|
|
|
-import java.util.List;
|
|
|
-
|
|
|
-/**
|
|
|
- * @Description: hlg_cp_account_detail
|
|
|
- * @Author: jeecg-boot
|
|
|
- * @Date: 2020-04-07
|
|
|
- * @Version: V1.0
|
|
|
- */
|
|
|
-@Service
|
|
|
-public class HlgCpAccountDetailServiceImpl extends ServiceImpl<HlgCpAccountDetailMapper, HlgCpAccountDetail> implements IHlgCpAccountDetailService {
|
|
|
- @Autowired
|
|
|
- private IHlgCpAccountService hlgCpAccountService;
|
|
|
- @Autowired
|
|
|
- private IHlgCpSettingService hlgCpSettingService;
|
|
|
-
|
|
|
- @Override
|
|
|
- public HlgCpAccountDetail getByAccountDetailId(Integer id) {
|
|
|
- return baseMapper.getByAccountDetailId(id);
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public Page<HlgCpAccountDetail> pageList(Page<HlgCpAccountDetail> pageList, HlgCpAccountDetail hlgCpAccountDetail, QueryWrapper<HlgCpAccountDetail> queryWrapper) {
|
|
|
- List<HlgCpAccountDetail> list = baseMapper.findList(pageList, hlgCpAccountDetail, queryWrapper);
|
|
|
- for (HlgCpAccountDetail hlgCpAccountDetail1 : list) {
|
|
|
- //备注
|
|
|
- String remark = switchRemark(hlgCpAccountDetail1);
|
|
|
- hlgCpAccountDetail1.setRemark(remark);
|
|
|
- }
|
|
|
- return pageList.setRecords(list);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 充值退款列表
|
|
|
- *
|
|
|
- * @param pageList
|
|
|
- * @param hlgCpAccountDetail
|
|
|
- * @param queryWrapper
|
|
|
- * @return
|
|
|
- */
|
|
|
- @Override
|
|
|
- public Page<HlgCpAccountDetail> pageRefundList(Page<HlgCpAccountDetail> pageList, HlgCpAccountDetail hlgCpAccountDetail, QueryWrapper<HlgCpAccountDetail> queryWrapper) {
|
|
|
- return pageList.setRecords(baseMapper.findRefundList(pageList, hlgCpAccountDetail, queryWrapper));
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 平台账目统计
|
|
|
- *
|
|
|
- * @param pageList
|
|
|
- * @param hlgCpAccountDetail
|
|
|
- * @param queryWrapper
|
|
|
- * @return
|
|
|
- */
|
|
|
- @Override
|
|
|
- public Page<HlgCpAccountDetail> pageAllList(Page<HlgCpAccountDetail> pageList, HlgCpAccountDetail hlgCpAccountDetail, QueryWrapper<HlgCpAccountDetail> queryWrapper) {
|
|
|
- /**
|
|
|
- * 合计1、收入合计,服务费收入合计,服务费支出合计
|
|
|
- */
|
|
|
- List<HlgCpAccountDetail> allList1 = baseMapper.findRechargeList(hlgCpAccountDetail, queryWrapper);
|
|
|
- Double rechargeMoney = 0.00;
|
|
|
- Double serviceMoney = 0.00;
|
|
|
- Double paymentServiceMoney = 0.00;
|
|
|
- for (HlgCpAccountDetail hlgCpAccountDetail1 : allList1) {
|
|
|
- rechargeMoney = businessAccountUtils.add(rechargeMoney, hlgCpAccountDetail1.getAmount());
|
|
|
- serviceMoney = businessAccountUtils.add(serviceMoney, hlgCpAccountDetail1.getServiceFee());
|
|
|
- paymentServiceMoney = businessAccountUtils.add(paymentServiceMoney, hlgCpAccountDetail1.getPaymentServiceFee());
|
|
|
- }
|
|
|
- /**
|
|
|
- * 合计2、支出合计
|
|
|
- */
|
|
|
- List<HlgCpAccountDetail> allList2 = baseMapper.findPaymentList(hlgCpAccountDetail, queryWrapper);
|
|
|
- Double paymentMoney = 0.00;
|
|
|
- for (HlgCpAccountDetail hlgCpAccountDetail2 : allList2) {
|
|
|
- //打回的付款单做减法处理
|
|
|
- if (hlgCpAccountDetail2.getType() == 2) {
|
|
|
- paymentMoney = businessAccountUtils.sub(paymentMoney, hlgCpAccountDetail2.getAmount());
|
|
|
- } else {
|
|
|
- paymentMoney = businessAccountUtils.add(paymentMoney, hlgCpAccountDetail2.getAmount());
|
|
|
- }
|
|
|
- }
|
|
|
- List<HlgCpAccountDetail> list = baseMapper.findAllList(pageList, hlgCpAccountDetail, queryWrapper);
|
|
|
- for (HlgCpAccountDetail hlgCpAccountDetail3 : list) {
|
|
|
- //备注
|
|
|
- String remark = switchRemark(hlgCpAccountDetail3);
|
|
|
- hlgCpAccountDetail3.setRemark(remark);
|
|
|
- hlgCpAccountDetail3.setRechargeMoney(rechargeMoney);
|
|
|
- hlgCpAccountDetail3.setServiceMoney(serviceMoney);
|
|
|
- hlgCpAccountDetail3.setPaymentMoney(paymentMoney);
|
|
|
- hlgCpAccountDetail3.setPaymentServiceMoney(paymentServiceMoney);
|
|
|
- }
|
|
|
-
|
|
|
- return pageList.setRecords(list);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 平台账目统计-平台信息
|
|
|
- *
|
|
|
- * @return
|
|
|
- */
|
|
|
- @Override
|
|
|
- public HlgCpAccount getCpAccount() {
|
|
|
- HlgCpAccount hlgCpAccount = new HlgCpAccount();
|
|
|
- List<HlgCpAccount> hlgCpAccountList = hlgCpAccountService.findAllList();
|
|
|
- //账目余额
|
|
|
- Double balanceMoney = 0.00;
|
|
|
- //服务费余额
|
|
|
- Double serviceFeeBalanceMoney = 0.00;
|
|
|
- for (HlgCpAccount hlgCpAccount1 : hlgCpAccountList) {
|
|
|
- balanceMoney = businessAccountUtils.add(balanceMoney, hlgCpAccount1.getBalance());
|
|
|
- serviceFeeBalanceMoney = businessAccountUtils.add(serviceFeeBalanceMoney, hlgCpAccount1.getServiceFeeBalance());
|
|
|
- }
|
|
|
- hlgCpAccount.setBalanceMoney(balanceMoney);
|
|
|
- hlgCpAccount.setServiceFeeBalanceMoney(serviceFeeBalanceMoney);
|
|
|
- //中间服务商
|
|
|
- HlgCpSetting hlgCpSetting = hlgCpSettingService.findHlgCpSetting();
|
|
|
- hlgCpAccount.setCpCompanyName(hlgCpSetting.getCompanyName());
|
|
|
- return hlgCpAccount;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 导出平台账目统计
|
|
|
- *
|
|
|
- * @param hlgCpAccountDetailExport
|
|
|
- * @param queryWrapper
|
|
|
- * @return
|
|
|
- */
|
|
|
- @Override
|
|
|
- public List<HlgCpAccountDetailExport> findExportList(HlgCpAccountDetailExport hlgCpAccountDetailExport, QueryWrapper<HlgCpAccountDetailExport> queryWrapper) {
|
|
|
- /**
|
|
|
- * 合计1、收入合计,服务费收入合计,服务费支出合计
|
|
|
- */
|
|
|
- List<HlgCpAccountDetail> allList1 = baseMapper.findRechargeExportList(hlgCpAccountDetailExport, queryWrapper);
|
|
|
- Double rechargeMoney = 0.00;
|
|
|
- Double serviceMoney = 0.00;
|
|
|
- Double paymentServiceMoney = 0.00;
|
|
|
- for (HlgCpAccountDetail hlgCpAccountDetail1 : allList1) {
|
|
|
- rechargeMoney = businessAccountUtils.add(rechargeMoney, hlgCpAccountDetail1.getAmount());
|
|
|
- serviceMoney = businessAccountUtils.add(serviceMoney, hlgCpAccountDetail1.getServiceFee());
|
|
|
- paymentServiceMoney = businessAccountUtils.add(paymentServiceMoney, hlgCpAccountDetail1.getPaymentServiceFee());
|
|
|
- }
|
|
|
- /**
|
|
|
- * 合计2、支出合计
|
|
|
- */
|
|
|
- List<HlgCpAccountDetail> allList2 = baseMapper.findPaymentExportList(hlgCpAccountDetailExport, queryWrapper);
|
|
|
- Double paymentMoney = 0.00;
|
|
|
- for (HlgCpAccountDetail hlgCpAccountDetail2 : allList2) {
|
|
|
- //打回的付款单做减法处理
|
|
|
- if (hlgCpAccountDetail2.getType() == 2) {
|
|
|
- paymentMoney = businessAccountUtils.sub(paymentMoney, hlgCpAccountDetail2.getAmount());
|
|
|
- } else {
|
|
|
- paymentMoney = businessAccountUtils.add(paymentMoney, hlgCpAccountDetail2.getAmount());
|
|
|
- }
|
|
|
- }
|
|
|
- List<HlgCpAccountDetailExport> list = baseMapper.findExportList(hlgCpAccountDetailExport, queryWrapper);
|
|
|
- for (int i = 0; i < list.size(); i++) {
|
|
|
- HlgCpAccountDetailExport hlgCpAccountDetail3 = list.get(i);
|
|
|
- //备注
|
|
|
- String remark = "";
|
|
|
- switch (hlgCpAccountDetail3.getType()) {
|
|
|
- case 0:
|
|
|
- remark = "充值" + hlgCpAccountDetail3.getTotalAmount() + "元,扣除服务费" +
|
|
|
- hlgCpAccountDetail3.getServiceFee() + "元,实际到账" + hlgCpAccountDetail3.getAmount() + "元";
|
|
|
- break;
|
|
|
- case 1:
|
|
|
- if (hlgCpAccountDetail3.getPaymentId() != null) {
|
|
|
- remark = "付款:" + hlgCpAccountDetail3.getPaymentCode();
|
|
|
- }
|
|
|
- break;
|
|
|
- case 2:
|
|
|
- remark = "付款失败:" + hlgCpAccountDetail3.getPaymentCode();
|
|
|
- break;
|
|
|
- default:
|
|
|
- remark = "";
|
|
|
- break;
|
|
|
- }
|
|
|
- hlgCpAccountDetail3.setRemark(remark);
|
|
|
- if (hlgCpAccountDetail3.getIsDrawback() == 1) {
|
|
|
- hlgCpAccountDetail3.setAmount(hlgCpAccountDetail3.getAmount() + "(已退款)");
|
|
|
- }
|
|
|
- if (hlgCpAccountDetail3.getIsDrawback() == 1) {
|
|
|
- hlgCpAccountDetail3.setServiceFee(hlgCpAccountDetail3.getServiceFee() + "(已退款)");
|
|
|
- }
|
|
|
- if (hlgCpAccountDetail3.getIsDrawback() == 1) {
|
|
|
- hlgCpAccountDetail3.setPaymentServiceFee(hlgCpAccountDetail3.getPaymentServiceFee() + "(已退款)");
|
|
|
- }
|
|
|
- if (i == 0) {
|
|
|
- hlgCpAccountDetail3.setRechargeMoney(rechargeMoney);
|
|
|
- hlgCpAccountDetail3.setServiceMoney(serviceMoney);
|
|
|
- hlgCpAccountDetail3.setPaymentMoney(paymentMoney);
|
|
|
- hlgCpAccountDetail3.setPaymentServiceMoney(paymentServiceMoney);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- return list;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 收支备注统一处理
|
|
|
- *
|
|
|
- * @param hlgCpAccountDetail
|
|
|
- * @return
|
|
|
- */
|
|
|
- private String switchRemark(HlgCpAccountDetail hlgCpAccountDetail) {
|
|
|
- String remark = "";
|
|
|
- switch (hlgCpAccountDetail.getType()) {
|
|
|
- case 0:
|
|
|
- remark = "充值" + hlgCpAccountDetail.getTotalAmount() + "元,扣除服务费" +
|
|
|
- hlgCpAccountDetail.getServiceFee() + "元,实际到账" + hlgCpAccountDetail.getAmount() + "元";
|
|
|
- break;
|
|
|
- case 1:
|
|
|
- if (hlgCpAccountDetail.getPaymentId() != null) {
|
|
|
- remark = "付款:" + hlgCpAccountDetail.getPaymentCode();
|
|
|
- }
|
|
|
- break;
|
|
|
- case 2:
|
|
|
- remark = "付款失败:" + hlgCpAccountDetail.getPaymentCode();
|
|
|
- break;
|
|
|
- default:
|
|
|
- remark = "";
|
|
|
- break;
|
|
|
- }
|
|
|
- return remark;
|
|
|
- }
|
|
|
-}
|
|
|
+package org.jeecg.modules.hlgcpmanager.service.impl;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import org.jeecg.common.util.businessAccountUtils;
|
|
|
+import org.jeecg.modules.hlgaccount.entity.HlgAccountDetail;
|
|
|
+import org.jeecg.modules.hlgaccount.mapper.HlgAccountDetailMapper;
|
|
|
+import org.jeecg.modules.hlgcpmanager.entity.HlgCpAccount;
|
|
|
+import org.jeecg.modules.hlgcpmanager.entity.HlgCpAccountDetail;
|
|
|
+import org.jeecg.modules.hlgcpmanager.entity.HlgCpAccountDetailExport;
|
|
|
+import org.jeecg.modules.hlgcpmanager.entity.HlgCpSetting;
|
|
|
+import org.jeecg.modules.hlgcpmanager.mapper.HlgCpAccountDetailMapper;
|
|
|
+import org.jeecg.modules.hlgcpmanager.service.IHlgCpAccountDetailService;
|
|
|
+import org.jeecg.modules.hlgcpmanager.service.IHlgCpAccountService;
|
|
|
+import org.jeecg.modules.hlgcpmanager.service.IHlgCpSettingService;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @Description: hlg_cp_account_detail
|
|
|
+ * @Author: jeecg-boot
|
|
|
+ * @Date: 2020-04-07
|
|
|
+ * @Version: V1.0
|
|
|
+ */
|
|
|
+@Service
|
|
|
+public class HlgCpAccountDetailServiceImpl extends ServiceImpl<HlgCpAccountDetailMapper, HlgCpAccountDetail> implements IHlgCpAccountDetailService {
|
|
|
+ @Autowired
|
|
|
+ private IHlgCpAccountService hlgCpAccountService;
|
|
|
+ @Autowired
|
|
|
+ private IHlgCpSettingService hlgCpSettingService;
|
|
|
+ @Resource
|
|
|
+ private HlgAccountDetailMapper hlgAccountDetailMapper;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public HlgCpAccountDetail getByAccountDetailId(Integer id) {
|
|
|
+ return baseMapper.getByAccountDetailId(id);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Page<HlgCpAccountDetail> pageList(Page<HlgCpAccountDetail> pageList, HlgCpAccountDetail hlgCpAccountDetail, QueryWrapper<HlgCpAccountDetail> queryWrapper) {
|
|
|
+ List<HlgCpAccountDetail> list = baseMapper.findList(pageList, hlgCpAccountDetail, queryWrapper);
|
|
|
+ for (HlgCpAccountDetail hlgCpAccountDetail1 : list) {
|
|
|
+ //备注
|
|
|
+ String remark = switchRemark(hlgCpAccountDetail1);
|
|
|
+ hlgCpAccountDetail1.setRemark(remark);
|
|
|
+ }
|
|
|
+ return pageList.setRecords(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 充值退款列表
|
|
|
+ *
|
|
|
+ * @param pageList
|
|
|
+ * @param hlgCpAccountDetail
|
|
|
+ * @param queryWrapper
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Page<HlgCpAccountDetail> pageRefundList(Page<HlgCpAccountDetail> pageList, HlgCpAccountDetail hlgCpAccountDetail, QueryWrapper<HlgCpAccountDetail> queryWrapper) {
|
|
|
+ return pageList.setRecords(baseMapper.findRefundList(pageList, hlgCpAccountDetail, queryWrapper));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 平台账目统计
|
|
|
+ *
|
|
|
+ * @param pageList
|
|
|
+ * @param hlgCpAccountDetail
|
|
|
+ * @param queryWrapper
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Page<HlgCpAccountDetail> pageAllList(Page<HlgCpAccountDetail> pageList, HlgCpAccountDetail hlgCpAccountDetail, QueryWrapper<HlgCpAccountDetail> queryWrapper) {
|
|
|
+ /**
|
|
|
+ * 合计1、收入合计,服务费收入合计,服务费支出合计
|
|
|
+ */
|
|
|
+ List<HlgCpAccountDetail> allList1 = baseMapper.findRechargeList(hlgCpAccountDetail, queryWrapper);
|
|
|
+ Double rechargeMoney = 0.00;
|
|
|
+ Double serviceMoney = 0.00;
|
|
|
+ Double paymentServiceMoney = 0.00;
|
|
|
+ for (HlgCpAccountDetail hlgCpAccountDetail1 : allList1) {
|
|
|
+ rechargeMoney = businessAccountUtils.add(rechargeMoney, hlgCpAccountDetail1.getAmount());
|
|
|
+ serviceMoney = businessAccountUtils.add(serviceMoney, hlgCpAccountDetail1.getServiceFee());
|
|
|
+ paymentServiceMoney = businessAccountUtils.add(paymentServiceMoney, hlgCpAccountDetail1.getPaymentServiceFee());
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 合计2、支出合计
|
|
|
+ */
|
|
|
+ List<HlgCpAccountDetail> allList2 = baseMapper.findPaymentList(hlgCpAccountDetail, queryWrapper);
|
|
|
+ Double paymentMoney = 0.00;
|
|
|
+ for (HlgCpAccountDetail hlgCpAccountDetail2 : allList2) {
|
|
|
+ //打回的付款单做减法处理
|
|
|
+ if (hlgCpAccountDetail2.getType() == 2) {
|
|
|
+ paymentMoney = businessAccountUtils.sub(paymentMoney, hlgCpAccountDetail2.getAmount());
|
|
|
+ } else {
|
|
|
+ paymentMoney = businessAccountUtils.add(paymentMoney, hlgCpAccountDetail2.getAmount());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<HlgCpAccountDetail> list = baseMapper.findAllList(pageList, hlgCpAccountDetail, queryWrapper);
|
|
|
+ for (HlgCpAccountDetail hlgCpAccountDetail3 : list) {
|
|
|
+ //备注
|
|
|
+ String remark = switchRemark(hlgCpAccountDetail3);
|
|
|
+ hlgCpAccountDetail3.setRemark(remark);
|
|
|
+ hlgCpAccountDetail3.setRechargeMoney(rechargeMoney);
|
|
|
+ hlgCpAccountDetail3.setServiceMoney(serviceMoney);
|
|
|
+ hlgCpAccountDetail3.setPaymentMoney(paymentMoney);
|
|
|
+ hlgCpAccountDetail3.setPaymentServiceMoney(paymentServiceMoney);
|
|
|
+ }
|
|
|
+
|
|
|
+ return pageList.setRecords(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 平台账目统计-平台信息
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public HlgCpAccount getCpAccount() {
|
|
|
+ HlgCpAccount hlgCpAccount = new HlgCpAccount();
|
|
|
+ List<HlgCpAccount> hlgCpAccountList = hlgCpAccountService.findAllList();
|
|
|
+ //账目余额
|
|
|
+ Double balanceMoney = 0.00;
|
|
|
+ //服务费余额
|
|
|
+ Double serviceFeeBalanceMoney = 0.00;
|
|
|
+ for (HlgCpAccount hlgCpAccount1 : hlgCpAccountList) {
|
|
|
+ balanceMoney = businessAccountUtils.add(balanceMoney, hlgCpAccount1.getBalance());
|
|
|
+ serviceFeeBalanceMoney = businessAccountUtils.add(serviceFeeBalanceMoney, hlgCpAccount1.getServiceFeeBalance());
|
|
|
+ }
|
|
|
+ hlgCpAccount.setBalanceMoney(balanceMoney);
|
|
|
+ hlgCpAccount.setServiceFeeBalanceMoney(serviceFeeBalanceMoney);
|
|
|
+ //中间服务商
|
|
|
+ HlgCpSetting hlgCpSetting = hlgCpSettingService.findHlgCpSetting();
|
|
|
+ hlgCpAccount.setCpCompanyName(hlgCpSetting.getCompanyName());
|
|
|
+ return hlgCpAccount;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 导出平台账目统计
|
|
|
+ *
|
|
|
+ * @param hlgCpAccountDetailExport
|
|
|
+ * @param queryWrapper
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public List<HlgCpAccountDetailExport> findExportList(HlgCpAccountDetailExport hlgCpAccountDetailExport, QueryWrapper<HlgCpAccountDetailExport> queryWrapper) {
|
|
|
+ /**
|
|
|
+ * 合计1、收入合计,服务费收入合计,服务费支出合计
|
|
|
+ */
|
|
|
+ List<HlgCpAccountDetail> allList1 = baseMapper.findRechargeExportList(hlgCpAccountDetailExport, queryWrapper);
|
|
|
+ Double rechargeMoney = 0.00;
|
|
|
+ Double serviceMoney = 0.00;
|
|
|
+ Double paymentServiceMoney = 0.00;
|
|
|
+ for (HlgCpAccountDetail hlgCpAccountDetail1 : allList1) {
|
|
|
+ rechargeMoney = businessAccountUtils.add(rechargeMoney, hlgCpAccountDetail1.getAmount());
|
|
|
+ serviceMoney = businessAccountUtils.add(serviceMoney, hlgCpAccountDetail1.getServiceFee());
|
|
|
+ paymentServiceMoney = businessAccountUtils.add(paymentServiceMoney, hlgCpAccountDetail1.getPaymentServiceFee());
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 合计2、支出合计
|
|
|
+ */
|
|
|
+ List<HlgCpAccountDetail> allList2 = baseMapper.findPaymentExportList(hlgCpAccountDetailExport, queryWrapper);
|
|
|
+ Double paymentMoney = 0.00;
|
|
|
+ for (HlgCpAccountDetail hlgCpAccountDetail2 : allList2) {
|
|
|
+ //打回的付款单做减法处理
|
|
|
+ if (hlgCpAccountDetail2.getType() == 2) {
|
|
|
+ paymentMoney = businessAccountUtils.sub(paymentMoney, hlgCpAccountDetail2.getAmount());
|
|
|
+ } else {
|
|
|
+ paymentMoney = businessAccountUtils.add(paymentMoney, hlgCpAccountDetail2.getAmount());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<HlgCpAccountDetailExport> list = baseMapper.findExportList(hlgCpAccountDetailExport, queryWrapper);
|
|
|
+ for (int i = 0; i < list.size(); i++) {
|
|
|
+ HlgCpAccountDetailExport hlgCpAccountDetail3 = list.get(i);
|
|
|
+ //备注
|
|
|
+ String remark = "";
|
|
|
+ switch (hlgCpAccountDetail3.getType()) {
|
|
|
+ case 0:
|
|
|
+ remark = "充值" + hlgCpAccountDetail3.getTotalAmount() + "元,扣除服务费" +
|
|
|
+ hlgCpAccountDetail3.getServiceFee() + "元,实际到账" + hlgCpAccountDetail3.getAmount() + "元";
|
|
|
+ break;
|
|
|
+ case 1:
|
|
|
+ if (hlgCpAccountDetail3.getPaymentId() != null) {
|
|
|
+ remark = "付款:" + hlgCpAccountDetail3.getPaymentCode();
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ remark = "付款失败:" + hlgCpAccountDetail3.getPaymentCode();
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ remark = "";
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ hlgCpAccountDetail3.setRemark(remark);
|
|
|
+ if (hlgCpAccountDetail3.getIsDrawback() == 1) {
|
|
|
+ hlgCpAccountDetail3.setAmount(hlgCpAccountDetail3.getAmount() + "(已退款)");
|
|
|
+ }
|
|
|
+ if (hlgCpAccountDetail3.getIsDrawback() == 1) {
|
|
|
+ hlgCpAccountDetail3.setServiceFee(hlgCpAccountDetail3.getServiceFee() + "(已退款)");
|
|
|
+ }
|
|
|
+ if (hlgCpAccountDetail3.getIsDrawback() == 1) {
|
|
|
+ hlgCpAccountDetail3.setPaymentServiceFee(hlgCpAccountDetail3.getPaymentServiceFee() + "(已退款)");
|
|
|
+ }
|
|
|
+ if (i == 0) {
|
|
|
+ hlgCpAccountDetail3.setRechargeMoney(rechargeMoney);
|
|
|
+ hlgCpAccountDetail3.setServiceMoney(serviceMoney);
|
|
|
+ hlgCpAccountDetail3.setPaymentMoney(paymentMoney);
|
|
|
+ hlgCpAccountDetail3.setPaymentServiceMoney(paymentServiceMoney);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return list;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 收支备注统一处理
|
|
|
+ *
|
|
|
+ * @param hlgCpAccountDetail
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private String switchRemark(HlgCpAccountDetail hlgCpAccountDetail) {
|
|
|
+ String remark = "";
|
|
|
+ switch (hlgCpAccountDetail.getType()) {
|
|
|
+ case 0:
|
|
|
+ remark = "充值" + hlgCpAccountDetail.getTotalAmount() + "元,扣除服务费" +
|
|
|
+ hlgCpAccountDetail.getServiceFee() + "元,实际到账" + hlgCpAccountDetail.getAmount() + "元";
|
|
|
+ break;
|
|
|
+ case 1:
|
|
|
+ if (hlgCpAccountDetail.getPaymentId() != null) {
|
|
|
+ remark = "付款:" + hlgCpAccountDetail.getPaymentCode();
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ remark = "付款失败:" + hlgCpAccountDetail.getPaymentCode();
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ remark = "";
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ return remark;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 关联付款
|
|
|
+ *
|
|
|
+ * @param hlgCpAccountDetail
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public boolean relatePayment(HlgCpAccountDetail hlgCpAccountDetail) {
|
|
|
+ boolean ok = updateById(hlgCpAccountDetail);
|
|
|
+ QueryWrapper<HlgAccountDetail> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.eq("id", hlgCpAccountDetail.getAccountDetailId());
|
|
|
+ HlgAccountDetail hlgAccountDetail = hlgAccountDetailMapper.selectOne(queryWrapper);
|
|
|
+ hlgAccountDetail.setPaymentId(hlgCpAccountDetail.getPaymentId());
|
|
|
+ int ok_account = hlgAccountDetailMapper.updateById(hlgAccountDetail);
|
|
|
+ return ok && (ok_account > 0);
|
|
|
+ }
|
|
|
+}
|