Commit ec7b8419 authored by zhangfeng's avatar zhangfeng

feat(wealth): 财务报表

parent 5b47b3b2
......@@ -4,7 +4,7 @@ ALTER TABLE `ecw_bank_account` COLLATE = utf8mb4_general_ci;
ALTER TABLE `ecw_bank_account` ADD COLUMN `ba_country` bigint NULL DEFAULT NULL COMMENT '国家' AFTER `ba_type`;
ALTER TABLE `ecw_bank_account` ADD COLUMN `ba_income_belong` bigint NULL DEFAULT NULL COMMENT '归属' AFTER `ba_country`;
ALTER TABLE `ecw_bank_account` ADD COLUMN `ba_income_belong` int NULL DEFAULT NULL COMMENT '归属' AFTER `ba_country`;
ALTER TABLE `ecw_bank_account` ADD COLUMN `ba_currency` int NULL DEFAULT NULL COMMENT '币种' AFTER `ba_income_belong`;
......@@ -103,6 +103,8 @@ ALTER TABLE `ecw_receipt_item` ADD COLUMN `remark` varchar(500) CHARACTER SET ut
ALTER TABLE `ecw_receipt_item` ADD COLUMN `approval_time` datetime NULL DEFAULT NULL COMMENT '审核通过时间' AFTER `remark`;
ALTER TABLE `ecw_receipt_item` ADD COLUMN `account_id` bigint NULL DEFAULT NULL COMMENT '收款账号id' AFTER `receipt_id`;
ALTER TABLE `ecw_receipt_item` MODIFY COLUMN `rate` decimal(10, 6) NULL DEFAULT NULL COMMENT '收款汇率' AFTER `currency_id`;
CREATE TABLE `ecw_receipt_log` (
......@@ -128,20 +130,29 @@ ALTER TABLE `ecw_receivable` ADD COLUMN `write_off_amount` decimal(15, 2) NOT NU
ALTER TABLE `ecw_receivable` MODIFY COLUMN `exchange_rate` decimal(15, 6) NULL DEFAULT NULL COMMENT '汇率' AFTER `fee_type`;
ALTER TABLE `ecw_receivable` ADD COLUMN `dest_country_currency_id` bigint NULL DEFAULT NULL COMMENT '目的国相关币种id(用于报表,跟费用类型相关)' AFTER `fee_type`;
ALTER TABLE `ecw_receivable` ADD COLUMN `dest_country_rate` decimal(10, 6) NULL DEFAULT NULL COMMENT '目的国相关汇率(用于报表,跟费用类型相关)' AFTER `dest_country_currency_id`;
ALTER TABLE `ecw_receivable` ADD COLUMN `dest_country_sub_rate` decimal(10, 6) NULL DEFAULT NULL COMMENT '额外费用副币种汇率(用于报表,跟费用类型相关)' AFTER `dest_country_rate`;
ALTER TABLE `ecw_receivable` ADD INDEX `key_receipt_id`(`deleted` ASC, `receipt_id` ASC) USING BTREE;
CREATE TABLE `ecw_receivable_write_off_record` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
`order_id` bigint DEFAULT NULL COMMENT '订单id',
`receivable_id` bigint DEFAULT NULL COMMENT '应收款id',
`receipt_item_id` bigint DEFAULT NULL COMMENT '银行收款明细id',
`receivable_write_off_amount` decimal(10,2) DEFAULT NULL COMMENT '应收的核销金额',
`write_off_amount` decimal(10,2) DEFAULT NULL COMMENT '核销金额',
`income_belong` int DEFAULT NULL COMMENT '收入归属(0目的国,1始发国)',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
`creator` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '创建人',
`updater` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '更新人',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '删除标志',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=28 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='收款单日志';
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='收款明细与应收明细关联表';
SET FOREIGN_KEY_CHECKS=1;
......
......@@ -28,6 +28,67 @@ UPDATE ecw_receipt_item
SET approval_time = update_time
WHERE approval_time IS NULL AND `status` = 1;
# 刷新银行明细汇率,银行收款明细-币种≠应收所在自编号对应的核算币种,但是跟收款单-应收费用的币种相同
UPDATE ecw_receipt_item eri
SET eri.rate = (
SELECT era.write_off_rate
FROM ecw_receipt_account era
WHERE eri.receipt_id = era.receipt_id
AND era.currency_id = eri.currency_id
AND era.deleted = 0
AND era.write_off_rate IS NOT NULL
)
WHERE eri.`status` = 1
AND eri.deleted = 0
AND EXISTS (
SELECT 1
FROM ecw_receipt_account era
WHERE eri.receipt_id = era.receipt_id
AND era.currency_id = eri.currency_id
AND era.deleted = 0
AND era.write_off_rate IS NOT NULL
);
# 查询银行收款明细-币种≠应收所在自编号对应的核算币种,跟收款单-应收费用的币种也无法匹配
SELECT
eri.id,
eri.serial_number,
eri.receipt_id,
era.id aid,
eri.currency_id ic,
era.currency_id ac,
era.write_off_rate
FROM
ecw_receipt_item eri
LEFT JOIN ecw_receipt_account era ON eri.receipt_id = era.receipt_id
AND eri.currency_id = era.currency_id
AND era.deleted = 0
WHERE
eri.`status` = 1
AND eri.deleted = 0
AND era.id IS NULL;
# 刷新银行收款明细-币种≠应收所在自编号对应的核算币种,跟收款单-应收费用的币种也无法匹配
UPDATE ecw_receipt_item eri
JOIN (
SELECT
eri.id
FROM
ecw_receipt_item eri
LEFT JOIN ecw_receipt_account era
ON eri.receipt_id = era.receipt_id
AND eri.currency_id = era.currency_id
AND era.deleted = 0
WHERE
eri.`status` = 1
AND eri.deleted = 0
AND era.id IS NULL
) AS to_update ON eri.id = to_update.id
SET eri.rate = IFNULL((
SELECT eer.currency_rate
FROM ecw_exchange_rate eer
WHERE eer.source_currency_id = eri.currency_id
AND eer.target_currency_id = eri.write_off_currency_id
),1);
# 刷新银行明细审核核销币种
UPDATE ecw_receipt_item SET write_off_currency_id = 1 WHERE write_off_currency_id IS NULL;
......@@ -38,12 +99,20 @@ UPDATE ecw_receivable er
SET er.discount_total = 0 WHERE er.discount_total IS NULL;
# 刷新应收款汇率
# 应收明细币种=基准币种
UPDATE ecw_receivable er
SET er.exchange_rate = 1 WHERE er.exchange_rate IS NULL AND er.receipt_id IS NOT NULL AND er.currency_id = er.base_currency_id AND er.deleted = 0;
# 应收明细基准币种是美元
UPDATE ecw_receivable er
SET er.exchange_rate = ( SELECT era.write_off_rate FROM ecw_receipt_account era WHERE era.receipt_id = er.receipt_id AND era.currency_id = er.currency_id AND era.deleted = 0)
WHERE
er.receipt_id IS NOT NULL AND er.base_currency_id = 1 AND er.deleted = 0;
# 应收明细基准币种不是美元
UPDATE ecw_receivable er
SET er.exchange_rate = (SELECT eer.currency_rate FROM ecw_exchange_rate eer WHERE eer.source_currency_id = er.currency_id AND eer.target_currency_id = er.base_currency_id )
WHERE er.exchange_rate IS NULL AND er.receipt_id IS NOT NULL;
WHERE er.exchange_rate IS NULL AND er.receipt_id IS NOT NULL AND er.base_currency_id != 1 AND er.deleted = 0;
UPDATE ecw_receivable er
SET er.exchange_rate = 1 WHERE er.exchange_rate IS NULL AND er.receipt_id IS NOT NULL;
# 刷新应收款基准金额
UPDATE ecw_receivable er
......@@ -51,4 +120,12 @@ SET er.base_amount = er.exchange_rate * (er.tax_amount - er.discount_total)
WHERE er.base_amount IS NULL AND er.receipt_id IS NOT NULL AND er.exchange_rate IS NOT NULL;
# 修改收款单已核销待开票状态
UPDATE `ecw_receipt` SET `state` = 4 WHERE `state` = 5;
\ No newline at end of file
UPDATE `ecw_receipt` SET `state` = 4 WHERE `state` = 5;
# 刷新应收明细账户ID
UPDATE ecw_receipt_item eri SET eri.account_id = (SELECT eba.id FROM ecw_bank_account eba WHERE eba.ba_account_name = eri.account_name AND eba.ba_bank_name = eri.account_bank_name AND eba.ba_account_num = eri.account_no AND eba.deleted = 0) WHERE eri.deleted = 0;
# 刷新收款明细-应收明细-收入归属
UPDATE ecw_receivable_write_off_record erwor SET erwor.income_belong =
(SELECT eba.ba_income_belong FROM ecw_receipt_item eri LEFT JOIN ecw_bank_account eba ON eri.account_id = eba.id WHERE erwor.receipt_item_id = eri.id);
\ No newline at end of file
This diff is collapsed.
package cn.iocoder.yudao.framework.apollo.core.event.export;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class ShipmentSummeryNewExcelExportPushEvent {
/**
* 操作用户
*/
private Long userId;
/**
* 端口
*/
private Integer userType;
/**
* 请求参数
*/
private String requestParams;
/**
* 国际化语言值,默认0中文, 具体取值I18nMessage.getLang()
*/
private Integer lang = 0;
/**
* 文件名称
*/
private String fileName;
/**
* 文件路径
*/
private String path;
/**
* 下载地址
*/
private String url;
/**
* 执行结果
*/
private String result;
@ApiModelProperty(value = "文件ID")
private Long fileId;
}
......@@ -190,6 +190,7 @@ public class CustomerApiImpl implements CustomerApi {
customerDTO.setName(customer.getName());
customerDTO.setNumber(customer.getNumber());
customerDTO.setPayerName(customer.getPayerName());
customerDTO.setDefaultBilling(customer.getDefaultBilling() ? 1 : 0);
return customerDTO;
}
}
......@@ -11,4 +11,11 @@ public interface BankApi {
* 根据银行账号id获取账号信息
*/
BankAccountDTO getBankAccountByAccountId(Long id);
/**
* 更新银行账号余额
* @param bankAccountDTO
* @param isAdd
*/
void updateBankAccountBalance(BankAccountDTO bankAccountDTO, boolean isAdd);
}
package cn.iocoder.yudao.module.ecw.api.bank.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class BankAccountDTO {
@ApiModelProperty(value = "银行账号编号", required = true)
private Long id;
......
......@@ -45,4 +45,10 @@ public interface CurrencyApi {
*/
ExchangeRateRespDTO getCurrencyRateByCode(String sourceCode, String targetCode);
/**
* 获取所有汇率
* @return
*/
List<ExchangeRateRespDTO> getAllCurrencyRate();
}
......@@ -11,4 +11,6 @@ public class CustomerDTO {
private String name;
private String payerName;
private Integer defaultBilling;
}
......@@ -14,6 +14,18 @@ public class RegionDTO {
@ApiModelProperty(value = "英文")
private String titleEn;
@ApiModelProperty(value = "进口国运费币种")
private String importCurrency1;
@ApiModelProperty(value = "进口国清关费币种")
private String importCurrency2;
@ApiModelProperty(value = "进口国额外费用主币种 (匹配币种一致的金额)")
private String importCurrency3;
@ApiModelProperty(value = "进口国额外费用副币种 (未匹配主币种的金额统一转换为额外费用副币种金额)")
private String importCurrency4;
@ApiModelProperty(value = "进口国应收额币种")
private String importCurrency5;
}
......@@ -5,6 +5,7 @@ import cn.iocoder.yudao.module.ecw.api.bank.dto.BankAccountDTO;
import cn.iocoder.yudao.module.ecw.convert.bankAccount.BankAccountConvert;
import cn.iocoder.yudao.module.ecw.dal.dataobject.bankAccount.BankAccountDO;
import cn.iocoder.yudao.module.ecw.dal.mysql.bankAccount.BankAccountMapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
......@@ -29,4 +30,21 @@ public class BankApiImpl implements BankApi {
BankAccountDO bankAccountDO = bankAccountMapper.selectById(id);
return BankAccountConvert.INSTANCE.convertDTO(bankAccountDO);
}
@Override
public void updateBankAccountBalance(BankAccountDTO bankAccountDTO, boolean isAdd) {
List<BankAccountDO> bankAccountDOS = bankAccountMapper.selectList(Wrappers.lambdaQuery(BankAccountDO.class)
.eq(BankAccountDO::getBaAccountName, bankAccountDTO.getBaAccountName())
.eq(BankAccountDO::getBaAccountNum, bankAccountDTO.getBaAccountNum())
.eq(BankAccountDO::getBaBankName, bankAccountDTO.getBaBankName()));
if (bankAccountDOS != null && !bankAccountDOS.isEmpty()) {
BankAccountDO bankAccountDO = bankAccountDOS.get(0);
if (isAdd) {
bankAccountDO.setBaBalance(bankAccountDO.getBaBalance().add(bankAccountDTO.getBaBalance()));
} else {
bankAccountDO.setBaBalance(bankAccountDO.getBaBalance().subtract(bankAccountDTO.getBaBalance()));
}
bankAccountMapper.updateById(bankAccountDO);
}
}
}
......@@ -195,4 +195,10 @@ public class CurrecyApiImpl implements CurrencyApi {
}
@Override
public List<ExchangeRateRespDTO> getAllCurrencyRate() {
List<ExchangeRateDO> exchangeRateDOS = exchangeRateService.selectList();
return ExchangeRateConvert.INSTANCE.convertList2(exchangeRateDOS);
}
}
......@@ -36,6 +36,10 @@ public class RegionApiImpl implements RegionApi {
regionDTO.setId(regionDO.getId());
regionDTO.setTitleZh(regionDO.getTitleZh());
regionDTO.setTitleEn(regionDO.getTitleEn());
regionDTO.setImportCurrency1(regionDO.getImportCurrency1());
regionDTO.setImportCurrency2(regionDO.getImportCurrency2());
regionDTO.setImportCurrency3(regionDO.getImportCurrency3());
regionDTO.setImportCurrency4(regionDO.getImportCurrency4());
regionDTO.setImportCurrency5(regionDO.getImportCurrency5());
return regionDTO;
}
......
......@@ -101,11 +101,6 @@ public class BankAccountServiceImpl implements BankAccountService {
vo.setBaCountryZh(baCountryDO.getTitleZh());
vo.setBaCountryEn(baCountryDO.getTitleEn());
}
if (vo.getBaIncomeBelong() != null) {
RegionDO baIncomeBelongDO = countryMap.get(vo.getBaIncomeBelong().longValue());
vo.setBaIncomeBelongZh(baIncomeBelongDO.getTitleZh());
vo.setBaIncomeBelongEn(baIncomeBelongDO.getTitleEn());
}
});
return voPageResult;
}
......
......@@ -6,6 +6,7 @@ import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQuery;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.module.order.dal.dataobject.order.OrderDO;
import cn.iocoder.yudao.module.order.dal.dataobject.orderItem.OrderItemDO;
import cn.iocoder.yudao.module.order.dto.OrderCostSummaryDto;
import cn.iocoder.yudao.module.order.dto.OrderExportBackDTO;
import cn.iocoder.yudao.module.order.dto.OrderBackInfoDto;
import cn.iocoder.yudao.module.order.dto.SearchBackDto;
......@@ -3368,4 +3369,6 @@ public interface OrderMapper extends AbstractMapper<OrderDO> {
void updateOrderCustomerAndSalesmanId(@Param("customerId")Long customerId,@Param("salesmanId") Long salesmanId,@Param("orderId") Long orderId);
StatisticsOrderVO statisticsPickUp(@Param("query") OrderQueryVO query);
List<OrderBackPageVO> containerOrderSummaryList(@Param("query") ContainerReportOrderQueryVO query);
}
......@@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Objects;
@Data
@ApiModel("费用分组dto")
......@@ -16,4 +17,21 @@ public class FeeGroupDto {
private Long currencyId;
@ApiModelProperty("货币名称(只展示英文代码)")
private String currencyName;
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
FeeGroupDto that = (FeeGroupDto) o;
return Objects.equals(currencyId, that.currencyId);
}
@Override
public int hashCode() {
return Objects.hashCode(currencyId);
}
public void addAmount(BigDecimal amount) {
this.amount = this.amount.add(amount);
}
}
......@@ -5,6 +5,7 @@ import cn.iocoder.yudao.framework.excel.convert.DictConvert;
import cn.iocoder.yudao.module.depository.dto.LogisticsInfoDto;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -29,6 +30,7 @@ import static cn.iocoder.yudao.module.bpm.enums.DictTypeConstants.TRANSPORT_TYPE
*/
@Data
@ApiModel("订单费用汇总")
// TODO 表格index待调整
public class OrderCostSummaryDto {
@ExcelProperty(value = "序号", index = 0)
......@@ -73,7 +75,7 @@ public class OrderCostSummaryDto {
@ExcelIgnore
@ApiModelProperty(value = "是否控货")
private Boolean isCargoControl;
private Integer isCargoControl;
// @ExcelIgnore
@ExcelProperty(value = "订单入仓时间", index = 29)
......@@ -151,6 +153,14 @@ public class OrderCostSummaryDto {
@ApiModelProperty(value = "已收运费(货币分组列表转换字符串)")
private String writeOffFreightFeeGroup;
@ExcelIgnore
@ApiModelProperty(value = "未收运费货币分组列表")
private List<FeeGroupDto> notWriteOffFreightFeeGroupDtoList;
@ExcelProperty(value = "未收运费", index = 17)
@ApiModelProperty(value = "未收运费(货币分组列表转换字符串)")
private String notWriteOffFreightFeeGroup;
@ExcelIgnore
@ApiModelProperty(value = "实收清关费")
private BigDecimal netReceiptsClearanceFee;
......@@ -196,9 +206,17 @@ public class OrderCostSummaryDto {
private List<FeeGroupDto> writeOffClearanceFeeGroupDtoList;
@ExcelProperty(value = "已收清关费", index = 21)
@ApiModelProperty(value = "已收额外费用(货币分组列表转换字符串)")
@ApiModelProperty(value = "已收清关费用(货币分组列表转换字符串)")
private String writeOffClearanceFeeGroup;
@ExcelIgnore
@ApiModelProperty(value = "未收清关费货币分组列表")
private List<FeeGroupDto> notWriteOffClearanceFeeGroupDtoList;
@ExcelProperty(value = "未收清关费", index = 21)
@ApiModelProperty(value = "未收清关费用(货币分组列表转换字符串)")
private String notWriteOffClearanceFeeGroup;
@ExcelIgnore
@ApiModelProperty(value = "实收额外费用")
private BigDecimal netReceiptsOtherFee;
......@@ -247,6 +265,14 @@ public class OrderCostSummaryDto {
@ApiModelProperty(value = "已收额外费用(货币分组列表转换字符串)")
private String writeOffOtherFeeGroup;
@ExcelIgnore
@ApiModelProperty(value = "未收额外费用货币分组列表")
private List<FeeGroupDto> notWriteOffOtherFeeGroupDtoList;
@ExcelProperty(value = "未收额外费用", index = 99)
@ApiModelProperty(value = "未收额外费用(货币分组列表转换字符串)")
private String notWriteOffOtherFeeGroup;
@ExcelIgnore
@ApiModelProperty(value = "核销币种(总额计算统一币种,当币种有多个时,以美元计算,否则以当前单一币种计算)")
private Long writeOffCurrencyId;
......@@ -306,6 +332,14 @@ public class OrderCostSummaryDto {
@ApiModelProperty(value = "已收总金额(货币分组列表转换字符串)")
private String writeOffTotalFeeGroup;
@ExcelIgnore
@ApiModelProperty(value = "未收总金额货币分组列表")
private List<FeeGroupDto> notWriteOffTotalFeeGroupDtoList;
@ExcelProperty(value = "未收总金额", index = 99)
@ApiModelProperty(value = "未收总金额(货币分组列表转换字符串)")
private String notWriteOffTotalFeeGroup;
@ExcelProperty(value = "是否全部核销", index = 26)
@ApiModelProperty(value = "是否全部核销")
......@@ -514,6 +548,64 @@ public class OrderCostSummaryDto {
@ApiModelProperty(value = "订单状态")
private String statusMsg;
@ApiModelProperty(value = "财务2.2-提货率")
private BigDecimal pickRatio;
@ApiModelProperty(value = "财务2.2-提单制作状态 2已完成")
private Integer billOfLadingStatus;
@ExcelProperty("收货人客户id")
@ApiModelProperty(value = "财务2.2-收货人客户id")
private Long consigneeCustomerId;
@ExcelProperty("收货人客户编号")
@ApiModelProperty(value = "财务2.2-收货人客户编号")
private String consigneeCustomerNumber;
@ExcelProperty("收货人姓名")
@ApiModelProperty(value = "财务2.2-收货人姓名")
private String consigneeName;
@ExcelProperty("收货人姓名(英文)")
@ApiModelProperty(value = "财务2.2-收货人姓名(英文)")
private String consigneeNameEn;
@ExcelProperty("收货人手机")
@ApiModelProperty(value = "财务2.2-收货人手机")
private String consigneePhone;
@ExcelProperty("发货人姓名")
@ApiModelProperty(value = "财务2.2-发货人姓名")
private String consignorName;
@ExcelProperty("发货人客户id")
@ApiModelProperty(value = "财务2.2-发货人客户id")
private Long consignorCustomerId;
@ExcelProperty("发货人客户编号")
@ApiModelProperty(value = "财务2.2-发货人客户编号")
private String consignorCustomerNumber;
@ExcelProperty("发货人姓名(英文)")
@ApiModelProperty(value = "财务2.2-发货人姓名(英文)")
private String consignorNameEn;
@ExcelProperty("发货人手机")
@ApiModelProperty(value = "财务2.2-发货人手机")
private String consignorPhone;
@ApiModelProperty(value = "财务2.2-到港时间")
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date daogangTime;
@ApiModelProperty(value = "财务2.2-清关时间")
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date qingguanTime;
@ApiModelProperty(value = "财务2.2-已卸柜/出仓时间")
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date unloadTime;
public void setWriteOffProportion(BigDecimal writeOffProportion) {
this.writeOffProportion = writeOffProportion;
......@@ -529,4 +621,17 @@ public class OrderCostSummaryDto {
this.orderTypeName = orderType == 1 ? "否" : "是";
}
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
OrderCostSummaryDto that = (OrderCostSummaryDto) o;
return Objects.equals(orderId, that.orderId);
}
@Override
public int hashCode() {
return Objects.hashCode(orderId);
}
}
......@@ -416,4 +416,6 @@ public interface OrderQueryService {
* @return true 是拆单子订单 false 否
*/
boolean isSplitOrderChildren(OrderDO orderDO);
ContainerReportOrderPageResult<OrderCostSummaryDto> containerOrderSummary(ContainerReportOrderQueryVO query, PageVO page);
}
package cn.iocoder.yudao.module.order.vo.order;
import cn.iocoder.yudao.module.order.dto.FeeGroupDto;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
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 ContainerReportOrderPageResult<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<FeeGroupDto> receivableTotalFeeGroupDtoList = new ArrayList<>();
@ApiModelProperty(value = "优惠总金额货币分组列表")
private List<FeeGroupDto> discountTotalFeeGroupDtoList = new ArrayList<>();
@ApiModelProperty(value = "实收总金额货币分组列表")
private List<FeeGroupDto> netReceiptsTotalFeeGroupDtoList = new ArrayList<>();
@ApiModelProperty(value = "已收总金额货币分组列表")
private List<FeeGroupDto> writeOffTotalFeeGroupDtoList = new ArrayList<>();
@ApiModelProperty(value = "未收总金额货币分组列表")
private List<FeeGroupDto> notWriteOffTotalFeeGroupDtoList = new ArrayList<>();
@ApiModelProperty(value = "当页应收总金额货币分组列表")
private List<FeeGroupDto> pageReceivableTotalFeeGroupDtoList = new ArrayList<>();
@ApiModelProperty(value = "当页优惠总金额货币分组列表")
private List<FeeGroupDto> pageDiscountTotalFeeGroupDtoList = new ArrayList<>();
@ApiModelProperty(value = "当页实收总金额货币分组列表")
private List<FeeGroupDto> pageNetReceiptsTotalFeeGroupDtoList = new ArrayList<>();
@ApiModelProperty(value = "当页已收总金额货币分组列表")
private List<FeeGroupDto> pageWriteOffTotalFeeGroupDtoList = new ArrayList<>();
@ApiModelProperty(value = "当页未收总金额货币分组列表")
private List<FeeGroupDto> pageNotWriteOffTotalFeeGroupDtoList = new ArrayList<>();
public ContainerReportOrderPageResult() {
}
public ContainerReportOrderPageResult(List<T> list, long total) {
this.list = list;
this.total = total;
}
public ContainerReportOrderPageResult(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 ContainerReportOrderPageResult(long total) {
this.list = new ArrayList<>();
this.total = total;
}
public static <T> ContainerReportOrderPageResult<T> empty() {
return new ContainerReportOrderPageResult<>();
}
public static <T> ContainerReportOrderPageResult<T> empty(long total) {
return new ContainerReportOrderPageResult<>(total);
}
/****
* 分页转换
* @param pager
* @return
*/
public static <T> ContainerReportOrderPageResult<T> of(IPage<T> pager) {
return new ContainerReportOrderPageResult<>(pager.getRecords(), pager.getTotal(), pager.getSize(), pager.getCurrent(), pager.getPages());
}
/****
* 分页转换
* @param pager
* @return
*/
public static <T> ContainerReportOrderPageResult<T> of(PageInfo<T> pager) {
return new ContainerReportOrderPageResult<>(pager.getList(), pager.getTotal(), pager.getPageSize(), pager.getPageNum(), pager.getPages());
}
}
package cn.iocoder.yudao.module.order.vo.order;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotBlank;
import java.math.BigDecimal;
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 ContainerReportOrderQueryVO {
@ApiModelProperty(value = "自编号")
@NotBlank(message = "自编号不能为空")
private String containerNumber;
@ApiModelProperty(value = "订单编号")
private String orderNo;
@ApiModelProperty(value = "提单编号")
private String tidanNo;
@ApiModelProperty(value = "唛头")
private String marks;
@ApiModelProperty(value = "发货人客户编号,姓名、手机号搜索")
private String consignorKey;
@ApiModelProperty(value = "收货人客户编号,姓名、手机号搜索")
private String consigneeKey;
@ApiModelProperty(value = "始发仓IDs")
private List<Long> startWarehouseIds;
@ApiModelProperty(value = "目的仓IDs")
private List<Long> destWarehouseIds;
@ApiModelProperty(value = "目的国ids")
private List<Long> destCountryIds;
@ApiModelProperty(value = "目的地ids")
private List<Long> destCityIds;
@ApiModelProperty(value = "订单状态详情见字典:order_status")
private Integer status;
@ApiModelProperty(value = "是否重货")
private Boolean isHeavyCargo;
@ApiModelProperty(value = "是否泡货")
private Boolean isPaoCargo;
@ApiModelProperty(value = "订单类型")
private List<Integer> orderType;
@ApiModelProperty(value = "是否控货")
private Integer isCargoControl;
@ApiModelProperty(value = "不等于提货率")
private BigDecimal nePickRatio;
@ApiModelProperty(value = "小于等于提货率")
private BigDecimal lePickRatio;
@ApiModelProperty(value = "等于提货率")
private BigDecimal eqPickRatio;
@ApiModelProperty(value = "大于等于提货率")
private BigDecimal gePickRatio;
@ApiModelProperty(value = "开始放货锁定收货人到期时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date beginLockConsigneeTime;
@ApiModelProperty(value = "结束放货锁定收货人到期时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date endLockConsigneeTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始送货时间")
private Date beginDeliveryDate;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "结束送货时间")
private Date endDeliveryDate;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始入仓时间")
private Date beginRucangTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "结束入仓时间")
private Date endRucangTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始入仓记录时间")
private Date beginWarehouseInTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "结束入仓记录时间")
private Date endWarehouseInTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始到港时间")
private Date beginDaogangTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "结束到港时间")
private Date endDaogangTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始清关时间")
private Date beginQingguanTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "结束清关时间")
private Date endQingguanTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始已预装时间")
private Date beginPreLoadTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "结束已预装时间")
private Date endPreLoadTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始已装柜时间")
private Date beginLoadTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始出仓时间")
private Date beginOutboundTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "结束出仓时间")
private Date endOutboundTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始理货时间")
private Date beginTallyTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "结束理货时间")
private Date endTallyTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始出货时间")
private Date beginShippingTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "结束出货时间")
private Date endShippingTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "结束已装柜时间")
private Date endLoadTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始已卸柜时间")
private Date beginUnloadTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "结束已卸柜时间")
private Date endUnloadTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始提货时间")
private Date beginTakeTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "结束提货时间")
private Date endTakeTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始提货记录时间")
private Date beginPickUpTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "结束提货记录时间")
private Date endPickUpTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始拆单时间")
private Date beginSplitTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "结束拆单时间")
private Date endSplitTime;
@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;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始放货时间")
private Date beginReleaseTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "结束放货时间")
private Date endReleaseTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始复核时间")
private Date beginCheckTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "结束复核时间")
private Date endCheckTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始放货时间")
private Date beginPickTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "结束放货时间")
private Date endPickTime;
@ApiModelProperty(value = "语言")
private Integer lang;
}
package cn.iocoder.yudao.module.order.vo.order;
import cn.hutool.core.collection.CollectionUtil;
import cn.iocoder.yudao.framework.common.util.spring.enums.UserTypeEnum;
import cn.iocoder.yudao.framework.i18n.core.I18nMessage;
import cn.iocoder.yudao.module.order.dto.OrderRemindExceptionDto;
import cn.iocoder.yudao.module.order.enums.OrderAbnormalStateEnum;
......@@ -557,6 +558,15 @@ public class OrderBackPageVO {
@ApiModelProperty(value = "到仓重量")
private BigDecimal checkWeight;
@ApiModelProperty(value = "财务2.2-提单制作状态 2已完成")
private Integer billOfLadingStatus;
@ApiModelProperty(value = "财务2.2-到港时间")
private Date daogangTime;
@ApiModelProperty(value = "财务2.2-清关时间")
private Date qingguanTime;
public void setGuanLianOrderStatus(String guanLianOrderStatus) {
this.guanLianOrderStatus = guanLianOrderStatus;
......
......@@ -7594,5 +7594,176 @@
</if>
<include refid="orderQuery"/>
</select>
<select id="containerOrderSummaryList" resultType="cn.iocoder.yudao.module.order.vo.order.OrderBackPageVO">
SELECT
o.*,
w.start_warehouse_name,
w.dst_warehouse_name,
w.start_warehouse_id,
w.dst_warehouse_id,
bl.status as billOfLadingStatus,
norc.id as consignorCustomerId,
norc.number as consignorCustomerNumber,
norc.name as consignorName,
norc.name_en as consignorNameEn,
nor.phone as consignorPhone,
neeo.id as consigneeCustomerId,
neeo.name as consigneeName,
neeo.name_en as consigneeNameEn,
nee.phone as consigneePhone,
neeo.number as consigneeCustomerNumber,
(select su.nickname from system_user su where su.deleted = 0 and su.id = o.salesman_id) as salesman_name,
(select min(wi.`in_time`) from ecw_order_warehouse_in wi where wi.deleted = 0 and wi.order_id = o.order_id ) as in_time
FROM ecw_order o
LEFT JOIN (
SELECT
ewl.id AS line_id,
ew_start.id AS start_warehouse_id,
ew_dest.id AS dst_warehouse_id,
ew_start.title_zh AS start_title_zh,
IF( #{query.lang} = 0, ew_dest.title_zh, ew_dest.title_en ) AS dst_warehouse_name,
IF( #{query.lang} = 0, ew_start.title_zh, ew_start.title_en ) AS start_warehouse_name
FROM
ecw_warehouse_line ewl
LEFT JOIN ecw_warehouse ew_start ON ewl.start_warehouse_id = ew_start.id
LEFT JOIN ecw_warehouse ew_dest ON ewl.dest_warehouse_id = ew_dest.id
) w ON w.line_id = o.line_id
LEFT JOIN ecw_order_consignor nor on nor.order_id = o.order_id and nor.deleted = 0
LEFT JOIN ecw_order_consignee nee on nee.order_id = o.order_id and nee.deleted = 0
LEFT JOIN ecw_make_bill_of_lading bl on bl.order_id = o.order_id and bl.deleted = 0
LEFT JOIN ecw_customer norc on norc.id = nor.customer_id
LEFT JOIN ecw_customer neeo on neeo.id = nee.customer_id
WHERE o.`container_number` = #{query.containerNumber}
</select>
<sql id="containerOrderSummaryQuery">
<if test="query.orderNo != null and query.orderNo != '' ">
AND o.`order_no` like concat("%",concat(#{query.orderNo},"%"))
</if>
<if test="query.tidanNo != null and query.tidanNo != '' ">
AND o.`tidan_no` like concat("%",concat(#{query.tidanNo},"%"))
</if>
<if test="query.marks != null and query.marks != '' ">
AND o.`marks` like concat("%",concat(#{query.marks},"%"))
</if>
<if test="query.consignorKey != null and query.consignorKey != '' ">
AND (concat(IFNULL(nor.`name`,''),IFNULL(nor.`name_en`,''),IFNULL(nor.`phone`,'')) like
concat("%",concat(#{query.consignorKey},"%"))
OR nor.customer_id in (select c.id from ecw_customer c where c.number like
concat("%",concat(#{query.consignorKey},"%"))))
</if>
<if test="query.consigneeKey != null and query.consigneeKey != '' ">
AND (concat(IFNULL(nee.`name`,''),IFNULL(nee.`name_en`,''),IFNULL(nee.`phone`,'')) like
concat("%",concat(#{query.consigneeKey},"%"))
OR nee.customer_id in (select c.id from ecw_customer c where c.number like
concat("%",concat(#{query.consigneeKey},"%"))))
</if>
<if test="query.startWarehouseIds !=null and query.startWarehouseIds.size() > 0 and query.destWarehouseIds !=null and query.destWarehouseIds.size() > 0 ">
and (o.line_id in(
select whl.id
from ecw_warehouse_line whl
where whl.start_warehouse_id in
<foreach item='warehouseId' collection='query.startWarehouseIds' open='(' separator=',' close=')'>
#{warehouseId}
</foreach>
and whl.dest_warehouse_id in
<foreach item='destWarehouseId' collection='query.destWarehouseIds' open='(' separator=',' close=')'>
#{destWarehouseId}
</foreach>
))
</if>
<if test="query.startWarehouseIds !=null and query.startWarehouseIds.size() > 0 and (query.destWarehouseIds==null or query.destWarehouseIds.size() == 0) ">
and (o.line_id in(
select whl.id
from ecw_warehouse_line whl
where whl.start_warehouse_id in
<foreach item='warehouseId' collection='query.startWarehouseIds' open='(' separator=',' close=')'>
#{warehouseId}
</foreach>
))
</if>
<if test="(query.startWarehouseIds ==null or query.startWarehouseIds.size() == 0) and query.destWarehouseIds !=null and query.destWarehouseIds.size() > 0 ">
and (o.line_id in(
select whl.id
from ecw_warehouse_line whl
where whl.dest_warehouse_id in
<foreach item='destWarehouseId' collection='query.destWarehouseIds' open='(' separator=',' close=')'>
#{destWarehouseId}
</foreach>
))
</if>
<if test="query.destCountryIds != null and query.destCountryIds.size()>0 ">
AND ob.`objective_country_id` in
<foreach item='destCountryId' index='index' collection='query.destCountryIds' open='(' separator=',' close=')'>
#{destCountryId}
</foreach>
</if>
<if test="query.status != null">
AND o.`status` = #{query.status}
</if>
<if test="query.lePickRatio != null ">
AND o.pick_ratio <![CDATA[ <= ]]> #{query.lePickRatio}
</if>
<if test="query.gePickRatio != null ">
AND o.pick_ratio <![CDATA[ >= ]]> #{query.gePickRatio}
</if>
<if test="query.eqPickRatio != null ">
AND o.pick_ratio = #{query.eqPickRatio}
</if>
<if test="query.eqPickRatio != null ">
AND o.pick_ratio <![CDATA[ != ]]> #{query.eqPickRatio}
</if>
<if test="query.isCargoControl != null ">
AND o.is_cargo_control = #{query.isCargoControl}
</if>
<if test="query.orderType != null and query.orderType.size()>0 ">
AND o.`order_type` in
<foreach item='item' index='index' collection='query.orderType' open='(' separator=',' close=')'>
#{item}
</foreach>
</if>
<if test="query.beginRucangTime != null and query.endRucangTime != null ">
AND o.order_id in(select distinct wi.order_id from ecw_order_warehouse_in wi where wi.deleted = 0 and
wi.`in_time` between #{query.beginRucangTime} and #{query.endRucangTime})
</if>
<if test="query.beginQingguanTime != null and query.endQingguanTime != null ">
AND o.`qingguan_time` between #{query.beginQingguanTime} and #{query.endQingguanTime}
</if>
<if test="query.beginDaogangTime != null and query.endDaogangTime != null ">
AND o.`daogang_time` between #{query.beginDaogangTime} and #{query.endDaogangTime}
</if>
<if test="query.beginPreLoadTime != null and query.endPreLoadTime != null ">
AND o.`status` > 5 AND o.`pre_load_time` between #{query.beginPreLoadTime} and #{query.endPreLoadTime}
</if>
<if test="query.beginOutboundTime != null and query.endOutboundTime != null ">
AND o.`status` > 5 AND o.container_number in(select distinct b.self_no from ecw_box_air_checkout bc join ecw_box b ON bc.shipment_id = b.id
where b.deleted = 0 and bc.deleted = 0 and bc.`checkout_time` between #{query.beginOutboundTime} and #{query.endOutboundTime})
</if>
<if test="query.beginLoadTime != null and query.endLoadTime != null ">
AND o.`status` > 5 AND o.`load_time` between #{query.beginLoadTime} and #{query.endLoadTime}
</if>
<if test="query.beginUnloadTime != null and query.endUnloadTime != null ">
AND o.`status` > 5 AND o.`unload_time` between #{query.beginUnloadTime} and #{query.endUnloadTime}
</if>
<if test="query.beginTakeTime != null and query.endTakeTime != null ">
AND o.`status` > 19 AND o.`take_time` between #{query.beginTakeTime} and #{query.endTakeTime}
</if>
<if test="query.beginSplitTime != null and query.endSplitTime != null ">
AND o.`split_time` between #{query.beginSplitTime} and #{query.endSplitTime}
</if>
<if test="query.beginCreateTime != null and query.endCreateTime != null ">
AND o.`create_time` between #{query.beginCreateTime} and #{query.endCreateTime}
</if>
<if test="query.beginPickTime != null and query.endPickTime != null ">
AND o.order_id in(select distinct op.order_id from ecw_order_cargo_control_pick op where op.deleted = 0 and
op.status in(1,3) and op.`create_time` between #{query.beginPickTime} and #{query.endPickTime})
</if>
<if test="query.beginPickUpTime != null and query.endPickUpTime != null ">
AND o.order_no in(select distinct op.order_id from ecw_order_pickup op where op.deleted = 0 and
op.`create_time` between #{query.beginPickUpTime} and #{query.endPickUpTime})
</if>
<if test="query.beginWarehouseInTime != null and query.endWarehouseInTime != null ">
AND o.order_id in(select distinct wi.order_id from ecw_order_warehouse_in wi where wi.deleted = 0 and
wi.`update_time` between #{query.beginWarehouseInTime} and #{query.endWarehouseInTime})
</if>
</sql>
</mapper>
......@@ -8,6 +8,8 @@ import cn.iocoder.yudao.module.order.dto.OrderCostSummaryDto;
import cn.iocoder.yudao.module.order.dto.OrderDetailSummaryDto;
import cn.iocoder.yudao.module.order.service.order.OrderQueryService;
import cn.iocoder.yudao.module.order.service.orderException.OrderExceptionService;
import cn.iocoder.yudao.module.order.vo.order.ContainerReportOrderPageResult;
import cn.iocoder.yudao.module.order.vo.order.ContainerReportOrderQueryVO;
import cn.iocoder.yudao.module.order.vo.order.OrderBackPageVO;
import cn.iocoder.yudao.module.order.vo.order.OrderQueryVO;
import io.swagger.annotations.Api;
......@@ -17,10 +19,7 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.HashMap;
......@@ -81,4 +80,14 @@ public class OrderCountController {
return success(orderQueryService.orderDetailSummaryByOrderId(orderId));
}
@PostMapping("/containerNumber/orderSummary/new")
@ApiOperation("财务2.2-自编号的订单费用汇总")
public CommonResult<ContainerReportOrderPageResult<OrderCostSummaryDto>> orderSummaryNew(@RequestBody ContainerReportOrderQueryVO query, PageVO page) {
if (StringUtils.isBlank(query.getContainerNumber())) {
return error(CONTAINER_NUMBER_NOT_NULL);
}
ContainerReportOrderPageResult<OrderCostSummaryDto> summaryDtoPage = orderQueryService.containerOrderSummary(query, page);
return success(summaryDtoPage);
}
}
......@@ -22,6 +22,7 @@ import cn.iocoder.yudao.module.system.api.file.FileMakeApi;
import cn.iocoder.yudao.module.system.api.file.dto.FileMakeReqDTO;
import cn.iocoder.yudao.module.system.enums.download.DownloadTypeEnum;
import cn.iocoder.yudao.module.system.enums.sms.SmsNodeEnum;
import cn.iocoder.yudao.module.wealth.vo.receivable.ReceivableBoxReportQueryVO;
import com.alibaba.fastjson.JSONObject;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
......@@ -359,4 +360,22 @@ public class BoxController {
fileMakeApi.sendFileMake(reqDTO);
return success("");
}
@GetMapping("/export-shipment-summary/new")
@ApiOperation("导出自编号汇总列表 Excel")
@OperateLog(type = EXPORT)
public CommonResult exportOrderSummaryNew(ReceivableBoxReportQueryVO query, HttpServletResponse response) throws Exception {
FileMakeReqDTO reqDTO = new FileMakeReqDTO();
JSONObject jsonObject = new JSONObject();
jsonObject.put("query", JSONObject.toJSONString(query));
reqDTO.setType(DownloadTypeEnum.SHIPMENT_SUMMERY_EXCEL_EXPORT_NEW.getType());
reqDTO.setName("新出货应收报表");
reqDTO.setFileSuffix("xlsx");
reqDTO.setTemporaryFile(true);
reqDTO.setUserType(2);
reqDTO.setLang(I18nMessage.getLang());
reqDTO.setRequestParams(jsonObject.toJSONString());
fileMakeApi.sendFileMake(reqDTO);
return success("");
}
}
......@@ -187,6 +187,11 @@ public enum DownloadTypeEnum implements IntArrayValuable {
*/
CUSTOMER_FOLLOWUP_EXPORT(34),
/**
* 新应收报表导出
*/
SHIPMENT_SUMMERY_EXCEL_EXPORT_NEW(35)
// ....自己补充
;
......
......@@ -347,6 +347,10 @@ public class DownloadLogServiceImpl extends AbstractService<DownloadLogMapper, D
case SHIPMENT_SUMMERY_EXCEL_EXPORT:
shipmentSummeryExcelExportPushEvent(downloadLog);
break;
//新自编号应收报表导出
case SHIPMENT_SUMMERY_EXCEL_EXPORT_NEW:
shipmentSummeryNewExcelExportPushEvent(downloadLog);
break;
case SHIPMENT_SEA_PRELOAD_EXCEL_EXPORT:
//海运预装单导出
shipmentSeaPreloadExcelExportPushEvent(downloadLog);
......@@ -465,6 +469,20 @@ public class DownloadLogServiceImpl extends AbstractService<DownloadLogMapper, D
downloadLog.setFileId(event.getFileId());
}
private void shipmentSummeryNewExcelExportPushEvent(DownloadLogDO downloadLog) {
ShipmentSummeryNewExcelExportPushEvent event = new ShipmentSummeryNewExcelExportPushEvent();
event.setUserId(downloadLog.getUserId());
event.setUserType(downloadLog.getUserType());
event.setLang(downloadLog.getLang());
event.setRequestParams(downloadLog.getRequestParams());
applicationContext.publishEvent(event);
downloadLog.setFileName(event.getFileName());
downloadLog.setPath(event.getPath());
downloadLog.setDownloadUrl(event.getUrl());
downloadLog.setResult(event.getResult());
downloadLog.setFileId(event.getFileId());
}
private void airBillReceivableExcelExportPushEvent(DownloadLogDO downloadLog) {
AirBillReceivableExcelExportPushEvent event = new AirBillReceivableExcelExportPushEvent();
event.setUserId(downloadLog.getUserId());
......
......@@ -34,6 +34,10 @@ public class ReceiptItemDO extends BaseDO {
* 收款单id
*/
private Long receiptId;
/**
* 收款账号id
*/
private Long accountId;
/**
* 收款账号
*/
......
......@@ -173,5 +173,16 @@ public class ReceivableDO extends BaseDO {
* 备注
*/
private String remark;
/**
* 目的国相关币种id(用于报表,跟费用类型相关)
*/
private Long destCountryCurrencyId;
/**
* 目的国相关汇率(用于报表,跟费用类型相关)
*/
private BigDecimal destCountryRate;
/**
* 额外费用副币种汇率(用于报表,跟费用类型相关)
*/
private BigDecimal destCountrySubRate;
}
......@@ -16,7 +16,10 @@ import java.math.BigDecimal;
public class ReceivableWriteOffRecordDO extends BaseDO {
@TableId
private Long id;
private Long orderId;
private Long receivableId;
private Long receiptItemId;
private BigDecimal writeOffAmount;
private BigDecimal receivableWriteOffAmount;
private Integer incomeBelong;
}
......@@ -9,6 +9,7 @@ import cn.iocoder.yudao.module.wealth.vo.receiptItem.CurrencyAmount;
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 cn.iocoder.yudao.module.wealth.vo.receivable.ReceivableIncomeBelong;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
......@@ -17,6 +18,7 @@ import org.apache.ibatis.annotations.Select;
import java.math.BigDecimal;
import java.util.List;
import java.util.Set;
/**
* 收款单明细 Mapper
......@@ -99,4 +101,6 @@ public interface ReceiptItemMapper extends AbstractMapper<ReceiptItemDO> {
List<CurrencyAmount> countTotalActualAmount();
List<CurrencyAmount> countTotalWriteOffAmount();
List<ReceivableIncomeBelong> selectAllWriteOffItemByOrders(@Param("orderIds") Set<Long> orderIds);
}
......@@ -12,6 +12,7 @@ import org.apache.ibatis.annotations.*;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Set;
/**
* 应收款 Mapper
......@@ -428,4 +429,12 @@ public interface ReceivableMapper extends AbstractMapper<ReceivableDO> {
IPage<BatchGenReceiptReceivablePageVO> batchGenReceiptReceivablePage(IPage<BatchGenReceiptReceivablePageVO> mpPage, @Param("query") BatchGenReceiptReceivablePageQueryVO query);
List<CurrencyAmount> batchGenReceiptReceivablAmount(@Param("query") BatchGenReceiptReceivablePageQueryVO query);
List<ReceivableBoxReportPageVO> getReceivableBoxPage(@Param("query") ReceivableBoxReportQueryVO query);
List<ReceivebleBoxRelationOrder> getReceivableBoxRelationOrders(@Param("shipmentIdList") List<Long> shipmentIdList);
List<ReceivableDO> selectBoxReceivablesByOrderIds(@Param("orderIds") Set<Long> orderIds);
List<Long> getAllBoxId();
}
package cn.iocoder.yudao.module.wealth.enums;
public interface BoxReportConstant {
/**
* 自编号数据汇总缓存key
*/
String BOX_AMOUNT_CACHE = "wealth:report:boxAmount:";
/**
* 报表查询结果缓存key
*/
String BOX_REPORT_QUERY_CACHE = "wealth:report:query";
/**
* 报表查询条件缓存key
*/
String BOX_REPORT_QUERY_CONDITION_CACHE = "wealth:report:condition";
/**
* 本年度报表缓存
*/
String BOX_REPORT_CURRENT_YEAR_CACHE = "wealth:report:currentYear";
}
......@@ -216,40 +216,6 @@ public class FinanceReceiptApproveService {
receiptService.recordLog(receiptDO.getId(), ReceiptLinkEnum.REJECT_WRITE_OFF_RECEIPT, comment, WorkFlowEmus.FINANCE_RECEIPT_WRITE_OFF_NO.getValue());
} else if (StrUtil.equals(WorkFlowEmus.FINANCE_RECEIPT_ITEM_WRITE_OFF.getKey(), bmpKey)) {
//收款单明细核销审核
//if (null == receiptApprovalDO.getReceiptItemId()) {
// throw exception(RECEIPT_ITEM_NOT_FOUND);
//}
//ReceiptItemDO receiptItemDO = receiptItemMapper.selectById(receiptApprovalDO.getReceiptItemId());
//if (null == receiptItemDO) {
// throw exception(RECEIPT_ITEM_NOT_FOUND);
//}
//ReceiptItemDO updateReceiptItem = new ReceiptItemDO();
//updateReceiptItem.setId(receiptItemDO.getId());
//updateReceiptItem.setBmpStatus(result);
//if (result == BpmProcessInstanceResultEnum.APPROVE.getResult()) {
// updateReceiptItem.setStatus(ReceiptItemStatusEnum.WRITE_OFF.getValue());
// updateReceiptItem.setApprovalTime(new Date());
// //判断收款单状态如果是待核销状态-变成部分核销状态,其它 状态不变
// ReceiptDO receiptDO = receiptMapper.selectById(receiptItemDO.getReceiptId());
// if (null != receiptDO && receiptDO.getState().equals(ReceiptStatusEnum.WRITE_OFF_WAITING.getValue())) {
// ReceiptDO updateReceipt = new ReceiptDO();
// updateReceipt.setId(receiptDO.getId());
// updateReceipt.setState(ReceiptStatusEnum.WRITE_OFF_PART_ING.getValue());
// receiptMapper.updateById(updateReceipt);
//
// //更新收该收款单下的应收为收款中状态
// LambdaUpdateWrapper<ReceivableDO> lambdaUpdateWrapper = new LambdaUpdateWrapper();
// lambdaUpdateWrapper.eq(ReceivableDO::getReceiptId, receiptDO.getId());
// lambdaUpdateWrapper.set(ReceivableDO::getState, 1);
// receivableService.update(lambdaUpdateWrapper);
// }
// receiptService.updateReceiptItemStatus(receiptItemDO.getReceiptId());
//} else if (result == BpmProcessInstanceResultEnum.REJECT.getResult()) {
// updateReceiptItem.setStatus(ReceiptItemStatusEnum.WRITE_OFF_APPROVE_REJECT.getValue());
//} else if (result == BpmProcessInstanceResultEnum.CANCEL.getResult()) {
// updateReceiptItem.setStatus(ReceiptItemStatusEnum.DRAFT.getValue());
//}
//receiptItemMapper.updateById(updateReceiptItem);
applicationContext.publishEvent(new ReceiptItemWriteOffEvent(receiptApprovalDO.getReceiptItemId(), result, comment));
} else if (StrUtil.equals(WorkFlowEmus.FINANCE_RECEIPT_ITEM_WRITE_OFF_NO.getKey(), bmpKey)) {
//收款单明细核销反审核
......@@ -301,6 +267,7 @@ public class FinanceReceiptApproveService {
receiptItemMapper.update(null, updateWrapper);
}
receiptService.recordLog(receiptItemDO.getReceiptId(), ReceiptLinkEnum.REJECT_BANK_RECEIPT, comment, WorkFlowEmus.FINANCE_RECEIPT_ITEM_WRITE_OFF_NO.getValue());
// TODO 更新银行账号余额
}
ReceiptApprovalDO updateReceiptApproval = new ReceiptApprovalDO();
updateReceiptApproval.setId(receiptApprovalDO.getId());
......
......@@ -740,7 +740,7 @@ public class ReceiptServiceImpl extends AbstractService<ReceiptMapper, ReceiptDO
//bmpStatus
//PROCESS(1, "处理中"),APPROVE(2, "通过"),
//REJECT(3, "不通过"),CANCEL(4, "已取消");
long Item0 = listItem.stream().filter(i -> i.getStatus() == 0).filter(i -> i.getReceiptId() == ReceiptId).collect(Collectors.counting());
long Item0 = listItem.stream().filter(i -> i.getStatus() == 0 || i.getStatus() == 4).filter(i -> i.getReceiptId() == ReceiptId).collect(Collectors.counting());
long Item1 = listItem.stream().filter(i -> i.getStatus() == 1).filter(i -> i.getReceiptId() == ReceiptId).collect(Collectors.counting());
long Item2 = listItem.stream().filter(i -> i.getStatus() == 2).filter(i -> i.getReceiptId() == ReceiptId).collect(Collectors.counting());
long Item3 = listItem.stream().filter(i -> i.getStatus() == 3).filter(i -> i.getReceiptId() == ReceiptId).collect(Collectors.counting());
......@@ -1163,7 +1163,7 @@ public class ReceiptServiceImpl extends AbstractService<ReceiptMapper, ReceiptDO
if (countItem == 0) {
receiptItemStatus = ReceiptItemStatusInReceiptEnum.NO_INPUT;
} else {
long draft = listItem.stream().filter(i -> Objects.equals(i.getStatus(), DRAFT.getValue())).count();
long draft = listItem.stream().filter(i -> Objects.equals(i.getStatus(), DRAFT.getValue()) || Objects.equals(i.getStatus(), WRITE_OFF_APPROVE_REJECT.getValue())).count();
long writeOff = listItem.stream().filter(i -> Objects.equals(i.getStatus(), WRITE_OFF.getValue())).count();
long writeOffApproving = listItem.stream().filter(i -> Objects.equals(i.getStatus(), WRITE_OFF_APPROVE_ING.getValue())).count();
long writeOffNoApproving = listItem.stream().filter(i -> Objects.equals(i.getStatus(), WRITE_OFF_NO_APPROVE_ING.getValue())).count();
......
......@@ -56,7 +56,7 @@ public class BankReceiptDetailsImpl implements BankReceiptDetailsService {
}
r.setAttrList(getFileList(r.getAttr()));
if(r.getCreateBpm()==null|| r.getCreator().isEmpty()) {
if (r.getCreateBpm() == null || r.getCreator().isEmpty()) {
r.setCreateBpm("");
} else {
Long l2 = Long.parseLong(r.getCreateBpm());
......@@ -70,6 +70,9 @@ public class BankReceiptDetailsImpl implements BankReceiptDetailsService {
@Override
public BankIncomePageResult<BankIncomeItemResp> getBankIncomeItemPage(BankIncomeItemReq req) {
if (req.getIsIncome() != null && req.getIsIncome() == 1) {
return BankIncomePageResult.empty();
}
IPage<BankIncomeItemResp> mpPage = MyBatisUtils.buildPage(req);
bankReceiptDetailsMapper.getBankIncomeItemPage(mpPage, req);
if (mpPage.getTotal() == 0) {
......
......@@ -122,10 +122,11 @@ public class ReceiptItemServiceImpl extends AbstractService<ReceiptItemMapper, R
ReceiptItemDO receiptItem = ReceiptItemConvert.INSTANCE.convert(createReqVO);
receiptItem.setSerialNumber(wealthGenCodeUtils.generateReceiptItemCode());
receiptItemMapper.insert(receiptItem);
// 生成应收明细核销记录
BankAccountDTO account = bankApi.getBankAccountByAccountId(receiptItem.getAccountId());
Integer incomeBelong = account.getBaIncomeBelong();
for (ReceivableWriteOffReqVO receivableWriteOffReqVO : createReqVO.getReceivableWriteOffList()) {
receivableService.createWriteOffRecord(receivableWriteOffReqVO, receiptItem);
receivableService.createWriteOffRecord(receivableWriteOffReqVO, receiptItem, incomeBelong);
}
// TODO 校验当前收款单汇率是否过期,过期则更新为导入的汇率 没过期不更新?更新汇率后有效期是啥?
//if (receiptDO.getRateValidateDate().before(new Date())) {
......@@ -177,14 +178,15 @@ public class ReceiptItemServiceImpl extends AbstractService<ReceiptItemMapper, R
}
// 删除之前的核销记录
receivableService.deleteWriteOffRecord(receiptItemDO);
// 生成应收明细核销记录
for (ReceivableWriteOffReqVO receivableWriteOffReqVO : updateReqVO.getReceivableWriteOffList()) {
receivableService.createWriteOffRecord(receivableWriteOffReqVO, receiptItemDO);
}
// 更新
ReceiptItemDO updateObj = ReceiptItemConvert.INSTANCE.convert(updateReqVO);
receiptItemMapper.updateById(updateObj);
BankAccountDTO account = bankApi.getBankAccountByAccountId(updateObj.getAccountId());
Integer incomeBelong = account.getBaIncomeBelong();
// 生成应收明细核销记录
for (ReceivableWriteOffReqVO receivableWriteOffReqVO : updateReqVO.getReceivableWriteOffList()) {
receivableService.createWriteOffRecord(receivableWriteOffReqVO, receiptItemDO, incomeBelong);
}
}
/*
......@@ -243,7 +245,7 @@ public class ReceiptItemServiceImpl extends AbstractService<ReceiptItemMapper, R
@Override
@Transactional(rollbackFor = Exception.class)
public void verification(Long id, Integer bpmResult,String comment) {
public void verification(Long id, Integer bpmResult, String comment) {
//收款单明细核销审核
if (null == id) {
throw exception(RECEIPT_ITEM_NOT_FOUND);
......@@ -279,12 +281,18 @@ public class ReceiptItemServiceImpl extends AbstractService<ReceiptItemMapper, R
receivableDO.setState(1);
ReceivableWriteOffRecordDO receivableWriteOffRecordDO = receivableService.getReceivableWriteOffRecord(receivableDO.getId(), receiptItemDO.getId());
if (null != receivableWriteOffRecordDO) {
BigDecimal writeOffCurrent = receivableWriteOffRecordDO.getWriteOffAmount().divide(receivableDO.getExchangeRate(),4, RoundingMode.HALF_UP);
BigDecimal writeOffCurrent = receivableWriteOffRecordDO.getWriteOffAmount().divide(receivableDO.getExchangeRate(), 4, RoundingMode.HALF_UP);
receivableDO.setWriteOffAmount(receivableDO.getWriteOffAmount().add(writeOffCurrent));
}
}
receivableService.updateBatchById(receivableDOS);
receiptService.updateReceiptItemStatus(receiptItemDO.getReceiptId());
// 更新银行账户余额
bankApi.updateBankAccountBalance(BankAccountDTO.builder()
.baAccountName(receiptItemDO.getAccountName())
.baAccountNum(receiptItemDO.getAccountNo())
.baBankName(receiptItemDO.getAccountBankName())
.baBalance(receiptItemDO.getAmount()).build(), true);
}
// 审核拒绝
else if (Objects.equals(bpmResult, BpmProcessInstanceResultEnum.REJECT.getResult())) {
......@@ -677,7 +685,7 @@ public class ReceiptItemServiceImpl extends AbstractService<ReceiptItemMapper, R
});
throw exception(new ErrorCode(haveError ? 1004520042 : 1004520043, errorMsg.toString()));
}
ReceiptItemService proxy = (ReceiptItemService)AopContext.currentProxy();
ReceiptItemService proxy = (ReceiptItemService) AopContext.currentProxy();
for (ReceiptItemCreateReqVO receiptItemCreateReqVO : receiptItemCreateReqVOS) {
// 计算每条应收明细的核销金额
List<ReceivableInItemVO> listForCreateReceiptItem = receivableService.getListForCreateReceiptItem(receiptItemCreateReqVO.getReceiptId());
......@@ -741,8 +749,8 @@ public class ReceiptItemServiceImpl extends AbstractService<ReceiptItemMapper, R
ReceiptItemBackVO itemBackVO = ReceiptItemConvert.INSTANCE.convert(receiptItemDO);
ReceiptDO receiptDO = receiptMapper.selectById(receiptItemDO.getReceiptId());
itemBackVO.setReceiptNo(receiptDO.getReceiptNo());
List<ReceivableInItemVO> listForCreateReceiptItem = receivableService.getReceivableByReceiptItem(receiptItemDO.getId());
itemBackVO.setReceivableList(listForCreateReceiptItem);
List<ReceivableInItemVO> receivableList = receivableService.getReceivableByReceiptItem(receiptItemDO.getId());
itemBackVO.setReceivableList(receivableList);
return itemBackVO;
}
......@@ -872,6 +880,7 @@ public class ReceiptItemServiceImpl extends AbstractService<ReceiptItemMapper, R
// 生成创建明细
ReceiptItemCreateReqVO receiptItemCreateReqVO = new ReceiptItemCreateReqVO();
receiptItemCreateReqVO.setReceiptId(matchReceiptDO.getId());
receiptItemCreateReqVO.setAccountId(batchCreateReqVO.getAccountId());
receiptItemCreateReqVO.setAccountNo(batchCreateReqVO.getPayAccount());
receiptItemCreateReqVO.setAccountName(batchCreateReqVO.getAccountName());
receiptItemCreateReqVO.setAccountBankName(batchCreateReqVO.getAccountBankName());
......@@ -955,6 +964,7 @@ public class ReceiptItemServiceImpl extends AbstractService<ReceiptItemMapper, R
if (null == account) {
return new ReceiptItemBatchRespVO(createReqVO.getOrderNo(), createReqVO.getPayer(), 0, "收款账号不存在");
}
createReqVO.setAccountId(account.getId());
createReqVO.setAccountName(account.getBaAccountName());
createReqVO.setAccountBankName(account.getBaBankName());
if (account.getBaCurrency() != null && !allCurrency.get(account.getBaCurrency()).getFuhao().equals(createReqVO.getPayCurrency())) {
......
......@@ -271,7 +271,7 @@ public interface ReceivableService extends IService<ReceivableDO> {
Long getDestCountryCurrencyId(Long orderId);
void createWriteOffRecord(ReceivableWriteOffReqVO receivableWriteOffReqVO, ReceiptItemDO receiptItem);
void createWriteOffRecord(ReceivableWriteOffReqVO receivableWriteOffReqVO, ReceiptItemDO receiptItem, Integer incomeBelong);
ReceivableWriteOffRecordDO getReceivableWriteOffRecord(Long receivableId, Long receiptItemId);
......@@ -282,4 +282,8 @@ public interface ReceivableService extends IService<ReceivableDO> {
List<ReceivableInItemVO> getReceivableByReceiptItem(Long receiptItemId);
ReceivablePageResult<BatchGenReceiptReceivablePageVO> batchGenReceiptReceivablePage(BatchGenReceiptReceivablePageQueryVO query, PageVO page);
ReceivableBoxReportVO getReceivableBoxReport(@Valid ReceivableBoxReportQueryVO query, PageVO page);
void updateBoxAmountCache(List<Long> shipmentIdList, boolean isForceUpdate);
}
......@@ -29,6 +29,10 @@ public class ReceiptItemBatchCreateReqVO {
@ExcelProperty("收款日期")
private String payDate;
@ApiModelProperty(value = "收款账号id")
@ExcelIgnore
private Long accountId;
@ApiModelProperty(value = "收款账号")
@ExcelProperty("收款账号")
private String payAccount;
......
......@@ -23,6 +23,9 @@ public class ReceiptItemBaseVO {
@ApiModelProperty(value = "收款单id")
private Long receiptId;
@ApiModelProperty(value = "收款账号id")
private Long accountId;
@ApiModelProperty(value = "收款账号")
private String accountNo;
......
......@@ -40,6 +40,9 @@ public class BatchGenReceiptPageVO {
@ApiModelProperty(value = "付款人id")
private Long payerId;
@ApiModelProperty(value = "是否开票 0否1是")
private Integer openInvoice;
@ApiModelProperty(value = "客户编号")
private String customerNo;
......
package cn.iocoder.yudao.module.wealth.vo.receivable;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.Objects;
@Data
@ApiModel("分页结果")
public class ReceivableBoxReportPageVO implements Serializable {
@ApiModelProperty(value = "自编号id")
private Long id;
@ApiModelProperty(value = "自编号")
private String selfNo;
@ApiModelProperty(value = "目的国id")
private Long destCountryId;
@ApiModelProperty(value = "订单数量")
private Integer orderCount;
@ApiModelProperty(value = "提单数量")
private Integer ladingCount;
@ApiModelProperty(value = "字典settlement_status,191-未结算,192-结算中,193-已结算")
private Integer slStatus;
@ApiModelProperty(value = "结算时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date slSettledTime;
@ApiModelProperty(value = "核销比例")
private String writeOffPercent;
@ApiModelProperty(value = "提单制作,未完成/部分完成/已完成")
private Integer ladingBillStatus;
@ApiModelProperty(value = "到港时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date dgDate;
@ApiModelProperty(value = "清关时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date qgDate;
@ApiModelProperty(value = "卸柜/到仓时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date ulWarehouseTime;
@ApiModelProperty(value = "应收款-汇总")
private String receivableTotalSummary;
@ApiModelProperty(value = "应收款-结算")
private String receivableTotalSettle;
@ApiModelProperty(value = "应收款明细-运费")
private String receivableDetailFreight;
@ApiModelProperty(value = "应收款明细-清关费")
private String receivableDetailClearance;
@ApiModelProperty(value = "应收款明细-额外费用")
private String receivableDetailOtherFee;
@ApiModelProperty(value = "目的国实收-运费")
private String receivableDestCountryFreight;
@ApiModelProperty(value = "目的国实收-清关费")
private String receivableDestCountryClearance;
@ApiModelProperty(value = "目的国实收-额外费用")
private String receivableDestCountryOtherFee;
@ApiModelProperty(value = "目的国实收-额外费用(副币种)")
private String receivableDestCountryOtherFeeSub;
@ApiModelProperty(value = "始发国实收-运费")
private String receivableStartCountryFreight;
@ApiModelProperty(value = "始发国实收-清关费")
private String receivableStartCountryClearance;
@ApiModelProperty(value = "始发国实收-额外费用")
private String receivableStartCountryOtherFee;
@ApiModelProperty(value = "始发国实收-额外费用(副币种)")
private String receivableStartCountryOtherFeeSub;
@ApiModelProperty(value = "折扣-运费")
private String receivableDiscountFreight;
@ApiModelProperty(value = "折扣-清关费")
private String receivableDiscountClearance;
@ApiModelProperty(value = "折扣-额外费用")
private String receivableDiscountOtherFee;
@ApiModelProperty(value = "未收款明细-运费")
private String receivableUnsettledFreight;
@ApiModelProperty(value = "未收款明细-清关费")
private String receivableUnsettledClearance;
@ApiModelProperty(value = "未收款明细-额外费用")
private String receivableUnsettledOtherFee;
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ReceivableBoxReportPageVO that = (ReceivableBoxReportPageVO) o;
return Objects.equals(id, that.id);
}
@Override
public int hashCode() {
return Objects.hashCode(id);
}
}
package cn.iocoder.yudao.module.wealth.vo.receivable;
import cn.hutool.core.collection.CollectionUtil;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Data
public class ReceivableBoxReportQueryVO {
@ApiModelProperty(value = "自编号")
private String selfNo;
@ApiModelProperty(value = "始发地id列表")
private List<Long> startWarehouseIdList;
@ApiModelProperty(value = "目的国家ID")
private List<Long> destCountryId;
@ApiModelProperty(value = "目的城市ID")
private List<Long> destCity;
@ApiModelProperty(value = "目的仓库id列表")
private List<Long> destWarehouseIdList;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始结算时间")
private Date beginJsDate;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "结束结算时间")
private Date endJsDate;
@ApiModelProperty(value = "191-未结算,192-结算中,193-已结算")
private Integer slStatus;
@ApiModelProperty(value = "出货状态")
private Integer boxStatus;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始到港时间")
private Date beginDaogangTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "结束到港时间")
private Date endDaogangTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始清关时间")
private Date beginQingguanTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "结束清关时间")
private Date endQingguanTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始卸柜/到仓时间")
private Date beginUlWarehouseTime ;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "结束卸柜/到仓时间")
private Date endUlWarehouseTime ;
@ApiModelProperty(value = "提单制作,0-未完成,1-部分完成,2-已完成")
private Integer ladingBillStatus;
@ApiModelProperty(value = "结算时间排序(默认倒序)")
private Boolean jsTimeDesc = true;
@ApiModelProperty(value = "卸柜/到仓时间排序(默认倒序)")
private Boolean ulWarehouseTimeDesc = true;
@ApiModelProperty(value = "清关时间排序(默认倒序)")
private Boolean qingguanTimeDesc = true;
@ApiModelProperty(value = "到港时间排序(默认倒序)")
private Boolean daogangTimeDesc = true;
private Boolean forceUpdateCache = false;
public Boolean isEmpty() {
return StringUtils.isBlank(selfNo)
&& (CollectionUtil.isEmpty(startWarehouseIdList))
&& (CollectionUtil.isEmpty(destCountryId))
&& (CollectionUtil.isEmpty(destCity))
&& (CollectionUtil.isEmpty(destWarehouseIdList))
&& (beginJsDate == null)
&& (endJsDate == null)
&& (slStatus == null)
&& (boxStatus == null)
&& (beginDaogangTime == null)
&& (endDaogangTime == null)
&& (beginQingguanTime == null)
&& (endQingguanTime == null)
&& (beginUlWarehouseTime == null)
&& (endUlWarehouseTime == null)
&& (ladingBillStatus == null);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ReceivableBoxReportQueryVO that = (ReceivableBoxReportQueryVO) o;
return Objects.equals(selfNo, that.selfNo) &&
// 比较两个list中的元素相同
CollectionUtil.isEqualList(startWarehouseIdList, that.startWarehouseIdList) &&
CollectionUtil.isEqualList(destCountryId, that.destCountryId) &&
CollectionUtil.isEqualList(destCity, that.destCity) &&
CollectionUtil.isEqualList(destWarehouseIdList, that.destWarehouseIdList) &&
Objects.equals(beginJsDate, that.beginJsDate) && Objects.equals(endJsDate, that.endJsDate) && Objects.equals(slStatus, that.slStatus) && Objects.equals(boxStatus, that.boxStatus) && Objects.equals(beginDaogangTime, that.beginDaogangTime) && Objects.equals(endDaogangTime, that.endDaogangTime) && Objects.equals(beginQingguanTime, that.beginQingguanTime) && Objects.equals(endQingguanTime, that.endQingguanTime) && Objects.equals(beginUlWarehouseTime, that.beginUlWarehouseTime) && Objects.equals(endUlWarehouseTime, that.endUlWarehouseTime) && Objects.equals(ladingBillStatus, that.ladingBillStatus) && Objects.equals(jsTimeDesc, that.jsTimeDesc) && Objects.equals(ulWarehouseTimeDesc, that.ulWarehouseTimeDesc) && Objects.equals(qingguanTimeDesc, that.qingguanTimeDesc) && Objects.equals(daogangTimeDesc, that.daogangTimeDesc);
}
@Override
public int hashCode() {
return Objects.hash(selfNo, startWarehouseIdList, destCountryId, destCity, destWarehouseIdList, beginJsDate, endJsDate, slStatus, boxStatus, beginDaogangTime, endDaogangTime, beginQingguanTime, endQingguanTime, beginUlWarehouseTime, endUlWarehouseTime, ladingBillStatus, jsTimeDesc, ulWarehouseTimeDesc, qingguanTimeDesc, daogangTimeDesc);
}
}
package cn.iocoder.yudao.module.wealth.vo.receivable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
@Data
@ApiModel("应收报表分页结果")
@Builder
@NoArgsConstructor
@AllArgsConstructor
public final class ReceivableBoxReportVO implements Serializable {
@ApiModelProperty(value = "数据", required = true)
private List<ReceivableBoxReportPageVO> list;
@ApiModelProperty(value = "当页汇总", required = true)
private Amount pageAmount;
@ApiModelProperty(value = "查询条件汇总", required = true)
private Amount queryAmount;
@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;
@Data
public static class Amount {
@ApiModelProperty(value = "应收款-汇总")
private List<ReceivableCurrencyAmount> receivableTotalSummary = new ArrayList<>();
@ApiModelProperty(value = "应收款-结算")
private List<ReceivableCurrencyAmount> receivableTotalSettle = new ArrayList<>();
@ApiModelProperty(value = "应收款明细-运费")
private List<ReceivableCurrencyAmount> receivableDetailFreight = new ArrayList<>();
@ApiModelProperty(value = "应收款明细-清关费")
private List<ReceivableCurrencyAmount> receivableDetailClearance = new ArrayList<>();
@ApiModelProperty(value = "应收款明细-额外费用")
private List<ReceivableCurrencyAmount> receivableDetailOtherFee = new ArrayList<>();
@ApiModelProperty(value = "目的国实收-运费")
private List<ReceivableCurrencyAmount> receivableDestCountryFreight = new ArrayList<>();
@ApiModelProperty(value = "目的国实收-清关费")
private List<ReceivableCurrencyAmount> receivableDestCountryClearance = new ArrayList<>();
@ApiModelProperty(value = "目的国实收-额外费用")
private List<ReceivableCurrencyAmount> receivableDestCountryOtherFee = new ArrayList<>();
@ApiModelProperty(value = "目的国实收-额外费用(副币种)")
private List<ReceivableCurrencyAmount> receivableDestCountryOtherFeeSub = new ArrayList<>();
@ApiModelProperty(value = "始发国实收-运费")
private List<ReceivableCurrencyAmount> receivableStartCountryFreight = new ArrayList<>();
@ApiModelProperty(value = "始发国实收-清关费")
private List<ReceivableCurrencyAmount> receivableStartCountryClearance = new ArrayList<>();
@ApiModelProperty(value = "始发国实收-额外费用")
private List<ReceivableCurrencyAmount> receivableStartCountryOtherFee = new ArrayList<>();
@ApiModelProperty(value = "始发国实收-额外费用(副币种)")
private List<ReceivableCurrencyAmount> receivableStartCountryOtherFeeSub = new ArrayList<>();
@ApiModelProperty(value = "折扣-运费")
private List<ReceivableCurrencyAmount> receivableDiscountFreight = new ArrayList<>();
@ApiModelProperty(value = "折扣-清关费")
private List<ReceivableCurrencyAmount> receivableDiscountClearance = new ArrayList<>();
@ApiModelProperty(value = "折扣-额外费用")
private List<ReceivableCurrencyAmount> receivableDiscountOtherFee = new ArrayList<>();
@ApiModelProperty(value = "未收款明细-运费")
private List<ReceivableCurrencyAmount> receivableUnsettledFreight = new ArrayList<>();
@ApiModelProperty(value = "未收款明细-清关费")
private List<ReceivableCurrencyAmount> receivableUnsettledClearance = new ArrayList<>();
@ApiModelProperty(value = "未收款明细-额外费用")
private List<ReceivableCurrencyAmount> receivableUnsettledOtherFee = new ArrayList<>();
}
}
package cn.iocoder.yudao.module.wealth.vo.receivable;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Objects;
@Data
public class ReceivableCurrencyAmount {
@ApiModelProperty(value = "币种id")
private Long currencyId;
@ApiModelProperty(value = "金额")
private BigDecimal amount;
public ReceivableCurrencyAmount(Long currencyId, BigDecimal amount) {
this.currencyId = currencyId;
this.amount = amount;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ReceivableCurrencyAmount that = (ReceivableCurrencyAmount) o;
return Objects.equals(currencyId, that.currencyId);
}
@Override
public int hashCode() {
return Objects.hashCode(currencyId);
}
public void addAmount(BigDecimal amount) {
this.amount = this.amount.add(amount);
}
}
\ No newline at end of file
package cn.iocoder.yudao.module.wealth.vo.receivable;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class ReceivableIncomeBelong {
private Long receivableId;
/**
* 收款归属 0 目的国,1 始发国
*/
private Integer incomeBelong;
private BigDecimal writeOffAmount;
}
package cn.iocoder.yudao.module.wealth.vo.receivable;
import lombok.Data;
@Data
public class ReceivebleBoxRelationOrder {
private Long orderId;
private Long shipmentId;
private Long destCountryId;
}
package cn.iocoder.yudao.module.wealth.controller.admin.job;
import cn.hutool.core.collection.CollectionUtil;
import cn.iocoder.yudao.framework.redis.helper.RedisHelper;
import cn.iocoder.yudao.module.wealth.dal.mysql.receivable.ReceivableMapper;
import cn.iocoder.yudao.module.wealth.service.receivable.ReceivableService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.module.wealth.enums.BoxReportConstant.BOX_AMOUNT_CACHE;
@Component
@Slf4j
@AllArgsConstructor
public class BoxReportCacheLoader implements ApplicationRunner {
private final ReceivableService receivableService;
private final ReceivableMapper receivableMapper;
private final RedisHelper redisHelper;
@Override
public void run(ApplicationArguments args) throws Exception {
log.info("初始化应收报表缓存");
List<Long> boxIds = receivableMapper.getAllBoxId();
Set<String> keys = redisHelper.keys(BOX_AMOUNT_CACHE + "*");
if (CollectionUtil.isNotEmpty(keys)) {
List<Long> cacheBoxIds = keys.stream().map(key -> Long.parseLong(key.replace(BOX_AMOUNT_CACHE, ""))).collect(Collectors.toList());
boxIds = boxIds.stream().filter(boxId -> !cacheBoxIds.contains(boxId)).collect(Collectors.toList());
}
receivableService.updateBoxAmountCache(boxIds, false);
log.info("初始化应收报表缓存完成");
}
}
......@@ -311,6 +311,7 @@ public class ReceiptController {
@PostMapping("/batch-gen-receipt")
@ApiOperation("批量生成收款单")
@Idempotent(timeout = 5)
public CommonResult<List<ReceiptBatchGenRespVO>> batchGenReceipt(@RequestBody List<ReceiptBatchCreateReqVO> createReqVOList) {
return success(receiptService.batchGenReceipt(createReqVOList));
}
......
......@@ -70,9 +70,6 @@ public class ReceiptItemController {
@Resource
private ReceiptApprovalMapper receiptApprovalMapper;
@Resource
private BankApi bankApi;
@PostMapping("/create")
@ApiOperation("创建收款明细")
//@PreAuthorize("@ss.hasPermission('ecw:receipt-item:create')")
......@@ -102,8 +99,6 @@ public class ReceiptItemController {
@ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
public CommonResult<ReceiptItemBackVO> getReceiptItemDetail(@RequestParam("id") Long id) {
ReceiptItemBackVO receiptItemVO = receiptItemService.getReceiptItemDetail(id);
BankAccountDTO account = bankApi.getBankAccountByAccountNo(receiptItemVO.getAccountNo());
receiptItemVO.setAccountId(account.getId());
getSY(receiptItemVO, receiptItemVO.getReceiptId());
SetData(receiptItemVO);
return success(receiptItemVO);
......@@ -214,12 +209,7 @@ public class ReceiptItemController {
LambdaQueryWrapper<ReceiptItemDO> lambdaQueryWrapper = new LambdaQueryWrapper();
lambdaQueryWrapper.eq(ReceiptItemDO::getReceiptId, id);
List<ReceiptItemDO> list = receiptItemService.list(lambdaQueryWrapper);
List<ReceiptItemBackVO> receiptItemBackVOS = ReceiptItemConvert.INSTANCE.convertList(list);
receiptItemBackVOS.forEach(vo -> {
BankAccountDTO account = bankApi.getBankAccountByAccountNo(vo.getAccountNo());
vo.setAccountId(account.getId());
});
return success(receiptItemBackVOS);
return success(ReceiptItemConvert.INSTANCE.convertList(list));
}
@PostMapping("/review/page")
......@@ -315,6 +305,7 @@ public class ReceiptItemController {
@PostMapping(value = "/import", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
@ApiOperation("批量银行收款信息导入")
@Idempotent(timeout = 5)
public CommonResult<List<ReceiptItemBatchRespVO>> receiptAccountImport(@RequestPart("file") MultipartFile file, @RequestParam(value = "ignoreItem") Boolean ignoreItem) throws IOException {
List<ReceiptItemBatchCreateReqVO> list = ExcelUtils.read(file, ReceiptItemBatchCreateReqVO.class);
return success(receiptItemService.receiptItemImport(list, ignoreItem));
......
......@@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.wealth.controller.admin.receivable;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.idempotent.core.annotation.Idempotent;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.module.wealth.convert.receivableDiscount.ReceivableDiscountConvert;
import cn.iocoder.yudao.module.wealth.dal.dataobject.receivableDiscount.ReceivableDiscountDO;
......@@ -116,6 +117,7 @@ public class ReceivableController {
public CommonResult<ReceivablePageResult<BatchGenReceiptReceivablePageVO>> batchGenReceiptReceivablePage(@Valid @RequestBody BatchGenReceiptReceivablePageQueryVO query, PageVO page) {
return success(receivableService.batchGenReceiptReceivablePage(query, page));
}
@GetMapping("/getListForReceiptItem")
@ApiOperation("财务-创建收款明细获取应收明细")
public CommonResult<List<ReceivableInItemVO>> getListForCreateReceiptItem(Long receiptId) {
......@@ -127,51 +129,11 @@ public class ReceivableController {
public CommonResult<List<ReceivableInItemVO>> getReceivableByReceiptItem(Long receiptItemId) {
return success(receivableService.getReceivableByReceiptItem(receiptItemId));
}
/*
@GetMapping("/list")
@ApiOperation("根据id集合获得应收款列表")
@ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class)
//@PreAuthorize("@ss.hasPermission('ecw:receivable:query')")
public CommonResult<List<ReceivableBackVO>> receivableList(@RequestParam("ids") List<Long> ids) {
List<ReceivableBackVO> list = receivableService.receivableList(ids);
return success(list);
}*/
/*
@GetMapping("/export-excel")
@ApiOperation("导出应收款 Excel")
//@PreAuthorize("@ss.hasPermission('ecw:receivable:export')")
@OperateLog(type = EXPORT)
public void exportReceivableExcel(@Valid ReceivableQueryVO query,
HttpServletResponse response) throws IOException {
List<ReceivableDO> list = receivableService.getReceivableList(query);
// 导出 Excel
List<ReceivableBackVO> datas = ReceivableConvert.INSTANCE.convertList(list);
ExcelUtils.write(response, "应收款.xls", "数据", ReceivableBackVO.class, datas);
}*/
// @PostMapping("/create")
// @ApiOperation("创建应收款")
// //@PreAuthorize("@ss.hasPermission('ecw:receivable:create')")
// public CommonResult<Long> createReceivable(@Valid @RequestBody ReceivableCreateReqVO createReqVO) {
// return success(receivableService.createReceivable(createReqVO));
// }
// @PutMapping("/update")
// @ApiOperation("更新应收款")
// //@PreAuthorize("@ss.hasPermission('ecw:receivable:update')")
// public CommonResult<Boolean> updateReceivable(@Valid @RequestBody ReceivableUpdateReqVO updateReqVO) {
// receivableService.updateReceivable(updateReqVO);
// return success(true);
// }
// @DeleteMapping("/delete")
// @ApiOperation("删除应收款")
// @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
// //@PreAuthorize("@ss.hasPermission('ecw:receivable:delete')")
// public CommonResult<Boolean> deleteReceivable(@RequestParam("id") Long id) {
// receivableService.deleteReceivable(id);
// return success(true);
// }
@PostMapping("/box/report")
@ApiOperation("财务-应收报表")
@Idempotent(timeout = 5)
public CommonResult<ReceivableBoxReportVO> getReceivableBoxReport(@Valid @RequestBody ReceivableBoxReportQueryVO query, PageVO page) {
return success(receivableService.getReceivableBoxReport(query, page));
}
}
......@@ -102,7 +102,7 @@
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 eo ON eo.order_id = rb.order_id
LEFT JOIN ecw_receipt_account era ON era.receipt_id = eri.receipt_id
LEFT JOIN ecw_bank_account eba ON eba.ba_account_num = eri.account_no
WHERE eri.status = 1
<include refid="incomePageCondition"/>
GROUP BY eri.id
......
......@@ -18,7 +18,6 @@
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
......@@ -53,7 +52,7 @@
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
AND eri.account_id IN
<foreach collection="query.accountId" item="account" open="(" separator="," close=")">
#{account}
</foreach>
......@@ -78,7 +77,6 @@
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
......@@ -106,4 +104,19 @@
WHERE eri.deleted = 0 AND eri.bmp_status = 1
GROUP BY eri.write_off_currency_id
</select>
<select id="selectAllWriteOffItemByOrders" resultType="cn.iocoder.yudao.module.wealth.vo.receivable.ReceivableIncomeBelong">
SELECT
erwor.receivable_id,
erwor.income_belong,
SUM(erwor.receivable_write_off_amount) AS write_off_amount
FROM ecw_receivable_write_off_record erwor
LEFT JOIN ecw_receipt_item eri ON erwor.receipt_item_id = eri.id
WHERE
erwor.order_id IN
<foreach collection="orderIds" item="orderId" open="(" separator="," close=")">
#{orderId}
</foreach>
AND eri.status = 1 AND eri.deleted = 0
GROUP BY erwor.receivable_id, erwor.income_belong
</select>
</mapper>
......@@ -37,10 +37,8 @@
</if>
WHERE er.deleted = 0
<include refid="pageCondition"/>
ORDER BY er.create_time DESC
<if test="query.numberNo != null and query.numberNo != ''">
GROUP BY er.receipt_no
</if>
GROUP BY er.receipt_no
ORDER BY MAX(er.create_time) DESC
LIMIT #{start}, #{size}
</select>
<select id="getOrderInfoByReceiptId"
......
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