From 98de9d8608ef61910cf5126efa934dd3bb65b591 Mon Sep 17 00:00:00 2001 From: liuxiaoxu <1793812695@qq.com> Date: Fri, 25 Oct 2024 16:48:00 +0800 Subject: [PATCH] =?UTF-8?q?[fix]=20=E4=BF=AE=E6=94=B9=E5=AE=A2=E6=88=B7?= =?UTF-8?q?=E5=9F=BA=E6=9C=AC=E4=BF=A1=E6=81=AF=E7=9A=84=E5=90=8E=E7=AB=AF?= =?UTF-8?q?mapper.xml=E6=96=87=E4=BB=B6=EF=BC=8C=E6=89=80=E6=9C=89?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E5=8A=A0=E4=B8=8A=E4=BF=AE=E6=94=B9=E6=97=B6?= =?UTF-8?q?=E9=97=B4=EF=BC=9Aupdate=5Ftime=E5=AD=97=E6=AE=B5=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E6=96=B0=E5=A2=9E=E5=AE=A2=E6=88=B7=E5=9F=BA=E6=9C=AC?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E5=90=8E=E7=AB=AF=E6=8E=A5=E5=8F=A3=EF=BC=9A?= =?UTF-8?q?=E5=8A=A0=E4=B8=8A=E5=AF=B9=E4=BF=AE=E6=94=B9=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E8=A1=A8=E6=A0=BC=E7=9A=84=E5=A4=84=E7=90=86=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E5=AE=A2=E6=88=B7=E5=9F=BA=E6=9C=AC=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=90=8E=E7=AB=AF=E6=8E=A5=E5=8F=A3=EF=BC=9A?= =?UTF-8?q?=E5=8A=A0=E4=B8=8A=E5=AF=B9=E4=BF=AE=E6=94=B9=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E8=A1=A8=E6=A0=BC=E7=9A=84=E5=A4=84=E7=90=86=E3=80=81=E5=8A=A0?= =?UTF-8?q?=E4=B8=8A=E5=BC=82=E5=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=92=AE=E9=87=87=E7=94=A8=E7=BB=9F=E4=B8=80=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=EF=BC=9B=E6=96=B0=E5=A2=9E=E6=93=8D=E4=BD=9C=E6=A0=8F?= =?UTF-8?q?=EF=BC=8C=E6=93=8D=E4=BD=9C=E6=A0=8F=E5=BC=95=E7=94=A8$.table.d?= =?UTF-8?q?ropdownToggle=E6=96=B9=E6=B3=95=EF=BC=8C=E5=8E=BB=E6=8E=89?= =?UTF-8?q?=E6=8C=89=E9=92=AE=E8=87=AA=E5=B8=A6=E7=9A=84=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=EF=BC=9B=E9=80=81=E8=B4=A7=E5=9C=B0=E5=9D=80=E5=92=8C=E5=85=AC?= =?UTF-8?q?=E5=8F=B8=E5=9C=B0=E5=9D=80=E5=BC=95=E7=94=A8$.table.tooltip?= =?UTF-8?q?=E6=96=B9=E6=B3=95=EF=BC=8C=E9=9A=90=E8=97=8F=E9=83=A8=E5=88=86?= =?UTF-8?q?=E5=86=85=E5=AE=B9=20=E5=85=A8=E5=B1=80=E4=B8=9A=E5=8A=A1?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E5=B8=B8=E9=87=8FBusinessKeysConstants?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=AE=A2=E6=88=B7=E5=9F=BA=E6=9C=AC=E4=BF=A1?= =?UTF-8?q?=E6=81=AFSYS=5FCUSTOMER=20=3D=20"3"=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=85=AC=E5=85=B1=E7=9A=84FieldCompareUtil=E5=B7=A5=E5=85=B7?= =?UTF-8?q?=E7=B1=BB=EF=BC=8C=E8=BF=9B=E8=A1=8C=E4=BC=98=E5=8C=96=EF=BC=8C?= =?UTF-8?q?=E4=BD=BF=E5=85=B6=E8=83=BD=E8=AF=86=E5=88=AB=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E4=B8=AD=E4=BE=8B=E5=A6=82=EF=BC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8=A6=81?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=9A=84=E5=AD=97=E6=AE=B5=E9=83=BD=E5=8A=A0?= =?UTF-8?q?=E4=B8=8A=EF=BC=8C@FieldCompare=E6=B3=A8=E8=A7=A3=E7=94=A8?= =?UTF-8?q?=E4=BA=8E=E6=A0=87=E8=AF=86=EF=BC=9B=E5=B9=B6=E4=B8=94=E5=A6=82?= =?UTF-8?q?=E6=9E=9C=E6=98=AF=E5=AD=97=E5=85=B8=E5=80=BC=E9=87=87=E7=94=A8?= =?UTF-8?q?=E4=BE=8B=E5=A6=82=EF=BC=9A@FieldCompare(chineseName=20=3D=20"?= =?UTF-8?q?=E5=AE=A2=E6=88=B7=E6=A0=87=E8=AF=86",properties=20=3D=20"1:?= =?UTF-8?q?=E6=BD=9C=E5=9C=A8=E5=AE=A2=E6=88=B7,2:=E5=AE=A2=E6=88=B7")?= =?UTF-8?q?=E8=BF=99=E7=A7=8D=E6=96=B9=E5=BC=8F=E6=A0=87=E6=98=8E=20?= =?UTF-8?q?=E5=AE=A2=E6=88=B7=E5=9F=BA=E6=9C=AC=E4=BF=A1=E6=81=AF=E6=89=80?= =?UTF-8?q?=E6=9C=89=E5=AD=97=E5=85=B8=E5=80=BC=E9=83=BD=E5=8A=A0=E4=B8=8A?= =?UTF-8?q?=E5=AF=B9=E5=BA=94=E5=AD=97=E5=85=B8=E6=95=B0=E6=8D=AE=E7=9A=84?= =?UTF-8?q?=E5=A4=87=E6=B3=A8=20=E5=AE=A2=E6=88=B7=E5=9F=BA=E6=9C=AC?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E5=89=8D=E7=AB=AF=E9=A1=B5=E9=9D=A2=EF=BC=9A?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=8F=8C=E5=87=BB=E4=B8=8A=E6=AC=A1=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E6=97=B6=E9=97=B4=E6=89=93=E5=BC=80=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E6=95=B0=E6=8D=AE=E9=A1=B5=E9=9D=A2=E7=9A=84?= =?UTF-8?q?=E6=96=B9=E6=B3=95=EF=BC=8C=E4=B8=8A=E6=AC=A1=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E5=AD=97=E6=AE=B5=E5=8A=A0=E4=B8=8A=E9=A2=9C?= =?UTF-8?q?=E8=89=B2=E6=A0=87=E6=B3=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ruoyi/system/domain/SysCustomer.java | 72 ++++++- .../system/service/ISysCustomerService.java | 1 - .../service/impl/SysCustomerServiceImpl.java | 39 +++- .../mapper/system/SysCustomerMapper.xml | 7 +- .../templates/system/customer/customer.html | 181 +++++++----------- .../constant/BusinessKeysConstants.java | 3 + .../ruoyi/common/utils/FieldCompareUtil.java | 44 +++-- 7 files changed, 205 insertions(+), 142 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysCustomer.java b/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysCustomer.java index 12bf1e34..feb73f1a 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysCustomer.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysCustomer.java @@ -1,6 +1,7 @@ package com.ruoyi.system.domain; import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.annotation.FieldCompare; import com.ruoyi.common.core.domain.BaseEntity; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; @@ -24,123 +25,179 @@ public class SysCustomer extends BaseEntity private Long id; /** 客户/企业代码 */ + @FieldCompare(chineseName = "客户/企业代码") @Excel(name = "客户/企业ID") private String enterpriseCode; /** 客户/企业名称 */ + @FieldCompare(chineseName = "客户/企业名称") @Excel(name = "客户/企业名称") private String enterpriseName; + /** 英文名称 */ + @FieldCompare(chineseName = "英文名称") @Excel(name = "英文名称") private String englishName; + /** 客户简称 */ + @FieldCompare(chineseName = "客户简称") @Excel(name = "客户简称") private String customerAbbreviation; /** 事业部 */ + @FieldCompare(chineseName = "事业部") @Excel(name = "事业部") private String customerPurser; - /** 内外销 */ + /** 内外销(1外销、2内销) */ + @FieldCompare(chineseName = "内外销",properties = "1:外销,2:内销") @Excel(name = "内外销") private String exportSales; - /** 国家地区 */ + /** 国家地区(1中国、2美国、3俄罗斯) */ + @FieldCompare(chineseName = "国家地区",properties = "1:中国,2:美国,3:俄罗斯") @Excel(name = "国家地区") private String customerCountry; + /** 邮编 */ + @FieldCompare(chineseName = "邮编") @Excel(name = "邮编") private String postalCode; + /** 公司地址 */ + @FieldCompare(chineseName = "公司地址") @Excel(name = "公司地址") private String customerAddress; + /** 法人代表 */ + @FieldCompare(chineseName = "法人代表") @Excel(name = "法人代表") private String legalRepresentative; + /** 成立日期 */ + @FieldCompare(chineseName = "成立日期") @Excel(name = "成立日期") private String establishedTime; /** 开票表编号 */ @Excel(name = "开票客户名称") private String invoicingCustomerName; + /** 开票公司名称 */ + @FieldCompare(chineseName = "开票公司名称") @Excel(name = "开票公司名称") private String invoicingCompanyName; + + /** 开票公司税号代码 */ + @FieldCompare(chineseName = "开票公司税号") @Excel(name = "开票公司税号") private String invoiceCode; /** 开户银行 */ + @FieldCompare(chineseName = "开户银行") @Excel(name = "开户银行") private String depositBank; /** 开户银行账号 */ + @FieldCompare(chineseName = "开户银行账号") @Excel(name = "开户银行账号") private String bankAccount; - /** 常用币种 */ + + + /** 报价币种(1RMB、2美元) */ + @FieldCompare(chineseName = "报价币种",properties = "1:RMB,2:美元") @Excel(name = "报价币种") private String commonCurrency; - /** 是否含税 */ + /** 是否含税(0不含税、1含税) */ + @FieldCompare(chineseName = "是否含税",properties = "0:不含税,1:含税") @Excel(name = "是否含税") private String confirmTax; /** 税率 */ + @FieldCompare(chineseName = "税率") @Excel(name = "税率") private Double taxRate; - /** 诚信评级 */ + /** 诚信评级(1A、2B、3C、4D) */ + @FieldCompare(chineseName = "诚信评级",properties = "1:A,2:B,3:C,4:D") @Excel(name = "诚信评级") private String integrityRating; /** RMB注册资金 */ + @FieldCompare(chineseName = "RMB注册资金") @Excel(name = "RMB注册资金") private String rmbRegisteredCapital; /** 外币注册资金 */ + @FieldCompare(chineseName = "外币注册资金") @Excel(name = "外币注册资金") private String registeredCapital; + /** 付款条件 */ + @FieldCompare(chineseName = "付款条件") @Excel(name = "付款条件") private String paymentTerms; + /** 海关代码 */ + @FieldCompare(chineseName = "海关代码") @Excel(name = "海关代码") private String customsCode; /*客户第一联系人id*/ private Long customerContactId; + /** 客户第一联系人 */ + @FieldCompare(chineseName = "客户第一联系人") @Excel(name = "客户第一联系人") private String customerContact; + /** 客户第一联系人职务 */ + @FieldCompare(chineseName = "客户第一联系人职务") @Excel(name = "客户第一联系人职务") private String customerOffice; + /** 客户第一联系人电话 */ + @FieldCompare(chineseName = "客户第一联系人电话") @Excel(name = "客户第一联系人电话") private String contactNumber; + /** 客户第一联系人邮箱 */ + @FieldCompare(chineseName = "客户第一联系人邮箱") @Excel(name = "客户第一联系人邮箱") private String customerEmail; + /** 客户第一联系人传真 */ + @FieldCompare(chineseName = "客户第一联系人传真") @Excel(name = "客户第一联系人传真") private String customerFax; - /** 客户第一联系人 */ @Excel(name = "客户第一收货人id") private Long deliveryAddressId; - /** 客户第一联系人 */ + + /** 客户第一收货人 */ + @FieldCompare(chineseName = "客户第一收货人") @Excel(name = "客户第一收货人") private String deliveryCustomerPerson; + + @Excel(name = "客户第一收货人职务") + private String deliveryCustomerOffice; + + @FieldCompare(chineseName = "客户第一收货人联系电话") @Excel(name = "客户第一收货人联系电话") private String deliveryCustomerPhone; + /** 客户第一收货人地址 */ + @FieldCompare(chineseName = "客户第一收货人地址") @Excel(name = "客户第一收货人地址") private String deliveryAddress; + @FieldCompare(chineseName = "客户第一收货人邮编") @Excel(name = "客户第一收货人邮编") private String deliveryCustomerPostal; + @FieldCompare(chineseName = "客户第一收货人传真") @Excel(name = "客户第一收货人传真") private String deliveryCustomerFax; @@ -170,6 +227,7 @@ public class SysCustomer extends BaseEntity private String useStatus; //1表示潜在客户(仅报价) 2表示 客户(已下单) + @FieldCompare(chineseName = "客户标识",properties = "1:潜在客户,2:客户") @Excel(name = "客户标识",dictType = "sys_customer_sign") private String customerSign; diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysCustomerService.java b/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysCustomerService.java index cff3eb4f..b92f35a3 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysCustomerService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysCustomerService.java @@ -93,7 +93,6 @@ public interface ISysCustomerService public ProcessInstance submitApply(SysCustomer sysCustomer); - @Transactional(rollbackFor = Exception.class) int updateSysCustomerVo(SysCustomer sysCustomer); CustomerDto selectCustomerDtoByEnterpriseCode(String customerId); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysCustomerServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysCustomerServiceImpl.java index 98755b4e..9c304744 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysCustomerServiceImpl.java +++ b/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.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.page.PageDomain; import com.ruoyi.common.core.page.TableSupport; import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.core.text.Convert; +import com.ruoyi.common.exception.BusinessException; import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.FieldCompareUtil; import com.ruoyi.common.utils.ShiroUtils; import com.ruoyi.common.utils.StringUtils; 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.SysUserMapper; import com.ruoyi.system.service.ISysCustomerService; +import com.ruoyi.system.service.ISysDiffLogService; import com.ruoyi.system.service.ISysInvoiceService; import com.ruoyi.system.service.ISysRoleService; +import lombok.SneakyThrows; import org.activiti.engine.TaskService; import org.activiti.engine.impl.persistence.entity.TaskEntityImpl; import org.activiti.engine.runtime.ProcessInstance; @@ -74,6 +80,9 @@ public class SysCustomerServiceImpl implements ISysCustomerService @Autowired private ISysRoleService roleService; + @Autowired + private ISysDiffLogService diffLogService; + @Override public SysCustomerVo selectSysCustomerById(Long id) { SysCustomerVo sysCustomerVo = sysCustomerMapper.selectSysCustomerById(id); @@ -182,6 +191,8 @@ public class SysCustomerServiceImpl implements ISysCustomerService @Override public int insertSysCustomer(SysCustomer sysCustomer) { + + SysDiffLog sysDiffLog = new SysDiffLog(); String loginName = ShiroUtils.getLoginName(); sysCustomer.setCreateBy(loginName); sysCustomer.setCreateTime(DateUtils.getNowDate()); @@ -230,6 +241,15 @@ public class SysCustomerServiceImpl implements ISysCustomerService // sysInvoiceService.insertSysInvoice(invoice); int result = sysCustomerMapper.insertSysCustomer(sysCustomer); 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; } @@ -249,7 +269,7 @@ public class SysCustomerServiceImpl implements ISysCustomerService - @Transactional(rollbackFor = Exception.class) + @SneakyThrows @Override public int updateSysCustomerVo(SysCustomer sysCustomer){ SysUser user = ShiroUtils.getSysUser(); @@ -268,6 +288,20 @@ public class SysCustomerServiceImpl implements ISysCustomerService }else { sysCustomer.setUsdFlag("0"); } + + Long id = sysCustomer.getId(); + SysCustomer oldSysCustomer = sysCustomerMapper.selectSysCustomerById(id); + if (oldSysCustomer == null){ + throw new BusinessException("客户信息不存在"); + } + List 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); } @@ -504,6 +538,9 @@ public class SysCustomerServiceImpl implements ISysCustomerService // 使用状态-是 sysCustomer.setUseStatus("1"); } + + + sysCustomerMapper.updateSysCustomer(sysCustomer); return processInstance; } diff --git a/ruoyi-admin/src/main/resources/mapper/system/SysCustomerMapper.xml b/ruoyi-admin/src/main/resources/mapper/system/SysCustomerMapper.xml index f52be75b..03ccc6d0 100644 --- a/ruoyi-admin/src/main/resources/mapper/system/SysCustomerMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/system/SysCustomerMapper.xml @@ -60,6 +60,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -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, delivery_address_id,delivery_customer_person,delivery_customer_phone, 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 @@ -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, delivery_address_id,delivery_customer_person,delivery_customer_phone, 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 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.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.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 left join( select dict_value,dict_label from sys_dict_data where dict_type = 'processType' diff --git a/ruoyi-admin/src/main/resources/templates/system/customer/customer.html b/ruoyi-admin/src/main/resources/templates/system/customer/customer.html index 98883862..73bb22bb 100644 --- a/ruoyi-admin/src/main/resources/templates/system/customer/customer.html +++ b/ruoyi-admin/src/main/resources/templates/system/customer/customer.html @@ -7,49 +7,6 @@ -
@@ -142,7 +99,7 @@
-
+
@@ -455,8 +412,18 @@ restoreUrl: prefix + "/restore/{id}", modalName: "客户基本信息", fixedColumns:true, - sortable: true,//开启排序 + showFooter: true, 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: [ {checkbox: true}, {title: '主键ID',field: 'id',visible: false}, @@ -473,6 +440,7 @@ return '' + value + ''; } }, + {title: '业务员',field: 'businessMembers',visible: false}, { title: '审核状态',field: 'auditStatus', visible: false, formatter: function (value, row, index) { return $.table.selectDictLabel(auditStatusDatas, value);} }, @@ -487,96 +455,88 @@ return '' + value + '';} }, - {field: 'applyUserName', title: '申请人', + {field: 'applyUserName', title: '申请人',align: 'center', formatter: function(value, row, index) { return '' + (value ? value : "-") + ''; } }, - - {title: '客户ID',field: 'enterpriseCode' }, - {title: '客户公司名称',field: 'enterpriseName'}, - {title: '客户公司简称',field: 'customerAbbreviation'}, - {title: '英文名称',field: 'englishName'}, - {title: '公司地址',field: 'customerAddress'}, - {title: '送货地址',field: 'deliveryAddress'}, - {title: '使用状态',field: 'useStatus', + {title: '客户ID',field: 'enterpriseCode',align: 'center',}, + {title: '客户公司名称',field: 'enterpriseName',align: 'center',}, + {title: '客户公司简称',field: 'customerAbbreviation',align: 'center',}, + {title: '英文名称',field: 'englishName',align: 'center',}, + {title: '公司地址',field: 'customerAddress',align: 'center', + formatter: function(value, row, index) { + return $.table.tooltip(value,5,"open"); + } + }, + {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);}, }, - {field: 'applyTime',title: '申请时间'}, - {title: '业务员',field: 'businessMembers',visible: false}, + {field: 'applyTime',title: '申请时间',align: 'center',}, - {title: '事业部',field: 'customerPurser'}, - {title: '内外销',field: 'exportSales',visible: false, - formatter: function (value, row, index) {return $.table.selectDictLabel(exportSalesDatas, value);}, - }, + {title: '事业部',field: 'customerPurser',align: 'center',}, - {title: '邮编',field: 'postalCode',visible: false}, - {title: '国家地区',field: 'customerCountry',visible: false, - formatter: function (value, row, index) {return $.table.selectDictLabel(customerCountryDatas, value);}, - }, - {title: '国家/地区编号',field: 'countryNumber',visible: false, - formatter: function (value, row, index) {return $.table.selectDictLabel(countryNumberDatas, value); }, - }, - {title: '币种',field: 'commonCurrency',visible: false, - formatter: function (value, row, index) {return $.table.selectDictLabel(commonCurrencyDatas, value);}, - }, - {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: '第一联系人',field: 'customerContact',align: 'center',}, + {title: '第一联系人电话',field: 'contactNumber',align: 'center',}, + + {title: '第一联系人传真',field: 'customerFax',align: 'center',}, + {title: '第一联系人邮箱',field: 'customerEmail',align: 'center',}, + + {title: '付款条件',field: 'paymentTerms',align: 'center', + formatter: function(value, row, index) { + return $.table.tooltip(value,5,"open"); + } }, - {title: '第一联系人id',field: 'customerContactId',visible: false}, - {title: '第一联系人',field: 'customerContact'}, - {title: '第一联系人电话',field: 'contactNumber'}, - {title: '第一联系人职务',field: 'customerOffice',visible: false}, - {title: '第一联系人传真',field: 'customerFax'}, - {title: '第一联系人邮箱',field: 'customerEmail'}, - {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', + + {title: '成立日期',field: 'establishedTime',align: 'center',}, + {title: '开户银行',field: 'depositBank',align: 'center',}, + {title: '开户银行账号',field: 'bankAccount',align: 'center',}, + + {title: '是否含税',field: 'confirmTax',align: 'center', formatter: function (value, row, index) { return $.table.selectDictLabel(confirmTaxDatas, value); }, }, - {title: '税率',field: 'taxRate'}, - {title: '第一收货人Id',field:'deliveryAddressId',visible: false}, - {title: '第一收货人',field:'deliveryCustomerPerson',visible: false}, - {title: '第一收货人地址',field: 'deliveryAddress',visible: false}, - {title: '第一收货人电话',field: 'deliveryCustomerPhone',visible: false}, - {title: '第一收货人邮编',field: 'deliveryCustomerPostal',visible:false}, - {title: '第一收货人传真',field: 'deliveryCustomerFax',visible: false}, - {title: '客户标识',field:'customerSign', + {title: '税率',field: 'taxRate',align: 'center',}, + + {title: '客户标识',field:'customerSign',align: 'center', formatter: function (value, row, index) {return $.table.selectDictLabel(customerSignDatas, value);} }, - {title: '录入时间',field: 'createTime', + {title: '录入时间',field: 'createTime',align: 'center', sortable: true, }, - {title: '上次修改时间',field: 'updateTime',}, + {title: '上次修改时间',field: 'updateTime',align: 'center', + + formatter: function(value, row, index) { + if (value) { + return '' + value + ''; + } else { + return value; + } + } + }, {title: '操作',align: 'center', formatter: function(value, row, index) { var actions = []; // 审核状态-审核通过 使用状态-是 未发起作废流程 if((row.auditStatus=="1" || row.auditStatus=="2") && !row.cancelInstanceId){ // 作废 - actions.push(' 作废'); + actions.push(' 作废'); // 编辑 - actions.push(' 编辑 '); + actions.push(' 编辑 '); }else{ - actions.push(' 编辑 '); + actions.push(' 编辑 '); } // 已作废 if(row.useStatus=="2" && !row.restoreInstanceId){ // 恢复 - actions.push(' 恢复 '); + actions.push(' 恢复 '); } //有流程实例id if (row.instanceId) { @@ -585,17 +545,18 @@ var todoUserIdList = row.todoUserId.split(","); if(todoUserIdList.includes(loginName) || loginName == 'admin'){ var nodeName = row.taskName=='驳回调整'?' 调整申请':' 审批'; - actions.push(' '+nodeName+' '); + actions.push(' '+nodeName+' '); } } // 审批历史 - actions.push(' 审批历史 '); + actions.push(' 审批历史 '); // 进度查看 - actions.push(' 进度查看 '); + actions.push(' 进度查看 '); } //详情 - actions.push(' 详情 '); - return actions.join(''); + actions.push(' 详情 '); + var actionLinks = actions.join(''); + return $.table.dropdownToggle(actionLinks); } } ], diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/constant/BusinessKeysConstants.java b/ruoyi-common/src/main/java/com/ruoyi/common/constant/BusinessKeysConstants.java index 84d2a34f..70b19a61 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/constant/BusinessKeysConstants.java +++ b/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 SYS_CUSTOMER = "3"; } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/FieldCompareUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/FieldCompareUtil.java index 6745dad4..216ed983 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/FieldCompareUtil.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/FieldCompareUtil.java @@ -20,6 +20,15 @@ import java.util.*; * */ 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 newVal = getMethod.invoke(newObject); if (!areEqual(oldVal, newVal)) { - String s1 = formatValue(oldVal); - String s2 = formatValue(newVal); + String s1 = formatValue(oldVal, annotation); + String s2 = formatValue(newVal, annotation); String chineseName = annotation.chineseName(); - Map codeToNameMap = codeToNameMap(annotation); - if (!codeToNameMap.isEmpty()) { - s1 = codeToNameMap.getOrDefault(s1, s1); - s2 = codeToNameMap.getOrDefault(s2, s2); - } changeLogFields.add(new SysFieldDifferent(chineseName, s1, s2)); } } @@ -57,7 +61,7 @@ public class FieldCompareUtil { return changeLogFields; } - //统一处理条件判断 + // 统一处理条件判断 private static boolean areEqual(Object oldVal, Object newVal) { if (oldVal == null && newVal == null) { return true; @@ -71,21 +75,26 @@ public class FieldCompareUtil { return ((Number) oldVal).doubleValue() == ((Number) newVal).doubleValue(); } else if (oldVal instanceof Enum) { return oldVal.equals(newVal); - } else if (oldVal instanceof Date) { + } else if (oldVal instanceof java.util.Date) { return oldVal.equals(newVal); } else { return oldVal.equals(newVal); } } - //统一处理格式化值 - private static String formatValue(Object value) { + // 统一处理格式化值 + private static String formatValue(Object value, FieldCompare annotation) { if (value == null) { return ""; } + Map codeToNameMap = codeToNameMap(annotation); + if (!codeToNameMap.isEmpty()) { + return codeToNameMap.getOrDefault(value.toString(), value.toString()); + } + if (value instanceof String) { 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"); return sdf.format(value); } else if (value instanceof Number) { @@ -97,15 +106,10 @@ public class FieldCompareUtil { } } - - /** - * 字典映射 使用方式: - * @param newAnnotation - * @return - */ - private static Map codeToNameMap(FieldCompare newAnnotation) { + // 字典映射 使用方式 + private static Map codeToNameMap(FieldCompare annotation) { Map map = new HashMap<>(); - String properties = newAnnotation.properties(); + String properties = annotation.properties(); if (properties != null && properties.length() > 0) { String[] propertiesArr = properties.split(","); for (String propertie : propertiesArr) {