optimise-当同时启动mall和iot的时候会出现bean冲突[produt和productCategory相关的bean],重新命名了一下

pull/189/head
wuweigang 2025-05-05 20:55:36 +08:00
parent 18e4b1f33e
commit 2a74003fa8
8 changed files with 49 additions and 49 deletions

View File

@ -30,20 +30,20 @@ import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.
public class IotProductCategoryController { public class IotProductCategoryController {
@Resource @Resource
private IotProductCategoryService productCategoryService; private IotProductCategoryService iotProductCategoryService;
@PostMapping("/create") @PostMapping("/create")
@Operation(summary = "创建产品分类") @Operation(summary = "创建产品分类")
@PreAuthorize("@ss.hasPermission('iot:product-category:create')") @PreAuthorize("@ss.hasPermission('iot:product-category:create')")
public CommonResult<Long> createProductCategory(@Valid @RequestBody IotProductCategorySaveReqVO createReqVO) { public CommonResult<Long> createProductCategory(@Valid @RequestBody IotProductCategorySaveReqVO createReqVO) {
return success(productCategoryService.createProductCategory(createReqVO)); return success(iotProductCategoryService.createProductCategory(createReqVO));
} }
@PutMapping("/update") @PutMapping("/update")
@Operation(summary = "更新产品分类") @Operation(summary = "更新产品分类")
@PreAuthorize("@ss.hasPermission('iot:product-category:update')") @PreAuthorize("@ss.hasPermission('iot:product-category:update')")
public CommonResult<Boolean> updateProductCategory(@Valid @RequestBody IotProductCategorySaveReqVO updateReqVO) { public CommonResult<Boolean> updateProductCategory(@Valid @RequestBody IotProductCategorySaveReqVO updateReqVO) {
productCategoryService.updateProductCategory(updateReqVO); iotProductCategoryService.updateProductCategory(updateReqVO);
return success(true); return success(true);
} }
@ -52,7 +52,7 @@ public class IotProductCategoryController {
@Parameter(name = "id", description = "编号", required = true) @Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('iot:product-category:delete')") @PreAuthorize("@ss.hasPermission('iot:product-category:delete')")
public CommonResult<Boolean> deleteProductCategory(@RequestParam("id") Long id) { public CommonResult<Boolean> deleteProductCategory(@RequestParam("id") Long id) {
productCategoryService.deleteProductCategory(id); iotProductCategoryService.deleteProductCategory(id);
return success(true); return success(true);
} }
@ -61,7 +61,7 @@ public class IotProductCategoryController {
@Parameter(name = "id", description = "编号", required = true, example = "1024") @Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('iot:product-category:query')") @PreAuthorize("@ss.hasPermission('iot:product-category:query')")
public CommonResult<IotProductCategoryRespVO> getProductCategory(@RequestParam("id") Long id) { public CommonResult<IotProductCategoryRespVO> getProductCategory(@RequestParam("id") Long id) {
IotProductCategoryDO productCategory = productCategoryService.getProductCategory(id); IotProductCategoryDO productCategory = iotProductCategoryService.getProductCategory(id);
return success(BeanUtils.toBean(productCategory, IotProductCategoryRespVO.class)); return success(BeanUtils.toBean(productCategory, IotProductCategoryRespVO.class));
} }
@ -69,7 +69,7 @@ public class IotProductCategoryController {
@Operation(summary = "获得产品分类分页") @Operation(summary = "获得产品分类分页")
@PreAuthorize("@ss.hasPermission('iot:product-category:query')") @PreAuthorize("@ss.hasPermission('iot:product-category:query')")
public CommonResult<PageResult<IotProductCategoryRespVO>> getProductCategoryPage(@Valid IotProductCategoryPageReqVO pageReqVO) { public CommonResult<PageResult<IotProductCategoryRespVO>> getProductCategoryPage(@Valid IotProductCategoryPageReqVO pageReqVO) {
PageResult<IotProductCategoryDO> pageResult = productCategoryService.getProductCategoryPage(pageReqVO); PageResult<IotProductCategoryDO> pageResult = iotProductCategoryService.getProductCategoryPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, IotProductCategoryRespVO.class)); return success(BeanUtils.toBean(pageResult, IotProductCategoryRespVO.class));
} }
@ -77,7 +77,7 @@ public class IotProductCategoryController {
@Operation(summary = "获得所有产品分类列表") @Operation(summary = "获得所有产品分类列表")
@PreAuthorize("@ss.hasPermission('iot:product-category:query')") @PreAuthorize("@ss.hasPermission('iot:product-category:query')")
public CommonResult<List<IotProductCategoryRespVO>> getSimpleProductCategoryList() { public CommonResult<List<IotProductCategoryRespVO>> getSimpleProductCategoryList() {
List<IotProductCategoryDO> list = productCategoryService.getProductCategoryListByStatus( List<IotProductCategoryDO> list = iotProductCategoryService.getProductCategoryListByStatus(
CommonStatusEnum.ENABLE.getStatus()); CommonStatusEnum.ENABLE.getStatus());
return success(convertList(list, category -> return success(convertList(list, category ->
new IotProductCategoryRespVO().setId(category.getId()).setName(category.getName()))); new IotProductCategoryRespVO().setId(category.getId()).setName(category.getName())));

View File

@ -39,22 +39,22 @@ import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.
public class IotProductController { public class IotProductController {
@Resource @Resource
private IotProductService productService; private IotProductService iotProductService;
@Resource @Resource
private IotProductCategoryService categoryService; private IotProductCategoryService iotProductCategoryService;
@PostMapping("/create") @PostMapping("/create")
@Operation(summary = "创建产品") @Operation(summary = "创建产品")
@PreAuthorize("@ss.hasPermission('iot:product:create')") @PreAuthorize("@ss.hasPermission('iot:product:create')")
public CommonResult<Long> createProduct(@Valid @RequestBody IotProductSaveReqVO createReqVO) { public CommonResult<Long> createProduct(@Valid @RequestBody IotProductSaveReqVO createReqVO) {
return success(productService.createProduct(createReqVO)); return success(iotProductService.createProduct(createReqVO));
} }
@PutMapping("/update") @PutMapping("/update")
@Operation(summary = "更新产品") @Operation(summary = "更新产品")
@PreAuthorize("@ss.hasPermission('iot:product:update')") @PreAuthorize("@ss.hasPermission('iot:product:update')")
public CommonResult<Boolean> updateProduct(@Valid @RequestBody IotProductSaveReqVO updateReqVO) { public CommonResult<Boolean> updateProduct(@Valid @RequestBody IotProductSaveReqVO updateReqVO) {
productService.updateProduct(updateReqVO); iotProductService.updateProduct(updateReqVO);
return success(true); return success(true);
} }
@ -65,7 +65,7 @@ public class IotProductController {
@PreAuthorize("@ss.hasPermission('iot:product:update')") @PreAuthorize("@ss.hasPermission('iot:product:update')")
public CommonResult<Boolean> updateProductStatus(@RequestParam("id") Long id, public CommonResult<Boolean> updateProductStatus(@RequestParam("id") Long id,
@RequestParam("status") Integer status) { @RequestParam("status") Integer status) {
productService.updateProductStatus(id, status); iotProductService.updateProductStatus(id, status);
return success(true); return success(true);
} }
@ -74,7 +74,7 @@ public class IotProductController {
@Parameter(name = "id", description = "编号", required = true) @Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('iot:product:delete')") @PreAuthorize("@ss.hasPermission('iot:product:delete')")
public CommonResult<Boolean> deleteProduct(@RequestParam("id") Long id) { public CommonResult<Boolean> deleteProduct(@RequestParam("id") Long id) {
productService.deleteProduct(id); iotProductService.deleteProduct(id);
return success(true); return success(true);
} }
@ -83,9 +83,9 @@ public class IotProductController {
@Parameter(name = "id", description = "编号", required = true, example = "1024") @Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('iot:product:query')") @PreAuthorize("@ss.hasPermission('iot:product:query')")
public CommonResult<IotProductRespVO> getProduct(@RequestParam("id") Long id) { public CommonResult<IotProductRespVO> getProduct(@RequestParam("id") Long id) {
IotProductDO product = productService.getProduct(id); IotProductDO product = iotProductService.getProduct(id);
// 拼接数据 // 拼接数据
IotProductCategoryDO category = categoryService.getProductCategory(product.getCategoryId()); IotProductCategoryDO category = iotProductCategoryService.getProductCategory(product.getCategoryId());
return success(BeanUtils.toBean(product, IotProductRespVO.class, bean -> { return success(BeanUtils.toBean(product, IotProductRespVO.class, bean -> {
if (category != null) { if (category != null) {
bean.setCategoryName(category.getName()); bean.setCategoryName(category.getName());
@ -97,9 +97,9 @@ public class IotProductController {
@Operation(summary = "获得产品分页") @Operation(summary = "获得产品分页")
@PreAuthorize("@ss.hasPermission('iot:product:query')") @PreAuthorize("@ss.hasPermission('iot:product:query')")
public CommonResult<PageResult<IotProductRespVO>> getProductPage(@Valid IotProductPageReqVO pageReqVO) { public CommonResult<PageResult<IotProductRespVO>> getProductPage(@Valid IotProductPageReqVO pageReqVO) {
PageResult<IotProductDO> pageResult = productService.getProductPage(pageReqVO); PageResult<IotProductDO> pageResult = iotProductService.getProductPage(pageReqVO);
// 拼接数据 // 拼接数据
Map<Long, IotProductCategoryDO> categoryMap = categoryService.getProductCategoryMap( Map<Long, IotProductCategoryDO> categoryMap = iotProductCategoryService.getProductCategoryMap(
convertList(pageResult.getList(), IotProductDO::getCategoryId)); convertList(pageResult.getList(), IotProductDO::getCategoryId));
return success(BeanUtils.toBean(pageResult, IotProductRespVO.class, bean -> { return success(BeanUtils.toBean(pageResult, IotProductRespVO.class, bean -> {
MapUtils.findAndThen(categoryMap, bean.getCategoryId(), MapUtils.findAndThen(categoryMap, bean.getCategoryId(),
@ -123,7 +123,7 @@ public class IotProductController {
@GetMapping("/simple-list") @GetMapping("/simple-list")
@Operation(summary = "获取产品的精简信息列表", description = "主要用于前端的下拉选项") @Operation(summary = "获取产品的精简信息列表", description = "主要用于前端的下拉选项")
public CommonResult<List<IotProductRespVO>> getSimpleProductList() { public CommonResult<List<IotProductRespVO>> getSimpleProductList() {
List<IotProductDO> list = productService.getProductList(); List<IotProductDO> list = iotProductService.getProductList();
return success(convertList(list, product -> // 只返回 id、name 字段 return success(convertList(list, product -> // 只返回 id、name 字段
new IotProductRespVO().setId(product.getId()).setName(product.getName()) new IotProductRespVO().setId(product.getId()).setName(product.getName())
.setDeviceType(product.getDeviceType()))); .setDeviceType(product.getDeviceType())));

View File

@ -32,9 +32,9 @@ public class IotStatisticsController {
@Resource @Resource
private IotDeviceService deviceService; private IotDeviceService deviceService;
@Resource @Resource
private IotProductCategoryService productCategoryService; private IotProductCategoryService iotProductCategoryService;
@Resource @Resource
private IotProductService productService; private IotProductService iotProductService;
@Resource @Resource
private IotDeviceLogService deviceLogService; private IotDeviceLogService deviceLogService;
@ -43,20 +43,20 @@ public class IotStatisticsController {
public CommonResult<IotStatisticsSummaryRespVO> getIotStatisticsSummary(){ public CommonResult<IotStatisticsSummaryRespVO> getIotStatisticsSummary(){
IotStatisticsSummaryRespVO respVO = new IotStatisticsSummaryRespVO(); IotStatisticsSummaryRespVO respVO = new IotStatisticsSummaryRespVO();
// 1.1 获取总数 // 1.1 获取总数
respVO.setProductCategoryCount(productCategoryService.getProductCategoryCount(null)); respVO.setProductCategoryCount(iotProductCategoryService.getProductCategoryCount(null));
respVO.setProductCount(productService.getProductCount(null)); respVO.setProductCount(iotProductService.getProductCount(null));
respVO.setDeviceCount(deviceService.getDeviceCount(null)); respVO.setDeviceCount(deviceService.getDeviceCount(null));
respVO.setDeviceMessageCount(deviceLogService.getDeviceLogCount(null)); respVO.setDeviceMessageCount(deviceLogService.getDeviceLogCount(null));
// 1.2 获取今日新增数量 // 1.2 获取今日新增数量
// TODO @super使用 LocalDateTimeUtils.getToday() // TODO @super使用 LocalDateTimeUtils.getToday()
LocalDateTime todayStart = LocalDateTime.now().withHour(0).withMinute(0).withSecond(0); LocalDateTime todayStart = LocalDateTime.now().withHour(0).withMinute(0).withSecond(0);
respVO.setProductCategoryTodayCount(productCategoryService.getProductCategoryCount(todayStart)); respVO.setProductCategoryTodayCount(iotProductCategoryService.getProductCategoryCount(todayStart));
respVO.setProductTodayCount(productService.getProductCount(todayStart)); respVO.setProductTodayCount(iotProductService.getProductCount(todayStart));
respVO.setDeviceTodayCount(deviceService.getDeviceCount(todayStart)); respVO.setDeviceTodayCount(deviceService.getDeviceCount(todayStart));
respVO.setDeviceMessageTodayCount(deviceLogService.getDeviceLogCount(todayStart)); respVO.setDeviceMessageTodayCount(deviceLogService.getDeviceLogCount(todayStart));
// 2. 获取各个品类下设备数量统计 // 2. 获取各个品类下设备数量统计
respVO.setProductCategoryDeviceCounts(productCategoryService.getProductCategoryDeviceCountMap()); respVO.setProductCategoryDeviceCounts(iotProductCategoryService.getProductCategoryDeviceCountMap());
// 3. 获取设备状态数量统计 // 3. 获取设备状态数量统计
Map<Integer, Long> deviceCountMap = deviceService.getDeviceCountMapByState(); Map<Integer, Long> deviceCountMap = deviceService.getDeviceCountMapByState();

View File

@ -55,7 +55,7 @@ public class IotDeviceServiceImpl implements IotDeviceService {
private IotDeviceMapper deviceMapper; private IotDeviceMapper deviceMapper;
@Resource @Resource
private IotProductService productService; private IotProductService iotProductService;
@Resource @Resource
@Lazy // 延迟加载,解决循环依赖 @Lazy // 延迟加载,解决循环依赖
private IotDeviceGroupService deviceGroupService; private IotDeviceGroupService deviceGroupService;
@ -63,7 +63,7 @@ public class IotDeviceServiceImpl implements IotDeviceService {
@Override @Override
public Long createDevice(IotDeviceSaveReqVO createReqVO) { public Long createDevice(IotDeviceSaveReqVO createReqVO) {
// 1.1 校验产品是否存在 // 1.1 校验产品是否存在
IotProductDO product = productService.getProduct(createReqVO.getProductId()); IotProductDO product = iotProductService.getProduct(createReqVO.getProductId());
if (product == null) { if (product == null) {
throw exception(PRODUCT_NOT_EXISTS); throw exception(PRODUCT_NOT_EXISTS);
} }
@ -84,7 +84,7 @@ public class IotDeviceServiceImpl implements IotDeviceService {
public IotDeviceDO createDevice(String productKey, String deviceName, Long gatewayId) { public IotDeviceDO createDevice(String productKey, String deviceName, Long gatewayId) {
String deviceKey = generateDeviceKey(); String deviceKey = generateDeviceKey();
// 1.1 校验产品是否存在 // 1.1 校验产品是否存在
IotProductDO product = TenantUtils.executeIgnore(() -> productService.getProductByProductKey(productKey)); IotProductDO product = TenantUtils.executeIgnore(() -> iotProductService.getProductByProductKey(productKey));
if (product == null) { if (product == null) {
throw exception(PRODUCT_NOT_EXISTS); throw exception(PRODUCT_NOT_EXISTS);
} }
@ -348,7 +348,7 @@ public class IotDeviceServiceImpl implements IotDeviceService {
return; return;
} }
// 2.1.2 校验产品是否存在 // 2.1.2 校验产品是否存在
IotProductDO product = productService.validateProductExists(importDevice.getProductKey()); IotProductDO product = iotProductService.validateProductExists(importDevice.getProductKey());
// 2.1.3 校验父设备是否存在 // 2.1.3 校验父设备是否存在
Long gatewayId = null; Long gatewayId = null;
if (StrUtil.isNotEmpty(importDevice.getParentDeviceName())) { if (StrUtil.isNotEmpty(importDevice.getParentDeviceName())) {

View File

@ -64,7 +64,7 @@ public class IotDevicePropertyServiceImpl implements IotDevicePropertyService {
@Resource @Resource
private IotThingModelService thingModelService; private IotThingModelService thingModelService;
@Resource @Resource
private IotProductService productService; private IotProductService iotProductService;
@Resource @Resource
private DevicePropertyRedisDAO deviceDataRedisDAO; private DevicePropertyRedisDAO deviceDataRedisDAO;
@ -79,7 +79,7 @@ public class IotDevicePropertyServiceImpl implements IotDevicePropertyService {
@Override @Override
public void defineDevicePropertyData(Long productId) { public void defineDevicePropertyData(Long productId) {
// 1.1 查询产品和物模型 // 1.1 查询产品和物模型
IotProductDO product = productService.validateProductExists(productId); IotProductDO product = iotProductService.validateProductExists(productId);
List<IotThingModelDO> thingModels = filterList(thingModelService.getThingModelListByProductId(productId), List<IotThingModelDO> thingModels = filterList(thingModelService.getThingModelListByProductId(productId),
thingModel -> IotThingModelTypeEnum.PROPERTY.getType().equals(thingModel.getType())); thingModel -> IotThingModelTypeEnum.PROPERTY.getType().equals(thingModel.getType()));
// 1.2 解析 DB 里的字段 // 1.2 解析 DB 里的字段

View File

@ -33,7 +33,7 @@ public class IotOtaFirmwareServiceImpl implements IotOtaFirmwareService {
private IotOtaFirmwareMapper otaFirmwareMapper; private IotOtaFirmwareMapper otaFirmwareMapper;
@Lazy @Lazy
@Resource @Resource
private IotProductService productService; private IotProductService iotProductService;
@Override @Override
public Long createOtaFirmware(IotOtaFirmwareCreateReqVO saveReqVO) { public Long createOtaFirmware(IotOtaFirmwareCreateReqVO saveReqVO) {
@ -43,8 +43,8 @@ public class IotOtaFirmwareServiceImpl implements IotOtaFirmwareService {
// 2.1.转化数据格式,准备存储到数据库中 // 2.1.转化数据格式,准备存储到数据库中
IotOtaFirmwareDO firmware = BeanUtils.toBean(saveReqVO, IotOtaFirmwareDO.class); IotOtaFirmwareDO firmware = BeanUtils.toBean(saveReqVO, IotOtaFirmwareDO.class);
// 2.2.查询ProductKey // 2.2.查询ProductKey
// TODO @liproductService.getProduct(Convert.toLong(firmware.getProductId())) 放到 1. 后面先做参考校验。逻辑两段1先参数校验2构建对象 + 存储 // TODO @liiotProductService.getProduct(Convert.toLong(firmware.getProductId())) 放到 1. 后面先做参考校验。逻辑两段1先参数校验2构建对象 + 存储
IotProductDO product = productService.getProduct(Convert.toLong(firmware.getProductId())); IotProductDO product = iotProductService.getProduct(Convert.toLong(firmware.getProductId()));
firmware.setProductKey(Objects.requireNonNull(product).getProductKey()); firmware.setProductKey(Objects.requireNonNull(product).getProductKey());
// TODO @芋艿: 附件、附件签名等属性的计算 // TODO @芋艿: 附件、附件签名等属性的计算
otaFirmwareMapper.insert(firmware); otaFirmwareMapper.insert(firmware);

View File

@ -29,10 +29,10 @@ import static cn.iocoder.yudao.module.iot.enums.ErrorCodeConstants.PRODUCT_CATEG
public class IotProductCategoryServiceImpl implements IotProductCategoryService { public class IotProductCategoryServiceImpl implements IotProductCategoryService {
@Resource @Resource
private IotProductCategoryMapper productCategoryMapper; private IotProductCategoryMapper iotProductCategoryMapper;
@Resource @Resource
private IotProductService productService; private IotProductService iotProductService;
@Resource @Resource
private IotDeviceService deviceService; private IotDeviceService deviceService;
@ -40,7 +40,7 @@ public class IotProductCategoryServiceImpl implements IotProductCategoryService
public Long createProductCategory(IotProductCategorySaveReqVO createReqVO) { public Long createProductCategory(IotProductCategorySaveReqVO createReqVO) {
// 插入 // 插入
IotProductCategoryDO productCategory = BeanUtils.toBean(createReqVO, IotProductCategoryDO.class); IotProductCategoryDO productCategory = BeanUtils.toBean(createReqVO, IotProductCategoryDO.class);
productCategoryMapper.insert(productCategory); iotProductCategoryMapper.insert(productCategory);
// 返回 // 返回
return productCategory.getId(); return productCategory.getId();
} }
@ -51,7 +51,7 @@ public class IotProductCategoryServiceImpl implements IotProductCategoryService
validateProductCategoryExists(updateReqVO.getId()); validateProductCategoryExists(updateReqVO.getId());
// 更新 // 更新
IotProductCategoryDO updateObj = BeanUtils.toBean(updateReqVO, IotProductCategoryDO.class); IotProductCategoryDO updateObj = BeanUtils.toBean(updateReqVO, IotProductCategoryDO.class);
productCategoryMapper.updateById(updateObj); iotProductCategoryMapper.updateById(updateObj);
} }
@Override @Override
@ -59,18 +59,18 @@ public class IotProductCategoryServiceImpl implements IotProductCategoryService
// 校验存在 // 校验存在
validateProductCategoryExists(id); validateProductCategoryExists(id);
// 删除 // 删除
productCategoryMapper.deleteById(id); iotProductCategoryMapper.deleteById(id);
} }
private void validateProductCategoryExists(Long id) { private void validateProductCategoryExists(Long id) {
if (productCategoryMapper.selectById(id) == null) { if (iotProductCategoryMapper.selectById(id) == null) {
throw exception(PRODUCT_CATEGORY_NOT_EXISTS); throw exception(PRODUCT_CATEGORY_NOT_EXISTS);
} }
} }
@Override @Override
public IotProductCategoryDO getProductCategory(Long id) { public IotProductCategoryDO getProductCategory(Long id) {
return productCategoryMapper.selectById(id); return iotProductCategoryMapper.selectById(id);
} }
@Override @Override
@ -78,29 +78,29 @@ public class IotProductCategoryServiceImpl implements IotProductCategoryService
if (CollUtil.isEmpty(ids)) { if (CollUtil.isEmpty(ids)) {
return CollUtil.newArrayList(); return CollUtil.newArrayList();
} }
return productCategoryMapper.selectBatchIds(ids); return iotProductCategoryMapper.selectBatchIds(ids);
} }
@Override @Override
public PageResult<IotProductCategoryDO> getProductCategoryPage(IotProductCategoryPageReqVO pageReqVO) { public PageResult<IotProductCategoryDO> getProductCategoryPage(IotProductCategoryPageReqVO pageReqVO) {
return productCategoryMapper.selectPage(pageReqVO); return iotProductCategoryMapper.selectPage(pageReqVO);
} }
@Override @Override
public List<IotProductCategoryDO> getProductCategoryListByStatus(Integer status) { public List<IotProductCategoryDO> getProductCategoryListByStatus(Integer status) {
return productCategoryMapper.selectListByStatus(status); return iotProductCategoryMapper.selectListByStatus(status);
} }
@Override @Override
public Long getProductCategoryCount(LocalDateTime createTime) { public Long getProductCategoryCount(LocalDateTime createTime) {
return productCategoryMapper.selectCountByCreateTime(createTime); return iotProductCategoryMapper.selectCountByCreateTime(createTime);
} }
@Override @Override
public Map<String, Integer> getProductCategoryDeviceCountMap() { public Map<String, Integer> getProductCategoryDeviceCountMap() {
// 1. 获取所有数据 // 1. 获取所有数据
List<IotProductCategoryDO> categoryList = productCategoryMapper.selectList(); List<IotProductCategoryDO> categoryList = iotProductCategoryMapper.selectList();
List<IotProductDO> productList = productService.getProductList(); List<IotProductDO> productList = iotProductService.getProductList();
// TODO @super不要 list 查询,返回内存,而是查询一个 Map<productId, count> // TODO @super不要 list 查询,返回内存,而是查询一个 Map<productId, count>
Map<Long, Integer> deviceCountMapByProductId = deviceService.getDeviceCountMapByProductId(); Map<Long, Integer> deviceCountMapByProductId = deviceService.getDeviceCountMapByProductId();

View File

@ -50,7 +50,7 @@ public class IotThingModelServiceImpl implements IotThingModelService {
private IotThingModelMapper thingModelMapper; private IotThingModelMapper thingModelMapper;
@Resource @Resource
private IotProductService productService; private IotProductService iotProductService;
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@ -184,7 +184,7 @@ public class IotThingModelServiceImpl implements IotThingModelService {
} }
private void validateProductStatus(Long createReqVO) { private void validateProductStatus(Long createReqVO) {
IotProductDO product = productService.validateProductExists(createReqVO); IotProductDO product = iotProductService.validateProductExists(createReqVO);
if (Objects.equals(product.getStatus(), IotProductStatusEnum.PUBLISHED.getStatus())) { if (Objects.equals(product.getStatus(), IotProductStatusEnum.PUBLISHED.getStatus())) {
throw exception(PRODUCT_STATUS_NOT_ALLOW_THING_MODEL); throw exception(PRODUCT_STATUS_NOT_ALLOW_THING_MODEL);
} }