Browse Source

[fix]

修改客户基本信息的后端mapper.xml文件,所有方法加上修改时间:update_time字段
修改新增客户基本信息后端接口:加上对修改记录表格的处理
修改客户基本信息修改后端接口:加上对修改记录表格的处理、加上异常处理
修复客户基本信息前端表的标题和内容对不齐的bug:去掉外联CSS样式;去掉table的消除空格的样式;去掉多余的隐藏了的字段,保持页面整洁;所有前端列表字段加上居中对齐的关键字
修改客户基本信息列表页面表头的按钮,按钮采用统一样式;新增操作栏,操作栏引用$.table.dropdownToggle方法,去掉按钮自带的样式;送货地址和公司地址引用$.table.tooltip方法,隐藏部分内容
全局业务模块常量BusinessKeysConstants新增客户基本信息SYS_CUSTOMER = "3"
修改公共的FieldCompareUtil工具类,进行优化,使其能识别系统中例如:一个字典的值,1代表销售订单、2代表生产订单、3代表采购订单这种数据:新增codeToNameMap方法构成字典映射和修改 formatValue方法加上对codeToNameMap 的处理逻辑,以将编码转换为对应的中文名称。
按照客户基本信息修改页面:客户基本信息实体类只要是需要修改的字段都加上,@FieldCompare注解用于标识;并且如果是字典值采用例如:@FieldCompare(chineseName = "客户标识",properties = "1:潜在客户,2:客户")这种方式标明
客户基本信息所有字典值都加上对应字典数据的备注
客户基本信息前端页面:新增双击上次修改时间打开修改记录数据页面的方法,上次修改时间字段加上颜色标注
dev
liuxiaoxu 1 month ago
parent
commit
98de9d8608
  1. 72
      ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysCustomer.java
  2. 1
      ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysCustomerService.java
  3. 39
      ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysCustomerServiceImpl.java
  4. 7
      ruoyi-admin/src/main/resources/mapper/system/SysCustomerMapper.xml
  5. 181
      ruoyi-admin/src/main/resources/templates/system/customer/customer.html
  6. 3
      ruoyi-common/src/main/java/com/ruoyi/common/constant/BusinessKeysConstants.java
  7. 44
      ruoyi-common/src/main/java/com/ruoyi/common/utils/FieldCompareUtil.java

72
ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysCustomer.java

@ -1,6 +1,7 @@
package com.ruoyi.system.domain; package com.ruoyi.system.domain;
import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.annotation.FieldCompare;
import com.ruoyi.common.core.domain.BaseEntity; import com.ruoyi.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
@ -24,123 +25,179 @@ public class SysCustomer extends BaseEntity
private Long id; private Long id;
/** 客户/企业代码 */ /** 客户/企业代码 */
@FieldCompare(chineseName = "客户/企业代码")
@Excel(name = "客户/企业ID") @Excel(name = "客户/企业ID")
private String enterpriseCode; private String enterpriseCode;
/** 客户/企业名称 */ /** 客户/企业名称 */
@FieldCompare(chineseName = "客户/企业名称")
@Excel(name = "客户/企业名称") @Excel(name = "客户/企业名称")
private String enterpriseName; private String enterpriseName;
/** 英文名称 */ /** 英文名称 */
@FieldCompare(chineseName = "英文名称")
@Excel(name = "英文名称") @Excel(name = "英文名称")
private String englishName; private String englishName;
/** 客户简称 */ /** 客户简称 */
@FieldCompare(chineseName = "客户简称")
@Excel(name = "客户简称") @Excel(name = "客户简称")
private String customerAbbreviation; private String customerAbbreviation;
/** 事业部 */ /** 事业部 */
@FieldCompare(chineseName = "事业部")
@Excel(name = "事业部") @Excel(name = "事业部")
private String customerPurser; private String customerPurser;
/** 内外销 */ /** 内外销(1外销、2内销) */
@FieldCompare(chineseName = "内外销",properties = "1:外销,2:内销")
@Excel(name = "内外销") @Excel(name = "内外销")
private String exportSales; private String exportSales;
/** 国家地区 */ /** 国家地区(1中国、2美国、3俄罗斯) */
@FieldCompare(chineseName = "国家地区",properties = "1:中国,2:美国,3:俄罗斯")
@Excel(name = "国家地区") @Excel(name = "国家地区")
private String customerCountry; private String customerCountry;
/** 邮编 */ /** 邮编 */
@FieldCompare(chineseName = "邮编")
@Excel(name = "邮编") @Excel(name = "邮编")
private String postalCode; private String postalCode;
/** 公司地址 */ /** 公司地址 */
@FieldCompare(chineseName = "公司地址")
@Excel(name = "公司地址") @Excel(name = "公司地址")
private String customerAddress; private String customerAddress;
/** 法人代表 */ /** 法人代表 */
@FieldCompare(chineseName = "法人代表")
@Excel(name = "法人代表") @Excel(name = "法人代表")
private String legalRepresentative; private String legalRepresentative;
/** 成立日期 */ /** 成立日期 */
@FieldCompare(chineseName = "成立日期")
@Excel(name = "成立日期") @Excel(name = "成立日期")
private String establishedTime; private String establishedTime;
/** 开票表编号 */ /** 开票表编号 */
@Excel(name = "开票客户名称") @Excel(name = "开票客户名称")
private String invoicingCustomerName; private String invoicingCustomerName;
/** 开票公司名称 */ /** 开票公司名称 */
@FieldCompare(chineseName = "开票公司名称")
@Excel(name = "开票公司名称") @Excel(name = "开票公司名称")
private String invoicingCompanyName; private String invoicingCompanyName;
/** 开票公司税号代码 */ /** 开票公司税号代码 */
@FieldCompare(chineseName = "开票公司税号")
@Excel(name = "开票公司税号") @Excel(name = "开票公司税号")
private String invoiceCode; private String invoiceCode;
/** 开户银行 */ /** 开户银行 */
@FieldCompare(chineseName = "开户银行")
@Excel(name = "开户银行") @Excel(name = "开户银行")
private String depositBank; private String depositBank;
/** 开户银行账号 */ /** 开户银行账号 */
@FieldCompare(chineseName = "开户银行账号")
@Excel(name = "开户银行账号") @Excel(name = "开户银行账号")
private String bankAccount; private String bankAccount;
/** 常用币种 */
/** 报价币种(1RMB、2美元) */
@FieldCompare(chineseName = "报价币种",properties = "1:RMB,2:美元")
@Excel(name = "报价币种") @Excel(name = "报价币种")
private String commonCurrency; private String commonCurrency;
/** 是否含税 */ /** 是否含税(0不含税、1含税) */
@FieldCompare(chineseName = "是否含税",properties = "0:不含税,1:含税")
@Excel(name = "是否含税") @Excel(name = "是否含税")
private String confirmTax; private String confirmTax;
/** 税率 */ /** 税率 */
@FieldCompare(chineseName = "税率")
@Excel(name = "税率") @Excel(name = "税率")
private Double taxRate; private Double taxRate;
/** 诚信评级 */ /** 诚信评级(1A、2B、3C、4D) */
@FieldCompare(chineseName = "诚信评级",properties = "1:A,2:B,3:C,4:D")
@Excel(name = "诚信评级") @Excel(name = "诚信评级")
private String integrityRating; private String integrityRating;
/** RMB注册资金 */ /** RMB注册资金 */
@FieldCompare(chineseName = "RMB注册资金")
@Excel(name = "RMB注册资金") @Excel(name = "RMB注册资金")
private String rmbRegisteredCapital; private String rmbRegisteredCapital;
/** 外币注册资金 */ /** 外币注册资金 */
@FieldCompare(chineseName = "外币注册资金")
@Excel(name = "外币注册资金") @Excel(name = "外币注册资金")
private String registeredCapital; private String registeredCapital;
/** 付款条件 */ /** 付款条件 */
@FieldCompare(chineseName = "付款条件")
@Excel(name = "付款条件") @Excel(name = "付款条件")
private String paymentTerms; private String paymentTerms;
/** 海关代码 */ /** 海关代码 */
@FieldCompare(chineseName = "海关代码")
@Excel(name = "海关代码") @Excel(name = "海关代码")
private String customsCode; private String customsCode;
/*客户第一联系人id*/ /*客户第一联系人id*/
private Long customerContactId; private Long customerContactId;
/** 客户第一联系人 */ /** 客户第一联系人 */
@FieldCompare(chineseName = "客户第一联系人")
@Excel(name = "客户第一联系人") @Excel(name = "客户第一联系人")
private String customerContact; private String customerContact;
/** 客户第一联系人职务 */ /** 客户第一联系人职务 */
@FieldCompare(chineseName = "客户第一联系人职务")
@Excel(name = "客户第一联系人职务") @Excel(name = "客户第一联系人职务")
private String customerOffice; private String customerOffice;
/** 客户第一联系人电话 */ /** 客户第一联系人电话 */
@FieldCompare(chineseName = "客户第一联系人电话")
@Excel(name = "客户第一联系人电话") @Excel(name = "客户第一联系人电话")
private String contactNumber; private String contactNumber;
/** 客户第一联系人邮箱 */ /** 客户第一联系人邮箱 */
@FieldCompare(chineseName = "客户第一联系人邮箱")
@Excel(name = "客户第一联系人邮箱") @Excel(name = "客户第一联系人邮箱")
private String customerEmail; private String customerEmail;
/** 客户第一联系人传真 */ /** 客户第一联系人传真 */
@FieldCompare(chineseName = "客户第一联系人传真")
@Excel(name = "客户第一联系人传真") @Excel(name = "客户第一联系人传真")
private String customerFax; private String customerFax;
/** 客户第一联系人 */
@Excel(name = "客户第一收货人id") @Excel(name = "客户第一收货人id")
private Long deliveryAddressId; private Long deliveryAddressId;
/** 客户第一联系人 */
/** 客户第一收货人 */
@FieldCompare(chineseName = "客户第一收货人")
@Excel(name = "客户第一收货人") @Excel(name = "客户第一收货人")
private String deliveryCustomerPerson; private String deliveryCustomerPerson;
@Excel(name = "客户第一收货人职务")
private String deliveryCustomerOffice;
@FieldCompare(chineseName = "客户第一收货人联系电话")
@Excel(name = "客户第一收货人联系电话") @Excel(name = "客户第一收货人联系电话")
private String deliveryCustomerPhone; private String deliveryCustomerPhone;
/** 客户第一收货人地址 */ /** 客户第一收货人地址 */
@FieldCompare(chineseName = "客户第一收货人地址")
@Excel(name = "客户第一收货人地址") @Excel(name = "客户第一收货人地址")
private String deliveryAddress; private String deliveryAddress;
@FieldCompare(chineseName = "客户第一收货人邮编")
@Excel(name = "客户第一收货人邮编") @Excel(name = "客户第一收货人邮编")
private String deliveryCustomerPostal; private String deliveryCustomerPostal;
@FieldCompare(chineseName = "客户第一收货人传真")
@Excel(name = "客户第一收货人传真") @Excel(name = "客户第一收货人传真")
private String deliveryCustomerFax; private String deliveryCustomerFax;
@ -170,6 +227,7 @@ public class SysCustomer extends BaseEntity
private String useStatus; private String useStatus;
//1表示潜在客户(仅报价) 2表示 客户(已下单) //1表示潜在客户(仅报价) 2表示 客户(已下单)
@FieldCompare(chineseName = "客户标识",properties = "1:潜在客户,2:客户")
@Excel(name = "客户标识",dictType = "sys_customer_sign") @Excel(name = "客户标识",dictType = "sys_customer_sign")
private String customerSign; private String customerSign;

1
ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysCustomerService.java

@ -93,7 +93,6 @@ public interface ISysCustomerService
public ProcessInstance submitApply(SysCustomer sysCustomer); public ProcessInstance submitApply(SysCustomer sysCustomer);
@Transactional(rollbackFor = Exception.class)
int updateSysCustomerVo(SysCustomer sysCustomer); int updateSysCustomerVo(SysCustomer sysCustomer);
CustomerDto selectCustomerDtoByEnterpriseCode(String customerId); CustomerDto selectCustomerDtoByEnterpriseCode(String customerId);

39
ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysCustomerServiceImpl.java

@ -2,12 +2,16 @@ package com.ruoyi.system.service.impl;
import com.github.pagehelper.Page; import com.github.pagehelper.Page;
import com.ruoyi.aftersales.domain.dto.CustomerDto; import com.ruoyi.aftersales.domain.dto.CustomerDto;
import com.ruoyi.common.constant.BusinessKeysConstants;
import com.ruoyi.common.core.domain.entity.SysFieldDifferent;
import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.page.PageDomain; import com.ruoyi.common.core.page.PageDomain;
import com.ruoyi.common.core.page.TableSupport; import com.ruoyi.common.core.page.TableSupport;
import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.core.text.Convert; import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.exception.BusinessException;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.FieldCompareUtil;
import com.ruoyi.common.utils.ShiroUtils; import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.process.general.service.IProcessService; import com.ruoyi.process.general.service.IProcessService;
@ -17,8 +21,10 @@ import com.ruoyi.system.mapper.SysCustomerMapper;
import com.ruoyi.system.mapper.SysInvoiceMapper; import com.ruoyi.system.mapper.SysInvoiceMapper;
import com.ruoyi.system.mapper.SysUserMapper; import com.ruoyi.system.mapper.SysUserMapper;
import com.ruoyi.system.service.ISysCustomerService; import com.ruoyi.system.service.ISysCustomerService;
import com.ruoyi.system.service.ISysDiffLogService;
import com.ruoyi.system.service.ISysInvoiceService; import com.ruoyi.system.service.ISysInvoiceService;
import com.ruoyi.system.service.ISysRoleService; import com.ruoyi.system.service.ISysRoleService;
import lombok.SneakyThrows;
import org.activiti.engine.TaskService; import org.activiti.engine.TaskService;
import org.activiti.engine.impl.persistence.entity.TaskEntityImpl; import org.activiti.engine.impl.persistence.entity.TaskEntityImpl;
import org.activiti.engine.runtime.ProcessInstance; import org.activiti.engine.runtime.ProcessInstance;
@ -74,6 +80,9 @@ public class SysCustomerServiceImpl implements ISysCustomerService
@Autowired @Autowired
private ISysRoleService roleService; private ISysRoleService roleService;
@Autowired
private ISysDiffLogService diffLogService;
@Override @Override
public SysCustomerVo selectSysCustomerById(Long id) { public SysCustomerVo selectSysCustomerById(Long id) {
SysCustomerVo sysCustomerVo = sysCustomerMapper.selectSysCustomerById(id); SysCustomerVo sysCustomerVo = sysCustomerMapper.selectSysCustomerById(id);
@ -182,6 +191,8 @@ public class SysCustomerServiceImpl implements ISysCustomerService
@Override @Override
public int insertSysCustomer(SysCustomer sysCustomer) public int insertSysCustomer(SysCustomer sysCustomer)
{ {
SysDiffLog sysDiffLog = new SysDiffLog();
String loginName = ShiroUtils.getLoginName(); String loginName = ShiroUtils.getLoginName();
sysCustomer.setCreateBy(loginName); sysCustomer.setCreateBy(loginName);
sysCustomer.setCreateTime(DateUtils.getNowDate()); sysCustomer.setCreateTime(DateUtils.getNowDate());
@ -230,6 +241,15 @@ public class SysCustomerServiceImpl implements ISysCustomerService
// sysInvoiceService.insertSysInvoice(invoice); // sysInvoiceService.insertSysInvoice(invoice);
int result = sysCustomerMapper.insertSysCustomer(sysCustomer); int result = sysCustomerMapper.insertSysCustomer(sysCustomer);
sysCustomer.getCustomerId(); sysCustomer.getCustomerId();
Long id = sysCustomer.getId();
sysDiffLog.setBusinessId(id);
sysDiffLog.setBusinessKey(BusinessKeysConstants.SYS_CUSTOMER);
sysDiffLog.setCreateTime(DateUtils.getNowDate());
sysDiffLog.setCreateBy(loginName);
int insertSysDiffLog = diffLogService.insertSysDiffLog(sysDiffLog);
if (insertSysDiffLog <= 0){
throw new BusinessException("添加客户基本信息修改记录失败");
}
return result; return result;
} }
@ -249,7 +269,7 @@ public class SysCustomerServiceImpl implements ISysCustomerService
@Transactional(rollbackFor = Exception.class) @SneakyThrows
@Override @Override
public int updateSysCustomerVo(SysCustomer sysCustomer){ public int updateSysCustomerVo(SysCustomer sysCustomer){
SysUser user = ShiroUtils.getSysUser(); SysUser user = ShiroUtils.getSysUser();
@ -268,6 +288,20 @@ public class SysCustomerServiceImpl implements ISysCustomerService
}else { }else {
sysCustomer.setUsdFlag("0"); sysCustomer.setUsdFlag("0");
} }
Long id = sysCustomer.getId();
SysCustomer oldSysCustomer = sysCustomerMapper.selectSysCustomerById(id);
if (oldSysCustomer == null){
throw new BusinessException("客户信息不存在");
}
List<SysFieldDifferent> compare = FieldCompareUtil.compare(SysCustomer.class, sysCustomer, oldSysCustomer);
if (!CollectionUtils.isEmpty(compare)){
int updateSysDiffLog = diffLogService.updateSysDiffLogByBusiness(id, BusinessKeysConstants.SYS_CUSTOMER, compare);
if (updateSysDiffLog <= 0){
throw new BusinessException("修改客户信息数据修改记录失败");
}
}
// 启动流程 // 启动流程
return sysCustomerMapper.updateSysCustomer(sysCustomer); return sysCustomerMapper.updateSysCustomer(sysCustomer);
} }
@ -504,6 +538,9 @@ public class SysCustomerServiceImpl implements ISysCustomerService
// 使用状态-是 // 使用状态-是
sysCustomer.setUseStatus("1"); sysCustomer.setUseStatus("1");
} }
sysCustomerMapper.updateSysCustomer(sysCustomer); sysCustomerMapper.updateSysCustomer(sysCustomer);
return processInstance; return processInstance;
} }

7
ruoyi-admin/src/main/resources/mapper/system/SysCustomerMapper.xml

@ -60,6 +60,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="applyUser" column="apply_user" /> <result property="applyUser" column="apply_user" />
<result property="applyTime" column="apply_time" /> <result property="applyTime" column="apply_time" />
<result property="createTime" column="create_time" /> <result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
<result property="rmbFlag" column="rmb_flag" /> <result property="rmbFlag" column="rmb_flag" />
<result property="usdFlag" column="usd_flag" /> <result property="usdFlag" column="usd_flag" />
<result property="cancelRemark" column="cancel_remark" /> <result property="cancelRemark" column="cancel_remark" />
@ -73,7 +74,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
customer_contact_id,customer_contact,customer_office,contact_number,customer_email,customer_fax, customer_contact_id,customer_contact,customer_office,contact_number,customer_email,customer_fax,
delivery_address_id,delivery_customer_person,delivery_customer_phone, delivery_address_id,delivery_customer_person,delivery_customer_phone,
delivery_address,delivery_customer_postal,delivery_customer_fax,business_members, delivery_address,delivery_customer_postal,delivery_customer_fax,business_members,
identifying_people,first_add_time,update_info_time, create_time ,audit_status,use_status,update_by,rmb_flag,usd_flag, cancel_remark, identifying_people,first_add_time,update_info_time, create_time ,audit_status,use_status,update_by, update_time,rmb_flag,usd_flag, cancel_remark,
apply_user,apply_time , instance_id , instance_type from sys_customer apply_user,apply_time , instance_id , instance_type from sys_customer
</sql> </sql>
@ -85,7 +86,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
customer_contact_id,customer_contact,customer_office,contact_number,customer_email,customer_fax, customer_contact_id,customer_contact,customer_office,contact_number,customer_email,customer_fax,
delivery_address_id,delivery_customer_person,delivery_customer_phone, delivery_address_id,delivery_customer_person,delivery_customer_phone,
delivery_address,delivery_customer_postal,delivery_customer_fax,business_members,rmb_flag,usd_flag, delivery_address,delivery_customer_postal,delivery_customer_fax,business_members,rmb_flag,usd_flag,
identifying_people,first_add_time,update_info_time,audit_status,use_status, create_time from identifying_people,first_add_time,update_info_time,audit_status,use_status, create_time,update_time from
sys_customer sys_customer
<where> <where>
and audit_status = '1' and use_status = '1' and audit_status = '1' and use_status = '1'
@ -102,7 +103,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
s.customer_fax,s.delivery_address_id,s.delivery_customer_person,s.delivery_customer_phone,s.delivery_address, s.customer_fax,s.delivery_address_id,s.delivery_customer_person,s.delivery_customer_phone,s.delivery_address,
s.delivery_customer_postal,s.delivery_customer_fax,s.business_members,s.identifying_people,s.first_add_time, s.delivery_customer_postal,s.delivery_customer_fax,s.business_members,s.identifying_people,s.first_add_time,
s.update_info_time,s.audit_status,s.use_status,s.update_by,s.instance_id, s.instance_type,p.dict_value as instance_type_name, s.update_info_time,s.audit_status,s.use_status,s.update_by,s.instance_id, s.instance_type,p.dict_value as instance_type_name,
s.submit_instance_id, s.cancel_instance_id, s.restore_instance_id, s.apply_title, s.apply_user, s.apply_time ,s.create_time,s.rmb_flag,s.usd_flag s.submit_instance_id, s.cancel_instance_id, s.restore_instance_id, s.apply_title, s.apply_user, s.apply_time ,s.create_time,s.update_time ,s.rmb_flag,s.usd_flag
from sys_customer as s from sys_customer as s
left join( left join(
select dict_value,dict_label from sys_dict_data where dict_type = 'processType' select dict_value,dict_label from sys_dict_data where dict_type = 'processType'

181
ruoyi-admin/src/main/resources/templates/system/customer/customer.html

@ -7,49 +7,6 @@
<script type="text/javascript" th:src="@{/js/axios.min.js}"></script> <script type="text/javascript" th:src="@{/js/axios.min.js}"></script>
</head> </head>
<style>
.form-horizontal .form-group {
width: 50%;
}
.base-customer {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}
.base-customer .form-group {
width: 30%;
}
.details-title {
width: 100%;
position: fixed;
font-size: 20px;
padding: 10px 0;
text-align: center;
background-color: #a7b1c2;
color: #FFFFFF;
z-index: 9999;
}
.details-body {
padding-top: 80px;
overflow-y: auto;
max-height: 750px;
}
.hiddenDetailInfo {
display: none;
}
.search-collapse, .select-table {
box-shadow: none;
}
</style>
<body class="gray-bg"> <body class="gray-bg">
<div class="container-div"> <div class="container-div">
<div class="row"> <div class="row">
@ -142,7 +99,7 @@
</div> </div>
<div class="col-sm-12 select-table table-striped"> <div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table" style="white-space:nowrap"></table> <table id="bootstrap-table"></table>
</div> </div>
</div> </div>
</div> </div>
@ -455,8 +412,18 @@
restoreUrl: prefix + "/restore/{id}", restoreUrl: prefix + "/restore/{id}",
modalName: "客户基本信息", modalName: "客户基本信息",
fixedColumns:true, fixedColumns:true,
sortable: true,//开启排序 showFooter: true,
fixedRightNumber:1, fixedRightNumber:1,
sortable: true, // 是否启用排序
sortStable: true, // 设置为 true 将获得稳定的排序
onDblClickCell: function (field,value,row, $element){
var businessId = row.id;
var businessKey = "3";
if (field == 'updateTime'){
var url = ctx + "system/diffLog/getDiffDataList/" + businessId + "/" + businessKey;
$.modal.open("数据修改记录",url);
}
},
columns: [ columns: [
{checkbox: true}, {checkbox: true},
{title: '主键ID',field: 'id',visible: false}, {title: '主键ID',field: 'id',visible: false},
@ -473,6 +440,7 @@
return '<span class="badge badge-primary">' + value + '</span>'; return '<span class="badge badge-primary">' + value + '</span>';
} }
}, },
{title: '业务员',field: 'businessMembers',visible: false},
{ title: '审核状态',field: 'auditStatus', visible: false, { title: '审核状态',field: 'auditStatus', visible: false,
formatter: function (value, row, index) { return $.table.selectDictLabel(auditStatusDatas, value);} formatter: function (value, row, index) { return $.table.selectDictLabel(auditStatusDatas, value);}
}, },
@ -487,96 +455,88 @@
return '<span class="badge badge-primary">' + value + '</span>';} return '<span class="badge badge-primary">' + value + '</span>';}
}, },
{field: 'applyUserName', title: '<span style="color: red;">申请人</span>', {field: 'applyUserName', title: '<span style="color: red;">申请人</span>',align: 'center',
formatter: function(value, row, index) { formatter: function(value, row, index) {
return '<span style="color: red;">' + (value ? value : "-") + '</span>'; return '<span style="color: red;">' + (value ? value : "-") + '</span>';
} }
}, },
{title: '客户ID',field: 'enterpriseCode',align: 'center',},
{title: '客户ID',field: 'enterpriseCode' }, {title: '客户公司名称',field: 'enterpriseName',align: 'center',},
{title: '客户公司名称',field: 'enterpriseName'}, {title: '客户公司简称',field: 'customerAbbreviation',align: 'center',},
{title: '客户公司简称',field: 'customerAbbreviation'}, {title: '英文名称',field: 'englishName',align: 'center',},
{title: '英文名称',field: 'englishName'}, {title: '公司地址',field: 'customerAddress',align: 'center',
{title: '公司地址',field: 'customerAddress'}, formatter: function(value, row, index) {
{title: '送货地址',field: 'deliveryAddress'}, return $.table.tooltip(value,5,"open");
{title: '使用状态',field: 'useStatus', }
},
{title: '送货地址',field: 'deliveryAddress',align: 'center',
formatter: function(value, row, index) {
return $.table.tooltip(value,5,"open");
}
},
{title: '使用状态',field: 'useStatus',align: 'center',
formatter: function (value, row, index) {return $.table.selectDictLabel(useStatusDatas, value);}, formatter: function (value, row, index) {return $.table.selectDictLabel(useStatusDatas, value);},
}, },
{field: 'applyTime',title: '申请时间'}, {field: 'applyTime',title: '申请时间',align: 'center',},
{title: '业务员',field: 'businessMembers',visible: false},
{title: '事业部',field: 'customerPurser'},
{title: '内外销',field: 'exportSales',visible: false, {title: '事业部',field: 'customerPurser',align: 'center',},
formatter: function (value, row, index) {return $.table.selectDictLabel(exportSalesDatas, value);},
},
{title: '邮编',field: 'postalCode',visible: false}, {title: '第一联系人',field: 'customerContact',align: 'center',},
{title: '国家地区',field: 'customerCountry',visible: false, {title: '第一联系人电话',field: 'contactNumber',align: 'center',},
formatter: function (value, row, index) {return $.table.selectDictLabel(customerCountryDatas, value);},
}, {title: '第一联系人传真',field: 'customerFax',align: 'center',},
{title: '国家/地区编号',field: 'countryNumber',visible: false, {title: '第一联系人邮箱',field: 'customerEmail',align: 'center',},
formatter: function (value, row, index) {return $.table.selectDictLabel(countryNumberDatas, value); },
}, {title: '付款条件',field: 'paymentTerms',align: 'center',
{title: '币种',field: 'commonCurrency',visible: false, formatter: function(value, row, index) {
formatter: function (value, row, index) {return $.table.selectDictLabel(commonCurrencyDatas, value);}, return $.table.tooltip(value,5,"open");
}, }
{title: '备注内容',field: 'customerRemarks',visible: false},
{title: '法人代表',field: 'legalRepresentative',visible: false},
{title: '开票客户名称',field: 'invoicingCustomerName',visible: false},
{title: '开票公司名称',field: 'invoicingCompanyName',visible: false},
{title: '诚信评级',field: 'integrityRating',visible: false,
formatter: function (value, row, index) {return $.table.selectDictLabel(integrityRatingDatas, value);},
}, },
{title: '第一联系人id',field: 'customerContactId',visible: false},
{title: '第一联系人',field: 'customerContact'}, {title: '成立日期',field: 'establishedTime',align: 'center',},
{title: '第一联系人电话',field: 'contactNumber'}, {title: '开户银行',field: 'depositBank',align: 'center',},
{title: '第一联系人职务',field: 'customerOffice',visible: false}, {title: '开户银行账号',field: 'bankAccount',align: 'center',},
{title: '第一联系人传真',field: 'customerFax'},
{title: '第一联系人邮箱',field: 'customerEmail'}, {title: '是否含税',field: 'confirmTax',align: 'center',
{title: '海关代码',field: 'customsCode',visible: false},
{title: '付款条件',field: 'paymentTerms'},
{title: '公司税号',field: 'invoiceCode',visible: false},
{title: '成立日期',field: 'establishedTime'},
{title: '开户银行',field: 'depositBank'},
{title: '开户银行账号',field: 'bankAccount'},
{title: 'RMB注册资金',field: 'rmbRegisteredCapital',visible: false},
{title: '外币注册资金',field: 'registeredCapital',visible: false},
{title: '是否含税',field: 'confirmTax',
formatter: function (value, row, index) { formatter: function (value, row, index) {
return $.table.selectDictLabel(confirmTaxDatas, value); return $.table.selectDictLabel(confirmTaxDatas, value);
}, },
}, },
{title: '税率',field: 'taxRate'}, {title: '税率',field: 'taxRate',align: 'center',},
{title: '第一收货人Id',field:'deliveryAddressId',visible: false},
{title: '第一收货人',field:'deliveryCustomerPerson',visible: false}, {title: '客户标识',field:'customerSign',align: 'center',
{title: '第一收货人地址',field: 'deliveryAddress',visible: false},
{title: '第一收货人电话',field: 'deliveryCustomerPhone',visible: false},
{title: '第一收货人邮编',field: 'deliveryCustomerPostal',visible:false},
{title: '第一收货人传真',field: 'deliveryCustomerFax',visible: false},
{title: '客户标识',field:'customerSign',
formatter: function (value, row, index) {return $.table.selectDictLabel(customerSignDatas, value);} formatter: function (value, row, index) {return $.table.selectDictLabel(customerSignDatas, value);}
}, },
{title: '录入时间',field: 'createTime', {title: '录入时间',field: 'createTime',align: 'center',
sortable: true, sortable: true,
}, },
{title: '上次修改时间',field: 'updateTime',}, {title: '上次修改时间',field: 'updateTime',align: 'center',
formatter: function(value, row, index) {
if (value) {
return '<span style="color:#337ab7; cursor: pointer;">' + value + '</span>';
} else {
return value;
}
}
},
{title: '操作',align: 'center', {title: '操作',align: 'center',
formatter: function(value, row, index) { formatter: function(value, row, index) {
var actions = []; var actions = [];
// 审核状态-审核通过 使用状态-是 未发起作废流程 // 审核状态-审核通过 使用状态-是 未发起作废流程
if((row.auditStatus=="1" || row.auditStatus=="2") && !row.cancelInstanceId){ if((row.auditStatus=="1" || row.auditStatus=="2") && !row.cancelInstanceId){
// 作废 // 作废
actions.push('<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="cancel(\'' + row.id + '\')"><i class="fa fa-remove"></i> 作废</a>'); actions.push('<a href="javascript:void(0)" onclick="cancel(\'' + row.id + '\')"><i class="fa fa-remove"></i> 作废</a>');
// 编辑 // 编辑
actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i> 编辑</a> '); actions.push('<a href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i> 编辑</a> ');
}else{ }else{
actions.push('<a class="btn btn-default btn-xs" href="javascript:void(0)" disabled ><i class="fa fa-edit"></i> 编辑</a> '); actions.push('<a href="javascript:void(0)" disabled ><i class="fa fa-edit"></i> 编辑</a> ');
} }
// 已作废 // 已作废
if(row.useStatus=="2" && !row.restoreInstanceId){ if(row.useStatus=="2" && !row.restoreInstanceId){
// 恢复 // 恢复
actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="$.operate.restore(\'' + row.id + '\')"><i class="fa fa-window-restore"></i> 恢复</a> '); actions.push('<a href="javascript:void(0)" onclick="$.operate.restore(\'' + row.id + '\')"><i class="fa fa-window-restore"></i> 恢复</a> ');
} }
//有流程实例id //有流程实例id
if (row.instanceId) { if (row.instanceId) {
@ -585,17 +545,18 @@
var todoUserIdList = row.todoUserId.split(","); var todoUserIdList = row.todoUserId.split(",");
if(todoUserIdList.includes(loginName) || loginName == 'admin'){ if(todoUserIdList.includes(loginName) || loginName == 'admin'){
var nodeName = row.taskName=='驳回调整'?' 调整申请':' 审批'; var nodeName = row.taskName=='驳回调整'?' 调整申请':' 审批';
actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="showVerifyDialog(\'' + prefix + '\',\'' + row.taskId + '\', \'' + row.taskName+"-"+row.instanceTypeName+"申请" + '\')"><i class="fa fa-edit"></i> '+nodeName+'</a> '); actions.push('<a href="javascript:void(0)" onclick="showVerifyDialog(\'' + prefix + '\',\'' + row.taskId + '\', \'' + row.taskName+"-"+row.instanceTypeName+"申请" + '\')"><i class="fa fa-edit"></i> '+nodeName+'</a> ');
} }
} }
// 审批历史 // 审批历史
actions.push('<a class="btn btn-warning btn-xs" href="javascript:void(0)" onclick="showHistoryDialog(\'' + row.instanceId + '\')"><i class="fa fa-list"></i> 审批历史</a> '); actions.push('<a href="javascript:void(0)" onclick="showHistoryDialog(\'' + row.instanceId + '\')"><i class="fa fa-list"></i> 审批历史</a> ');
// 进度查看 // 进度查看
actions.push('<a class="btn btn-info btn-xs" href="javascript:void(0)" onclick="showProcessImgDialog(\'' + row.instanceId + '\')"><i class="fa fa-image"></i> 进度查看</a> '); actions.push('<a href="javascript:void(0)" onclick="showProcessImgDialog(\'' + row.instanceId + '\')"><i class="fa fa-image"></i> 进度查看</a> ');
} }
//详情 //详情
actions.push('<a class="btn btn-primary btn-xs" href="javascript:void(0)" onclick="$.operate.detail(\'' + row.id + '\')"><i class="fa fa-eye"></i> 详情</a> '); actions.push('<a href="javascript:void(0)" onclick="$.operate.detail(\'' + row.id + '\')"><i class="fa fa-eye"></i> 详情</a> ');
return actions.join(''); var actionLinks = actions.join('');
return $.table.dropdownToggle(actionLinks);
} }
} }
], ],

3
ruoyi-common/src/main/java/com/ruoyi/common/constant/BusinessKeysConstants.java

@ -16,4 +16,7 @@ public class BusinessKeysConstants {
/** 仓库信息 */ /** 仓库信息 */
public static final String STOCK_INFO = "2"; public static final String STOCK_INFO = "2";
/** 客户基本信息 */
public static final String SYS_CUSTOMER = "3";
} }

44
ruoyi-common/src/main/java/com/ruoyi/common/utils/FieldCompareUtil.java

@ -20,6 +20,15 @@ import java.util.*;
* */ * */
public class FieldCompareUtil { public class FieldCompareUtil {
/**
* 比较两个对象的变化并记录
*
* @param type 对象的类型
* @param newObject 新对象
* @param oldObject 旧对象
* @return 变更记录列表
* @throws Exception 如果发生异常
*/
/** /**
* 比较两个对象的变化并记录 * 比较两个对象的变化并记录
* *
@ -42,14 +51,9 @@ public class FieldCompareUtil {
Object oldVal = getMethod.invoke(oldObject); Object oldVal = getMethod.invoke(oldObject);
Object newVal = getMethod.invoke(newObject); Object newVal = getMethod.invoke(newObject);
if (!areEqual(oldVal, newVal)) { if (!areEqual(oldVal, newVal)) {
String s1 = formatValue(oldVal); String s1 = formatValue(oldVal, annotation);
String s2 = formatValue(newVal); String s2 = formatValue(newVal, annotation);
String chineseName = annotation.chineseName(); String chineseName = annotation.chineseName();
Map<String, String> codeToNameMap = codeToNameMap(annotation);
if (!codeToNameMap.isEmpty()) {
s1 = codeToNameMap.getOrDefault(s1, s1);
s2 = codeToNameMap.getOrDefault(s2, s2);
}
changeLogFields.add(new SysFieldDifferent(chineseName, s1, s2)); changeLogFields.add(new SysFieldDifferent(chineseName, s1, s2));
} }
} }
@ -57,7 +61,7 @@ public class FieldCompareUtil {
return changeLogFields; return changeLogFields;
} }
//统一处理条件判断 // 统一处理条件判断
private static boolean areEqual(Object oldVal, Object newVal) { private static boolean areEqual(Object oldVal, Object newVal) {
if (oldVal == null && newVal == null) { if (oldVal == null && newVal == null) {
return true; return true;
@ -71,21 +75,26 @@ public class FieldCompareUtil {
return ((Number) oldVal).doubleValue() == ((Number) newVal).doubleValue(); return ((Number) oldVal).doubleValue() == ((Number) newVal).doubleValue();
} else if (oldVal instanceof Enum) { } else if (oldVal instanceof Enum) {
return oldVal.equals(newVal); return oldVal.equals(newVal);
} else if (oldVal instanceof Date) { } else if (oldVal instanceof java.util.Date) {
return oldVal.equals(newVal); return oldVal.equals(newVal);
} else { } else {
return oldVal.equals(newVal); return oldVal.equals(newVal);
} }
} }
//统一处理格式化值 // 统一处理格式化值
private static String formatValue(Object value) { private static String formatValue(Object value, FieldCompare annotation) {
if (value == null) { if (value == null) {
return ""; return "";
} }
Map<String, String> codeToNameMap = codeToNameMap(annotation);
if (!codeToNameMap.isEmpty()) {
return codeToNameMap.getOrDefault(value.toString(), value.toString());
}
if (value instanceof String) { if (value instanceof String) {
return ((String) value).trim(); return ((String) value).trim();
} else if (value instanceof Date) { } else if (value instanceof java.util.Date) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return sdf.format(value); return sdf.format(value);
} else if (value instanceof Number) { } else if (value instanceof Number) {
@ -97,15 +106,10 @@ public class FieldCompareUtil {
} }
} }
// 字典映射 使用方式
/** private static Map<String, String> codeToNameMap(FieldCompare annotation) {
* 字典映射 使用方式:
* @param newAnnotation
* @return
*/
private static Map<String, String> codeToNameMap(FieldCompare newAnnotation) {
Map<String, String> map = new HashMap<>(); Map<String, String> map = new HashMap<>();
String properties = newAnnotation.properties(); String properties = annotation.properties();
if (properties != null && properties.length() > 0) { if (properties != null && properties.length() > 0) {
String[] propertiesArr = properties.split(","); String[] propertiesArr = properties.split(",");
for (String propertie : propertiesArr) { for (String propertie : propertiesArr) {

Loading…
Cancel
Save