Commit 094ad590 authored by zhangfeng's avatar zhangfeng

feat(wealth): 开票管理,收款单对应多订单

parent ac16eac2
......@@ -13,4 +13,7 @@ public class RegionDTO {
@ApiModelProperty(value = "英文")
private String titleEn;
@ApiModelProperty(value = "进口国应收额币种")
private String importCurrency5;
}
......@@ -36,6 +36,7 @@ public class RegionApiImpl implements RegionApi {
regionDTO.setId(regionDO.getId());
regionDTO.setTitleZh(regionDO.getTitleZh());
regionDTO.setTitleEn(regionDO.getTitleEn());
regionDTO.setImportCurrency5(regionDO.getImportCurrency5());
return regionDTO;
}
return null;
......
......@@ -41,4 +41,9 @@ public interface OrderApi {
* @param orderNo
*/
OrderRespDTO getOrderByNo(String orderNo);
/**
* 根据订单号获取目的国
*/
Long getDestCountryByOrderId(Long orderId);
}
......@@ -11,6 +11,7 @@ import cn.iocoder.yudao.module.order.dal.dataobject.orderConsignee.OrderConsigne
import cn.iocoder.yudao.module.order.dal.dataobject.orderConsignor.OrderConsignorDO;
import cn.iocoder.yudao.module.order.dal.dataobject.orderItem.OrderItemDO;
import cn.iocoder.yudao.module.order.dal.dataobject.orderObjective.OrderObjectiveDO;
import cn.iocoder.yudao.module.order.dal.mysql.order.OrderMapper;
import cn.iocoder.yudao.module.order.service.order.*;
import cn.iocoder.yudao.module.order.service.order.impl.OrderItemServiceImpl;
import cn.iocoder.yudao.module.order.service.orderOperateLog.OrderOperateLogService;
......@@ -37,6 +38,8 @@ public class OrderApiImpl implements OrderApi {
@Resource
private OrderService orderService;
@Resource
private OrderMapper orderMapper;
@Resource
private OrderBusinessService orderBusinessService;
@Resource
private CustomerService customerService;
......@@ -192,4 +195,10 @@ public class OrderApiImpl implements OrderApi {
BeanUtils.copyProperties(orderDO, orderRespDTO);
return orderRespDTO;
}
@Override
public Long getDestCountryByOrderId(Long orderId) {
String destCountryByOrderId = orderMapper.getDestCountryByOrderId(orderId);
return destCountryByOrderId == null ? null : Long.valueOf(destCountryByOrderId);
}
}
......@@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.wealth.convert.receiptInvoice;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.wealth.dal.dataobject.receipt.ReceiptDO;
import cn.iocoder.yudao.module.wealth.dal.dataobject.receiptInvoice.ReceiptInvoiceDO;
import cn.iocoder.yudao.module.wealth.dal.dataobject.receiptInvoiceLog.ReceiptInvoiceLogDO;
import cn.iocoder.yudao.module.wealth.vo.receiptInvoice.*;
......@@ -55,4 +56,6 @@ public interface ReceiptInvoiceConvert {
List<ReceiptInvoiceLogBackVO> logDOtoLogVOList(List<ReceiptInvoiceLogDO> invoiceLogDOs);
ReceiptInvoiceDO convert(ReceiptInvoiceUpdateInfoReqVO updateReqVO);
ReceiptInvoiceDetailVO convert(ReceiptDO receiptDO);
}
......@@ -212,16 +212,6 @@ public class ReceiptDO extends BaseDO {
* 财务备注
*/
private String financeRemark;
/**
*订单ID
*/
private long orderId;
/**
*订单编号
*/
private String orderNo;
/**
* 明细状态
*/
......
......@@ -38,14 +38,6 @@ public class ReceiptInvoiceDO extends BaseDO {
* 收款单号(例:SKD001)
*/
private String receiptNo;
/**
* 部门id
*/
private Long departmentId;
/**
* 部门名称
*/
private String departmentName;
/**
* 申请人id
*/
......@@ -106,26 +98,10 @@ public class ReceiptInvoiceDO extends BaseDO {
* 开发票人id
*/
private Long invoicerId;
/**
* 开票人名称
*/
private String invoicerName;
/**
* 开票时间
*/
private Date invoiceTime;
/**
* 订单id
*/
private Long orderId;
/**
* 订单号(NG2414248L)
*/
private String orderNo;
/**
* 提单号(CNG244432-26)
*/
private String tidanNo;
/**
* 开票币种符号
......@@ -142,4 +118,12 @@ public class ReceiptInvoiceDO extends BaseDO {
*/
private String invoiceInfoRemark;
/**
* 开票取消人id
*/
private Long cancelUserId;
/**
* 开票取消时间
*/
private Date cancelTime;
}
......@@ -88,6 +88,10 @@ public class ReceivableDO extends BaseDO {
* 货币id
*/
private Long currencyId;
/**
* 基准币种id
*/
private Long baseCurrencyId;
/**
* 单价
*/
......
package cn.iocoder.yudao.module.wealth.dal.mysql.receipt;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
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.receipt.ReceiptDO;
import cn.iocoder.yudao.module.wealth.vo.commissionPayable.CommissionPayableBackVO;
import cn.iocoder.yudao.module.wealth.vo.commissionPayable.CommissionPayableQueryVO;
import cn.iocoder.yudao.module.wealth.vo.receipt.OrderVo;
import cn.iocoder.yudao.module.wealth.vo.receipt.ReceiptBackVO;
import cn.iocoder.yudao.module.wealth.vo.receipt.ReceiptExportDto;
import cn.iocoder.yudao.module.wealth.vo.receipt.ReceiptQueryVO;
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;
......@@ -96,4 +88,5 @@ public interface ReceiptMapper extends AbstractMapper<ReceiptDO> {
IPage<ReceiptBackVO> getReceiptBackPage(@Param("mpPage") IPage<ReceiptBackVO> mpPage, @Param("query") ReceiptQueryVO query);
List<ReceiptRelationOrderInfoVO> getOrderInfoByReceiptId(Long id);
}
......@@ -17,7 +17,7 @@ import org.apache.ibatis.annotations.Param;
@Mapper
public interface ReceiptInvoiceMapper extends AbstractMapper<ReceiptInvoiceDO> {
void getReceiptInvoicePage(IPage<ReceiptInvoicePageBackVO> mpPage, @Param("query") ReceiptInvoiceQueryVO query);
IPage<ReceiptInvoicePageBackVO> getReceiptInvoicePage(IPage<ReceiptInvoicePageBackVO> mpPage, @Param("query") ReceiptInvoiceQueryVO query);
ReceiptInvoiceDetailVO getReceiptInvoiceDetail(Long id);
......
package cn.iocoder.yudao.module.wealth.dal.mysql.receiptItem;
import cn.iocoder.yudao.module.wealth.vo.receiptItem.BankIncomeItemReq;
import cn.iocoder.yudao.module.wealth.vo.receiptItem.BankIncomeItemResp;
import cn.iocoder.yudao.module.wealth.vo.receiptItem.ReceiptItemReq;
import cn.iocoder.yudao.module.wealth.vo.receiptItem.ReceiptItemResp;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal;
import java.util.List;
@Mapper
......@@ -11,4 +16,8 @@ public interface BankReceiptDetailsMapper {
List<ReceiptItemResp> getBankReceiptDetailsList(ReceiptItemReq req);
long GetCount(ReceiptItemReq req);
void getBankIncomeItemPage(IPage<BankIncomeItemResp> page, @Param("req") BankIncomeItemReq req);
BigDecimal calculateAccountBalance(String accountNo);
}
......@@ -17,7 +17,11 @@ public enum InvoiceDataStatusEnum implements IntArrayValuable {
/**
* 驳回
*/
REJECT(1, "驳回", "Reject");
REJECT(1, "驳回", "Reject"),
/**
* 无需审核
*/
NO_AUDIT(2, "无需审核", "No Audit");
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(InvoiceDataStatusEnum::getValue).toArray();
......
......@@ -19,15 +19,15 @@ public enum InvoicingLinkEnum implements IntArrayValuable {
*/
CANCEL_INVOICE(1, "取消开票", "Cancel Invoice"),
/**
* 驳回开票
* 修改开票信息
*/
REJECT_INVOICE(2, "驳回开票", "Reject Invoice"),
MODIFY_INVOICE_INFO(2, "修改开票信息", "Modify Invoice Info"),
/**
* 删除开票信息
*/
DELETE_INVOICE_INFO(3, "删除开票", "Delete Invoice Info"),
DELETE_INVOICE_INFO(3, "删除开票信息", "Delete Invoice Info"),
/**
* 驳回开票信息
* 驳回开票资料
*/
REJECT_INVOICE_DATA(4, "驳回开票资料", "Reject Invoice Data"),
/**
......@@ -37,7 +37,7 @@ public enum InvoicingLinkEnum implements IntArrayValuable {
/**
* 修改开票资料
*/
MODIFY_INVOICE_INFO(6, "修改开票资料", "Modify Invoice Info");
MODIFY_INVOICE_DATA(6, "修改开票资料", "Modify Invoice Data");
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(InvoicingLinkEnum::getValue).toArray();
......
......@@ -25,12 +25,7 @@ public enum InvoicingStatusEnum implements IntArrayValuable {
/**
* 不开票
*/
NO_INVOICE(3, "不开票", "NoInvoice"),
/**
* 无申请记录
*/
NO_RECORD(4, "无申请记录", "NoRecord");
NO_INVOICE(3, "不开票", "NoInvoice");
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(InvoicingStatusEnum::getValue).toArray();
......
package cn.iocoder.yudao.module.wealth.job;
import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
@Component
@Slf4j
public class UpdateCurrencyExchangeRate implements JobHandler {
/**
* 更新兑兑目的国各种费用币种汇率
* @param param 参数
*/
@Override
public String execute(String param) throws Exception {
return "success";
}
/**
* 更新兑兑目的国运费币种汇率
* 当订单费用核销>=100%且费用类型为运费/额外费用-运费/全包价且兑目的国运费币种汇率为空,
* 更新目的国运费币种汇率=当前系统本币兑目的国运费用币种汇率,兑目的国运费币种汇率来源=系统汇率+年月日,例如系统汇率2024年06月27日 00:00:00
*/
private void updateFreightExchangeRate() {
}
/**
* 更新兑兑目的国清关费币种汇率
* 当订单费用核销>=100%且费用类型为清关费/额外费用-清关费且兑目的国清关费币种汇率为空,
* 更新目的国清关费币种汇率=当前系统本币兑目的国清关费币种汇率,兑目的国清关费币种汇率来源=系统汇率+年月日,例如系统汇率2024年06月27日 00:00:00
*/
private void updateClearanceFeeExchangeRate() {
}
/**
* 更新兑兑目的国额外费用主币种汇率
* 当订单费用核销>=100%且费用类型非清关费/额外费用-清关费/全包价/运费/额外费用-运费且兑目的国额外费用主币种汇率汇率为空,
* 更新目的国额外费用主币种汇率=当前系统本币兑目的国额外费用主币种汇率,兑目的国额外费用主币种汇率来源=系统汇率+年月日,例如系统汇率2024年06月27日 00:00:00
*/
private void updateExtraMainExchangeRate() {
}
/**
* 更新兑兑目的国额外费用副币种汇率
* 当订单费用核销>=100%且费用类型非清关费/额外费用-清关费/全包价/运费/额外费用-运费且兑目的国额外费用副币种汇率汇率为空,
* 更新目的国额外费用副币种汇率=当前系统本币兑目的国额外费用副币种汇率,兑目的国额外费用副币种汇率来源=系统汇率+年月日,例如系统汇率2024年06月27日 00:00:00
*/
private void updateExtraSecondaryExchangeRate() {
}
}
package cn.iocoder.yudao.module.wealth.job;
import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler;
import cn.iocoder.yudao.module.wealth.dal.dataobject.receipt.ReceiptDO;
import cn.iocoder.yudao.module.wealth.dal.dataobject.receiptItem.ReceiptItemDO;
import cn.iocoder.yudao.module.wealth.dal.mysql.receipt.ReceiptMapper;
import cn.iocoder.yudao.module.wealth.dal.mysql.receiptItem.ReceiptItemMapper;
import cn.iocoder.yudao.module.wealth.enums.ReceiptItemStatusInReceiptEnum;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;
@Component
@Slf4j
public class UpdateReceiptNewFeildTask implements JobHandler {
@Resource
private ReceiptItemMapper receiptItemMapper;
@Resource
private ReceiptMapper receiptMapper;
/**
* 更新收款单新字段:应收明细状态
* @param param 参数
*/
@Override
public String execute(String param) throws Exception {
LambdaQueryWrapper<ReceiptDO> receiptDOLambdaQueryWrapper = new LambdaQueryWrapper<>();
receiptDOLambdaQueryWrapper.select(ReceiptDO::getId)
.eq(ReceiptDO::getDeleted, false);
List<ReceiptDO> receiptDOS = receiptMapper.selectList(receiptDOLambdaQueryWrapper);
for (ReceiptDO receiptDO : receiptDOS) {
LambdaQueryWrapper<ReceiptItemDO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(ReceiptItemDO::getReceiptId, receiptDO.getId())
.select(ReceiptItemDO::getReceiptId, ReceiptItemDO::getStatus);
List<ReceiptItemDO> listItem = receiptItemMapper.selectList(lambdaQueryWrapper);
if (!listItem.isEmpty()) {
ReceiptItemStatusInReceiptEnum sMxStatus = getReceiptMxStatus(listItem, receiptDO.getId());
receiptDO.setReceiptItemStatus(sMxStatus.getValue());
} else {
receiptDO.setReceiptItemStatus(ReceiptItemStatusInReceiptEnum.NO_INPUT.getValue());
}
}
receiptMapper.updateBatch(receiptDOS);
return "success";
}
/**
* 计算收款单明细状态
* 收款单主表
* SELECT * from ecw_receipt where receipt_no='SKD00006547'
* 收款单明细表
* SELECT * from ecw_receipt_item where receipt_id=6554
*/
private ReceiptItemStatusInReceiptEnum getReceiptMxStatus(List<ReceiptItemDO> listItem, long ReceiptId) {
//未录入 收款单下无收款明细 OK
//未提交 :收款单下有收款明细且全未提交 OK
//部分提交 收款单下有收款明细且部分提交(无需判断收款明细是否审批) OK
//未审核 收款明细全部提交且全部未审批 OK
//部分审核 收款明细全部提交且部分已审批 OK
//全部审核 收款明细全部已审批 OK
ReceiptItemStatusInReceiptEnum sMxStatus = null;
//计算明细总数
Long iCount = listItem.stream().filter(i -> i.getReceiptId() == ReceiptId).collect(Collectors.counting());
if (iCount == 0) {
sMxStatus = ReceiptItemStatusInReceiptEnum.NO_INPUT;
return sMxStatus;
} else {
//存在记录就判断状态
//status 状态0待核销,待提交 1已核销
//2核销审核中,3反核销审核中
//bmpStatus
//PROCESS(1, "处理中"),APPROVE(2, "通过"),
//REJECT(3, "不通过"),CANCEL(4, "已取消");
long Item0 = listItem.stream().filter(i -> i.getStatus() == 0).filter(i -> i.getReceiptId() == ReceiptId).count();
long Item1 = listItem.stream().filter(i -> i.getStatus() == 1).filter(i -> i.getReceiptId() == ReceiptId).count();
long Item2 = listItem.stream().filter(i -> i.getStatus() == 2).filter(i -> i.getReceiptId() == ReceiptId).count();
long Item3 = listItem.stream().filter(i -> i.getStatus() == 3).filter(i -> i.getReceiptId() == ReceiptId).count();
if (Item0 == iCount) {
//0待核销
//收款单下有收款明细且全未提交
sMxStatus = ReceiptItemStatusInReceiptEnum.UN_SUBMITTED;
return sMxStatus;
}
if (Item0 > 0 && Item0 < iCount) {
//部分提交 收款单下有收款明细且部分提交(无需判断收款明细是否审批)
sMxStatus = ReceiptItemStatusInReceiptEnum.PART_SUBMITTED;
return sMxStatus;
}
//进部分提交,部分审核逻辑
//未审核 收款明细全部提交且全部未审批
if (Item2 == iCount) {
sMxStatus = ReceiptItemStatusInReceiptEnum.UN_APPROVED;
return sMxStatus;
}
if (Item1 == iCount) {
//1已核销
sMxStatus = ReceiptItemStatusInReceiptEnum.ALL_APPROVED;
return sMxStatus;
}
if ((Item2 + Item3) == iCount || (Item1 + Item3) == iCount || (Item2 + Item1) == iCount) {
sMxStatus = ReceiptItemStatusInReceiptEnum.PART_APPROVED;
return sMxStatus;
}
}
return sMxStatus;
}
}
......@@ -73,7 +73,7 @@ public class FinanceReceiptApproveService {
}
ReceiptDO updateReceipt = new ReceiptDO();
//添加订单ID的修改,不然订单ID就丢失了
updateReceipt.setOrderId(receiptDO.getOrderId());
// updateReceipt.setOrderId(receiptDO.getOrderId());
updateReceipt.setId(receiptDO.getId());
updateReceipt.setBmpStatus(result);
......@@ -104,7 +104,7 @@ public class FinanceReceiptApproveService {
}
ReceiptDO updateReceipt = new ReceiptDO();
// 添加订单ID的修改,不然订单ID就丢失了
updateReceipt.setOrderId(receiptDO.getOrderId());
// updateReceipt.setOrderId(receiptDO.getOrderId());
updateReceipt.setId(receiptDO.getId());
updateReceipt.setBmpStatus(result);
if (result == BpmProcessInstanceResultEnum.APPROVE.getResult()) {
......@@ -127,7 +127,7 @@ public class FinanceReceiptApproveService {
}
ReceiptDO updateReceipt = new ReceiptDO();
// 添加订单ID的修改,不然订单ID就丢失了
updateReceipt.setOrderId(receiptDO.getOrderId());
// updateReceipt.setOrderId(receiptDO.getOrderId());
updateReceipt.setId(receiptDO.getId());
updateReceipt.setBmpStatus(result);
if (result == BpmProcessInstanceResultEnum.APPROVE.getResult()) {
......@@ -175,7 +175,7 @@ public class FinanceReceiptApproveService {
}
ReceiptDO updateReceipt = new ReceiptDO();
// 添加订单ID的修改,不然订单ID就丢失了
updateReceipt.setOrderId(receiptDO.getOrderId());
// updateReceipt.setOrderId(receiptDO.getOrderId());
updateReceipt.setId(receiptDO.getId());
updateReceipt.setBmpStatus(result);
if (result == BpmProcessInstanceResultEnum.APPROVE.getResult()) {
......
......@@ -65,4 +65,6 @@ public interface ReceiptInvoiceService extends IService<ReceiptInvoiceDO> {
Boolean deleteInvoiceInfo(@Valid ReceiptInvoiceOperateReqVO reqVO);
void updateReceiptInvoiceInfo(@Valid ReceiptInvoiceUpdateInfoReqVO updateReqVO);
ReceiptInvoiceDetailVO getReceiptDetailForCreateInvoice(Long receiptId);
}
......@@ -6,6 +6,8 @@ import cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils;
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
import cn.iocoder.yudao.module.wealth.dal.mysql.receiptItem.BankReceiptDetailsMapper;
import cn.iocoder.yudao.module.wealth.vo.receiptItem.BankIncomeItemReq;
import cn.iocoder.yudao.module.wealth.vo.receiptItem.BankIncomeItemResp;
import cn.iocoder.yudao.module.wealth.vo.receiptItem.ReceiptItemReq;
import cn.iocoder.yudao.module.wealth.vo.receiptItem.ReceiptItemResp;
import com.baomidou.mybatisplus.core.metadata.IPage;
......@@ -15,7 +17,9 @@ import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
......@@ -69,6 +73,29 @@ public class BankReceiptDetailsImpl implements BankReceiptDetailsService {
}
@Override
public PageResult<BankIncomeItemResp> getBankIncomeItemPage(BankIncomeItemReq req) {
IPage<BankIncomeItemResp> mpPage = MyBatisUtils.buildPage(req);
bankReceiptDetailsMapper.getBankIncomeItemPage(mpPage, req);
if (mpPage.getTotal() == 0) {
return PageResult.empty();
}
// 计算账号余额
List<BankIncomeItemResp> records = mpPage.getRecords();
HashMap<String, BigDecimal> accountBalanceMap = new HashMap<>();
for (BankIncomeItemResp record : records) {
if (accountBalanceMap.containsKey(record.getAccountNo())) {
record.setAccountBalance(accountBalanceMap.get(record.getAccountNo()));
} else {
record.setAccountBalance(bankReceiptDetailsMapper.calculateAccountBalance(record.getAccountNo()));
accountBalanceMap.put(record.getAccountNo(), record.getAccountBalance());
}
}
// 汇总不同币种总额
//bankReceiptDetailsMapper.
return PageResult.of(mpPage);
}
/*
组装附件信息
*/
......
package cn.iocoder.yudao.module.wealth.service.receiptItem;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.wealth.vo.receiptItem.BankIncomeItemReq;
import cn.iocoder.yudao.module.wealth.vo.receiptItem.BankIncomeItemResp;
import cn.iocoder.yudao.module.wealth.vo.receiptItem.ReceiptItemReq;
import cn.iocoder.yudao.module.wealth.vo.receiptItem.ReceiptItemResp;
public interface BankReceiptDetailsService {
PageResult<ReceiptItemResp> getBankReceiptDetailsList(ReceiptItemReq req);
PageResult<BankIncomeItemResp> getBankIncomeItemPage(BankIncomeItemReq req);
}
......@@ -108,7 +108,7 @@ public class ReceiptItemServiceImpl extends AbstractService<ReceiptItemMapper, R
ReceiptDO update = new ReceiptDO();
update.setId(receiptDO.getId());
update.setState(2);
update.setOrderId(receiptDO.getOrderId());
// update.setOrderId(receiptDO.getOrderId());
receiptService.updateById(update);
}
// TODO 校验当前收款单汇率是否过期,过期则更新为导入的汇率 没过期不更新?更新汇率后有效期是啥?
......
......@@ -268,4 +268,6 @@ public interface ReceivableService extends IService<ReceivableDO> {
PageResult<BatchGenReceiptPageVO> batchGenReceiptPage(@Valid BatchGenReceiptPageQueryVO query, PageVO page);
void writeOffByReceiptItem(List<ReceivableWriteOffReqVO> receivableWriteOffList);
Long getDestCountryCurrencyId(Long orderId);
}
package cn.iocoder.yudao.module.wealth.service.receivable;
import cn.hutool.core.collection.CollectionUtil;
import cn.iocoder.boot.module.order.api.OrderApi;
import cn.iocoder.yudao.framework.apollo.core.event.Order.OrderOperateLogEvent;
import cn.iocoder.yudao.framework.apollo.core.vo.ApplyInfoVO;
import cn.iocoder.yudao.framework.common.exception.ServiceException;
......@@ -15,6 +16,7 @@ import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
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.ecw.api.customer.CustomerApi;
import cn.iocoder.yudao.module.ecw.api.customer.dto.CustomerDTO;
import cn.iocoder.yudao.module.ecw.api.region.RegionApi;
......@@ -83,6 +85,10 @@ public class ReceivableServiceImpl extends AbstractService<ReceivableMapper, Rec
@Resource
private RegionApi regionApi;
@Resource
@Lazy
private OrderApi orderApi;
@Override
public Long createReceivable(ReceivableCreateReqVO createReqVO) {
LoginUser user = SecurityFrameworkUtils.getLoginUser();
......@@ -257,12 +263,17 @@ public class ReceivableServiceImpl extends AbstractService<ReceivableMapper, Rec
@Override
public List<ReceivableBackVO> getReceivableByOrderId(Long orderId) {
List<ReceivableBackVO> receivableBackVOList = receivableMapper.getReceivableByOrderId(orderId);
Long destCountryCurrencyId = getDestCountryCurrencyId(orderId);
receivableBackVOList.forEach(receivableBackVO -> {
if (receivableBackVO.getDiscountTotal() == null) {
receivableBackVO.setDiscountTotal(BigDecimal.ZERO);
}
receivableBackVO.setNotIncludedTaxAmount(receivableBackVO.getTotalAmount());
receivableBackVO.setActualAmount(receivableBackVO.getTaxAmount().subtract(receivableBackVO.getDiscountTotal()));
receivableBackVO.setBaseCurrencyId(destCountryCurrencyId);
ExchangeRateRespDTO currencyRate = currencyApi.getCurrencyRate(receivableBackVO.getCurrencyId(), destCountryCurrencyId);
receivableBackVO.setExchangeRate(currencyRate.getCurrencyRate());
receivableBackVO.setBaseAmount(receivableBackVO.getActualAmount().multiply(currencyRate.getCurrencyRate()));
});
return receivableBackVOList;
}
......@@ -297,6 +308,11 @@ public class ReceivableServiceImpl extends AbstractService<ReceivableMapper, Rec
receivableBackVO.setWriteOffAmount(BigDecimal.ZERO);
}
receivableBackVO.setNotWriteOffAmount(receivableBackVO.getActualAmount().subtract(receivableBackVO.getWriteOffAmount()));
// TODO 核销/未核销美元暂时默认为0,待计算
receivableBackVO.setWriteOffAmountUsd(BigDecimal.ZERO);
receivableBackVO.setNotWriteOffAmountUsd(BigDecimal.ZERO);
receivableBackVO.setBaseAmount(BigDecimal.ZERO);
receivableBackVO.setBaseCurrencyId(1L);
// 核销比例 = 已核销金额 / 实际金额,保留两位小数字符串
receivableBackVO.setWriteOffProportion(receivableBackVO.getWriteOffAmount().divide(receivableBackVO.getActualAmount(), 2, RoundingMode.HALF_UP).toString());
});
......@@ -499,6 +515,7 @@ public class ReceivableServiceImpl extends AbstractService<ReceivableMapper, Rec
* 实际金额 = 含税金额 - 优惠金额
* 未核销金额 = 实际金额 - 核销金额
* TODO 暂定 不含税金额 = 总金额
*
* @param allCurrency
* @param statistics
*/
......@@ -555,4 +572,14 @@ public class ReceivableServiceImpl extends AbstractService<ReceivableMapper, Rec
receivableMapper.updateById(receivableDO);
}
}
@Override
public Long getDestCountryCurrencyId(Long orderId) {
Long countryId = orderApi.getDestCountryByOrderId(orderId);
if (countryId == null) {
return null;
}
RegionDTO regionById = regionApi.getRegionById(countryId);
return Long.parseLong(regionById.getImportCurrency5());
}
}
\ No newline at end of file
......@@ -8,6 +8,7 @@ import org.springframework.format.annotation.DateTimeFormat;
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;
......@@ -226,4 +227,10 @@ public class ReceiptBackVO {
@ApiModelProperty(value = "开票资料状态")
private Integer invoiceDataStatus;
@ApiModelProperty(value = "开票id")
private Long invoiceId;
@ApiModelProperty(value = "相关订单信息列表")
private List<ReceiptRelationOrderInfoVO> orderInfoList;
}
......@@ -151,7 +151,7 @@ public class ReceiptBaseVO {
private String financeRemark;
@ApiModelProperty(value = "订单ID")
private long orderId;
private String orderId;
@ApiModelProperty(value = "订单编号")
private String orderNo;
......
package cn.iocoder.yudao.module.wealth.vo.receipt;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class ReceiptRelationOrderInfoVO {
@ApiModelProperty(value = "订单号")
private String orderNo;
@ApiModelProperty(value = "订单ID")
private Long orderId;
@ApiModelProperty(value = "提单号")
private String tidanNo;
}
\ No newline at end of file
......@@ -40,5 +40,5 @@ public class ReceiptInvoiceCreateReqVO {
private String invoiceAddress;
@ApiModelProperty(value = "备注")
private String remark;
private String invoiceRemark;
}
package cn.iocoder.yudao.module.wealth.vo.receiptInvoice;
import cn.iocoder.yudao.module.wealth.vo.receipt.ReceiptRelationOrderInfoVO;
import cn.iocoder.yudao.module.wealth.vo.receivable.ReceivableBackVO;
import cn.iocoder.yudao.module.wealth.vo.receivable.WealthMoneyAmountVO;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
......@@ -9,11 +11,16 @@ 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_HOUR_MINUTE_SECOND;
@Data
@ApiModel("管理后台 - 开票详情 VO")
public class ReceiptInvoiceDetailVO {
//订单信息/基础信息
@ApiModelProperty(value = "开票id")
private Long id;
@ApiModelProperty(value = "开票编号")
private String invoiceNo;
......@@ -53,6 +60,12 @@ public class ReceiptInvoiceDetailVO {
@ApiModelProperty(value = "开票类型名称")
private String invoiceType;
@ApiModelProperty(value = "基准币种id")
private Long baseCurrencyId;
@ApiModelProperty(value = "相关订单信息列表")
private List<ReceiptRelationOrderInfoVO> orderInfoList;
// 开票资料
@ApiModelProperty(value = "发票抬头")
private String invoiceHeader;
......@@ -60,6 +73,12 @@ public class ReceiptInvoiceDetailVO {
@ApiModelProperty(value = "纳税人识别号")
private String taxpayer;
@ApiModelProperty(value = "开户行")
private String accountBank;
@ApiModelProperty(value = "账号")
private String accountName;
@ApiModelProperty(value = "税率")
private java.math.BigDecimal taxRate;
......@@ -97,8 +116,16 @@ public class ReceiptInvoiceDetailVO {
private String invoicerName;
@ApiModelProperty(value = "开票时间")
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date invoiceTime;
@ApiModelProperty(value = "取消开票人")
private String cancelUserName;
@ApiModelProperty(value = "取消开票时间")
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date cancelTime;
// 应收信息
@ApiModelProperty(value = "应收明细")
private List<ReceivableBackVO> receivableList;
......@@ -115,8 +142,10 @@ public class ReceiptInvoiceDetailVO {
private String writeOffUser;
@ApiModelProperty(value = "创建时间")
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date createTime;
@ApiModelProperty(value = "更新时间")
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date updateTime;
@ApiModelProperty(value = "创建人")
private String creator;
......
package cn.iocoder.yudao.module.wealth.vo.receiptInvoice;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.*;
import java.util.*;
import io.swagger.annotations.*;
......@@ -37,7 +38,7 @@ public class ReceiptInvoiceLogBackVO {
private Integer bpmStatus;
@ExcelProperty("创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "创建时间")
private Date createTime;
......
package cn.iocoder.yudao.module.wealth.vo.receiptInvoice;
import cn.iocoder.yudao.module.wealth.vo.receipt.ReceiptRelationOrderInfoVO;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
@ApiModel("管理后台 - 收款单开票列表 Response VO")
public class ReceiptInvoicePageBackVO {
......@@ -13,6 +16,10 @@ public class ReceiptInvoicePageBackVO {
@ApiModelProperty(value = "主键", required = true)
private Long id;
@ExcelProperty("开票编号")
@ApiModelProperty(value = "开票编号", required = true)
private String invoiceNo;
@ExcelProperty("收款单id")
@ApiModelProperty(value = "收款单id", required = true)
private Long receiptId;
......@@ -28,9 +35,9 @@ public class ReceiptInvoicePageBackVO {
@ApiModelProperty(value = "开票状态")
private Integer invoicingStatus;
@ExcelProperty("开票明细状态")
@ApiModelProperty(value = "开票明细状态")
private Integer invoicingDetailStatus;
@ExcelProperty("开票资料状态")
@ApiModelProperty(value = "开票资料状态")
private Integer invoiceDataStatus;
@ExcelProperty("部门id")
@ApiModelProperty(value = "部门id")
......@@ -51,8 +58,7 @@ public class ReceiptInvoicePageBackVO {
@ApiModelProperty(value = "发票抬头")
private String invoiceHeader;
@ApiModelProperty(value = "开票金额(暂时不知道从哪拿)")
// TODO 暂时不知道从哪拿
@ApiModelProperty(value = "开票金额")
private java.math.BigDecimal invoiceMoney;
@ApiModelProperty(value = "开票品名")
......@@ -61,16 +67,12 @@ public class ReceiptInvoicePageBackVO {
@ApiModelProperty(value = "税率")
private java.math.BigDecimal taxRate;
@ApiModelProperty(value = "订单号(NG2414248L)")
private String orderNo;
@ApiModelProperty(value = "提单号(CNG244432-26)")
private String tidanNo;
@ApiModelProperty(value = "收款状态")
private Integer receiptState;
@ApiModelProperty(value = "核销比例")
private java.math.BigDecimal writeOffProportion;
@ApiModelProperty(value = "相关订单信息列表")
private List<ReceiptRelationOrderInfoVO> orderInfoList;
}
......@@ -4,6 +4,8 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
@ApiModel("管理后台 - 收款单开票信息查询 VO")
public class ReceiptInvoiceQueryVO {
......@@ -21,6 +23,6 @@ public class ReceiptInvoiceQueryVO {
private String tidanNo;
@ApiModelProperty(value = "开票状态")
private Integer invoicingStatus;
private List<Integer> invoicingStatus;
}
package cn.iocoder.yudao.module.wealth.vo.receiptItem;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
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_HOUR_MINUTE_SECOND;
@Data
@ApiModel("管理后台 - 银行收款单明细列表")
public class BankIncomeItemReq extends PageParam {
@ApiModelProperty(value = "收款账号银行名称")
private List<Integer> platformAccountIds;
@ApiModelProperty(value = "收/支,暂时没支")
private Integer isIncome;
@ApiModelProperty(value = "金额符号")
private Integer relationSymbol;
@ApiModelProperty(value = "金额")
private java.math.BigDecimal amount;
@ApiModelProperty(value = "交易日期开始")
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date amountDateStart;
@ApiModelProperty(value = "交易日期结束")
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date amountDateEnd;
@ApiModelProperty(value = "关联单号")
private String relationNo;
@ApiModelProperty(value = "交易日期排序方式")
private Boolean isAsc;
}
package cn.iocoder.yudao.module.wealth.vo.receiptItem;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Data
@ApiModel("管理后台 - 银行账号收支明细列表返回结果")
public class BankIncomeItemResp {
@ApiModelProperty(value = "银行收款明细id")
private Long id;
@ApiModelProperty(value = "收款单id")
private String receiptId;
@ApiModelProperty(value = "收款账号")
private String accountNo;
/**
* 当次实收金额不含税
*/
private java.math.BigDecimal amount;
/**
* 税点
*/
private java.math.BigDecimal taxPoint;
/**
* 当次实收金额含税
*/
private java.math.BigDecimal taxAmount;
/**
* 收款账号名称
*/
private String accountName;
@ApiModelProperty(value = "收款账号银行名称")
private String accountBankName;
@ApiModelProperty(value = "货币id")
private Long currencyId;
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "实收日期")
private Date amountDate;
@ApiModelProperty(value = "收款单编号")
private String receiptNo;
@ApiModelProperty(value = "订单ID")
private long orderId;
@ApiModelProperty(value = "订单编号")
private String orderNo;
@ApiModelProperty(value = "提单编号")
private String tidanNo;
@ApiModelProperty(value = "账号余额")
private java.math.BigDecimal accountBalance;
}
......@@ -231,4 +231,12 @@ public class ReceivableBackVO {
@ApiModelProperty(value = "实际金额")
private BigDecimal actualAmount;
@ApiModelProperty(value = "核销金额")
private BigDecimal writeOffAmountUsd;
@ApiModelProperty(value = "未核销金额")
private BigDecimal notWriteOffAmountUsd;
@ApiModelProperty(value = "基准币种id")
private Long baseCurrencyId;
}
......@@ -23,6 +23,7 @@ import cn.iocoder.yudao.module.wealth.convert.receiptApproval.ReceiptApprovalCon
import cn.iocoder.yudao.module.wealth.dal.dataobject.receipt.ReceiptDO;
import cn.iocoder.yudao.module.wealth.dal.dataobject.receiptAccount.ReceiptAccountDO;
import cn.iocoder.yudao.module.wealth.dal.dataobject.receiptApproval.ReceiptApprovalDO;
import cn.iocoder.yudao.module.wealth.job.UpdateReceiptNewFeildTask;
import cn.iocoder.yudao.module.wealth.service.receipt.ReceiptService;
import cn.iocoder.yudao.module.wealth.service.receiptAccount.ReceiptAccountService;
import cn.iocoder.yudao.module.wealth.service.receiptApproval.ReceiptApprovalService;
......@@ -68,11 +69,6 @@ import static cn.iocoder.yudao.module.wealth.enums.ErrorCodeConstants.PAYMENT_NO
@RequestMapping("/ecw/receipt")
@Slf4j
public class ReceiptController {
//ecw_receivable 应收款
//ecw_receipt 收款单
//ecw_order 订单表
@Resource
private ReceiptService receiptService;
......@@ -90,6 +86,9 @@ public class ReceiptController {
@Resource
private ReceiptApprovalService receiptApprovalService;
@Resource
private UpdateReceiptNewFeildTask updateReceiptNewFeildTask;
@GetMapping("/page")
@ApiOperation("获得收款单分页")
......@@ -715,4 +714,9 @@ public class ReceiptController {
return "¥";
}
}
@GetMapping("/updateReceiptNewFeild")
@ApiOperation("更新应收明细")
public CommonResult<String> updateReceiptNewFeild() throws Exception {
return success(updateReceiptNewFeildTask.execute(""));
}
}
......@@ -50,6 +50,13 @@ public class ReceiptInvoiceController {
return success(receiptInvoiceDetail);
}
@GetMapping("/receipt/info/get")
@ApiOperation("获得收款单开票信息")
public CommonResult<ReceiptInvoiceDetailVO> getReceiptDetailForCreateInvoice(@RequestParam("receiptId") Long receiptId) {
ReceiptInvoiceDetailVO receiptInvoiceDetail = receiptInvoiceService.getReceiptDetailForCreateInvoice(receiptId);
return success(receiptInvoiceDetail);
}
@PostMapping("/page")
@ApiOperation("获得收款单开票信息分页")
public CommonResult<PageResult<ReceiptInvoicePageBackVO>> getReceiptInvoicePage(@RequestBody @Valid ReceiptInvoiceQueryVO query, PageVO page) {
......
......@@ -2,28 +2,22 @@ package cn.iocoder.yudao.module.wealth.controller.admin.receiptItem;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.wealth.convert.receiptItem.ReceiptItemConvert;
import cn.iocoder.yudao.module.wealth.dal.dataobject.receipt.ReceiptDO;
import cn.iocoder.yudao.module.wealth.dal.dataobject.receiptItem.ReceiptItemDO;
import cn.iocoder.yudao.module.wealth.dal.mysql.receipt.ReceiptMapper;
import cn.iocoder.yudao.module.wealth.service.receiptItem.BankReceiptDetailsService;
import cn.iocoder.yudao.module.wealth.service.receiptItem.ReceiptItemService;
import cn.iocoder.yudao.module.wealth.vo.receiptItem.ReceiptItemBackVO;
import cn.iocoder.yudao.module.wealth.vo.receiptItem.BankIncomeItemReq;
import cn.iocoder.yudao.module.wealth.vo.receiptItem.BankIncomeItemResp;
import cn.iocoder.yudao.module.wealth.vo.receiptItem.ReceiptItemReq;
import cn.iocoder.yudao.module.wealth.vo.receiptItem.ReceiptItemResp;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
......@@ -45,15 +39,9 @@ public class BankReceiptDetailsControl {
return success(bankReceiptDetailsService.getBankReceiptDetailsList(req));
}
@GetMapping("/test")
@ApiOperation("测试")
public CommonResult<Boolean> doTest(ReceiptItemReq req) {
ReceiptDO r=new ReceiptDO();
r.setOrderId(123);
r.setReceiptNo("ww");
receiptMapper.insert(r);
return success(true);
@GetMapping("/income/page")
@ApiOperation("银行账号收支明细列表")
public CommonResult<PageResult<BankIncomeItemResp>> getBankIncomeItemPage(BankIncomeItemReq req) {
return success(bankReceiptDetailsService.getBankIncomeItemPage(req));
}
}
......@@ -75,6 +75,64 @@
left join ecw_receipt_approval a on a.bmp_id=m.bmp_id and a.deleted=0
<include refid="WherePage"/>
</select>
<select id="getBankIncomeItemPage">
SELECT
eri.id,
eri.receipt_id,
eri.account_no,
eri.account_name,
eri.account_bank_name,
eri.amount,
eri.currency_id,
er.receipt_no,
eo.tidan_no,
eo.order_no,
eri.amount_date,
eri.remark
FROM ecw_receipt_item eri
LEFT JOIN ecw_receipt er ON eri.receipt_id = er.id
LEFT JOIN ecw_order eo ON eo.order_id = er.order_id
LEFT JOIN ecw_receipt_account era ON era.receipt_id = eri.receipt_id
WHERE eri.status = 1
<if test="req.relationNo != null and req.relationNo != ''">
AND (er.receipt_no LIKE concat('%',#{req.receiptNo},'%') OR eo.order_no LIKE
concat('%',#{req.relationNo},'%') OR eo.tidan_no = #{req.relationNo})
</if>
<if test="req.platformAccountIds != null and req.platformAccountIds.size > 0">
AND era.platform_account_id IN
<foreach collection="req.platformAccountIds" item="platformAccountId" open="(" separator="," close=")">
#{platformAccountId}
</foreach>
</if>
<if test="req.amount != null and req.relationSymbol != null">
<!--1:大于 2:等于 3:小于-->
<if test="req.rewardCountOperate == 1">
AND eri.amount &gt; #{req.amount}
</if>
<if test="req.rewardCountOperate == 2">
AND eri.amount = #{req.amount}
</if>
<if test="req.rewardCountOperate == 3">
AND eri.amount &lt; #{req.amount}
</if>
</if>
<if test="req.amountDateStart != null and req.amountDateEnd != null">
AND eri.amount_date BETWEEN #{req.amountDateStart} AND #{req.amountDateEnd}
</if>
<if test="req.isAsc != null">
<if test="req.isAsc">
ORDER BY eri.amount_date
</if>
<if test="!req.isAsc">
ORDER BY eri.amount_date DESC
</if>
</if>
</select>
<select id="calculateAccountBalance" resultType="java.math.BigDecimal">
SELECT SUM(amount)
FROM ecw_receipt_item
WHERE
account_no = #{accountNo} AND status = 1
</select>
</mapper>
......@@ -6,12 +6,12 @@
<!--添加关联订单和应收款表的关联-->
SELECT
er.*,
rb.order_no AS orderNo,
o.order_no AS orderNo,
o.tidan_no AS tidanNo,
rb.order_id AS orderId
o.order_id AS orderId
FROM ecw_receipt er
LEFT JOIN ecw_receivable rb ON rb.receipt_id=er.id AND rb.deleted=0
LEFT JOIN ecw_order o ON o.order_no=rb.order_no AND o.deleted=0
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 AND o.deleted=0
WHERE er.deleted = 0
<if test="query.receiptItemStatus != null">
AND er.`detail_status` = #{query.receiptItemStatus}
......@@ -45,19 +45,20 @@
AND er.`create_time` between #{query.beginCreateTime} and #{query.endCreateTime}
</if>
<if test="query.numberNo != null and query.numberNo != '' ">
and er.id in ( SELECT DISTINCT
t.receipt_id
FROM
ecw_receivable t
LEFT JOIN ecw_order o ON t.order_id = o.order_id
WHERE
t.deleted = 0 and t.receipt_id is not null
AND (
t.order_no = #{query.numberNo}
OR o.tidan_no = #{query.numberNo}
OR o.container_number = #{query.numberNo})
)
AND (o.order_no = #{query.numberNo} OR o.tidan_no = #{query.numberNo} OR o.container_number =
#{query.numberNo}))
</if>
GROUP BY er.receipt_no
</select>
<select id="getOrderInfoByReceiptId"
resultType="cn.iocoder.yudao.module.wealth.vo.receipt.ReceiptRelationOrderInfoVO">
SELECT
o.order_no AS orderNo,
o.tidan_no AS tidanNo,
o.order_id AS orderId
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}
GROUP BY o.order_id
</select>
</mapper>
......@@ -6,9 +6,17 @@
SELECT
eri.*,
er.state AS receiptState,
er.write_off_proportion
er.write_off_proportion,
er.invoicing_status,
er.invoice_data_status,
sd.id AS departmentId,
sd.name AS departmentName
FROM ecw_receipt_invoice eri
LEFT JOIN ecw_receipt er ON eri.receipt_id = er.id
LEFT JOIN system_user su ON eri.apply_user_id = su.id
LEFT JOIN system_dept sd ON su.dept_id = sd.id
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
WHERE eri.deleted = 0
<if test="query.receiptNo != null and query.receiptNo != '' ">
AND eri.`receipt_no` LIKE CONCAT('%',#{query.receiptNo},'%')
......@@ -17,14 +25,21 @@
AND eri.`invoice_no` LIKE CONCAT('%',#{query.invoiceNo},'%')
</if>
<if test="query.orderNo != null and query.orderNo != '' ">
AND eri.`order_no` = #{query.orderNo}
AND o.`order_no` = #{query.orderNo}
</if>
<if test="query.tidanNo != null and query.tidanNo != '' ">
AND eri.`tidan_no` = #{query.tidanNo}
AND o.`tidan_no` = #{query.tidanNo}
</if>
<if test="query.invoicingStatus != null and query.invoicingStatus.size == 1">
AND er.`invoicing_status` = #{query.invoicingStatus[0]}
</if>
<if test="query.invoicingStatus != null ">
AND eri.`invoicing_status` = #{query.invoicingStatus}
<if test="query.invoicingStatus != null and query.invoicingStatus.size > 1">
AND er.`invoicing_status` IN
<foreach collection="query.invoicingStatus" item="invoicingStatus" open="(" separator="," close=")">
#{invoicingStatus}
</foreach>
</if>
GROUP BY er.id
</select>
<select id="getReceiptInvoiceDetail"
resultType="cn.iocoder.yudao.module.wealth.vo.receiptInvoice.ReceiptInvoiceDetailVO">
......@@ -36,6 +51,7 @@
er.customer_name
FROM ecw_receipt_invoice eri
LEFT JOIN ecw_receipt er ON eri.receipt_id = er.id
WHERE eri.id = #{id}
</select>
<select id="getCurrentMaxInvoiceCode" resultType="java.lang.String">
SELECT invoice_no FROM ecw_receipt_invoice ORDER BY invoice_no DESC LIMIT 1
......
......@@ -47,32 +47,32 @@ spring:
master:
name: jiedao
# name: ruoyi-vue-pro-flowable
url: jdbc:mysql://117.72.42.41:2290/${spring.datasource.dynamic.datasource.master.name}?useUnicode=true&useSSL=true&characterEncoding=utf8&characterSetResults=utf8&allowMultiQueries=true&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&autoReconnect=true&rewriteBatchedStatements=TRUE
url: jdbc:mysql://159.75.224.138:2292/${spring.datasource.dynamic.datasource.master.name}?useUnicode=true&useSSL=true&characterEncoding=utf8&characterSetResults=utf8&allowMultiQueries=true&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&autoReconnect=true&rewriteBatchedStatements=TRUE
driver-class-name: com.mysql.cj.jdbc.Driver
username: jiedao
password: Jiedao2024
username: root
password: mysql@2022
slave: # 模拟从库,可根据自己需要修改
name: jiedao
# name: ruoyi-vue-pro-flowable
url: jdbc:mysql://117.72.42.41:2290/${spring.datasource.dynamic.datasource.slave.name}?useUnicode=true&useSSL=true&characterEncoding=utf8&characterSetResults=utf8&allowMultiQueries=true&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&autoReconnect=true&rewriteBatchedStatements=TRUE
url: jdbc:mysql://159.75.224.138:2292/${spring.datasource.dynamic.datasource.slave.name}?useUnicode=true&useSSL=true&characterEncoding=utf8&characterSetResults=utf8&allowMultiQueries=true&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&autoReconnect=true&rewriteBatchedStatements=TRUE
driver-class-name: com.mysql.cj.jdbc.Driver
username: jiedao
password: Jiedao2024
username: root
password: mysql@2022
# Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优
redis:
host: 117.72.42.41 # 地址
port: 2291 # 端口
password: Redis2024
database: 0 # 数据库索引
host: 159.75.224.138 # 地址
port: 2297 # 端口
password: redis@2022
database: 1 # 数据库索引
timeout: 60s
connect-timeout: 60s
redis-limiter:
redis-host: 117.72.42.41 # redis server IP 默认值:127.0.0.1
redis-port: 2291 # redis service 端口 默认值:6379
redis-host: 159.75.224.138 # redis server IP 默认值:127.0.0.1
redis-port: 2297 # redis service 端口 默认值:6379
redis-db: 4 # redis service 数据库 默认值:6379
redis-password: Redis2024 # redis 访问密码 默认值:null
redis-password: redis@2022 # redis 访问密码 默认值:null
redis-connection-timeout: 2000 # redis 连接超时时间 默认值:2000
redis-pool-max-idle: 50 # redis 连接池最大空闲连接数 默认值:50
redis-pool-min-idle: 10 # redis 连接池最小空闲连接数 默认值: 10
......
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