feat: 积分商城-对账-发票-优化4
This commit is contained in:
+2
@@ -7,6 +7,8 @@ public class PointsMallInvoiceApplyParam {
|
||||
|
||||
private String supplierId;
|
||||
private String orderIds;
|
||||
private String queryOrderId;
|
||||
private String userId;
|
||||
private String startDate;
|
||||
private String endDate;
|
||||
private String invoiceDate;
|
||||
|
||||
+13
-4
@@ -350,7 +350,19 @@ public class PointsMallInvoiceServiceImpl extends BaseServiceImpl<PointsMallInvo
|
||||
query.setEndDate(param.getEndDate());
|
||||
query.setInvoiceStatus(0);
|
||||
|
||||
List<PointsMallOrderSub> orders = dao().query(PointsMallOrderSub.class, invoiceOrderCnd(query, ""));
|
||||
Cnd cnd = invoiceOrderCnd(query, "");
|
||||
if (StrUtil.isNotBlank(param.getQueryOrderId())) {
|
||||
List<String> queryOrderIds = StrUtil.splitTrim(param.getQueryOrderId(), ",");
|
||||
if (queryOrderIds.size() > 1) {
|
||||
cnd.and("orderId", "in", queryOrderIds);
|
||||
} else {
|
||||
cnd.and("orderId", "like", "%" + param.getQueryOrderId() + "%");
|
||||
}
|
||||
}
|
||||
if (StrUtil.isNotBlank(param.getUserId())) {
|
||||
cnd.and("userId", "like", "%" + param.getUserId() + "%");
|
||||
}
|
||||
List<PointsMallOrderSub> orders = dao().query(PointsMallOrderSub.class, cnd);
|
||||
if (CollUtil.isEmpty(orders)) {
|
||||
throw new IllegalArgumentException("无符合条件的订单数据");
|
||||
}
|
||||
@@ -464,9 +476,6 @@ public class PointsMallInvoiceServiceImpl extends BaseServiceImpl<PointsMallInvo
|
||||
if (StrUtil.isBlank(param.getSupplierId())) {
|
||||
throw new IllegalArgumentException("供应商不能为空");
|
||||
}
|
||||
if (StrUtil.isBlank(param.getOrderIds())) {
|
||||
throw new IllegalArgumentException("订单不能为空");
|
||||
}
|
||||
if (StrUtil.isBlank(param.getStartDate()) || StrUtil.isBlank(param.getEndDate())) {
|
||||
throw new IllegalArgumentException("订单完成日期不能为空");
|
||||
}
|
||||
|
||||
+14
-5
@@ -77,7 +77,8 @@ public class MallCallPMessagePushService {
|
||||
log.info("订单消息已推送,跳过重复通知:{}", uniqueNo);
|
||||
return;
|
||||
}
|
||||
Map<String, String> params = orderParams(order.getSupplierId(), userId, order.getExtJson());
|
||||
Map<String, String> params = orderParams(order.getSupplierId(), userId, order.getExtJson(),
|
||||
"11111111".equals(templateId), order.getTotalPrice());
|
||||
if (StrUtil.isNotBlank(order.getUserName())) {
|
||||
params.put("#{userName}", order.getUserName());
|
||||
}
|
||||
@@ -120,18 +121,26 @@ public class MallCallPMessagePushService {
|
||||
}
|
||||
|
||||
/** 公共模板变量:用户姓名、供应商名称和订单商品列表。 */
|
||||
private Map<String, String> orderParams(String supplierId, String userId, String extJson) {
|
||||
private Map<String, String> orderParams(String supplierId, String userId, String extJson,
|
||||
boolean paymentMessage, BigDecimal totalPrice) {
|
||||
Sys_user user = dao.fetch(Sys_user.class, Cnd.where("id", "=", userId).or("loginname", "=", userId));
|
||||
PointsMallSupplier supplier = dao.fetch(PointsMallSupplier.class, Cnd.where("supplierId", "=", supplierId).and("delFlag", "=", false));
|
||||
Map<String, String> params = new HashMap<>();
|
||||
params.put("#{userName}", user == null ? userId : StrUtil.blankToDefault(user.getUsername(), userId));
|
||||
params.put("#{supplierName}", supplier == null ? supplierId : StrUtil.blankToDefault(supplier.getSupplierName(), supplierId));
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("商品列表: ").append(System.lineSeparator());
|
||||
sb.append(paymentMessage ? "商品列表:" : "商品列表: ").append(System.lineSeparator());
|
||||
List<OrderProInfoDTO> products = StrUtil.isBlank(extJson) || "null".equalsIgnoreCase(extJson.trim())
|
||||
? Collections.emptyList() : JSONUtil.toList(extJson, OrderProInfoDTO.class);
|
||||
products.forEach(product -> sb.append(" 商品名称: ").append(product.getName())
|
||||
.append(",商品价格:").append(formatMoney(product.getPrice())).append("元").append(System.lineSeparator()));
|
||||
if (paymentMessage) {
|
||||
products.forEach(product -> sb.append("商品名称:").append(product.getName())
|
||||
.append(" * ").append(product.getNumber() == null ? "-" : product.getNumber())
|
||||
.append(",商品单价:").append(formatMoney(product.getPrice())).append("元").append(System.lineSeparator()));
|
||||
sb.append(System.lineSeparator()).append("订单合计:¥").append(formatMoney(totalPrice));
|
||||
} else {
|
||||
products.forEach(product -> sb.append(" 商品名称: ").append(product.getName())
|
||||
.append(",商品价格:").append(formatMoney(product.getPrice())).append("元").append(System.lineSeparator()));
|
||||
}
|
||||
params.put("#{productList}", sb.toString());
|
||||
return params;
|
||||
}
|
||||
|
||||
+8
-4
@@ -37,6 +37,10 @@ public class MallInvoiceInfoQueryService extends AbstractMallBridgeSupport {
|
||||
}
|
||||
|
||||
public MallPictureOutboundResult queryInvoiceFiles(String supplierId, String settlementId, List<String> fileIds) {
|
||||
return queryFiles(supplierId, settlementId, "2", fileIds);
|
||||
}
|
||||
|
||||
public MallPictureOutboundResult queryFiles(String supplierId, String idNumber, String queryType, List<String> fileIds) {
|
||||
PointsMallSupplier supplier = dao.fetch(PointsMallSupplier.class,
|
||||
Cnd.where("supplierId", "=", supplierId).and("delFlag", "=", false));
|
||||
if (supplier == null || StrUtil.isBlank(supplier.getSupplierApiUrl())) {
|
||||
@@ -51,8 +55,8 @@ public class MallInvoiceInfoQueryService extends AbstractMallBridgeSupport {
|
||||
dto.setSupplierId(supplierId);
|
||||
dto.setToken(MallBridgeCryptoUtil.generateSign(supplierId, supplier.getClientId(), timestamp));
|
||||
dto.setTimestamp(timestamp);
|
||||
dto.setQueryType("2");
|
||||
dto.setIdNumber(settlementId);
|
||||
dto.setQueryType(queryType);
|
||||
dto.setIdNumber(idNumber);
|
||||
dto.setFileIdList(fileIds);
|
||||
HashMap<String, Object> body = new HashMap<>();
|
||||
body.put("Address4", supplier.getSupplierApiUrl() + "/supplierOpenApi/pointOrder/queryFileBase64Info");
|
||||
@@ -64,8 +68,8 @@ public class MallInvoiceInfoQueryService extends AbstractMallBridgeSupport {
|
||||
String response = HttpUtil.createPost(apiUrl).contentType("application/json;charset=UTF-8")
|
||||
.body(JSONUtil.toJsonStr(body)).execute().body();
|
||||
JSONObject payload = MallBridgeResponseUtil.parse(response);
|
||||
if (payload.getInt("resultCode") != 0) {
|
||||
throw new IllegalArgumentException(StrUtil.blankToDefault(payload.getStr("message"), "获取发票文件失败"));
|
||||
if (payload.getInt("resultCode", -1) != 0) {
|
||||
throw new IllegalArgumentException(StrUtil.blankToDefault(payload.getStr("message"), "获取供应商文件失败"));
|
||||
}
|
||||
return JSONUtil.toBean(payload, MallPictureOutboundResult.class);
|
||||
}
|
||||
|
||||
+66
-1
@@ -2,33 +2,98 @@ package com.budwk.app.zhgh.pointsmall.order.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.io.FileTypeUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.sys.enums.SysFileEngineTypeEnum;
|
||||
import com.budwk.app.sys.services.SysFileService;
|
||||
import com.budwk.app.zhgh.pointsmall.mallbridge.dto.MallOrderEventDTO;
|
||||
import com.budwk.app.zhgh.pointsmall.mallbridge.dto.OrderInfoDTO;
|
||||
import com.budwk.app.zhgh.pointsmall.mallbridge.dto.OrderProInfoDTO;
|
||||
import com.budwk.app.zhgh.pointsmall.mallbridge.model.MallPictureOutboundResult;
|
||||
import com.budwk.app.zhgh.pointsmall.mallbridge.service.MallInvoiceInfoQueryService;
|
||||
import com.budwk.app.zhgh.pointsmall.order.enums.MallOrderStatusEnum;
|
||||
import com.budwk.app.zhgh.pointsmall.order.models.PointsMallOrderSub;
|
||||
import com.budwk.app.zhgh.pointsmall.order.models.PointsMallOrderSubHistory;
|
||||
import com.budwk.app.zhgh.pointsmall.order.result.SubOrderBuildResult;
|
||||
import com.budwk.app.zhgh.pointsmall.order.service.PointsMallOrderSubHistoryService;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.ioc.loader.annotation.Inject;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.util.Base64;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class PointsMallOrderSubHistoryServiceImpl extends BaseServiceImpl<PointsMallOrderSubHistory> implements PointsMallOrderSubHistoryService {
|
||||
|
||||
@Inject
|
||||
private MallInvoiceInfoQueryService mallInvoiceInfoQueryService;
|
||||
@Inject
|
||||
private SysFileService sysFileService;
|
||||
|
||||
public PointsMallOrderSubHistoryServiceImpl(Dao dao) {
|
||||
super(dao);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrderProInfoDTO> getPictureBase64(String supplierId, String orderId, String queryType, List<OrderProInfoDTO> orderProInfo) {
|
||||
return CollUtil.isEmpty(orderProInfo) ? Collections.emptyList() : orderProInfo;
|
||||
if (CollUtil.isEmpty(orderProInfo)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<String> fileIds = orderProInfo.stream().map(OrderProInfoDTO::getSku)
|
||||
.filter(StrUtil::isNotBlank).distinct().collect(Collectors.toList());
|
||||
if (fileIds.isEmpty()) {
|
||||
throw new IllegalArgumentException("商品SKU为空,无法获取商品图片");
|
||||
}
|
||||
try {
|
||||
// 供应商按子订单和 SKU 返回图片 Base64,订单只保存工会文件服务地址。
|
||||
MallPictureOutboundResult result = mallInvoiceInfoQueryService.queryFiles(supplierId, orderId, queryType, fileIds);
|
||||
Map<String, String> localUrls = new LinkedHashMap<>();
|
||||
for (OrderProInfoDTO product : orderProInfo) {
|
||||
String sku = product.getSku();
|
||||
if (StrUtil.isBlank(sku)) {
|
||||
throw new IllegalArgumentException("商品SKU为空,无法获取商品图片");
|
||||
}
|
||||
String localUrl = localUrls.get(sku);
|
||||
if (localUrl == null) {
|
||||
String base64 = result.getImageEncodeMap() == null ? null : result.getImageEncodeMap().get(sku);
|
||||
if (StrUtil.isBlank(base64)) {
|
||||
if (CollUtil.isEmpty(product.getPicInfo()) && StrUtil.isBlank(product.getFilePath()) && StrUtil.isBlank(product.getFileId())) {
|
||||
continue;
|
||||
}
|
||||
throw new IllegalArgumentException("未获取到商品图片Base64:" + sku);
|
||||
}
|
||||
if (base64.startsWith("data:")) {
|
||||
base64 = base64.substring(base64.indexOf(',') + 1);
|
||||
}
|
||||
byte[] bytes = Base64.getDecoder().decode(base64.replaceAll("\\s", ""));
|
||||
String fileType = FileTypeUtil.getType(new ByteArrayInputStream(bytes));
|
||||
if (bytes.length == 0 || fileType == null || !fileType.matches("(?i)jpg|jpeg|png|gif|bmp|webp")) {
|
||||
throw new IllegalArgumentException("商品图片内容为空或格式不支持:" + sku);
|
||||
}
|
||||
localUrl = sysFileService.uploadReturnUrl(SysFileEngineTypeEnum.MINIO.getValue(),
|
||||
"product-" + UUID.randomUUID() + "." + fileType.toLowerCase(java.util.Locale.ROOT), bytes);
|
||||
if (StrUtil.isBlank(localUrl)) {
|
||||
throw new IllegalArgumentException("商品图片上传失败:" + sku);
|
||||
}
|
||||
localUrls.put(sku, localUrl);
|
||||
}
|
||||
product.setPicInfo(Collections.singletonList(localUrl));
|
||||
product.setFilePath(localUrl);
|
||||
product.setFileId(localUrl);
|
||||
}
|
||||
return orderProInfo;
|
||||
} catch (Exception e) {
|
||||
throw new IllegalArgumentException("商品图片同步失败:" + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+8
-8
@@ -98,10 +98,10 @@ public class PointsMallReconciliationServiceImpl extends BaseServiceImpl<PointsM
|
||||
}
|
||||
Integer reconciliationType = reconciliationBO.getReconciliationType();
|
||||
|
||||
// 从浦发积分商城订单表查询对账订单
|
||||
// 从积分商城订单表查询对账订单
|
||||
List<PointsMallOrderSub> orderInfoList = dao().query(PointsMallOrderSub.class, reconciliationCnd(reconciliationBO, ""));
|
||||
if (CollUtil.isEmpty(orderInfoList)) {
|
||||
return Result.error("浦发积分商城没有查询到对账订单数据");
|
||||
return Result.error("积分商城没有查询到对账订单数据");
|
||||
}
|
||||
Set<String> orderIdList = orderInfoList.stream().map(PointsMallOrderSub::getOrderId).collect(Collectors.toSet());
|
||||
if (StrUtil.isNotBlank(reconciliationBO.getOrderId())
|
||||
@@ -159,7 +159,7 @@ public class PointsMallReconciliationServiceImpl extends BaseServiceImpl<PointsM
|
||||
}
|
||||
}
|
||||
|
||||
// 2.浦发积分商城已确认收货,对账接口未返回
|
||||
// 2.积分商城已确认收货,对账接口未返回
|
||||
List<PointsMallReconciliationRecord> reconciliationList2 = orderNotReturn(pfKeySet, supplierKeySet, pfOrderList);
|
||||
if (CollUtil.isNotEmpty(reconciliationList2)) {
|
||||
reconciliationList1.addAll(reconciliationList2);
|
||||
@@ -171,7 +171,7 @@ public class PointsMallReconciliationServiceImpl extends BaseServiceImpl<PointsM
|
||||
unReconciledMsgNoticeService.unReconciledMsgNotice(noticeDTO);
|
||||
}
|
||||
|
||||
// 3.浦发积分商城不存在此订单,无法对账
|
||||
// 3.积分商城不存在此订单,无法对账
|
||||
List<PointsMallReconciliationRecord> reconciliationList3 = orderNotExist(supplierKeySet, pfKeySet, supplierOrderList);
|
||||
if (CollUtil.isNotEmpty(reconciliationList3)) {
|
||||
reconciliationList1.addAll(reconciliationList3);
|
||||
@@ -361,7 +361,7 @@ public class PointsMallReconciliationServiceImpl extends BaseServiceImpl<PointsM
|
||||
}
|
||||
|
||||
/**
|
||||
* 浦发积分商城已确认收货,对账接口未返回
|
||||
* 积分商城已确认收货,对账接口未返回
|
||||
*
|
||||
* @param pfKeySet 浦发key
|
||||
* @param supplierKeySet 供应商key
|
||||
@@ -374,14 +374,14 @@ public class PointsMallReconciliationServiceImpl extends BaseServiceImpl<PointsM
|
||||
pfKeySet.stream().filter(key -> !supplierKeySet.contains(key)).forEach(key -> {
|
||||
List<PointsMallOrderSub> pfOrders = pfOrderList.get(key);
|
||||
if (CollUtil.isNotEmpty(pfOrders)) {
|
||||
reconciliationList.add(buildReconciliationRecord(null, pfOrders.get(0), 1, "浦发积分商城已确认收货,对账接口未返回"));
|
||||
reconciliationList.add(buildReconciliationRecord(null, pfOrders.get(0), 1, "积分商城已确认收货,对账接口未返回"));
|
||||
}
|
||||
});
|
||||
return reconciliationList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 浦发积分商城不存在此订单,无法对账
|
||||
* 积分商城不存在此订单,无法对账
|
||||
*
|
||||
* @param supplierKeySet 供应商key
|
||||
* @param pfKeySet 浦发key
|
||||
@@ -394,7 +394,7 @@ public class PointsMallReconciliationServiceImpl extends BaseServiceImpl<PointsM
|
||||
supplierKeySet.stream().filter(key -> !pfKeySet.contains(key)).forEach(key -> {
|
||||
List<OrderInfoByReconciliationDTO> supplierOrders = supplierOrderList.get(key);
|
||||
if (CollUtil.isNotEmpty(supplierOrders)) {
|
||||
reconciliationList.add(buildReconciliationRecord(supplierOrders.get(0), null, 2, "浦发积分商城不存在此订单,无法对账"));
|
||||
reconciliationList.add(buildReconciliationRecord(supplierOrders.get(0), null, 2, "积分商城不存在此订单,无法对账"));
|
||||
}
|
||||
});
|
||||
return reconciliationList;
|
||||
|
||||
+2
-2
@@ -5,13 +5,13 @@ import com.budwk.app.base.service.BaseService;
|
||||
import com.budwk.app.zhgh.pointsmall.reconciliationrecord.models.PointsMallReconciliationRecord;
|
||||
import com.budwk.app.zhgh.pointsmall.reconciliationrecord.param.PointsMallReconciliationRecordPageParam;
|
||||
import com.budwk.app.zhgh.pointsmall.supplier.models.PointsMallSupplier;
|
||||
import org.nutz.dao.entity.Record;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface PointsMallReconciliationRecordService extends BaseService<PointsMallReconciliationRecord> {
|
||||
|
||||
Pagination<Record> page(PointsMallReconciliationRecordPageParam param);
|
||||
Pagination<Map<String, Object>> page(PointsMallReconciliationRecordPageParam param);
|
||||
|
||||
List<PointsMallSupplier> listSuppliers();
|
||||
}
|
||||
|
||||
+24
-4
@@ -3,6 +3,7 @@ package com.budwk.app.zhgh.pointsmall.reconciliationrecord.service.impl;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.budwk.app.base.page.Pagination;
|
||||
import com.budwk.app.base.service.impl.BaseServiceImpl;
|
||||
import com.budwk.app.sys.models.Sys_user;
|
||||
import com.budwk.app.zhgh.pointsmall.reconciliationrecord.models.PointsMallReconciliationRecord;
|
||||
import com.budwk.app.zhgh.pointsmall.reconciliationrecord.param.PointsMallReconciliationRecordPageParam;
|
||||
import com.budwk.app.zhgh.pointsmall.reconciliationrecord.service.PointsMallReconciliationRecordService;
|
||||
@@ -10,11 +11,14 @@ import com.budwk.app.zhgh.pointsmall.supplier.models.PointsMallSupplier;
|
||||
import org.nutz.dao.Cnd;
|
||||
import org.nutz.dao.Dao;
|
||||
import org.nutz.dao.Sqls;
|
||||
import org.nutz.dao.entity.Record;
|
||||
import org.nutz.dao.sql.Sql;
|
||||
import org.nutz.ioc.loader.annotation.IocBean;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@IocBean(args = {"refer:dao"})
|
||||
public class PointsMallReconciliationRecordServiceImpl extends BaseServiceImpl<PointsMallReconciliationRecord> implements PointsMallReconciliationRecordService {
|
||||
@@ -24,7 +28,7 @@ public class PointsMallReconciliationRecordServiceImpl extends BaseServiceImpl<P
|
||||
}
|
||||
|
||||
@Override
|
||||
public Pagination<Record> page(PointsMallReconciliationRecordPageParam param) {
|
||||
public Pagination<Map<String, Object>> page(PointsMallReconciliationRecordPageParam param) {
|
||||
Cnd cnd = Cnd.where("r.delFlag", "=", false);
|
||||
if (StrUtil.isNotBlank(param.getSupplierId())) {
|
||||
cnd.and("r.supplierId", "=", param.getSupplierId());
|
||||
@@ -33,7 +37,12 @@ public class PointsMallReconciliationRecordServiceImpl extends BaseServiceImpl<P
|
||||
cnd.and("r.orderId", "=", param.getOrderId());
|
||||
}
|
||||
if (StrUtil.isNotBlank(param.getUserId())) {
|
||||
cnd.and("r.userId", "=", param.getUserId());
|
||||
List<Sys_user> users = dao().query(Sys_user.class, Cnd.where("loginname", "like", "%" + param.getUserId().trim() + "%")
|
||||
.and("delFlag", "=", false));
|
||||
if (users.isEmpty()) {
|
||||
return new Pagination<>(param.getPageNumber(), param.getPageSize(), 0, Collections.emptyList());
|
||||
}
|
||||
cnd.and("r.userId", "in", users.stream().map(Sys_user::getId).collect(Collectors.toList()));
|
||||
}
|
||||
if (param.getDiffType() != null) {
|
||||
cnd.and("r.diffType", "=", param.getDiffType());
|
||||
@@ -47,7 +56,18 @@ public class PointsMallReconciliationRecordServiceImpl extends BaseServiceImpl<P
|
||||
cnd.desc("r.batchNo").desc("r.createdAt");
|
||||
Sql sql = Sqls.create("select r.*, s.supplierName from points_mall_reconciliation_record r left join points_mall_supplier s on r.supplierId = s.supplierId and s.delFlag = 0 $condition");
|
||||
sql.setCondition(cnd);
|
||||
return listPageMap(param.getPageNumber(), param.getPageSize(), sql);
|
||||
Pagination<Map<String, Object>> page = listPageMap(param.getPageNumber(), param.getPageSize(), sql);
|
||||
if (page.getList() != null && !page.getList().isEmpty()) {
|
||||
List<String> userIds = page.getList().stream().map(record -> (String) record.get("userId"))
|
||||
.filter(StrUtil::isNotBlank).distinct().collect(Collectors.toList());
|
||||
Map<String, String> loginNames = new HashMap<>();
|
||||
if (!userIds.isEmpty()) {
|
||||
List<Sys_user> users = dao().query(Sys_user.class, Cnd.where("id", "in", userIds).and("delFlag", "=", false));
|
||||
users.forEach(user -> loginNames.put(user.getId(), user.getLoginname()));
|
||||
}
|
||||
page.getList().forEach(record -> record.put("loginname", loginNames.get(record.get("userId"))));
|
||||
}
|
||||
return page;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -50,22 +50,23 @@ layout("/layouts/platform.html"){
|
||||
|
||||
<el-dialog :close-on-click-modal="false" title="订单明细" :visible.sync="orderDialogVisible" top="5vh" width="90%">
|
||||
<el-table :data="orderList" border size="small" style="width: 100%" v-loading="orderLoading">
|
||||
<el-table-column :index="orderIndexMethod" align="center" label="序号" type="index" width="70"></el-table-column>
|
||||
<el-table-column align="center" label="订单ID" min-width="170" prop="orderId" show-overflow-tooltip></el-table-column>
|
||||
<el-table-column align="center" label="主订单号" min-width="170" prop="mainOrderId" show-overflow-tooltip></el-table-column>
|
||||
<el-table-column align="center" label="供应商" min-width="150" prop="supplierName" show-overflow-tooltip></el-table-column>
|
||||
<el-table-column align="center" label="用户ID" min-width="120" prop="userId" show-overflow-tooltip></el-table-column>
|
||||
<el-table-column align="center" label="完成时间" min-width="160" prop="orderCompleteTime"></el-table-column>
|
||||
<el-table-column align="center" label="订单总金额" min-width="110" prop="totalPrice"></el-table-column>
|
||||
<el-table-column align="center" label="实际消耗积分" min-width="110">
|
||||
<template slot-scope="{row}">{{ (Number(row.pointsPrice || 0) - Number(row.refund || 0)).toFixed(2) }}</template>
|
||||
<el-table-column align="center" label="订单状态" min-width="110">
|
||||
<template slot-scope="{row}">
|
||||
<el-tag :type="orderStatusType(row.orderState)" size="mini">{{ orderStateName(row.orderState) }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="退款积分" min-width="110" prop="refund"></el-table-column>
|
||||
<el-table-column align="center" label="开票状态" min-width="100">
|
||||
<el-table-column align="center" label="发票状态" min-width="100">
|
||||
<template slot-scope="{row}">
|
||||
<el-tag :type="invoiceStatusType(row.invoiceStatus)" size="mini">{{ invoiceStatusName(row.invoiceStatus) }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="完成时间" min-width="160" prop="orderCompleteTime"></el-table-column>
|
||||
<el-table-column align="center" label="实际消耗积分" min-width="110">
|
||||
<template slot-scope="{row}">{{ (Number(row.pointsPrice || 0) - Number(row.refund || 0)).toFixed(2) }}</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-pagination
|
||||
:current-page="orderForm.pageNumber"
|
||||
@@ -380,6 +381,14 @@ layout("/layouts/platform.html"){
|
||||
invoiceResultType(value) {
|
||||
return value == null ? "warning" : Number(value) === 0 ? "success" : "danger"
|
||||
},
|
||||
orderStateName(value) {
|
||||
const map = { 0: "待付款", 1: "已支付", 2: "进行中", 3: "已取消", 4: "已签收", 5: "已完成", 6: "换货", 7: "退货", 8: "已废除" }
|
||||
return map[value] || "-"
|
||||
},
|
||||
orderStatusType(value) {
|
||||
const map = { 0: "info", 1: "primary", 2: "warning", 3: "danger", 4: "primary", 5: "success", 6: "warning", 7: "danger", 8: "info" }
|
||||
return map[value] || "info"
|
||||
},
|
||||
invoiceStatusName(value) {
|
||||
const map = { 0: "未开票", 1: "已开票", 2: "开票中" }
|
||||
return map[value] || "-"
|
||||
|
||||
@@ -129,6 +129,8 @@ layout("/layouts/platform.html"){
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog :close-on-click-modal="false" title="开票申请" :visible.sync="applyDialogVisible" top="5vh" width="720px">
|
||||
<el-alert :closable="false" show-icon type="info" style="margin-bottom: 16px"
|
||||
:title="applySelectionCount ? '本次仅为已勾选的 ' + applySelectionCount + ' 笔订单申请开票。' : '未勾选订单,本次将为当前查询条件下的全部可开票订单申请开票(包含其他分页)。'"></el-alert>
|
||||
<el-form ref="applyFormRef" :model="applyForm" :rules="applyRules" label-width="120px" size="small">
|
||||
<el-form-item label="开票日期" prop="invoiceDate">
|
||||
<el-date-picker placeholder="请选择开票日期" style="width: 100%" type="date" value-format="yyyy-MM-dd" v-model="applyForm.invoiceDate"></el-date-picker>
|
||||
@@ -274,6 +276,8 @@ layout("/layouts/platform.html"){
|
||||
},
|
||||
applyDialogVisible: false,
|
||||
applyLoading: false,
|
||||
applyScope: {},
|
||||
applySelectionCount: 0,
|
||||
applyForm: {
|
||||
invoiceDate: [new Date().getFullYear(), String(new Date().getMonth() + 1).padStart(2, "0"), String(new Date().getDate()).padStart(2, "0")].join("-"),
|
||||
invoiceTitle: "测试工会(开发测试)",
|
||||
@@ -478,13 +482,24 @@ layout("/layouts/platform.html"){
|
||||
}
|
||||
},
|
||||
openApplyDialog() {
|
||||
if (!this.pageForm.supplierId || !this.pageForm.startDate || !this.pageForm.endDate) {
|
||||
if (this.tableLoading || !this.lastQuery) {
|
||||
this.notifyWarning("请先查询订单列表")
|
||||
return
|
||||
}
|
||||
if (!this.selections.length) {
|
||||
this.notifyWarning("请先勾选需要开票的订单")
|
||||
const query = this.lastQuery
|
||||
if (!query.supplierId || !query.startDate || !query.endDate || query.reconciliationStatus !== 1 || query.invoiceStatus !== 0) {
|
||||
this.notifyWarning("请查询对账成功且未开票的订单")
|
||||
return
|
||||
}
|
||||
this.applySelectionCount = this.selections.length
|
||||
this.applyScope = {
|
||||
supplierId: query.supplierId,
|
||||
startDate: query.startDate,
|
||||
endDate: query.endDate,
|
||||
queryOrderId: query.orderId,
|
||||
userId: query.userId,
|
||||
orderIds: this.selections.map(item => item.orderId).join(",") || null
|
||||
}
|
||||
this.applyForm = {
|
||||
invoiceDate: [new Date().getFullYear(), String(new Date().getMonth() + 1).padStart(2, "0"), String(new Date().getDate()).padStart(2, "0")].join("-"),
|
||||
invoiceTitle: "测试工会(开发测试)",
|
||||
@@ -497,17 +512,12 @@ layout("/layouts/platform.html"){
|
||||
},
|
||||
submitApply() {
|
||||
this.$refs.applyFormRef.validate(async (valid) => {
|
||||
if (!valid) {
|
||||
if (!valid || this.applyLoading) {
|
||||
return
|
||||
}
|
||||
this.applyLoading = true
|
||||
try {
|
||||
const params = Object.assign({}, this.applyForm, {
|
||||
supplierId: this.pageForm.supplierId,
|
||||
startDate: this.pageForm.startDate,
|
||||
endDate: this.pageForm.endDate,
|
||||
orderIds: this.selections.map((item) => item.orderId).join(",")
|
||||
})
|
||||
const params = Object.assign({}, this.applyForm, this.applyScope)
|
||||
const resp = await this.$axios.post("/platform/zhgh/points-mall/invoice/applyInvoice", params)
|
||||
if (resp.code === 0) {
|
||||
this.notifySuccess(resp.data || "开票申请成功")
|
||||
|
||||
@@ -13,25 +13,6 @@ layout("/layouts/platform.html"){
|
||||
<search-item label="订单ID">
|
||||
<el-input clearable placeholder="请输入订单ID" v-model="pageForm.orderId"></el-input>
|
||||
</search-item>
|
||||
<search-item label="用户ID">
|
||||
<el-input clearable placeholder="请输入用户ID" v-model="pageForm.userId"></el-input>
|
||||
</search-item>
|
||||
<search-item label="批次号">
|
||||
<el-input clearable placeholder="请输入对账批次号" v-model="pageForm.batchNo"></el-input>
|
||||
</search-item>
|
||||
<search-item label="差异类型">
|
||||
<el-select clearable placeholder="请选择差异类型" style="width: 100%" v-model="pageForm.diffType">
|
||||
<el-option label="一致" :value="0"></el-option>
|
||||
<el-option label="异常" :value="1"></el-option>
|
||||
</el-select>
|
||||
</search-item>
|
||||
<search-item label="通知状态">
|
||||
<el-select clearable placeholder="请选择通知状态" style="width: 100%" v-model="pageForm.noticeStatus">
|
||||
<el-option label="未推送" :value="0"></el-option>
|
||||
<el-option label="推送成功" :value="1"></el-option>
|
||||
<el-option label="推送失败" :value="2"></el-option>
|
||||
</el-select>
|
||||
</search-item>
|
||||
</search>
|
||||
</el-card>
|
||||
|
||||
@@ -39,11 +20,10 @@ layout("/layouts/platform.html"){
|
||||
<table-tool label="对账记录"></table-tool>
|
||||
<el-table :data="tableData" border class="vi-table" size="small" style="width: 100%" v-loading="tableLoading">
|
||||
<el-table-column :index="indexMethod" align="center" label="序号" type="index" width="70"></el-table-column>
|
||||
<el-table-column align="center" label="批次号" min-width="170" prop="batchNo" show-overflow-tooltip></el-table-column>
|
||||
<el-table-column align="center" label="订单ID" min-width="170" prop="orderId" show-overflow-tooltip></el-table-column>
|
||||
<el-table-column align="center" label="供应商" min-width="150" prop="supplierName" show-overflow-tooltip></el-table-column>
|
||||
<el-table-column align="center" label="供应商编码" min-width="130" prop="supplierId" show-overflow-tooltip></el-table-column>
|
||||
<el-table-column align="center" label="用户ID" min-width="120" prop="userId" show-overflow-tooltip></el-table-column>
|
||||
<el-table-column align="center" label="用户工号" min-width="120" prop="loginname" show-overflow-tooltip></el-table-column>
|
||||
<el-table-column align="center" label="订单总金额(平台)" min-width="140" prop="pTotalPrice"></el-table-column>
|
||||
<el-table-column align="center" label="现金金额(平台)" min-width="130" prop="pCashAmount"></el-table-column>
|
||||
<el-table-column align="center" label="积分金额(平台)" min-width="130" prop="pPointsPrice"></el-table-column>
|
||||
@@ -57,18 +37,7 @@ layout("/layouts/platform.html"){
|
||||
<el-tag :type="diffTypeTag(row.diffType)" size="mini">{{ diffTypeName(row.diffType) }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="通知状态" min-width="110">
|
||||
<template slot-scope="{row}">
|
||||
<el-tag :type="noticeStatusTag(row.noticeStatus)" size="mini">{{ noticeStatusName(row.noticeStatus) }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="推送次数" min-width="90" prop="pushTime"></el-table-column>
|
||||
<el-table-column align="center" label="差异原因" min-width="240" prop="diffReason" show-overflow-tooltip></el-table-column>
|
||||
<el-table-column align="center" fixed="right" label="操作" width="90">
|
||||
<template slot-scope="{row}">
|
||||
<el-button @click="openDetail(row)" size="mini" type="primary">查看</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-pagination
|
||||
:current-page="pageForm.pageNumber"
|
||||
@@ -87,7 +56,7 @@ layout("/layouts/platform.html"){
|
||||
<el-descriptions-item label="批次号">{{ currentRecord.batchNo || "-" }}</el-descriptions-item>
|
||||
<el-descriptions-item label="订单ID">{{ currentRecord.orderId || "-" }}</el-descriptions-item>
|
||||
<el-descriptions-item label="供应商">{{ currentRecord.supplierName || currentRecord.supplierId || "-" }}</el-descriptions-item>
|
||||
<el-descriptions-item label="用户ID">{{ currentRecord.userId || "-" }}</el-descriptions-item>
|
||||
<el-descriptions-item label="用户工号">{{ currentRecord.loginname || "-" }}</el-descriptions-item>
|
||||
<el-descriptions-item label="平台总金额">{{ currentRecord.pTotalPrice || "0" }}</el-descriptions-item>
|
||||
<el-descriptions-item label="对账总金额">{{ currentRecord.sTotalPrice || "0" }}</el-descriptions-item>
|
||||
<el-descriptions-item label="平台现金金额">{{ currentRecord.pCashAmount || "0" }}</el-descriptions-item>
|
||||
@@ -121,11 +90,7 @@ layout("/layouts/platform.html"){
|
||||
pageSize: 10,
|
||||
totalCount: 0,
|
||||
supplierId: null,
|
||||
orderId: null,
|
||||
userId: null,
|
||||
diffType: null,
|
||||
batchNo: null,
|
||||
noticeStatus: null
|
||||
orderId: null
|
||||
},
|
||||
detailDialogVisible: false,
|
||||
currentRecord: null
|
||||
|
||||
Reference in New Issue
Block a user