Commit 8f529fdf authored by zhangfeng's avatar zhangfeng

feat(wealth): 财务新增功能

parent bd8f3885
This diff is collapsed.
This diff is collapsed.
# 刷新应收款基准币种
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))
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;
UPDATE ecw_receipt SET generate_path = 0;
# 刷新应收款优惠金额
UPDATE ecw_receivable er
SET er.discount_total = 0 WHERE er.discount_total IS NULL;
# 刷新应收款汇率
UPDATE ecw_receivable er
SET er.exchange_rate = (SELECT eer.currency_rate FROM ecw_exchange_rate eer WHERE eer.source_currency_id = er.currency_id AND eer.target_currency_id = er.base_currency_id )
WHERE er.exchange_rate IS NULL AND er.receipt_id IS NOT NULL;
UPDATE ecw_receivable er
SET er.exchange_rate = 1 WHERE er.exchange_rate IS NULL AND er.receipt_id IS NOT NULL;
# 刷新应收款基准金额
UPDATE ecw_receivable er
SET er.base_amount = er.exchange_rate * (er.tax_amount - er.discount_total)
WHERE er.base_amount IS NULL AND er.receipt_id IS NOT NULL AND er.exchange_rate IS NOT NULL;
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);
}
}
......@@ -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;
}
}
......@@ -470,4 +470,6 @@ public interface CustomerService extends IService<CustomerDO> {
void validateCustomerApproval(CustomerDO customerDO);
CustomerPaymentInfoVO getPaymentCustomerInfo(Long customerId);
}
......@@ -3923,4 +3923,16 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper,
throw exception(CUSTOMER_APPROVAL_IN_PROCESSING);
}
}
@Override
public CustomerPaymentInfoVO getPaymentCustomerInfo(Long customerId) {
CustomerDO customerDO = customerMapper.selectById(customerId);
if (customerDO != null) {
CustomerPaymentInfoVO infoVO = new CustomerPaymentInfoVO();
infoVO.setId(customerDO.getId());
infoVO.setDefaultBilling(customerDO.getDefaultBilling());
return infoVO;
}
return null;
}
}
package cn.iocoder.yudao.module.customer.vo.customer.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ApiModel("管理后台 - 付款客户信息 VO")
@Data
public class CustomerPaymentInfoVO {
private Long id;
@ApiModelProperty(value = "默认是否开票")
private Boolean defaultBilling;
}
......@@ -1205,4 +1205,9 @@ public class CustomerController {
return success(true);
}
@GetMapping("/payment-customer-info")
@ApiOperation("获取付款客户信息")
public CommonResult<CustomerPaymentInfoVO> getPaymentCustomerInfo(Long customerId) {
return success(customerService.getPaymentCustomerInfo(customerId));
}
}
package cn.iocoder.yudao.module.ecw.api.bank;
import cn.iocoder.yudao.module.ecw.api.bank.dto.BankAccountDTO;
public interface BankApi {
/**
* 根据银行账号获取账号信息
*/
BankAccountDTO getBankAccountByAccountNo(String baAccountNum);
}
package cn.iocoder.yudao.module.ecw.api.bank.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class BankAccountDTO {
@ApiModelProperty(value = "银行账号编号", required = true)
private Long id;
@ApiModelProperty(value = "户名", required = true)
private String baAccountName;
@ApiModelProperty(value = "开户银行", required = true)
private String baBankName;
@ApiModelProperty(value = "银行账号", required = true)
private String baAccountNum;
@ApiModelProperty(value = "银行代码", required = true)
private String baSwiftCode;
@ApiModelProperty(value = "开户银行地址", required = true)
private String baBankAdd;
@ApiModelProperty(value = "类型字典(1公账,2私账)", required = true)
private Integer baType;
@ApiModelProperty(value = "状态(0正常 1停用)", required = false)
private Integer status;
@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.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;
}
package cn.iocoder.yudao.module.ecw.api.region;
import cn.iocoder.yudao.module.ecw.api.region.dto.RegionDTO;
import java.util.List;
public interface RegionApi {
/**
* 获得目的国家列表
* @return
*/
List<RegionDTO> getTradeCountryList();
/**
* 根据id获取区域
*/
RegionDTO getRegionById(Long id);
}
package cn.iocoder.yudao.module.ecw.api.region.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class RegionDTO {
private Long id;
@ApiModelProperty(value = "中文")
private String titleZh;
@ApiModelProperty(value = "英文")
private String titleEn;
@ApiModelProperty(value = "进口国应收额币种")
private String importCurrency5;
}
......@@ -89,8 +89,7 @@ public class BankAccountController {
@ApiOperation("获得银行账户分页")
// @PreAuthorize("@ss.hasPermission('ecw:bank-account:query')")
public CommonResult<PageResult<BankAccountRespVO>> getBankAccountPage(@Valid BankAccountPageReqVO pageVO) {
PageResult<BankAccountDO> pageResult = bankAccountService.getBankAccountPage(pageVO);
return success(BankAccountConvert.INSTANCE.convertPage(pageResult));
return success(bankAccountService.getBankAccountPage(pageVO));
}
@GetMapping("/export-excel")
......
......@@ -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;
}
......@@ -19,4 +19,16 @@ public class BankAccountRespVO extends BankAccountBaseVO {
@ApiModelProperty(value = "创建时间", required = true)
private Date createTime;
@ApiModelProperty(value = "开户国家中文")
private String baCountryZh;
@ApiModelProperty(value = "开户国家英文")
private String baCountryEn;
@ApiModelProperty(value = "收入归属中文")
private String baIncomeBelongZh;
@ApiModelProperty(value = "收入归属英文")
private String baIncomeBelongEn;
}
......@@ -4,6 +4,7 @@ import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.ecw.api.bank.dto.BankAccountDTO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import cn.iocoder.yudao.module.ecw.controller.admin.bankAccount.vo.*;
......@@ -32,4 +33,5 @@ public interface BankAccountConvert {
List<BankAccountExcelVO> convertList02(List<BankAccountDO> list);
BankAccountDTO convertDTO(BankAccountDO bankAccountDO);
}
......@@ -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())
......
package cn.iocoder.yudao.module.ecw.service.api;
import cn.iocoder.yudao.module.ecw.api.bank.BankApi;
import cn.iocoder.yudao.module.ecw.api.bank.dto.BankAccountDTO;
import cn.iocoder.yudao.module.ecw.convert.bankAccount.BankAccountConvert;
import cn.iocoder.yudao.module.ecw.dal.dataobject.bankAccount.BankAccountDO;
import cn.iocoder.yudao.module.ecw.dal.mysql.bankAccount.BankAccountMapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service
public class BankApiImpl implements BankApi {
@Resource
private BankAccountMapper bankAccountMapper;
@Override
public BankAccountDTO getBankAccountByAccountNo(String baAccountNum) {
List<BankAccountDO> bankAccountDO = bankAccountMapper.selectList("ba_account_num", baAccountNum);
if (bankAccountDO != null && !bankAccountDO.isEmpty()) {
return BankAccountConvert.INSTANCE.convertDTO(bankAccountDO.get(0));
}
return null;
}
}
package cn.iocoder.yudao.module.ecw.service.api;
import cn.iocoder.yudao.module.ecw.api.region.RegionApi;
import cn.iocoder.yudao.module.ecw.api.region.dto.RegionDTO;
import cn.iocoder.yudao.module.ecw.dal.dataobject.region.RegionDO;
import cn.iocoder.yudao.module.ecw.dal.mysql.region.RegionMapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;
@Service
public class RegionApiImpl implements RegionApi {
@Resource
private RegionMapper regionMapper;
@Override
public List<RegionDTO> getTradeCountryList() {
List<RegionDO> countryList = regionMapper.getImportExportCountryList();
List<RegionDTO> dtoList = countryList.stream().map(c -> {
RegionDTO regionDTO = new RegionDTO();
regionDTO.setId(c.getId());
regionDTO.setTitleZh(c.getTitleZh());
regionDTO.setTitleEn(c.getTitleEn());
return regionDTO;
}).collect(Collectors.toList());
return dtoList;
}
@Override
public RegionDTO getRegionById(Long id) {
RegionDO regionDO = regionMapper.selectById(id);
if (regionDO != null) {
RegionDTO regionDTO = new RegionDTO();
regionDTO.setId(regionDO.getId());
regionDTO.setTitleZh(regionDO.getTitleZh());
regionDTO.setTitleEn(regionDO.getTitleEn());
regionDTO.setImportCurrency5(regionDO.getImportCurrency5());
return regionDTO;
}
return null;
}
}
......@@ -58,7 +58,7 @@ public interface BankAccountService {
* @param pageReqVO 分页查询
* @return 银行账户分页
*/
PageResult<BankAccountDO> getBankAccountPage(BankAccountPageReqVO pageReqVO);
PageResult<BankAccountRespVO> getBankAccountPage(BankAccountPageReqVO pageReqVO);
/**
* 获得银行账户列表, 用于 Excel 导出
......
package cn.iocoder.yudao.module.ecw.service.bankAccount;
import cn.iocoder.yudao.module.ecw.dal.dataobject.region.RegionDO;
import cn.iocoder.yudao.module.ecw.dal.mysql.region.RegionMapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import java.util.*;
import java.util.stream.Collectors;
import cn.iocoder.yudao.module.ecw.controller.admin.bankAccount.vo.*;
import cn.iocoder.yudao.module.ecw.dal.dataobject.bankAccount.BankAccountDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
......@@ -26,6 +32,8 @@ public class BankAccountServiceImpl implements BankAccountService {
@Resource
private BankAccountMapper bankAccountMapper;
@Resource
private RegionMapper regionMapper;
@Override
public Long createBankAccount(BankAccountCreateReqVO createReqVO) {
......@@ -81,8 +89,25 @@ public class BankAccountServiceImpl implements BankAccountService {
}
@Override
public PageResult<BankAccountDO> getBankAccountPage(BankAccountPageReqVO pageReqVO) {
return bankAccountMapper.selectPage(pageReqVO);
public PageResult<BankAccountRespVO> getBankAccountPage(BankAccountPageReqVO pageReqVO) {
PageResult<BankAccountDO> bankAccountDOPageResult = bankAccountMapper.selectPage(pageReqVO);
PageResult<BankAccountRespVO> voPageResult = BankAccountConvert.INSTANCE.convertPage(bankAccountDOPageResult);
List<RegionDO> countryList = regionMapper.getImportExportCountryList();
Map<Long, RegionDO> countryMap = countryList.stream().collect(Collectors.toMap(RegionDO::getId, regionDO -> regionDO));
voPageResult.getList().forEach(vo -> {
if (vo.getBaCountry() != null) {
RegionDO baCountryDO = countryMap.get(vo.getBaCountry().longValue());
vo.setBaCountryZh(baCountryDO.getTitleZh());
vo.setBaCountryEn(baCountryDO.getTitleEn());
}
if (vo.getBaIncomeBelong() != null) {
RegionDO baIncomeBelongDO = countryMap.get(vo.getBaIncomeBelong().longValue());
vo.setBaIncomeBelongZh(baIncomeBelongDO.getTitleZh());
vo.setBaIncomeBelongEn(baIncomeBelongDO.getTitleEn());
}
});
return voPageResult;
}
@Override
......
......@@ -35,4 +35,15 @@ public interface OrderApi {
* @return 是否合并成功
*/
boolean mergeOrder(Long customerIdSaved, Long customerIdDeleted);
/**
* 根据订单号/提单号获取订单
* @param orderNo
*/
OrderRespDTO getOrderByNo(String orderNo);
/**
* 根据订单号获取目的国
*/
Long getDestCountryByOrderId(Long orderId);
}
......@@ -11,12 +11,14 @@ import cn.iocoder.yudao.module.order.dal.dataobject.orderConsignee.OrderConsigne
import cn.iocoder.yudao.module.order.dal.dataobject.orderConsignor.OrderConsignorDO;
import cn.iocoder.yudao.module.order.dal.dataobject.orderItem.OrderItemDO;
import cn.iocoder.yudao.module.order.dal.dataobject.orderObjective.OrderObjectiveDO;
import cn.iocoder.yudao.module.order.dal.mysql.order.OrderMapper;
import cn.iocoder.yudao.module.order.service.order.*;
import cn.iocoder.yudao.module.order.service.order.impl.OrderItemServiceImpl;
import cn.iocoder.yudao.module.order.service.orderOperateLog.OrderOperateLogService;
import cn.iocoder.yudao.module.order.vo.orderOperateLog.OrderOperateLogCreateReqVO;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.google.common.base.Joiner;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
......@@ -172,4 +174,29 @@ public class OrderApiImpl implements OrderApi {
return false;
}
@Override
public OrderRespDTO getOrderByNo(String orderNo) {
if (StringUtils.isBlank(orderNo)) {
return null;
}
OrderDO orderDO;
if (orderNo.contains("-")) {
orderDO = orderService.selectOne(new LambdaQueryWrapper<OrderDO>().eq(OrderDO::getTidanNo, orderNo).last("limit 1"));
} else {
orderDO = orderService.selectOne(new LambdaQueryWrapper<OrderDO>().eq(OrderDO::getOrderNo, orderNo).last("limit 1"));
}
if (orderDO == null) {
return null;
}
OrderRespDTO orderRespDTO = new OrderRespDTO();
BeanUtils.copyProperties(orderDO, orderRespDTO);
return orderRespDTO;
}
@Override
public Long getDestCountryByOrderId(Long orderId) {
OrderObjectiveDO orderObjectiveDO = objectiveService.getByOrderId(orderId);
return orderObjectiveDO == null ? null : orderObjectiveDO.getObjectiveCountryId();
}
}
......@@ -47,7 +47,16 @@
<version>${revision}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-module-ecw-api</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-module-order-api</artifactId>
<version>${revision}</version>
</dependency>
</dependencies>
</project>
......@@ -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);
}
package cn.iocoder.yudao.module.wealth.convert.receiptInvoice;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.wealth.dal.dataobject.receipt.ReceiptDO;
import cn.iocoder.yudao.module.wealth.dal.dataobject.receiptInvoice.ReceiptInvoiceDO;
import cn.iocoder.yudao.module.wealth.dal.dataobject.receiptInvoiceLog.ReceiptInvoiceLogDO;
import cn.iocoder.yudao.module.wealth.vo.receiptInvoice.*;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
/**
* 收款单开票信息 Convert
* @author 系统管理员
*/
@Mapper
public interface ReceiptInvoiceConvert {
/*****转换MapStruct*****/
ReceiptInvoiceConvert INSTANCE = Mappers.getMapper(ReceiptInvoiceConvert.class);
/***
* 创建VO转实体
* @param bean
* @return
*/
ReceiptInvoiceDO convert(InvoiceCreateReqVO bean);
/***
* 修改VO转实体
* @param bean
* @return
*/
ReceiptInvoiceDO convert(ReceiptInvoiceUpdateDataReqVO bean);
/***
* 实体转返回VO
* @param bean
* @return
*/
ReceiptInvoicePageBackVO convert(ReceiptInvoiceDO bean);
/***
* 实体列表转返回VO列表
* @param list
* @return
*/
List<ReceiptInvoicePageBackVO> convertList(List<ReceiptInvoiceDO> list);
/***
* 实体分页转返回分页
* @param page
* @return
*/
PageResult<ReceiptInvoicePageBackVO> convertPage(PageResult<ReceiptInvoiceDO> page);
List<ReceiptInvoiceLogBackVO> logDOtoLogVOList(List<ReceiptInvoiceLogDO> invoiceLogDOs);
ReceiptInvoiceDO convert(ReceiptInvoiceUpdateInfoReqVO updateReqVO);
ReceiptInvoiceDetailVO convert(ReceiptDO receiptDO);
ReceiptInvoiceDO convertInvoiceCreateReqVO(ReceiptInvoiceCreateReqVO receiptInvoiceCreateReqVO);
InvoiceInReceiptRespVO convertRespVO(ReceiptInvoiceDO receiptInvoiceDO);
}
......@@ -50,4 +50,6 @@ public interface ReceivableConvert {
* @return
*/
PageResult<ReceivableBackVO> convertPage(PageResult<ReceivableDO> page);
List<ReceivableInItemVO> convertToItemVOList(List<ReceivableDO> receivableDOS);
}
package cn.iocoder.yudao.module.wealth.dal.dataobject.receipt;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import java.util.Date;
@Data
@TableName("ecw_receipt_bank_writeoff_range")
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class ReceiptBankWriteoffRangeDO extends BaseDO {
/**
* 主键
*/
@TableId
private Long id;
/**
* 核销比例下界(除以100)
*/
private Integer writeOffDown;
/**
* 核销比例上界(除以100)
*/
private Integer writeOffUp;
}
......@@ -76,55 +76,55 @@ public class ReceiptDO extends BaseDO {
*/
private java.math.BigDecimal feeRate;
/**
* 发票抬头
*/
private String invoice;
/**
* 纳税人识别号
*/
private String taxpayer;
/**
* 开户行
*/
private String accountBank;
/**
* 账号
*/
private String accountName;
/**
* 项目
*/
private String projectName;
/**
* 税率
*/
private java.math.BigDecimal taxRate;
/**
* 开票地址、电话
*/
private String addressPhone;
///**
// * 发票抬头
// */
//private String invoice;
///**
// * 纳税人识别号
// */
//private String taxpayer;
///**
// * 开户行
// */
//private String accountBank;
///**
// * 账号
// */
//private String accountName;
///**
// * 项目
// */
//private String projectName;
///**
// * 税率
// */
//private java.math.BigDecimal taxRate;
///**
// * 开票地址、电话
// */
//private String addressPhone;
/**
* 实收日期
*/
private Date payedAt;
/**
* 发票号码
*/
private String invoiceNumber;
/**
* 开票类型(字典表 invoicing_type)
*/
private Integer invoicingTypeId;
/**
* 开票类型名称
*/
private String invoicingType;
/**
* 开票备注
*/
private String invoicingRemark;
///**
// * 发票号码
// */
//private String invoiceNumber;
///**
// * 开票类型(字典表 invoicing_type)
// */
//private Integer invoicingTypeId;
///**
// * 开票类型名称
// */
//private String invoicingType;
///**
// * 开票备注
// */
//private String invoicingRemark;
/**
* 通知人id
*/
......@@ -149,19 +149,23 @@ public class ReceiptDO extends BaseDO {
* 核销人名称
*/
private String writeOffName;
/**
* 开票人id
*/
private Long issuerId;
/**
* 开票人名称
*/
private String issuerName;
///**
// * 开票人id
// */
//private Long issuerId;
///**
// * 开票人名称
// */
//private String issuerName;
/**
* 是否需要开票
*/
private Integer openInvoice;
/**
* 开票信息id
*/
private Long invoiceId;
/**
* 状态:0:草稿, 1待收款, 2待核销,3已部分核销,4已核销,5已核销待开票,6已开票
......@@ -171,10 +175,10 @@ public class ReceiptDO extends BaseDO {
* 核销时间
*/
private Date writeOffAt;
/**
* 开票时间
*/
private Date invoicingAt;
///**
// * 开票时间
// */
//private Date invoicingAt;
/**
* 数据来源(pc端,mobile端)
*/
......@@ -208,14 +212,23 @@ public class ReceiptDO extends BaseDO {
* 财务备注
*/
private String financeRemark;
/**
* 明细状态
*/
private Integer receiptItemStatus;
/*
订单ID
/**
* 开票状态
*/
private long orderId;
private Integer invoicingStatus;
/*
订单编号
/**
* 开票资料状态
*/
private Integer invoiceDataStatus;
/**
* 生成路径
*/
private String orderNo;
private Integer generatePath;
}
package cn.iocoder.yudao.module.wealth.dal.dataobject.receiptInvoice;
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.util.Date;
/**
* 收款单开票信息 DO
*
* @author 系统管理员
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName("ecw_receipt_invoice")
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class ReceiptInvoiceDO extends BaseDO {
/**
* 主键
*/
@TableId
private Long id;
/**
* 开票编号
*/
private String invoiceNo;
/**
* 收款单id
*/
private Long receiptId;
/**
* 收款单号(例:SKD001)
*/
private String receiptNo;
/**
* 申请人id
*/
private Long applyUserId;
/**
* 开票资料备注
*/
private String invoiceRemark;
/**
* 申请人姓名
*/
private String applyUserName;
/**
* 发票抬头
*/
private String invoiceHeader;
/**
* 纳税人识别号
*/
private String taxpayer;
/**
* 税率
*/
private java.math.BigDecimal taxRate;
/**
* 开票电话
*/
private String invoicePhone;
/**
* 开户行
*/
private String accountBank;
/**
* 开票地址
*/
private String invoiceAddress;
/**
* 开户账号
*/
private String accountName;
/**
* 发票号码
*/
private String invoiceNumber;
/**
* 开票项目
*/
private String invoiceItem;
/**
* 开票类型(字典表 invoicing_type)
*/
private Integer invoiceTypeId;
/**
* 发票信息最后修改时间
*/
private Date invoiceInfoSaveTime;
/**
* 开发票人id
*/
private Long invoicerId;
/**
* 开票时间
*/
private Date invoiceTime;
/**
* 开票币种符号
*/
private Long currencyId;
/**
* 开票金额
*/
private java.math.BigDecimal invoiceMoney;
/**
* 开票信息备注
*/
private String invoiceInfoRemark;
/**
* 开票取消人id
*/
private Long cancelUserId;
/**
* 开票取消时间
*/
private Date cancelTime;
}
package cn.iocoder.yudao.module.wealth.dal.dataobject.receiptInvoiceLog;
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.util.Date;
/**
* 收款单开票信息日志 DO
*
* @author 系统管理员
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName("ecw_receipt_invoice_log")
public class ReceiptInvoiceLogDO {
/**
* 主键
*/
@TableId
private Long id;
/**
* 开票信息id
*/
private Long invoiceId;
/**
* 开票环节
*/
private Integer invoicingLink;
/**
* 操作人
*/
private String operator;
/**
* 备注
*/
private String remark;
/**
* 审批流程
*/
private Integer bpmStatus;
/**
* 创建时间
*/
private Date createTime;
}
......@@ -26,6 +26,10 @@ public class ReceiptItemDO extends BaseDO {
*/
@TableId
private Long id;
/**
* 流水号
*/
private String serialNumber;
/**
* 收款单id
*/
......@@ -96,5 +100,12 @@ public class ReceiptItemDO extends BaseDO {
* 当前流程ID
*/
private String bmpId;
/**
* 审核通过时间
*/
private Date approvalTime;
/**
* 备注
*/
private String remark;
}
package cn.iocoder.yudao.module.wealth.dal.dataobject.receiptLog;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* 收款单日志 DO
*
* @author 系统管理员
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName("ecw_receipt_log")
public class ReceiptLogDO {
/**
* 主键
*/
@TableId
private Long id;
/**
* 收款单id
*/
private Long receiptId;
/**
* 收款单环节
*/
private Integer receiptLink;
/**
* 操作人
*/
private String operator;
/**
* 备注
*/
private String remark;
/**
* 审批流程
*/
private String bpmStatus;
/**
* 创建时间
*/
private Date createTime;
}
......@@ -88,6 +88,10 @@ public class ReceivableDO extends BaseDO {
* 货币id
*/
private Long currencyId;
/**
* 基准币种id
*/
private Long baseCurrencyId;
/**
* 单价
*/
......@@ -152,7 +156,19 @@ public class ReceivableDO extends BaseDO {
* 含税金额
*/
private BigDecimal taxAmount;
/**
* 核销金额
*/
private BigDecimal writeOffAmount;
/**
* 基准核销金额
*/
@TableField(exist = false)
private BigDecimal writeOffBaseAmount;
/**
* 基准金额
*/
private BigDecimal baseAmount;
/**
* 备注
*/
......
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 ReceivableWriteOffRecordDO extends BaseDO {
@TableId
private Long id;
private Long receivableId;
private Long receiptItemId;
private BigDecimal writeOffAmount;
}
package cn.iocoder.yudao.module.wealth.dal.mysql.receipt;
import cn.iocoder.yudao.framework.mybatis.core.mapper.AbstractMapper;
import cn.iocoder.yudao.module.wealth.dal.dataobject.receipt.ReceiptBankWriteoffRangeDO;
import org.apache.ibatis.annotations.Mapper;
/**
* 银行收款明细自动核销比例设置 Mapper
*/
@Mapper
public interface ReceiptBankWriteoffRangeMapper extends AbstractMapper<ReceiptBankWriteoffRangeDO> {
}
\ No newline at end of file
package cn.iocoder.yudao.module.wealth.dal.mysql.receiptInvoice;
import cn.iocoder.yudao.framework.mybatis.core.mapper.AbstractMapper;
import cn.iocoder.yudao.module.wealth.dal.dataobject.receiptInvoice.ReceiptInvoiceDO;
import cn.iocoder.yudao.module.wealth.vo.receiptInvoice.ReceiptInvoiceDetailVO;
import cn.iocoder.yudao.module.wealth.vo.receiptInvoice.ReceiptInvoicePageBackVO;
import cn.iocoder.yudao.module.wealth.vo.receiptInvoice.ReceiptInvoiceQueryVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 收款单开票信息 Mapper
*
* @author 系统管理员
*/
@Mapper
public interface ReceiptInvoiceMapper extends AbstractMapper<ReceiptInvoiceDO> {
IPage<ReceiptInvoicePageBackVO> getReceiptInvoicePage(IPage<ReceiptInvoicePageBackVO> mpPage, @Param("query") ReceiptInvoiceQueryVO query);
ReceiptInvoiceDetailVO getReceiptInvoiceDetail(Long id);
String getCurrentMaxInvoiceCode();
}
package cn.iocoder.yudao.module.wealth.dal.mysql.receiptInvoiceLog;
import cn.iocoder.yudao.framework.mybatis.core.mapper.AbstractMapper;
import cn.iocoder.yudao.module.wealth.dal.dataobject.receiptInvoiceLog.ReceiptInvoiceLogDO;
import org.apache.ibatis.annotations.Mapper;
/**
* 收款单开票信息日志 Mapper
* @author 系统管理员
*/
@Mapper
public interface ReceiptInvoiceLogMapper extends AbstractMapper<ReceiptInvoiceLogDO> {
}
package cn.iocoder.yudao.module.wealth.dal.mysql.receiptItem;
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.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal;
import java.util.List;
/*
*/
@Mapper
public interface BankReceiptDetailsMapper {
List<ReceiptItemResp> getBankReceiptDetailsList(ReceiptItemReq req);
List<ReceiptItemRespVO> getBankReceiptDetailsList(ReceiptItemReq req);
/*
获取记录总数
*/
long GetCount(ReceiptItemReq req);
IPage<BankIncomeItemResp> getBankIncomeItemPage(IPage<BankIncomeItemResp> page, @Param("req") BankIncomeItemReq req);
BigDecimal calculateAccountBalance(String accountNo);
List<ReceiptItemActualAmount> calculateCurrentAmount(@Param("req") BankIncomeItemReq req);
List<ReceiptItemActualAmount> calculateTotalAmount();
}
......@@ -5,7 +5,11 @@ import cn.iocoder.yudao.framework.mybatis.core.mapper.AbstractMapper;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQuery;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.module.wealth.dal.dataobject.receiptItem.ReceiptItemDO;
import cn.iocoder.yudao.module.wealth.vo.receiptItem.ReceiptItemActualAmount;
import cn.iocoder.yudao.module.wealth.vo.receiptItem.ReceiptItemQueryVO;
import cn.iocoder.yudao.module.wealth.vo.receiptItem.ReceiptItemReviewPageReqVO;
import cn.iocoder.yudao.module.wealth.vo.receiptItem.ReceiptItemReviewPageVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultType;
......@@ -83,4 +87,16 @@ public interface ReceiptItemMapper extends AbstractMapper<ReceiptItemDO> {
"</script>"
})
BigDecimal getWriteOffAmountByReceiptId(@Param("receiptId") Long receiptId);
@ResultType(String.class)
@Select({"select serial_number from ecw_receipt_item order by serial_number desc limit 1"})
String getCurrentMaxReceiptItemCode();
IPage<ReceiptItemReviewPageVO> getReceiptItemReviewPage(IPage<ReceiptItemReviewPageVO> mpPage, @Param("query") ReceiptItemReviewPageReqVO pageReqVO);
List<ReceiptItemActualAmount> getReceiptItemActualAmount(@Param("query") ReceiptItemReviewPageReqVO pageReqVO);
List<ReceiptItemActualAmount> countTotalActualAmount();
List<ReceiptItemActualAmount> countTotalWriteOffAmount();
}
package cn.iocoder.yudao.module.wealth.dal.mysql.receiptLog;
import cn.iocoder.yudao.framework.mybatis.core.mapper.AbstractMapper;
import cn.iocoder.yudao.module.wealth.dal.dataobject.receiptLog.ReceiptLogDO;
import org.apache.ibatis.annotations.Mapper;
/**
* 收款单日志 Mapper
* @author 系统管理员
*/
@Mapper
public interface ReceiptLogMapper extends AbstractMapper<ReceiptLogDO> {
}
......@@ -5,9 +5,7 @@ import cn.iocoder.yudao.framework.mybatis.core.mapper.AbstractMapper;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQuery;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.module.wealth.dal.dataobject.receivable.ReceivableDO;
import cn.iocoder.yudao.module.wealth.vo.receivable.ReceivableBackVO;
import cn.iocoder.yudao.module.wealth.vo.receivable.ReceivableOrderPayedFeeTypeVO;
import cn.iocoder.yudao.module.wealth.vo.receivable.ReceivableQueryVO;
import cn.iocoder.yudao.module.wealth.vo.receivable.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.annotations.Param;
......@@ -102,7 +100,9 @@ public interface ReceivableMapper extends AbstractMapper<ReceivableDO> {
"o.container_number as container_number, ",
"nor.name as consignor_name, ",
"nor.phone as consignor_phone, ",
"nor.customer_id as consignor_id, ",
"nee.name as consignee_name, ",
"nee.customer_id as consignee_id, ",
"nee.phone as consignee_phone",
"from ecw_receivable r ",
"left join ecw_order o on o.order_id = r.order_id",
......@@ -408,4 +408,16 @@ public interface ReceivableMapper extends AbstractMapper<ReceivableDO> {
"update ecw_receivable set `deleted` = 0 ,update_time = now() where `id` = #{receivableId}"
})
void revokeDeleteReceivableById(@Param("receivableId") Long receivableId);
IPage<CostDetailPageVO> getCostDetailPage(IPage<CostDetailPageVO> page, @Param("query") CostDetailPageQueryVO query);
List<WealthMoneyAmountVO> costDetailSearchAmount(@Param("query") CostDetailPageQueryVO query);
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.dal.mysql.receivable;
import cn.iocoder.yudao.framework.mybatis.core.mapper.AbstractMapper;
import cn.iocoder.yudao.module.wealth.dal.dataobject.receivable.ReceivableWriteOffRecordDO;
import org.apache.ibatis.annotations.Mapper;
import java.math.BigDecimal;
/**
* 应收明细核销记录 Mapper
*/
@Mapper
public interface ReceivableWriteOffRecordMapper extends AbstractMapper<ReceivableWriteOffRecordDO> {
BigDecimal getTotalAmountForReceivable(Long id);
void deleteWriteOffRecord(Long id);
}
......@@ -110,5 +110,7 @@ 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, "收款明细对应的应收明细核销记录为空");
ErrorCode RECEIPT_ITEM_BATCH_ERROR = new ErrorCode(1004520042, "批量导入收款明细存在错误");
ErrorCode RECEIPT_ITEM_BATCH_WARN = new ErrorCode(1004520043, "批量导入收款明细存在警告");
}
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;
}
}
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 InvoiceDataStatusEnum implements IntArrayValuable {
/**
* 提交
*/
SUBMIT(0, "提交", "Submit"),
/**
* 驳回
*/
REJECT(1, "驳回", "Reject"),
/**
* 无需审核
*/
NO_AUDIT(2, "无需审核", "No Audit");
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(InvoiceDataStatusEnum::getValue).toArray();
/**
* 状态
*/
private final Integer value;
/**
* 状态中文
*/
private final String nameZh;
/**
* 状态英语
*/
private final String nameEn;
public static InvoiceDataStatusEnum valueOf(Integer value) {
return ArrayUtil.firstMatch(orderStatus -> orderStatus.getValue().equals(value), InvoiceDataStatusEnum.values());
}
@Override
public int[] array() {
return ARRAYS;
}
}
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"),
/**
* 修改开票信息
*/
MODIFY_INVOICE_INFO(2, "修改开票信息", "Modify Invoice Info"),
/**
* 删除开票信息
*/
DELETE_INVOICE_INFO(3, "删除开票信息", "Delete Invoice Info"),
/**
* 驳回开票资料
*/
REJECT_INVOICE_DATA(4, "驳回开票资料", "Reject Invoice Data"),
/**
* 提交开票
*/
SUBMIT_INVOICE(5, "提交开票", "Submit Invoice"),
/**
* 修改开票资料
*/
MODIFY_INVOICE_DATA(6, "修改开票资料", "Modify Invoice Data");
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;
}
}
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 InvoicingStatusEnum implements IntArrayValuable {
/**
* 待开票
*/
WAIT(0, "待开票", "Wait"),
/**
* 已开票
*/
INVOICED(1, "已开票", "Invoiced"),
/**
* 已取消
*/
CANCELLED(2, "已取消", "Cancelled"),
/**
* 不开票
*/
NO_INVOICE(3, "不开票", "NoInvoice");
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(InvoicingStatusEnum::getValue).toArray();
/**
* 状态
*/
private final Integer value;
/**
* 状态中文
*/
private final String nameZh;
/**
* 状态英语
*/
private final String nameEn;
public static InvoicingStatusEnum valueOf(Integer value) {
return ArrayUtil.firstMatch(orderStatus -> orderStatus.getValue().equals(value), InvoicingStatusEnum.values());
}
@Override
public int[] array() {
return ARRAYS;
}
}
......@@ -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.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 ReceiptItemStatusInReceiptEnum implements IntArrayValuable {
/**
* 未录入
*/
NO_INPUT(0, "未录入", "Draft"),
/**
* 未提交
*/
UN_SUBMITTED(1, "未提交", "Un Submitted"),
/**
* 部分提交
*/
PART_SUBMITTED(2, "部分提交", "Part Submitted"),
/**
* 未审批
*/
UN_APPROVED(3, "未审批", "Un Approved"),
/**
* 部分审批
*/
PART_APPROVED(4, "部分审批", "Part Approved"),
/**
* 全部审批
*/
ALL_APPROVED(5, "全部审批", "All Approved");
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(ReceiptItemStatusInReceiptEnum::getValue).toArray();
/**
* 状态
*/
private final Integer value;
/**
* 状态中文
*/
private final String nameZh;
/**
* 状态英语
*/
private final String nameEn;
public static ReceiptItemStatusInReceiptEnum valueOf(Integer value) {
return ArrayUtil.firstMatch(orderStatus -> orderStatus.getValue().equals(value), ReceiptItemStatusInReceiptEnum.values());
}
@Override
public int[] array() {
return ARRAYS;
}
}
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;
}
}
package cn.iocoder.yudao.module.wealth.job;
import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
@Component
@Slf4j
public class UpdateCurrencyExchangeRate implements JobHandler {
/**
* 更新兑兑目的国各种费用币种汇率
* @param param 参数
*/
@Override
public String execute(String param) throws Exception {
return "success";
}
/**
* 更新兑兑目的国运费币种汇率
* 当订单费用核销>=100%且费用类型为运费/额外费用-运费/全包价且兑目的国运费币种汇率为空,
* 更新目的国运费币种汇率=当前系统本币兑目的国运费用币种汇率,兑目的国运费币种汇率来源=系统汇率+年月日,例如系统汇率2024年06月27日 00:00:00
*/
private void updateFreightExchangeRate() {
}
/**
* 更新兑兑目的国清关费币种汇率
* 当订单费用核销>=100%且费用类型为清关费/额外费用-清关费且兑目的国清关费币种汇率为空,
* 更新目的国清关费币种汇率=当前系统本币兑目的国清关费币种汇率,兑目的国清关费币种汇率来源=系统汇率+年月日,例如系统汇率2024年06月27日 00:00:00
*/
private void updateClearanceFeeExchangeRate() {
}
/**
* 更新兑兑目的国额外费用主币种汇率
* 当订单费用核销>=100%且费用类型非清关费/额外费用-清关费/全包价/运费/额外费用-运费且兑目的国额外费用主币种汇率汇率为空,
* 更新目的国额外费用主币种汇率=当前系统本币兑目的国额外费用主币种汇率,兑目的国额外费用主币种汇率来源=系统汇率+年月日,例如系统汇率2024年06月27日 00:00:00
*/
private void updateExtraMainExchangeRate() {
}
/**
* 更新兑兑目的国额外费用副币种汇率
* 当订单费用核销>=100%且费用类型非清关费/额外费用-清关费/全包价/运费/额外费用-运费且兑目的国额外费用副币种汇率汇率为空,
* 更新目的国额外费用副币种汇率=当前系统本币兑目的国额外费用副币种汇率,兑目的国额外费用副币种汇率来源=系统汇率+年月日,例如系统汇率2024年06月27日 00:00:00
*/
private void updateExtraSecondaryExchangeRate() {
}
}
package cn.iocoder.yudao.module.wealth.job;
import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler;
import cn.iocoder.yudao.module.wealth.dal.dataobject.receipt.ReceiptDO;
import cn.iocoder.yudao.module.wealth.dal.dataobject.receiptItem.ReceiptItemDO;
import cn.iocoder.yudao.module.wealth.dal.mysql.receipt.ReceiptMapper;
import cn.iocoder.yudao.module.wealth.dal.mysql.receiptItem.ReceiptItemMapper;
import cn.iocoder.yudao.module.wealth.enums.InvoiceDataStatusEnum;
import cn.iocoder.yudao.module.wealth.enums.InvoicingStatusEnum;
import cn.iocoder.yudao.module.wealth.enums.ReceiptItemStatusInReceiptEnum;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;
@Component
@Slf4j
public class UpdateReceiptNewFieldTask implements JobHandler {
@Resource
private ReceiptItemMapper receiptItemMapper;
@Resource
private ReceiptMapper receiptMapper;
/**
* 更新收款单新字段:应收明细状态
* @param param 参数
*/
@Override
public String execute(String param) throws Exception {
log.info("更新收款单新字段:应收明细状态");
long l = System.currentTimeMillis();
LambdaQueryWrapper<ReceiptDO> receiptDOLambdaQueryWrapper = new LambdaQueryWrapper<>();
receiptDOLambdaQueryWrapper.select(ReceiptDO::getId,ReceiptDO::getOpenInvoice)
.eq(ReceiptDO::getDeleted, false);
List<ReceiptDO> receiptDOS = receiptMapper.selectList(receiptDOLambdaQueryWrapper);
List<Long> idList = receiptDOS.stream().map(ReceiptDO::getId).collect(Collectors.toList());
LambdaQueryWrapper<ReceiptItemDO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.in(ReceiptItemDO::getReceiptId, idList)
.select(ReceiptItemDO::getReceiptId, ReceiptItemDO::getStatus);
List<ReceiptItemDO> listItem = receiptItemMapper.selectList(lambdaQueryWrapper);
for (ReceiptDO receiptDO : receiptDOS) {
if (!listItem.isEmpty()) {
ReceiptItemStatusInReceiptEnum sMxStatus = getReceiptMxStatus(listItem, receiptDO.getId());
receiptDO.setReceiptItemStatus(sMxStatus.getValue());
} else {
receiptDO.setReceiptItemStatus(ReceiptItemStatusInReceiptEnum.NO_INPUT.getValue());
}
if (receiptDO.getOpenInvoice().equals(1)) {
receiptDO.setInvoiceDataStatus(InvoiceDataStatusEnum.SUBMIT.getValue());
receiptDO.setInvoicingStatus(InvoicingStatusEnum.WAIT.getValue());
} else if (receiptDO.getOpenInvoice().equals(0)) {
receiptDO.setInvoiceDataStatus(InvoiceDataStatusEnum.NO_AUDIT.getValue());
receiptDO.setInvoicingStatus(InvoicingStatusEnum.NO_INVOICE.getValue());
}
}
List<List<ReceiptDO>> receiptDOSList = receiptDOS.stream().collect(Collectors.groupingBy(item -> receiptDOS.indexOf(item) / 500)).values().stream().map(list -> list.stream().limit(1000).collect(Collectors.toList())).collect(Collectors.toList());
for (List<ReceiptDO> dos : receiptDOSList) {
receiptMapper.updateReceiptNewFieldBatch(dos);
}
log.info("更新收款单新字段:应收明细状态,耗时:{}", System.currentTimeMillis() - l);
return "success";
}
/**
* 计算收款单明细状态
* 收款单主表
* SELECT * from ecw_receipt where receipt_no='SKD00006547'
* 收款单明细表
* SELECT * from ecw_receipt_item where receipt_id=6554
*/
private ReceiptItemStatusInReceiptEnum getReceiptMxStatus(List<ReceiptItemDO> listItem, long ReceiptId) {
//未录入 收款单下无收款明细 OK
//未提交 :收款单下有收款明细且全未提交 OK
//部分提交 收款单下有收款明细且部分提交(无需判断收款明细是否审批) OK
//未审核 收款明细全部提交且全部未审批 OK
//部分审核 收款明细全部提交且部分已审批 OK
//全部审核 收款明细全部已审批 OK
ReceiptItemStatusInReceiptEnum sMxStatus = null;
//计算明细总数
Long iCount = listItem.stream().filter(i -> i.getReceiptId() == ReceiptId).collect(Collectors.counting());
if (iCount == 0) {
sMxStatus = ReceiptItemStatusInReceiptEnum.NO_INPUT;
return sMxStatus;
} else {
//存在记录就判断状态
//status 状态0待核销,待提交 1已核销
//2核销审核中,3反核销审核中
//bmpStatus
//PROCESS(1, "处理中"),APPROVE(2, "通过"),
//REJECT(3, "不通过"),CANCEL(4, "已取消");
long Item0 = listItem.stream().filter(i -> i.getStatus() == 0).filter(i -> i.getReceiptId() == ReceiptId).count();
long Item1 = listItem.stream().filter(i -> i.getStatus() == 1).filter(i -> i.getReceiptId() == ReceiptId).count();
long Item2 = listItem.stream().filter(i -> i.getStatus() == 2).filter(i -> i.getReceiptId() == ReceiptId).count();
long Item3 = listItem.stream().filter(i -> i.getStatus() == 3).filter(i -> i.getReceiptId() == ReceiptId).count();
if (Item0 == iCount) {
//0待核销
//收款单下有收款明细且全未提交
sMxStatus = ReceiptItemStatusInReceiptEnum.UN_SUBMITTED;
return sMxStatus;
}
if (Item0 > 0 && Item0 < iCount) {
//部分提交 收款单下有收款明细且部分提交(无需判断收款明细是否审批)
sMxStatus = ReceiptItemStatusInReceiptEnum.PART_SUBMITTED;
return sMxStatus;
}
//进部分提交,部分审核逻辑
//未审核 收款明细全部提交且全部未审批
if (Item2 == iCount) {
sMxStatus = ReceiptItemStatusInReceiptEnum.UN_APPROVED;
return sMxStatus;
}
if (Item1 == iCount) {
//1已核销
sMxStatus = ReceiptItemStatusInReceiptEnum.ALL_APPROVED;
return sMxStatus;
}
if ((Item2 + Item3) == iCount || (Item1 + Item3) == iCount || (Item2 + Item1) == iCount) {
sMxStatus = ReceiptItemStatusInReceiptEnum.PART_APPROVED;
return sMxStatus;
}
}
return sMxStatus;
}
}
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;
import org.springframework.scheduling.annotation.Async;
/**
* 银行收款明细审核通过监听
*/
@AllArgsConstructor
public class ReceiptItemWriteOffListener {
private final ReceiptItemService receiptItemService;
/**
* 银行收款明细审核通过更新应收核销金额
* @param event 编号记录
*/
@EventListener(ReceiptItemWriteOffEvent.class)
@Async
public void onReceiptItemWriteOff(ReceiptItemWriteOffEvent event) {
receiptItemService.verification(event.getId(), event.getBpmResult());
}
}
package cn.iocoder.yudao.module.wealth.listener.event;
import lombok.AllArgsConstructor;
import lombok.Data;
/**
* 银行收款明细审核通过 Event
*/
@Data
@AllArgsConstructor
public class ReceiptItemWriteOffEvent {
/**
* 主键
*/
private Long id;
/**
* 审核结果
*/
private Integer bpmResult;
}
......@@ -4,6 +4,7 @@ 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.receipt.ReceiptDO;
import cn.iocoder.yudao.module.wealth.enums.ReceiptLinkEnum;
import cn.iocoder.yudao.module.wealth.vo.receipt.*;
import javax.validation.Valid;
......@@ -32,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);
/**
* 删除收款单
*
......@@ -156,4 +142,55 @@ public interface ReceiptService extends IService<ReceiptDO> {
void autoWriteOffReceipt(ReceiptDO receiptDO, String userId, String userName);
/**
* 获得收款单银行明细核销范围
* @return
*/
ReceiptBankWriteoffRangeVO getBankWriteoffRange();
/**
* 设置收款单银行明细核销范围
* @param range
* @return
*/
Boolean setBankWriteoffRange(ReceiptBankWriteoffRangeVO range);
/**
* 批量创建收款单
*
* @param createReqVOList
* @return
*/
List<ReceiptBatchGenRespVO> batchGenReceipt(List<ReceiptCreateReqVO> createReqVOList);
/**
* 生成收款单相关数据
*
* @param createReqVO
* @return
*/
Long generateReceiptRelevantData(ReceiptCreateReqVO createReqVO);
/**
* 更新收款明细状态
* @param receiptId
*/
void updateReceiptItemStatus(Long receiptId);
/**
* 记录日志
*
* @param receiptId 收款单ID
* @param linkEnum 环节
* @param remark 备注
* @param bpmId 审批流程
*/
void recordLog(Long receiptId, ReceiptLinkEnum linkEnum, String remark, String bpmId);
/**
* 获得收款单详情
* @param id
* @return
*/
ReceiptBackVO getReceiptDetail(Long id);
}
package cn.iocoder.yudao.module.wealth.service.receiptInvoice;
import java.util.*;
import javax.validation.*;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.framework.mybatis.core.service.IService;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.wealth.dal.dataobject.receiptInvoice.ReceiptInvoiceDO;
import cn.iocoder.yudao.module.wealth.vo.receiptInvoice.*;
/**
* 收款单开票信息 Service 接口
*
* @author 系统管理员
*/
public interface ReceiptInvoiceService extends IService<ReceiptInvoiceDO> {
/**
* 创建收款单开票信息
* @param createReqVO 创建信息
* @return 编号
*/
Long createReceiptInvoice(@Valid InvoiceCreateReqVO createReqVO);
/**
* 更新收款单开票信息
* @param updateReqVO 更新信息
*/
void updateReceiptInvoiceData(@Valid ReceiptInvoiceUpdateDataReqVO updateReqVO);
/**
* 获得收款单开票信息
*
* @param id 编号
* @return 收款单开票信息
*/
ReceiptInvoiceDetailVO getReceiptInvoiceDetail(Long id);
/**
* 获得收款单开票信息列表
* @param ids 编号
* @return 收款单开票信息列表
*/
List<ReceiptInvoiceDO> getReceiptInvoiceList(Collection<Long> ids);
/**
* 获得收款单开票信息分页
* @param page 分页查询
* @param query 查询
* @return 收款单开票信息分页
*/
PageResult<ReceiptInvoicePageBackVO> getReceiptInvoicePage(ReceiptInvoiceQueryVO query, PageVO page);
/**
* 获得收款单开票信息列表, 用于 Excel 导出
* @param query 查询
* @return 收款单开票信息列表
*/
List<ReceiptInvoiceDO> getReceiptInvoiceList(ReceiptInvoiceQueryVO query);
Boolean rejectInvoiceInfo(@Valid ReceiptInvoiceOperateReqVO reqVO);
Boolean cancelInvoice(@Valid ReceiptInvoiceOperateReqVO reqVO);
Boolean deleteInvoiceInfo(@Valid ReceiptInvoiceOperateReqVO reqVO);
void updateReceiptInvoiceInfo(@Valid ReceiptInvoiceUpdateInfoReqVO updateReqVO);
ReceiptInvoiceDetailVO getReceiptDetailForCreateInvoice(Long receiptId);
}
......@@ -5,24 +5,23 @@ 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.receiptItem.ReceiptItemReq;
import cn.iocoder.yudao.module.wealth.vo.receiptItem.ReceiptItemResp;
import cn.iocoder.yudao.module.wealth.vo.receipt.ReceiptRelationOrderInfoVO;
import cn.iocoder.yudao.module.wealth.vo.receiptItem.*;
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;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/*
银行收款明细列表
*/
@Service
@Validated
@Slf4j
......@@ -30,51 +29,70 @@ 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
public BankIncomePageResult<BankIncomeItemResp> getBankIncomeItemPage(BankIncomeItemReq req) {
IPage<BankIncomeItemResp> mpPage = MyBatisUtils.buildPage(req);
bankReceiptDetailsMapper.getBankIncomeItemPage(mpPage, req);
if (mpPage.getTotal() == 0) {
return BankIncomePageResult.empty();
}
// 计算账号余额
List<BankIncomeItemResp> records = mpPage.getRecords();
HashMap<String, BigDecimal> accountBalanceMap = new HashMap<>();
for (BankIncomeItemResp record : records) {
if (accountBalanceMap.containsKey(record.getAccountNo())) {
record.setAccountBalance(accountBalanceMap.get(record.getAccountNo()));
} else {
record.setAccountBalance(bankReceiptDetailsMapper.calculateAccountBalance(record.getAccountNo()));
accountBalanceMap.put(record.getAccountNo(), record.getAccountBalance());
}
List<ReceiptRelationOrderInfoVO> orderInfoByReceiptId = receiptMapper.getOrderInfoByReceiptId(Long.parseLong(record.getReceiptId()));
record.setOrderInfoList(orderInfoByReceiptId);
}
// 汇总不同币种总额
BankIncomePageResult<BankIncomeItemResp> result = BankIncomePageResult.of(mpPage);
result.setCurrentAmount(bankReceiptDetailsMapper.calculateCurrentAmount(req));
result.setTotalAmount(bankReceiptDetailsMapper.calculateTotalAmount());
return result;
}
/*
......
package cn.iocoder.yudao.module.wealth.service.receiptItem;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.wealth.dal.dataobject.receiptItem.ReceiptItemDO;
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.*;
import java.util.List;
/*
*/
public interface BankReceiptDetailsService {
PageResult<ReceiptItemResp> getBankReceiptDetailsList(ReceiptItemReq req);
PageResult<ReceiptItemRespVO> getBankReceiptDetailsList(ReceiptItemReq req);
BankIncomePageResult<BankIncomeItemResp> getBankIncomeItemPage(BankIncomeItemReq req);
}
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;
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 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.*;
import javax.validation.Valid;
import java.math.BigDecimal;
......@@ -61,11 +63,11 @@ public interface ReceiptItemService extends IService<ReceiptItemDO> {
/**
* 核销
* 处理审批结果
*
* @param id
*/
void verification(Long id);
void verification(Long id,Integer bpmResult);
/**
* 批量核销
......@@ -94,7 +96,7 @@ public interface ReceiptItemService extends IService<ReceiptItemDO> {
*
* @param financeReceiptItemVo
*/
void createFinanceReceiptItemWriteOff(FinanceReceiptItemVo financeReceiptItemVo);
ReceiptApprovalDO createFinanceReceiptItemWriteOff(FinanceReceiptItemVo financeReceiptItemVo);
/**
* 发起收款明细反核销
......@@ -121,4 +123,9 @@ public interface ReceiptItemService extends IService<ReceiptItemDO> {
BigDecimal getWriteOffAmountByReceiptId( Long receiptId);
List<ReceiptItemBatchRespVO> receiptItemImport(List<ReceiptItemBatchCreateReqVO> list, Boolean ignoreItem);
ReceiptItemBackVO getReceiptItemDetail(Long id);
ReceiptItemReviewPageResult<ReceiptItemReviewPageVO> getReceiptItemReviewPage(ReceiptItemReviewPageReqVO pageReqVO, PageVO page);
}
......@@ -3,10 +3,10 @@ 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.receipt.ReceiptExportDto;
import cn.iocoder.yudao.module.wealth.dal.dataobject.receivable.ReceivableWriteOffRecordDO;
import cn.iocoder.yudao.module.wealth.vo.receivable.*;
import org.checkerframework.checker.units.qual.C;
import javax.validation.Valid;
import java.util.Collection;
......@@ -134,12 +134,13 @@ public interface ReceivableService extends IService<ReceivableDO> {
* @return 应收款分页
*/
PageResult<ReceivableBackVO> receivablePage(ReceivableQueryVO query, PageVO page);
List<WealthMoneyAmountVO> receivablePageAmount(@Valid ReceivableQueryVO query);
/**
* 获得应收款分页
* 根据订单id获得应收款
*
* @param orderId 订单ID
* @return 应收款分页
* @return 应收款列表
*/
List<ReceivableBackVO> getReceivableByOrderId(Long orderId);
......@@ -162,7 +163,7 @@ public interface ReceivableService extends IService<ReceivableDO> {
List<ReceivableBackVO> receivableList(List<Long> ids);
/**
* 根据付款单ID得到付款单明细列表
* 根据收款单ID得到应收明细列表
*
* @param id
* @return
......@@ -250,4 +251,33 @@ public interface ReceivableService extends IService<ReceivableDO> {
* @param receivableId 应收id
*/
void revokeDeleteReceivableById(Long receivableId);
/**
* 应收款费用明细分页
*
* @param query
* @param page
* @return
*/
CostDetailBackVO getCostDetailPage(@Valid CostDetailPageQueryVO query, PageVO page);
/**
* 批量生成收款单分页
* @param query
* @param page
* @return
*/
PageResult<BatchGenReceiptPageVO> batchGenReceiptPage(@Valid BatchGenReceiptPageQueryVO query, PageVO page);
Long getDestCountryCurrencyId(Long orderId);
void createWriteOffRecord(ReceivableWriteOffReqVO receivableWriteOffReqVO, ReceiptItemDO receiptItem);
ReceivableWriteOffRecordDO getReceivableWriteOffRecord(Long receivableId, Long receiptItemId);
List<ReceivableInItemVO> getListForCreateReceiptItem(Long receiptId);
void deleteWriteOffRecord(ReceiptItemDO receiptItemDO);
List<ReceivableInItemVO> getReceivableByReceiptItem(Long receiptItemId);
}
......@@ -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")
......
......@@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.wealth.vo.receipt;
import lombok.Data;
@Data
public class OrderVo {
public class OrderVO {
public Long customerId;
private String containerNumber;
private String country;
......
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