Commit 982b7af2 authored by zhangfeng's avatar zhangfeng

feat(wealth): 财务新增功能

parent 4e3d4ff2
......@@ -9,6 +9,7 @@ import cn.iocoder.yudao.module.customer.service.customerContacts.CustomerContact
import cn.iocoder.yudao.module.customer.vo.customer.customerContacts.CustomerContactsCreateReqVO;
import cn.iocoder.yudao.module.customer.vo.customer.vo.CustomerCreateReqVO;
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.dal.dataobject.country.CountryDO;
import cn.iocoder.yudao.module.ecw.enums.CustomerCreateFromEnum;
import cn.iocoder.yudao.module.ecw.enums.CustomerStatusEnum;
......@@ -179,4 +180,15 @@ public class CustomerApiImpl implements CustomerApi {
.isNull(CustomerDO::getFirstDealTime)
.eq(CustomerDO::getId, customerId));
}
@Override
public CustomerDTO getCustomerInfo(Long id) {
CustomerDO customer = customerService.getCustomer(id);
CustomerDTO customerDTO = new CustomerDTO();
customerDTO.setId(customer.getId());
customerDTO.setName(customer.getName());
customerDTO.setNumber(customer.getNumber());
customerDTO.setPayerName(customer.getPayerName());
return customerDTO;
}
}
package cn.iocoder.yudao.module.ecw.api.customer;
import cn.iocoder.yudao.module.ecw.api.customer.dto.CustomerDTO;
import java.util.Date;
public interface CustomerApi {
......@@ -12,5 +14,5 @@ public interface CustomerApi {
void fillFirstDealTimeIfNull(Long customerId, Date firstDealTime);
CustomerDTO getCustomerInfo(Long id);
}
package cn.iocoder.yudao.module.ecw.api.customer.dto;
import lombok.Data;
@Data
public class CustomerDTO {
private Long id;
private String number;
private String name;
private String payerName;
}
......@@ -38,7 +38,16 @@ public class BankAccountBaseVO {
@ApiModelProperty(value = "状态(0正常 1停用)", required = false)
private Integer status;
// @ApiModelProperty(value = "客户来源字典")
// private String source;
@ApiModelProperty(value = "开户国家")
private Integer baCountry;
@ApiModelProperty(value = "收入归属")
private Integer baIncomeBelong;
@ApiModelProperty(value = "币种")
private Integer baCurrency;
@ApiModelProperty(value = "余额")
private java.math.BigDecimal baBalance;
}
package cn.iocoder.yudao.module.ecw.controller.admin.bankAccount.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import java.util.*;
......@@ -43,4 +44,16 @@ public class BankAccountExcelVO {
@ExcelProperty("创建时间")
private Date createTime;
@ExcelProperty("开户国家")
private Integer baCountry;
@ExcelProperty("收入归属")
private Integer baIncomeBelong;
@ExcelProperty("币种")
private Integer baCurrency;
@ExcelProperty("余额")
private java.math.BigDecimal baBalance;
}
......@@ -43,4 +43,13 @@ public class BankAccountExportReqVO {
@ApiModelProperty(value = "结束创建时间")
private Date endCreateTime;
@ApiModelProperty(value = "开户国家")
private Integer baCountry;
@ApiModelProperty(value = "收入归属")
private Integer baIncomeBelong;
@ApiModelProperty(value = "币种")
private Integer baCurrency;
}
......@@ -46,4 +46,12 @@ public class BankAccountPageReqVO extends PageParam {
@ApiModelProperty(value = "结束创建时间")
private Date endCreateTime;
@ApiModelProperty(value = "开户国家")
private Integer baCountry;
@ApiModelProperty(value = "收入归属")
private Integer baIncomeBelong;
@ApiModelProperty(value = "币种")
private Integer baCurrency;
}
......@@ -55,5 +55,21 @@ public class BankAccountDO extends BaseDO {
* 状态(0正常 1停用)
*/
private Integer status;
/**
* 开户国家
*/
private Integer baCountry;
/**
* 收入归属
*/
private Integer baIncomeBelong;
/**
* 币种
*/
private Integer baCurrency;
/**
* 余额
*/
private java.math.BigDecimal baBalance;
}
......@@ -22,19 +22,22 @@ public interface BankAccountMapper extends BaseMapperX<BankAccountDO> {
default PageResult<BankAccountDO> selectPage(BankAccountPageReqVO reqVO) {
// MyBatis Plus 查询
IPage<BankAccountDO> mpPage = MyBatisUtils.buildPage(reqVO);
selectPage(mpPage, new LambdaQueryWrapperX<BankAccountDO>()
selectPage(mpPage, new LambdaQueryWrapperX<BankAccountDO>()
.likeIfPresent(BankAccountDO::getBaAccountName, reqVO.getBaAccountName())
.likeIfPresent(BankAccountDO::getBaBankName, reqVO.getBaBankName())
.eqIfPresent(BankAccountDO::getBaAccountNum, reqVO.getBaAccountNum())
.eqIfPresent(BankAccountDO::getBaSwiftCode, reqVO.getBaSwiftCode())
.likeIfPresent(BankAccountDO::getBaBankAdd, reqVO.getBaBankAdd())
.eqIfPresent(BankAccountDO::getBaType, reqVO.getBaType())
.eqIfPresent(BankAccountDO::getBaCountry, reqVO.getBaCountry())
.eqIfPresent(BankAccountDO::getBaIncomeBelong, reqVO.getBaIncomeBelong())
.eqIfPresent(BankAccountDO::getBaCurrency, reqVO.getBaCurrency())
// .eqIfPresent(BankAccountDO::getSource, reqVO.getSource())
.eqIfPresent(BankAccountDO::getStatus, reqVO.getStatus())
.betweenIfPresent(BankAccountDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
.orderByDesc(BankAccountDO::getId));
// 转换返回
return new PageResult<>(mpPage.getRecords(), mpPage.getTotal(),mpPage.getSize(),mpPage.getCurrent(),mpPage.getPages());
return new PageResult<>(mpPage.getRecords(), mpPage.getTotal(), mpPage.getSize(), mpPage.getCurrent(), mpPage.getPages());
}
default List<BankAccountDO> selectList(BankAccountExportReqVO reqVO) {
......@@ -45,6 +48,9 @@ public interface BankAccountMapper extends BaseMapperX<BankAccountDO> {
.eqIfPresent(BankAccountDO::getBaSwiftCode, reqVO.getBaSwiftCode())
.likeIfPresent(BankAccountDO::getBaBankAdd, reqVO.getBaBankAdd())
.eqIfPresent(BankAccountDO::getBaType, reqVO.getBaType())
.eqIfPresent(BankAccountDO::getBaCountry, reqVO.getBaCountry())
.eqIfPresent(BankAccountDO::getBaIncomeBelong, reqVO.getBaIncomeBelong())
.eqIfPresent(BankAccountDO::getBaCurrency, reqVO.getBaCurrency())
// .eqIfPresent(BankAccountDO::getSource, reqVO.getSource())
.eqIfPresent(BankAccountDO::getStatus, reqVO.getStatus())
.betweenIfPresent(BankAccountDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
......
......@@ -47,6 +47,11 @@
<version>${revision}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-module-ecw-api</artifactId>
<version>${revision}</version>
</dependency>
</dependencies>
......
......@@ -3,6 +3,8 @@ 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.receiptInvoice.ReceiptInvoiceDO;
import cn.iocoder.yudao.module.wealth.dal.dataobject.receiptInvoiceLog.ReceiptInvoiceLogDO;
import cn.iocoder.yudao.module.wealth.vo.receiptInvoice.ReceiptInvoiceLogBackVO;
import cn.iocoder.yudao.module.wealth.vo.receiptInvoice.ReceiptInvoicePageBackVO;
import cn.iocoder.yudao.module.wealth.vo.receiptInvoice.ReceiptInvoiceCreateReqVO;
import cn.iocoder.yudao.module.wealth.vo.receiptInvoice.ReceiptInvoiceUpdateReqVO;
......@@ -52,4 +54,6 @@ public interface ReceiptInvoiceConvert {
* @return
*/
PageResult<ReceiptInvoicePageBackVO> convertPage(PageResult<ReceiptInvoiceDO> page);
List<ReceiptInvoiceLogBackVO> logDOtoLogVOList(List<ReceiptInvoiceLogDO> invoiceLogDOs);
}
......@@ -162,6 +162,10 @@ public class ReceiptDO extends BaseDO {
* 是否需要开票
*/
private Integer openInvoice;
/**
* 开票信息id
*/
private Long invoiceId;
/**
* 状态:0:草稿, 1待收款, 2待核销,3已部分核销,4已核销,5已核销待开票,6已开票
......
......@@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
import java.util.Date;
/**
* 收款单开票信息日志 DO
*
......@@ -15,15 +17,17 @@ import lombok.*;
@NoArgsConstructor
@AllArgsConstructor
@TableName("ecw_receipt_invoice_log")
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class ReceiptInvoiceLogDO extends BaseDO {
public class ReceiptInvoiceLogDO {
/**
* 主键
*/
@TableId
private Long id;
/**
* 开票信息id
*/
private Long invoiceId;
/**
* 开票环节
*/
......@@ -39,6 +43,10 @@ public class ReceiptInvoiceLogDO extends BaseDO {
/**
* 审批流程
*/
private Integer bmpStatus;
private Integer bpmStatus;
/**
* 创建时间
*/
private Date createTime;
}
package cn.iocoder.yudao.module.wealth.dal.dataobject.receiptLog;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
import java.util.Date;
/**
* 收款单日志 DO
*
......@@ -15,15 +19,17 @@ import lombok.*;
@NoArgsConstructor
@AllArgsConstructor
@TableName("ecw_receipt_log")
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class ReceiptLogDO extends BaseDO {
public class ReceiptLogDO {
/**
* 主键
*/
@TableId
private Long id;
/**
* 收款单id
*/
private Long receiptId;
/**
* 收款单环节
*/
......@@ -39,6 +45,10 @@ public class ReceiptLogDO extends BaseDO {
/**
* 审批流程
*/
private Integer bmpStatus;
private Integer bpmStatus;
/**
* 创建时间
*/
private Date createTime;
}
......@@ -416,4 +416,8 @@ public interface ReceivableMapper extends AbstractMapper<ReceivableDO> {
List<WealthMoneyAmountVO> costDetailAmount();
List<WealthMoneyAmountVO> receivablePageAmount(@Param("query") ReceivableQueryVO query);
List<BatchGenReceiptPageVO> batchGenReceiptPage(@Param("start") int start,@Param("size") int size, @Param("query") BatchGenReceiptPageQueryVO query);
int countBatchGenReceiptPage(@Param("query") BatchGenReceiptPageQueryVO query);
}
package cn.iocoder.yudao.module.wealth.enums;
import cn.hutool.core.util.ArrayUtil;
import cn.iocoder.yudao.framework.common.util.json.core.IntArrayValuable;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
@AllArgsConstructor
@Getter
public enum InvoicingLinkEnum implements IntArrayValuable {
/**
* 申请开票
*/
APPLY_INVOICE(0, "申请开票", "Apply Invoice"),
/**
* 取消开票
*/
CANCEL_INVOICE(1, "取消开票", "Cancel Invoice"),
/**
* 驳回开票
*/
REJECT_INVOICE(2, "驳回开票", "Reject Invoice"),
/**
* 删除开票信息
*/
DELETE_INVOICE_INFO(3, "删除开票", "Delete Invoice Info"),
/**
* 驳回开票信息
*/
REJECT_INVOICE_INFO(4, "驳回开票信息", "Reject Invoice Info"),
/**
* 提交开票
*/
SUBMIT_INVOICE(5, "提交开票", "Submit Invoice"),
/**
* 修改开票资料
*/
MODIFY_INVOICE_INFO(6, "修改开票资料", "Modify Invoice Info");
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(InvoicingLinkEnum::getValue).toArray();
/**
* 状态
*/
private final Integer value;
/**
* 状态中文
*/
private final String nameZh;
/**
* 状态英语
*/
private final String nameEn;
public static InvoicingLinkEnum valueOf(Integer value) {
return ArrayUtil.firstMatch(orderStatus -> orderStatus.getValue().equals(value), InvoicingLinkEnum.values());
}
@Override
public int[] array() {
return ARRAYS;
}
}
......@@ -13,7 +13,7 @@ public enum ReceiptDetailStatusEnum implements IntArrayValuable {
/**
* 未录入
*/
DRAFT(0, "未录入", "Draft"),
NO_INPUT(0, "未录入", "Draft"),
/**
* 未提交
*/
......
package cn.iocoder.yudao.module.wealth.enums;
import cn.hutool.core.util.ArrayUtil;
import cn.iocoder.yudao.framework.common.util.json.core.IntArrayValuable;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
@AllArgsConstructor
@Getter
public enum ReceiptLinkEnum implements IntArrayValuable {
/**
* 创建收款单
*/
CREATE_RECEIPT(0, "创建收款单", "Create Receipt"),
/**
* 编辑收款单
*/
EDIT_RECEIPT(1, "编辑收款单", "Edit Receipt"),
/**
* 提交收款单
*/
SUBMIT_RECEIPT(2, "提交收款单", "Submit Receipt"),
/**
* 反审核收款单
*/
REJECT_RECEIPT(3, "反审核收款单", "Reject Receipt"),
/**
* 审核收款单
*/
APPROVE_RECEIPT(4, "审核收款单", "Approve Receipt"),
/**
* 提交银行收款明细
*/
SUBMIT_BANK_RECEIPT(5, "提交银行收款明细", "Submit Bank Receipt"),
/**
* 反审核银行收款明细
*/
REJECT_BANK_RECEIPT(6, "反审核银行收款明细", "Reject Bank Receipt"),
/**
* 审批银行收款明细
*/
APPROVE_BANK_RECEIPT(7, "审批银行收款明细", "Approve Bank Receipt"),
/**
* 核销收款单
*/
WRITE_OFF_RECEIPT(8, "核销收款单", "Write Off Receipt"),
/**
* 反核销收款单
*/
REJECT_WRITE_OFF_RECEIPT(9, "反核销收款单", "Reject Write Off Receipt");
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(ReceiptLinkEnum::getValue).toArray();
/**
* 状态
*/
private final Integer value;
/**
* 状态中文
*/
private final String nameZh;
/**
* 状态英语
*/
private final String nameEn;
public static ReceiptLinkEnum valueOf(Integer value) {
return ArrayUtil.firstMatch(orderStatus -> orderStatus.getValue().equals(value), ReceiptLinkEnum.values());
}
@Override
public int[] array() {
return ARRAYS;
}
}
......@@ -5,6 +5,8 @@ import cn.iocoder.yudao.framework.mybatis.core.service.IService;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.module.wealth.dal.dataobject.receipt.ReceiptDO;
import cn.iocoder.yudao.module.wealth.vo.receipt.*;
import cn.iocoder.yudao.module.wealth.vo.receiptAccount.ReceiptAccountBatchCreateReqVO;
import cn.iocoder.yudao.module.wealth.vo.receiptAccount.ReceiptAccountBatchRespVO;
import javax.validation.Valid;
import java.util.Collection;
......@@ -168,4 +170,20 @@ public interface ReceiptService extends IService<ReceiptDO> {
* @return
*/
Boolean setBankWriteoffRange(ReceiptBankWriteoffRangeVO range);
/**
* 批量生成收款单
*
* @param createReqVOList
* @return
*/
List<ReceiptBatchGenRespVO> batchGenReceipt(List<ReceiptCreateReqVO> createReqVOList);
/**
* 批量导入收款信息
*
* @param list
* @return
*/
List<ReceiptAccountBatchRespVO> receiptAccountImport(List<ReceiptAccountBatchCreateReqVO> list);
}
......@@ -12,6 +12,7 @@ import cn.iocoder.yudao.framework.dict.core.dto.DictDataRespDTO;
import cn.iocoder.yudao.framework.mybatis.core.service.AbstractService;
import cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.bpm.api.BpmCreateServiceFactory;
import cn.iocoder.yudao.module.bpm.enums.BpmProcessInstanceResultEnum;
......@@ -29,18 +30,22 @@ import cn.iocoder.yudao.module.wealth.dal.dataobject.receiptAccount.ReceiptAccou
import cn.iocoder.yudao.module.wealth.dal.dataobject.receiptApproval.ReceiptApprovalDO;
import cn.iocoder.yudao.module.wealth.dal.dataobject.receiptInvoice.ReceiptInvoiceDO;
import cn.iocoder.yudao.module.wealth.dal.dataobject.receiptItem.ReceiptItemDO;
import cn.iocoder.yudao.module.wealth.dal.dataobject.receiptLog.ReceiptLogDO;
import cn.iocoder.yudao.module.wealth.dal.dataobject.receivable.ReceivableDO;
import cn.iocoder.yudao.module.wealth.dal.mysql.receipt.ReceiptBankWriteoffRangeMapper;
import cn.iocoder.yudao.module.wealth.dal.mysql.receipt.ReceiptMapper;
import cn.iocoder.yudao.module.wealth.dal.mysql.receiptAccount.ReceiptAccountMapper;
import cn.iocoder.yudao.module.wealth.dal.mysql.receiptInvoice.ReceiptInvoiceMapper;
import cn.iocoder.yudao.module.wealth.dal.mysql.receiptItem.ReceiptItemMapper;
import cn.iocoder.yudao.module.wealth.enums.ReceiptStatusEnum;
import cn.iocoder.yudao.module.wealth.dal.mysql.receiptLog.ReceiptLogMapper;
import cn.iocoder.yudao.module.wealth.enums.*;
import cn.iocoder.yudao.module.wealth.service.receiptAccount.ReceiptAccountService;
import cn.iocoder.yudao.module.wealth.service.receiptApproval.ReceiptApprovalService;
import cn.iocoder.yudao.module.wealth.service.receivable.ReceivableService;
import cn.iocoder.yudao.module.wealth.util.InvoiceGenCodeUtils;
import cn.iocoder.yudao.module.wealth.vo.receipt.*;
import cn.iocoder.yudao.module.wealth.vo.receiptAccount.ReceiptAccountBatchCreateReqVO;
import cn.iocoder.yudao.module.wealth.vo.receiptAccount.ReceiptAccountBatchRespVO;
import cn.iocoder.yudao.module.wealth.vo.receiptAccount.ReceiptAccountCreateReqVO;
import cn.iocoder.yudao.module.wealth.vo.receiptInvoice.ReceiptInvoiceCreateReqVO;
import cn.iocoder.yudao.module.wealth.vo.receivable.ReceivableUpdateReqVO;
......@@ -48,6 +53,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.commons.lang3.StringUtils;
import org.springframework.aop.framework.AopContext;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -57,10 +63,7 @@ import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.NumberFormat;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
......@@ -100,6 +103,8 @@ public class ReceiptServiceImpl extends AbstractService<ReceiptMapper, ReceiptDO
private ReceiptInvoiceMapper receiptInvoiceMapper;
@Resource
private InvoiceGenCodeUtils invoiceGenCodeUtils;
@Resource
private ReceiptLogMapper receiptLogMapper;
private static final String RECEIPT_NEW_NUMBER = "receipt:new:number";
......@@ -123,6 +128,7 @@ public class ReceiptServiceImpl extends AbstractService<ReceiptMapper, ReceiptDO
ReceiptDO receipt = ReceiptConvert.INSTANCE.convert(createReqVO);
generateReceiptNo(receipt);
receipt.setDetailStatus(ReceiptDetailStatusEnum.NO_INPUT.getValue());
// 应收明细关联收款单
List<ReceivableDO> receivableDOList = receivableUpdateReqVOList.stream().filter(re -> null != re.getId()).map(re -> {
ReceivableDO receivableDO = ReceivableConvert.INSTANCE.convert(re);
......@@ -150,8 +156,10 @@ public class ReceiptServiceImpl extends AbstractService<ReceiptMapper, ReceiptDO
receiptInvoiceDO.setOrderId(createReqVO.getOrderId());
receiptInvoiceDO.setOrderNo(createReqVO.getOrderNo());
receiptInvoiceMapper.insert(receiptInvoiceDO);
receipt.setInvoiceId(receiptInvoiceDO.getId());
receipt.setInvoicingStatus(InvoicingStatusEnum.WAIT.getValue());
}
receipt.setInvoicingStatus(InvoicingStatusEnum.NO_INVOICE.getValue());
// 是草稿
if (StringUtils.equals(createReqVO.getAddType(), "1")) {
receipt.setState(ReceiptStatusEnum.DRAFT.getValue());
......@@ -181,6 +189,53 @@ public class ReceiptServiceImpl extends AbstractService<ReceiptMapper, ReceiptDO
return receipt.getId();
}
@Override
public List<ReceiptBatchGenRespVO> batchGenReceipt(List<ReceiptCreateReqVO> createReqVOList) {
// TODO 区分批量和单个创建,添加新字段
ArrayList<ReceiptBatchGenRespVO> respVOS = new ArrayList<>();
ReceiptService currentProxy = (ReceiptService)AopContext.currentProxy();
for (ReceiptCreateReqVO receiptCreateReqVO : createReqVOList) {
try {
currentProxy.createReceipt(receiptCreateReqVO);
} catch (Exception e) {
respVOS.add(new ReceiptBatchGenRespVO(receiptCreateReqVO.getOrderNo(), receiptCreateReqVO.getCustomerName(), e.getMessage()));
}
}
return respVOS;
}
@Override
public List<ReceiptAccountBatchRespVO> receiptAccountImport(List<ReceiptAccountBatchCreateReqVO> list) {
// TODO 逻辑待完善
// 校验收款账户信息
List<ReceiptAccountBatchRespVO> respVOS = validateBatchReceiptAccount(list);
// 插入数据
// 校验收款明细自动审核
// 更新收款单
return respVOS;
}
private List<ReceiptAccountBatchRespVO> validateBatchReceiptAccount(List<ReceiptAccountBatchCreateReqVO> list) {
// 根据订单号或提单号是否能查到订单
// 根据订单号或提单号匹配状态≠已核销/草稿状态的收款单是否存在,存在多条匹配创建时间最晚的一条
// 根据上条校验,一个收款单存在一条或多条收款数据弹提示
// 收款账号是否存在,是否匹配
// 校验收款金额
// 校验实收金额币种
// 结算币种需为收款单所在目的国结算币种
// 校验当前收款单汇率是否过期,过期则更新为导入的汇率
return null;
}
/**
* 生成收款单号
*
......@@ -352,7 +407,8 @@ public class ReceiptServiceImpl extends AbstractService<ReceiptMapper, ReceiptDO
// }*/
// //receiptMapper.updateById(ReceiptConvert.INSTANCE.convert(receiptBackVO));
// // 根据客户ID获取用户信息
///* List<ReceivableDO> receivableDOList = receivableService.list(new LambdaQueryWrapper<ReceivableDO>()
/// * List<ReceivableDO> receivableDOList = receivableService.list(new LambdaQueryWrapper<ReceivableDO>()
// .eq(ReceivableDO::getReceiptId, receiptId)
// .eq(ReceivableDO::getDeleted, 0)
// .orderByDesc(ReceivableDO::getId));
......@@ -388,7 +444,6 @@ public class ReceiptServiceImpl extends AbstractService<ReceiptMapper, ReceiptDO
// receiptDO.setState(ReceiptStatusEnum.OPEN_BILL.getValue());
// receiptMapper.updateById(receiptDO);
//}
@Override
@Transactional
public void deleteReceipt(Long id) {
......@@ -954,4 +1009,32 @@ public class ReceiptServiceImpl extends AbstractService<ReceiptMapper, ReceiptDO
receiptBankWriteoffRangeMapper.updateById(BeanUtil.toBean(range, ReceiptBankWriteoffRangeDO.class));
return true;
}
/**
* 设置收款明细状态
*/
private void setReceiptDetailStatus(ReceiptDO receiptDO, ReceiptDetailStatusEnum oldStatus, ReceiptDetailStatusEnum newStatus) {
receiptDO.setDetailStatus(newStatus.getValue());
}
/**
* 记录日志
*/
private void recordLog(Long receiptId, ReceiptLinkEnum linkEnum, String remark, Integer bpmStatus) {
LoginUser user = SecurityFrameworkUtils.getLoginUser();
String username = "";
if (user != null && user.getUsername() != null) {
username = user.getUsername();
}
ReceiptLogDO receiptLogDO = ReceiptLogDO.builder()
.receiptId(receiptId)
.operator(username)
.remark(remark)
.receiptLink(linkEnum.getValue())
.bpmStatus(bpmStatus)
.createTime(new Date())
.build();
receiptLogMapper.insert(receiptLogDO);
}
}
......@@ -63,4 +63,10 @@ public interface ReceiptInvoiceService extends IService<ReceiptInvoiceDO> {
* @return 收款单开票信息列表
*/
List<ReceiptInvoiceDO> getReceiptInvoiceList(ReceiptInvoiceQueryVO query);
Boolean rejectInvoiceInfo(@Valid ReceiptInvoiceOperateReqVO rejectReqVO);
Boolean cancelInvoice(@Valid ReceiptInvoiceOperateReqVO rejectReqVO);
Boolean deleteInvoice(@Valid ReceiptInvoiceOperateReqVO rejectReqVO);
}
......@@ -4,16 +4,26 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.service.AbstractService;
import cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.wealth.convert.receiptInvoice.ReceiptInvoiceConvert;
import cn.iocoder.yudao.module.wealth.convert.receivable.ReceivableConvert;
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.dal.dataobject.receivable.ReceivableDO;
import cn.iocoder.yudao.module.wealth.dal.mysql.receiptInvoice.ReceiptInvoiceMapper;
import cn.iocoder.yudao.module.wealth.dal.mysql.receiptInvoiceLog.ReceiptInvoiceLogMapper;
import cn.iocoder.yudao.module.wealth.dal.mysql.receivable.ReceivableMapper;
import cn.iocoder.yudao.module.wealth.enums.InvoicingLinkEnum;
import cn.iocoder.yudao.module.wealth.vo.receiptInvoice.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.util.Collection;
import java.util.Date;
import java.util.List;
/**
......@@ -27,6 +37,10 @@ public class ReceiptInvoiceServiceImpl extends AbstractService<ReceiptInvoiceMap
@Resource
private ReceiptInvoiceMapper receiptInvoiceMapper;
@Resource
private ReceiptInvoiceLogMapper receiptInvoiceLogMapper;
@Resource
private ReceivableMapper receivableMapper;
@Override
public Long createReceiptInvoice(ReceiptInvoiceCreateReqVO createReqVO) {
......@@ -62,7 +76,15 @@ public class ReceiptInvoiceServiceImpl extends AbstractService<ReceiptInvoiceMap
@Override
public ReceiptInvoiceDetailVO getReceiptInvoiceDetail(Long id) {
return receiptInvoiceMapper.getReceiptInvoiceDetail(id);
ReceiptInvoiceDetailVO receiptInvoiceDetail = receiptInvoiceMapper.getReceiptInvoiceDetail(id);
if (receiptInvoiceDetail == null) {
return null;
}
List<ReceiptInvoiceLogDO> invoiceLogDOS = receiptInvoiceLogMapper.selectList("invoice_id", id);
receiptInvoiceDetail.setInvoiceLog(ReceiptInvoiceConvert.INSTANCE.logDOtoLogVOList(invoiceLogDOS));
List<ReceivableDO> receivableDOS = receivableMapper.selectList(Wrappers.<ReceivableDO>lambdaQuery().eq(ReceivableDO::getReceiptId, receiptInvoiceDetail.getReceiptId()));
receiptInvoiceDetail.setReceivableList(ReceivableConvert.INSTANCE.convertList(receivableDOS));
return receiptInvoiceDetail;
}
@Override
......@@ -81,4 +103,39 @@ public class ReceiptInvoiceServiceImpl extends AbstractService<ReceiptInvoiceMap
public List<ReceiptInvoiceDO> getReceiptInvoiceList(ReceiptInvoiceQueryVO query) {
return receiptInvoiceMapper.selectList(query);
}
@Override
public Boolean rejectInvoiceInfo(ReceiptInvoiceOperateReqVO rejectReqVO) {
return null;
}
@Override
public Boolean cancelInvoice(ReceiptInvoiceOperateReqVO rejectReqVO) {
return null;
}
@Override
public Boolean deleteInvoice(ReceiptInvoiceOperateReqVO rejectReqVO) {
return null;
}
/**
* 记录日志
*/
private void recordLog(Long invoiceId, InvoicingLinkEnum linkEnum, String remark, Integer bpmStatus) {
LoginUser user = SecurityFrameworkUtils.getLoginUser();
String username = "";
if (user != null && user.getUsername() != null) {
username = user.getUsername();
}
ReceiptInvoiceLogDO receiptInvoiceLogDO = ReceiptInvoiceLogDO.builder()
.invoiceId(invoiceId)
.operator(username)
.remark(remark)
.invoicingLink(linkEnum.getValue())
.bpmStatus(bpmStatus)
.createTime(new Date())
.build();
receiptInvoiceLogMapper.insert(receiptInvoiceLogDO);
}
}
......@@ -97,6 +97,7 @@ public class ReceiptItemServiceImpl extends AbstractService<ReceiptItemMapper, R
} else {
throw exception(RECEIPT_NOT_EXISTS);
}
// TODO 更新收款明细核销金额
// 返回
return receiptItem.getId();
}
......
......@@ -258,4 +258,12 @@ public interface ReceivableService extends IService<ReceivableDO> {
* @return
*/
CostDetailBackVO getCostDetailPage(@Valid CostDetailPageQueryVO query, PageVO page);
/**
* 批量生成收款单分页
* @param query
* @param page
* @return
*/
PageResult<BatchGenReceiptPageVO> batchGenReceiptPage(@Valid BatchGenReceiptPageQueryVO query, PageVO page);
}
......@@ -14,6 +14,8 @@ 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.customer.CustomerApi;
import cn.iocoder.yudao.module.ecw.api.customer.dto.CustomerDTO;
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
import cn.iocoder.yudao.module.wealth.convert.receivable.ReceivableConvert;
......@@ -70,6 +72,9 @@ public class ReceivableServiceImpl extends AbstractService<ReceivableMapper, Rec
@Resource
private CurrencyApi currencyApi;
@Resource
private CustomerApi customerApi;
@Override
public Long createReceivable(ReceivableCreateReqVO createReqVO) {
LoginUser user = SecurityFrameworkUtils.getLoginUser();
......@@ -450,4 +455,26 @@ public class ReceivableServiceImpl extends AbstractService<ReceivableMapper, Rec
}
return null;
}
}
@Override
public PageResult<BatchGenReceiptPageVO> batchGenReceiptPage(BatchGenReceiptPageQueryVO query, PageVO page) {
int start = (page.getPage() - 1) * page.getRows();
int size = page.getRows();
List<BatchGenReceiptPageVO> batchGenReceiptPageVOS = receivableMapper.batchGenReceiptPage(start, size, query);
int total = receivableMapper.countBatchGenReceiptPage(query);
batchGenReceiptPageVOS.forEach(vo -> {
CustomerDTO customer;
if (vo.getDrawee().equals(1)) {
customer = customerApi.getCustomerInfo(vo.getConsignorId());
vo.setPayerId(vo.getConsignorId());
} else {
customer = customerApi.getCustomerInfo(vo.getConsigneeId());
vo.setPayerId(vo.getConsigneeId());
}
vo.setCustomerName(customer.getName());
vo.setCustomerNo(customer.getNumber());
vo.setPayerName(vo.getPayerName());
});
return new PageResult<>(batchGenReceiptPageVOS, total, page.getRows(), page.getPage(), (total + page.getRows() - 1) / page.getRows());
}
}
\ No newline at end of file
package cn.iocoder.yudao.module.wealth.vo.receipt;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
@ApiModel("管理后台 - 批量生成收款单结果 VO")
@Data
@AllArgsConstructor
public class ReceiptBatchGenRespVO {
@ApiModelProperty(value = "订单号")
private String orderNo;
@ApiModelProperty(value = "客户名")
private String customerName;
@ApiModelProperty(value = "错误信息")
private String errorMsg;
}
package cn.iocoder.yudao.module.wealth.vo.receipt;
import cn.iocoder.yudao.module.wealth.vo.receiptAccount.ReceiptAccountBackVO;
import cn.iocoder.yudao.module.wealth.vo.receiptAccount.ReceiptAccountCreateReqVO;
import cn.iocoder.yudao.module.wealth.vo.receiptInvoice.ReceiptInvoiceCreateReqVO;
import cn.iocoder.yudao.module.wealth.vo.receiptInvoice.ReceiptInvoicePageBackVO;
import cn.iocoder.yudao.module.wealth.vo.receiptItem.ReceiptItemBackVO;
import cn.iocoder.yudao.module.wealth.vo.receivable.ReceivableBackVO;
import cn.iocoder.yudao.module.wealth.vo.receivable.ReceivableUpdateReqVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import javax.validation.constraints.NotNull;
import java.util.List;
@Data
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel("管理后台 - 收款单详情 VO")
public class ReceiptDetailVO extends ReceiptBaseVO {
@ApiModelProperty(value = "应收项")
private List<ReceivableBackVO> receivableVOList;
@ApiModelProperty(value = "收款信息")
private List<ReceiptAccountBackVO> receiptAccountList;
@ApiModelProperty(value = "开票资料")
private ReceiptInvoicePageBackVO receiptInvoice;
@ApiModelProperty(value = "银行收款单明细")
private List<ReceiptItemBackVO> receiptItemList;
@ApiModelProperty(value = "日志")
private List<ReceiptLogBackVO> receiptLogList;
}
package cn.iocoder.yudao.module.wealth.vo.receipt;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ReceiptLogBackVO {
@ApiModelProperty(value = "主键")
private Long id;
@ApiModelProperty(value = "收款单id")
private Long receiptId;
@ApiModelProperty(value = "收款单环节")
private Integer receiptLink;
@ApiModelProperty(value = "操作人")
private String operator;
@ApiModelProperty(value = "备注")
private String remark;
@ApiModelProperty(value = "审批流程")
private Integer bpmStatus;
@ApiModelProperty(value = "创建时间")
private Date createTime;
}
package cn.iocoder.yudao.module.wealth.vo.receiptAccount;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel("管理后台 - 批量收款信息创建 Request VO")
public class ReceiptAccountBatchCreateReqVO {
@ApiModelProperty(value = "订单号/提单号")
@ExcelProperty("订单号/提单号")
private String orderNo;
@ApiModelProperty(value = "付款人")
@ExcelProperty("付款人")
private String payer;
@ApiModelProperty(value = "收款日期")
@ExcelProperty("收款日期")
private String payDate;
@ApiModelProperty(value = "收款账号")
@ExcelProperty("收款账号")
private String payAccount;
@ApiModelProperty(value = "收款金额")
@ExcelProperty("收款金额")
private String payAmount;
@ApiModelProperty(value = "实收金额币种")
@ExcelProperty("实收金额币种")
private String payCurrency;
@ApiModelProperty(value = "结算币种")
@ExcelProperty("结算币种")
private String settleCurrency;
@ApiModelProperty(value = "汇率")
@ExcelProperty("汇率")
private String settleRate;
@ApiModelProperty(value = "水单号")
@ExcelProperty("水单号")
private String waterNo;
@ApiModelProperty(value = "提交人")
@ExcelProperty("提交人")
private String submitter;
@ApiModelProperty(value = "备注")
@ExcelProperty("备注")
private String remark;
}
package cn.iocoder.yudao.module.wealth.vo.receiptAccount;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel("管理后台 - 批量导入收款信息结果 VO")
public class ReceiptAccountBatchRespVO {
@ApiModelProperty(value = "订单号/提单号")
private String orderNo;
@ApiModelProperty(value = "付款人")
private String payer;
@ApiModelProperty(value = "错误信息")
private String errorMsg;
}
package cn.iocoder.yudao.module.wealth.vo.receiptInvoice;
import cn.iocoder.yudao.module.wealth.vo.receivable.ReceivableBackVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
import java.util.List;
@Data
@ApiModel("管理后台 - 开票详情 VO")
......@@ -77,7 +79,11 @@ public class ReceiptInvoiceDetailVO {
private Date invoiceTime;
// 应收信息
@ApiModelProperty(value = "应收明细")
private List<ReceivableBackVO> receivableList;
// 日志
@ApiModelProperty(value = "日志")
private List<ReceiptInvoiceLogBackVO> invoiceLog;
}
......@@ -34,7 +34,7 @@ public class ReceiptInvoiceLogBackVO {
@ExcelProperty("审批流程")
@ApiModelProperty(value = "审批流程")
private Integer bmpStatus;
private Integer bpmStatus;
@ExcelProperty("创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
......
package cn.iocoder.yudao.module.wealth.vo.receiptInvoice;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import javax.validation.constraints.NotNull;
import java.util.List;
@Data
@ToString(callSuper = true)
@ApiModel("管理后台 - 收款单开票操作(取消,驳回,删除) Request VO")
public class ReceiptInvoiceOperateReqVO {
@ApiModelProperty(value = "主键", required = true)
@NotNull(message = "主键不能为空")
private Long id;
@ApiModelProperty(value = "通知人")
private List<Integer> notifyUserIdList;
@ApiModelProperty(value = "备注")
private String remark;
}
......@@ -3,19 +3,45 @@ package cn.iocoder.yudao.module.wealth.vo.receiptInvoice;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
@ApiModel("管理后台 - 收款单开票信息更新 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class ReceiptInvoiceUpdateReqVO extends ReceiptInvoiceBaseVO {
public class ReceiptInvoiceUpdateReqVO {
@ApiModelProperty(value = "主键", required = true)
@NotNull(message = "主键不能为空")
private Long id;
@ApiModelProperty(value = "发票抬头")
private String invoiceHeader;
@ApiModelProperty(value = "纳税人识别号")
private String taxpayer;
@ApiModelProperty(value = "开户行")
private String accountBank;
@ApiModelProperty(value = "账号")
private String accountName;
@ApiModelProperty(value = "开票品名")
private String invoiceItem;
@ApiModelProperty(value = "税率")
private BigDecimal taxRate;
@ApiModelProperty(value = "开票电话")
private String invoicePhone;
@ApiModelProperty(value = "开票地址")
private String invoiceAddress;
@ApiModelProperty(value = "备注")
private String remark;
}
package cn.iocoder.yudao.module.wealth.vo.receiptItem;
import cn.iocoder.yudao.module.wealth.vo.receivable.ReceivableWriteOffReqVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import java.util.List;
@Data
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel("管理后台 - 收款单明细创建 Request VO")
public class ReceiptItemCreateReqVO extends ReceiptItemBaseVO {
@ApiModelProperty(value = "收款明细核销信息")
private List<ReceivableWriteOffReqVO> receivableWriteOffList;
}
package cn.iocoder.yudao.module.wealth.vo.receivable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
@ApiModel("管理后台 - 批量生成收款单列表查询 Request VO")
public class BatchGenReceiptPageQueryVO {
@ApiModelProperty(value = "订单号")
private String orderNo;
@ApiModelProperty(value = "提单号")
private String tidanNo;
@ApiModelProperty(value = "运输方式id")
private Integer transportId;
@ApiModelProperty(value = "始发仓id(多选)")
private List<Integer> departureWareHouseId;
@ApiModelProperty(value = "目的国(多选)")
private List<Integer> destCountry;
@ApiModelProperty(value = "目的城市(多选)")
private List<Integer> destCity;
@ApiModelProperty(value = "目的仓id(多选)")
private List<Integer> objectiveWareHouseId;
@ApiModelProperty(value = "付款方")
private String payer;
@ApiModelProperty(value = "收货人")
private String consignee;
@ApiModelProperty(value = "发货人")
private String consignor;
}
package cn.iocoder.yudao.module.wealth.vo.receivable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel("管理后台 - 批量生成收款单列表 VO")
public class BatchGenReceiptPageVO {
@ApiModelProperty(value = "订单id")
private Long orderId;
@ApiModelProperty(value = "订单号")
private String orderNo;
@ApiModelProperty(value = "提单号")
private String tidanNo;
@ApiModelProperty(value = "运输方式id")
private Integer transportId;
@ApiModelProperty(value = "始发仓id")
private Integer departureWareHouseId;
@ApiModelProperty(value = "目的仓id")
private Integer objectiveWareHouseId;
@ApiModelProperty(value = "付款人类型(1 发货人 2 收货人)")
private Integer drawee;
@ApiModelProperty(value = "收货人id")
private Long consigneeId;
@ApiModelProperty(value = "发货人id")
private Long consignorId;
@ApiModelProperty(value = "付款人id")
private Long payerId;
@ApiModelProperty(value = "客户编号")
private String customerNo;
@ApiModelProperty(value = "客户姓名")
private String customerName;
@ApiModelProperty(value = "付款名称")
private String payerName;
@ApiModelProperty(value = "订单状态")
private Integer orderStatus;
@ApiModelProperty(value = "自编号状态")
private Integer selfNoStatus;
}
......@@ -216,4 +216,7 @@ public class ReceivableBackVO {
@ApiModelProperty(value = "核销比例")
private BigDecimal writeOffProportion;
//@ApiModelProperty(value = "基准币种汇率")
//private String exchangeRate;
}
package cn.iocoder.yudao.module.wealth.vo.receivable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
@Data
@ApiModel("管理后台 - 应收款核销 Request VO")
public class ReceivableWriteOffReqVO {
@ApiModelProperty(value = "主键", required = true)
@NotNull(message = "主键不能为空")
private Long id;
@ApiModelProperty(value = "基准币种汇率")
private BigDecimal baseCurrencyRate;
@ApiModelProperty(value = "核销金额")
@NotNull(message = "核销金额不能为空")
private BigDecimal writeOffAmount;
}
......@@ -10,6 +10,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
import cn.iocoder.yudao.framework.dict.core.dto.DictDataRespDTO;
import cn.iocoder.yudao.framework.dict.core.util.DictFrameworkUtils;
import cn.iocoder.yudao.framework.excel.util.ExcelUtils;
import cn.iocoder.yudao.framework.idempotent.core.annotation.Idempotent;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
......@@ -29,12 +30,15 @@ import cn.iocoder.yudao.module.wealth.service.receiptApproval.ReceiptApprovalSer
import cn.iocoder.yudao.module.wealth.service.receivable.ReceivableService;
import cn.iocoder.yudao.module.wealth.vo.receipt.*;
import cn.iocoder.yudao.module.wealth.vo.receiptAccount.ReceiptAccountBackVO;
import cn.iocoder.yudao.module.wealth.vo.receiptAccount.ReceiptAccountBatchCreateReqVO;
import cn.iocoder.yudao.module.wealth.vo.receiptAccount.ReceiptAccountBatchRespVO;
import cn.iocoder.yudao.module.wealth.vo.receiptApproval.ReceiptApprovalBackVO;
import cn.iocoder.yudao.module.wealth.vo.receivable.ReceivableBackVO;
import cn.iocoder.yudao.module.wealth.vo.receivable.ReceivableQueryVO;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
......@@ -44,13 +48,16 @@ import org.apache.poi.xssf.usermodel.XSSFDrawing;
import org.apache.poi.xssf.usermodel.XSSFPicture;
import org.apache.poi.xssf.usermodel.XSSFShape;
import org.springframework.core.io.ClassPathResource;
import org.springframework.http.MediaType;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.math.BigDecimal;
import java.net.URLEncoder;
import java.util.Collection;
......@@ -348,6 +355,22 @@ public class ReceiptController {
return success(receiptService.setBankWriteoffRange(range));
}
@PostMapping("/batch-gen-receipt")
@ApiOperation("批量生成收款单")
public CommonResult<List<ReceiptBatchGenRespVO>> batchGenReceipt(@RequestBody List<ReceiptCreateReqVO> createReqVOList) {
return success(receiptService.batchGenReceipt(createReqVOList));
}
@PostMapping(value = "receipt-account/import", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
@ApiOperation("批量银行收款信息导入")
@ApiImplicitParams({
@ApiImplicitParam(name = "file", value = "Excel 文件", required = true, dataTypeClass = MultipartFile.class)
})
public CommonResult<List<ReceiptAccountBatchRespVO>> receiptAccountImport(@RequestParam("file") MultipartFile file) throws IOException {
List<ReceiptAccountBatchCreateReqVO> list = ExcelUtils.read(file, ReceiptAccountBatchCreateReqVO.class);
return success(receiptService.receiptAccountImport(list));
}
@GetMapping("/export-excel")
@ApiOperation("导出收款单 Excel")
......
......@@ -51,6 +51,29 @@ public class ReceiptInvoiceController {
return success(pageResult);
}
@PostMapping("/reject")
@ApiOperation("驳回开票信息")
public CommonResult<Boolean> rejectInvoiceInfo(@RequestBody @Valid ReceiptInvoiceOperateReqVO rejectReqVO) {
Boolean res = receiptInvoiceService.rejectInvoiceInfo(rejectReqVO);
return success(res);
}
@PostMapping("/cancel")
@ApiOperation("取消开票")
public CommonResult<Boolean> cancelInvoice(@RequestBody @Valid ReceiptInvoiceOperateReqVO rejectReqVO) {
Boolean res = receiptInvoiceService.cancelInvoice(rejectReqVO);
return success(res);
}
@PostMapping("/delete")
@ApiOperation("删除开票")
public CommonResult<Boolean> deleteInvoice(@RequestBody @Valid ReceiptInvoiceOperateReqVO rejectReqVO) {
Boolean res = receiptInvoiceService.deleteInvoice(rejectReqVO);
return success(res);
}
//@GetMapping("/export-excel")
//@ApiOperation("导出收款单开票信息 Excel")
//@OperateLog(type = EXPORT)
......
......@@ -104,6 +104,12 @@ public class ReceivableController {
CostDetailBackVO pageResult = receivableService.getCostDetailPage(query, page);
return success(pageResult);
}
@PostMapping("/batch-gen-receipt/page")
@ApiOperation("财务-批量生成收款单列表")
public CommonResult<PageResult<BatchGenReceiptPageVO>> batchGenReceiptPage(@Valid @RequestBody BatchGenReceiptPageQueryVO query, PageVO page) {
return success(receivableService.batchGenReceiptPage(query, page));
}
/*
@GetMapping("/list")
@ApiOperation("根据id集合获得应收款列表")
......
......@@ -250,4 +250,108 @@
AND er.currency_id IS NOT NULL
GROUP BY er.currency_id
</select>
<select id="batchGenReceiptPage" resultType="cn.iocoder.yudao.module.wealth.vo.receivable.BatchGenReceiptPageVO">
SELECT
r.order_id,
r.order_no,
e.tidan_no,
e.transport_id,
de.departure_warehouse_id,
ob.objective_warehouse_id,
e.status AS order_status,
e.drawee,
nee.customer_id AS consignee_id,
nor.customer_id AS consignor_id
FROM ecw_receivable r
LEFT JOIN ecw_order e ON r.order_id = e.order_id
LEFT JOIN ecw_order_consignee nee ON nee.order_id = r.order_id
LEFT JOIN ecw_order_consignor nor ON nor.order_id = r.order_id
LEFT JOIN ecw_order_departure de ON de.order_id = r.order_id
LEFT JOIN ecw_order_objective ob ON ob.order_id = r.order_id
WHERE r.deleted = 0 AND r.receipt_id IS NULL
<include refid="batchGenReceiptPageCondition"/>
GROUP BY r.order_id
ORDER BY r.order_id
LIMIT #{start}, #{size}
</select>
<select id="countBatchGenReceiptPage" resultType="java.lang.Integer">
SELECT COUNT(DISTINCT r.order_id)
FROM ecw_receivable r
LEFT JOIN ecw_order e ON r.order_id = e.order_id
<if test="query.consignee != null and query.consignee != ''">
LEFT JOIN ecw_order_consignee nee ON nee.order_id = r.order_id
</if>
<if test="query.consignor != null and query.consignor != ''">
LEFT JOIN ecw_order_consignor nor ON nor.order_id = r.order_id
</if>
<if test="query.departureWareHouseId != null">
LEFT JOIN ecw_order_departure de ON de.order_id = r.order_id
</if>
<if test="query.objectiveWareHouseId != null or query.destCity != null or query.destCountry != null">
LEFT JOIN ecw_order_objective ob ON ob.order_id = r.order_id
</if>
WHERE r.deleted = 0 AND r.receipt_id IS NULL
<include refid="batchGenReceiptPageCondition"/>
</select>
<sql id="batchGenReceiptPageCondition">
<if test="query.orderNo != null and query.orderNo != ''">
AND r.order_no = #{query.orderNo}
</if>
<if test="query.tidanNo != null and query.tidanNo!= ''">
AND e.tidan_no = #{query.tidanNo}
</if>
<if test="query.transportId != null">
AND e.transport_id = #{query.transportId}
</if>
<if test="query.departureWareHouseId != null">
<if test="query.departureWareHouseId.size() == 1">
AND de.departure_warehouse_id = #{query.departureWareHouseId[0]}
</if>
<if test="query.departureWareHouseId.size() > 1">
AND de.departure_warehouse_id IN
<foreach collection="query.departureWareHouseId" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</if>
<if test="query.destCountry != null">
<if test="query.destCountry.size() == 1">
AND ob.objective_country_id = #{query.destCountry[0]}
</if>
<if test="query.destCountry.size() > 1">
AND ob.objective_country_id IN
<foreach collection="query.destCountry" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</if>
<if test="query.destCity != null">
<if test="query.destCity.size() == 1">
AND ob.objective_id = #{query.destCity[0]}
</if>
<if test="query.destCity.size() > 1">
AND ob.objective_id IN
<foreach collection="query.destCity" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</if>
<if test="query.objectiveWareHouseId != null">
<if test="query.objectiveWareHouseId.size() == 1">
AND ob.objective_warehouse_id = #{query.objectiveWareHouseId[0]}
</if>
<if test="query.objectiveWareHouseId.size() > 1">
AND ob.objective_warehouse_id IN
<foreach collection="query.objectiveWareHouseId" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</if>
<if test="query.consignee != null and query.consignee != ''">
AND nee.name = #{query.consignee}
</if>
<if test="query.consignor != null and query.consignor != ''">
AND nor.name = #{query.consignor}
</if>
</sql>
</mapper>
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