update 默认分隔符

This commit is contained in:
2023-08-04 13:55:36 +08:00
parent 59d8737daa
commit bf1fa80497
13 changed files with 67 additions and 41 deletions

View File

@@ -787,7 +787,7 @@ public class OrderService {
// 排除掉已经申请过的订单
List<String> orderCodeList = orderInvoiceRecords.stream() // 转化为 Stream
.map(OrderInvoiceRecord::getOrderCodes) // 获取 OrderInvoiceRecord 中的 orderCodes 字符串
.flatMap(str -> Arrays.stream(str.split(","))) // 分隔逗号并转化为 Stream
.flatMap(str -> Arrays.stream(str.split(Constants.DEFAULT_DELIMITER))) // 分隔逗号并转化为 Stream
.collect(Collectors.toList()); // 收集为 List<String>
orderList = orderList.stream()
@@ -813,7 +813,7 @@ public class OrderService {
List<OrderInvoiceRecord> orderInvoiceRecords = orderInvoiceRecordService.selectInvoiceRecordList(dto.getMemberId(), dateTime, LocalDateTime.now());
List<String> orderCodeList = orderInvoiceRecords.stream() // 转化为 Stream
.map(OrderInvoiceRecord::getOrderCodes) // 获取 OrderInvoiceRecord 中的 orderCodes 字符串
.flatMap(str -> Arrays.stream(str.split(","))) // 分隔逗号并转化为 Stream
.flatMap(str -> Arrays.stream(str.split(Constants.DEFAULT_DELIMITER))) // 分隔逗号并转化为 Stream
.collect(Collectors.toList()); // 收集为 List<String>
// 取交集 校验订单是否已经开票
@@ -823,19 +823,9 @@ public class OrderService {
return;
}
// 整理数据
List<OrderVO> orderVOList = orderBasicInfoService.getListByOrderCodes(dto.getOrderCodes());
BigDecimal totalAmount = BigDecimal.ZERO;
BigDecimal totalElecAmount = BigDecimal.ZERO;
BigDecimal totalServiceAmount = BigDecimal.ZERO;
for (OrderVO orderVO : orderVOList) {
totalAmount = totalAmount.add(orderVO.getOrderAmount());
totalElecAmount = totalElecAmount.add(orderVO.getTotalElectricityAmount());
totalServiceAmount = totalServiceAmount.add(orderVO.getTotalServiceAmount());
}
// 查抬头信息
MemberInvoiceTitle invoiceTitle = memberInvoiceTitleService.selectMemberInvoiceTitleById(Long.parseLong(dto.getTitleId()));
if (StringUtils.isNotEmpty(dto.getReception())) {
boolean b = false;
if (StringUtils.isEmail(dto.getReception()) && !StringUtils.equals(dto.getReception(), invoiceTitle.getEmail())) {
@@ -851,16 +841,38 @@ public class OrderService {
}
}
// 入库
OrderInvoiceRecord orderInvoiceRecord = new OrderInvoiceRecord();
orderInvoiceRecord.setStatus("0");
orderInvoiceRecord.setMemberId(dto.getMemberId());
orderInvoiceRecord.setTitleId(dto.getTitleId());
orderInvoiceRecord.setOrderCodes(String.join(",", dto.getOrderCodes()));
orderInvoiceRecord.setTotalAmount(totalAmount);
orderInvoiceRecord.setTotalElecAmount(totalElecAmount);
orderInvoiceRecord.setTotalServiceAmount(totalServiceAmount);
orderInvoiceRecordService.insertOrderInvoiceRecord(orderInvoiceRecord);
// 整理数据
List<OrderVO> orderVOList = orderBasicInfoService.getListByOrderCodes(dto.getOrderCodes());
// 根据运营商分组
Map<String, List<OrderVO>> map = orderVOList.stream().collect(Collectors.groupingBy(OrderVO::getMerchantId));
BigDecimal totalAmount = null;
BigDecimal totalElecAmount = null;
BigDecimal totalServiceAmount = null;
// 根据运营商创建多笔开票记录
for (Map.Entry<String, List<OrderVO>> entry : map.entrySet()) {
totalAmount = BigDecimal.ZERO;
totalElecAmount = BigDecimal.ZERO;
totalServiceAmount = BigDecimal.ZERO;
List<OrderVO> orders = entry.getValue();
for (OrderVO orderVO : orders) {
totalAmount = totalAmount.add(orderVO.getOrderAmount());
totalElecAmount = totalElecAmount.add(orderVO.getTotalElectricityAmount());
totalServiceAmount = totalServiceAmount.add(orderVO.getTotalServiceAmount());
}
// 入库
OrderInvoiceRecord orderInvoiceRecord = new OrderInvoiceRecord();
orderInvoiceRecord.setStatus(Constants.ZERO);
orderInvoiceRecord.setMemberId(dto.getMemberId());
orderInvoiceRecord.setTitleId(dto.getTitleId());
orderInvoiceRecord.setOrderCodes(String.join(Constants.DEFAULT_DELIMITER, dto.getOrderCodes()));
orderInvoiceRecord.setTotalAmount(totalAmount);
orderInvoiceRecord.setTotalElecAmount(totalElecAmount);
orderInvoiceRecord.setTotalServiceAmount(totalServiceAmount);
orderInvoiceRecordService.insertOrderInvoiceRecord(orderInvoiceRecord);
}
}
/**

View File

@@ -1,6 +1,7 @@
package com.jsowell.web.controller.system;
import com.jsowell.common.annotation.Log;
import com.jsowell.common.constant.Constants;
import com.jsowell.common.constant.UserConstants;
import com.jsowell.common.core.controller.BaseController;
import com.jsowell.common.core.domain.AjaxResult;
@@ -49,7 +50,7 @@ public class SysDeptController extends BaseController {
while (it.hasNext()) {
SysDept d = (SysDept) it.next();
if (d.getDeptId().intValue() == deptId
|| ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + "")) {
|| ArrayUtils.contains(StringUtils.split(d.getAncestors(), Constants.DEFAULT_DELIMITER), deptId + "")) {
it.remove();
}
}