Преглед изворни кода

feat(customer): 添加客户联系人和部门管理功能

- 在CustomerContact和CustomerContactVo中新增系统用户id字段
- 将CustomerDept中的部门负责人类型从String改为Long
- 将CustomerDept中的费用类型相关字段改为Long和BigDecimal类型
- 在CustomerDeptServiceImpl中集成RemoteUserService进行用户管理
- 修改部门查询逻辑以支持新的数据类型
- 在CustomerInfoServiceImpl中实现客户注册时的完整业务流程
- 添加验证码和密码验证功能
- 实现供应商注册接口参数优化
- 在系统用户控制器中添加密码修改的验证码验证
- 更新数据权限拦截器忽略特定表的配置
hurx пре 1 месец
родитељ
комит
29ab9a9dbb
17 измењених фајлова са 487 додато и 137 уклоњено
  1. 2 1
      ruoyi-common/ruoyi-common-mybatis/src/main/java/org/dromara/common/mybatis/interceptor/PlatformDataScopeInterceptor.java
  2. 16 5
      ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/controller/pc/CustomerRegisterController.java
  3. 3 0
      ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/domain/CustomerContact.java
  4. 5 5
      ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/domain/CustomerDept.java
  5. 6 5
      ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/domain/bo/CustomerDeptBo.java
  6. 101 0
      ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/domain/bo/SupplierRegisterBo.java
  7. 3 0
      ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/domain/vo/CustomerContactVo.java
  8. 7 6
      ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/domain/vo/CustomerDeptVo.java
  9. 5 0
      ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/service/ICustomerInfoService.java
  10. 6 2
      ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/service/ISupplierInfoService.java
  11. 10 1
      ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/service/impl/CustomerDeptServiceImpl.java
  12. 119 36
      ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/service/impl/CustomerInfoServiceImpl.java
  13. 147 72
      ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/service/impl/SupplierInfoServiceImpl.java
  14. 2 1
      ruoyi-modules/ruoyi-resource/src/main/java/org/dromara/resource/controller/SysOssController.java
  15. 15 1
      ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/controller/pc/PcSysUserController.java
  16. 30 0
      ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/bo/ChangeUserPwdBo.java
  17. 10 2
      ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/bo/SysUserBo.java

+ 2 - 1
ruoyi-common/ruoyi-common-mybatis/src/main/java/org/dromara/common/mybatis/interceptor/PlatformDataScopeInterceptor.java

@@ -97,7 +97,8 @@ public class PlatformDataScopeInterceptor implements Interceptor {
         "supply_area",
         "supply_area",
         "authorize_type_level",
         "authorize_type_level",
         "order_return",
         "order_return",
-        "order_return_item"
+        "order_return_item",
+        "customer_business_info"
 
 
 
 
         // 注意:前缀匹配需特殊处理(如 qrtz_),见 isIgnoreTable 方法
         // 注意:前缀匹配需特殊处理(如 qrtz_),见 isIgnoreTable 方法

+ 16 - 5
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/controller/pc/CustomerRegisterController.java

@@ -8,6 +8,7 @@ package org.dromara.customer.controller.pc;
 import lombok.RequiredArgsConstructor;
 import lombok.RequiredArgsConstructor;
 import org.dromara.common.core.domain.R;
 import org.dromara.common.core.domain.R;
 import org.dromara.customer.domain.bo.CustomerRegisterBo;
 import org.dromara.customer.domain.bo.CustomerRegisterBo;
+import org.dromara.customer.domain.bo.SupplierRegisterBo;
 import org.dromara.customer.service.ICustomerInfoService;
 import org.dromara.customer.service.ICustomerInfoService;
 import org.dromara.customer.service.ISupplierInfoService;
 import org.dromara.customer.service.ISupplierInfoService;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.validation.annotation.Validated;
@@ -27,18 +28,28 @@ public class CustomerRegisterController {
     private final ISupplierInfoService supplierInfoService;
     private final ISupplierInfoService supplierInfoService;
 
 
     /**
     /**
-    * 企业注册
-    * */
+     * 验证密码与验证码
+     */
+    @PostMapping("/validate")
+    public R<Void> verifyCodeAndPassword(@RequestBody CustomerRegisterBo bo) {
+        customerInfoService.verifyCodeAndPssword(bo);
+        return R.ok();
+    }
+
+    /**
+     * 企业注册
+     */
     @PostMapping("/registerCustomer")
     @PostMapping("/registerCustomer")
     public R<Void> register(@RequestBody CustomerRegisterBo bo) {
     public R<Void> register(@RequestBody CustomerRegisterBo bo) {
         customerInfoService.register(bo);
         customerInfoService.register(bo);
         return R.ok();
         return R.ok();
     }
     }
+
     /**
     /**
-    * 供应商注册
-    * */
+     * 供应商注册
+     */
     @PostMapping("/registerSupplier")
     @PostMapping("/registerSupplier")
-    public R<Void> registerSupplier(@RequestBody CustomerRegisterBo bo) {
+    public R<Void> registerSupplier(@RequestBody SupplierRegisterBo bo) {
         supplierInfoService.register(bo);
         supplierInfoService.register(bo);
         return R.ok();
         return R.ok();
     }
     }

+ 3 - 0
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/domain/CustomerContact.java

@@ -28,6 +28,9 @@ public class CustomerContact extends TenantEntity {
     @TableId(value = "id")
     @TableId(value = "id")
     private Long id;
     private Long id;
 
 
+    /*系统用户id*/
+    private Long userId;
+
     /**
     /**
      * 所属客户ID
      * 所属客户ID
      */
      */

+ 5 - 5
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/domain/CustomerDept.java

@@ -66,7 +66,7 @@ public class CustomerDept extends TenantEntity {
     /**
     /**
      * 部门负责人
      * 部门负责人
      */
      */
-    private String deptManage;
+    private Long deptManage;
 
 
     /**
     /**
      * 是否限制预算
      * 是否限制预算
@@ -79,18 +79,18 @@ public class CustomerDept extends TenantEntity {
     private String selectYear;
     private String selectYear;
 
 
     /**
     /**
-     * 费用类型
+     * 分项费用
      */
      */
-    private String expenseType;
+    private Long expenseTypeId;
 
 
     /**
     /**
      * 年度剩余预算
      * 年度剩余预算
      */
      */
-    private Long residueYearlyBudget;
+    private BigDecimal residueYearlyBudget;
 
 
     /**
     /**
      * 充值金额
      * 充值金额
      */
      */
-    private Long recharge;
+    private BigDecimal recharge;
 
 
 }
 }

+ 6 - 5
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/domain/bo/CustomerDeptBo.java

@@ -1,5 +1,6 @@
 package org.dromara.customer.domain.bo;
 package org.dromara.customer.domain.bo;
 
 
+import cn.idev.excel.annotation.ExcelProperty;
 import org.dromara.customer.domain.CustomerDept;
 import org.dromara.customer.domain.CustomerDept;
 import org.dromara.common.mybatis.core.domain.BaseEntity;
 import org.dromara.common.mybatis.core.domain.BaseEntity;
 import org.dromara.common.core.validate.AddGroup;
 import org.dromara.common.core.validate.AddGroup;
@@ -90,7 +91,7 @@ public class CustomerDeptBo extends BaseEntity {
     /**
     /**
      * 部门负责人
      * 部门负责人
      */
      */
-    private String deptManage;
+    private Long deptManage;
 
 
     /**
     /**
      * 是否限制预算
      * 是否限制预算
@@ -103,19 +104,19 @@ public class CustomerDeptBo extends BaseEntity {
     private String selectYear;
     private String selectYear;
 
 
     /**
     /**
-     * 费用类型
+     * 分项费用
      */
      */
-    private String expenseType;
+    private Long expenseTypeId;
 
 
     /**
     /**
      * 年度剩余预算
      * 年度剩余预算
      */
      */
-    private Long residueYearlyBudget;
+    private BigDecimal residueYearlyBudget;
 
 
     /**
     /**
      * 充值金额
      * 充值金额
      */
      */
-    private Long recharge;
+    private BigDecimal recharge;
 
 
     /**
     /**
      * 状态(0正常 1停用)
      * 状态(0正常 1停用)

+ 101 - 0
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/domain/bo/SupplierRegisterBo.java

@@ -0,0 +1,101 @@
+package org.dromara.customer.domain.bo;
+
+import lombok.Data;
+import org.dromara.customer.domain.vo.SupplyAreaVo;
+
+import java.util.List;
+
+@Data
+public class SupplierRegisterBo {
+    /**
+     * 供应商名称
+     */
+    private String enterpriseName;
+    /**
+     * 姓名
+     */
+    private String purchaseName;
+    /**
+     * 手机号
+     */
+    private String purchasePhone;
+    /**
+     * 验证码
+     */
+    private String code;
+    /**
+     * 密码
+     */
+    private String password;
+    /**
+     * 确认密码
+     */
+    private String confirmPassword;
+
+    /**
+     * 人员规模
+     */
+    private Long membershipSize;
+
+    /**
+     * 固定电话
+     */
+    private String fixedPhone;
+
+    /**
+     * 传真
+     */
+    private String fax;
+
+    /**
+     * 网址
+     */
+    private String url;
+
+    /**
+     * 邮箱
+     */
+    private String mailbox;
+
+    /**
+     * 办公地址-省
+     */
+    private String officeProvince;
+
+    /**
+     * 办公地址-市
+     */
+    private String officeCity;
+
+    /**
+     * 办公地址-区/县
+     */
+    private String officeCounty;
+
+    /**
+     * 办公详细地址
+     */
+    private String officeAddress;
+
+    /**
+     * 统一社会信用代码
+     */
+    private String socialCreditCode;
+
+    /**
+     * 营业执照图片路径
+     */
+    private String businessLicense;
+
+    /**
+     * 年销售额
+     */
+    private Long yearSales;
+
+    /**
+     * 经营品类
+     */
+    private String operatingCategory;
+
+    List<SupplyAreaBo> supplyAreaList;
+}

+ 3 - 0
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/domain/vo/CustomerContactVo.java

@@ -36,6 +36,9 @@ public class CustomerContactVo implements Serializable {
     /*联系人编号*/
     /*联系人编号*/
     private String contactNo;
     private String contactNo;
 
 
+    /*系统用户id*/
+    private Long userId;
+
     /**
     /**
      * 所属客户ID
      * 所属客户ID
      */
      */

+ 7 - 6
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/domain/vo/CustomerDeptVo.java

@@ -106,7 +106,7 @@ public class CustomerDeptVo implements Serializable {
      * 部门负责人
      * 部门负责人
      */
      */
     @ExcelProperty(value = "部门负责人")
     @ExcelProperty(value = "部门负责人")
-    private String deptManage;
+    private Long deptManage;
 
 
     /**
     /**
      * 是否限制预算
      * 是否限制预算
@@ -120,23 +120,24 @@ public class CustomerDeptVo implements Serializable {
     @ExcelProperty(value = "所选年份")
     @ExcelProperty(value = "所选年份")
     private String selectYear;
     private String selectYear;
 
 
+
     /**
     /**
-     * 费用类型
+     * 分项费用
      */
      */
-    @ExcelProperty(value = "费用类型")
-    private String expenseType;
+    @ExcelProperty(value = "分项费用")
+    private Long expenseTypeId;
 
 
     /**
     /**
      * 年度剩余预算
      * 年度剩余预算
      */
      */
     @ExcelProperty(value = "年度剩余预算")
     @ExcelProperty(value = "年度剩余预算")
-    private Long residueYearlyBudget;
+    private BigDecimal residueYearlyBudget;
 
 
     /**
     /**
      * 充值金额
      * 充值金额
      */
      */
     @ExcelProperty(value = "充值金额")
     @ExcelProperty(value = "充值金额")
-    private Long recharge;
+    private BigDecimal recharge;
 
 
     /**
     /**
      * 状态(0正常 1停用)
      * 状态(0正常 1停用)

+ 5 - 0
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/service/ICustomerInfoService.java

@@ -131,8 +131,13 @@ public interface ICustomerInfoService extends IService<CustomerInfo> {
      */
      */
     Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
     Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
 
 
+    /*验证密码与验证码*/
+    Boolean verifyCodeAndPssword(CustomerRegisterBo bo);
+
     /**
     /**
      * 客户注册
      * 客户注册
      */
      */
     Boolean register(CustomerRegisterBo bo);
     Boolean register(CustomerRegisterBo bo);
+
+
 }
 }

+ 6 - 2
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/service/ISupplierInfoService.java

@@ -7,6 +7,7 @@ import jakarta.validation.constraints.NotNull;
 import org.dromara.customer.domain.SupplierInfo;
 import org.dromara.customer.domain.SupplierInfo;
 import org.dromara.customer.domain.bo.CustomerRegisterBo;
 import org.dromara.customer.domain.bo.CustomerRegisterBo;
 import org.dromara.customer.domain.bo.SupplierAuthorizeBo;
 import org.dromara.customer.domain.bo.SupplierAuthorizeBo;
+import org.dromara.customer.domain.bo.SupplierRegisterBo;
 import org.dromara.customer.domain.vo.SupplierInfoVo;
 import org.dromara.customer.domain.vo.SupplierInfoVo;
 import org.dromara.customer.domain.bo.SupplierInfoBo;
 import org.dromara.customer.domain.bo.SupplierInfoBo;
 import org.dromara.common.mybatis.core.page.TableDataInfo;
 import org.dromara.common.mybatis.core.page.TableDataInfo;
@@ -24,7 +25,7 @@ import java.util.Set;
  * @author LionLi
  * @author LionLi
  * @date 2026-01-09
  * @date 2026-01-09
  */
  */
-public interface ISupplierInfoService extends IService<SupplierInfo>{
+public interface ISupplierInfoService extends IService<SupplierInfo> {
 
 
     /**
     /**
      * 查询供应商信息
      * 查询供应商信息
@@ -42,6 +43,7 @@ public interface ISupplierInfoService extends IService<SupplierInfo>{
      * @return 供应商信息分页列表
      * @return 供应商信息分页列表
      */
      */
     TableDataInfo<SupplierInfoVo> queryPageList(SupplierInfoBo bo, PageQuery pageQuery);
     TableDataInfo<SupplierInfoVo> queryPageList(SupplierInfoBo bo, PageQuery pageQuery);
+
     /**
     /**
      * 获取供应商信息列表
      * 获取供应商信息列表
      *
      *
@@ -54,6 +56,7 @@ public interface ISupplierInfoService extends IService<SupplierInfo>{
 
 
     /**
     /**
      * 获取供应商审核列表
      * 获取供应商审核列表
+     *
      * @param bo
      * @param bo
      * @param pageQuery
      * @param pageQuery
      * @return
      * @return
@@ -109,9 +112,10 @@ public interface ISupplierInfoService extends IService<SupplierInfo>{
 
 
     /**
     /**
      * 注册供应商
      * 注册供应商
+     *
      * @param bo
      * @param bo
      */
      */
-    Boolean register(CustomerRegisterBo bo);
+    Boolean register(SupplierRegisterBo bo);
 
 
     List<SupplierInfoVo> getNameList();
     List<SupplierInfoVo> getNameList();
 }
 }

+ 10 - 1
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/service/impl/CustomerDeptServiceImpl.java

@@ -19,6 +19,7 @@ import org.dromara.customer.mapper.CustomerDeptMapper;
 import org.dromara.customer.mapper.CustomerShippingAddressMapper;
 import org.dromara.customer.mapper.CustomerShippingAddressMapper;
 import org.dromara.customer.service.ICustomerDeptService;
 import org.dromara.customer.service.ICustomerDeptService;
 import org.dromara.system.api.RemoteDeptService;
 import org.dromara.system.api.RemoteDeptService;
+import org.dromara.system.api.RemoteUserService;
 import org.dromara.system.api.domain.vo.RemoteDeptVo;
 import org.dromara.system.api.domain.vo.RemoteDeptVo;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.annotation.Transactional;
@@ -41,6 +42,9 @@ public class CustomerDeptServiceImpl extends ServiceImpl<CustomerDeptMapper, Cus
     @DubboReference
     @DubboReference
     private RemoteDeptService remoteDeptService;
     private RemoteDeptService remoteDeptService;
 
 
+    @DubboReference
+    private RemoteUserService remoteUserService;
+
     private static final String DEPT_NO_KEY = "customer_dept:dept_no";
     private static final String DEPT_NO_KEY = "customer_dept:dept_no";
 
 
     private final CustomerDeptMapper baseMapper;
     private final CustomerDeptMapper baseMapper;
@@ -199,7 +203,6 @@ public class CustomerDeptServiceImpl extends ServiceImpl<CustomerDeptMapper, Cus
         lqw.eq(bo.getMonthLimit() != null, CustomerDept::getMonthLimit, bo.getMonthLimit());
         lqw.eq(bo.getMonthLimit() != null, CustomerDept::getMonthLimit, bo.getMonthLimit());
         lqw.eq(bo.getMonthUsedBudget() != null, CustomerDept::getMonthUsedBudget, bo.getMonthUsedBudget());
         lqw.eq(bo.getMonthUsedBudget() != null, CustomerDept::getMonthUsedBudget, bo.getMonthUsedBudget());
         lqw.eq(StringUtils.isNotBlank(bo.getBindStatus()), CustomerDept::getBindStatus, bo.getBindStatus());
         lqw.eq(StringUtils.isNotBlank(bo.getBindStatus()), CustomerDept::getBindStatus, bo.getBindStatus());
-        lqw.eq(StringUtils.isNotBlank(bo.getDeptManage()), CustomerDept::getDeptManage, bo.getDeptManage());
         lqw.eq(StringUtils.isNotBlank(bo.getIsLimit()), CustomerDept::getIsLimit, bo.getIsLimit());
         lqw.eq(StringUtils.isNotBlank(bo.getIsLimit()), CustomerDept::getIsLimit, bo.getIsLimit());
         lqw.eq(StringUtils.isNotBlank(bo.getSelectYear()), CustomerDept::getSelectYear, bo.getSelectYear());
         lqw.eq(StringUtils.isNotBlank(bo.getSelectYear()), CustomerDept::getSelectYear, bo.getSelectYear());
         lqw.eq(StringUtils.isNotBlank(bo.getPlatformCode()), CustomerDept::getPlatformCode, bo.getPlatformCode());
         lqw.eq(StringUtils.isNotBlank(bo.getPlatformCode()), CustomerDept::getPlatformCode, bo.getPlatformCode());
@@ -240,6 +243,12 @@ public class CustomerDeptServiceImpl extends ServiceImpl<CustomerDeptMapper, Cus
             dept.setUsedBudget(bo.getUsedBudget());
             dept.setUsedBudget(bo.getUsedBudget());
             dept.setBindStatus(bo.getBindStatus());
             dept.setBindStatus(bo.getBindStatus());
             dept.setBindAddress(bo.getBindAddress());
             dept.setBindAddress(bo.getBindAddress());
+            dept.setIsLimit(bo.getIsLimit());
+            dept.setSelectYear(bo.getSelectYear());
+            dept.setExpenseTypeId(bo.getExpenseTypeId());
+            dept.setDeptManage(bo.getDeptManage());
+            dept.setRecharge(bo.getRecharge());
+            dept.setResidueYearlyBudget(bo.getResidueYearlyBudget());
 
 
             boolean success = baseMapper.insert(dept) > 0;
             boolean success = baseMapper.insert(dept) > 0;
             if (!success) {
             if (!success) {

+ 119 - 36
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/service/impl/CustomerInfoServiceImpl.java

@@ -20,6 +20,7 @@ import org.dromara.common.core.utils.StringUtils;
 import org.dromara.common.mybatis.core.page.PageQuery;
 import org.dromara.common.mybatis.core.page.PageQuery;
 import org.dromara.common.mybatis.core.page.TableDataInfo;
 import org.dromara.common.mybatis.core.page.TableDataInfo;
 import org.dromara.common.redis.utils.RedisUtils;
 import org.dromara.common.redis.utils.RedisUtils;
+import org.dromara.common.redis.utils.SequenceUtils;
 import org.dromara.common.satoken.utils.LoginHelper;
 import org.dromara.common.satoken.utils.LoginHelper;
 import org.dromara.customer.domain.*;
 import org.dromara.customer.domain.*;
 import org.dromara.customer.domain.bo.*;
 import org.dromara.customer.domain.bo.*;
@@ -35,6 +36,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.annotation.Transactional;
 
 
 import java.math.BigDecimal;
 import java.math.BigDecimal;
+import java.time.Duration;
 import java.util.*;
 import java.util.*;
 import java.util.function.Function;
 import java.util.function.Function;
 import java.util.stream.Collectors;
 import java.util.stream.Collectors;
@@ -66,6 +68,9 @@ public class CustomerInfoServiceImpl extends ServiceImpl<CustomerInfoMapper, Cus
     @DubboReference
     @DubboReference
     private RemoteCreditLevelService remoteCreditLevelService;
     private RemoteCreditLevelService remoteCreditLevelService;
 
 
+    private static final String CUSTOMER_NO_KEY = "customer_info:customer_no";
+    private static final String CONTACT_NO_KEY = "customer_contact:contact_no";
+
     private final CustomerInfoMapper baseMapper;
     private final CustomerInfoMapper baseMapper;
     private final CustomerBusinessInfoMapper customerBusinessInfoMapper;
     private final CustomerBusinessInfoMapper customerBusinessInfoMapper;
     private final CustomerInvoiceInfoMapper customerInvoiceInfoMapper;
     private final CustomerInvoiceInfoMapper customerInvoiceInfoMapper;
@@ -557,7 +562,7 @@ public class CustomerInfoServiceImpl extends ServiceImpl<CustomerInfoMapper, Cus
             /*新增客户时给每个客户创建自己的组织架构*/
             /*新增客户时给每个客户创建自己的组织架构*/
             RemoteDeptVo remoteDeptVo = new RemoteDeptVo();
             RemoteDeptVo remoteDeptVo = new RemoteDeptVo();
             remoteDeptVo.setParentId(100L);
             remoteDeptVo.setParentId(100L);
-            remoteDeptVo.setDeptName(bo.getCustomerName());
+            remoteDeptVo.setDeptName(bo.getBusinessCustomerName());
             remoteDeptVo.setPlatformCode(platform);
             remoteDeptVo.setPlatformCode(platform);
             RemoteDeptVo deptVo = remoteDeptService.insertDept(remoteDeptVo);
             RemoteDeptVo deptVo = remoteDeptService.insertDept(remoteDeptVo);
 
 
@@ -604,27 +609,34 @@ public class CustomerInfoServiceImpl extends ServiceImpl<CustomerInfoMapper, Cus
 
 
             // 联系人列表
             // 联系人列表
             if (contactList != null && !contactList.isEmpty()) {
             if (contactList != null && !contactList.isEmpty()) {
-                CustomerContactBo primaryContact = contactList.stream()
-                    .filter(contact -> contact.getIsPrimary().equals("0"))
-                    .findFirst()
-                    .orElse(null);
-                RemoteUserBo remoteUserBo = new RemoteUserBo();
-                remoteUserBo.setNickName(bo.getCustomerName());
-                if (null != primaryContact) {
-                    remoteUserBo.setUserName(primaryContact.getPhone());
-                } else {
-                    remoteUserBo.setUserName(contactList.get(0).getPhone());
-                }
-
-                String password = "123456";
-                remoteUserBo.setPassword(BCrypt.hashpw(password));
-                remoteUserBo.setUserSonType("3");
-                remoteUserBo.setTenantId(LoginHelper.getTenantId());
-                remoteUserService.addUser(remoteUserBo);
                 for (CustomerContactBo contactBo : contactList) {
                 for (CustomerContactBo contactBo : contactList) {
+                    // 1. 准备创建系统用户的数据
+                    RemoteUserBo remoteUserBo = new RemoteUserBo();
+                    remoteUserBo.setNickName(contactBo.getContactName());
+                    remoteUserBo.setUserName(contactBo.getPhone());// 用手机号做账号
+                    String defaultPassword = "123456";
+                    remoteUserBo.setPassword(BCrypt.hashpw(defaultPassword));
+                    remoteUserBo.setUserSonType("3");
+                    remoteUserBo.setTenantId(LoginHelper.getTenantId());
+
+                    // 2. 调用远程服务创建用户
+                    Long userId = remoteUserService.addUser(remoteUserBo);
+
+                    if (userId == null) {
+                        throw new ServiceException("创建系统用户失败:" + userId);
+                    }
+
+                    // 3. 转换并填充业务联系人数据
                     CustomerContact contact = MapstructUtils.convert(contactBo, CustomerContact.class);
                     CustomerContact contact = MapstructUtils.convert(contactBo, CustomerContact.class);
                     contact.setCustomerId(customerId);
                     contact.setCustomerId(customerId);
-                    customerContactMapper.insert(contact);
+
+                    // 建立关联
+                    contact.setUserId(userId);
+
+                    // 4. 插入联系人表
+                    if (customerContactMapper.insert(contact) <= 0) {
+                        throw new ServiceException("保存联系人信息失败");
+                    }
                 }
                 }
             }
             }
 
 
@@ -872,6 +884,22 @@ public class CustomerInfoServiceImpl extends ServiceImpl<CustomerInfoMapper, Cus
         return baseMapper.deleteByIds(ids) > 0;
         return baseMapper.deleteByIds(ids) > 0;
     }
     }
 
 
+    @Override
+    public Boolean verifyCodeAndPssword(CustomerRegisterBo bo) {
+        //先校验验证码是否正确
+        String code = RedisUtils.getCacheObject(GlobalConstants.CAPTCHA_CODE_KEY + bo.getPurchasePhone());
+        if (!code.equals(bo.getCode())) {
+            throw new ServiceException("验证码错误");
+
+        }
+
+        //校验密码与确认密码是否一致
+        if (!bo.getPassword().equals(bo.getConfirmPassword())) {
+            throw new ServiceException("密码与确认密码不一致");
+        }
+        return true;
+    }
+
     /**
     /**
      * 客户注册
      * 客户注册
      *
      *
@@ -882,7 +910,10 @@ public class CustomerInfoServiceImpl extends ServiceImpl<CustomerInfoMapper, Cus
     public Boolean register(CustomerRegisterBo bo) {
     public Boolean register(CustomerRegisterBo bo) {
         //先校验验证码是否正确
         //先校验验证码是否正确
         String code = RedisUtils.getCacheObject(GlobalConstants.CAPTCHA_CODE_KEY + bo.getPurchasePhone());
         String code = RedisUtils.getCacheObject(GlobalConstants.CAPTCHA_CODE_KEY + bo.getPurchasePhone());
-        code = "123456";
+        if (code == null) {
+            throw new ServiceException("验证码已过期");
+        }
+
         if (!code.equals(bo.getCode())) {
         if (!code.equals(bo.getCode())) {
             throw new ServiceException("验证码错误");
             throw new ServiceException("验证码错误");
         }
         }
@@ -893,9 +924,13 @@ public class CustomerInfoServiceImpl extends ServiceImpl<CustomerInfoMapper, Cus
         }
         }
 
 
         //查询数据库是否存在企业,已存在则提示客户已存在
         //查询数据库是否存在企业,已存在则提示客户已存在
-        CustomerInfo customerInfo = baseMapper.selectOne(new LambdaQueryWrapper<CustomerInfo>()
-            .eq(CustomerInfo::getCustomerName, bo.getCustomerName())
+        List<CustomerInfo> list = baseMapper.selectList(
+            new LambdaQueryWrapper<CustomerInfo>()
+                .eq(CustomerInfo::getCustomerName, bo.getCustomerName())
+                .last("LIMIT 1")
         );
         );
+
+        CustomerInfo customerInfo = list.isEmpty() ? null : list.get(0);
         if (customerInfo != null) {
         if (customerInfo != null) {
             throw new ServiceException("客户已存在");
             throw new ServiceException("客户已存在");
         }
         }
@@ -909,8 +944,10 @@ public class CustomerInfoServiceImpl extends ServiceImpl<CustomerInfoMapper, Cus
         //构建客户信息实体
         //构建客户信息实体
         CustomerInfo customerEntity = new CustomerInfo();
         CustomerInfo customerEntity = new CustomerInfo();
         customerEntity.setCustomerName(bo.getCustomerName());
         customerEntity.setCustomerName(bo.getCustomerName());
+        customerEntity.setCustomerNo(SequenceUtils.nextPaddedIdStr(CUSTOMER_NO_KEY, Duration.ofDays(3650), 6));
         customerEntity.setBusinessCustomerName(companyInfo.getResult().getName());
         customerEntity.setBusinessCustomerName(companyInfo.getResult().getName());
         customerEntity.setShortName(companyInfo.getResult().getName());
         customerEntity.setShortName(companyInfo.getResult().getName());
+        customerEntity.setInvoiceTop(companyInfo.getResult().getName());
         customerEntity.setStatus("0"); // 正常状态
         customerEntity.setStatus("0"); // 正常状态
         customerEntity.setDelFlag("0"); // 未删除
         customerEntity.setDelFlag("0"); // 未删除
 
 
@@ -921,27 +958,85 @@ public class CustomerInfoServiceImpl extends ServiceImpl<CustomerInfoMapper, Cus
 
 
         Long customerId = customerEntity.getId();
         Long customerId = customerEntity.getId();
 
 
+        String customerNo = customerEntity.getCustomerNo();
+
+        /*新增客户时给每个客户创建自己的组织架构*/
+        RemoteDeptVo remoteDeptVo = new RemoteDeptVo();
+        remoteDeptVo.setParentId(100L);
+        remoteDeptVo.setDeptName(companyInfo.getResult().getName());
+        RemoteDeptVo deptVo = remoteDeptService.insertDept(remoteDeptVo);
+
+        CustomerDept dept = new CustomerDept();
+        dept.setDeptId(deptVo.getDeptId());
+        dept.setCustomerId(customerId);
+        dept.setYearlyBudget(BigDecimal.ZERO);
+        dept.setMonthLimit(BigDecimal.ZERO);
+        dept.setUsedBudget(BigDecimal.ZERO);
+        dept.setBindStatus(IsDefault.No.getCode());
+
+        if (customerDeptMapper.insert(dept) <= 0) {
+            throw new ServiceException("客户部门新增失败");
+        }
+
         // 添加客户工商信息
         // 添加客户工商信息
         CustomerBusinessInfo businessInfo = new CustomerBusinessInfo();
         CustomerBusinessInfo businessInfo = new CustomerBusinessInfo();
         businessInfo.setCustomerId(customerId);
         businessInfo.setCustomerId(customerId);
         businessInfo.setBusinessCustomerName(companyInfo.getResult().getName());
         businessInfo.setBusinessCustomerName(companyInfo.getResult().getName());
         businessInfo.setSocialCreditCode(companyInfo.getResult().getCreditCode());
         businessInfo.setSocialCreditCode(companyInfo.getResult().getCreditCode());
         businessInfo.setLegalPersonName(companyInfo.getResult().getOperName());
         businessInfo.setLegalPersonName(companyInfo.getResult().getOperName());
-        businessInfo.setRegisteredCapital(companyInfo.getResult().getRegistCapi());
+//        businessInfo.setRegisteredCapital(companyInfo.getResult().getRegistCapi());
+
+        // 注册资本:拼接数值 + 单位(如 "101万元")
+        String regCap = companyInfo.getResult().getRegisteredCapital();
+        String regUnit = companyInfo.getResult().getRegisteredCapitalUnit();
+        businessInfo.setRegisteredCapital(
+            StringUtils.isNotBlank(regCap) && StringUtils.isNotBlank(regUnit)
+                ? regCap + regUnit
+                : regCap
+        );
+
+        // 实缴资本
+        String paidCap = companyInfo.getResult().getPaidUpCapital();
+        String paidUnit = companyInfo.getResult().getPaidUpCapitalUnit();
+        businessInfo.setPaidInCapital(
+            StringUtils.isNotBlank(paidCap) && StringUtils.isNotBlank(paidUnit)
+                ? paidCap + paidUnit
+                : paidCap
+        );
+
         businessInfo.setEstablishmentDate(DateUtils.parseDate((companyInfo.getResult().getStartDate())));
         businessInfo.setEstablishmentDate(DateUtils.parseDate((companyInfo.getResult().getStartDate())));
+        businessInfo.setRevocationDate(null);
         businessInfo.setRegistrationStatus(companyInfo.getResult().getStatus());
         businessInfo.setRegistrationStatus(companyInfo.getResult().getStatus());
+        businessInfo.setRegistrationAuthority(companyInfo.getResult().getBelongOrg());
         businessInfo.setBusinessAddress(companyInfo.getResult().getAddress());
         businessInfo.setBusinessAddress(companyInfo.getResult().getAddress());
         businessInfo.setBussinessRange(companyInfo.getResult().getScope());
         businessInfo.setBussinessRange(companyInfo.getResult().getScope());
         businessInfo.setStatus("0");
         businessInfo.setStatus("0");
-        businessInfo.setDelFlag("0");
 
 
         if (customerBusinessInfoMapper.insert(businessInfo) <= 0) {
         if (customerBusinessInfoMapper.insert(businessInfo) <= 0) {
             throw new ServiceException("客户工商信息新增失败");
             throw new ServiceException("客户工商信息新增失败");
         }
         }
 
 
+        // 创建系统用户
+        RemoteUserBo remoteUserBo = new RemoteUserBo();
+        remoteUserBo.setDeptId(deptVo.getDeptId());
+        remoteUserBo.setUserName(bo.getPurchasePhone());
+        remoteUserBo.setNickName(bo.getCustomerName());
+        remoteUserBo.setPhonenumber(bo.getPurchasePhone());
+        remoteUserBo.setPassword(BCrypt.hashpw(bo.getPassword()));
+        remoteUserBo.setUserSonType("3"); // 商城用户
+        remoteUserBo.setTenantId(LoginHelper.getTenantId());
+        remoteUserBo.setStatus("0"); // 正常状态
+        Long userId = remoteUserService.addUser(remoteUserBo);
+
+
         // 添加客户联系人信息
         // 添加客户联系人信息
         CustomerContact contact = new CustomerContact();
         CustomerContact contact = new CustomerContact();
         contact.setCustomerId(customerId);
         contact.setCustomerId(customerId);
+        //  生成联系人编号
+        String seqId = SequenceUtils.nextPaddedIdStr(CONTACT_NO_KEY, Duration.ofDays(3650), 3);
+        String contactNo = customerNo + seqId;
+        contact.setContactNo(contactNo);
+        contact.setUserId(userId);
         contact.setContactName(bo.getPurchaseName());
         contact.setContactName(bo.getPurchaseName());
         contact.setPhone(bo.getPurchasePhone());
         contact.setPhone(bo.getPurchasePhone());
         contact.setCustomLoginName(bo.getPurchasePhone());
         contact.setCustomLoginName(bo.getPurchasePhone());
@@ -953,18 +1048,6 @@ public class CustomerInfoServiceImpl extends ServiceImpl<CustomerInfoMapper, Cus
             throw new ServiceException("客户联系人信息新增失败");
             throw new ServiceException("客户联系人信息新增失败");
         }
         }
 
 
-        // 创建系统用户
-        RemoteUserBo remoteUserBo = new RemoteUserBo();
-        remoteUserBo.setUserName(bo.getPurchasePhone());
-        remoteUserBo.setNickName(bo.getCustomerName());
-        remoteUserBo.setPhonenumber(bo.getPurchasePhone());
-        remoteUserBo.setPassword(BCrypt.hashpw(bo.getPassword()));
-        remoteUserBo.setUserSonType("3"); // 商城用户
-        remoteUserBo.setTenantId(LoginHelper.getTenantId());
-        remoteUserBo.setStatus("0"); // 正常状态
-
-        remoteUserService.addUser(remoteUserBo);
-
         log.info("客户注册成功,客户ID:{},客户名称:{}", customerId, bo.getCustomerName());
         log.info("客户注册成功,客户ID:{},客户名称:{}", customerId, bo.getCustomerName());
         return true;
         return true;
     }
     }

+ 147 - 72
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/service/impl/SupplierInfoServiceImpl.java

@@ -26,15 +26,10 @@ import lombok.extern.slf4j.Slf4j;
 import org.dromara.common.redis.utils.RedisUtils;
 import org.dromara.common.redis.utils.RedisUtils;
 import org.dromara.common.satoken.utils.LoginHelper;
 import org.dromara.common.satoken.utils.LoginHelper;
 import org.dromara.customer.domain.*;
 import org.dromara.customer.domain.*;
-import org.dromara.customer.domain.bo.CustomerRegisterBo;
-import org.dromara.customer.domain.bo.EnterpriseScaleBo;
-import org.dromara.customer.domain.bo.SupplierAuthorizeBo;
-import org.dromara.customer.domain.bo.SupplyAreaBo;
+import org.dromara.customer.domain.bo.*;
 import org.dromara.customer.domain.vo.*;
 import org.dromara.customer.domain.vo.*;
 import org.dromara.customer.enums.SupplierStatusEnum;
 import org.dromara.customer.enums.SupplierStatusEnum;
-import org.dromara.customer.mapper.SupplierAuthorizeMapper;
-import org.dromara.customer.mapper.SupplierBusinessInfoMapper;
-import org.dromara.customer.mapper.SupplierContactMapper;
+import org.dromara.customer.mapper.*;
 import org.dromara.customer.service.*;
 import org.dromara.customer.service.*;
 import org.dromara.customer.utils.qcc.QccUtils;
 import org.dromara.customer.utils.qcc.QccUtils;
 import org.dromara.customer.utils.qcc.domain.CompanyInfoResponse;
 import org.dromara.customer.utils.qcc.domain.CompanyInfoResponse;
@@ -48,10 +43,9 @@ import org.dromara.system.api.domain.bo.RemoteUserBo;
 import org.dromara.system.api.domain.vo.RemoteSupplierTypeVo;
 import org.dromara.system.api.domain.vo.RemoteSupplierTypeVo;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
-import org.dromara.customer.domain.bo.SupplierInfoBo;
 import org.dromara.customer.domain.vo.SupplierInfoVo;
 import org.dromara.customer.domain.vo.SupplierInfoVo;
 import org.dromara.customer.domain.SupplierInfo;
 import org.dromara.customer.domain.SupplierInfo;
-import org.dromara.customer.mapper.SupplierInfoMapper;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
 import org.springframework.util.CollectionUtils;
 
 
 import java.util.*;
 import java.util.*;
@@ -66,7 +60,7 @@ import java.util.stream.Collectors;
 @Slf4j
 @Slf4j
 @RequiredArgsConstructor
 @RequiredArgsConstructor
 @Service
 @Service
-public class SupplierInfoServiceImpl  extends ServiceImpl<SupplierInfoMapper, SupplierInfo> implements ISupplierInfoService {
+public class SupplierInfoServiceImpl extends ServiceImpl<SupplierInfoMapper, SupplierInfo> implements ISupplierInfoService {
 
 
     private final SupplierInfoMapper baseMapper;
     private final SupplierInfoMapper baseMapper;
 
 
@@ -84,10 +78,11 @@ public class SupplierInfoServiceImpl  extends ServiceImpl<SupplierInfoMapper, Su
 
 
     private final ObjectMapper objectMapper;
     private final ObjectMapper objectMapper;
 
 
+    private final SupplyAreaMapper supplyAreaMapper;
+
     /**
     /**
-     *
      * 供应商联系人信息
      * 供应商联系人信息
-     * */
+     */
     private final SupplierContactMapper supplierContactMapper;
     private final SupplierContactMapper supplierContactMapper;
 
 
     @DubboReference
     @DubboReference
@@ -106,8 +101,6 @@ public class SupplierInfoServiceImpl  extends ServiceImpl<SupplierInfoMapper, Su
     private final RemoteSupplierTypeService remoteSupplierTypeService;
     private final RemoteSupplierTypeService remoteSupplierTypeService;
 
 
 
 
-
-
     /**
     /**
      * 新增供应商信息
      * 新增供应商信息
      *
      *
@@ -137,11 +130,12 @@ public class SupplierInfoServiceImpl  extends ServiceImpl<SupplierInfoMapper, Su
         }
         }
         return flag;
         return flag;
     }
     }
+
     /**
     /**
      * 从JSON字符串解析工商信息并保存
      * 从JSON字符串解析工商信息并保存
      *
      *
      * @param otherCustomersJson JSON格式的工商信息
      * @param otherCustomersJson JSON格式的工商信息
-     * @param supplierId 供应商ID
+     * @param supplierId         供应商ID
      */
      */
     private void saveSupplierBusinessInfoFromJson(String otherCustomersJson, Long supplierId) {
     private void saveSupplierBusinessInfoFromJson(String otherCustomersJson, Long supplierId) {
         if (StringUtils.isBlank(otherCustomersJson)) {
         if (StringUtils.isBlank(otherCustomersJson)) {
@@ -172,7 +166,6 @@ public class SupplierInfoServiceImpl  extends ServiceImpl<SupplierInfoMapper, Su
     }
     }
 
 
 
 
-
     /**
     /**
      * 修改供应商信息
      * 修改供应商信息
      *
      *
@@ -197,7 +190,7 @@ public class SupplierInfoServiceImpl  extends ServiceImpl<SupplierInfoMapper, Su
             supplierInfoVo.setSupplyStatus(SupplierStatusEnum.REVIEW_UPDATED.getCode());
             supplierInfoVo.setSupplyStatus(SupplierStatusEnum.REVIEW_UPDATED.getCode());
             //先copy到临时表
             //先copy到临时表
             SupplierInfoTemporary supplierInfoTemporary = new SupplierInfoTemporary();
             SupplierInfoTemporary supplierInfoTemporary = new SupplierInfoTemporary();
-            BeanUtils.copyProperties(bo, supplierInfoTemporary,"id");
+            BeanUtils.copyProperties(bo, supplierInfoTemporary, "id");
             //修改待审核
             //修改待审核
             //ID一对一
             //ID一对一
             supplierInfoTemporary.setSupplierId(bo.getId());
             supplierInfoTemporary.setSupplierId(bo.getId());
@@ -229,7 +222,7 @@ public class SupplierInfoServiceImpl  extends ServiceImpl<SupplierInfoMapper, Su
         }
         }
 
 
         //停用 ->正式供应商
         //停用 ->正式供应商
-        if (supplierInfoVo.getSupplyStatus() ==SupplierStatusEnum.DISABLED.getCode() && bo.getSupplyStatus() == SupplierStatusEnum.OFFICIAL_SUPPLIER.getCode()) {
+        if (supplierInfoVo.getSupplyStatus() == SupplierStatusEnum.DISABLED.getCode() && bo.getSupplyStatus() == SupplierStatusEnum.OFFICIAL_SUPPLIER.getCode()) {
             SupplierInfo update = MapstructUtils.convert(bo, SupplierInfo.class);
             SupplierInfo update = MapstructUtils.convert(bo, SupplierInfo.class);
             update.setCooperative(1L);
             update.setCooperative(1L);
             return baseMapper.updateById(update) > 0;
             return baseMapper.updateById(update) > 0;
@@ -262,7 +255,8 @@ public class SupplierInfoServiceImpl  extends ServiceImpl<SupplierInfoMapper, Su
                 // 注意:泛型解析需要用 TypeReference 明确类型,否则会解析为 LinkedHashMap
                 // 注意:泛型解析需要用 TypeReference 明确类型,否则会解析为 LinkedHashMap
                 TableDataInfo<SupplyAreaVo> areaTableData = objectMapper.readValue(
                 TableDataInfo<SupplyAreaVo> areaTableData = objectMapper.readValue(
                     areaListJson,
                     areaListJson,
-                    new TypeReference<TableDataInfo<SupplyAreaVo>>() {}
+                    new TypeReference<TableDataInfo<SupplyAreaVo>>() {
+                    }
                 );
                 );
                 // 2. 提取 SupplyAreaVo 列表(判空避免空指针)
                 // 2. 提取 SupplyAreaVo 列表(判空避免空指针)
                 List<SupplyAreaVo> supplyAreaVoList = areaTableData.getRows();
                 List<SupplyAreaVo> supplyAreaVoList = areaTableData.getRows();
@@ -290,7 +284,7 @@ public class SupplierInfoServiceImpl  extends ServiceImpl<SupplierInfoMapper, Su
                 // 5. 更新主表 SupplierInfo
                 // 5. 更新主表 SupplierInfo
                 supplierInfoVo.setSupplyStatus(SupplierStatusEnum.OFFICIAL_SUPPLIER.getCode());
                 supplierInfoVo.setSupplyStatus(SupplierStatusEnum.OFFICIAL_SUPPLIER.getCode());
                 boolean updateMain = baseMapper.updateById(supplierInfoVo) > 0;
                 boolean updateMain = baseMapper.updateById(supplierInfoVo) > 0;
-                if (updateMain == false){
+                if (updateMain == false) {
                     throw new RuntimeException("更新供应商信息失败");
                     throw new RuntimeException("更新供应商信息失败");
                 }
                 }
                 boolean remove = supplierInfoTemporaryService.remove(new LambdaQueryWrapper<SupplierInfoTemporary>().eq(SupplierInfoTemporary::getSupplierId, id));
                 boolean remove = supplierInfoTemporaryService.remove(new LambdaQueryWrapper<SupplierInfoTemporary>().eq(SupplierInfoTemporary::getSupplierId, id));
@@ -356,16 +350,16 @@ public class SupplierInfoServiceImpl  extends ServiceImpl<SupplierInfoMapper, Su
         Long id = bo.getId();
         Long id = bo.getId();
         SupplierInfo supplierInfo = baseMapper.selectById(id);
         SupplierInfo supplierInfo = baseMapper.selectById(id);
         //如果是待审核和审核不通过 随便改
         //如果是待审核和审核不通过 随便改
-        if (bo.getSupplyStatus() == SupplierStatusEnum.PENDING_REVIEW.getCode() || bo.getSupplyStatus() == SupplierStatusEnum.REVIEW_FAILED.getCode()){
+        if (bo.getSupplyStatus() == SupplierStatusEnum.PENDING_REVIEW.getCode() || bo.getSupplyStatus() == SupplierStatusEnum.REVIEW_FAILED.getCode()) {
             SupplierInfo update = MapstructUtils.convert(bo, SupplierInfo.class);
             SupplierInfo update = MapstructUtils.convert(bo, SupplierInfo.class);
             return baseMapper.updateById(update) > 0;
             return baseMapper.updateById(update) > 0;
         }
         }
         //如果是启用状态,就变成待修改审核状态
         //如果是启用状态,就变成待修改审核状态
-        if (supplierInfo.getSupplyStatus() == SupplierStatusEnum.OFFICIAL_SUPPLIER.getCode()){
+        if (supplierInfo.getSupplyStatus() == SupplierStatusEnum.OFFICIAL_SUPPLIER.getCode()) {
             SupplierInfoTemporary supplierInfoTemporary = supplierInfoTemporaryService.querBySupplierId(id);
             SupplierInfoTemporary supplierInfoTemporary = supplierInfoTemporaryService.querBySupplierId(id);
-            if (supplierInfoTemporary == null){
+            if (supplierInfoTemporary == null) {
                 supplierInfoTemporary = new SupplierInfoTemporary();
                 supplierInfoTemporary = new SupplierInfoTemporary();
-                BeanUtils.copyProperties(supplierInfo, supplierInfoTemporary,"id");
+                BeanUtils.copyProperties(supplierInfo, supplierInfoTemporary, "id");
                 supplierInfoTemporary.setSupplierId(id);
                 supplierInfoTemporary.setSupplierId(id);
                 //通过传参在set临时表
                 //通过传参在set临时表
                 //查询供应地址 存入  areaListJson  为了回显
                 //查询供应地址 存入  areaListJson  为了回显
@@ -377,57 +371,57 @@ public class SupplierInfoServiceImpl  extends ServiceImpl<SupplierInfoMapper, Su
                 supplierInfoTemporary.setAreaListJson(areaListJson);
                 supplierInfoTemporary.setAreaListJson(areaListJson);
                 supplierInfoTemporary.setSupplyStatus(SupplierStatusEnum.REVIEW_UPDATED.getCode());
                 supplierInfoTemporary.setSupplyStatus(SupplierStatusEnum.REVIEW_UPDATED.getCode());
                 boolean save = supplierInfoTemporaryService.save(supplierInfoTemporary);
                 boolean save = supplierInfoTemporaryService.save(supplierInfoTemporary);
-                if (save == false){
+                if (save == false) {
                     throw new RuntimeException("保存供应商待审核数据失败");
                     throw new RuntimeException("保存供应商待审核数据失败");
                 }
                 }
 
 
             }
             }
             //一共三个地方
             //一共三个地方
-            boolean flag =false;
+            boolean flag = false;
             //1.简称
             //1.简称
-            if (bo.getShortName() != null && StringUtils.isNotBlank(bo.getShortName())){
+            if (bo.getShortName() != null && StringUtils.isNotBlank(bo.getShortName())) {
                 supplierInfoTemporary.setShortName(bo.getShortName());
                 supplierInfoTemporary.setShortName(bo.getShortName());
                 flag = supplierInfoTemporaryService.updateById(supplierInfoTemporary);
                 flag = supplierInfoTemporaryService.updateById(supplierInfoTemporary);
             }
             }
             //2.供货品牌
             //2.供货品牌
-            if (bo.getOperatingBrand() != null && StringUtils.isNotBlank(bo.getOperatingBrand())){
+            if (bo.getOperatingBrand() != null && StringUtils.isNotBlank(bo.getOperatingBrand())) {
                 supplierInfoTemporary.setOperatingBrand(bo.getOperatingBrand());
                 supplierInfoTemporary.setOperatingBrand(bo.getOperatingBrand());
                 flag = supplierInfoTemporaryService.updateById(supplierInfoTemporary);
                 flag = supplierInfoTemporaryService.updateById(supplierInfoTemporary);
             }
             }
             //3.供货类目
             //3.供货类目
-            if (bo.getOperatingCategory() != null && StringUtils.isNotBlank(bo.getOperatingCategory())){
+            if (bo.getOperatingCategory() != null && StringUtils.isNotBlank(bo.getOperatingCategory())) {
                 supplierInfoTemporary.setOperatingCategory(bo.getOperatingCategory());
                 supplierInfoTemporary.setOperatingCategory(bo.getOperatingCategory());
                 flag = supplierInfoTemporaryService.updateById(supplierInfoTemporary);
                 flag = supplierInfoTemporaryService.updateById(supplierInfoTemporary);
             }
             }
 
 
             supplierInfo.setSupplyStatus(SupplierStatusEnum.REVIEW_UPDATED.getCode());
             supplierInfo.setSupplyStatus(SupplierStatusEnum.REVIEW_UPDATED.getCode());
-            boolean update =baseMapper.updateById(supplierInfo) > 0;
+            boolean update = baseMapper.updateById(supplierInfo) > 0;
             return update && flag;
             return update && flag;
         }
         }
         //如果是待审核状态,依旧是待修改审核状态
         //如果是待审核状态,依旧是待修改审核状态
-        if (supplierInfo.getSupplyStatus() == SupplierStatusEnum.REVIEW_UPDATED.getCode()){
+        if (supplierInfo.getSupplyStatus() == SupplierStatusEnum.REVIEW_UPDATED.getCode()) {
             SupplierInfoTemporary supplierInfoTemporary = supplierInfoTemporaryService.querBySupplierId(id);
             SupplierInfoTemporary supplierInfoTemporary = supplierInfoTemporaryService.querBySupplierId(id);
             //一共三个地方
             //一共三个地方
-            boolean flag =false;
+            boolean flag = false;
             //1.简称
             //1.简称
-            if (bo.getShortName() != null && StringUtils.isNotBlank(bo.getShortName())){
+            if (bo.getShortName() != null && StringUtils.isNotBlank(bo.getShortName())) {
                 supplierInfoTemporary.setShortName(bo.getShortName());
                 supplierInfoTemporary.setShortName(bo.getShortName());
                 flag = supplierInfoTemporaryService.updateById(supplierInfoTemporary);
                 flag = supplierInfoTemporaryService.updateById(supplierInfoTemporary);
             }
             }
             //2.供货品牌
             //2.供货品牌
-            if (bo.getOperatingBrand() != null && StringUtils.isNotBlank(bo.getOperatingBrand())){
+            if (bo.getOperatingBrand() != null && StringUtils.isNotBlank(bo.getOperatingBrand())) {
                 supplierInfoTemporary.setOperatingBrand(bo.getOperatingBrand());
                 supplierInfoTemporary.setOperatingBrand(bo.getOperatingBrand());
                 flag = supplierInfoTemporaryService.updateById(supplierInfoTemporary);
                 flag = supplierInfoTemporaryService.updateById(supplierInfoTemporary);
             }
             }
             //3.供货类目
             //3.供货类目
-            if (bo.getOperatingCategory() != null && StringUtils.isNotBlank(bo.getOperatingCategory())){
+            if (bo.getOperatingCategory() != null && StringUtils.isNotBlank(bo.getOperatingCategory())) {
                 supplierInfoTemporary.setOperatingCategory(bo.getOperatingCategory());
                 supplierInfoTemporary.setOperatingCategory(bo.getOperatingCategory());
                 flag = supplierInfoTemporaryService.updateById(supplierInfoTemporary);
                 flag = supplierInfoTemporaryService.updateById(supplierInfoTemporary);
             }
             }
             return flag;
             return flag;
         }
         }
         // 停用呢  不能修改了
         // 停用呢  不能修改了
-        if (supplierInfo.getSupplyStatus() == SupplierStatusEnum.DISABLED.getCode()){
+        if (supplierInfo.getSupplyStatus() == SupplierStatusEnum.DISABLED.getCode()) {
             throw new RuntimeException("供应商已停用,不能修改");
             throw new RuntimeException("供应商已停用,不能修改");
         }
         }
         return false;
         return false;
@@ -458,11 +452,11 @@ public class SupplierInfoServiceImpl  extends ServiceImpl<SupplierInfoMapper, Su
     public SupplierInfoVo queryById(Long id) throws JsonProcessingException {
     public SupplierInfoVo queryById(Long id) throws JsonProcessingException {
         SupplierInfoVo supplierInfoVo1 = baseMapper.selectVoOne(new LambdaQueryWrapper<SupplierInfo>().select(SupplierInfo::getSupplyStatus)
         SupplierInfoVo supplierInfoVo1 = baseMapper.selectVoOne(new LambdaQueryWrapper<SupplierInfo>().select(SupplierInfo::getSupplyStatus)
             .eq(SupplierInfo::getId, id));
             .eq(SupplierInfo::getId, id));
-        SupplierInfoVo supplierInfoVo =new SupplierInfoVo();
+        SupplierInfoVo supplierInfoVo = new SupplierInfoVo();
         if (supplierInfoVo1.getSupplyStatus() == SupplierStatusEnum.REVIEW_UPDATED.getCode()) {
         if (supplierInfoVo1.getSupplyStatus() == SupplierStatusEnum.REVIEW_UPDATED.getCode()) {
             SupplierInfoTemporaryVo supplierInfoTemporaryVo = supplierInfoTemporaryService.getVoOne(id);
             SupplierInfoTemporaryVo supplierInfoTemporaryVo = supplierInfoTemporaryService.getVoOne(id);
             BeanUtils.copyProperties(supplierInfoTemporaryVo, supplierInfoVo);
             BeanUtils.copyProperties(supplierInfoTemporaryVo, supplierInfoVo);
-        }else {
+        } else {
             supplierInfoVo = baseMapper.selectVoById(id);
             supplierInfoVo = baseMapper.selectVoById(id);
         }
         }
         SupplierInfoVo supplierInformationVo = handleProcurementInfo(supplierInfoVo);
         SupplierInfoVo supplierInformationVo = handleProcurementInfo(supplierInfoVo);
@@ -478,7 +472,6 @@ public class SupplierInfoServiceImpl  extends ServiceImpl<SupplierInfoMapper, Su
     }
     }
 
 
 
 
-
     /**
     /**
      * 分页查询供应商信息列表
      * 分页查询供应商信息列表
      *
      *
@@ -497,18 +490,18 @@ public class SupplierInfoServiceImpl  extends ServiceImpl<SupplierInfoMapper, Su
     public TableDataInfo<SupplierInfoVo> getSupplierInformation(SupplierInfoBo bo, PageQuery pageQuery) {
     public TableDataInfo<SupplierInfoVo> getSupplierInformation(SupplierInfoBo bo, PageQuery pageQuery) {
         LambdaQueryWrapper<SupplierInfo> lqw = new LambdaQueryWrapper<>();
         LambdaQueryWrapper<SupplierInfo> lqw = new LambdaQueryWrapper<>();
         // 1. 基础分页查询
         // 1. 基础分页查询
-        if (bo.getSupplyStatus() == null){
+        if (bo.getSupplyStatus() == null) {
             //正式供应商
             //正式供应商
             lqw.eq(SupplierInfo::getSupplyStatus, 1L);
             lqw.eq(SupplierInfo::getSupplyStatus, 1L);
-        }else {
-            lqw.eq(SupplierInfo::getSupplyStatus,bo.getSupplyStatus());
+        } else {
+            lqw.eq(SupplierInfo::getSupplyStatus, bo.getSupplyStatus());
         }
         }
 
 
         // 2. 添加品牌条件
         // 2. 添加品牌条件
-        if (bo.getOperatingBrand()!= null && StringUtils.isNotBlank(bo.getOperatingBrand())){
-            if (StringUtils.isNotBlank(bo.getOperatingBrand())){
+        if (bo.getOperatingBrand() != null && StringUtils.isNotBlank(bo.getOperatingBrand())) {
+            if (StringUtils.isNotBlank(bo.getOperatingBrand())) {
                 Long productBrandIdByName = remoteProductService.getProductBrandIdByName(bo.getOperatingBrand());
                 Long productBrandIdByName = remoteProductService.getProductBrandIdByName(bo.getOperatingBrand());
-                if (productBrandIdByName != null){
+                if (productBrandIdByName != null) {
                     lqw.like(SupplierInfo::getOperatingBrand, productBrandIdByName);
                     lqw.like(SupplierInfo::getOperatingBrand, productBrandIdByName);
                 }
                 }
             }
             }
@@ -556,7 +549,7 @@ public class SupplierInfoServiceImpl  extends ServiceImpl<SupplierInfoMapper, Su
 
 
     @Override
     @Override
     public TableDataInfo<SupplierInfoVo> getSupplierApproveInformation(SupplierInfoBo bo, PageQuery pageQuery) {
     public TableDataInfo<SupplierInfoVo> getSupplierApproveInformation(SupplierInfoBo bo, PageQuery pageQuery) {
-        if (bo.getSupplyStatus() == null){
+        if (bo.getSupplyStatus() == null) {
             // 步骤1:定义两个列表,存储主表(状态0)和临时表(状态4)的数据
             // 步骤1:定义两个列表,存储主表(状态0)和临时表(状态4)的数据
             List<SupplierInfoVo> mainTableVoList = new ArrayList<>();
             List<SupplierInfoVo> mainTableVoList = new ArrayList<>();
             List<SupplierInfoVo> tempTableVoList = new ArrayList<>();
             List<SupplierInfoVo> tempTableVoList = new ArrayList<>();
@@ -664,13 +657,13 @@ public class SupplierInfoServiceImpl  extends ServiceImpl<SupplierInfoMapper, Su
 
 
         // 1. 构建审批状态条件
         // 1. 构建审批状态条件
         LambdaQueryWrapper<SupplierInfo> lqw = new LambdaQueryWrapper<>();
         LambdaQueryWrapper<SupplierInfo> lqw = new LambdaQueryWrapper<>();
-        lqw.eq(SupplierInfo::getSupplyStatus,bo.getSupplyStatus());
+        lqw.eq(SupplierInfo::getSupplyStatus, bo.getSupplyStatus());
 
 
         // 2.添加品牌条件
         // 2.添加品牌条件
-        if (bo.getOperatingBrand()!= null && StringUtils.isNotBlank(bo.getOperatingBrand())){
-            if (StringUtils.isNotBlank(bo.getOperatingBrand())){
+        if (bo.getOperatingBrand() != null && StringUtils.isNotBlank(bo.getOperatingBrand())) {
+            if (StringUtils.isNotBlank(bo.getOperatingBrand())) {
                 Long productBrandIdByName = remoteProductService.getProductBrandIdByName(bo.getOperatingBrand());
                 Long productBrandIdByName = remoteProductService.getProductBrandIdByName(bo.getOperatingBrand());
-                if (productBrandIdByName != null){
+                if (productBrandIdByName != null) {
                     lqw.like(SupplierInfo::getOperatingBrand, productBrandIdByName);
                     lqw.like(SupplierInfo::getOperatingBrand, productBrandIdByName);
                 }
                 }
             }
             }
@@ -813,9 +806,9 @@ public class SupplierInfoServiceImpl  extends ServiceImpl<SupplierInfoMapper, Su
         lqw.eq(StringUtils.isNotBlank(bo.getSupplierName()), SupplierInfo::getEnterpriseName, bo.getSupplierName());
         lqw.eq(StringUtils.isNotBlank(bo.getSupplierName()), SupplierInfo::getEnterpriseName, bo.getSupplierName());
 
 
         //可供应品牌
         //可供应品牌
-        if (StringUtils.isNotBlank(bo.getSupplyBrand())){
+        if (StringUtils.isNotBlank(bo.getSupplyBrand())) {
             Long productBrandIdByName = remoteProductService.getProductBrandIdByName(bo.getSupplyBrand());
             Long productBrandIdByName = remoteProductService.getProductBrandIdByName(bo.getSupplyBrand());
-            if (productBrandIdByName != null){
+            if (productBrandIdByName != null) {
                 lqw.like(SupplierInfo::getOperatingBrand, productBrandIdByName);
                 lqw.like(SupplierInfo::getOperatingBrand, productBrandIdByName);
             }
             }
         }
         }
@@ -823,10 +816,10 @@ public class SupplierInfoServiceImpl  extends ServiceImpl<SupplierInfoMapper, Su
         if (StringUtils.isNotBlank(bo.getProvince()) || StringUtils.isNotBlank(bo.getCity())) {
         if (StringUtils.isNotBlank(bo.getProvince()) || StringUtils.isNotBlank(bo.getCity())) {
             // 查询符合条件的供应商ID列表
             // 查询符合条件的供应商ID列表
             List<Long> supplierIds = supplyAreaService.getSupplierIdsByArea(bo.getProvince(), bo.getCity());
             List<Long> supplierIds = supplyAreaService.getSupplierIdsByArea(bo.getProvince(), bo.getCity());
-            if (supplierIds != null &&!supplierIds.isEmpty()) {
+            if (supplierIds != null && !supplierIds.isEmpty()) {
                 lqw.in(SupplierInfo::getId, supplierIds);
                 lqw.in(SupplierInfo::getId, supplierIds);
 
 
-            }else {
+            } else {
                 lqw.in(SupplierInfo::getId, -1L);
                 lqw.in(SupplierInfo::getId, -1L);
 
 
             }
             }
@@ -836,9 +829,9 @@ public class SupplierInfoServiceImpl  extends ServiceImpl<SupplierInfoMapper, Su
         if (StringUtils.isNotBlank(bo.getBrandName())) {
         if (StringUtils.isNotBlank(bo.getBrandName())) {
             // 通过SupplierAuthorizeService查询符合条件的供应商ID
             // 通过SupplierAuthorizeService查询符合条件的供应商ID
             List<Long> supplierIdsByBrand = commonSupplierAuthorizeMapper.getSupplierIdsByBrandName(bo.getBrandName());
             List<Long> supplierIdsByBrand = commonSupplierAuthorizeMapper.getSupplierIdsByBrandName(bo.getBrandName());
-            if (supplierIdsByBrand!=null &&!supplierIdsByBrand.isEmpty()) {
+            if (supplierIdsByBrand != null && !supplierIdsByBrand.isEmpty()) {
                 lqw.in(SupplierInfo::getId, supplierIdsByBrand);
                 lqw.in(SupplierInfo::getId, supplierIdsByBrand);
-            }else {
+            } else {
                 lqw.in(SupplierInfo::getId, -1L);
                 lqw.in(SupplierInfo::getId, -1L);
 
 
             }
             }
@@ -889,7 +882,7 @@ public class SupplierInfoServiceImpl  extends ServiceImpl<SupplierInfoMapper, Su
     @Override
     @Override
     public Long getSupplierStatus(Long id) {
     public Long getSupplierStatus(Long id) {
         SupplierInfoVo supplierInfoVo1 = baseMapper.selectVoOne(new LambdaQueryWrapper<SupplierInfo>().select(SupplierInfo::getSupplyStatus)
         SupplierInfoVo supplierInfoVo1 = baseMapper.selectVoOne(new LambdaQueryWrapper<SupplierInfo>().select(SupplierInfo::getSupplyStatus)
-            .eq(SupplierInfo::getId,id));
+            .eq(SupplierInfo::getId, id));
 
 
         return supplierInfoVo1.getSupplyStatus();
         return supplierInfoVo1.getSupplyStatus();
     }
     }
@@ -941,6 +934,7 @@ public class SupplierInfoServiceImpl  extends ServiceImpl<SupplierInfoMapper, Su
     }
     }
 
 
     // ========== 3. 数据转换 - 映射构建方法 ==========
     // ========== 3. 数据转换 - 映射构建方法 ==========
+
     /**
     /**
      * 构建品牌ID→名称映射表
      * 构建品牌ID→名称映射表
      */
      */
@@ -1421,7 +1415,6 @@ public class SupplierInfoServiceImpl  extends ServiceImpl<SupplierInfoMapper, Su
     }
     }
 
 
 
 
-
     private SupplierInfoVo handleProcurementInfo(SupplierInfoVo records) {
     private SupplierInfoVo handleProcurementInfo(SupplierInfoVo records) {
 
 
         // 查询管理人员和采购人员
         // 查询管理人员和采购人员
@@ -1565,7 +1558,6 @@ public class SupplierInfoServiceImpl  extends ServiceImpl<SupplierInfoMapper, Su
     }*/
     }*/
 
 
 
 
-
     /**
     /**
      * 处理采购员和产品经理信息和品牌和供应商类型
      * 处理采购员和产品经理信息和品牌和供应商类型
      */
      */
@@ -1951,12 +1943,18 @@ public class SupplierInfoServiceImpl  extends ServiceImpl<SupplierInfoMapper, Su
      * @param bo
      * @param bo
      */
      */
     @Override
     @Override
-    public Boolean register(CustomerRegisterBo bo) {
+    @Transactional(rollbackFor = Exception.class)
+    public Boolean register(SupplierRegisterBo bo) {
         //先校验验证码是否正确
         //先校验验证码是否正确
         String code = RedisUtils.getCacheObject(GlobalConstants.CAPTCHA_CODE_KEY + bo.getPurchasePhone());
         String code = RedisUtils.getCacheObject(GlobalConstants.CAPTCHA_CODE_KEY + bo.getPurchasePhone());
-        code = "123456";
+
+        if (code == null) {
+            throw new ServiceException("验证码已过期");
+        }
+
         if (!code.equals(bo.getCode())) {
         if (!code.equals(bo.getCode())) {
             throw new ServiceException("验证码错误");
             throw new ServiceException("验证码错误");
+
         }
         }
 
 
         //校验密码与确认密码是否一致
         //校验密码与确认密码是否一致
@@ -1966,23 +1964,47 @@ public class SupplierInfoServiceImpl  extends ServiceImpl<SupplierInfoMapper, Su
 
 
         //查询数据库是否存在企业,已存在则提示客户已存在
         //查询数据库是否存在企业,已存在则提示客户已存在
         SupplierInfo one = baseMapper.selectOne(new LambdaQueryWrapper<SupplierInfo>()
         SupplierInfo one = baseMapper.selectOne(new LambdaQueryWrapper<SupplierInfo>()
-            .eq(SupplierInfo::getSupplierName, bo.getCustomerName())
+            .eq(SupplierInfo::getSupplierName, bo.getEnterpriseName())
         );
         );
+
         if (one != null) {
         if (one != null) {
-            throw new ServiceException("客户已存在");
+            throw new ServiceException("供应商已存在");
         }
         }
 
 
         //查询企查查是否存在企业,如果企查查不存在则提示企业不存在
         //查询企查查是否存在企业,如果企查查不存在则提示企业不存在
-        CompanyInfoResponse companyInfo = QccUtils.getCompanyInfo(bo.getCustomerName());
+        CompanyInfoResponse companyInfo = QccUtils.getCompanyInfo(bo.getEnterpriseName());
         if (companyInfo == null || companyInfo.getResult() == null) {
         if (companyInfo == null || companyInfo.getResult() == null) {
             throw new ServiceException("请检查企业名是否正确");
             throw new ServiceException("请检查企业名是否正确");
         }
         }
 
 
         //构建客户信息实体
         //构建客户信息实体
         SupplierInfo supplierInfo = new SupplierInfo();
         SupplierInfo supplierInfo = new SupplierInfo();
-        supplierInfo.setSupplierName(bo.getCustomerName());
-        supplierInfo.setSupplierName(companyInfo.getResult().getName());
+        LambdaQueryWrapper<SupplierInfo> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+        // 按supplier_no降序排序,取第一条(最大值)
+        lambdaQueryWrapper.select(SupplierInfo::getSupplierNo)
+            .orderByDesc(SupplierInfo::getSupplierNo)
+            .last("LIMIT 1");
+        SupplierInfo maxSupplier = baseMapper.selectOne(lambdaQueryWrapper);
+        long l = Long.parseLong(maxSupplier.getSupplierNo()) + 1;
+        supplierInfo.setSupplierNo(String.valueOf(l));
+        // supplierInfo.setSupplierName(bo.getCustomerName()); //表中的该字段是表示 供应商联系人的名称
+        supplierInfo.setEnterpriseName(bo.getEnterpriseName());//表示供应商名称
+        supplierInfo.setBusinessName(companyInfo.getResult().getName());//表示供应商的工商名称
+        supplierInfo.setInvoiceHeader(companyInfo.getResult().getName());
         supplierInfo.setShortName(companyInfo.getResult().getName());
         supplierInfo.setShortName(companyInfo.getResult().getName());
+        supplierInfo.setMembershipSize(bo.getMembershipSize());
+        supplierInfo.setFixedPhone(bo.getFixedPhone());
+        supplierInfo.setFax(bo.getFax());
+        supplierInfo.setUrl(bo.getUrl());
+        supplierInfo.setMailbox(bo.getMailbox());
+        supplierInfo.setOfficeProvince(bo.getOfficeProvince());
+        supplierInfo.setOfficeCity(bo.getOfficeCity());
+        supplierInfo.setOfficeCounty(bo.getOfficeCounty());
+        supplierInfo.setOfficeAddress(bo.getOfficeAddress());
+        supplierInfo.setSocialCreditCode(companyInfo.getResult().getCreditCode());
+        supplierInfo.setYearSales(bo.getYearSales());
+        supplierInfo.setOperatingCategory(bo.getOperatingCategory());
+        supplierInfo.setBusinessLicense(bo.getBusinessLicense());
 
 
         // 设置其他工商信息
         // 设置其他工商信息
         if (baseMapper.insert(supplierInfo) <= 0) {
         if (baseMapper.insert(supplierInfo) <= 0) {
@@ -1991,27 +2013,49 @@ public class SupplierInfoServiceImpl  extends ServiceImpl<SupplierInfoMapper, Su
 
 
         Long supplierId = supplierInfo.getId();
         Long supplierId = supplierInfo.getId();
 
 
+        String supplierNo = supplierInfo.getSupplierNo();
+
         // 添加客户工商信息
         // 添加客户工商信息
         SupplierBusinessInfo businessInfo = new SupplierBusinessInfo();
         SupplierBusinessInfo businessInfo = new SupplierBusinessInfo();
         businessInfo.setSupplierId(supplierId);
         businessInfo.setSupplierId(supplierId);
         businessInfo.setBusinessName(companyInfo.getResult().getName());
         businessInfo.setBusinessName(companyInfo.getResult().getName());
         businessInfo.setSocialCreditCode(companyInfo.getResult().getCreditCode());
         businessInfo.setSocialCreditCode(companyInfo.getResult().getCreditCode());
         businessInfo.setLegalPersonName(companyInfo.getResult().getOperName());
         businessInfo.setLegalPersonName(companyInfo.getResult().getOperName());
-        businessInfo.setRegisteredCapital(companyInfo.getResult().getRegistCapi());
+//        businessInfo.setRegisteredCapital(companyInfo.getResult().getRegistCapi());
+        // 注册资本:拼接数值 + 单位(如 "101万元")
+        String regCap = companyInfo.getResult().getRegisteredCapital();
+        String regUnit = companyInfo.getResult().getRegisteredCapitalUnit();
+        businessInfo.setRegisteredCapital(
+            StringUtils.isNotBlank(regCap) && StringUtils.isNotBlank(regUnit)
+                ? regCap + regUnit
+                : regCap
+        );
+
+        // 实缴资本
+        String paidCap = companyInfo.getResult().getPaidUpCapital();
+        String paidUnit = companyInfo.getResult().getPaidUpCapitalUnit();
+        businessInfo.setPaidInCapital(
+            StringUtils.isNotBlank(paidCap) && StringUtils.isNotBlank(paidUnit)
+                ? paidCap + paidUnit
+                : paidCap
+        );
+
         businessInfo.setEstablishmentDate(DateUtils.parseDate((companyInfo.getResult().getStartDate())));
         businessInfo.setEstablishmentDate(DateUtils.parseDate((companyInfo.getResult().getStartDate())));
         businessInfo.setRegistrationStatus(companyInfo.getResult().getStatus());
         businessInfo.setRegistrationStatus(companyInfo.getResult().getStatus());
+        businessInfo.setRegistrationAuthority(companyInfo.getResult().getBelongOrg());
         businessInfo.setBusinessAddress(companyInfo.getResult().getAddress());
         businessInfo.setBusinessAddress(companyInfo.getResult().getAddress());
         businessInfo.setBussinessRange(companyInfo.getResult().getScope());
         businessInfo.setBussinessRange(companyInfo.getResult().getScope());
         businessInfo.setStatus("0");
         businessInfo.setStatus("0");
         businessInfo.setDelFlag("0");
         businessInfo.setDelFlag("0");
 
 
         if (supplierBusinessInfoMapper.insert(businessInfo) <= 0) {
         if (supplierBusinessInfoMapper.insert(businessInfo) <= 0) {
-            throw new ServiceException("客户工商信息新增失败");
+            throw new ServiceException("供应商工商信息新增失败");
         }
         }
 
 
         // 添加客户联系人信息
         // 添加客户联系人信息
         SupplierContact contact = new SupplierContact();
         SupplierContact contact = new SupplierContact();
         contact.setSupplierId(supplierId);
         contact.setSupplierId(supplierId);
+        contact.setSupplierNo(supplierNo);
         contact.setUserName(bo.getPurchaseName());
         contact.setUserName(bo.getPurchaseName());
         contact.setPhone(bo.getPurchasePhone());
         contact.setPhone(bo.getPurchasePhone());
         contact.setPhone(bo.getPurchasePhone());
         contact.setPhone(bo.getPurchasePhone());
@@ -2021,13 +2065,44 @@ public class SupplierInfoServiceImpl  extends ServiceImpl<SupplierInfoMapper, Su
         contact.setDelFlag("0");
         contact.setDelFlag("0");
 
 
         if (supplierContactMapper.insert(contact) <= 0) {
         if (supplierContactMapper.insert(contact) <= 0) {
-            throw new ServiceException("客户联系人信息新增失败");
+            throw new ServiceException("供应商联系人信息新增失败");
+        }
+
+        List<SupplyAreaBo> supplyAreaList = bo.getSupplyAreaList();
+        if (supplyAreaList == null || supplyAreaList.isEmpty()) {
+            throw new ServiceException("供应商供应区域为空");
+        }
+
+        // 1. 内存中转换对象
+        List<SupplyArea> insertList = new ArrayList<>(supplyAreaList.size());
+        Set<String> uniqueCodes = new HashSet<>();
+        for (SupplyAreaBo area : supplyAreaList) {
+            if (!uniqueCodes.add(area.getAreaCode())) {
+                throw new ServiceException("供应区域代码 [" + area.getAreaCode() + "] 重复");
+            }
+            SupplyArea supplyArea = new SupplyArea();
+            supplyArea.setSupplierId(supplierId);
+            supplyArea.setSupplyNo(supplierNo);
+            supplyArea.setAreaCode(area.getAreaCode());
+            supplyArea.setAreaName(area.getAreaName());
+            supplyArea.setParentCode(area.getParentCode());
+            supplyArea.setLevel(area.getLevel());
+            supplyArea.setDelFlag("0");
+            supplyArea.setStatus("0");
+            insertList.add(supplyArea);
+        }
+
+        // 2. 执行批量插入
+        boolean b = supplyAreaMapper.insertBatch(insertList);
+
+        if (!b) {
+            throw new ServiceException("供应商供应区域信息批量新增失败");
         }
         }
 
 
         // 创建系统用户
         // 创建系统用户
         RemoteUserBo remoteUserBo = new RemoteUserBo();
         RemoteUserBo remoteUserBo = new RemoteUserBo();
         remoteUserBo.setUserName(bo.getPurchasePhone());
         remoteUserBo.setUserName(bo.getPurchasePhone());
-        remoteUserBo.setNickName(bo.getCustomerName());
+        remoteUserBo.setNickName(bo.getPurchaseName());
         remoteUserBo.setPhonenumber(bo.getPurchasePhone());
         remoteUserBo.setPhonenumber(bo.getPurchasePhone());
         remoteUserBo.setPassword(BCrypt.hashpw(bo.getPassword()));
         remoteUserBo.setPassword(BCrypt.hashpw(bo.getPassword()));
         remoteUserBo.setUserSonType("3"); // 商城用户
         remoteUserBo.setUserSonType("3"); // 商城用户
@@ -2036,13 +2111,13 @@ public class SupplierInfoServiceImpl  extends ServiceImpl<SupplierInfoMapper, Su
 
 
         remoteUserService.addUser(remoteUserBo);
         remoteUserService.addUser(remoteUserBo);
 
 
-        log.info("客户注册成功,客户ID:{},客户名称:{}", supplierId, bo.getCustomerName());
+        log.info("供应商注册成功,供应商ID:{},供应商名称:{}", supplierId, bo.getEnterpriseName());
         return true;
         return true;
     }
     }
 
 
     @Override
     @Override
     public List<SupplierInfoVo> getNameList() {
     public List<SupplierInfoVo> getNameList() {
-        List<SupplierInfoVo> supplierInfoVos = baseMapper.selectVoList(new LambdaQueryWrapper<SupplierInfo>().select(SupplierInfo::getId, SupplierInfo::getEnterpriseName,SupplierInfo::getSupplierNo));
+        List<SupplierInfoVo> supplierInfoVos = baseMapper.selectVoList(new LambdaQueryWrapper<SupplierInfo>().select(SupplierInfo::getId, SupplierInfo::getEnterpriseName, SupplierInfo::getSupplierNo));
         return supplierInfoVos;
         return supplierInfoVos;
     }
     }
 }
 }

+ 2 - 1
ruoyi-modules/ruoyi-resource/src/main/java/org/dromara/resource/controller/SysOssController.java

@@ -22,6 +22,7 @@ import org.springframework.web.multipart.MultipartFile;
 
 
 import jakarta.servlet.http.HttpServletResponse;
 import jakarta.servlet.http.HttpServletResponse;
 import jakarta.validation.constraints.NotEmpty;
 import jakarta.validation.constraints.NotEmpty;
+
 import java.io.IOException;
 import java.io.IOException;
 import java.util.Arrays;
 import java.util.Arrays;
 import java.util.List;
 import java.util.List;
@@ -65,7 +66,7 @@ public class SysOssController extends BaseController {
      *
      *
      * @param file 文件
      * @param file 文件
      */
      */
-    @SaCheckPermission("system:oss:upload")
+//    @SaCheckPermission("system:oss:upload")
     @Log(title = "OSS对象存储", businessType = BusinessType.INSERT)
     @Log(title = "OSS对象存储", businessType = BusinessType.INSERT)
     @PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
     @PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
     public R<SysOssUploadVo> upload(@RequestPart("file") MultipartFile file) {
     public R<SysOssUploadVo> upload(@RequestPart("file") MultipartFile file) {

+ 15 - 1
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/controller/pc/PcSysUserController.java

@@ -2,9 +2,13 @@ package org.dromara.system.controller.pc;
 
 
 import cn.hutool.crypto.digest.BCrypt;
 import cn.hutool.crypto.digest.BCrypt;
 import lombok.RequiredArgsConstructor;
 import lombok.RequiredArgsConstructor;
+import org.dromara.common.core.constant.GlobalConstants;
 import org.dromara.common.core.domain.R;
 import org.dromara.common.core.domain.R;
+import org.dromara.common.core.exception.ServiceException;
+import org.dromara.common.redis.utils.RedisUtils;
 import org.dromara.common.satoken.utils.LoginHelper;
 import org.dromara.common.satoken.utils.LoginHelper;
 import org.dromara.common.web.core.BaseController;
 import org.dromara.common.web.core.BaseController;
+import org.dromara.system.domain.bo.ChangeUserPwdBo;
 import org.dromara.system.domain.bo.SysUserBo;
 import org.dromara.system.domain.bo.SysUserBo;
 import org.dromara.system.service.ISysUserService;
 import org.dromara.system.service.ISysUserService;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.validation.annotation.Validated;
@@ -26,9 +30,19 @@ public class PcSysUserController extends BaseController {
      * 重置密码
      * 重置密码
      */
      */
     @PutMapping("/changePwd")
     @PutMapping("/changePwd")
-    public R<Void> changePwd(@RequestBody SysUserBo user) {
+    public R<Void> changePwd(@RequestBody ChangeUserPwdBo user) {
         Long userId = LoginHelper.getLoginUser().getUserId();
         Long userId = LoginHelper.getLoginUser().getUserId();
         user.setUserId(userId);
         user.setUserId(userId);
+        //先校验验证码是否正确
+        String code = RedisUtils.getCacheObject(GlobalConstants.CAPTCHA_CODE_KEY + user.getPhonenumber());
+        if (!code.equals(user.getCode())) {
+            throw new ServiceException("验证码错误");
+        }
+
+        //校验密码与确认密码是否一致
+        if (!user.getPassword().equals(user.getConfirmPassword())) {
+            throw new ServiceException("密码与确认密码不一致");
+        }
         sysUserService.checkUserAllowed(user.getUserId());
         sysUserService.checkUserAllowed(user.getUserId());
         sysUserService.checkUserDataScope(user.getUserId());
         sysUserService.checkUserDataScope(user.getUserId());
         user.setPassword(BCrypt.hashpw(user.getPassword()));
         user.setPassword(BCrypt.hashpw(user.getPassword()));

+ 30 - 0
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/bo/ChangeUserPwdBo.java

@@ -0,0 +1,30 @@
+package org.dromara.system.domain.bo;
+
+import lombok.Data;
+
+@Data
+public class ChangeUserPwdBo {
+
+    /**
+     * 用户ID
+     */
+    private Long userId;
+
+    /**
+     * 手机号码
+     */
+    private String phonenumber;
+
+    /**
+     * 验证码
+     */
+    private String code;
+
+    /**
+     * 密码
+     */
+    private String password;
+
+    /*确认密码*/
+    private String confirmPassword;
+}

+ 10 - 2
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/bo/SysUserBo.java

@@ -72,11 +72,19 @@ public class SysUserBo extends BaseEntity {
      */
      */
     private String sex;
     private String sex;
 
 
+    /**
+     * 验证码
+     */
+    private String code;
+
     /**
     /**
      * 密码
      * 密码
      */
      */
     private String password;
     private String password;
 
 
+    /*确认密码*/
+    private String confirmPassword;
+
     /**
     /**
      * 帐号状态(0正常 1停用)
      * 帐号状态(0正常 1停用)
      */
      */
@@ -88,8 +96,8 @@ public class SysUserBo extends BaseEntity {
     private String remark;
     private String remark;
 
 
     /**
     /**
-    * 用户子类型 用户子类型(0=平台用户,1=供应商,2=伙伴商,3=商城用户)
-    * */
+     * 用户子类型 用户子类型(0=平台用户,1=供应商,2=伙伴商,3=商城用户)
+     */
     private String userSonType;
     private String userSonType;
 
 
     /**
     /**