客户和供应商新增合同时间
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>
|
||||
|
||||
Reference in New Issue
Block a user