Commit 7c732a99 authored by zhangfeng's avatar zhangfeng

feat(wealth): 批量生成收款单;优化创建,更新收款单

parent f8ee4809
......@@ -236,4 +236,9 @@ public class ReceiptDO extends BaseDO {
* 开票资料状态
*/
private Integer invoiceDataStatus;
/**
* 生成路径
*/
private Integer generatePath;
}
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 GeneratePathEnum implements IntArrayValuable {
/**
* 单个生成
*/
SINGLE(0, "单个生成", "SINGLE"),
/**
* 批量生成
*/
BATCH(1, "批量生成", "BATCH");
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(GeneratePathEnum::getValue).toArray();
/**
* 状态
*/
private final Integer value;
/**
* 状态中文
*/
private final String nameZh;
/**
* 状态英语
*/
private final String nameEn;
public static GeneratePathEnum valueOf(Integer value) {
return ArrayUtil.firstMatch(orderStatus -> orderStatus.getValue().equals(value), GeneratePathEnum.values());
}
@Override
public int[] array() {
return ARRAYS;
}
}
......@@ -6,8 +6,6 @@ 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.enums.ReceiptLinkEnum;
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;
......@@ -35,21 +33,6 @@ public interface ReceiptService extends IService<ReceiptDO> {
*/
void updateReceipt(@Valid ReceiptUpdateReqVO updateReqVO);
///**
// * 获取开票信息
// *
// * @param receiptId 付款单ID
// */
//ReceiptBackVO getInvoicingInfo(Long receiptId);
//
///**
// * 更新发票信息
// *
// * @param invoicingUpdateVO 更新信息
// */
//void updateInvoicingInfo(@Valid InvoicingUpdateVO invoicingUpdateVO);
/**
* 删除收款单
*
......@@ -173,7 +156,7 @@ public interface ReceiptService extends IService<ReceiptDO> {
Boolean setBankWriteoffRange(ReceiptBankWriteoffRangeVO range);
/**
* 批量生成收款单
* 批量创建收款单
*
* @param createReqVOList
* @return
......@@ -181,12 +164,12 @@ public interface ReceiptService extends IService<ReceiptDO> {
List<ReceiptBatchGenRespVO> batchGenReceipt(List<ReceiptCreateReqVO> createReqVOList);
/**
* 批量导入收款信息
* 生成收款单相关数据
*
* @param list
* @param createReqVO
* @return
*/
List<ReceiptAccountBatchRespVO> receiptAccountImport(List<ReceiptAccountBatchCreateReqVO> list);
Long generateReceiptRelevantData(ReceiptCreateReqVO createReqVO);
/**
* 更新收款明细状态
......
......@@ -4,9 +4,10 @@ import cn.iocoder.yudao.framework.mybatis.core.service.IService;
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;
import cn.iocoder.yudao.module.wealth.vo.receiptAccount.ReceiptItemBatchCreateReqVO;
import cn.iocoder.yudao.module.wealth.vo.receiptAccount.ReceiptItemBatchRespVO;
import cn.iocoder.yudao.module.wealth.vo.receiptItem.ReceiptItemCreateReqVO;
import cn.iocoder.yudao.module.wealth.vo.receiptItem.ReceiptItemUpdateReqVO;
import org.apache.ibatis.annotations.Param;
import javax.validation.Valid;
import java.math.BigDecimal;
......@@ -121,4 +122,5 @@ public interface ReceiptItemService extends IService<ReceiptItemDO> {
BigDecimal getWriteOffAmountByReceiptId( Long receiptId);
List<ReceiptItemBatchRespVO> receiptItemImport(List<ReceiptItemBatchCreateReqVO> list);
}
......@@ -23,6 +23,8 @@ import cn.iocoder.yudao.module.wealth.service.receivable.ReceivableService;
import cn.iocoder.yudao.module.wealth.util.WealthGenCodeUtils;
import cn.iocoder.yudao.module.wealth.vo.receipt.FinanceReceiptItemCancelVo;
import cn.iocoder.yudao.module.wealth.vo.receipt.FinanceReceiptItemVo;
import cn.iocoder.yudao.module.wealth.vo.receiptAccount.ReceiptItemBatchCreateReqVO;
import cn.iocoder.yudao.module.wealth.vo.receiptAccount.ReceiptItemBatchRespVO;
import cn.iocoder.yudao.module.wealth.vo.receiptItem.ReceiptItemCreateReqVO;
import cn.iocoder.yudao.module.wealth.vo.receiptItem.ReceiptItemUpdateReqVO;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
......@@ -545,4 +547,36 @@ public class ReceiptItemServiceImpl extends AbstractService<ReceiptItemMapper, R
public BigDecimal getWriteOffAmountByReceiptId(Long receiptId) {
return receiptItemMapper.getWriteOffAmountByReceiptId(receiptId);
}
@Override
public List<ReceiptItemBatchRespVO> receiptItemImport(List<ReceiptItemBatchCreateReqVO> list) {
// TODO 逻辑待完善
// 校验收款账户信息
List<ReceiptItemBatchRespVO> respVOS = validateBatchReceiptAccount(list);
// 插入数据
// 校验收款明细自动审核
// 更新收款单
return respVOS;
}
private List<ReceiptItemBatchRespVO> validateBatchReceiptAccount(List<ReceiptItemBatchCreateReqVO> list) {
// 根据订单号或提单号是否能查到订单
// 根据订单号或提单号匹配状态≠已核销/草稿状态的收款单是否存在,存在多条匹配创建时间最晚的一条
// 根据上条校验,一个收款单存在一条或多条收款数据弹提示
// 收款账号是否存在,是否匹配
// 校验收款金额
// 校验实收金额币种
// 结算币种需为收款单所在目的国结算币种
// 校验当前收款单汇率是否过期,过期则更新为导入的汇率
return null;
}
}
......@@ -7,7 +7,7 @@ import lombok.Data;
@Data
@ApiModel("管理后台 - 批量收款信息创建 Request VO")
public class ReceiptAccountBatchCreateReqVO {
public class ReceiptItemBatchCreateReqVO {
@ApiModelProperty(value = "订单号/提单号")
@ExcelProperty("订单号/提单号")
private String orderNo;
......
......@@ -6,7 +6,7 @@ import lombok.Data;
@Data
@ApiModel("管理后台 - 批量导入收款信息结果 VO")
public class ReceiptAccountBatchRespVO {
public class ReceiptItemBatchRespVO {
@ApiModelProperty(value = "订单号/提单号")
private String orderNo;
......
......@@ -10,7 +10,6 @@ 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;
......@@ -30,15 +29,12 @@ 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;
......@@ -48,16 +44,13 @@ 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;
......@@ -296,34 +289,6 @@ public class ReceiptController {
return success(ReceiptAccountConvert.INSTANCE.convertList(list));
}
// TODO 拆分到开票管理
//@GetMapping("/invoicing/info/{id}")
//@ApiOperation("获得收款单开票信息")
//@ApiImplicitParam(name = "id", value = "收款单ID", required = true, example = "1024", dataTypeClass = Long.class)
////@PreAuthorize("@ss.hasPermission('ecw:receipt:query')")
//public CommonResult<ReceiptBackVO> getInvoicingInfo(@PathVariable("id") Long id) {
// ReceiptBackVO receiptBackVO = receiptService.getInvoicingInfo(id);
// return success(receiptBackVO);
//}
/* @GetMapping("/getInvoicingItem")
@ApiOperation("根据收款单ID获取应收明细")
@ApiImplicitParam(name = "id", value = "收款单ID", required = true, example = "1024", dataTypeClass = Long.class)
public CommonResult<List<ReceivableBackVO>> getInvoicingItem(@RequestParam("id") Long id) {
LambdaQueryWrapper<ReceivableDO> lambdaQueryWrapper = new LambdaQueryWrapper();
lambdaQueryWrapper.eq(ReceivableDO::getReceiptId, id);
return success(ReceivableConvert.INSTANCE.convertList(receivableService.list(lambdaQueryWrapper)));
}*/
// TODO 拆分到开票管理
//@PutMapping("/invoicing/info")
//@ApiOperation("更新收款单开票信息")
////@PreAuthorize("@ss.hasPermission('ecw:receipt:update')")
//public CommonResult<Boolean> updateInvoicingInfo(@Valid @RequestBody InvoicingUpdateVO invoicingUpdateVO) {
// receiptService.updateInvoicingInfo(invoicingUpdateVO);
// return success(true);
//}
@GetMapping("/list")
@ApiOperation("获得收款单列表")
@ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class)
......@@ -361,16 +326,6 @@ public class ReceiptController {
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")
......
......@@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.wealth.controller.admin.receiptItem;
import cn.hutool.core.collection.CollectionUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.collectors.CollectorsUtil;
import cn.iocoder.yudao.framework.excel.util.ExcelUtils;
import cn.iocoder.yudao.framework.idempotent.core.annotation.Idempotent;
import cn.iocoder.yudao.module.ecw.api.currency.CurrencyApi;
import cn.iocoder.yudao.module.ecw.api.currency.dto.CurrencyRespDTO;
......@@ -18,18 +19,24 @@ import cn.iocoder.yudao.module.wealth.dal.mysql.receiptItem.ReceiptItemMapper;
import cn.iocoder.yudao.module.wealth.service.receiptItem.ReceiptItemService;
import cn.iocoder.yudao.module.wealth.vo.receipt.FinanceReceiptItemCancelVo;
import cn.iocoder.yudao.module.wealth.vo.receipt.FinanceReceiptItemVo;
import cn.iocoder.yudao.module.wealth.vo.receiptAccount.ReceiptItemBatchCreateReqVO;
import cn.iocoder.yudao.module.wealth.vo.receiptAccount.ReceiptItemBatchRespVO;
import cn.iocoder.yudao.module.wealth.vo.receiptItem.ReceiptItemBackVO;
import cn.iocoder.yudao.module.wealth.vo.receiptItem.ReceiptItemCreateReqVO;
import cn.iocoder.yudao.module.wealth.vo.receiptItem.ReceiptItemUpdateReqVO;
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 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.validation.Valid;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
......@@ -270,4 +277,14 @@ public class ReceiptItemController {
return success(true);
}
@PostMapping(value = "/import", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
@ApiOperation("批量银行收款信息导入")
@ApiImplicitParams({
@ApiImplicitParam(name = "file", value = "Excel 文件", required = true, dataTypeClass = MultipartFile.class)
})
public CommonResult<List<ReceiptItemBatchRespVO>> receiptAccountImport(@RequestParam("file") MultipartFile file) throws IOException {
List<ReceiptItemBatchCreateReqVO> list = ExcelUtils.read(file, ReceiptItemBatchCreateReqVO.class);
return success(receiptItemService.receiptItemImport(list));
}
}
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