ソースを参照

fix(customer): 修复客户联系人注册及部门权限控制问题

- 在CustomerContactServiceImpl中为远程用户对象添加手机号字段设置
- 新增CustomerRegisterController中的客户名称模糊查询接口selectByCustomerName
- 移除PcPurchaseHabitController中新增方法的校验组注解
- 注释掉SysDeptController中多个部门管理接口的权限检查注解以调整访问控制
hurx 1 ヶ月 前
コミット
f54ea2ffc6

+ 23 - 4
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/controller/pc/CustomerRegisterController.java

@@ -7,15 +7,16 @@ package org.dromara.customer.controller.pc;
 
 import lombok.RequiredArgsConstructor;
 import org.dromara.common.core.domain.R;
+import org.dromara.common.core.utils.StringUtils;
 import org.dromara.customer.domain.bo.CustomerRegisterBo;
 import org.dromara.customer.domain.bo.SupplierRegisterBo;
+import org.dromara.customer.domain.vo.CustomerInfoVo;
 import org.dromara.customer.service.ICustomerInfoService;
 import org.dromara.customer.service.ISupplierInfoService;
 import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
 
 @Validated
 @RequiredArgsConstructor
@@ -27,6 +28,24 @@ public class CustomerRegisterController {
 
     private final ISupplierInfoService supplierInfoService;
 
+    /**
+     * 获取客户名称模糊查询客户列表信息
+     *
+     * @param customerName 主键
+     */
+    @GetMapping("/selectByCustomerName/{customerName}")
+    public R<List<CustomerInfoVo>> selectByCustomerName(
+        @PathVariable("customerName") String customerName) {
+
+        if (StringUtils.isBlank(customerName)) {
+            return R.fail("客户名称不能为空");
+        }
+
+        List<CustomerInfoVo> customerInfoVoList = customerInfoService.selectByCustomerName(customerName);
+
+        return R.ok(customerInfoVoList);
+    }
+
     /**
      * 验证密码与验证码
      */

+ 1 - 1
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/controller/pc/PcPurchaseHabitController.java

@@ -31,7 +31,7 @@ public class PcPurchaseHabitController extends BaseController {
      */
     @Log(title = "PC-客户采购习惯", businessType = BusinessType.INSERT)
     @PostMapping()
-    public R<Void> add(@Validated(AddGroup.class) @RequestBody PurchaseHabitBo bo) {
+    public R<Void> add( @RequestBody PurchaseHabitBo bo) {
         // 获取当前登录用户的企业ID
         Long customerId = LoginHelper.getLoginUser().getCustomerId();
         // 强制设置企业ID,防止为其他企业添加地址

+ 1 - 0
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/service/impl/CustomerContactServiceImpl.java

@@ -208,6 +208,7 @@ public class CustomerContactServiceImpl extends ServiceImpl<CustomerContactMappe
         remoteUserBo.setNickName(bo.getContactName());
         remoteUserBo.setDeptId(bo.getDeptId());
         remoteUserBo.setUserName(bo.getPhone());// 用手机号做账号
+        remoteUserBo.setPhonenumber(bo.getPhone());
         String defaultPassword = "123456";
         remoteUserBo.setPassword(BCrypt.hashpw(defaultPassword));
         remoteUserBo.setUserSonType("3");

+ 7 - 7
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/controller/system/SysDeptController.java

@@ -47,7 +47,7 @@ public class SysDeptController extends BaseController {
      *
      * @param deptId 部门ID
      */
-    @SaCheckPermission("system:dept:list")
+//    @SaCheckPermission("system:dept:list")
     @GetMapping("/list/exclude/{deptId}")
     public R<List<SysDeptVo>> excludeChild(@PathVariable(value = "deptId", required = false) Long deptId) {
         List<SysDeptVo> depts = deptService.selectDeptList(new SysDeptBo());
@@ -59,7 +59,7 @@ public class SysDeptController extends BaseController {
     /**
      * 获取部门列表
      */
-    @SaCheckPermission("system:dept:list")
+//    @SaCheckPermission("system:dept:list")
     @GetMapping("/customerDeptList/{customerId}")
     public R<List<SysDeptVo>> customerDeptList(@PathVariable(value = "customerId", required = false) Long customerId) {
         List<SysDeptVo> depts = deptService.selectCustomerDeptList(customerId);
@@ -71,7 +71,7 @@ public class SysDeptController extends BaseController {
      *
      * @param deptId 部门ID
      */
-    @SaCheckPermission("system:dept:query")
+//    @SaCheckPermission("system:dept:query")
     @GetMapping(value = "/{deptId}")
     public R<SysDeptVo> getInfo(@PathVariable Long deptId) {
         deptService.checkDeptDataScope(deptId);
@@ -81,7 +81,7 @@ public class SysDeptController extends BaseController {
     /**
      * 新增部门
      */
-    @SaCheckPermission("system:dept:add")
+//    @SaCheckPermission("system:dept:add")
     @Log(title = "部门管理", businessType = BusinessType.INSERT)
     @PostMapping
     public R<Void> add(@Validated @RequestBody SysDeptBo dept) {
@@ -94,7 +94,7 @@ public class SysDeptController extends BaseController {
     /**
      * 修改部门
      */
-    @SaCheckPermission("system:dept:edit")
+//    @SaCheckPermission("system:dept:edit")
     @Log(title = "部门管理", businessType = BusinessType.UPDATE)
     @PutMapping
     public R<Void> edit(@Validated @RequestBody SysDeptBo dept) {
@@ -119,7 +119,7 @@ public class SysDeptController extends BaseController {
      *
      * @param deptId 部门ID
      */
-    @SaCheckPermission("system:dept:remove")
+//    @SaCheckPermission("system:dept:remove")
     @Log(title = "部门管理", businessType = BusinessType.DELETE)
     @DeleteMapping("/{deptId}")
     public R<Void> remove(@PathVariable Long deptId) {
@@ -141,7 +141,7 @@ public class SysDeptController extends BaseController {
      *
      * @param deptIds 部门ID串
      */
-    @SaCheckPermission("system:dept:query")
+//    @SaCheckPermission("system:dept:query")
     @GetMapping("/optionselect")
     public R<List<SysDeptVo>> optionselect(@RequestParam(required = false) Long[] deptIds) {
         return R.ok(deptService.selectDeptByIds(deptIds == null ? null : List.of(deptIds)));