11 Commits

Author SHA1 Message Date
wuweihua dfa90d6e33 Merge branch 'master' of D:\wuweihua\BMS with conflicts. 2026-10-27 16:25:11 +08:00
wuweihua 4a34075022 Merge branch 'test' of https://git.lionquexpress.com/wuweihua/BMS
# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.
2026-10-27 16:24:36 +08:00
wuweihua b55f0010ed 新增订单状态字段并调整提货时间字段,更新相关导出和展示逻辑 2026-10-27 16:23:02 +08:00
caojia 4067bfc277 ✨ 客户余额页增加只读账单弹窗 2026-10-27 16:19:44 +08:00
caojia fe30345045 Revert "✨ 应收账单接入角色数据权限并同步在线缓存"
This reverts commit 4659c63ef9.
2026-10-27 15:32:26 +08:00
wuweihua 4d4065b9e9 更新计费失败状态,新增销售价和产品价未匹配的错误信息,调整相关代码逻辑以支持新的状态处理。 2026-10-27 15:24:16 +08:00
liuminghui 0ba975656b 客户和供应商新增合同时间 2026-10-27 13:50:54 +08:00
liuminghui 65d382d256 Merge remote-tracking branch 'origin/test' into test 2026-10-27 13:36:11 +08:00
wuweihua 7fcd3b6089 计费列表增加状态搜索 2026-10-27 13:28:14 +08:00
liuminghui 7e53b41a3c 新增供应商类型配置 2026-10-27 11:40:22 +08:00
caojia 4659c63ef9 ✨ 应收账单接入角色数据权限并同步在线缓存 2026-10-27 11:32:26 +08:00
45 changed files with 1586 additions and 111 deletions
@@ -11,8 +11,11 @@ import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.bms.ar.domain.ArBill;
import com.bms.ar.domain.ArBalanceWriteoff;
import com.bms.ar.domain.vo.ArBillQuery;
import com.bms.ar.service.IArBalanceWriteoffService;
import com.bms.ar.service.IArBillService;
import com.bms.common.annotation.Log;
import com.bms.common.core.controller.BaseController;
import com.bms.common.core.domain.AjaxResult;
@@ -20,7 +23,7 @@ import com.bms.common.core.page.TableDataInfo;
import com.bms.common.enums.BusinessType;
/**
* 客户余额核销应收账单 Controller(账单查看统一走应收管理-应收账单页面)
* 客户余额账单查询与核销 Controller
*
* @author bms
* @date 2026-09-16
@@ -32,6 +35,27 @@ public class CustomerBillController extends BaseController
@Autowired
private IArBalanceWriteoffService balanceWriteoffService;
@Autowired
private IArBillService billService;
/**
* 查询指定客户的应收账单(分页)。客户ID来自路径并覆盖查询对象中的同名参数。
*/
@PreAuthorize("@ss.hasPermi('customersupplier:customerinfo:list')")
@GetMapping("/list/{customerId}")
public TableDataInfo billList(@PathVariable("customerId") Long customerId, ArBillQuery query)
{
if (customerId == null || customerId <= 0L)
{
return getDataTable(Collections.emptyList());
}
ArBillQuery billQuery = query == null ? new ArBillQuery() : query;
billQuery.setCustomerId(customerId);
startPage();
List<ArBill> list = billService.selectArBillList(billQuery);
return getDataTable(list);
}
/**
* 查询客户可核销账单(已确认/部分核销,未核销额大于0)
*/
@@ -0,0 +1,117 @@
package com.bms.web.controller.data;
import java.util.List;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.bms.common.annotation.Log;
import com.bms.common.core.controller.BaseController;
import com.bms.common.core.domain.AjaxResult;
import com.bms.common.core.page.TableDataInfo;
import com.bms.common.enums.BusinessType;
import com.bms.common.utils.poi.ExcelUtil;
import com.bms.system.domain.BmsSupplierType;
import com.bms.system.service.IBmsSupplierTypeService;
/**
* 数据管理:供应商类型
*
* @author bms
*/
@RestController
@RequestMapping("/data/supplierType")
public class BmsSupplierTypeController extends BaseController
{
@Autowired
private IBmsSupplierTypeService supplierTypeService;
/**
* 分页查询。名称模糊、状态精确。
*/
@PreAuthorize("@ss.hasPermi('data:supplierType:list')")
@GetMapping("/list")
public TableDataInfo list(BmsSupplierType query)
{
startPage();
List<BmsSupplierType> list = supplierTypeService.selectList(query);
return getDataTable(list);
}
/**
* 按当前查询条件导出
*/
@Log(title = "供应商类型", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('data:supplierType:export')")
@PostMapping("/export")
public void export(HttpServletResponse response, BmsSupplierType query)
{
List<BmsSupplierType> list = supplierTypeService.selectList(query);
ExcelUtil<BmsSupplierType> util = new ExcelUtil<BmsSupplierType>(BmsSupplierType.class);
util.exportExcel(response, list, "供应商类型");
}
/**
* 查询详情
*/
@PreAuthorize("@ss.hasPermi('data:supplierType:query')")
@GetMapping("/{typeId}")
public AjaxResult getInfo(@PathVariable Long typeId)
{
return success(supplierTypeService.selectById(typeId));
}
/**
* 新增
*/
@PreAuthorize("@ss.hasPermi('data:supplierType:add')")
@Log(title = "供应商类型", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody BmsSupplierType row)
{
row.setCreateBy(getUsername());
return toAjax(supplierTypeService.insert(row));
}
/**
* 修改
*/
@PreAuthorize("@ss.hasPermi('data:supplierType:edit')")
@Log(title = "供应商类型", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody BmsSupplierType row)
{
row.setUpdateBy(getUsername());
return toAjax(supplierTypeService.update(row));
}
/**
* 启用或停用
*/
@PreAuthorize("@ss.hasPermi('data:supplierType:changeStatus')")
@Log(title = "供应商类型", businessType = BusinessType.UPDATE)
@PutMapping("/changeStatus")
public AjaxResult changeStatus(@RequestBody BmsSupplierType row)
{
row.setUpdateBy(getUsername());
return toAjax(supplierTypeService.changeStatus(row));
}
/**
* 删除
*/
@PreAuthorize("@ss.hasPermi('data:supplierType:remove')")
@Log(title = "供应商类型", businessType = BusinessType.DELETE)
@DeleteMapping("/{typeIds}")
public AjaxResult remove(@PathVariable Long[] typeIds)
{
return toAjax(supplierTypeService.deleteByIds(typeIds));
}
}
@@ -195,7 +195,10 @@ public class BillingController extends BaseController
private static List<Integer> limitBillingListFailStatus(List<Integer> requested)
{
List<Integer> allowed = Arrays.asList(Integer.valueOf(0), Integer.valueOf(1), Integer.valueOf(2), Integer.valueOf(3));
// Soft-fail list: success + sales 1/2/3 + product-catalog 23/24/25
List<Integer> allowed = Arrays.asList(
Integer.valueOf(0), Integer.valueOf(1), Integer.valueOf(2), Integer.valueOf(3),
Integer.valueOf(23), Integer.valueOf(24), Integer.valueOf(25));
if (requested == null || requested.isEmpty())
{
return new ArrayList<Integer>(allowed);
@@ -216,9 +216,12 @@ price.set.detail.duplicate.fixed=产品{0} 国家{1} 重量段{2} {3}(共{4}
price.set.detail.duplicate.discount=产品{0}(共{1}条)
price.set.detail.duplicate.hasZone=有分区({0})
price.set.detail.duplicate.noZone=无分区
price.bill.billingFail.product=计费失败:未匹配产品
price.bill.billingFail.country=计费失败:未匹配国家
price.bill.billingFail.weight=计费失败:未匹配重量段
price.bill.billingFail.product=计费失败:销售价未匹配产品
price.bill.billingFail.country=计费失败:销售价未匹配国家
price.bill.billingFail.weight=计费失败:销售价未匹配重量段
price.bill.billingFail.catalogProduct=计费失败:产品价未匹配产品
price.bill.billingFail.catalogCountry=计费失败:产品价未匹配国家
price.bill.billingFail.catalogWeight=计费失败:产品价未匹配重量段
price.bill.export.filterRequired=请先设置列表查询条件后再导出
price.bill.export.taskNotExists=导出任务不存在或已过期
price.bill.export.tooMany=匹配订单超过上限 {0} 条,请缩小筛选范围
@@ -1688,9 +1688,12 @@ public class ArBillServiceImpl implements IArBillService {
}
return switch (status) {
case SUCCESS -> "";
case PRODUCT -> "未匹配产品";
case COUNTRY -> "未匹配国家";
case WEIGHT -> "未匹配重量段";
case PRODUCT -> "销售价未匹配产品";
case COUNTRY -> "销售价未匹配国家";
case WEIGHT -> "销售价未匹配重量段";
case CATALOG_PRODUCT -> "产品价未匹配产品";
case CATALOG_COUNTRY -> "产品价未匹配国家";
case CATALOG_WEIGHT -> "产品价未匹配重量段";
case NO_CUSTOMER_PACKAGE -> "未绑定套餐";
case NO_ACTIVE_PACKAGE_VERSION -> "无生效套餐版本";
case ALREADY_IN_AR_BILL -> "已生成应收账单";
@@ -3,8 +3,10 @@ package com.bms.customer.customerinfo.domain;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
@@ -112,6 +114,16 @@ public class BmsCustomer extends BaseEntity
@Excel(name = "信用额度", readConverterExp = "元=")
private BigDecimal creditEd;
/** 合同开始时间 */
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@Excel(name = "合同开始时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date contractStartDate;
/** 合同结束时间 */
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@Excel(name = "合同结束时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date contractEndDate;
/** 绑定产品代码(多个产品代码用逗号分隔;旧库导入产品ID不稳定,统一用代码对接) */
@Excel(name = "绑定产品代码")
private String productCodes;
@@ -88,6 +88,8 @@ public class BmsCustomerLogServiceImpl implements IBmsCustomerLogService
new FieldDef("weightThreshold", "重量阈值(kg)", BmsCustomer::getWeightThreshold, false, BmsCustomerLogServiceImpl::numText),
new FieldDef("throwRatio", "抛比(%)", BmsCustomer::getThrowRatio, false, BmsCustomerLogServiceImpl::numText),
new FieldDef("productCodes", "绑定产品", BmsCustomer::getProductCodes, false, Function.identity()),
new FieldDef("contractStartDate", "合同开始时间", c -> contractDateText(c.getContractStartDate()), false, Function.identity()),
new FieldDef("contractEndDate", "合同结束时间", c -> contractDateText(c.getContractEndDate()), false, Function.identity()),
new FieldDef("remark", "备注", BmsCustomer::getRemark, false, Function.identity()));
/** 公司主体需记录的字段(顺序即展示顺序) */
@@ -196,7 +198,8 @@ public class BmsCustomerLogServiceImpl implements IBmsCustomerLogService
{
// 与 update SQL 的动态条件保持一致:未提交(null/空串)的字段本次不落库,不参与比对
Object raw = def.rawGetter.apply(newCustomer);
if (raw == null)
// 合同起止允许清空;其余动态字段未提交时不落库,也不记日志
if (raw == null && !isContractDateField(def.field))
{
continue;
}
@@ -614,6 +617,17 @@ public class BmsCustomerLogServiceImpl implements IBmsCustomerLogService
return date == null ? "" : DATE_FMT.get().format(date);
}
/** 合同日期日志原值:空日期返回 null,便于清空时仍参与比对 */
private static Object contractDateText(Date date)
{
return date == null ? null : dateText(date);
}
private static boolean isContractDateField(String field)
{
return "contractStartDate".equals(field) || "contractEndDate".equals(field);
}
private static String dateTextOrLong(Date date)
{
return date == null ? "长期" : DATE_FMT.get().format(date);
@@ -1,9 +1,11 @@
package com.bms.customer.customerinfo.service.impl;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.bms.common.annotation.DataScope;
import com.bms.common.exception.ServiceException;
import com.bms.common.core.domain.entity.SysUser;
import com.bms.common.utils.DateUtils;
import com.bms.common.utils.SecurityUtils;
@@ -272,6 +274,7 @@ public class BmsCustomerServiceImpl implements IBmsCustomerService
@Override
public int insertBmsCustomer(BmsCustomer bmsCustomer)
{
checkContractDate(bmsCustomer.getContractStartDate(), bmsCustomer.getContractEndDate());
SysUser user = SecurityUtils.getLoginUser().getUser();
bmsCustomer.setCreateTime(DateUtils.getNowDate());
bmsCustomer.setCreateBy(user.getUserName());
@@ -299,6 +302,7 @@ public class BmsCustomerServiceImpl implements IBmsCustomerService
@Override
public int updateBmsCustomer(BmsCustomer bmsCustomer)
{
checkContractDate(bmsCustomer.getContractStartDate(), bmsCustomer.getContractEndDate());
SysUser user = SecurityUtils.getLoginUser().getUser();
bmsCustomer.setUpdateTime(DateUtils.getNowDate());
bmsCustomer.setUpdateBy(user.getUserName());
@@ -505,4 +509,13 @@ public class BmsCustomerServiceImpl implements IBmsCustomerService
}
}
}
/** 合同结束时间不能早于开始时间 */
private void checkContractDate(Date start, Date end)
{
if (start != null && end != null && end.before(start))
{
throw new ServiceException("合同结束时间不能早于开始时间");
}
}
}
@@ -127,6 +127,16 @@ public class BmsSupplier extends BaseEntity
@Excel(name = "合作开始日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date cooperationStartDate;
/** 合同开始时间 */
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@Excel(name = "合同开始时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date contractStartDate;
/** 合同结束时间 */
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@Excel(name = "合同结束时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date contractEndDate;
/** 合作状态(0正常 1暂停 2终止) */
@Excel(name = "合作状态", readConverterExp = "0=正常,1=暂停,2=终止")
private String cooperationStatus;
@@ -1,8 +1,10 @@
package com.bms.customer.supplierinfo.service.impl;
import java.util.Date;
import java.util.List;
import com.bms.common.annotation.DataScope;
import com.bms.common.exception.ServiceException;
import com.bms.common.core.domain.entity.SysUser;
import com.bms.common.utils.DateUtils;
import com.bms.common.utils.SecurityUtils;
@@ -250,6 +252,7 @@ public class BmsSupplierServiceImpl implements IBmsSupplierService
@Override
public int insertBmsSupplier(BmsSupplier bmsSupplier)
{
checkContractDate(bmsSupplier.getContractStartDate(), bmsSupplier.getContractEndDate());
SysUser user = SecurityUtils.getLoginUser().getUser();
bmsSupplier.setCreateTime(DateUtils.getNowDate());
bmsSupplier.setCreateBy(user.getUserName());
@@ -267,6 +270,7 @@ public class BmsSupplierServiceImpl implements IBmsSupplierService
@Override
public int updateBmsSupplier(BmsSupplier bmsSupplier)
{
checkContractDate(bmsSupplier.getContractStartDate(), bmsSupplier.getContractEndDate());
SysUser user = SecurityUtils.getLoginUser().getUser();
bmsSupplier.setUpdateTime(DateUtils.getNowDate());
bmsSupplier.setUpdateBy(user.getUserName());
@@ -309,4 +313,13 @@ public class BmsSupplierServiceImpl implements IBmsSupplierService
bmsSupplierMapper.deleteBmsSupplierContactBySupplierId(supplierId);
return bmsSupplierMapper.deleteBmsSupplierBySupplierId(supplierId);
}
/** 合同结束时间不能早于开始时间 */
private void checkContractDate(Date start, Date end)
{
if (start != null && end != null && end.before(start))
{
throw new ServiceException("合同结束时间不能早于开始时间");
}
}
}
@@ -122,7 +122,7 @@ public class PrcOrderBill extends BaseEntity
private String creditArrearsStatus;
/** NONE / REFUNDED */
private String refundStatus;
/** 计费失败状态:0成功/1未匹配产品/2未匹配国家/3未匹配重量段;软失败时金额为0且不落费用明细 */
/** Billing fail: 0 ok; 1/2/3 sales miss; 23/24/25 catalog miss; soft-fail amount=0, no fee rows */
private Integer billingFailStatus;
/** 失败原因 */
private String errorMessage;
@@ -31,6 +31,8 @@ public class BatchAddIncomeBillFeeRequest implements Serializable
private List<String> productCodes;
private String countryCode;
private String creditArrearsStatus;
/** Same as list filter order_status IN (...). */
private List<Integer> orderStatuses;
/** Same as list filter billing_fail_status IN (...). */
private List<Integer> billingFailStatuses;
@@ -21,6 +21,8 @@ public class ChargeWeightTemplateRequest implements Serializable
private List<String> customerCodes;
private List<String> productCodes;
private String creditArrearsStatus;
/** Same as list filter order_status IN (...). */
private List<Integer> orderStatuses;
private String beginBizDate;
private String endBizDate;
}
@@ -45,6 +45,8 @@ public class PrcBillingBillListExportRow implements Serializable
private BigDecimal payTotal;
@Excel(name = "计价来源", width = 16)
private String matchSourceLabel;
@Excel(name = "订单状态", width = 12)
private String orderStatusLabel;
@Excel(name = "计费状态", width = 14)
private String billingFailStatusLabel;
@Excel(name = "客户状态", width = 12)
@@ -54,9 +56,9 @@ public class PrcBillingBillListExportRow implements Serializable
@Excel(name = "计费时间", width = 20, dateFormat = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date bizDate;
@Excel(name = "下单时间", width = 20, dateFormat = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "提货时间", width = 20, dateFormat = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date orderTime;
private Date pickupDate;
@Excel(name = "销售员", width = 12)
private String belongSaler;
@Excel(name = "结算员", width = 12)
@@ -25,6 +25,8 @@ public class RecalcBillPriceRequest implements Serializable
private List<String> productCodes;
private String countryCode;
private String creditArrearsStatus;
/** Same as list filter order_status IN (...). */
private List<Integer> orderStatuses;
/** Same as list filter billing_fail_status IN (...). */
private List<Integer> billingFailStatuses;
private String beginBizDate;
@@ -103,7 +103,7 @@ public class TmsPriceQuoteResult implements Serializable
private String creditArrearsStatus;
/** NONE / REFUNDED */
private String refundStatus;
/** 计费失败状态:0成功/1未匹配产品/2未匹配国家/3未匹配重量段(仅上游同步计费软失败) */
/** Billing fail: 0 ok; 1/2/3 sales; 23/24/25 catalog (soft-fail on bill sync) */
private Integer billingFailStatus;
private Integer pieces;
private BigDecimal actualWeight;
@@ -1,10 +1,12 @@
package com.bms.price.enums;
/**
* prc_order_bill.billing_fail_status 计费失败状态(数字)。
* 0成功;1未匹配产品;2未匹配国家;3未匹配重量段。
* 4 起与 prc_billing_task.fail_code 一一对应。
* 仅 0/1/2/3 写入 prc_income_bill;仅 0 写入 prc_income_bill_fee。
* prc_order_bill.billing_fail_status numeric codes.
* 0 success;
* 1/2/3 sales-price (package) miss: product / country / weight;
* 23/24/25 product-catalog price miss: product / country / weight;
* 4+ map to prc_billing_task.fail_code.
* Soft-fail income bill: 0/1/2/3/23/24/25; fee rows only for 0.
*/
public enum BillBillingFailStatus
{
@@ -30,7 +32,13 @@ public enum BillBillingFailStatus
CUSTOMER_CODE_REQUIRED(19),
CUSTOMER_DISABLED(20),
FREIGHT_MISSING(21),
UNKNOWN(22);
UNKNOWN(22),
/** Product catalog (产品价) miss: no product rows. */
CATALOG_PRODUCT(23),
/** Product catalog miss: product hit but country/zone miss. */
CATALOG_COUNTRY(24),
/** Product catalog miss: product+country hit but weight band miss. */
CATALOG_WEIGHT(25);
private final int code;
@@ -65,11 +73,13 @@ public enum BillBillingFailStatus
return code != null && code.intValue() > SUCCESS.code;
}
/** 0/1/2/3 才落 prc_income_bill。 */
/** Soft-fail sales/catalog misses also persist prc_income_bill. */
public static boolean storesIncomeBill(Integer code)
{
int value = code == null ? SUCCESS.code : code.intValue();
return value == SUCCESS.code || value == PRODUCT.code || value == COUNTRY.code || value == WEIGHT.code;
return value == SUCCESS.code
|| value == PRODUCT.code || value == COUNTRY.code || value == WEIGHT.code
|| value == CATALOG_PRODUCT.code || value == CATALOG_COUNTRY.code || value == CATALOG_WEIGHT.code;
}
/** 仅 0 落 prc_income_bill_fee。 */
@@ -110,6 +120,12 @@ public enum BillBillingFailStatus
return BillTaskFailCode.COUNTRY_NOT_HIT.getCode();
case WEIGHT:
return BillTaskFailCode.WEIGHT_NOT_HIT.getCode();
case CATALOG_PRODUCT:
return BillTaskFailCode.CATALOG_PRODUCT_NOT_HIT.getCode();
case CATALOG_COUNTRY:
return BillTaskFailCode.CATALOG_COUNTRY_NOT_HIT.getCode();
case CATALOG_WEIGHT:
return BillTaskFailCode.CATALOG_WEIGHT_NOT_HIT.getCode();
case NO_CUSTOMER_PACKAGE:
return BillTaskFailCode.NO_CUSTOMER_PACKAGE.getCode();
case NO_ACTIVE_PACKAGE_VERSION:
@@ -12,12 +12,18 @@ public enum BillTaskFailCode
NO_ACTIVE_PACKAGE_VERSION("NO_ACTIVE_PACKAGE_VERSION"),
ALREADY_IN_AR_BILL("ALREADY_IN_AR_BILL"),
PRODUCT_ARCHIVE_MISSING("PRODUCT_ARCHIVE_MISSING"),
/** Soft-fail: product not in package (incl. after product_code_mapping). */
/** Soft-fail: sales price (package) product miss. */
PRODUCT_NOT_HIT("PRODUCT_NOT_HIT"),
/** Soft-fail: product hit but country/zone miss. */
/** Soft-fail: sales price country/zone miss. */
COUNTRY_NOT_HIT("COUNTRY_NOT_HIT"),
/** Soft-fail: product+country hit but weight band miss. */
/** Soft-fail: sales price weight band miss. */
WEIGHT_NOT_HIT("WEIGHT_NOT_HIT"),
/** Soft-fail: product catalog (产品价) product miss. */
CATALOG_PRODUCT_NOT_HIT("CATALOG_PRODUCT_NOT_HIT"),
/** Soft-fail: product catalog country/zone miss. */
CATALOG_COUNTRY_NOT_HIT("CATALOG_COUNTRY_NOT_HIT"),
/** Soft-fail: product catalog weight band miss. */
CATALOG_WEIGHT_NOT_HIT("CATALOG_WEIGHT_NOT_HIT"),
PRICE_NOT_HIT("PRICE_NOT_HIT"),
ZONE_PRICE_NOT_HIT("ZONE_PRICE_NOT_HIT"),
POSTCODE_REQUIRED("POSTCODE_REQUIRED"),
@@ -72,16 +78,29 @@ public enum BillTaskFailCode
{
return PRODUCT_ARCHIVE_MISSING.code;
}
// Soft-fail messages from price.bill.billingFail.* (order matters: weight/country before generic)
if (containsAny(msg, "未匹配重量段", "WEIGHT_NOT_HIT", "billingFail.weight"))
// Soft-fail: product catalog before sales (more specific Chinese prefix)
if (containsAny(msg, "产品价未匹配重量段", "CATALOG_WEIGHT_NOT_HIT", "billingFail.catalogWeight"))
{
return CATALOG_WEIGHT_NOT_HIT.code;
}
if (containsAny(msg, "产品价未匹配国家", "CATALOG_COUNTRY_NOT_HIT", "billingFail.catalogCountry"))
{
return CATALOG_COUNTRY_NOT_HIT.code;
}
if (containsAny(msg, "产品价未匹配产品", "CATALOG_PRODUCT_NOT_HIT", "billingFail.catalogProduct"))
{
return CATALOG_PRODUCT_NOT_HIT.code;
}
// Soft-fail sales price (order matters: weight/country before generic product)
if (containsAny(msg, "销售价未匹配重量段", "未匹配重量段", "WEIGHT_NOT_HIT", "billingFail.weight"))
{
return WEIGHT_NOT_HIT.code;
}
if (containsAny(msg, "未匹配国家", "COUNTRY_NOT_HIT", "billingFail.country"))
if (containsAny(msg, "销售价未匹配国家", "未匹配国家", "COUNTRY_NOT_HIT", "billingFail.country"))
{
return COUNTRY_NOT_HIT.code;
}
if (containsAny(msg, "未匹配产品", "PRODUCT_NOT_HIT", "billingFail.product", "productNotInPackage"))
if (containsAny(msg, "销售价未匹配产品", "未匹配产品", "PRODUCT_NOT_HIT", "billingFail.product", "productNotInPackage"))
{
return PRODUCT_NOT_HIT.code;
}
@@ -675,7 +675,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
List<PrcOrderBill> bills = resolveListScopedBills(request.getScopeMode(), request.getBillIds(),
request.getOrderNos(), request.getTrackingNos(), request.getTransferNos(), request.getOrderIdentifiers(),
request.getCustomerCodes(), request.getProductCodes(), request.getCountryCode(),
request.getCreditArrearsStatus(), request.getBillingFailStatuses(),
request.getCreditArrearsStatus(), request.getOrderStatuses(), request.getBillingFailStatuses(),
request.getBeginBizDate(), request.getEndBizDate(),
"price.bill.recalc.filterRequired", "price.bill.recalc.scopeRequired",
"price.bill.recalc.selectedRequired");
@@ -1251,7 +1251,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
return resolveListScopedBills(request.getScopeMode(), request.getBillIds(),
request.getOrderNos(), request.getTrackingNos(), request.getTransferNos(), request.getOrderIdentifiers(),
request.getCustomerCodes(), request.getProductCodes(), request.getCountryCode(),
request.getCreditArrearsStatus(), request.getBillingFailStatuses(),
request.getCreditArrearsStatus(), request.getOrderStatuses(), request.getBillingFailStatuses(),
request.getBeginBizDate(), request.getEndBizDate(),
"price.bill.fee.batch.filterRequired", "price.bill.fee.batch.scopeRequired",
"price.bill.fee.batch.selectedRequired");
@@ -1260,11 +1260,12 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
/**
* Shared list-scope resolve for batch fee / recalc price.
* scopeMode: SELECTED uses billIds; ALL uses filters (at least one required).
* orderStatuses alone does not count as a meaningful filter (same as export).
*/
private List<PrcOrderBill> resolveListScopedBills(String scopeModeRaw, List<String> billIdsRaw,
List<String> orderNosRaw, List<String> trackingNosRaw, List<String> transferNosRaw, List<String> orderIdentifiersRaw,
List<String> customerCodesRaw, List<String> productCodesRaw, String countryCodeRaw,
String creditArrearsStatusRaw, List<Integer> billingFailStatusesRaw,
String creditArrearsStatusRaw, List<Integer> orderStatusesRaw, List<Integer> billingFailStatusesRaw,
String beginBizDateRaw, String endBizDateRaw,
String msgFilter, String msgScope, String msgSelected)
{
@@ -1279,6 +1280,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
List<String> orderIdentifiers = normalizeOrderIdentifiers(orderIdentifiersRaw);
List<String> customerCodes = normalizeCodeList(customerCodesRaw);
List<String> productCodes = normalizeCodeList(productCodesRaw);
List<Integer> orderStatuses = normalizeIntegerList(orderStatusesRaw);
List<Integer> billingFailStatuses = normalizeIntegerList(billingFailStatusesRaw);
String creditArrearsStatus = StringUtils.isEmpty(creditArrearsStatusRaw) ? null
: creditArrearsStatusRaw.trim();
@@ -1320,6 +1322,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
query.setCustomerCodes(customerCodes);
query.setProductCodes(productCodes);
query.setCreditArrearsStatus(creditArrearsStatus);
query.setOrderStatuses(orderStatuses);
query.setBillingFailStatuses(billingFailStatuses);
query.setCountryCode(countryCode);
if (beginBizDate != null)
@@ -2713,6 +2716,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
List<String> transferNos = normalizeCodeList(request.getTransferNos());
List<String> customerCodes = normalizeCodeList(request.getCustomerCodes());
List<String> productCodes = normalizeCodeList(request.getProductCodes());
List<Integer> orderStatuses = normalizeIntegerList(request.getOrderStatuses());
String creditArrearsStatus = StringUtils.isEmpty(request.getCreditArrearsStatus()) ? null
: request.getCreditArrearsStatus().trim();
String beginBizDate = StringUtils.isEmpty(request.getBeginBizDate()) ? null
@@ -2740,6 +2744,7 @@ public class PrcOrderBillServiceImpl implements IPrcOrderBillService
query.setCustomerCodes(customerCodes);
query.setProductCodes(productCodes);
query.setCreditArrearsStatus(creditArrearsStatus);
query.setOrderStatuses(orderStatuses);
if (beginBizDate != null)
{
query.getParams().put("beginBizDate", beginBizDate);
@@ -420,8 +420,9 @@ public class TmsPriceQuoteServiceImpl implements ITmsPriceQuoteService
boolean productExcludedBySetProducts = false;
boolean attemptedPriceMatch = false;
boolean anyZoneRequired = false;
// Highest specificity among soft-failable misses: WEIGHT(3) > COUNTRY(2) > PRODUCT(1).
int missCode = 0;
// Sales miss: WEIGHT(3) > COUNTRY(2) > PRODUCT(1). Catalog miss: 25 > 24 > 23.
int salesMissCode = 0;
int catalogMissCode = 0;
// Match version by exact bill datetime (effective_time / expire_time), not end-of-day.
Date asOf = bizDate != null ? bizDate : new Date();
for (PrcCustomerPriceSet bind : binds)
@@ -467,7 +468,7 @@ public class TmsPriceQuoteServiceImpl implements ITmsPriceQuoteService
if (anyProducts != null && !anyProducts.isEmpty())
{
productExcludedBySetProducts = true;
missCode = Math.max(missCode, BillBillingFailStatus.PRODUCT.getCode());
salesMissCode = Math.max(salesMissCode, BillBillingFailStatus.PRODUCT.getCode());
continue;
}
}
@@ -497,23 +498,26 @@ public class TmsPriceQuoteServiceImpl implements ITmsPriceQuoteService
productCode, productName, cc, cn, zone.zoneCode, weight, bizDate);
if (hit != null)
{
// Billing requires product catalog price (产品价); package hit alone is not enough.
if (request instanceof TmsPriceBillRequest && !hasProductCatalogPrice(catalog))
{
missCode = Math.max(missCode,
diagnoseCatalogMiss(productCode, cc, cn, zone.zoneCode, bizDate));
continue;
}
// Temporarily skip product-catalog (产品价) soft-fail; sales package hit is enough.
// if (request instanceof TmsPriceBillRequest && !hasProductCatalogPrice(catalog))
// {
// catalogMissCode = Math.max(catalogMissCode,
// diagnoseCatalogMiss(productCode, cc, cn, zone.zoneCode, bizDate));
// continue;
// }
stampRequestMeta(request, hit);
return hit;
}
missCode = Math.max(missCode, diagnoseFixedMiss(version.getPsvId(), productCode, cc, cn, zone.zoneCode));
salesMissCode = Math.max(salesMissCode,
diagnoseFixedMiss(version.getPsvId(), productCode, cc, cn, zone.zoneCode));
}
else if (TYPE_DISCOUNT.equals(setType))
{
// DISCOUNT still needs catalog as base rate; do not soft-fail as 产品价未匹配 for now.
if (!hasProductCatalogPrice(catalog))
{
missCode = Math.max(missCode, diagnoseCatalogMiss(productCode, cc, cn, zone.zoneCode, bizDate));
// catalogMissCode = Math.max(catalogMissCode,
// diagnoseCatalogMiss(productCode, cc, cn, zone.zoneCode, bizDate));
continue;
}
TmsPriceQuoteResult hit = tryDiscount(bind, set, version, catalog, productCode, productName, weight, bizDate);
@@ -523,7 +527,7 @@ public class TmsPriceQuoteServiceImpl implements ITmsPriceQuoteService
return hit;
}
// Discount detail missing for product (or invalid discount) after catalog hit.
missCode = Math.max(missCode, BillBillingFailStatus.PRODUCT.getCode());
salesMissCode = Math.max(salesMissCode, BillBillingFailStatus.PRODUCT.getCode());
}
}
@@ -536,8 +540,10 @@ public class TmsPriceQuoteServiceImpl implements ITmsPriceQuoteService
}
if (!attemptedPriceMatch && productExcludedBySetProducts)
{
missCode = Math.max(missCode, BillBillingFailStatus.PRODUCT.getCode());
salesMissCode = Math.max(salesMissCode, BillBillingFailStatus.PRODUCT.getCode());
}
// Prefer product-catalog miss when present (sales may already have hit).
int missCode = catalogMissCode > 0 ? catalogMissCode : salesMissCode;
if (request instanceof TmsPriceBillRequest && BillBillingFailStatus.isFail(Integer.valueOf(missCode)))
{
return buildBillingMissResult(request, productCode, productName, countryCode, countryName,
@@ -591,27 +597,27 @@ public class TmsPriceQuoteServiceImpl implements ITmsPriceQuoteService
}
/**
* Diagnose catalog miss for DISCOUNT base price.
* Diagnose product-catalog (产品价) miss: product absent -> 23; country/zone -> 24; else weight -> 25.
*/
private int diagnoseCatalogMiss(String productCode, String countryCode, String countryName,
String zoneCode, Date bizDate)
{
if (StringUtils.isEmpty(productCode))
{
return BillBillingFailStatus.PRODUCT.getCode();
return BillBillingFailStatus.CATALOG_PRODUCT.getCode();
}
int byProduct = productCountryMapper.countByProduct(productCode, bizDate);
if (byProduct <= 0)
{
return BillBillingFailStatus.PRODUCT.getCode();
return BillBillingFailStatus.CATALOG_PRODUCT.getCode();
}
int byCountry = productCountryMapper.countByProductCountryZone(
productCode, countryCode, countryName, zoneCode, bizDate);
if (byCountry <= 0)
{
return BillBillingFailStatus.COUNTRY.getCode();
return BillBillingFailStatus.CATALOG_COUNTRY.getCode();
}
return BillBillingFailStatus.WEIGHT.getCode();
return BillBillingFailStatus.CATALOG_WEIGHT.getCode();
}
/**
@@ -675,6 +681,18 @@ public class TmsPriceQuoteServiceImpl implements ITmsPriceQuoteService
{
return MessageUtils.message("price.bill.billingFail.weight");
}
if (missCode == BillBillingFailStatus.CATALOG_PRODUCT.getCode())
{
return MessageUtils.message("price.bill.billingFail.catalogProduct");
}
if (missCode == BillBillingFailStatus.CATALOG_COUNTRY.getCode())
{
return MessageUtils.message("price.bill.billingFail.catalogCountry");
}
if (missCode == BillBillingFailStatus.CATALOG_WEIGHT.getCode())
{
return MessageUtils.message("price.bill.billingFail.catalogWeight");
}
return MessageUtils.message("price.bill.packagePriceNotHit");
}
@@ -193,11 +193,12 @@ public final class OrderBillExportSupport
row.setIncomeTotal(bill.getIncomeTotal());
row.setPayTotal(bill.getPayTotal());
row.setMatchSourceLabel(matchSourceLabel(bill.getMatchSource()));
row.setOrderStatusLabel(orderStatusLabel(bill.getOrderStatus()));
row.setBillingFailStatusLabel(billingFailStatusLabel(bill.getBillingFailStatus()));
row.setCustomerActiveStatusLabel(customerActiveLabel(bill.getCustomerActiveStatus()));
row.setCreditArrearsStatusLabel(creditArrearsLabel(bill.getCreditArrearsStatus()));
row.setBizDate(bill.getBizDate());
row.setOrderTime(bill.getOrderTime());
row.setPickupDate(bill.getPickupDate());
row.setBelongSaler(bill.getBelongSaler());
row.setSettlementMan(bill.getSettlementMan());
row.setServiceMan(bill.getServiceMan());
@@ -239,9 +240,12 @@ public final class OrderBillExportSupport
switch (status.intValue())
{
case 0: return "计费成功";
case 1: return "未匹配产品";
case 2: return "未匹配国家";
case 3: return "未匹配重量段";
case 1: return "销售价未匹配产品";
case 2: return "销售价未匹配国家";
case 3: return "销售价未匹配重量段";
case 23: return "产品价未匹配产品";
case 24: return "产品价未匹配国家";
case 25: return "产品价未匹配重量段";
case 4: return "未绑定套餐";
case 5: return "无生效套餐版本";
case 6: return "已生成应收账单";
@@ -0,0 +1,112 @@
package com.bms.system.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.bms.common.annotation.Excel;
import com.bms.common.core.domain.BaseEntity;
/**
* 供应商类型 bms_supplier_type
* 类型编码与字典 bms_supplier_type 的字典键值一致,供供应商档案引用。
*
* @author bms
*/
public class BmsSupplierType extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 类型ID */
private Long typeId;
/** 类型编码(字典键值) */
@Excel(name = "类型编码")
private String typeCode;
/** 类型名称 */
@Excel(name = "类型名称")
private String typeName;
/** 显示排序 */
@Excel(name = "显示排序")
private Integer typeSort;
/** 状态(0正常 1停用) */
@Excel(name = "状态", readConverterExp = "0=正常,1=停用")
private String status;
/** 删除标记(0存在 1删除) */
private String delFlag;
public Long getTypeId()
{
return typeId;
}
public void setTypeId(Long typeId)
{
this.typeId = typeId;
}
public String getTypeCode()
{
return typeCode;
}
public void setTypeCode(String typeCode)
{
this.typeCode = typeCode;
}
public String getTypeName()
{
return typeName;
}
public void setTypeName(String typeName)
{
this.typeName = typeName;
}
public Integer getTypeSort()
{
return typeSort;
}
public void setTypeSort(Integer typeSort)
{
this.typeSort = typeSort;
}
public String getStatus()
{
return status;
}
public void setStatus(String status)
{
this.status = status;
}
public String getDelFlag()
{
return delFlag;
}
public void setDelFlag(String delFlag)
{
this.delFlag = delFlag;
}
@Override
public String toString()
{
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("typeId", getTypeId())
.append("typeCode", getTypeCode())
.append("typeName", getTypeName())
.append("typeSort", getTypeSort())
.append("status", getStatus())
.append("remark", getRemark())
.toString();
}
}
@@ -0,0 +1,112 @@
package com.bms.system.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.bms.system.domain.BmsSupplierType;
/**
* 供应商类型数据层
*
* @author bms
*/
public interface BmsSupplierTypeMapper
{
/**
* 按名称、状态查询供应商类型
*
* @param query 查询条件
* @return 类型列表
*/
List<BmsSupplierType> selectList(BmsSupplierType query);
/**
* 按主键查询未删除的类型
*
* @param typeId 类型ID
* @return 类型
*/
BmsSupplierType selectById(Long typeId);
/**
* 统计未删除的同编码数量
*
* @param typeCode 类型编码
* @param excludeId 排除的类型ID,新增时为空
* @return 数量
*/
int countByTypeCode(@Param("typeCode") String typeCode, @Param("excludeId") Long excludeId);
/**
* 统计未删除的同名称数量
*
* @param typeName 类型名称
* @param excludeId 排除的类型ID,新增时为空
* @return 数量
*/
int countByTypeName(@Param("typeName") String typeName, @Param("excludeId") Long excludeId);
/**
* 新增供应商类型
*
* @param row 类型
* @return 影响行数
*/
int insert(BmsSupplierType row);
/**
* 修改供应商类型(不改编码,避免已引用的供应商失联)
*
* @param row 类型
* @return 影响行数
*/
int update(BmsSupplierType row);
/**
* 只更新启用状态
*
* @param row 含 typeId、status、updateBy
* @return 影响行数
*/
int updateStatus(BmsSupplierType row);
/**
* 逻辑删除
*
* @param typeIds 类型ID
* @return 影响行数
*/
int deleteByIds(Long[] typeIds);
/**
* 按字典类型和键值取字典编码
*
* @param dictType 字典类型
* @param dictValue 字典键值
* @return 字典编码,不存在时为空
*/
Long selectDictCode(@Param("dictType") String dictType, @Param("dictValue") String dictValue);
/**
* 写入字典数据
*
* @param row 类型,字典类型由调用方放入 remark 以外的固定值,见 XML
* @return 影响行数
*/
int insertDict(BmsSupplierType row);
/**
* 按类型编码更新字典标签、排序和状态
*
* @param row 类型
* @return 影响行数
*/
int updateDict(BmsSupplierType row);
/**
* 按类型编码删除字典数据
*
* @param typeCode 类型编码
* @return 影响行数
*/
int deleteDictByCode(String typeCode);
}
@@ -0,0 +1,60 @@
package com.bms.system.service;
import java.util.List;
import com.bms.system.domain.BmsSupplierType;
/**
* 供应商类型服务
*
* @author bms
*/
public interface IBmsSupplierTypeService
{
/**
* 分页前的条件查询,分页由调用方开启
*
* @param query 名称、状态
* @return 类型列表
*/
List<BmsSupplierType> selectList(BmsSupplierType query);
/**
* 查询单个类型
*
* @param typeId 类型ID
* @return 类型
*/
BmsSupplierType selectById(Long typeId);
/**
* 新增类型,并同步字典 bms_supplier_type
*
* @param row 类型
* @return 影响行数
*/
int insert(BmsSupplierType row);
/**
* 修改类型名称、排序、状态、备注,并同步字典
*
* @param row 类型
* @return 影响行数
*/
int update(BmsSupplierType row);
/**
* 启用或停用,并同步字典状态
*
* @param row 含 typeId 与 status
* @return 影响行数
*/
int changeStatus(BmsSupplierType row);
/**
* 逻辑删除,并从字典中移除对应键值
*
* @param typeIds 类型ID
* @return 影响行数
*/
int deleteByIds(Long[] typeIds);
}
@@ -0,0 +1,232 @@
package com.bms.system.service.impl;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.bms.common.core.domain.entity.SysDictData;
import com.bms.common.exception.ServiceException;
import com.bms.common.utils.DictUtils;
import com.bms.common.utils.StringUtils;
import com.bms.system.domain.BmsSupplierType;
import com.bms.system.mapper.BmsSupplierTypeMapper;
import com.bms.system.mapper.SysDictDataMapper;
import com.bms.system.service.IBmsSupplierTypeService;
/**
* 供应商类型服务实现。
* 供应商类型服务实现。_DETAIL
*
* @author bms
*/
@Service
public class BmsSupplierTypeServiceImpl implements IBmsSupplierTypeService
{
/** 字典类型,与系统字典管理中的类型编码一致 */
public static final String DICT_TYPE = "bms_supplier_type";
@Autowired
private BmsSupplierTypeMapper supplierTypeMapper;
@Autowired
private SysDictDataMapper dictDataMapper;
@Override
public List<BmsSupplierType> selectList(BmsSupplierType query)
{
return supplierTypeMapper.selectList(query);
}
@Override
public BmsSupplierType selectById(Long typeId)
{
return supplierTypeMapper.selectById(typeId);
}
@Override
@Transactional(rollbackFor = Exception.class)
public int insert(BmsSupplierType row)
{
normalize(row);
validate(row, null);
if (row.getTypeSort() == null)
{
row.setTypeSort(0);
}
if (StringUtils.isEmpty(row.getStatus()))
{
row.setStatus("0");
}
int rows = supplierTypeMapper.insert(row);
syncDict(row);
return rows;
}
@Override
@Transactional(rollbackFor = Exception.class)
public int update(BmsSupplierType row)
{
if (row.getTypeId() == null)
{
throw new ServiceException("类型ID不能为空");
}
BmsSupplierType existing = requireActive(row.getTypeId());
normalize(row);
if (StringUtils.isEmpty(row.getTypeName()))
{
row.setTypeName(existing.getTypeName());
}
if (row.getTypeSort() == null)
{
row.setTypeSort(existing.getTypeSort());
}
if (StringUtils.isEmpty(row.getStatus()))
{
row.setStatus(existing.getStatus());
}
validateNameAndStatus(row, row.getTypeId());
row.setTypeCode(existing.getTypeCode());
int rows = supplierTypeMapper.update(row);
syncDict(row);
return rows;
}
@Override
@Transactional(rollbackFor = Exception.class)
public int changeStatus(BmsSupplierType row)
{
if (row.getTypeId() == null)
{
throw new ServiceException("类型ID不能为空");
}
if (!"0".equals(row.getStatus()) && !"1".equals(row.getStatus()))
{
throw new ServiceException("状态只能是正常或停用");
}
BmsSupplierType existing = requireActive(row.getTypeId());
existing.setStatus(row.getStatus());
existing.setUpdateBy(row.getUpdateBy());
int rows = supplierTypeMapper.updateStatus(existing);
syncDict(existing);
return rows;
}
@Override
@Transactional(rollbackFor = Exception.class)
public int deleteByIds(Long[] typeIds)
{
if (typeIds == null || typeIds.length == 0)
{
return 0;
}
for (Long typeId : typeIds)
{
BmsSupplierType existing = supplierTypeMapper.selectById(typeId);
if (existing != null && StringUtils.isNotEmpty(existing.getTypeCode()))
{
supplierTypeMapper.deleteDictByCode(existing.getTypeCode());
}
}
int rows = supplierTypeMapper.deleteByIds(typeIds);
refreshDictCache();
return rows;
}
/**
* 校验编码、名称唯一,并整理状态
*/
private void validate(BmsSupplierType row, Long excludeId)
{
if (StringUtils.isEmpty(row.getTypeCode()))
{
throw new ServiceException("类型编码不能为空");
}
if (!row.getTypeCode().matches("[0-9A-Za-z_-]{1,32}"))
{
throw new ServiceException("类型编码只能是字母、数字、下划线或中划线,最长32位");
}
if (supplierTypeMapper.countByTypeCode(row.getTypeCode(), excludeId) > 0)
{
throw new ServiceException("类型编码已存在:" + row.getTypeCode());
}
validateNameAndStatus(row, excludeId);
}
private void validateNameAndStatus(BmsSupplierType row, Long excludeId)
{
if (StringUtils.isEmpty(row.getTypeName()))
{
throw new ServiceException("类型名称不能为空");
}
if (row.getTypeName().length() > 100)
{
throw new ServiceException("类型名称不能超过100个字符");
}
if (supplierTypeMapper.countByTypeName(row.getTypeName(), excludeId) > 0)
{
throw new ServiceException("类型名称已存在:" + row.getTypeName());
}
if (StringUtils.isNotEmpty(row.getStatus())
&& !"0".equals(row.getStatus()) && !"1".equals(row.getStatus()))
{
throw new ServiceException("状态只能是正常或停用");
}
}
private BmsSupplierType requireActive(Long typeId)
{
BmsSupplierType existing = supplierTypeMapper.selectById(typeId);
if (existing == null)
{
throw new ServiceException("供应商类型不存在或已删除");
}
return existing;
}
private void normalize(BmsSupplierType row)
{
if (row.getTypeCode() != null)
{
row.setTypeCode(row.getTypeCode().trim());
}
if (row.getTypeName() != null)
{
row.setTypeName(row.getTypeName().trim());
}
if (row.getRemark() != null)
{
row.setRemark(row.getRemark().trim());
}
}
/**
* 按类型编码新增或更新字典项,并刷新该字典缓存
*/
private void syncDict(BmsSupplierType row)
{
Long dictCode = supplierTypeMapper.selectDictCode(DICT_TYPE, row.getTypeCode());
if (dictCode == null)
{
if (StringUtils.isEmpty(row.getCreateBy()))
{
row.setCreateBy(row.getUpdateBy());
}
supplierTypeMapper.insertDict(row);
}
else
{
supplierTypeMapper.updateDict(row);
}
refreshDictCache();
}
/**
* 只缓存正常状态的字典项,停用后下拉不再出现
*/
private void refreshDictCache()
{
List<SysDictData> dictDatas = dictDataMapper.selectDictDataByType(DICT_TYPE);
DictUtils.setDictCache(DICT_TYPE, dictDatas == null ? new ArrayList<SysDictData>() : dictDatas);
}
}
@@ -28,6 +28,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="weightThreshold" column="weight_threshold" />
<result property="throwRatio" column="throw_ratio" />
<result property="creditEd" column="credit_ed" />
<result property="contractStartDate" column="contract_start_date" />
<result property="contractEndDate" column="contract_end_date" />
<result property="productCodes" column="product_codes" />
<result property="priceSetId" column="price_set_id" />
<result property="priceSetName" column="price_set_name" />
@@ -54,7 +56,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
(select coalesce(sum(ca.total_credit+ca.extra_credit-ca.used_credit), 0) from ctr_customer_account ca
where ca.customer_id = c.customer_id and ca.del_flag = '0') as credit_ed,
c.product_codes, c.remark,
c.contract_start_date, c.contract_end_date, c.product_codes, c.remark,
c.create_by, c.create_time, c.update_by, c.update_time, c.del_flag,
su.nick_name as sales_user_nick_name,
cps.price_set_id, ps.price_set_name
@@ -272,6 +274,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="weightThreshold != null">weight_threshold,</if>
<if test="throwRatio != null">throw_ratio,</if>
<if test="creditEd != null">credit_ed,</if>
<if test="contractStartDate != null">contract_start_date,</if>
<if test="contractEndDate != null">contract_end_date,</if>
<if test="productCodes != null">product_codes,</if>
<if test="remark != null">remark,</if>
<if test="createBy != null">create_by,</if>
@@ -302,6 +306,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="weightThreshold != null">#{weightThreshold},</if>
<if test="throwRatio != null">#{throwRatio},</if>
<if test="creditEd != null">#{creditEd},</if>
<if test="contractStartDate != null">#{contractStartDate},</if>
<if test="contractEndDate != null">#{contractEndDate},</if>
<if test="productCodes != null">#{productCodes},</if>
<if test="remark != null">#{remark},</if>
<if test="createBy != null">#{createBy},</if>
@@ -334,6 +340,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="foreignCurrencyBalance != null">foreign_currency_balance = #{foreignCurrencyBalance},</if>
<if test="weightThreshold != null">weight_threshold = #{weightThreshold},</if>
<if test="throwRatio != null">throw_ratio = #{throwRatio},</if>
contract_start_date = #{contractStartDate},
contract_end_date = #{contractEndDate},
<if test="productCodes != null">product_codes = #{productCodes},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createBy != null">create_by = #{createBy},</if>
@@ -30,6 +30,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="weightThreshold" column="weight_threshold" />
<result property="throwRatio" column="throw_ratio" />
<result property="cooperationStartDate" column="cooperation_start_date" />
<result property="contractStartDate" column="contract_start_date" />
<result property="contractEndDate" column="contract_end_date" />
<result property="cooperationStatus" column="cooperation_status" />
<result property="channelIds" column="channel_ids" />
<result property="remark" column="remark" />
@@ -46,7 +48,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
s.is_enable, s.purchaser_user_id, s.purchaser_user, s.settlement_user_id, s.settlement_user,
s.service_user_id, s.service_user, s.ed, s.zq, s.settlement_type, s.temp_ed, s.account_balance,
s.foreign_currency_balance, s.credit_ed, s.weight_threshold, s.throw_ratio, s.cooperation_start_date,
s.cooperation_status, s.channel_ids, s.remark, s.create_by, s.create_time, s.update_by, s.update_time, s.del_flag
s.contract_start_date, s.contract_end_date, s.cooperation_status, s.channel_ids, s.remark,
s.create_by, s.create_time, s.update_by, s.update_time, s.del_flag
from sup_supplier s
<!-- 数据权限:采购/销售(仅本人 s.purchaser_user_id)/部门经理(本部门 su.dept_id);
非数字历史工号 +0 后不匹配任何 sys_user,仅管理员可见 -->
@@ -120,6 +123,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="weightThreshold != null">weight_threshold,</if>
<if test="throwRatio != null">throw_ratio,</if>
<if test="cooperationStartDate != null">cooperation_start_date,</if>
<if test="contractStartDate != null">contract_start_date,</if>
<if test="contractEndDate != null">contract_end_date,</if>
<if test="cooperationStatus != null">cooperation_status,</if>
<if test="channelIds != null">channel_ids,</if>
<if test="remark != null">remark,</if>
@@ -152,6 +157,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="weightThreshold != null">#{weightThreshold},</if>
<if test="throwRatio != null">#{throwRatio},</if>
<if test="cooperationStartDate != null">#{cooperationStartDate},</if>
<if test="contractStartDate != null">#{contractStartDate},</if>
<if test="contractEndDate != null">#{contractEndDate},</if>
<if test="cooperationStatus != null">#{cooperationStatus},</if>
<if test="channelIds != null">#{channelIds},</if>
<if test="remark != null">#{remark},</if>
@@ -188,6 +195,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="weightThreshold != null">weight_threshold = #{weightThreshold},</if>
<if test="throwRatio != null">throw_ratio = #{throwRatio},</if>
<if test="cooperationStartDate != null">cooperation_start_date = #{cooperationStartDate},</if>
contract_start_date = #{contractStartDate},
contract_end_date = #{contractEndDate},
<if test="cooperationStatus != null">cooperation_status = #{cooperationStatus},</if>
<if test="channelIds != null">channel_ids = #{channelIds},</if>
<if test="remark != null">remark = #{remark},</if>
@@ -0,0 +1,130 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bms.system.mapper.BmsSupplierTypeMapper">
<resultMap type="BmsSupplierType" id="BmsSupplierTypeResult">
<id property="typeId" column="type_id" />
<result property="typeCode" column="type_code" />
<result property="typeName" column="type_name" />
<result property="typeSort" column="type_sort" />
<result property="status" column="status" />
<result property="remark" column="remark" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="delFlag" column="del_flag" />
</resultMap>
<sql id="selectVo">
select type_id, type_code, type_name, type_sort, status, remark,
create_by, create_time, update_by, update_time, del_flag
from bms_supplier_type
</sql>
<select id="selectList" parameterType="BmsSupplierType" resultMap="BmsSupplierTypeResult">
<include refid="selectVo"/>
<where>
del_flag = '0'
<if test="typeName != null and typeName != ''">
and type_name like concat('%', #{typeName}, '%')
</if>
<if test="status != null and status != ''">
and status = #{status}
</if>
</where>
order by type_sort asc, type_id asc
</select>
<select id="selectById" parameterType="Long" resultMap="BmsSupplierTypeResult">
<include refid="selectVo"/>
where type_id = #{typeId} and del_flag = '0'
</select>
<select id="countByTypeCode" resultType="int">
select count(1) from bms_supplier_type
where del_flag = '0' and type_code = #{typeCode}
<if test="excludeId != null">and type_id != #{excludeId}</if>
</select>
<select id="countByTypeName" resultType="int">
select count(1) from bms_supplier_type
where del_flag = '0' and type_name = #{typeName}
<if test="excludeId != null">and type_id != #{excludeId}</if>
</select>
<insert id="insert" parameterType="BmsSupplierType" useGeneratedKeys="true" keyProperty="typeId">
insert into bms_supplier_type (
type_code, type_name, type_sort, status, remark, create_by, create_time, del_flag
) values (
#{typeCode}, #{typeName}, #{typeSort}, #{status}, #{remark}, #{createBy}, sysdate(), '0'
)
</insert>
<update id="update" parameterType="BmsSupplierType">
update bms_supplier_type
<set>
<if test="typeName != null and typeName != ''">type_name = #{typeName},</if>
<if test="typeSort != null">type_sort = #{typeSort},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
update_time = sysdate()
</set>
where type_id = #{typeId} and del_flag = '0'
</update>
<update id="updateStatus" parameterType="BmsSupplierType">
update bms_supplier_type
set status = #{status},
update_by = #{updateBy},
update_time = sysdate()
where type_id = #{typeId} and del_flag = '0'
</update>
<update id="deleteByIds" parameterType="Long">
update bms_supplier_type
set del_flag = '1',
type_code = concat(type_code, '#', type_id),
type_name = concat(type_name, '#', type_id),
update_time = sysdate()
where del_flag = '0' and type_id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</update>
<select id="selectDictCode" resultType="java.lang.Long">
select dict_code from sys_dict_data
where dict_type = #{dictType} and dict_value = #{dictValue}
limit 1
</select>
<insert id="insertDict" parameterType="BmsSupplierType">
insert into sys_dict_data (
dict_sort, dict_label, dict_value, dict_type, css_class, list_class,
is_default, status, create_by, create_time, remark
) values (
#{typeSort}, #{typeName}, #{typeCode}, 'bms_supplier_type', '', 'primary',
'N', #{status}, #{createBy}, sysdate(), #{remark}
)
</insert>
<update id="updateDict" parameterType="BmsSupplierType">
update sys_dict_data
set dict_sort = #{typeSort},
dict_label = #{typeName},
status = #{status},
remark = #{remark},
update_by = #{updateBy},
update_time = sysdate()
where dict_type = 'bms_supplier_type' and dict_value = #{typeCode}
</update>
<delete id="deleteDictByCode">
delete from sys_dict_data
where dict_type = 'bms_supplier_type' and dict_value = #{typeCode}
</delete>
</mapper>
+4
View File
@@ -371,6 +371,8 @@ CREATE TABLE `ctr_customer` (
`weight_threshold` decimal(15,2) DEFAULT '0.00' COMMENT '重量阈值(kg)',
`throw_ratio` decimal(15,2) DEFAULT '0.00' COMMENT '抛比(%)',
`credit_ed` decimal(15,2) DEFAULT '0.00' COMMENT '信用额度(元)',
`contract_start_date` date DEFAULT NULL COMMENT '合同开始时间',
`contract_end_date` date DEFAULT NULL COMMENT '合同结束时间',
`product_codes` varchar(1000) DEFAULT NULL COMMENT '绑定产品代码(多个产品代码用逗号分隔,对接旧库产品编码)',
`logo_oss_id` varchar(1000) DEFAULT NULL COMMENT '客户Logo(图片,关联sys_oss.oss_id)',
`attachment_ids` varchar(1000) DEFAULT NULL COMMENT '附件资料(多个oss_id用逗号分隔,支持PDF/图片/压缩包等)',
@@ -1783,6 +1785,8 @@ CREATE TABLE `sup_supplier` (
`weight_threshold` decimal(15,2) DEFAULT '0.00' COMMENT '重量阈值(kg)',
`throw_ratio` decimal(15,2) DEFAULT '0.00' COMMENT '抛比(%)',
`cooperation_start_date` date DEFAULT NULL COMMENT '合作开始日期',
`contract_start_date` date DEFAULT NULL COMMENT '合同开始时间',
`contract_end_date` date DEFAULT NULL COMMENT '合同结束时间',
`cooperation_status` char(1) DEFAULT '0' COMMENT '合作状态(0正常 1暂停 2终止)',
`channel_ids` varchar(1000) DEFAULT NULL COMMENT '绑定的渠道/服务ID(多个用逗号分隔)',
`remark` varchar(500) DEFAULT NULL COMMENT '备注说明',
+103
View File
@@ -0,0 +1,103 @@
-- 数据管理:供应商类型
-- 业务表与字典 bms_supplier_type 使用同一套编码,初始数据与现有供应商档案口径一致
SET NAMES utf8mb4;
CREATE TABLE IF NOT EXISTS bms_supplier_type (
type_id bigint(20) NOT NULL AUTO_INCREMENT COMMENT '类型ID',
type_code varchar(32) NOT NULL COMMENT '类型编码(字典键值)',
type_name varchar(100) NOT NULL COMMENT '类型名称',
type_sort int(4) NOT NULL DEFAULT 0 COMMENT '显示排序',
status char(1) NOT NULL DEFAULT '0' COMMENT '状态(0正常 1停用)',
remark varchar(500) DEFAULT NULL COMMENT '备注',
create_by varchar(64) DEFAULT '' COMMENT '创建者',
create_time datetime DEFAULT NULL COMMENT '创建时间',
update_by varchar(64) DEFAULT '' COMMENT '更新者',
update_time datetime DEFAULT NULL COMMENT '更新时间',
del_flag char(1) DEFAULT '0' COMMENT '删除标记(0存在 1删除)',
PRIMARY KEY (type_id),
UNIQUE KEY uk_bms_supplier_type_code (type_code),
UNIQUE KEY uk_bms_supplier_type_name (type_name),
KEY idx_bms_supplier_type_status (status)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='供应商类型';
-- 已有供应商档案的类型列只有 1 位,放宽后才能保存新编码
ALTER TABLE sup_supplier
MODIFY COLUMN supplier_type varchar(32) DEFAULT NULL COMMENT '供应商类型(字典 bms_supplier_type)';
INSERT INTO bms_supplier_type (type_code, type_name, type_sort, status, remark, create_by, create_time, del_flag)
SELECT v.type_code, v.type_name, v.type_sort, '0', v.remark, 'admin', sysdate(), '0'
FROM (
SELECT '1' AS type_code, '卡车行' AS type_name, 1 AS type_sort, '原供应商档案口径' AS remark
UNION ALL SELECT '2', '航司代理', 2, '原供应商档案口径'
UNION ALL SELECT '3', '报关行', 3, '原供应商档案口径'
UNION ALL SELECT '4', '清关行', 4, '原供应商档案口径'
UNION ALL SELECT '5', '尾派服务商', 5, '原供应商档案口径'
UNION ALL SELECT '6', '报关代理', 6, '原供应商档案口径'
) v
WHERE NOT EXISTS (
SELECT 1 FROM bms_supplier_type t WHERE t.type_code = v.type_code OR t.type_name = v.type_name
);
INSERT INTO sys_dict_type (dict_name, dict_type, status, create_by, create_time, remark)
SELECT '供应商类型', 'bms_supplier_type', '0', 'admin', sysdate(), '供应商档案使用的类型,与供应商类型管理保持一致'
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_dict_type WHERE dict_type = 'bms_supplier_type');
INSERT INTO sys_dict_data (dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, remark)
SELECT v.type_sort, v.type_name, v.type_code, 'bms_supplier_type', '', 'primary', 'N', '0', 'admin', sysdate(), v.remark
FROM (
SELECT '1' AS type_code, '卡车行' AS type_name, 1 AS type_sort, '原供应商档案口径' AS remark
UNION ALL SELECT '2', '航司代理', 2, '原供应商档案口径'
UNION ALL SELECT '3', '报关行', 3, '原供应商档案口径'
UNION ALL SELECT '4', '清关行', 4, '原供应商档案口径'
UNION ALL SELECT '5', '尾派服务商', 5, '原供应商档案口径'
UNION ALL SELECT '6', '报关代理', 6, '原供应商档案口径'
) v
WHERE NOT EXISTS (
SELECT 1 FROM sys_dict_data d WHERE d.dict_type = 'bms_supplier_type' AND d.dict_value = v.type_code
);
SET @parentId := (
SELECT menu_id FROM sys_menu
WHERE path = 'data' AND menu_type = 'M'
ORDER BY menu_id ASC LIMIT 1
);
SET @parentId := IFNULL(@parentId, (
SELECT parent_id FROM sys_menu
WHERE perms = 'data:region:list' OR component = 'data/region/index' OR component = 'data/exchangerate/index'
ORDER BY menu_id ASC LIMIT 1
));
INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, remark)
SELECT 2490, '供应商类型', @parentId, 40, 'supplierType', 'data/supplierType/index', '', 'SupplierType', 1, 0, 'C', '0', '0', 'data:supplierType:list', 'tree', 'admin', sysdate(), '供应商类型维护,并同步字典 bms_supplier_type'
FROM DUAL WHERE @parentId IS NOT NULL AND NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_id = 2490 OR perms = 'data:supplierType:list');
INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time)
SELECT 2491, '查询', 2490, 1, '', NULL, 1, 0, 'F', '0', '0', 'data:supplierType:query', '#', 'admin', sysdate()
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_id = 2491);
INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time)
SELECT 2492, '新增', 2490, 2, '', NULL, 1, 0, 'F', '0', '0', 'data:supplierType:add', '#', 'admin', sysdate()
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_id = 2492);
INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time)
SELECT 2493, '修改', 2490, 3, '', NULL, 1, 0, 'F', '0', '0', 'data:supplierType:edit', '#', 'admin', sysdate()
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_id = 2493);
INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time)
SELECT 2494, '删除', 2490, 4, '', NULL, 1, 0, 'F', '0', '0', 'data:supplierType:remove', '#', 'admin', sysdate()
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_id = 2494);
INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time)
SELECT 2495, '导出', 2490, 5, '', NULL, 1, 0, 'F', '0', '0', 'data:supplierType:export', '#', 'admin', sysdate()
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_id = 2495);
INSERT INTO sys_menu (menu_id, menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time)
SELECT 2496, '启停', 2490, 6, '', NULL, 1, 0, 'F', '0', '0', 'data:supplierType:changeStatus', '#', 'admin', sysdate()
FROM DUAL WHERE NOT EXISTS (SELECT 1 FROM sys_menu WHERE menu_id = 2496);
INSERT INTO sys_role_menu (role_id, menu_id)
SELECT 1, m.menu_id FROM (
SELECT 2490 AS menu_id UNION SELECT 2491 UNION SELECT 2492 UNION SELECT 2493
UNION SELECT 2494 UNION SELECT 2495 UNION SELECT 2496
) m
WHERE NOT EXISTS (SELECT 1 FROM sys_role_menu rm WHERE rm.role_id = 1 AND rm.menu_id = m.menu_id);
@@ -0,0 +1,11 @@
-- 客户、供应商主表增加合同开始时间、合同结束时间
-- 已存在的库执行本脚本;列已存在时不要重复执行
SET NAMES utf8mb4;
ALTER TABLE ctr_customer
ADD COLUMN contract_start_date date DEFAULT NULL COMMENT '合同开始时间' AFTER credit_ed,
ADD COLUMN contract_end_date date DEFAULT NULL COMMENT '合同结束时间' AFTER contract_start_date;
ALTER TABLE sup_supplier
ADD COLUMN contract_start_date date DEFAULT NULL COMMENT '合同开始时间' AFTER cooperation_start_date,
ADD COLUMN contract_end_date date DEFAULT NULL COMMENT '合同结束时间' AFTER contract_start_date;
@@ -1,5 +1,14 @@
import request from '@/utils/request'
/** 分页查询指定客户的应收账单(客户ID由路径固定) */
export function listCustomerBills(customerId, query) {
return request({
url: '/customersupplier/customerbill/list/' + customerId,
method: 'get',
params: query
})
}
/** 查询客户可核销账单(已确认/部分核销) */
export function listUnsettledBill(customerId) {
return request({
+47
View File
@@ -0,0 +1,47 @@
import request from '@/utils/request'
export function listSupplierType(query) {
return request({
url: '/data/supplierType/list',
method: 'get',
params: query
})
}
export function getSupplierType(typeId) {
return request({
url: '/data/supplierType/' + typeId,
method: 'get'
})
}
export function addSupplierType(data) {
return request({
url: '/data/supplierType',
method: 'post',
data
})
}
export function updateSupplierType(data) {
return request({
url: '/data/supplierType',
method: 'put',
data
})
}
export function changeSupplierTypeStatus(data) {
return request({
url: '/data/supplierType/changeStatus',
method: 'put',
data
})
}
export function delSupplierType(typeIds) {
return request({
url: '/data/supplierType/' + typeIds,
method: 'delete'
})
}
+54 -10
View File
@@ -588,6 +588,55 @@ function renderVirtualText(col, row, rowIndex) {
return String(text)
}
/** Flatten slot VNode text for virtual-table overflow tooltip. */
function extractSlotText(nodes) {
if (nodes == null || nodes === false) return ''
if (typeof nodes === 'string' || typeof nodes === 'number') return String(nodes)
if (Array.isArray(nodes)) return nodes.map(extractSlotText).join('')
if (typeof nodes === 'object') {
if (typeof nodes.children === 'string' || typeof nodes.children === 'number') {
return String(nodes.children)
}
if (Array.isArray(nodes.children)) return extractSlotText(nodes.children)
}
return ''
}
/** True when slot tree contains a component (button/tag/...), skip auto tooltip. */
function slotHasComponent(nodes) {
if (nodes == null || nodes === false) return false
if (Array.isArray(nodes)) return nodes.some(slotHasComponent)
if (typeof nodes !== 'object') return false
if (typeof nodes.type === 'object' || typeof nodes.type === 'function') return true
if (Array.isArray(nodes.children)) return slotHasComponent(nodes.children)
return false
}
function resolveVirtualTooltip(col, rowData, rowIndex, slotNodes) {
if (col.showOverflowTooltip === false) return ''
if (typeof col.tooltipFormatter === 'function') {
const tip = col.tooltipFormatter(rowData, col, rowData ? rowData[col.prop] : undefined, rowIndex)
return tip == null || tip === '' ? '' : String(tip)
}
if (slotNodes != null) {
if (slotHasComponent(slotNodes)) return ''
return extractSlotText(slotNodes).trim()
}
return renderVirtualText(col, rowData, rowIndex)
}
function wrapVirtualTooltip(tip, cell) {
if (!tip) return cell
return h(ElTooltip, {
content: tip,
placement: 'top',
showAfter: 300,
enterable: false
}, {
default: () => cell
})
}
const virtualColumns = computed(() => {
const cols = []
if (props.selection) {
@@ -629,18 +678,13 @@ const virtualColumns = computed(() => {
})
}
if (slotFn) {
return h('div', { class: 'basic-table-vcell' }, slotFn({ row: rowData, $index: rowIndex }))
const nodes = slotFn({ row: rowData, $index: rowIndex })
const cell = h('div', { class: 'basic-table-vcell' }, nodes)
return wrapVirtualTooltip(resolveVirtualTooltip(col, rowData, rowIndex, nodes), cell)
}
const text = renderVirtualText(col, rowData, rowIndex)
if (!text) return h('div', { class: 'basic-table-vcell' }, '')
return h(ElTooltip, {
content: text,
placement: 'top',
showAfter: 300,
enterable: false
}, {
default: () => h('div', { class: 'basic-table-vcell' }, text)
})
const cell = h('div', { class: 'basic-table-vcell' }, text || '')
return wrapVirtualTooltip(resolveVirtualTooltip(col, rowData, rowIndex), cell)
}
}
if (headerSlot) column.headerCellRenderer = () => headerSlot({ column: col })
+2 -1
View File
@@ -63,11 +63,12 @@ export const BILLING_BILL_EXPORT_FIELDS = [
{ prop: 'incomeTotal', label: '应收总额' },
{ prop: 'payTotal', label: '应付总额' },
{ prop: 'matchSourceLabel', label: '计价来源' },
{ prop: 'orderStatusLabel', label: '订单状态' },
{ prop: 'billingFailStatusLabel', label: '计费状态' },
{ prop: 'customerActiveStatusLabel', label: '客户状态' },
{ prop: 'creditArrearsStatusLabel', label: '额度欠费' },
{ prop: 'bizDate', label: '计费时间' },
{ prop: 'orderTime', label: '下单时间' },
{ prop: 'pickupDate', label: '提货时间' },
{ prop: 'belongSaler', label: '销售员' },
{ prop: 'settlementMan', label: '结算员' },
{ prop: 'serviceMan', label: '客服员' }
@@ -154,6 +154,16 @@
<el-input v-model="form.throwRatio" placeholder="请输入抛比" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="合同开始时间" prop="contractStartDate">
<el-date-picker v-model="form.contractStartDate" type="date" value-format="YYYY-MM-DD" placeholder="选择合同开始时间" style="width: 100%;" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="合同结束时间" prop="contractEndDate">
<el-date-picker v-model="form.contractEndDate" type="date" value-format="YYYY-MM-DD" placeholder="选择合同结束时间" style="width: 100%;" />
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="备注说明" prop="remark">
@@ -783,6 +793,8 @@ function buildEmptyForm() {
weightThreshold: null,
throwRatio: null,
creditEd: 0,
contractStartDate: null,
contractEndDate: null,
productCodes: null,
attachmentList: [],
companyList: [],
@@ -1224,6 +1236,11 @@ function submitForm() {
activeTab.value = 'base'
return
}
if (form.value.contractStartDate && form.value.contractEndDate && form.value.contractEndDate < form.value.contractStartDate) {
proxy.$modal.msgError('合同结束时间不能早于开始时间')
activeTab.value = 'base'
return
}
const nullIfEmpty = v => (v === '' || v === undefined ? null : v)
const payload = {
...form.value,
@@ -1234,7 +1251,9 @@ function submitForm() {
settlementUserId: nullIfEmpty(form.value.settlementUserId),
settlementUser: nullIfEmpty(form.value.settlementUser),
serviceUserId: nullIfEmpty(form.value.serviceUserId),
serviceUser: nullIfEmpty(form.value.serviceUser)
serviceUser: nullIfEmpty(form.value.serviceUser),
contractStartDate: nullIfEmpty(form.value.contractStartDate),
contractEndDate: nullIfEmpty(form.value.contractEndDate)
}
saving.value = true
const req = isAdd.value ? addCustomer(payload) : updateCustomer(payload)
@@ -0,0 +1,109 @@
<template>
<el-dialog
v-model="visible"
:title="dialogTitle"
width="min(1500px, 96vw)"
append-to-body
destroy-on-close
>
<basic-table
:columns="columns"
:search-columns="searchColumns"
:query="queryBills"
:extra-params="fixedParams"
:selection="false"
:show-toolbar="false"
:border="true"
:max-height="560"
:page-size="10"
row-key="arBillId"
>
<template #col-status="{ row }">
<el-tag :type="statusType(row.status)">{{ statusText(row.status) }}</el-tag>
</template>
<template #col-totalAmount="{ row }">
<span class="amount">{{ money(row.totalAmount) }}</span>
</template>
<template #col-writtenOffAmount="{ row }">
<span class="written">{{ money(row.writtenOffAmount) }}</span>
</template>
<template #col-unwrittenAmount="{ row }">
<span class="unwritten">{{ money(row.unwrittenAmount) }}</span>
</template>
</basic-table>
<template #footer>
<el-button @click="visible = false">关闭</el-button>
</template>
</el-dialog>
</template>
<script setup>
import { computed } from 'vue'
import { listCustomerBills } from '@/api/customersuppliermanagement/customermoney/customerbill'
import { AR_BILL_STATUS_OPTIONS, AR_BILL_STATUS_TYPES } from '@/constants/ar/bill'
import { arEnumLabel } from '@/constants/ar/enums'
const props = defineProps({
modelValue: { type: Boolean, default: false },
customerId: { type: [String, Number], required: true },
customerName: { type: String, default: '' }
})
const emit = defineEmits(['update:modelValue'])
const visible = computed({
get: () => props.modelValue,
set: value => emit('update:modelValue', value)
})
const dialogTitle = computed(() => props.customerName ? `客户账单 - ${props.customerName}` : '客户账单')
// BasicTable merges these fixed parameters after search and pagination state.
const fixedParams = computed(() => ({ customerId: Number(props.customerId) }))
const statusOptions = AR_BILL_STATUS_OPTIONS
const columns = [
{ label: '账单号', prop: 'billNo', minWidth: 180, showOverflowTooltip: true },
{ label: '账单名称', prop: 'billName', minWidth: 180, showOverflowTooltip: true },
{ label: '客户名称', prop: 'customerName', minWidth: 130, showOverflowTooltip: true },
{ label: '客户编码', prop: 'customerCode', minWidth: 120, showOverflowTooltip: true },
{ label: '账单截止日', prop: 'billPeriodEnd', minWidth: 120, formatter: row => `截至 ${date(row.billPeriodEnd)}` },
{ label: '订单数', prop: 'orderCount', width: 80 },
{ label: '应收总额', prop: 'totalAmount', width: 120, align: 'right', slot: 'totalAmount' },
{ label: '已核销', prop: 'writtenOffAmount', width: 110, align: 'right', slot: 'writtenOffAmount' },
{ label: '未核销', prop: 'unwrittenAmount', width: 110, align: 'right', slot: 'unwrittenAmount' },
{ label: '状态', prop: 'status', width: 110, slot: 'status' },
{ label: '账单日期', prop: 'billDate', width: 120, formatter: row => date(row.billDate) }
]
const searchColumns = [
{ label: '账单号', prop: 'billNo', component: 'input', placeholder: '账单号', width: '180px' },
{ label: '账单名称', prop: 'billName', component: 'input', placeholder: '账单名称', width: '180px' },
{ label: '状态', prop: 'status', component: 'select', options: statusOptions, placeholder: '全部状态', width: '150px' },
{ label: '账单日期', prop: 'billDateRange', component: 'daterange', width: '300px' },
{ label: '账单截止日', prop: 'billPeriodEnd', component: 'date', width: '160px' }
]
function queryBills(params) {
const query = { ...params }
const range = query.billDateRange
if (Array.isArray(range) && range.length === 2) {
query.billDateStart = range[0]
query.billDateEnd = range[1]
}
delete query.billDateRange
// The route parameter is authoritative; the customer ID cannot be changed by search/reset.
delete query.customerId
return listCustomerBills(props.customerId, query)
}
function date(value) { return value ? String(value).slice(0, 10) : '-' }
function money(value) {
const amount = Number(value)
return Number.isNaN(amount) ? '-' : amount.toFixed(2)
}
function statusText(value) { return arEnumLabel(AR_BILL_STATUS_OPTIONS, value) }
function statusType(value) { return AR_BILL_STATUS_TYPES[value] || 'info' }
</script>
<style scoped>
.amount { color: #f56c6c; font-weight: 600; }
.written { color: var(--el-color-success); }
.unwritten { color: var(--el-color-warning); }
</style>
@@ -13,8 +13,8 @@
<el-tag type="success" size="small">本位币账户 CNY</el-tag>
<el-button
icon="Document"
@click="goBillView"
v-hasPermi="['ar:bill:list']"
@click="openBillDialog"
v-hasPermi="['customersupplier:customerinfo:list']"
>查看账单</el-button>
<el-button
type="primary"
@@ -26,6 +26,14 @@
</div>
</el-card>
<customer-bill-list-dialog
v-if="billDialogVisible"
:key="currentCustomerId"
v-model="billDialogVisible"
:customer-id="currentCustomerId"
:customer-name="customer.customerName || route.query.customerName || ''"
/>
<!-- 余额概览(数据来源 customer_account) -->
<el-row :gutter="12" class="balance-row">
<el-col :xs="12" :sm="8" :md="4">
@@ -478,8 +486,6 @@
<span>未核销总额:<b class="money-out">CNY {{ unsettledTotal }}</b></span>
<span>账户余额:<b class="money-in">CNY {{ formatMoney(currentAccount.balance) }}</b></span>
<el-button type="primary" link size="small" icon="Refresh" @click="loadBillWriteoffData">刷新</el-button>
<el-button type="primary" plain size="small" @click="goBillView"
v-hasPermi="['ar:bill:list']">查看全部账单</el-button>
</div>
</el-alert>
@@ -1110,6 +1116,7 @@
<script setup name="CustomerMoney">
import axios from 'axios'
import { saveAs } from 'file-saver'
import CustomerBillListDialog from './CustomerBillListDialog.vue'
import { getCustomer } from "@/api/customersuppliermanagement/customerinfo/customer.js"
import { listAccount, listReceipt, getReceipt, addReceipt, confirmReceipt, cancelReceipt, listFlow, listCreditFlow, applyCreditAdjust, listCreditApply, approveCreditApply, rejectCreditApply, cancelCreditApply, listMyCreditPools } from "@/api/customersuppliermanagement/customermoney/customermoney.js"
import { listUnsettledBill, listBalanceWriteoff, balanceWriteoff, cancelBalanceWriteoff } from "@/api/customersuppliermanagement/customermoney/customerbill.js"
@@ -2028,11 +2035,18 @@ function formatDate(val) {
if (!val) return '-'
return String(val).substring(0, 10)
}
function goBillView() {
router.push({
path: '/ar/bill',
query: { customerId: route.query.customerId || '' }
})
const billDialogVisible = ref(false)
const currentCustomerId = computed(() => {
const id = Number(route.query.customerId)
return Number.isSafeInteger(id) && id > 0 ? id : null
})
function openBillDialog() {
if (!currentCustomerId.value) {
proxy.$modal.msgWarning('缺少客户ID,请从客户列表进入客户余额页')
return
}
billDialogVisible.value = true
}
const unsettledList = ref([])
@@ -179,6 +179,12 @@
<span v-else>{{ scope.row.creditEd }}</span>
</template>
</el-table-column>
<el-table-column v-if="isColVisible('contractStartDate')" label="合同开始时间" align="center" prop="contractStartDate" width="120">
<template #default="scope">{{ formatDateOnly(scope.row.contractStartDate) }}</template>
</el-table-column>
<el-table-column v-if="isColVisible('contractEndDate')" label="合同结束时间" align="center" prop="contractEndDate" width="120">
<template #default="scope">{{ formatDateOnly(scope.row.contractEndDate) }}</template>
</el-table-column>
<el-table-column v-if="isColVisible('productCodes')" label="绑定产品" align="center" prop="productCodes" min-width="180" show-overflow-tooltip>
<template #default="scope">
<span v-if="productNames(scope.row.productCodes)">{{ productNames(scope.row.productCodes) }}</span>
@@ -326,6 +332,8 @@ const columnDefs = [
{ key: 'weightThreshold', label: '重量阈值' },
{ key: 'throwRatio', label: '抛比' },
{ key: 'creditEd', label: '信用额度' },
{ key: 'contractStartDate', label: '合同开始时间' },
{ key: 'contractEndDate', label: '合同结束时间' },
{ key: 'productCodes', label: '绑定产品' },
{ key: 'priceSetName', label: '绑定套餐' },
{ key: 'remark', label: '备注说明' }
@@ -359,6 +367,12 @@ function formatBalance(val) {
return isNaN(num) ? '0.00' : num.toFixed(2)
}
function formatDateOnly(value) {
if (!value) return ''
const s = String(value)
return s.length > 10 ? s.substring(0, 10) : s
}
/* ================= 右键复制列值 ================= */
const copyMenuRef = ref(null)
/** 右键可复制列(取值口径与表格展示一致) */
@@ -379,6 +393,8 @@ const copyColumns = computed(() => [
{ key: 'weightThreshold', label: '重量阈值', get: r => (r.weightThreshold === null || r.weightThreshold === undefined ? '' : r.weightThreshold) },
{ key: 'throwRatio', label: '抛比', get: r => (r.throwRatio === null || r.throwRatio === undefined ? '' : r.throwRatio) },
{ key: 'creditEd', label: '信用额度', get: r => (r.creditEd === null || r.creditEd === undefined ? '' : r.creditEd) },
{ key: 'contractStartDate', label: '合同开始时间', get: r => formatDateOnly(r.contractStartDate) },
{ key: 'contractEndDate', label: '合同结束时间', get: r => formatDateOnly(r.contractEndDate) },
{ key: 'productCodes', label: '绑定产品', get: r => productNames(r.productCodes) },
{ key: 'priceSetName', label: '绑定套餐', get: r => r.priceSetName || '' },
{ key: 'remark', label: '备注说明', get: r => r.remark || '' }
@@ -166,6 +166,12 @@
<el-table-column v-if="isColVisible('cooperationStartDate')" label="合作开始日期" align="center" prop="cooperationStartDate">
<template #default="scope">{{ formatDateOnly(scope.row.cooperationStartDate) }}</template>
</el-table-column>
<el-table-column v-if="isColVisible('contractStartDate')" label="合同开始时间" align="center" prop="contractStartDate" width="120">
<template #default="scope">{{ formatDateOnly(scope.row.contractStartDate) }}</template>
</el-table-column>
<el-table-column v-if="isColVisible('contractEndDate')" label="合同结束时间" align="center" prop="contractEndDate" width="120">
<template #default="scope">{{ formatDateOnly(scope.row.contractEndDate) }}</template>
</el-table-column>
<el-table-column v-if="isColVisible('cooperationStatus')" label="合作状态" align="center" prop="cooperationStatus">
<template #default="scope">{{ formatOption(cooperationStatusOptions, scope.row.cooperationStatus) }}</template>
</el-table-column>
@@ -240,6 +246,8 @@ const columnDefs = [
{ key: 'weightThreshold', label: '重量阈值' },
{ key: 'throwRatio', label: '抛比' },
{ key: 'cooperationStartDate', label: '合作开始日期' },
{ key: 'contractStartDate', label: '合同开始时间' },
{ key: 'contractEndDate', label: '合同结束时间' },
{ key: 'cooperationStatus', label: '合作状态' },
{ key: 'channelIds', label: '绑定渠道' },
{ key: 'remark', label: '备注说明' }
@@ -254,16 +262,7 @@ const single = ref(true)
const multiple = ref(true)
const total = ref(0)
const { sys_normal_disable, settlement_type } = useDict("sys_normal_disable", "settlement_type")
const supplierTypeOptions = ref([
{ value: "1", label: "卡车行" },
{ value: "2", label: "航司代理" },
{ value: "3", label: "报关行" },
{ value: "4", label: "清关行" },
{ value: "5", label: "尾派服务商" },
{ value: "6", label: "报关代理" }
])
const { sys_normal_disable, settlement_type, bms_supplier_type: supplierTypeOptions } = useDict("sys_normal_disable", "settlement_type", "bms_supplier_type")
const invoiceTypeOptions = ref([
{ value: "1", label: "增值税普通发票" },
{ value: "2", label: "增值税专用发票" },
@@ -321,6 +320,8 @@ const copyColumns = computed(() => [
{ key: 'weightThreshold', label: '重量阈值', get: r => (r.weightThreshold === null || r.weightThreshold === undefined ? '' : r.weightThreshold) },
{ key: 'throwRatio', label: '抛比', get: r => (r.throwRatio === null || r.throwRatio === undefined ? '' : r.throwRatio) },
{ key: 'cooperationStartDate', label: '合作开始日期', get: r => formatDateOnly(r.cooperationStartDate) },
{ key: 'contractStartDate', label: '合同开始时间', get: r => formatDateOnly(r.contractStartDate) },
{ key: 'contractEndDate', label: '合同结束时间', get: r => formatDateOnly(r.contractEndDate) },
{ key: 'cooperationStatus', label: '合作状态', get: r => formatOption(cooperationStatusOptions.value, r.cooperationStatus) },
{ key: 'channelIds', label: '绑定渠道', get: r => channelNames(r.channelIds) },
{ key: 'remark', label: '备注说明', get: r => r.remark || '' }
@@ -161,6 +161,16 @@
<el-date-picker v-model="form.cooperationStartDate" type="date" value-format="YYYY-MM-DD" placeholder="选择合作开始日期" style="width: 100%;" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="合同开始时间" prop="contractStartDate">
<el-date-picker v-model="form.contractStartDate" type="date" value-format="YYYY-MM-DD" placeholder="选择合同开始时间" style="width: 100%;" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="合同结束时间" prop="contractEndDate">
<el-date-picker v-model="form.contractEndDate" type="date" value-format="YYYY-MM-DD" placeholder="选择合同结束时间" style="width: 100%;" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="合作状态" prop="cooperationStatus">
<el-select v-model="form.cooperationStatus" placeholder="请选择合作状态" clearable style="width: 100%;">
@@ -640,14 +650,7 @@ const rules = {
supplierName: [{ required: true, message: '供应商名称不能为空', trigger: 'blur' }]
}
const supplierTypeOptions = ref([
{ value: '1', label: '卡车行' },
{ value: '2', label: '航司代理' },
{ value: '3', label: '报关行' },
{ value: '4', label: '清关行' },
{ value: '5', label: '尾派服务商' },
{ value: '6', label: '报关代理' }
])
const { bms_supplier_type: supplierTypeOptions } = useDict('bms_supplier_type')
const invoiceTypeOptions = ref([
{ value: '1', label: '增值税普通发票' },
{ value: '2', label: '增值税专用发票' },
@@ -692,6 +695,8 @@ function buildEmptyForm() {
throwRatio: null,
creditEd: null,
cooperationStartDate: null,
contractStartDate: null,
contractEndDate: null,
cooperationStatus: null,
channelIds: null,
attachmentList: [],
@@ -1028,6 +1033,11 @@ function submitForm() {
activeTab.value = 'base'
return
}
if (form.value.contractStartDate && form.value.contractEndDate && form.value.contractEndDate < form.value.contractStartDate) {
proxy.$modal.msgError('合同结束时间不能早于开始时间')
activeTab.value = 'base'
return
}
const nullIfEmpty = v => (v === '' || v === undefined ? null : v)
const payload = {
...form.value,
@@ -1036,7 +1046,9 @@ function submitForm() {
settlementUserId: nullIfEmpty(form.value.settlementUserId),
settlementUser: nullIfEmpty(form.value.settlementUser),
serviceUserId: nullIfEmpty(form.value.serviceUserId),
serviceUser: nullIfEmpty(form.value.serviceUser)
serviceUser: nullIfEmpty(form.value.serviceUser),
contractStartDate: nullIfEmpty(form.value.contractStartDate),
contractEndDate: nullIfEmpty(form.value.contractEndDate)
}
saving.value = true
const req = isAdd.value ? addSupplier(payload) : updateSupplier(payload)
+113 -7
View File
@@ -4,6 +4,7 @@
ref="tableRef"
:columns="columns"
:search-columns="searchColumns"
:default-params="defaultParams"
:query="queryList"
:search-per-row="4"
row-key="billId"
@@ -54,6 +55,32 @@
</el-option>
</el-select>
</template>
<template #search-orderStatuses="{ model }">
<el-select
v-model="model.orderStatuses"
multiple
filterable
clearable
collapse-tags
collapse-tags-tooltip
placeholder="请选择"
style="width: 100%"
>
<template #header>
<el-checkbox
:model-value="isAllSelected(model, 'orderStatuses', orderStatusAllValues)"
:indeterminate="isIndeterminate(model, 'orderStatuses', orderStatusAllValues)"
@change="(checked) => toggleAllSelected(model, 'orderStatuses', orderStatusAllValues, checked)"
>全选</el-checkbox>
</template>
<el-option
v-for="opt in orderStatusOptions"
:key="opt.value"
:label="opt.label"
:value="opt.value"
/>
</el-select>
</template>
<template #col-product="{ row }">
{{ row.productName || '-' }} ({{ row.productCode }})
</template>
@@ -66,6 +93,9 @@
<template #col-matchSource="{ row }">
<el-tag size="small" :type="sourceTagType(row.matchSource)">{{ sourceLabel(row.matchSource) }}</el-tag>
</template>
<template #col-orderStatus="{ row }">
{{ orderStatusLabel(row.orderStatus) }}
</template>
<template #col-billingFailStatus="{ row }">
<el-tag size="small" :type="billingFailTagType(row.billingFailStatus)">{{ billingFailLabel(row.billingFailStatus) }}</el-tag>
</template>
@@ -293,6 +323,63 @@ const exportFieldRef = ref()
const tableHeight = ref(480)
let tableResizeObserver = null
const defaultParams = {
orderStatuses: [3, 4, 5, 6, 7, 8, 11],
billingFailStatuses: []
}
const orderStatusMap = {
0: '草稿订单',
1: '确认订单',
2: '已中转',
3: '已收货',
4: '已装箱',
5: '已出库',
6: '转运中',
7: '已上网',
8: '已签收',
9: '已退件',
10: '已取消',
11: '已复核'
}
const orderStatusOptions = Object.keys(orderStatusMap).map(k => ({ label: orderStatusMap[k], value: Number(k) }))
const orderStatusAllValues = computed(() => orderStatusOptions.map(o => o.value))
function orderStatusLabel(status) {
if (status == null || status === '') return '-'
const key = String(status)
if (Object.prototype.hasOwnProperty.call(orderStatusMap, key)) return orderStatusMap[key]
return String(status)
}
function selectedValues(model, key) {
const value = model?.[key]
return Array.isArray(value) ? value : []
}
function resolveAllValues(allValues) {
if (Array.isArray(allValues)) return allValues
const value = allValues?.value
return Array.isArray(value) ? value : []
}
function isAllSelected(model, key, allValues) {
const all = resolveAllValues(allValues)
const selected = selectedValues(model, key)
return all.length > 0 && selected.length === all.length
}
function isIndeterminate(model, key, allValues) {
const all = resolveAllValues(allValues)
const selected = selectedValues(model, key)
return selected.length > 0 && selected.length < all.length
}
function toggleAllSelected(model, key, allValues, checked) {
if (!model) return
model[key] = checked ? [...resolveAllValues(allValues)] : []
}
function updateTableHeight() {
const tableEl = document.querySelector('.billing-bill > .basic-table .el-table, .billing-bill > .basic-table .basic-table-virtual')
if (!tableEl) return
@@ -363,16 +450,17 @@ const columns = [
{ label: '应收总额', prop: 'incomeTotal', align: 'right', width: 120, slot: 'incomeTotal' },
{ label: '应付总额', prop: 'payTotal', align: 'right', width: 120, slot: 'payTotal' },
{ label: '计价来源', prop: 'matchSource', align: 'center', width: 130, slot: 'matchSource' },
{ label: '订单状态', prop: 'orderStatus', align: 'center', width: 110, slot: 'orderStatus' },
{ label: '计费状态', prop: 'billingFailStatus', align: 'center', width: 120, slot: 'billingFailStatus' },
{ label: '客户状态', prop: 'customerActiveStatus', align: 'center', width: 100, slot: 'customerActiveStatus' },
{ label: '额度欠费', prop: 'creditArrearsStatus', align: 'center', width: 100, slot: 'creditArrearsStatus' },
// { label: '退费状态', prop: 'refundStatus', align: 'center', width: 100, slot: 'refundStatus' },
{ label: '计费时间', prop: 'bizDate', align: 'center', width: 170, parseTime: true },
{ label: '下单时间', prop: 'orderTime', align: 'center', width: 170, parseTime: true },
{ label: '提货时间', prop: 'pickupDate', align: 'center', width: 170, parseTime: true },
{ label: '销售员', prop: 'belongSaler', minWidth: 100, showOverflowTooltip: true },
{ label: '结算员', prop: 'settlementMan', minWidth: 100, showOverflowTooltip: true },
{ label: '客服员', prop: 'serviceMan', minWidth: 100, showOverflowTooltip: true },
{ label: '操作', prop: 'action', align: 'center', width: 240, fixed: 'right', slot: 'action', showInToolbar: false }
{ label: '操作', prop: 'action', align: 'center', width: 240, fixed: 'right', slot: 'action', showInToolbar: false, showOverflowTooltip: false }
]
const arrearsStatusOptions = [
@@ -385,15 +473,18 @@ const refundStatusOptions = [
]
const billingFailStatusOptions = [
{ label: '计费成功', value: 0 },
{ label: '未匹配产品', value: 1 },
{ label: '未匹配国家', value: 2 },
{ label: '未匹配重量段', value: 3 },
{ label: '销售价未匹配产品', value: 1 },
{ label: '销售价未匹配国家', value: 2 },
{ label: '销售价未匹配重量段', value: 3 },
{ label: '产品价未匹配产品', value: 23 },
{ label: '产品价未匹配国家', value: 24 },
{ label: '产品价未匹配重量段', value: 25 },
]
const searchColumns = [
{ label: '单号', prop: 'orderIdentifiers', placeholder: '订单号/运单号/转单号' },
{ label: '客户', prop: 'customerCodes', placeholder: '客户名称/客户代码/对外代码' },
{ label: '产品代码', prop: 'productCodes', placeholder: '产品代码' },
// { label: '产品代码', prop: 'productCodes', placeholder: '产品代码' },
{
label: '额度欠费',
prop: 'creditArrearsStatus',
@@ -402,6 +493,19 @@ const searchColumns = [
placeholder: '请选择',
props: { clearable: true }
},
{
label: '订单状态',
prop: 'orderStatuses',
component: 'select',
options: orderStatusOptions,
placeholder: '请选择',
props: {
multiple: true,
clearable: true,
collapseTags: true,
collapseTagsTooltip: true
}
},
{
label: '\u8ba1\u8d39\u5931\u8d25',
prop: 'billingFailStatuses',
@@ -587,6 +691,7 @@ function buildRecalcPayload() {
customerCodes: rest.customerCodes || [],
productCodes: rest.productCodes || [],
creditArrearsStatus: rest.creditArrearsStatus || undefined,
orderStatuses: Array.isArray(rest.orderStatuses) ? rest.orderStatuses : [],
billingFailStatuses: Array.isArray(rest.billingFailStatuses) ? rest.billingFailStatuses : []
}
if (Array.isArray(bizDateRange) && (bizDateRange[0] || bizDateRange[1])) {
@@ -678,7 +783,8 @@ function buildChargeWeightTemplateQuery() {
orderIdentifiers: parseOrderIdentifiers(rest.orderIdentifiers),
customerCodes: rest.customerCodes || [],
productCodes: rest.productCodes || [],
creditArrearsStatus: rest.creditArrearsStatus || undefined
creditArrearsStatus: rest.creditArrearsStatus || undefined,
orderStatuses: Array.isArray(rest.orderStatuses) ? rest.orderStatuses : []
}
if (Array.isArray(bizDateRange) && (bizDateRange[0] || bizDateRange[1])) {
payload.beginBizDate = bizDateRange[0] || null
@@ -211,6 +211,11 @@ function buildQueryTags(q) {
: (q.creditArrearsStatus === 'NORMAL' ? "正常" : q.creditArrearsStatus)
tags.push("额度欠费" + ':' + label)
}
const orderStatuses = Array.isArray(q.orderStatuses) ? q.orderStatuses.filter(v => v != null) : []
if (orderStatuses.length) {
const labels = orderStatuses.map(v => orderStatusLabel(v))
tags.push("订单状态" + ':' + labels.join(', '))
}
const failStatuses = Array.isArray(q.billingFailStatuses) ? q.billingFailStatuses.filter(v => v != null) : []
if (failStatuses.length) {
const labels = failStatuses.map(v => billingFailStatusLabel(v))
@@ -222,12 +227,34 @@ function buildQueryTags(q) {
return tags
}
function orderStatusLabel(code) {
const map = {
0: '草稿订单',
1: '确认订单',
2: '已中转',
3: '已收货',
4: '已装箱',
5: '已出库',
6: '转运中',
7: '已上网',
8: '已签收',
9: '已退件',
10: '已取消',
11: '已复核'
}
const key = Number(code)
return map[key] != null ? map[key] : String(code)
}
function billingFailStatusLabel(code) {
const map = {
0: '计费成功',
1: '未匹配产品',
2: '未匹配国家',
3: '未匹配重量段'
1: '销售价未匹配产品',
2: '销售价未匹配国家',
3: '销售价未匹配重量段',
23: '产品价未匹配产品',
24: '产品价未匹配国家',
25: '产品价未匹配重量段'
}
const key = Number(code)
return map[key] != null ? map[key] : String(code)
@@ -278,6 +305,7 @@ function buildPayload() {
customerCodes: q.customerCodes || [],
productCodes: q.productCodes || [],
creditArrearsStatus: q.creditArrearsStatus || undefined,
orderStatuses: Array.isArray(q.orderStatuses) ? q.orderStatuses : [],
billingFailStatuses: Array.isArray(q.billingFailStatuses) ? q.billingFailStatuses : [],
beginBizDate: q.beginBizDate || undefined,
endBizDate: q.endBizDate || undefined
@@ -338,9 +338,12 @@ function formatDateTime(val) {
const billingFailStatusOptions = [
{ label: '计费成功', value: 0 },
{ label: '未匹配产品', value: 1 },
{ label: '未匹配国家', value: 2 },
{ label: '未匹配重量段', value: 3 },
{ label: '销售价未匹配产品', value: 1 },
{ label: '销售价未匹配国家', value: 2 },
{ label: '销售价未匹配重量段', value: 3 },
{ label: '产品价未匹配产品', value: 23 },
{ label: '产品价未匹配国家', value: 24 },
{ label: '产品价未匹配重量段', value: 25 },
{ label: '未绑定套餐', value: 4 },
{ label: '无生效套餐版本', value: 5 },
{ label: '已生成应收账单', value: 6 },
@@ -270,9 +270,12 @@ const orderStatusOptions = Object.keys(orderStatusMap).map(k => ({ label: orderS
const billingFailStatusOptions = [
{ label: '计费成功', value: 0 },
{ label: '未匹配产品', value: 1 },
{ label: '未匹配国家', value: 2 },
{ label: '未匹配重量段', value: 3 },
{ label: '销售价未匹配产品', value: 1 },
{ label: '销售价未匹配国家', value: 2 },
{ label: '销售价未匹配重量段', value: 3 },
{ label: '产品价未匹配产品', value: 23 },
{ label: '产品价未匹配国家', value: 24 },
{ label: '产品价未匹配重量段', value: 25 },
{ label: '未绑定套餐', value: 4 },
{ label: '无生效套餐版本', value: 5 },
{ label: '已生成应收账单', value: 6 },