Commit 146c3c91 authored by zhangfeng's avatar zhangfeng

feat(wealth): 银行收款明细审批

parent 5b5678a2
......@@ -3,7 +3,6 @@ package cn.iocoder.yudao.module.wealth.dal.mysql.receipt;
import cn.iocoder.yudao.framework.mybatis.core.mapper.AbstractMapper;
import cn.iocoder.yudao.module.wealth.dal.dataobject.receipt.ReceiptDO;
import cn.iocoder.yudao.module.wealth.vo.receipt.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultType;
......@@ -51,9 +50,9 @@ public interface ReceiptMapper extends AbstractMapper<ReceiptDO> {
* @param orderId 订单ID
* @return 得到自编号
*/
@ResultType(OrderVo.class)
@ResultType(OrderVO.class)
@Select({"select r.customer_id,r.container_number,w.guojia as country from ecw_order r LEFT JOIN ecw_warehouse_line l ON r.line_id = l.id left join ecw_warehouse w on l.dest_warehouse_id = w.id where r.deleted = 0 and r.order_id = #{orderId}"})
OrderVo getContainerNumberByOrderId(@Param("orderId") Long orderId);
OrderVO getContainerNumberByOrderId(@Param("orderId") Long orderId);
/**
......
......@@ -5,12 +5,15 @@ import cn.iocoder.yudao.framework.mybatis.core.mapper.AbstractMapper;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQuery;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.module.wealth.dal.dataobject.receiptItem.ReceiptItemDO;
import cn.iocoder.yudao.module.wealth.vo.receiptItem.ReceiptItemActualAmount;
import cn.iocoder.yudao.module.wealth.vo.receiptItem.ReceiptItemQueryVO;
import cn.iocoder.yudao.module.wealth.vo.receiptItem.ReceiptItemReviewPageReqVO;
import cn.iocoder.yudao.module.wealth.vo.receiptItem.ReceiptItemReviewPageVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultType;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.code.ORDER;
import java.math.BigDecimal;
import java.util.List;
......@@ -88,4 +91,12 @@ public interface ReceiptItemMapper extends AbstractMapper<ReceiptItemDO> {
@ResultType(String.class)
@Select({"select serial_number from ecw_receipt_item order by serial_number desc limit 1"})
String getCurrentMaxReceiptItemCode();
IPage<ReceiptItemReviewPageVO> getReceiptItemReviewPage(IPage<ReceiptItemReviewPageVO> mpPage, @Param("query") ReceiptItemReviewPageReqVO pageReqVO);
List<ReceiptItemActualAmount> getReceiptItemActualAmount(@Param("query") ReceiptItemReviewPageReqVO pageReqVO);
List<ReceiptItemActualAmount> countTotalActualAmount();
List<ReceiptItemActualAmount> countTotalWriteOffAmount();
}
......@@ -18,7 +18,6 @@ import cn.iocoder.yudao.module.bpm.enums.BpmProcessInstanceResultEnum;
import cn.iocoder.yudao.module.bpm.enums.WorkFlowEmus;
import cn.iocoder.yudao.module.ecw.api.currency.CurrencyApi;
import cn.iocoder.yudao.module.ecw.api.currency.dto.CurrencyRespDTO;
import cn.iocoder.yudao.module.ecw.api.currency.dto.ExchangeRateRespDTO;
import cn.iocoder.yudao.module.system.api.dict.DictDataApi;
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
import cn.iocoder.yudao.module.wealth.convert.receipt.ReceiptConvert;
......@@ -316,7 +315,7 @@ public class ReceiptServiceImpl extends AbstractService<ReceiptMapper, ReceiptDO
throw exception(RECEIVABLE_ORDER_EXITS_NOT);
}
OrderVo orderDo = receiptMapper.getContainerNumberByOrderId(receivableDO.getOrderId());
OrderVO orderDo = receiptMapper.getContainerNumberByOrderId(receivableDO.getOrderId());
if (null == orderDo) {
throw exception(RECEIVABLE_ORDER_EXITS_NOT);
}
......
package cn.iocoder.yudao.module.wealth.service.receiptItem;
import cn.iocoder.yudao.framework.mybatis.core.service.IService;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.module.wealth.dal.dataobject.receiptItem.ReceiptItemDO;
import cn.iocoder.yudao.module.wealth.vo.receipt.FinanceReceiptItemCancelVo;
import cn.iocoder.yudao.module.wealth.vo.receipt.FinanceReceiptItemVo;
import cn.iocoder.yudao.module.wealth.vo.receiptAccount.ReceiptItemBatchCreateReqVO;
import cn.iocoder.yudao.module.wealth.vo.receiptAccount.ReceiptItemBatchRespVO;
import cn.iocoder.yudao.module.wealth.vo.receiptItem.ReceiptItemBackVO;
import cn.iocoder.yudao.module.wealth.vo.receiptItem.ReceiptItemCreateReqVO;
import cn.iocoder.yudao.module.wealth.vo.receiptItem.ReceiptItemUpdateReqVO;
import cn.iocoder.yudao.module.wealth.vo.receiptItem.*;
import javax.validation.Valid;
import java.math.BigDecimal;
......@@ -126,4 +125,6 @@ public interface ReceiptItemService extends IService<ReceiptItemDO> {
List<ReceiptItemBatchRespVO> receiptItemImport(List<ReceiptItemBatchCreateReqVO> list, Boolean ignoreItem);
ReceiptItemBackVO getReceiptItemDetail(Long id);
ReceiptItemReviewPageResult<ReceiptItemReviewPageVO> getReceiptItemReviewPage(ReceiptItemReviewPageReqVO pageReqVO, PageVO page);
}
......@@ -4,6 +4,8 @@ import cn.iocoder.boot.module.order.api.OrderApi;
import cn.iocoder.boot.module.order.api.dto.OrderRespDTO;
import cn.iocoder.yudao.framework.dict.core.dto.DictDataRespDTO;
import cn.iocoder.yudao.framework.mybatis.core.service.AbstractService;
import cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.bpm.api.BpmCreateServiceFactory;
......@@ -15,6 +17,7 @@ import cn.iocoder.yudao.module.ecw.api.currency.CurrencyApi;
import cn.iocoder.yudao.module.ecw.api.currency.dto.CurrencyRespDTO;
import cn.iocoder.yudao.module.ecw.api.currency.dto.ExchangeRateRespDTO;
import cn.iocoder.yudao.module.system.api.dict.DictDataApi;
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
import cn.iocoder.yudao.module.wealth.convert.receiptItem.ReceiptItemConvert;
import cn.iocoder.yudao.module.wealth.convert.receivable.ReceivableConvert;
import cn.iocoder.yudao.module.wealth.dal.dataobject.receipt.ReceiptDO;
......@@ -33,16 +36,16 @@ import cn.iocoder.yudao.module.wealth.service.receivable.ReceivableService;
import cn.iocoder.yudao.module.wealth.util.WealthGenCodeUtils;
import cn.iocoder.yudao.module.wealth.vo.receipt.FinanceReceiptItemCancelVo;
import cn.iocoder.yudao.module.wealth.vo.receipt.FinanceReceiptItemVo;
import cn.iocoder.yudao.module.wealth.vo.receipt.ReceiptRelationOrderInfoVO;
import cn.iocoder.yudao.module.wealth.vo.receiptAccount.ReceiptItemBatchCreateReqVO;
import cn.iocoder.yudao.module.wealth.vo.receiptAccount.ReceiptItemBatchRespVO;
import cn.iocoder.yudao.module.wealth.vo.receiptItem.ReceiptItemBackVO;
import cn.iocoder.yudao.module.wealth.vo.receiptItem.ReceiptItemCreateReqVO;
import cn.iocoder.yudao.module.wealth.vo.receiptItem.ReceiptItemUpdateReqVO;
import cn.iocoder.yudao.module.wealth.vo.receiptItem.*;
import cn.iocoder.yudao.module.wealth.vo.receivable.ReceivableInItemVO;
import cn.iocoder.yudao.module.wealth.vo.receivable.ReceivableWriteOffReqVO;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateUtils;
......@@ -93,6 +96,8 @@ public class ReceiptItemServiceImpl extends AbstractService<ReceiptItemMapper, R
private CurrencyApi currencyApi;
@Resource
private BankApi bankApi;
@Resource
private AdminUserApi adminUserApi;
@Override
@Transactional(rollbackFor = Exception.class)
......@@ -616,6 +621,80 @@ public class ReceiptItemServiceImpl extends AbstractService<ReceiptItemMapper, R
return itemBackVO;
}
@Override
public ReceiptItemReviewPageResult<ReceiptItemReviewPageVO> getReceiptItemReviewPage(ReceiptItemReviewPageReqVO pageReqVO, PageVO page) {
IPage<ReceiptItemReviewPageVO> mpPage = MyBatisUtils.buildPage(page);
receiptItemMapper.getReceiptItemReviewPage(mpPage, pageReqVO);
List<ReceiptItemReviewPageVO> records = mpPage.getRecords();
if (records.isEmpty()) {
return ReceiptItemReviewPageResult.empty();
}
for (ReceiptItemReviewPageVO record : records) {
List<ReceiptRelationOrderInfoVO> orderInfoByReceiptId = receiptMapper.getOrderInfoByReceiptId(record.getReceiptId());
record.setOrderInfoList(orderInfoByReceiptId);
List<ReceivableDO> receivableDOS = receivableService.selectList("receipt_id", record.getReceiptId());
record.setFeeStatistics(getReceivableFeeStatistics(receivableDOS));
}
ReceiptItemReviewPageResult<ReceiptItemReviewPageVO> pageResult = ReceiptItemReviewPageResult.of(mpPage);
List<ReceiptItemActualAmount> actualAmount = receiptItemMapper.getReceiptItemActualAmount(pageReqVO);
List<ReceiptItemActualAmount> totalActualAmount= receiptItemMapper.countTotalActualAmount();
List<ReceiptItemActualAmount> totalWriteOffAmount= receiptItemMapper.countTotalWriteOffAmount();
pageResult.setActualAmount(actualAmount);
pageResult.setTotalActualAmount(totalActualAmount);
pageResult.setTotalWriteOffAmount(totalWriteOffAmount);
return pageResult;
}
private ReceiptItemReviewPageVO.FeeStatistics getReceivableFeeStatistics(List<ReceivableDO> receivableDOS) {
HashMap<Long, BigDecimal> summaryMap = new HashMap<>();
BigDecimal baseCurrencySummary = BigDecimal.ZERO;
HashMap<Integer, Map<Long, BigDecimal>> detailsMap = new HashMap<>();
for (ReceivableDO receivableDO : receivableDOS) {
BigDecimal actualAmount = receivableDO.getTaxAmount().subtract(receivableDO.getDiscountTotal());
// 更新 summaryMap
summaryMap.merge(receivableDO.getCurrencyId(), actualAmount, BigDecimal::add);
// 更新 baseCurrencySummary
baseCurrencySummary = baseCurrencySummary.add(receivableDO.getBaseAmount());
// 更新 detailsMap
detailsMap.computeIfAbsent(receivableDO.getFeeType(), k -> new HashMap<>())
.merge(receivableDO.getCurrencyId(), actualAmount, BigDecimal::add);
}
Map<Integer, CurrencyRespDTO> allCurrency = currencyApi.getAllCurrency();
ReceiptItemReviewPageVO.FeeStatistics feeStatistics = new ReceiptItemReviewPageVO.FeeStatistics();
if (!receivableDOS.isEmpty()) {
CurrencyRespDTO baseCurrency = allCurrency.get(receivableDOS.get(0).getBaseCurrencyId().intValue());
feeStatistics.setBaseCurrencySummary(baseCurrency.getFuhao() + baseCurrencySummary);
}
StringBuilder summary = new StringBuilder(summaryMap.size() * 20);
for (Map.Entry<Long, BigDecimal> entry : summaryMap.entrySet()) {
CurrencyRespDTO currency = allCurrency.get(entry.getKey().intValue());
summary.append(currency.getFuhao()).append(entry.getValue()).append(",");
}
if (summary.length() > 0) {
feeStatistics.setSummary(summary.substring(0, summary.length() - 1));
}
List<ReceiptItemReviewPageVO.Fee> fees = new ArrayList<>(detailsMap.size());
for (Map.Entry<Integer, Map<Long, BigDecimal>> entry : detailsMap.entrySet()) {
StringBuilder detail = new StringBuilder(entry.getValue().size() * 20);
for (Map.Entry<Long, BigDecimal> detailEntry : entry.getValue().entrySet()) {
CurrencyRespDTO currency = allCurrency.get(detailEntry.getKey().intValue());
detail.append(currency.getFuhao()).append(detailEntry.getValue()).append(",");
}
fees.add(new ReceiptItemReviewPageVO.Fee(entry.getKey(), detail.substring(0, detail.length() - 1)));
}
feeStatistics.setDetails(fees);
return feeStatistics;
}
private ReceiptItemBatchRespVO validateBatchReceiptItem(ReceiptItemBatchCreateReqVO batchCreateReqVO, Boolean ignoreItem, ArrayList<ReceiptItemCreateReqVO> receiptItemCreateReqVOS) {
// 校验单个字段合法性
ReceiptItemBatchRespVO commonFieldRes = validateBatchReceiptItemCommonField(batchCreateReqVO);
......
......@@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.wealth.vo.receipt;
import lombok.Data;
@Data
public class OrderVo {
public class OrderVO {
public Long customerId;
private String containerNumber;
private String country;
......
package cn.iocoder.yudao.module.wealth.vo.receipt;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ReceiptRelationOrderInfoVO {
@ApiModelProperty(value = "订单号")
......@@ -14,4 +16,7 @@ public class ReceiptRelationOrderInfoVO {
@ApiModelProperty(value = "提单号")
private String tidanNo;
@ApiModelProperty(value = "状态")
private Integer status;
}
\ No newline at end of file
package cn.iocoder.yudao.module.wealth.vo.receiptItem;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class ReceiptItemActualAmount {
@ApiModelProperty(value = "币种id")
private String currencyId;
@ApiModelProperty(value = "金额")
private String amount;
}
\ No newline at end of file
package cn.iocoder.yudao.module.wealth.vo.receiptItem;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import java.util.List;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Data
@ApiModel("管理后台 - 收款单明细审核分页查询 VO")
public class ReceiptItemReviewPageReqVO {
@ApiModelProperty(value = "编号搜索(包括订单号,提单号)")
private String numberKey;
@ApiModelProperty(value = "反向编号搜索(包括订单号,提单号)不包含的数据")
private String notNumberKey;
@ApiModelProperty(value = "编号搜索强等于(包括订单号,提单号)")
private String eqNumberKey;
@ApiModelProperty(value = "编号搜索强不等于(包括订单号,提单号)")
private String notEqNumberKey;
@ApiModelProperty(value = "付款方")
private Integer payerType;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始实收日期")
private Date beginAmountDate;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "结束实收日期")
private Date endAmountDate;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "提交日期开始")
private Date beginCreateTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "提交日期结束")
private Date endCreateTime;
@ApiModelProperty(value = "收款账号")
private List<Long> accountId;
@ApiModelProperty(value = "客户经理")
private List<Long> salesmanIds;
@ApiModelProperty(value = "客户名")
private String customerName;
}
package cn.iocoder.yudao.module.wealth.vo.receiptItem;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
@Data
@ApiModel("分页结果")
public final class ReceiptItemReviewPageResult<T> implements Serializable {
@ApiModelProperty(value = "数据", required = true)
private List<T> list;
@ApiModelProperty(value = "总量", required = true, example = "0")
private Long total = 0L;
@ApiModelProperty(value = "每页记录数", required = true, example = "10")
private Long rows = 10L;
@ApiModelProperty(value = "当前页数", required = true, example = "1")
private Long page = 1L;
@ApiModelProperty(value = "总页数", required = true, example = "0")
private Long pages = 0L;
@ApiModelProperty(value = "当前查询实收")
private List<ReceiptItemActualAmount> actualAmount;
@ApiModelProperty(value = "总实收")
List<ReceiptItemActualAmount> totalActualAmount;
@ApiModelProperty(value = "结算总合计")
List<ReceiptItemActualAmount> totalWriteOffAmount;
public ReceiptItemReviewPageResult() {}
public ReceiptItemReviewPageResult(List<T> list, long total) {
this.list = list;
this.total = total;
}
public ReceiptItemReviewPageResult(List<T> list, long total, long rows, long page, long pages) {
this.list = list;
this.rows = rows;
this.page = page;
this.pages = pages;
this.total = total;
}
public ReceiptItemReviewPageResult(long total) {
this.list = new ArrayList<>();
this.total = total;
}
public static <T> ReceiptItemReviewPageResult<T> empty() {
return new ReceiptItemReviewPageResult<>();
}
public static <T> ReceiptItemReviewPageResult<T> empty(long total) {
return new ReceiptItemReviewPageResult<>(total);
}
/****
* 分页转换
* @param pager
* @return
*/
public static <T> ReceiptItemReviewPageResult<T> of(IPage<T> pager){
return new ReceiptItemReviewPageResult<>(pager.getRecords(), pager.getTotal(), pager.getSize(), pager.getCurrent(), pager.getPages());
}
/****
* 分页转换
* @param pager
* @return
*/
public static <T> ReceiptItemReviewPageResult<T> of(PageInfo<T> pager){
return new ReceiptItemReviewPageResult<>(pager.getList(), pager.getTotal(), pager.getPageSize(), pager.getPageNum(), pager.getPages());
}
}
package cn.iocoder.yudao.module.wealth.vo.receiptItem;
import cn.iocoder.yudao.module.wealth.vo.receipt.ReceiptRelationOrderInfoVO;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import java.util.List;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY;
/**
* 收款单明细审核 Response VO
*/
@Data
@ApiModel("管理后台 - 收款单明细审核 Response VO")
public class ReceiptItemReviewPageVO {
@ApiModelProperty(value = "主键", required = true)
private Long id;
@ApiModelProperty(value = "订单信息")
private List<ReceiptRelationOrderInfoVO> orderInfoList;
@ApiModelProperty(value = "收款单id")
private Long receiptId;
@ApiModelProperty(value = "收款单号")
private String receiptNo;
@ApiModelProperty(value = "付款方")
private Integer payerType;
@ApiModelProperty(value = "费用统计")
private FeeStatistics feeStatistics;
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY)
@ApiModelProperty(value = "实收日期")
private Date amountDate;
@ApiModelProperty(value = "收款账号")
private String accountNo;
@ApiModelProperty(value = "收款账号名称")
private String accountName;
@ApiModelProperty(value = "收款账号银行名称")
private String accountBankName;
@ApiModelProperty(value = "货币id")
private Long currencyId;
@ApiModelProperty(value = "当次实收金额不含税")
private java.math.BigDecimal amount;
@ApiModelProperty(value = "收款汇率")
private String rate;
@ApiModelProperty(value = "核销货币id")
private Long writeOffCurrencyId;
@ApiModelProperty(value = "核销金额")
private java.math.BigDecimal writeOffAmount;
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY)
@ApiModelProperty(value = "提交时间")
private Date submitTime;
@ApiModelProperty(value = "附件多个,分隔")
private String attr;
@ApiModelProperty(value = "备注")
private String remark;
@ApiModelProperty(value = "客户id")
private Long customerId;
@ApiModelProperty(value = "客户编号")
private String customerNo;
@ApiModelProperty(value = "客户付款人姓名")
private String customerPayName;
@ApiModelProperty(value = "客户名")
private String customerName;
@ApiModelProperty(value = "客户经理id")
private Long salesmanId;
@ApiModelProperty(value = "客户经理id")
private String salesmanName;
@ApiModelProperty(value = "审批单id")
private String bmpId;
@Data
public static class FeeStatistics {
@ApiModelProperty(value = "明细")
private List<Fee> details;
@ApiModelProperty(value = "汇总")
private String summary;
@ApiModelProperty(value = "结算币种")
private String baseCurrencySummary;
}
@Data
public static class Fee {
@ApiModelProperty(value = "明细")
private Integer feeType;
@ApiModelProperty(value = "费用金额")
private String feeAmount;
public Fee(Integer feeType, String feeAmount) {
this.feeType = feeType;
this.feeAmount = feeAmount;
}
}
}
......@@ -5,6 +5,7 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.collectors.CollectorsUtil;
import cn.iocoder.yudao.framework.excel.util.ExcelUtils;
import cn.iocoder.yudao.framework.idempotent.core.annotation.Idempotent;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.module.ecw.api.currency.CurrencyApi;
import cn.iocoder.yudao.module.ecw.api.currency.dto.CurrencyRespDTO;
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
......@@ -21,9 +22,7 @@ import cn.iocoder.yudao.module.wealth.vo.receipt.FinanceReceiptItemCancelVo;
import cn.iocoder.yudao.module.wealth.vo.receipt.FinanceReceiptItemVo;
import cn.iocoder.yudao.module.wealth.vo.receiptAccount.ReceiptItemBatchCreateReqVO;
import cn.iocoder.yudao.module.wealth.vo.receiptAccount.ReceiptItemBatchRespVO;
import cn.iocoder.yudao.module.wealth.vo.receiptItem.ReceiptItemBackVO;
import cn.iocoder.yudao.module.wealth.vo.receiptItem.ReceiptItemCreateReqVO;
import cn.iocoder.yudao.module.wealth.vo.receiptItem.ReceiptItemUpdateReqVO;
import cn.iocoder.yudao.module.wealth.vo.receiptItem.*;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
......@@ -210,6 +209,12 @@ public class ReceiptItemController {
return success(ReceiptItemConvert.INSTANCE.convertList(list));
}
@PostMapping("/review/page")
@ApiOperation("获得收款数据审批列表")
public CommonResult<ReceiptItemReviewPageResult<ReceiptItemReviewPageVO>> getReceiptItemReviewPage(@RequestBody ReceiptItemReviewPageReqVO pageReqVO, PageVO page) {
return success(receiptItemService.getReceiptItemReviewPage(pageReqVO, page));
}
@PostMapping("/financeReceiptItemWriteOff")
@ApiOperation("收款明细核销")
@Idempotent(timeout = 5)
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.iocoder.yudao.module.wealth.dal.mysql.receiptItem.ReceiptItemMapper">
<select id="getReceiptItemReviewPage"
resultType="cn.iocoder.yudao.module.wealth.vo.receiptItem.ReceiptItemReviewPageVO">
SELECT
eri.*,
er.receipt_no,
o.customer_id,
era.create_time AS submitTime,
c.number AS customerNo,
c.name AS customerName,
c.payer_name AS customerPayName,
o.salesman_id,
su.nickname AS salesmanName,
o.drawee AS payerType
FROM ecw_receipt_item eri
LEFT JOIN ecw_receipt er ON eri.receipt_id = er.id
LEFT JOIN ecw_receipt_approval era ON era.bmp_id=eri.bmp_id
LEFT JOIN ecw_bank_account eba ON eba.ba_account_num = eri.account_no
INNER JOIN (SELECT receipt_id, order_id FROM ecw_receivable GROUP BY receipt_id, order_id) rb
ON rb.receipt_id = er.id
LEFT JOIN ecw_order o ON o.order_id = rb.order_id
LEFT JOIN ecw_customer c ON c.id = o.customer_id
LEFT JOIN system_user su ON su.id = o.salesman_id
WHERE eri.deleted = 0 AND eri.bmp_status = 1
<include refid="itemReviewPageCondition"/>
GROUP BY eri.id
</select>
<sql id="itemReviewPageCondition">
<if test="query.numberKey != null and query.numberKey != '' ">
AND concat(IFNULL(o.`order_no`,''), IFNULL(o.`tidan_no`,'')) LIKE concat("%",concat(#{query.numberKey},"%"))
</if>
<if test="query.notNumberKey != null and query.notNumberKey != '' ">
AND concat(IFNULL(o.`order_no`,''),IFNULL(o.`tidan_no`,'')) NOT LIKE
concat("%",concat(#{query.notNumberKey},"%"))
</if>
<if test="query.eqNumberKey != null and query.eqNumberKey != '' ">
AND (IFNULL(o.`order_no`,'') = #{query.eqNumberKey} OR IFNULL(o.`tidan_no`,'') = #{query.eqNumberKey})
</if>
<if test="query.notEqNumberKey != null and query.notEqNumberKey != '' ">
AND IFNULL(o.`order_no`,'') != #{query.notEqNumberKey} AND IFNULL(o.`tidan_no`,'') !=
#{query.notEqNumberKey}
</if>
<if test="query.payerType != null">
AND o.drawee = #{query.payerType}
</if>
<if test="query.beginCreateTime != null and query.endCreateTime != null">
AND era.create_time BETWEEN #{query.beginCreateTime} and #{query.endCreateTime}
</if>
<if test="query.beginAmountDate != null and query.endAmountDate != null">
AND eri.amount_date BETWEEN #{query.beginAmountDate} and #{query.endAmountDate}
</if>
<if test="query.accountId != null and query.accountId.size > 0">
AND eba.id IN
<foreach collection="query.accountId" item="account" open="(" separator="," close=")">
#{account}
</foreach>
</if>
<if test="query.salesmanIds != null and query.salesmanIds.size > 0 ">
AND o.salesman_id IN
<foreach collection="query.salesmanIds" item="salesmanId" open="(" separator="," close=")">
#{salesmanId}
</foreach>
</if>
<if test="query.customerName != null and query.customerName != ''">
AND c.name LIKE CONCAT('%', #{query.customerName}, '%')
</if>
</sql>
<select id="getReceiptItemActualAmount"
resultType="cn.iocoder.yudao.module.wealth.vo.receiptItem.ReceiptItemActualAmount">
SELECT t.currency_id,
SUM(t.amount) AS amount
FROM ( SELECT
eri.currency_id,
eri.amount
FROM ecw_receipt_item eri
LEFT JOIN ecw_receipt er ON eri.receipt_id = er.id
LEFT JOIN ecw_receipt_approval era ON era.bmp_id=eri.bmp_id
LEFT JOIN ecw_bank_account eba ON eba.ba_account_num = eri.account_no
INNER JOIN (SELECT receipt_id, order_id FROM ecw_receivable GROUP BY receipt_id, order_id) rb
ON rb.receipt_id = er.id
LEFT JOIN ecw_order o ON o.order_id = rb.order_id
LEFT JOIN ecw_customer c ON c.id = o.customer_id
WHERE eri.deleted = 0 AND eri.bmp_status = 1
<include refid="itemReviewPageCondition"/>
GROUP BY eri.id ) AS t
GROUP BY t.currency_id
</select>
<select id="countTotalActualAmount"
resultType="cn.iocoder.yudao.module.wealth.vo.receiptItem.ReceiptItemActualAmount">
SELECT
eri.currency_id,
SUM(eri.amount) AS amount
FROM ecw_receipt_item eri
WHERE eri.deleted = 0 AND eri.bmp_status = 1
GROUP BY eri.currency_id
</select>
<select id="countTotalWriteOffAmount"
resultType="cn.iocoder.yudao.module.wealth.vo.receiptItem.ReceiptItemActualAmount">
SELECT
eri.write_off_currency_id AS currency_id,
SUM(eri.write_off_amount) AS amount
FROM ecw_receipt_item eri
WHERE eri.deleted = 0 AND eri.bmp_status = 1
GROUP BY eri.write_off_currency_id
</select>
</mapper>
......@@ -47,7 +47,8 @@
SELECT
o.order_no AS orderNo,
o.tidan_no AS tidanNo,
o.order_id AS orderId
o.order_id AS orderId,
o.status
FROM ecw_receivable er
LEFT JOIN ecw_order o ON o.order_id=er.order_id
WHERE er.deleted= 0 AND er.receipt_id = #{id}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment