Browse Source

客户商机

zhaopeiqing 1 year ago
parent
commit
4683b08351

+ 30 - 0
yudao-module-customer/yudao-module-customer-biz/src/main/java/cn/iocoder/yudao/module/customer/controller/admin/info/CustomerInfoController.java

@@ -118,4 +118,34 @@ public class CustomerInfoController {
         return success(infoService.getCustomerCode());
         return success(infoService.getCustomerCode());
     }
     }
 
 
+    @PutMapping("/update-open-status")
+    @Operation(summary = "修改用户状态")
+    @PreAuthorize("@ss.hasPermission('system:user:update')")
+    public CommonResult<Boolean> updateOpenStatus(@Valid @RequestBody CustomerInfoOpenStatusReqVO reqVO) {
+        infoService.updateOpenStatus(reqVO.getId(), reqVO.getStatus());
+        return success(true);
+    }
+
+    @GetMapping("/list")
+    @Operation(summary = "获得客户信息列表")
+    @PreAuthorize("@ss.hasPermission('customer:info:query')")
+    public CommonResult<List<CustomerInfoRespVO>> getInfoList(@Valid CustomerInfoPageReqVO pageReqVO) {
+        pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
+        List<CustomerInfoDO> pageResult = infoService.getInfoPage(pageReqVO).getList();
+        List<CustomerInfoRespVO> result = BeanUtils.toBean(pageResult, CustomerInfoRespVO.class);
+        if (result != null && result.size() > 0) {
+            result.forEach(respVO -> {
+                // 部门
+                if (respVO.getDeptId() != null) {
+                    DeptRespDTO dept = deptApi.getDept(respVO.getDeptId());
+                    respVO.setDeptName(dept.getName());
+                    if (dept != null && StringUtils.isNotBlank(dept.getName())) {
+                        respVO.setDeptName(dept.getName());
+                    }
+                }
+            });
+        }
+        return success(result);
+    }
+
 }
 }

+ 23 - 0
yudao-module-customer/yudao-module-customer-biz/src/main/java/cn/iocoder/yudao/module/customer/controller/admin/info/vo/CustomerInfoOpenStatusReqVO.java

@@ -0,0 +1,23 @@
+package cn.iocoder.yudao.module.customer.controller.admin.info.vo;
+
+import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
+import cn.iocoder.yudao.framework.common.validation.InEnum;
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.Data;
+
+import javax.validation.constraints.NotNull;
+
+@Schema(description = "管理后台 - 客户信息开启状态 Request VO")
+@Data
+public class CustomerInfoOpenStatusReqVO {
+
+    @Schema(description = "客户ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
+    @NotNull(message = "客户ID不能为空")
+    private Long id;
+
+    @Schema(description = "状态,见 CommonStatusEnum 枚举", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
+    @NotNull(message = "状态不能为空")
+    @InEnum(value = CommonStatusEnum.class, message = "修改状态必须是 {value}")
+    private Integer status;
+
+}

+ 8 - 3
yudao-module-customer/yudao-module-customer-biz/src/main/java/cn/iocoder/yudao/module/customer/service/info/CustomerInfoService.java

@@ -1,13 +1,10 @@
 package cn.iocoder.yudao.module.customer.service.info;
 package cn.iocoder.yudao.module.customer.service.info;
 
 
-import java.util.*;
 import javax.validation.*;
 import javax.validation.*;
 
 
-import cn.iocoder.yudao.module.customer.controller.admin.businessopportunity.vo.CustomerBusinessOpportunityRespVO;
 import cn.iocoder.yudao.module.customer.controller.admin.info.vo.*;
 import cn.iocoder.yudao.module.customer.controller.admin.info.vo.*;
 import cn.iocoder.yudao.module.customer.dal.dataobject.info.CustomerInfoDO;
 import cn.iocoder.yudao.module.customer.dal.dataobject.info.CustomerInfoDO;
 import cn.iocoder.yudao.framework.common.pojo.PageResult;
 import cn.iocoder.yudao.framework.common.pojo.PageResult;
-import cn.iocoder.yudao.framework.common.pojo.PageParam;
 
 
 /**
 /**
  * 客户信息 Service 接口
  * 客户信息 Service 接口
@@ -70,4 +67,12 @@ public interface CustomerInfoService {
      */
      */
     String getCustomerCode();
     String getCustomerCode();
 
 
+    /**
+     * 修改开启状态
+     *
+     * @param id     用户编号
+     * @param status 状态
+     */
+    void updateOpenStatus(Long id, Integer status);
+
 }
 }

+ 12 - 0
yudao-module-customer/yudao-module-customer-biz/src/main/java/cn/iocoder/yudao/module/customer/service/info/CustomerInfoServiceImpl.java

@@ -167,4 +167,16 @@ public class CustomerInfoServiceImpl implements CustomerInfoService {
         return format + IdUtil.fastSimpleUUID();
         return format + IdUtil.fastSimpleUUID();
     }
     }
 
 
+    @Override
+    public void updateOpenStatus(Long id, Integer status) {
+        // 校验存在
+        validateInfoExists(id);
+        // 更新状态
+        // 更新状态
+        CustomerInfoDO updateObj = new CustomerInfoDO();
+        updateObj.setId(id);
+        updateObj.setIsOpen(status);
+        infoMapper.updateById(updateObj);
+    }
+
 }
 }