feat(product): 添加商机关联产品功能并优化产品查询
- 在产品模块中添加了根据商机 ID 查询产品列表的功能 - 更新了产品分页查询接口,使用 goodsCateId 替代 cateId- 在 RpcConfiguration 中添加了 BusinessApi 客户端 -优化了 StoreProductMapper 中的产品查询条件
This commit is contained in:
parent
72b60dd1ab
commit
d1e94a0d3d
@ -110,6 +110,12 @@
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-monitor</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.cloud</groupId>
|
||||
<artifactId>yudao-module-crm-api</artifactId>
|
||||
<version>2.0.0-jdk8-snapshot</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
@ -1,8 +1,11 @@
|
||||
package cn.iocoder.yudao.module.product.controller.admin.storeproduct;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.module.hrm.api.crmbusiness.BusinessApi;
|
||||
import cn.iocoder.yudao.module.hrm.api.crmbusiness.dto.CrmBusinessProductDTO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.storeproduct.vo.*;
|
||||
import cn.iocoder.yudao.module.product.convert.storeproduct.StoreProductConvert;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.storeproduct.StoreProductDO;
|
||||
@ -25,8 +28,10 @@ import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
|
||||
|
||||
@Tag(name = "管理后台 - 商品")
|
||||
@RestController
|
||||
@ -39,6 +44,8 @@ public class StoreProductController {
|
||||
@Resource
|
||||
private StoreProductAttrValueService storeProductAttrValueService;
|
||||
|
||||
@Resource
|
||||
private BusinessApi businessApi;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建商品")
|
||||
@ -83,6 +90,25 @@ public class StoreProductController {
|
||||
return success(StoreProductConvert.INSTANCE.convertList(list));
|
||||
}
|
||||
|
||||
@GetMapping("/listByBusinessId")
|
||||
@Operation(summary = "获得指定商机的商品列表")
|
||||
@Parameter(name = "businessId", description = "商机ID", required = true, example = "1024,2048")
|
||||
@PreAuthorize("@ss.hasPermission('shop:store-product:query')")
|
||||
public CommonResult<List<StoreProductRespVO>> getStoreProductList(@RequestParam("businessId") Long businessId) {
|
||||
|
||||
// 获取商机绑定产品的信息
|
||||
List<CrmBusinessProductDTO> businessProductList = businessApi.getBusinessProduct(businessId).getCheckedData();
|
||||
// 获取产品编号
|
||||
Set<Long> ids = convertSet(businessProductList, CrmBusinessProductDTO::getProductId);
|
||||
|
||||
if (CollUtil.isNotEmpty(ids)) {
|
||||
List<StoreProductDO> list = storeProductService.getStoreProductList(ids);
|
||||
return success(StoreProductConvert.INSTANCE.convertList(list));
|
||||
}else {
|
||||
return success(CollUtil.newArrayList());
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得商品分页")
|
||||
@PreAuthorize("@ss.hasPermission('shop:store-product:query')")
|
||||
|
@ -28,8 +28,8 @@ public class StoreProductPageReqVO extends PageParam {
|
||||
@Schema(description = "库存售罄", example = "0")
|
||||
private String stock;
|
||||
|
||||
@Schema(description = "库存售罄", example = "0")
|
||||
private String cateId;
|
||||
@Schema(description = "商品分类id", example = "0")
|
||||
private String goodsCateId;
|
||||
|
||||
private List<Long> catIds;
|
||||
|
||||
|
@ -27,7 +27,7 @@ public interface StoreProductMapper extends BaseMapperX<StoreProductDO> {
|
||||
wrapper.likeIfPresent(StoreProductDO::getStoreName, reqVO.getStoreName())
|
||||
.likeIfPresent(StoreProductDO::getShopName, reqVO.getShopName())
|
||||
.eqIfPresent(StoreProductDO::getIsPostage, reqVO.getIsPostage())
|
||||
.eqIfPresent(StoreProductDO::getCateId, reqVO.getCateId())
|
||||
.eqIfPresent(StoreProductDO::getCateId, reqVO.getGoodsCateId())
|
||||
.orderByDesc(StoreProductDO::getId);
|
||||
|
||||
wrapper.eq(StoreProductDO::getIsShow, Convert.toInt(reqVO.getIsShow()));
|
||||
|
@ -1,11 +1,12 @@
|
||||
package cn.iocoder.yudao.module.product.framework.rpc.config;
|
||||
|
||||
import cn.iocoder.yudao.module.hrm.api.crmbusiness.BusinessApi;
|
||||
import cn.iocoder.yudao.module.member.api.level.MemberLevelApi;
|
||||
import cn.iocoder.yudao.module.member.api.user.MemberUserApi;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@EnableFeignClients(clients = {MemberUserApi.class, MemberLevelApi.class})
|
||||
@EnableFeignClients(clients = {MemberUserApi.class, MemberLevelApi.class, BusinessApi.class})
|
||||
public class RpcConfiguration {
|
||||
}
|
||||
|
@ -68,11 +68,16 @@ public interface DeptApi {
|
||||
@Parameter(name = "factoryId", description = "工厂编号", example = "100001", required = true)
|
||||
void deleteDept(@RequestParam("factoryId") Long factoryId);
|
||||
|
||||
@PostMapping(PREFIX + "/getByFactoryId")
|
||||
@GetMapping(PREFIX + "/getByFactoryId")
|
||||
@Operation(summary = "根据工厂ID获得部门信息")
|
||||
@Parameter(name = "factoryId", description = "工厂编号", example = "100001", required = true)
|
||||
CommonResult<DeptRespDTO> getDeptByFactoryId(@RequestParam("factoryId") Long factoryId);
|
||||
|
||||
@GetMapping(PREFIX + "/getByFactoryIds")
|
||||
@Operation(summary = "根据工厂ID获得部门信息")
|
||||
@Parameter(name = "factoryIds", description = "工厂编号", example = "100001", required = true)
|
||||
CommonResult<List<DeptRespDTO>> getDeptByFactoryIds(@RequestParam("factoryIds") Collection<Long> factoryIds);
|
||||
|
||||
|
||||
/**
|
||||
* 获得指定编号的部门 Map
|
||||
|
@ -10,9 +10,7 @@ import cn.iocoder.yudao.module.smartfactory.api.staff.StaffApi;
|
||||
import cn.iocoder.yudao.module.smartfactory.api.staff.dto.StaffDTO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.loan.vo.LoanPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.loan.vo.LoanRespVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.loan.LoanDO;
|
||||
import cn.iocoder.yudao.module.system.service.dept.DeptService;
|
||||
import cn.iocoder.yudao.module.system.service.loan.LoanService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
|
@ -5,7 +5,6 @@ import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.worklog.LogUseDO;
|
||||
import cn.iocoder.yudao.module.system.dal.mysql.worklog.LogUseMapper;
|
||||
import cn.iocoder.yudao.module.system.service.worklog.dto.LogUseSaveReqDTO;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
|
@ -6,9 +6,6 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.staff.vo.StaffPageReqVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.staff.vo.StaffRespVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.staff.vo.StaffSaveReqVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.staffsalary.vo.StaffSalaryPageReqVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.staffsalary.vo.StaffSalaryRespVO;
|
||||
import cn.iocoder.yudao.module.smartfactory.controller.admin.staffsalary.vo.StaffSalarySaveReqVO;
|
||||
@ -18,8 +15,6 @@ import cn.iocoder.yudao.module.smartfactory.dal.dataobject.staffsalary.StaffSala
|
||||
import cn.iocoder.yudao.module.smartfactory.service.factoryinfo.FactoryInfoService;
|
||||
import cn.iocoder.yudao.module.smartfactory.service.staff.StaffService;
|
||||
import cn.iocoder.yudao.module.smartfactory.service.staffsalary.StaffSalaryService;
|
||||
import cn.iocoder.yudao.module.system.api.loan.LoanApi;
|
||||
import cn.iocoder.yudao.module.system.api.loan.dto.LoanDTO;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
|
@ -27,7 +27,6 @@ import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap;
|
||||
import static cn.iocoder.yudao.module.smartfactory.enums.ErrorCodeConstants.STAFF_NOT_EXISTS;
|
||||
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.USER_IMPORT_LIST_IS_EMPTY;
|
||||
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.USER_USERNAME_EXISTS;
|
||||
|
Loading…
Reference in New Issue
Block a user