统一修改ruoyi->bms

This commit is contained in:
caojia
2026-09-28 10:02:38 +08:00
parent 341afc4111
commit 0408b6c35e
639 changed files with 2776 additions and 2807 deletions
@@ -0,0 +1,140 @@
package com.bms.customer.supplierinfo.domain;
import java.math.BigDecimal;
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;
import com.bms.common.annotation.Excel;
import com.bms.common.core.domain.BaseEntity;
import com.bms.customer.supplierinfo.domain.BmsSupplierAttachment;
import com.bms.customer.supplierinfo.domain.BmsSupplierCompany;
import com.bms.customer.supplierinfo.domain.BmsSupplierContact;
/**
* 供应商主对象 sup_supplier
*
* @author bms
* @date 2026-09-09
*/
@Data
public class BmsSupplier extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 供应商ID */
private Long supplierId;
/** 供应商编码 */
@Excel(name = "供应商编码")
private String supplierCode;
/** 供应商名称 */
@Excel(name = "供应商名称")
private String supplierName;
/** 对外代码 */
@Excel(name = "对外代码")
private String supplierCodeDw;
/** 统一社会信用代码 */
@Excel(name = "统一社会信用代码")
private String creditCode;
/** 供应商类型(0生产商 1代理商 2个人 3物流商 4其他) */
@Excel(name = "供应商类型", readConverterExp = "0=生产商,1=代理商,2=个人,3=物流商,4=其他")
private String supplierType;
/** 启用状态(0正常 1停用) */
@Excel(name = "启用状态", readConverterExp = "0=正常,1=停用")
private String isEnable;
/** 采购员用户ID */
@Excel(name = "采购员用户ID")
private String purchaserUserId;
/** 采购员姓名 */
@Excel(name = "采购员姓名")
private String purchaserUser;
/** 结算员用户ID */
@Excel(name = "结算员用户ID")
private String settlementUserId;
/** 结算员姓名 */
@Excel(name = "结算员姓名")
private String settlementUser;
/** 跟单员用户ID */
@Excel(name = "跟单员用户ID")
private String serviceUserId;
/** 跟单员姓名 */
@Excel(name = "跟单员姓名")
private String serviceUser;
/** 应付额度(元) */
@Excel(name = "应付额度")
private BigDecimal ed;
/** 应付账期(天) */
@Excel(name = "应付账期")
private Long zq;
/** 结算方式(0月结 1周结 2日结 3票结) */
@Excel(name = "结算方式", readConverterExp = "0=月结,1=周结,2=日结,3=票结")
private String settlementType;
/** 临时额度(元) */
@Excel(name = "临时额度")
private BigDecimal tempEd;
/** 应付余额(元) */
@Excel(name = "应付余额")
private BigDecimal accountBalance;
/** 外币应付余额(元) */
@Excel(name = "外币应付余额")
private BigDecimal foreignCurrencyBalance;
/** 信用额度(元) */
@Excel(name = "信用额度")
private BigDecimal creditEd;
/** 重量阈值(kg) */
@Excel(name = "重量阈值")
private BigDecimal weightThreshold;
/** 抛比(%) */
@Excel(name = "抛比")
private BigDecimal throwRatio;
/** 合作开始日期 */
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@Excel(name = "合作开始日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date cooperationStartDate;
/** 合作状态(0正常 1暂停 2终止) */
@Excel(name = "合作状态", readConverterExp = "0=正常,1=暂停,2=终止")
private String cooperationStatus;
/** 绑定的渠道/服务ID */
private String channelIds;
/** 附件列表(子表 sup_supplier_attachment) */
private List<BmsSupplierAttachment> attachmentList;
/** 公司主体列表(子表 sup_supplier_company) */
private List<BmsSupplierCompany> companyList;
/** 联系人列表(子表 sup_supplier_contact) */
private List<BmsSupplierContact> contactList;
/** 删除标记(0正常 2删除) */
private String delFlag;
}
@@ -0,0 +1,62 @@
package com.bms.customer.supplierinfo.domain;
import lombok.Data;
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;
/**
* 供应商附件对象 sup_supplier_attachment
*
* @author bms
* @date 2026-09-10
*/
@Data
public class BmsSupplierAttachment extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 附件ID */
private Long attachmentId;
/** 所属供应商ID */
@Excel(name = "供应商ID")
private Long supplierId;
/** 文件原始名称 */
@Excel(name = "文件原始名称")
private String fileName;
/** 文件存储路径 */
@Excel(name = "文件存储路径")
private String filePath;
/** 文件大小(字节) */
@Excel(name = "文件大小")
private Long fileSize;
/** 文件类型 */
@Excel(name = "文件类型")
private String fileType;
/** 文件扩展名 */
@Excel(name = "文件扩展名")
private String fileExtension;
/** 附件类型(0附件资料 1供应商Logo 2合同文件 3其他) */
@Excel(name = "附件类型", readConverterExp = "0=附件资料,1=供应商Logo,2=合同文件,3=其他")
private String attachmentType;
/** 是否Logo(0否 1是) */
@Excel(name = "是否Logo", readConverterExp = "0=否,1=是")
private String isLogo;
/** 排序 */
@Excel(name = "排序")
private Integer sortOrder;
/** 删除标记(0正常 2删除) */
private String delFlag;
}
@@ -0,0 +1,147 @@
package com.bms.customer.supplierinfo.domain;
import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import com.bms.common.annotation.Excel;
import com.bms.common.core.domain.BaseEntity;
/**
* 供应商公司主体(工商信息)对象 sup_supplier_company
*
* @author bms
* @date 2026-09-10
*/
@Data
public class BmsSupplierCompany extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 公司主体ID */
private Long companyId;
/** 所属供应商ID */
@Excel(name = "供应商ID")
private Long supplierId;
/** 公司全称 */
@Excel(name = "公司全称")
private String companyNameFull;
/** 公司英文名称 */
@Excel(name = "公司英文名称")
private String englishName;
/** 统一社会信用代码 */
@Excel(name = "统一社会信用代码")
private String creditCode;
/** 法定代表人 */
@Excel(name = "法定代表人")
private String legalPerson;
/** 法定代表人电话 */
@Excel(name = "法定代表人电话")
private String legalPersonPhone;
/** 法定代表人身份证号 */
private String legalPersonIdCard;
/** 注册资本(万元) */
@Excel(name = "注册资本", cellType = Excel.ColumnType.NUMERIC)
private BigDecimal registeredCapital;
/** 注册资本币种 */
@Excel(name = "注册资本币种")
private String capitalCurrency;
/** 实收资本(万元) */
@Excel(name = "实收资本", cellType = Excel.ColumnType.NUMERIC)
private BigDecimal paidInCapital;
/** 成立日期 */
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@Excel(name = "成立日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date establishDate;
/** 营业期限起始日 */
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@Excel(name = "营业期限起始日", width = 30, dateFormat = "yyyy-MM-dd")
private Date businessTermStart;
/** 营业期限终止日 */
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@Excel(name = "营业期限终止日", width = 30, dateFormat = "yyyy-MM-dd")
private Date businessTermEnd;
/** 是否长期有效(0否 1是) */
@Excel(name = "是否长期有效", readConverterExp = "0=否,1=是")
private String businessTermPermanent;
/** 登记机关 */
@Excel(name = "登记机关")
private String registrationAuthority;
/** 注册号 */
@Excel(name = "注册号")
private String registrationNumber;
/** 经营状态 */
@Excel(name = "经营状态")
private String operatingStatus;
/** 经营范围 */
private String businessScope;
/** 主要股东信息 */
private String shareholders;
/** 员工人数 */
@Excel(name = "员工人数")
private Integer employeeCount;
/** 公司电话 */
@Excel(name = "公司电话")
private String companyPhone;
/** 公司传真 */
@Excel(name = "公司传真")
private String companyFax;
/** 公司网址 */
@Excel(name = "公司网址")
private String companyWebsite;
/** 公司邮箱 */
@Excel(name = "公司邮箱")
private String companyEmail;
/** 注册省份 */
@Excel(name = "注册省份")
private String registeredProvince;
/** 注册城市 */
@Excel(name = "注册城市")
private String registeredCity;
/** 注册区县 */
@Excel(name = "注册区县")
private String registeredDistrict;
/** 注册详细地址 */
@Excel(name = "注册详细地址")
private String registeredAddressDetail;
/** 营业执照图片URL(当前存服务器本地相对路径,后续可切换对象存储) */
private String businessLicenseUrl;
/** 其他附件(文件相对路径逗号分隔,后续可切换对象存储) */
private String attachmentIds;
/** 删除标记(0正常 2删除) */
private String delFlag;
}
@@ -0,0 +1,98 @@
package com.bms.customer.supplierinfo.domain;
import lombok.Data;
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;
/**
* 供应商联系人对象 sup_supplier_contact
*
* @author bms
* @date 2026-09-10
*/
@Data
public class BmsSupplierContact extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 联系人ID */
private Long contactId;
/** 所属供应商ID */
@Excel(name = "供应商ID")
private Long supplierId;
/** 联系人姓名 */
@Excel(name = "联系人姓名")
private String contactName;
/** 职位 */
@Excel(name = "职位")
private String position;
/** 所属部门 */
@Excel(name = "所属部门")
private String department;
/** 手机号 */
@Excel(name = "手机号")
private String phone;
/** 座机 */
@Excel(name = "座机")
private String landline;
/** 电子邮箱 */
@Excel(name = "电子邮箱")
private String email;
/** 微信号 */
@Excel(name = "微信号")
private String wechat;
/** QQ号 */
@Excel(name = "QQ号")
private String qq;
/** 国家/地区 */
@Excel(name = "国家/地区")
private String country;
/** 省份 */
@Excel(name = "省份")
private String province;
/** 城市 */
@Excel(name = "城市")
private String city;
/** 区/县 */
@Excel(name = "区/县")
private String district;
/** 联系详细地址 */
@Excel(name = "联系详细地址")
private String contactAddress;
/** 邮政编码 */
@Excel(name = "邮政编码")
private String postalCode;
/** 是否默认联系人(0否 1是) */
@Excel(name = "是否默认联系人", readConverterExp = "0=否,1=是")
private String isDefault;
/** 联系人类型(0业务联系人 1财务联系人 2紧急联系人 3其他) */
@Excel(name = "联系人类型", readConverterExp = "0=业务联系人,1=财务联系人,2=紧急联系人,3=其他")
private String contactType;
/** 排序 */
@Excel(name = "排序")
private Integer sortOrder;
/** 删除标记(0正常 2删除) */
private String delFlag;
}
@@ -0,0 +1,85 @@
package com.bms.customer.supplierinfo.mapper;
import java.util.List;
import com.bms.customer.supplierinfo.domain.BmsSupplier;
import com.bms.customer.supplierinfo.domain.BmsSupplierAttachment;
import com.bms.customer.supplierinfo.domain.BmsSupplierCompany;
import com.bms.customer.supplierinfo.domain.BmsSupplierContact;
/**
* 供应商主Mapper接口
*
* @author bms
* @date 2026-09-09
*/
public interface BmsSupplierMapper
{
/** 查询供应商 */
public BmsSupplier selectBmsSupplierBySupplierId(Long supplierId);
/** 查询供应商列表 */
public List<BmsSupplier> selectBmsSupplierList(BmsSupplier bmsSupplier);
/** 新增供应商 */
public int insertBmsSupplier(BmsSupplier bmsSupplier);
/** 修改供应商 */
public int updateBmsSupplier(BmsSupplier bmsSupplier);
/** 删除供应商 */
public int deleteBmsSupplierBySupplierId(Long supplierId);
/** 批量删除供应商 */
public int deleteBmsSupplierBySupplierIds(Long[] supplierIds);
/** 查询供应商附件列表 */
public List<BmsSupplierAttachment> selectBmsSupplierAttachmentList(BmsSupplierAttachment bmsSupplierAttachment);
/** 新增供应商附件 */
public int insertBmsSupplierAttachment(BmsSupplierAttachment bmsSupplierAttachment);
/** 修改供应商附件 */
public int updateBmsSupplierAttachment(BmsSupplierAttachment bmsSupplierAttachment);
/** 按供应商ID删除附件(逻辑删除) */
public int deleteBmsSupplierAttachmentBySupplierId(Long supplierId);
/** 按附件ID删除(逻辑删除) */
public int deleteBmsSupplierAttachmentByAttachmentId(Long attachmentId);
/** 查询供应商公司主体列表 */
public List<BmsSupplierCompany> selectBmsSupplierCompanyList(BmsSupplierCompany bmsSupplierCompany);
/** 按ID查询供应商公司主体 */
public BmsSupplierCompany selectBmsSupplierCompanyByCompanyId(Long companyId);
/** 新增供应商公司主体 */
public int insertBmsSupplierCompany(BmsSupplierCompany bmsSupplierCompany);
/** 修改供应商公司主体 */
public int updateBmsSupplierCompany(BmsSupplierCompany bmsSupplierCompany);
/** 按供应商ID删除公司主体(逻辑删除) */
public int deleteBmsSupplierCompanyBySupplierId(Long supplierId);
/** 按公司ID删除(逻辑删除) */
public int deleteBmsSupplierCompanyByCompanyId(Long companyId);
/** 查询供应商联系人列表 */
public List<BmsSupplierContact> selectBmsSupplierContactList(BmsSupplierContact bmsSupplierContact);
/** 按ID查询供应商联系人 */
public BmsSupplierContact selectBmsSupplierContactByContactId(Long contactId);
/** 新增供应商联系人 */
public int insertBmsSupplierContact(BmsSupplierContact bmsSupplierContact);
/** 修改供应商联系人 */
public int updateBmsSupplierContact(BmsSupplierContact bmsSupplierContact);
/** 按供应商ID删除联系人(逻辑删除) */
public int deleteBmsSupplierContactBySupplierId(Long supplierId);
/** 按联系人ID删除(逻辑删除) */
public int deleteBmsSupplierContactByContactId(Long contactId);
}
@@ -0,0 +1,79 @@
package com.bms.customer.supplierinfo.service;
import java.util.List;
import com.bms.customer.supplierinfo.domain.BmsSupplier;
import com.bms.customer.supplierinfo.domain.BmsSupplierAttachment;
import com.bms.customer.supplierinfo.domain.BmsSupplierCompany;
import com.bms.customer.supplierinfo.domain.BmsSupplierContact;
/**
* 供应商主Service接口
*
* @author bms
* @date 2026-09-09
*/
public interface IBmsSupplierService
{
/** 查询供应商 */
public BmsSupplier selectBmsSupplierBySupplierId(Long supplierId);
/** 查询供应商列表 */
public List<BmsSupplier> selectBmsSupplierList(BmsSupplier bmsSupplier);
/** 新增供应商 */
public int insertBmsSupplier(BmsSupplier bmsSupplier);
/** 修改供应商 */
public int updateBmsSupplier(BmsSupplier bmsSupplier);
/** 批量删除供应商 */
public int deleteBmsSupplierBySupplierIds(Long[] supplierIds);
/** 删除供应商 */
public int deleteBmsSupplierBySupplierId(Long supplierId);
/** 查询供应商附件列表 */
public List<BmsSupplierAttachment> selectBmsSupplierAttachmentList(BmsSupplierAttachment attachment);
/** 按供应商ID删除附件 */
public int deleteBmsSupplierAttachmentBySupplierId(Long supplierId);
/** 批量保存供应商附件(随主表提交时调用) */
public void saveBmsSupplierAttachments(Long supplierId, List<BmsSupplierAttachment> attachmentList);
/** 查询供应商公司主体列表 */
public List<BmsSupplierCompany> selectBmsSupplierCompanyList(BmsSupplierCompany company);
/** 按ID查询供应商公司主体 */
public BmsSupplierCompany selectBmsSupplierCompanyByCompanyId(Long companyId);
/** 新增供应商公司主体(独立接口,用于子表新增按钮) */
public int insertBmsSupplierCompany(BmsSupplierCompany bmsSupplierCompany);
/** 修改供应商公司主体 */
public int updateBmsSupplierCompany(BmsSupplierCompany bmsSupplierCompany);
/** 删除供应商公司主体 */
public int deleteBmsSupplierCompanyByCompanyIds(Long[] companyIds);
/** 批量保存供应商公司主体(随主表提交时调用) */
public void saveBmsSupplierCompanies(Long supplierId, List<BmsSupplierCompany> companyList);
/** 查询供应商联系人列表 */
public List<BmsSupplierContact> selectBmsSupplierContactList(BmsSupplierContact bmsSupplierContact);
/** 按ID查询供应商联系人 */
public BmsSupplierContact selectBmsSupplierContactByContactId(Long contactId);
/** 新增供应商联系人(独立接口,用于子表新增按钮) */
public int insertBmsSupplierContact(BmsSupplierContact bmsSupplierContact);
/** 修改供应商联系人 */
public int updateBmsSupplierContact(BmsSupplierContact bmsSupplierContact);
/** 删除供应商联系人 */
public int deleteBmsSupplierContactByContactIds(Long[] contactIds);
/** 批量保存供应商联系人(随主表提交时调用) */
public void saveBmsSupplierContacts(Long supplierId, List<BmsSupplierContact> contactList);
}
@@ -0,0 +1,312 @@
package com.bms.customer.supplierinfo.service.impl;
import java.util.List;
import com.bms.common.annotation.DataScope;
import com.bms.common.core.domain.entity.SysUser;
import com.bms.common.utils.DateUtils;
import com.bms.common.utils.SecurityUtils;
import com.bms.customer.supplierinfo.domain.BmsSupplier;
import com.bms.customer.supplierinfo.domain.BmsSupplierAttachment;
import com.bms.customer.supplierinfo.domain.BmsSupplierCompany;
import com.bms.customer.supplierinfo.domain.BmsSupplierContact;
import com.bms.customer.supplierinfo.mapper.BmsSupplierMapper;
import com.bms.customer.supplierinfo.service.IBmsSupplierService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
* 供应商主Service业务层处理
*
* @author bms
* @date 2026-09-09
*/
@Service
public class BmsSupplierServiceImpl implements IBmsSupplierService
{
@Autowired
private BmsSupplierMapper bmsSupplierMapper;
@Override
public BmsSupplier selectBmsSupplierBySupplierId(Long supplierId)
{
BmsSupplier bmsSupplier = bmsSupplierMapper.selectBmsSupplierBySupplierId(supplierId);
if (bmsSupplier != null)
{
BmsSupplierAttachment attachQuery = new BmsSupplierAttachment();
attachQuery.setSupplierId(supplierId);
bmsSupplier.setAttachmentList(bmsSupplierMapper.selectBmsSupplierAttachmentList(attachQuery));
BmsSupplierCompany companyQuery = new BmsSupplierCompany();
companyQuery.setSupplierId(supplierId);
bmsSupplier.setCompanyList(bmsSupplierMapper.selectBmsSupplierCompanyList(companyQuery));
BmsSupplierContact contactQuery = new BmsSupplierContact();
contactQuery.setSupplierId(supplierId);
bmsSupplier.setContactList(bmsSupplierMapper.selectBmsSupplierContactList(contactQuery));
}
return bmsSupplier;
}
@Override
@DataScope(deptAlias = "su", deptField = "dept_id", userAlias = "s", userField = "purchaser_user_id")
public List<BmsSupplier> selectBmsSupplierList(BmsSupplier bmsSupplier)
{
return bmsSupplierMapper.selectBmsSupplierList(bmsSupplier);
}
@Override
public List<BmsSupplierAttachment> selectBmsSupplierAttachmentList(BmsSupplierAttachment attachment)
{
return bmsSupplierMapper.selectBmsSupplierAttachmentList(attachment);
}
@Override
public int deleteBmsSupplierAttachmentBySupplierId(Long supplierId)
{
return bmsSupplierMapper.deleteBmsSupplierAttachmentBySupplierId(supplierId);
}
@Override
public void saveBmsSupplierAttachments(Long supplierId, List<BmsSupplierAttachment> attachmentList)
{
if (attachmentList == null || attachmentList.isEmpty())
{
return;
}
SysUser user = SecurityUtils.getLoginUser().getUser();
for (BmsSupplierAttachment item : attachmentList)
{
item.setSupplierId(supplierId);
if (item.getDelFlag() == null)
{
item.setDelFlag("0");
}
if (item.getAttachmentId() != null)
{
item.setUpdateBy(user.getUserName());
item.setUpdateTime(DateUtils.getNowDate());
bmsSupplierMapper.updateBmsSupplierAttachment(item);
}
else
{
item.setCreateBy(user.getUserName());
item.setCreateTime(DateUtils.getNowDate());
bmsSupplierMapper.insertBmsSupplierAttachment(item);
}
}
}
@Override
public List<BmsSupplierCompany> selectBmsSupplierCompanyList(BmsSupplierCompany company)
{
return bmsSupplierMapper.selectBmsSupplierCompanyList(company);
}
@Override
public BmsSupplierCompany selectBmsSupplierCompanyByCompanyId(Long companyId)
{
return bmsSupplierMapper.selectBmsSupplierCompanyByCompanyId(companyId);
}
@Override
public int insertBmsSupplierCompany(BmsSupplierCompany bmsSupplierCompany)
{
SysUser user = SecurityUtils.getLoginUser().getUser();
bmsSupplierCompany.setCreateBy(user.getUserName());
bmsSupplierCompany.setCreateTime(DateUtils.getNowDate());
if (bmsSupplierCompany.getDelFlag() == null)
{
bmsSupplierCompany.setDelFlag("0");
}
return bmsSupplierMapper.insertBmsSupplierCompany(bmsSupplierCompany);
}
@Override
public int updateBmsSupplierCompany(BmsSupplierCompany bmsSupplierCompany)
{
SysUser user = SecurityUtils.getLoginUser().getUser();
bmsSupplierCompany.setUpdateBy(user.getUserName());
bmsSupplierCompany.setUpdateTime(DateUtils.getNowDate());
return bmsSupplierMapper.updateBmsSupplierCompany(bmsSupplierCompany);
}
@Override
public int deleteBmsSupplierCompanyByCompanyIds(Long[] companyIds)
{
int rows = 0;
for (Long companyId : companyIds)
{
rows += bmsSupplierMapper.deleteBmsSupplierCompanyByCompanyId(companyId);
}
return rows;
}
@Override
public void saveBmsSupplierCompanies(Long supplierId, List<BmsSupplierCompany> companyList)
{
if (companyList == null || companyList.isEmpty())
{
return;
}
SysUser user = SecurityUtils.getLoginUser().getUser();
for (BmsSupplierCompany item : companyList)
{
item.setSupplierId(supplierId);
if (item.getDelFlag() == null)
{
item.setDelFlag("0");
}
if (item.getCompanyId() != null)
{
item.setUpdateBy(user.getUserName());
item.setUpdateTime(DateUtils.getNowDate());
bmsSupplierMapper.updateBmsSupplierCompany(item);
}
else
{
item.setCreateBy(user.getUserName());
item.setCreateTime(DateUtils.getNowDate());
bmsSupplierMapper.insertBmsSupplierCompany(item);
}
}
}
@Override
public List<BmsSupplierContact> selectBmsSupplierContactList(BmsSupplierContact bmsSupplierContact)
{
return bmsSupplierMapper.selectBmsSupplierContactList(bmsSupplierContact);
}
@Override
public BmsSupplierContact selectBmsSupplierContactByContactId(Long contactId)
{
return bmsSupplierMapper.selectBmsSupplierContactByContactId(contactId);
}
@Override
public int insertBmsSupplierContact(BmsSupplierContact bmsSupplierContact)
{
SysUser user = SecurityUtils.getLoginUser().getUser();
bmsSupplierContact.setCreateBy(user.getUserName());
bmsSupplierContact.setCreateTime(DateUtils.getNowDate());
if (bmsSupplierContact.getDelFlag() == null)
{
bmsSupplierContact.setDelFlag("0");
}
return bmsSupplierMapper.insertBmsSupplierContact(bmsSupplierContact);
}
@Override
public int updateBmsSupplierContact(BmsSupplierContact bmsSupplierContact)
{
SysUser user = SecurityUtils.getLoginUser().getUser();
bmsSupplierContact.setUpdateBy(user.getUserName());
bmsSupplierContact.setUpdateTime(DateUtils.getNowDate());
return bmsSupplierMapper.updateBmsSupplierContact(bmsSupplierContact);
}
@Override
public int deleteBmsSupplierContactByContactIds(Long[] contactIds)
{
int rows = 0;
for (Long contactId : contactIds)
{
rows += bmsSupplierMapper.deleteBmsSupplierContactByContactId(contactId);
}
return rows;
}
@Override
public void saveBmsSupplierContacts(Long supplierId, List<BmsSupplierContact> contactList)
{
if (contactList == null || contactList.isEmpty())
{
return;
}
SysUser user = SecurityUtils.getLoginUser().getUser();
for (BmsSupplierContact item : contactList)
{
item.setSupplierId(supplierId);
if (item.getDelFlag() == null)
{
item.setDelFlag("0");
}
if (item.getContactId() != null)
{
item.setUpdateBy(user.getUserName());
item.setUpdateTime(DateUtils.getNowDate());
bmsSupplierMapper.updateBmsSupplierContact(item);
}
else
{
item.setCreateBy(user.getUserName());
item.setCreateTime(DateUtils.getNowDate());
bmsSupplierMapper.insertBmsSupplierContact(item);
}
}
}
@Transactional(rollbackFor = Exception.class)
@Override
public int insertBmsSupplier(BmsSupplier bmsSupplier)
{
SysUser user = SecurityUtils.getLoginUser().getUser();
bmsSupplier.setCreateTime(DateUtils.getNowDate());
bmsSupplier.setCreateBy(user.getUserName());
int rows = bmsSupplierMapper.insertBmsSupplier(bmsSupplier);
if (rows > 0)
{
saveBmsSupplierAttachments(bmsSupplier.getSupplierId(), bmsSupplier.getAttachmentList());
saveBmsSupplierCompanies(bmsSupplier.getSupplierId(), bmsSupplier.getCompanyList());
saveBmsSupplierContacts(bmsSupplier.getSupplierId(), bmsSupplier.getContactList());
}
return rows;
}
@Transactional(rollbackFor = Exception.class)
@Override
public int updateBmsSupplier(BmsSupplier bmsSupplier)
{
SysUser user = SecurityUtils.getLoginUser().getUser();
bmsSupplier.setUpdateTime(DateUtils.getNowDate());
bmsSupplier.setUpdateBy(user.getUserName());
// 附件先逻辑删除再重建(全量替换)
bmsSupplierMapper.deleteBmsSupplierAttachmentBySupplierId(bmsSupplier.getSupplierId());
if (bmsSupplier.getAttachmentList() != null)
{
for (BmsSupplierAttachment item : bmsSupplier.getAttachmentList())
{
item.setAttachmentId(null);
}
saveBmsSupplierAttachments(bmsSupplier.getSupplierId(), bmsSupplier.getAttachmentList());
}
// 公司主体采用增量 upsert
saveBmsSupplierCompanies(bmsSupplier.getSupplierId(), bmsSupplier.getCompanyList());
// 联系人采用增量 upsert
saveBmsSupplierContacts(bmsSupplier.getSupplierId(), bmsSupplier.getContactList());
return bmsSupplierMapper.updateBmsSupplier(bmsSupplier);
}
@Transactional(rollbackFor = Exception.class)
@Override
public int deleteBmsSupplierBySupplierIds(Long[] supplierIds)
{
for (Long supplierId : supplierIds)
{
bmsSupplierMapper.deleteBmsSupplierAttachmentBySupplierId(supplierId);
bmsSupplierMapper.deleteBmsSupplierCompanyBySupplierId(supplierId);
bmsSupplierMapper.deleteBmsSupplierContactBySupplierId(supplierId);
}
return bmsSupplierMapper.deleteBmsSupplierBySupplierIds(supplierIds);
}
@Transactional(rollbackFor = Exception.class)
@Override
public int deleteBmsSupplierBySupplierId(Long supplierId)
{
bmsSupplierMapper.deleteBmsSupplierAttachmentBySupplierId(supplierId);
bmsSupplierMapper.deleteBmsSupplierCompanyBySupplierId(supplierId);
bmsSupplierMapper.deleteBmsSupplierContactBySupplierId(supplierId);
return bmsSupplierMapper.deleteBmsSupplierBySupplierId(supplierId);
}
}