Commit 24d94c20 authored by zhangfeng's avatar zhangfeng

feat(wealth): 收款单,银行收款明细

parent 076b357b
# 刷新应收款基准币种
UPDATE ecw_receivable er
SET base_currency_id = (SELECT er.import_currency5
FROM ecw_region er
WHERE er.id = (SELECT eoo.objective_country_id
FROM ecw_order_objective eoo
WHERE eoo.order_id = er.order_id));
\ No newline at end of file
WHERE eoo.order_id = er.order_id))
WHERE base_currency_id IS NULL;
# 刷新银行明细流水号
UPDATE ecw_receipt_item AS t1
JOIN (
SELECT
id,
CONCAT(
'YHMX',
DATE_FORMAT(create_time, '%Y%m%d'),
LPAD(ROW_NUMBER() OVER (PARTITION BY DATE(create_time) ORDER BY create_time), 5, '0')
) AS new_serial_number
FROM ecw_receipt_item
) AS t2
ON t1.id = t2.id
SET t1.serial_number = t2.new_serial_number
WHERE t1.serial_number IS NULL;
# 刷新银行明细审核通过时间
UPDATE ecw_receipt_item
SET approval_time = update_time
WHERE approval_time IS NULL AND `status` = 1;
# 刷新银行明细审核核销币种
UPDATE ecw_receipt_item SET write_off_currency_id = 1 WHERE write_off_currency_id IS NULL
\ No newline at end of file
......@@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.wealth.convert.receipt;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.wealth.dal.dataobject.receiptLog.ReceiptLogDO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import cn.iocoder.yudao.module.wealth.vo.receipt.*;
......@@ -56,4 +57,6 @@ public interface ReceiptConvert {
* @return
*/
PageResult<ReceiptBackVO> convertPage(PageResult<ReceiptDO> page);
List<ReceiptLogBackVO> convertLogList(List<ReceiptLogDO> receiptLogDOS);
}
......@@ -23,7 +23,7 @@ public interface ReceiptInvoiceConvert {
* @param bean
* @return
*/
ReceiptInvoiceDO convert(ReceiptInvoiceCreateReqVO bean);
ReceiptInvoiceDO convert(InvoiceCreateReqVO bean);
/***
* 修改VO转实体
......@@ -58,4 +58,8 @@ public interface ReceiptInvoiceConvert {
ReceiptInvoiceDO convert(ReceiptInvoiceUpdateInfoReqVO updateReqVO);
ReceiptInvoiceDetailVO convert(ReceiptDO receiptDO);
ReceiptInvoiceDO convertInvoiceCreateReqVO(ReceiptInvoiceCreateReqVO receiptInvoiceCreateReqVO);
InvoiceInReceiptRespVO convertRespVO(ReceiptInvoiceDO receiptInvoiceDO);
}
......@@ -100,5 +100,8 @@ public class ReceiptItemDO extends BaseDO {
* 当前流程ID
*/
private String bmpId;
/**
* 审核通过时间
*/
private Date approvalTime;
}
package cn.iocoder.yudao.module.wealth.dal.dataobject.receivable;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
import java.math.BigDecimal;
@Data
@TableName("ecw_receivable_write_off_record")
@EqualsAndHashCode(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ReceivableWriteOffRecord extends BaseDO {
@TableId
private Long id;
private Long receivableId;
private Long receiptItemId;
private BigDecimal writeOffAmount;
}
......@@ -3,7 +3,7 @@ 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 cn.iocoder.yudao.module.wealth.vo.receiptItem.ReceiptItemRespVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
......@@ -13,7 +13,7 @@ import java.util.List;
@Mapper
public interface BankReceiptDetailsMapper {
List<ReceiptItemResp> getBankReceiptDetailsList(ReceiptItemReq req);
List<ReceiptItemRespVO> getBankReceiptDetailsList(ReceiptItemReq req);
long GetCount(ReceiptItemReq req);
......
package cn.iocoder.yudao.module.wealth.dal.mysql.receivable;
import cn.iocoder.yudao.framework.mybatis.core.mapper.AbstractMapper;
import cn.iocoder.yudao.module.wealth.dal.dataobject.receivable.ReceivableWriteOffRecord;
import org.apache.ibatis.annotations.Mapper;
/**
* 应收明细核销记录 Mapper
*/
@Mapper
public interface ReceivableWriteOffRecordMapper extends AbstractMapper<ReceivableWriteOffRecord> {
}
......@@ -110,5 +110,5 @@ public interface ErrorCodeConstants {
ErrorCode RECEIVABLE_WRITE_OFF_ING_NO_NEED_TO_PACK = new ErrorCode(1004520038, "wealth.receivable_write_off_ing_no_need_to_pack");
ErrorCode RECEIPT_ITEM_RECEIVABLE_WRITE_OFF_LIST_EMPTY = new ErrorCode(1004520041, "收款明细对应的应收明细核销记录为空");
}
......@@ -13,7 +13,8 @@ public enum ReceiptItemStatusEnum implements IntArrayValuable {
DRAFT(0, "待核销", "DRAFT"),
WRITE_OFF(1, "已核销", "WRITE_OFF"),
WRITE_OFF_APPROVE_ING(2, "核销审核中", "WRITE_OFF_APPROVE_ING"),
WRITE_OFF_NO_APPROVE_ING(3, "反核销审核中", "WRITE_OFF_NO_APPROVE_ING");
WRITE_OFF_NO_APPROVE_ING(3, "反核销审核中", "WRITE_OFF_NO_APPROVE_ING"),
WRITE_OFF_APPROVE_REJECT(4, "核销审批拒绝", "WRITE_OFF_APPROVE_REJECT");
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(ReceiptItemStatusEnum::getValue).toArray();
......
package cn.iocoder.yudao.module.wealth.listener;
import cn.iocoder.yudao.module.wealth.listener.event.ReceiptItemWriteOffEvent;
import cn.iocoder.yudao.module.wealth.service.receiptItem.ReceiptItemService;
import lombok.AllArgsConstructor;
import org.springframework.context.event.EventListener;
/**
* 银行收款明细审核通过监听
*/
@AllArgsConstructor
public class ReceiptItemWriteOffListener {
private final ReceiptItemService receiptItemService;
/**
* 银行收款明细审核通过更新应收核销金额
* @param event 编号记录
*/
@EventListener(ReceiptItemWriteOffEvent.class)
public void onReceiptItemWriteOff(ReceiptItemWriteOffEvent event) {
receiptItemService.verification(event.getId());
}
}
package cn.iocoder.yudao.module.wealth.listener.event;
import lombok.AllArgsConstructor;
import lombok.Data;
/**
* 银行收款明细审核通过 Event
*/
@Data
@AllArgsConstructor
public class ReceiptItemWriteOffEvent {
/**
* 主键
*/
private Long id;
}
......@@ -13,12 +13,14 @@ 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.ReceiptItemStatusEnum;
import cn.iocoder.yudao.module.wealth.enums.ReceiptStatusEnum;
import cn.iocoder.yudao.module.wealth.listener.event.ReceiptItemWriteOffEvent;
import cn.iocoder.yudao.module.wealth.service.receipt.ReceiptService;
import cn.iocoder.yudao.module.wealth.service.receiptApproval.ReceiptApprovalService;
import cn.iocoder.yudao.module.wealth.service.receivable.ReceivableService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -49,6 +51,8 @@ public class FinanceReceiptApproveService {
private ReceiptApprovalService receiptApprovalService;
@Resource
private ReceivableService receivableService;
@Resource
private ApplicationContext applicationContext;
@Transactional
public void financeApproveCallBack(String bmpKey, String businessKey, Integer result) {
......@@ -234,6 +238,7 @@ public class FinanceReceiptApproveService {
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())) {
......@@ -250,11 +255,12 @@ public class FinanceReceiptApproveService {
}
receiptService.updateReceiptItemStatus(receiptItemDO.getReceiptId());
} else if (result == BpmProcessInstanceResultEnum.REJECT.getResult()) {
updateReceiptItem.setStatus(ReceiptItemStatusEnum.DRAFT.getValue());
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(updateReceiptItem.getId()));
} else if (StrUtil.equals(WorkFlowEmus.FINANCE_RECEIPT_ITEM_WRITE_OFF_NO.getKey(), bmpKey)) {
//收款单明细核销反审核
if (null == receiptApprovalDO.getReceiptItemId()) {
......
......@@ -186,4 +186,11 @@ public interface ReceiptService extends IService<ReceiptDO> {
* @param bpmId 审批流程
*/
void recordLog(Long receiptId, ReceiptLinkEnum linkEnum, String remark, String bpmId);
/**
* 获得收款单详情
* @param id
* @return
*/
ReceiptBackVO getReceiptDetail(Long id);
}
......@@ -20,7 +20,7 @@ public interface ReceiptInvoiceService extends IService<ReceiptInvoiceDO> {
* @param createReqVO 创建信息
* @return 编号
*/
Long createReceiptInvoice(@Valid ReceiptInvoiceCreateReqVO createReqVO);
Long createReceiptInvoice(@Valid InvoiceCreateReqVO createReqVO);
/**
* 更新收款单开票信息
......
......@@ -3,7 +3,6 @@ package cn.iocoder.yudao.module.wealth.service.receiptInvoice;
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
import cn.iocoder.yudao.framework.common.exception.ServiceException;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.i18n.core.I18nMessage;
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;
......@@ -76,7 +75,7 @@ public class ReceiptInvoiceServiceImpl extends AbstractService<ReceiptInvoiceMap
@Override
@Transactional(rollbackFor = Exception.class)
public Long createReceiptInvoice(ReceiptInvoiceCreateReqVO createReqVO) {
public Long createReceiptInvoice(InvoiceCreateReqVO createReqVO) {
// 查询收款单
ReceiptDO receiptDO = receiptMapper.selectById(createReqVO.getReceiptId());
if (receiptDO == null) {
......
......@@ -5,14 +5,15 @@ import cn.iocoder.yudao.framework.common.util.io.FileModel;
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.receipt.ReceiptMapper;
import cn.iocoder.yudao.module.wealth.dal.mysql.receiptItem.BankReceiptDetailsMapper;
import cn.iocoder.yudao.module.wealth.vo.receipt.ReceiptRelationOrderInfoVO;
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 cn.iocoder.yudao.module.wealth.vo.receiptItem.ReceiptItemRespVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
......@@ -31,46 +32,43 @@ public class BankReceiptDetailsImpl implements BankReceiptDetailsService {
@Resource
private BankReceiptDetailsMapper bankReceiptDetailsMapper;
@Autowired
@Resource
private AdminUserService adminUserService;
@Resource
private ReceiptMapper receiptMapper;
public PageResult<ReceiptItemResp> getBankReceiptDetailsList(ReceiptItemReq req) {
IPage<ReceiptItemResp> mpPage = MyBatisUtils.buildPage(req);
public PageResult<ReceiptItemRespVO> getBankReceiptDetailsList(ReceiptItemReq req) {
IPage<ReceiptItemRespVO> mpPage = MyBatisUtils.buildPage(req);
long total = bankReceiptDetailsMapper.GetCount(req);
if (total == 0) {
return PageResult.empty();
}
int start = (req.getPageNo() - 1) * req.getPageSize();
req.setStart(start);
List<AdminUserDO> ListUser = adminUserService.getUsersList();
Map<Long, String> userMap =
ListUser.stream().collect(
Collectors.toMap((AdminUserDO::getId), AdminUserDO::getNickname));
Map<Long, String> userMap = ListUser.stream().collect(Collectors.toMap((AdminUserDO::getId), AdminUserDO::getNickname));
List<ReceiptItemResp> list =
bankReceiptDetailsMapper.getBankReceiptDetailsList(req);
for (ReceiptItemResp r : list
) {
if (r.getCreator() == null || r.getCreator().length() == 0)
List<ReceiptItemRespVO> list = bankReceiptDetailsMapper.getBankReceiptDetailsList(req);
for (ReceiptItemRespVO r : list) {
if (r.getCreator() == null || r.getCreator().isEmpty()) {
r.setCreator("");
else {
} else {
Long l = Long.parseLong(r.getCreator());
r.setCreator(userMap.get(l));
}
r.setAttrList(getFileList(r.getAttr()));
if(r.getCreateBpm()==null||r.getCreator().length()==0)
{
if(r.getCreateBpm()==null|| r.getCreator().isEmpty()) {
r.setCreateBpm("");
}
else
{
} else {
Long l2 = Long.parseLong(r.getCreateBpm());
r.setCreateBpm(userMap.get(l2));
}
List<ReceiptRelationOrderInfoVO> orderInfoList = receiptMapper.getOrderInfoByReceiptId(r.getReceiptId());
r.setOrderInfoList(orderInfoList);
}
return new PageResult<>(list, total, mpPage.getSize(),
req.getPageNo(), (total + mpPage.getSize() - 1) / mpPage.getSize());
return new PageResult<>(list, total, mpPage.getSize(), req.getPageNo(), (total + mpPage.getSize() - 1) / mpPage.getSize());
}
@Override
......
......@@ -4,11 +4,11 @@ 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;
import cn.iocoder.yudao.module.wealth.vo.receiptItem.ReceiptItemRespVO;
public interface BankReceiptDetailsService {
PageResult<ReceiptItemResp> getBankReceiptDetailsList(ReceiptItemReq req);
PageResult<ReceiptItemRespVO> getBankReceiptDetailsList(ReceiptItemReq req);
PageResult<BankIncomeItemResp> getBankIncomeItemPage(BankIncomeItemReq req);
}
......@@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.wealth.service.receivable;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.service.IService;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.module.wealth.dal.dataobject.receiptItem.ReceiptItemDO;
import cn.iocoder.yudao.module.wealth.dal.dataobject.receivable.ReceivableDO;
import cn.iocoder.yudao.module.wealth.vo.receivable.*;
......@@ -267,7 +268,7 @@ public interface ReceivableService extends IService<ReceivableDO> {
*/
PageResult<BatchGenReceiptPageVO> batchGenReceiptPage(@Valid BatchGenReceiptPageQueryVO query, PageVO page);
void writeOffByReceiptItem(List<ReceivableWriteOffReqVO> receivableWriteOffList);
Long getDestCountryCurrencyId(Long orderId);
void createWriteOffRecord(ReceivableWriteOffReqVO receivableWriteOffReqVO, ReceiptItemDO receiptItem);
}
......@@ -4,7 +4,6 @@ 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;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.i18n.core.I18nMessage;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
......@@ -25,16 +24,18 @@ 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;
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.dataobject.receivable.ReceivableDO;
import cn.iocoder.yudao.module.wealth.dal.dataobject.receivable.ReceivableWriteOffRecord;
import cn.iocoder.yudao.module.wealth.dal.dataobject.receivableDiscount.ReceivableDiscountDO;
import cn.iocoder.yudao.module.wealth.dal.mysql.receivable.ReceivableMapper;
import cn.iocoder.yudao.module.wealth.dal.mysql.receivable.ReceivableWriteOffRecordMapper;
import cn.iocoder.yudao.module.wealth.service.receipt.ReceiptService;
import cn.iocoder.yudao.module.wealth.service.receivableDiscount.ReceivableDiscountService;
import cn.iocoder.yudao.module.wealth.vo.receivable.*;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
......@@ -60,34 +61,28 @@ import static cn.iocoder.yudao.module.wealth.enums.ErrorCodeConstants.*;
@Validated
public class ReceivableServiceImpl extends AbstractService<ReceivableMapper, ReceivableDO> implements ReceivableService {
@Autowired
@Resource
private ReceivableMapper receivableMapper;
@Resource
@Lazy
private ReceiptService receiptService;
@Resource
private ReceivableDiscountService receivableDiscountService;
@Resource
private AdminUserApi adminUserApi;
@Autowired
@Resource
private ApplicationContext applicationContext;
@Resource
private CurrencyApi currencyApi;
@Resource
private CustomerApi customerApi;
@Resource
private RegionApi regionApi;
@Resource
@Lazy
private OrderApi orderApi;
@Resource
private ReceivableWriteOffRecordMapper receivableWriteOffRecordMapper;
@Override
public Long createReceivable(ReceivableCreateReqVO createReqVO) {
......@@ -253,7 +248,7 @@ public class ReceivableServiceImpl extends AbstractService<ReceivableMapper, Rec
receivableBackVO.setDiscountTotal(BigDecimal.ZERO);
}
receivableBackVO.setNotIncludedTaxAmount(receivableBackVO.getTotalAmount());
receivableBackVO.setActualAmount(receivableBackVO.getTaxAmount().subtract(receivableBackVO.getDiscountTotal()));
receivableBackVO.setActualAmount(receivableBackVO.getNotIncludedTaxAmount().subtract(receivableBackVO.getDiscountTotal()));
ExchangeRateRespDTO currencyRate = currencyApi.getCurrencyRate(receivableBackVO.getCurrencyId(), receivableBackVO.getBaseCurrencyId());
receivableBackVO.setExchangeRate(currencyRate.getCurrencyRate());
receivableBackVO.setBaseAmount(receivableBackVO.getActualAmount().multiply(currencyRate.getCurrencyRate()));
......@@ -566,22 +561,6 @@ public class ReceivableServiceImpl extends AbstractService<ReceivableMapper, Rec
return new PageResult<>(batchGenReceiptPageVOS, total, page.getRows(), page.getPage(), (total + page.getRows() - 1) / page.getRows());
}
@Override
public void writeOffByReceiptItem(List<ReceivableWriteOffReqVO> receivableWriteOffList) {
if (CollectionUtil.isEmpty(receivableWriteOffList)) {
throw new ServiceException();
}
for (ReceivableWriteOffReqVO receivableWriteOffReqVO : receivableWriteOffList) {
ReceivableDO receivableDO = receivableMapper.selectById(receivableWriteOffReqVO.getId());
if (receivableDO == null) {
// 找不到对应的应收收款报错
}
receivableDO.setWriteOffAmount(receivableWriteOffReqVO.getWriteOffAmount().add(receivableDO.getWriteOffAmount()));
// TODO:是否更新汇率?是否每次更新基准金额,汇率变动时如何处理
receivableMapper.updateById(receivableDO);
}
}
@Override
public Long getDestCountryCurrencyId(Long orderId) {
Long countryId = orderApi.getDestCountryByOrderId(orderId);
......@@ -591,4 +570,18 @@ public class ReceivableServiceImpl extends AbstractService<ReceivableMapper, Rec
RegionDTO regionById = regionApi.getRegionById(countryId);
return Long.parseLong(regionById.getImportCurrency5());
}
@Override
public void createWriteOffRecord(ReceivableWriteOffReqVO receivableWriteOffReqVO, ReceiptItemDO receiptItem) {
ReceivableDO receivableDO = receivableMapper.selectById(receivableWriteOffReqVO.getReceivableId());
if (receivableDO == null) {
throw exception(RECEIVABLE_NOT_EXISTS);
}
ReceivableWriteOffRecord writeOffRecord = ReceivableWriteOffRecord.builder()
.receivableId(receivableWriteOffReqVO.getReceivableId())
.writeOffAmount(receivableWriteOffReqVO.getWriteOffAmount())
.receiptItemId(receiptItem.getId())
.build();
receivableWriteOffRecordMapper.insert(writeOffRecord);
}
}
\ No newline at end of file
package cn.iocoder.yudao.module.wealth.vo.receipt;
import cn.iocoder.yudao.module.wealth.vo.receiptInvoice.InvoiceInReceiptRespVO;
import cn.iocoder.yudao.module.wealth.vo.receiptInvoice.ReceiptInvoiceBaseVO;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......@@ -75,63 +77,6 @@ public class ReceiptBackVO {
@ApiModelProperty(value = "手续费")
private java.math.BigDecimal feeRate;
@ExcelProperty("发票抬头")
@ApiModelProperty(value = "发票抬头")
private String invoice;
@ExcelProperty("纳税人识别号")
@ApiModelProperty(value = "纳税人识别号")
private String taxpayer;
@ExcelProperty("开户行")
@ApiModelProperty(value = "开户行")
private String accountBank;
@ExcelProperty("账号")
@ApiModelProperty(value = "账号")
private String accountName;
@ExcelProperty("项目")
@ApiModelProperty(value = "项目")
private String projectName;
@ExcelProperty("税率")
@ApiModelProperty(value = "税率")
private java.math.BigDecimal taxRate;
@ExcelProperty("开票地址、电话")
@ApiModelProperty(value = "开票地址、电话")
private String addressPhone;
@ExcelProperty("实收日期")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "实收日期")
private Date payedAt;
@ExcelProperty("发票号码")
@ApiModelProperty(value = "发票号码")
private String invoiceNumber;
@ExcelProperty("开票类型(字典表 invoicing_type)")
@ApiModelProperty(value = "开票类型(字典表 invoicing_type)")
private Integer invoicingTypeId;
@ExcelProperty("开票类型名称")
@ApiModelProperty(value = "开票类型名称")
private String invoicingType;
@ExcelProperty("开票备注")
@ApiModelProperty(value = "开票备注")
private String invoicingRemark;
@ExcelProperty("通知人id")
@ApiModelProperty(value = "通知人id")
private Long noticeAdminId;
@ExcelProperty("通知人名称")
@ApiModelProperty(value = "通知人名称")
private String noticeAdminName;
@ExcelProperty("收款人id")
@ApiModelProperty(value = "收款人id")
private Long payeeId;
......@@ -165,20 +110,10 @@ public class ReceiptBackVO {
@ApiModelProperty(value = "核销时间")
private Date writeOffAt;
@ExcelProperty("开票时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开票时间")
private Date invoicingAt;
@ExcelProperty("数据来源(pc端,mobile端)")
@ApiModelProperty(value = "数据来源(pc端,mobile端)")
private String source;
@ExcelProperty("创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "创建时间")
private Date createTime;
@ExcelProperty("是否需要开票")
@ApiModelProperty(value = "是否需要开票0-不需要1需要")
private Integer openInvoice;
......@@ -222,6 +157,24 @@ public class ReceiptBackVO {
@ApiModelProperty(value = "开票id")
private Long invoiceId;
@ApiModelProperty(value = "生成路径")
private Integer generatePath;
@ApiModelProperty(value = "开票信息")
private InvoiceInReceiptRespVO invoiceVO;
@ApiModelProperty(value = "相关订单信息列表")
private List<ReceiptRelationOrderInfoVO> orderInfoList;
@ApiModelProperty(value = "收款单日志列表")
private List<ReceiptLogBackVO> logList;
@ApiModelProperty(value = "创建时间")
private Date createTime;
@ApiModelProperty(value = "更新时间")
private Date updateTime;
@ApiModelProperty(value = "创建人")
private String creator;
@ApiModelProperty(value = "更新人")
private String updater;
}
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
......
......@@ -30,7 +30,7 @@ public class ReceiptLogBackVO {
private String remark;
@ApiModelProperty(value = "审批流程")
private Integer bpmStatus;
private String bpmStatus;
@ApiModelProperty(value = "创建时间")
private Date createTime;
......
package cn.iocoder.yudao.module.wealth.vo.receipt;
import cn.iocoder.yudao.module.wealth.vo.receiptAccount.ReceiptAccountCreateReqVO;
import cn.iocoder.yudao.module.wealth.vo.receiptInvoice.InvoiceCreateReqVO;
import cn.iocoder.yudao.module.wealth.vo.receiptInvoice.ReceiptInvoiceCreateReqVO;
import cn.iocoder.yudao.module.wealth.vo.receivable.ReceivableUpdateReqVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......@@ -31,6 +33,9 @@ public class ReceiptUpdateReqVO extends ReceiptBaseVO {
@ApiModelProperty(value = "收款信息")
private List<ReceiptAccountCreateReqVO> receiptAccountList;
@ApiModelProperty(value = "开票资料")
private ReceiptInvoiceCreateReqVO receiptInvoice;
@ApiModelProperty(value = "抄送人")
private String[] copyUserList;
......
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 java.math.BigDecimal;
@Data
@ToString(callSuper = true)
@ApiModel("管理后台 - 收款单开票信息创建 Request VO")
public class InvoiceCreateReqVO {
@ApiModelProperty(value = "收款单id", required = true)
private Long receiptId;
@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 invoiceRemark;
}
package cn.iocoder.yudao.module.wealth.vo.receiptInvoice;
import com.fasterxml.jackson.annotation.JsonFormat;
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_HOUR_MINUTE_SECOND;
/**
* 收款单详情中的发票信息返回
*/
@Data
public class InvoiceInReceiptRespVO {
@ApiModelProperty(value = "开票编号")
private String invoiceNo;
@ApiModelProperty(value = "发票抬头")
private String invoice;
@ApiModelProperty(value = "纳税人识别号")
private String taxpayer;
@ApiModelProperty(value = "税率")
private java.math.BigDecimal taxRate;
@ApiModelProperty(value = "开票电话/地址")
private String addressPhone;
@ApiModelProperty(value = "开票品名")
private String projectName;
@ApiModelProperty(value = "开票资料备注")
private String invoiceRemark;
@ApiModelProperty(value = "发票号码")
private String invoiceNumber;
@ApiModelProperty(value = "开票类型(字典表 invoicing_type)")
private Integer invoiceTypeId;
@ApiModelProperty(value = "开票金额")
private java.math.BigDecimal invoiceMoney;
@ApiModelProperty(value = "开票币种")
private Long currencyId;
@ApiModelProperty(value = "开发票人id")
private Long invoicerId;
@ApiModelProperty(value = "开票时间")
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date invoiceTime;
@ApiModelProperty(value = "开票信息备注")
private String invoiceInfoRemark;
}
......@@ -16,7 +16,7 @@ public class ReceiptInvoiceCreateReqVO {
private Long receiptId;
@ApiModelProperty(value = "发票抬头")
private String invoiceHeader;
private String invoice;
@ApiModelProperty(value = "纳税人识别号")
private String taxpayer;
......@@ -28,7 +28,7 @@ public class ReceiptInvoiceCreateReqVO {
private String accountName;
@ApiModelProperty(value = "开票品名")
private String invoiceItem;
private String projectName;
@ApiModelProperty(value = "税率")
private BigDecimal taxRate;
......@@ -36,8 +36,8 @@ public class ReceiptInvoiceCreateReqVO {
@ApiModelProperty(value = "开票电话")
private String invoicePhone;
@ApiModelProperty(value = "开票地址")
private String invoiceAddress;
@ApiModelProperty(value = "开票电话/地址")
private String addressPhone;
@ApiModelProperty(value = "备注")
private String invoiceRemark;
......
......@@ -58,19 +58,14 @@ public class ReceiptItemBackVO {
@ApiModelProperty(value = "货币id")
private Long currencyId;
@ExcelProperty("创建时间")
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY)
@ApiModelProperty(value = "创建时间")
private Date createTime;
/*
创建人
*/
@ApiModelProperty(value = "创建人")
private String creator;
@ExcelProperty("收款汇率")
@ApiModelProperty(value = "收款汇率")
private String rate;
......@@ -100,39 +95,32 @@ public class ReceiptItemBackVO {
@ApiModelProperty(value = "核销金额")
private java.math.BigDecimal writeOffAmount;
@ExcelProperty("当前流程ID")
@ApiModelProperty(value = "当前流程ID")
private String bmpId;
/*
剩余金额
*/
@ApiModelProperty(value = "剩余金额")
private String syValue;
/*
提交审批时间
*/
@ApiModelProperty(value = "提交审批时间")
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY)
private Date createTimeBpm;
/*
提交审批人
*/
@ApiModelProperty(value = "提交审批人")
private String createBpm;
/*
审批通过时间
*/
@ApiModelProperty(value = "审批通过时间")
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY)
private Date updateTimeBpm;
@ApiModelProperty(value = "更新时间")
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY)
private Date updateTime;
@ApiModelProperty(value = "更新人")
private String updater;
@ApiModelProperty(value = "审核通过时间")
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private Date approvalTime;
}
......@@ -14,6 +14,6 @@ import java.util.List;
@EqualsAndHashCode(callSuper = true)
@ApiModel("管理后台 - 收款单明细创建 Request VO")
public class ReceiptItemCreateReqVO extends ReceiptItemBaseVO {
@ApiModelProperty(value = "收款明细核销信息")
@ApiModelProperty(value = "应收核销信息")
private List<ReceivableWriteOffReqVO> receivableWriteOffList;
}
package cn.iocoder.yudao.module.wealth.vo.receiptItem;
import cn.iocoder.yudao.framework.common.util.io.FileModel;
import com.baomidou.mybatisplus.annotation.TableId;
import cn.iocoder.yudao.module.wealth.vo.receipt.ReceiptRelationOrderInfoVO;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import java.util.List;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
/*
*/
@Data
@ApiModel("管理后台 - 银行收款单明细列表返回结果")
public class ReceiptItemResp {
/**
* 主键
*/
@TableId
public class ReceiptItemRespVO {
private Long id;
/**
* 流水号
*/
@ApiModelProperty(value = "流水号")
private String serialNumber;
/**
* 收款单id
*/
@ApiModelProperty(value = "收款单id")
private Long receiptId;
/**
* 收款账号
*/
@ApiModelProperty(value = "收款账号")
private String accountNo;
/**
* 当次实收金额不含税
*/
@ApiModelProperty(value = "当次实收金额不含税")
private java.math.BigDecimal amount;
/**
* 税点
*/
@ApiModelProperty(value = "税点")
private java.math.BigDecimal taxPoint;
/**
* 当次实收金额含税
*/
@ApiModelProperty(value = "当次实收金额含税")
private java.math.BigDecimal taxAmount;
/**
* 收款账号名称
*/
@ApiModelProperty(value = "收款账号名称")
private String accountName;
/**
* 收款账号银行名称
*/
@ApiModelProperty(value = "收款账号银行名称")
private String accountBankName;
/**
* 货币id
*/
@ApiModelProperty(value = "货币id")
private Long currencyId;
/**
* 收款汇率
*/
@ApiModelProperty(value = "收款汇率")
private String rate;
/**
* 实收日期
*/
@ApiModelProperty(value = "实收日期")
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY)
private Date amountDate;
/**
* 水单号
*/
@ApiModelProperty(value = "水单号")
private String billNo;
/**
* 附件多个,分隔
*/
@ApiModelProperty(value = "附件多个,分隔")
private String attr;
@ApiModelProperty(value = "上传文件列表")
private List<FileModel> attrList;
/**
* 状态0待核销,1已核销
*/
@ApiModelProperty(value = "状态0待核销,1已核销")
private Integer status;
/**
* 核销货币id
*/
@ApiModelProperty(value = "核销货币id")
private Long writeOffCurrencyId;
/**
* 核销金额
*/
@ApiModelProperty(value = "核销金额")
private java.math.BigDecimal writeOffAmount;
/**
* 流程审核状态
*/
@ApiModelProperty(value = "流程审核状态")
private Integer bmpStatus;
/**
* 当前流程ID
*/
@ApiModelProperty(value = "当前流程ID")
private String bmpId;
/*
主表中的收款单编号
*/
@ApiModelProperty(value = "主表中的收款单编号")
private String receiptNo;
/*
订单ID
*/
private long orderId;
/*
订单编号
*/
private String orderNo;
/*
提单编号
*/
private String tidanNo;
/*
创建人
*/
@ApiModelProperty(value = "创建人")
private String creator;
/*
创建时间
*/
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY)
@ApiModelProperty(value = "创建时间")
private Date createTime;
/*
提交审批人
*/
@ApiModelProperty(value = "提交审批人")
private String createBpm;
/*
提交审批时间
*/
@ApiModelProperty(value = "提交审批时间")
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY)
private Date createTimeBpm;
/*
审批通过时间
*/
@ApiModelProperty(value = "审批通过时间")
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY)
private Date updateTimeBpm;
@ApiModelProperty(value = "相关订单信息列表")
private List<ReceiptRelationOrderInfoVO> orderInfoList;
}
......@@ -13,7 +13,7 @@ public class ReceivableWriteOffReqVO {
@ApiModelProperty(value = "主键", required = true)
@NotNull(message = "主键不能为空")
private Long id;
private Long receivableId;
@ApiModelProperty(value = "基准币种汇率")
private BigDecimal baseCurrencyRate;
......
......@@ -256,9 +256,8 @@ public class ReceiptController {
@ApiOperation("根据收款单ID获得收款单详细信息")
@ApiImplicitParam(name = "id", value = "应收款单ID", required = true, example = "1024", dataTypeClass = Long.class)
//@PreAuthorize("@ss.hasPermission('ecw:receipt:query')")
public CommonResult<ReceiptBackVO> getReceipt(@RequestParam("id") Long id) {
ReceiptDO receipt = receiptService.getReceipt(id);
return success(ReceiptConvert.INSTANCE.convert(receipt));
public CommonResult<ReceiptBackVO> getReceiptDetail(@RequestParam("id") Long id) {
return success(receiptService.getReceiptDetail(id));
}
......
......@@ -26,7 +26,7 @@ public class ReceiptInvoiceController {
@PostMapping("/create")
@ApiOperation("申请开票")
public CommonResult<Long> createReceiptInvoice(@Valid @RequestBody ReceiptInvoiceCreateReqVO createReqVO) {
public CommonResult<Long> createReceiptInvoice(@Valid @RequestBody InvoiceCreateReqVO createReqVO) {
return success(receiptInvoiceService.createReceiptInvoice(createReqVO));
}
......
......@@ -2,13 +2,12 @@ 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.dal.dataobject.receipt.ReceiptDO;
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.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 cn.iocoder.yudao.module.wealth.vo.receiptItem.ReceiptItemRespVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -35,7 +34,7 @@ public class BankReceiptDetailsControl {
@GetMapping("/list")
@ApiOperation("收款明细列表")
public CommonResult<PageResult<ReceiptItemResp>> getBankReceiptDetailsList(ReceiptItemReq req) {
public CommonResult<PageResult<ReceiptItemRespVO>> getBankReceiptDetailsList(ReceiptItemReq req) {
return success(bankReceiptDetailsService.getBankReceiptDetailsList(req));
}
......
......@@ -3,16 +3,22 @@
<mapper namespace="cn.iocoder.yudao.module.wealth.dal.mysql.receiptItem.BankReceiptDetailsMapper">
<select id="getBankReceiptDetailsList"
resultType="cn.iocoder.yudao.module.wealth.vo.receiptItem.ReceiptItemResp">
SELECT p.*,m.receipt_no,m.order_id,
r.order_no,r.tidan_no,a.create_time as create_time_bpm,
a.update_time as update_time_bpm,a.creator as createBpm
resultType="cn.iocoder.yudao.module.wealth.vo.receiptItem.ReceiptItemRespVO">
SELECT
p.*,
m.receipt_no,
a.create_time as create_time_bpm,
a.update_time as update_time_bpm,
a.creator as createBpm
from ecw_receipt_item p
left join ecw_receipt m on p.receipt_id=m.id and m.deleted=0
left join ecw_order r on r.order_id=m.order_id and r.deleted=0
left join ecw_receipt_approval a on a.bmp_id=p.bmp_id and a.deleted=0
LEFT JOIN ecw_receipt m ON p.receipt_id=m.id AND m.deleted=0
<if test="(orderNo != null and orderNo != '') or (tidanNo != null and tidanNo != '')">
INNER JOIN (SELECT receipt_id,order_id FROM ecw_receivable GROUP BY receipt_id, order_id ) AS rb ON rb.receipt_id = m.id
LEFT JOIN ecw_order o ON o.order_id=rb.order_id AND o.deleted=0
</if>
LEFT JOIN ecw_receipt_approval a ON a.bmp_id=p.bmp_id AND a.deleted=0
<include refid="WherePage"/>
ORDER BY m.receipt_no desc,p.create_time asc limit #{start}, #{pageSize}
ORDER BY p.receipt_id desc,p.create_time limit #{start}, #{pageSize}
</select>
<sql id="WherePage">
<where>
......@@ -27,10 +33,10 @@
AND m.receipt_no like concat('%',#{receiptNo},'%')
</if>
<if test="orderNo != null and orderNo != ''">
AND r.order_no like concat('%',#{orderNo},'%')
AND o.order_no like concat('%',#{orderNo},'%')
</if>
<if test="tidanNo != null and tidanNo != ''">
AND r.tidan_no like concat('%',#{tidanNo},'%')
AND o.tidan_no like concat('%',#{tidanNo},'%')
</if>
<!--银行收款明细创建日期-->
<if test="sDate1 != null and sDate1 != '' and
......@@ -68,12 +74,16 @@
</where>
</sql>
<select id="GetCount" resultType="java.lang.Long">
SELECT count(p.id)
SELECT count(1)
from ecw_receipt_item p
left join ecw_receipt m on p.receipt_id=m.id and m.deleted=0
left join ecw_order r on r.order_id=m.order_id and r.deleted=0
<if test="(orderNo != null and orderNo != '') or (tidanNo != null and tidanNo != '')">
INNER JOIN (SELECT receipt_id,order_id FROM ecw_receivable GROUP BY receipt_id, order_id ) AS rb ON rb.receipt_id = m.id
LEFT JOIN ecw_order o ON o.order_id=rb.order_id AND o.deleted=0
</if>
left join ecw_receipt_approval a on a.bmp_id=m.bmp_id and a.deleted=0
<include refid="WherePage"/>
ORDER BY p.receipt_id desc,p.create_time
</select>
<select id="getBankIncomeItemPage">
SELECT
......
......@@ -17,7 +17,7 @@
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
WHERE eri.deleted = 0 AND er.bmp_status = 2
<if test="query.receiptNo != null and query.receiptNo != '' ">
AND eri.`receipt_no` LIKE CONCAT('%',#{query.receiptNo},'%')
</if>
......
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