Commit 7cf76af0 authored by zhangfeng's avatar zhangfeng

feat(wealth): 创建/批量创建银行收款明细

parent ff2841eb
This diff is collapsed.
This diff is collapsed.
......@@ -41,4 +41,6 @@ public interface BpmProcessInstanceApi {
* @return 流程任务总数
*/
Long getTodoTaskCount(Long userId);
void approveTask(String id, String comment);
}
......@@ -3,11 +3,13 @@ package cn.iocoder.yudao.module.bpm.api.task;
import cn.hutool.json.JSONUtil;
import cn.iocoder.yudao.module.bpm.api.task.dto.BpmProcessInstanceCreateReqDTO;
import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.instance.BpmProcessInstanceCancelReqVO;
import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task.BpmTaskApproveReqVO;
import cn.iocoder.yudao.module.bpm.controller.admin.task.vo.task.BpmTaskRespVO;
import cn.iocoder.yudao.module.bpm.resp.TaskResp;
import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService;
import cn.iocoder.yudao.module.bpm.service.task.BpmTaskService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
......@@ -80,4 +82,13 @@ public class BpmProcessInstanceApiImpl implements BpmProcessInstanceApi {
public Long getTodoTaskCount(Long userId) {
return bpmTaskService.getTodoTaskCount(getLoginUserId());
}
@Override
@Async
public void approveTask(String id, String comment) {
BpmTaskApproveReqVO bpmTaskApproveReqVO = new BpmTaskApproveReqVO();
bpmTaskApproveReqVO.setId(id);
bpmTaskApproveReqVO.setComment(comment);
bpmTaskService.approveTask(1L, bpmTaskApproveReqVO);
}
}
......@@ -13,7 +13,7 @@ import java.math.BigDecimal;
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ReceivableWriteOffRecord extends BaseDO {
public class ReceivableWriteOffRecordDO extends BaseDO {
@TableId
private Long id;
private Long receivableId;
......
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 cn.iocoder.yudao.module.wealth.dal.dataobject.receivable.ReceivableWriteOffRecordDO;
import org.apache.ibatis.annotations.Mapper;
import java.math.BigDecimal;
......@@ -10,6 +10,8 @@ import java.math.BigDecimal;
* 应收明细核销记录 Mapper
*/
@Mapper
public interface ReceivableWriteOffRecordMapper extends AbstractMapper<ReceivableWriteOffRecord> {
public interface ReceivableWriteOffRecordMapper extends AbstractMapper<ReceivableWriteOffRecordDO> {
BigDecimal getTotalAmountForReceivable(Long id);
void deleteWriteOffRecord(Long id);
}
......@@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.wealth.service.receiptItem;
import cn.iocoder.yudao.framework.mybatis.core.service.IService;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.module.wealth.dal.dataobject.receiptApproval.ReceiptApprovalDO;
import cn.iocoder.yudao.module.wealth.dal.dataobject.receiptItem.ReceiptItemDO;
import cn.iocoder.yudao.module.wealth.vo.receipt.FinanceReceiptItemCancelVo;
import cn.iocoder.yudao.module.wealth.vo.receipt.FinanceReceiptItemVo;
......@@ -95,7 +96,7 @@ public interface ReceiptItemService extends IService<ReceiptItemDO> {
*
* @param financeReceiptItemVo
*/
void createFinanceReceiptItemWriteOff(FinanceReceiptItemVo financeReceiptItemVo);
ReceiptApprovalDO createFinanceReceiptItemWriteOff(FinanceReceiptItemVo financeReceiptItemVo);
/**
* 发起收款明细反核销
......
......@@ -5,7 +5,7 @@ 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.dal.dataobject.receivable.ReceivableWriteOffRecord;
import cn.iocoder.yudao.module.wealth.dal.dataobject.receivable.ReceivableWriteOffRecordDO;
import cn.iocoder.yudao.module.wealth.vo.receivable.*;
import javax.validation.Valid;
......@@ -273,7 +273,11 @@ public interface ReceivableService extends IService<ReceivableDO> {
void createWriteOffRecord(ReceivableWriteOffReqVO receivableWriteOffReqVO, ReceiptItemDO receiptItem);
ReceivableWriteOffRecord getReceivableWriteOffRecord(Long receivableId, Long receiptItemId);
ReceivableWriteOffRecordDO getReceivableWriteOffRecord(Long receivableId, Long receiptItemId);
List<ReceivableInItemVO> getListForCreateReceiptItem(Long receiptId);
void deleteWriteOffRecord(ReceiptItemDO receiptItemDO);
List<ReceivableInItemVO> getReceivableByReceiptItem(Long receiptItemId);
}
......@@ -26,12 +26,14 @@ 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.receivable.ReceivableWriteOffRecordDO;
import cn.iocoder.yudao.module.wealth.dal.dataobject.receivableDiscount.ReceivableDiscountDO;
import cn.iocoder.yudao.module.wealth.dal.mysql.receiptItem.ReceiptItemMapper;
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.receiptItem.ReceiptItemBackVO;
import cn.iocoder.yudao.module.wealth.vo.receivable.*;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
......@@ -83,6 +85,8 @@ public class ReceivableServiceImpl extends AbstractService<ReceivableMapper, Rec
private OrderApi orderApi;
@Resource
private ReceivableWriteOffRecordMapper receivableWriteOffRecordMapper;
@Resource
private ReceiptItemMapper receiptItemMapper;
@Override
public Long createReceivable(ReceivableCreateReqVO createReqVO) {
......@@ -583,7 +587,7 @@ public class ReceivableServiceImpl extends AbstractService<ReceivableMapper, Rec
if (receivableDO == null) {
throw exception(RECEIVABLE_NOT_EXISTS);
}
ReceivableWriteOffRecord writeOffRecord = ReceivableWriteOffRecord.builder()
ReceivableWriteOffRecordDO writeOffRecord = ReceivableWriteOffRecordDO.builder()
.receivableId(receivableWriteOffReqVO.getReceivableId())
.writeOffAmount(receivableWriteOffReqVO.getWriteOffAmount())
.receiptItemId(receiptItem.getId())
......@@ -592,7 +596,7 @@ public class ReceivableServiceImpl extends AbstractService<ReceivableMapper, Rec
}
@Override
public ReceivableWriteOffRecord getReceivableWriteOffRecord(Long receivableId, Long receiptItemId) {
public ReceivableWriteOffRecordDO getReceivableWriteOffRecord(Long receivableId, Long receiptItemId) {
return receivableWriteOffRecordMapper.selectOne("receivable_id", receivableId, "receipt_item_id", receiptItemId);
}
......@@ -611,4 +615,27 @@ public class ReceivableServiceImpl extends AbstractService<ReceivableMapper, Rec
}
return receivableInItemVOS;
}
@Override
public List<ReceivableInItemVO> getReceivableByReceiptItem(Long receiptItemId) {
ReceiptItemDO receiptItemDO = receiptItemMapper.selectById(receiptItemId);
List<ReceivableDO> receivableDOS = this.selectList("receipt_id", receiptItemDO.getReceiptId());
List<ReceivableInItemVO> receivableInItemVOS = ReceivableConvert.INSTANCE.convertToItemVOList(receivableDOS);
for (ReceivableInItemVO receivableInItemVO : receivableInItemVOS) {
receivableInItemVO.setActualAmount(receivableInItemVO.getTaxAmount().subtract(receivableInItemVO.getDiscountTotal() == null ? BigDecimal.ZERO : receivableInItemVO.getDiscountTotal()));
ReceivableWriteOffRecordDO receivableWriteOffRecordDO = this.getReceivableWriteOffRecord(receivableInItemVO.getId(), receiptItemId);
if (null == receivableWriteOffRecordDO) {
receivableInItemVO.setWriteOffAmount(BigDecimal.ZERO);
} else {
receivableInItemVO.setWriteOffAmount(receivableWriteOffRecordDO.getWriteOffAmount());
}
}
return receivableInItemVOS;
}
@Override
public void deleteWriteOffRecord(ReceiptItemDO receiptItemDO) {
receivableWriteOffRecordMapper.deleteWriteOffRecord(receiptItemDO.getId());
}
}
\ No newline at end of file
......@@ -2,11 +2,13 @@ package cn.iocoder.yudao.module.wealth.vo.receipt;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import javax.validation.constraints.NotNull;
@Data
@Builder
@ApiModel("收款单明细审核")
public class FinanceReceiptItemVo {
@ApiModelProperty(value = "收款单ID")
......
package cn.iocoder.yudao.module.wealth.vo.receiptItem;
import cn.iocoder.yudao.module.wealth.vo.receivable.ReceivableWriteOffReqVO;
import lombok.*;
import java.util.*;
import io.swagger.annotations.*;
......@@ -14,5 +15,6 @@ public class ReceiptItemUpdateReqVO extends ReceiptItemBaseVO {
@ApiModelProperty(value = "主键", required = true)
@NotNull(message = "主键不能为空")
private Long id;
@ApiModelProperty(value = "应收核销信息")
private List<ReceivableWriteOffReqVO> receivableWriteOffList;
}
......@@ -62,5 +62,5 @@ public class ReceivableInItemVO {
private Long baseCurrencyId;
@ApiModelProperty(value = "本次核销金额")
private BigDecimal writeOffInCurrentItem;
private BigDecimal writeOffAmount;
}
......@@ -2,8 +2,10 @@ package cn.iocoder.yudao.module.wealth.vo.receivable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
......@@ -11,6 +13,8 @@ import java.math.BigDecimal;
@Data
@ApiModel("管理后台 - 应收款核销 Request VO")
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class ReceivableWriteOffReqVO {
@ApiModelProperty(value = "主键", required = true)
......
......@@ -116,6 +116,12 @@ public class ReceivableController {
public CommonResult<List<ReceivableInItemVO>> getListForCreateReceiptItem(Long receiptId) {
return success(receivableService.getListForCreateReceiptItem(receiptId));
}
@GetMapping("/getReceivableByReceiptItem")
@ApiOperation("财务-根据收款明细获取应收明细")
public CommonResult<List<ReceivableInItemVO>> getReceivableByReceiptItem(Long receiptItemId) {
return success(receivableService.getReceivableByReceiptItem(receiptItemId));
}
/*
@GetMapping("/list")
@ApiOperation("根据id集合获得应收款列表")
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.iocoder.yudao.module.wealth.dal.mysql.receivable.ReceivableWriteOffRecordMapper">
<delete id="deleteWriteOffRecord">
DELETE FROM ecw_receivable_write_off_record
WHERE receipt_item_id = #{id} AND deleted = 0
</delete>
<select id="getTotalAmountForReceivable" resultType="java.math.BigDecimal">
SELECT SUM(erwor.write_off_amount)
......
......@@ -8,6 +8,12 @@
<version>${revision}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<properties>
<java.version>1.8</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<artifactId>yudao-server</artifactId>
<packaging>jar</packaging>
......
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