获取不到登录人
This commit is contained in:
+119
-1
@@ -233,6 +233,124 @@ public class BillManageDomainService {
|
|||||||
return flag && flagTwo && three;
|
return flag && flagTwo && three;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Boolean saveBillJob(List<BillingStatementPO> billingStatementPOS,String billingRemark,Date billCreateTime,BillingStatementDTO billingStatementDTO) {
|
||||||
|
// LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||||
|
// if (ObjectUtil.isNull(loginUser)) {
|
||||||
|
//// throw new DigitalLogisticsException(UserError.TIMEOUT);
|
||||||
|
// }
|
||||||
|
BigDecimal taxAmount = billingStatementDTO.getTaxAmount(); // 获取税额
|
||||||
|
Double taxRate = billingStatementDTO.getTaxRate(); // 获取税率
|
||||||
|
BigDecimal taxFreeFee = billingStatementDTO.getTaxFreeFee(); // 获取税免金额
|
||||||
|
String settlementCurrency = billingStatementDTO.getSettlementCurrency(); // 获取结算币种
|
||||||
|
BillManage billManage = new BillManage();
|
||||||
|
billManage.setTaxAmount(taxAmount);
|
||||||
|
billManage.setTaxRate(taxRate);
|
||||||
|
billManage.setTaxFreeFee(taxFreeFee);
|
||||||
|
billManage.setSettlementCurrency(settlementCurrency);
|
||||||
|
// billManage.setCreateBy(loginUser.getUserPo().getUserId());
|
||||||
|
// billManage.setCreateByName(loginUser.getUserPo().getUserName());
|
||||||
|
billManage.setCreateTime(billCreateTime==null ? new Date():billCreateTime);
|
||||||
|
billManage.setDelFlag(1);
|
||||||
|
billManage.setBillNumber(OrderSequence.getOrderCode("ZD"));
|
||||||
|
billManage.setTopOrganizationId(billingStatementDTO.getTopOrganizationId());
|
||||||
|
billManage.setOrganizationId(billingStatementDTO.getOrganizationId());
|
||||||
|
billManage.setOrganizationName(billingStatementDTO.getOrganizationName());
|
||||||
|
billManage.setBillType(billingStatementPOS.get(0).getAccountExpenseType());
|
||||||
|
billManage.setBelongModule(billingStatementPOS.get(0).getBelongModule());
|
||||||
|
billManage.setBelongModuleCode(billingStatementPOS.get(0).getBelongModuleCode());
|
||||||
|
billManage.setSettlementCustomersId(billingStatementPOS.get(0).getSettlementCustomersId());
|
||||||
|
billManage.setSettlementEntity(billingStatementPOS.get(0).getSettlementEntity());
|
||||||
|
billManage.setSettlementCustomersCode(billingStatementPOS.get(0).getSettlementCustomersCode());
|
||||||
|
billManage.setSalesmanId(billingStatementPOS.get(0).getSalesmanId());
|
||||||
|
billManage.setSalesmanName(billingStatementPOS.get(0).getSalesmanName());
|
||||||
|
billManage.setPaymentAccountId(billingStatementPOS.get(0).getPaymentAccountId());
|
||||||
|
billManage.setPaymentAccountName(billingStatementPOS.get(0).getPaymentAccountName());
|
||||||
|
billManage.setBillRemark(billingRemark);
|
||||||
|
//查询结算对象信息
|
||||||
|
SettlementCustomersPO settlementCustomersPO = settlementCustomersDomainService.getInfo(billingStatementPOS.get(0).getSettlementCustomersId());
|
||||||
|
if(null == settlementCustomersPO){
|
||||||
|
throw new ServiceException("结算对象信息未找到");
|
||||||
|
}
|
||||||
|
billManage.setSettlementMethod(settlementCustomersPO.getSettlementMethod());
|
||||||
|
billManage.setSettlementMethodCode(settlementCustomersPO.getSettlementMethodCode());
|
||||||
|
// if(settlementCustomersPO.getMainRole()==1){
|
||||||
|
// billManage.setBillType(1);
|
||||||
|
// }else {
|
||||||
|
// billManage.setBillType(2);
|
||||||
|
// }
|
||||||
|
//计算所有流水列表中的最早周期开始时间和晚周期结束时间
|
||||||
|
List<Date> cycleBeginTimeSet = billingStatementPOS.stream().map(BillingStatementPO::getCycleBeginTime).collect(Collectors.toList());
|
||||||
|
List<Date> cycleEndTimeSet = billingStatementPOS.stream().map(BillingStatementPO::getCycleEndTime).collect(Collectors.toList());
|
||||||
|
cycleBeginTimeSet.removeIf(Objects::isNull);
|
||||||
|
cycleEndTimeSet.removeIf(Objects::isNull);
|
||||||
|
if(cycleBeginTimeSet.size()>0){
|
||||||
|
billManage.setCycleBeginTime(Collections.min(cycleBeginTimeSet));
|
||||||
|
}
|
||||||
|
if(cycleEndTimeSet.size()>0){
|
||||||
|
billManage.setCycleEndTime(Collections.max(cycleEndTimeSet));
|
||||||
|
}
|
||||||
|
//将所有的流水金额相加
|
||||||
|
billManage.setBillTotalAmount(billingStatementPOS.stream().map(BillingStatementPO::getBillingAmount).reduce(BigDecimal.ZERO, BigDecimal::add));
|
||||||
|
billManage.setBillAmount(billManage.getBillTotalAmount());
|
||||||
|
billManage.setBillAmountUnsettled(billManage.getBillTotalAmount());
|
||||||
|
boolean flag = billManageService.save(billManage);
|
||||||
|
billingStatementDTO.setBillManageId(billManage.getBillManageId());
|
||||||
|
List<BillDetail> billDetailList = new ArrayList<>();
|
||||||
|
for (BillingStatementPO billingStatementPO : billingStatementPOS) {
|
||||||
|
//生成对账单详情
|
||||||
|
BillDetail billDetail = new BillDetail();
|
||||||
|
billDetail.setTopOrganizationId(billingStatementPO.getTopOrganizationId());
|
||||||
|
billDetail.setOrganizationId(billingStatementPO.getOrganizationId());
|
||||||
|
billDetail.setOrganizationName(billingStatementPO.getOrganizationName());
|
||||||
|
billDetail.setCreateBy(billManage.getCreateBy());
|
||||||
|
billDetail.setCreateByName(billManage.getCreateByName());
|
||||||
|
billDetail.setCreateTime(billManage.getCreateTime());
|
||||||
|
billDetail.setBillManageId(billManage.getBillManageId());
|
||||||
|
billDetail.setBillNumber(billManage.getBillNumber());
|
||||||
|
billDetail.setBillingStatementId(billingStatementPO.getBillingStatementId());
|
||||||
|
billDetail.setBillingFlow(billingStatementPO.getBillingFlow());
|
||||||
|
billDetail.setBillingTotalAmount(billingStatementPO.getBillingAmount());
|
||||||
|
billDetail.setBillingAmount(billingStatementPO.getBillingAmount());
|
||||||
|
billDetail.setBillType(billingStatementPO.getAccountExpenseType());
|
||||||
|
billDetail.setTaxAmount(billingStatementPO.getTaxAmount());
|
||||||
|
billDetail.setTaxRate(billingStatementPO.getTaxRate());
|
||||||
|
billDetail.setTaxFreeFee(billingStatementPO.getTaxFreeFee());
|
||||||
|
billDetail.setSettlementCurrency(billingStatementPO.getSettlementCurrency());
|
||||||
|
billDetail.setFeeType(billingStatementPO.getFeeType());
|
||||||
|
billDetail.setInvoiceItem(billingStatementPO.getInvoiceItem());
|
||||||
|
billDetail.setInvoiceItemName(billingStatementPO.getInvoiceItemName());
|
||||||
|
billDetailList.add(billDetail);
|
||||||
|
}
|
||||||
|
boolean flagTwo = billDetailDomainService.insertBatch(billDetailList);
|
||||||
|
//保存账单操作记录
|
||||||
|
BillOperationLogDO billOperationLogDO = new BillOperationLogDO();
|
||||||
|
billOperationLogDO.setBillManageId(billManage.getBillManageId());
|
||||||
|
billOperationLogDO.setOperationInfo(StringUtils.format(BillLogsConstants.create_bill_text, billManage.getBillNumber(), billManage.getBillTotalAmount()));
|
||||||
|
billOperationLogDO.setOperationType(1);
|
||||||
|
billOperationLogDO.setCreateByName(billManage.getCreateByName());
|
||||||
|
billOperationLogDO.setUpdateByName(billManage.getUpdateByName());
|
||||||
|
billOperationLogDO.setCreateTime(new Date());
|
||||||
|
billOperationLogDO.setUpdateTime(new Date());
|
||||||
|
billOperationLogDO.setDelFlag(1);
|
||||||
|
billOperationLogDO.setCreateBy(billManage.getCreateBy());
|
||||||
|
billOperationLogDO.setUpdateBy(billManage.getUpdateBy());
|
||||||
|
billOperationLogDO.setTopOrganizationId(billManage.getTopOrganizationId());
|
||||||
|
billOperationLogDO.setOrganizationId(billManage.getOrganizationId());
|
||||||
|
billOperationLogDO.setOrganizationName(billManage.getOrganizationName());
|
||||||
|
|
||||||
|
boolean three = billOperationLogDomainService.saveBillOperationLogJob(billOperationLogDO);
|
||||||
|
//修改流水记录
|
||||||
|
/*billingStatementDTO.getBillingStatementList().forEach(billingStatementADDVO -> {
|
||||||
|
billingStatementMapper.update(null,
|
||||||
|
new LambdaUpdateWrapper<BillingStatement>().set(BillingStatement::getTaxAmount,billingStatementADDVO.getTaxAmount())
|
||||||
|
.set(BillingStatement::getTaxRate,billingStatementADDVO.getTaxRate())
|
||||||
|
.set(BillingStatement::getTaxFreeFee,billingStatementADDVO.getTaxFreeFee())
|
||||||
|
.set(BillingStatement::getSettlementCurrency,billingStatementADDVO.getSettlementCurrency())
|
||||||
|
.eq(BillingStatement::getBillingStatementId,billingStatementADDVO.getBillingStatementId()));
|
||||||
|
});*/
|
||||||
|
return flag && flagTwo && three;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存账单
|
* 保存账单
|
||||||
* @param billingStatementDTO
|
* @param billingStatementDTO
|
||||||
@@ -351,7 +469,7 @@ public class BillManageDomainService {
|
|||||||
if(billingStatementPOS==null || billingStatementPOS.size()==0){
|
if(billingStatementPOS==null || billingStatementPOS.size()==0){
|
||||||
throw new ServiceException("所选流水信息未找到");
|
throw new ServiceException("所选流水信息未找到");
|
||||||
}
|
}
|
||||||
return saveBill(distinctList,billingStatementDTO.getBillingRemark(),billingStatementDTO.getBillCreateTime(),billingStatementDTO);
|
return saveBillJob(distinctList,billingStatementDTO.getBillingRemark(),billingStatementDTO.getBillCreateTime(),billingStatementDTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+7
-1
@@ -95,6 +95,12 @@ public class BillOperationLogDomainService {
|
|||||||
return billOperationLogService.insert(billOperationLogDO);
|
return billOperationLogService.insert(billOperationLogDO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Boolean saveBillOperationLogJob(BillOperationLogDO billOperationLogDO) {
|
||||||
|
|
||||||
|
billOperationLogDO.setDelFlag(1);
|
||||||
|
return billOperationLogService.insert(billOperationLogDO);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量保存操作日志
|
* 批量保存操作日志
|
||||||
@@ -161,4 +167,4 @@ public class BillOperationLogDomainService {
|
|||||||
public List<BillOperationLogPO> getDetailsById(Long billManageId) {
|
public List<BillOperationLogPO> getDetailsById(Long billManageId) {
|
||||||
return billOperationLogService.getDetailsById(billManageId);
|
return billOperationLogService.getDetailsById(billManageId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user