客户和供应商新增合同时间
This commit is contained in:
+12
@@ -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;
|
||||
|
||||
+15
-1
@@ -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);
|
||||
|
||||
+13
@@ -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("合同结束时间不能早于开始时间");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+10
@@ -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;
|
||||
|
||||
+13
@@ -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("合同结束时间不能早于开始时间");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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 '备注说明',
|
||||
|
||||
@@ -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;
|
||||
@@ -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)
|
||||
|
||||
@@ -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: '备注说明' }
|
||||
@@ -312,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%;">
|
||||
@@ -685,6 +695,8 @@ function buildEmptyForm() {
|
||||
throwRatio: null,
|
||||
creditEd: null,
|
||||
cooperationStartDate: null,
|
||||
contractStartDate: null,
|
||||
contractEndDate: null,
|
||||
cooperationStatus: null,
|
||||
channelIds: null,
|
||||
attachmentList: [],
|
||||
@@ -1021,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,
|
||||
@@ -1029,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)
|
||||
|
||||
Reference in New Issue
Block a user