|
@@ -1,5 +1,7 @@
|
|
|
package com.diagbot.facade;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.diagbot.dto.ProductServiceDTO;
|
|
@@ -44,9 +46,10 @@ public class ProductServiceFacade extends ProductServiceServiceImpl {
|
|
|
private OpenedProductsFacade openedProductsFacade;
|
|
|
|
|
|
/**
|
|
|
- * @Description:建立产品服务端关联并生成令牌
|
|
|
- * @author: zhaops
|
|
|
- * @time: 2018/9/18 16:33
|
|
|
+ * 建立产品服务端关联并生成令牌
|
|
|
+ *
|
|
|
+ * @param productServiceSaveVO
|
|
|
+ * @return
|
|
|
*/
|
|
|
public ProductServiceDTO genProductService(ProductServiceSaveVO productServiceSaveVO) {
|
|
|
ProductServiceDTO productServiceDTO = new ProductServiceDTO();
|
|
@@ -66,10 +69,11 @@ public class ProductServiceFacade extends ProductServiceServiceImpl {
|
|
|
"当前登录用户没有关联服务端【" + serviceInfo.getName() + "】");
|
|
|
}
|
|
|
|
|
|
- Map<String, Object> map = new HashMap<>();
|
|
|
- map.put("productId", productServiceSaveVO.getProductId());
|
|
|
- map.put("serviceId", productServiceSaveVO.getServiceId());
|
|
|
- ProductService productService = this.findByProductIdAndServiceId(map);
|
|
|
+ QueryWrapper<ProductService> qwps = new QueryWrapper<>();
|
|
|
+ qwps.eq("product_id", productServiceSaveVO.getProductId());
|
|
|
+ qwps.eq("service_id", productServiceSaveVO.getServiceId());
|
|
|
+ qwps.eq("is_deleted", "N");
|
|
|
+ ProductService productService = this.getOne(qwps);
|
|
|
if (productService == null) {
|
|
|
productService = new ProductService();
|
|
|
productService.setProductId(productServiceSaveVO.getProductId());
|
|
@@ -120,15 +124,17 @@ public class ProductServiceFacade extends ProductServiceServiceImpl {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * @Description:删除产品服务端关联,级联删除令牌
|
|
|
- * @author: zhaops
|
|
|
- * @time: 2018/9/18 16:33
|
|
|
+ * 删除产品服务端关联,级联删除令牌
|
|
|
+ *
|
|
|
+ * @param productServiceSaveVO
|
|
|
+ * @return
|
|
|
*/
|
|
|
public Boolean deleteProductService(ProductServiceSaveVO productServiceSaveVO) {
|
|
|
- Map<String, Object> map = new HashMap<>();
|
|
|
- map.put("productId", productServiceSaveVO.getProductId());
|
|
|
- map.put("serviceId", productServiceSaveVO.getServiceId());
|
|
|
- ProductService productService = this.findByProductIdAndServiceId(map);
|
|
|
+ QueryWrapper<ProductService> qwps = new QueryWrapper<>();
|
|
|
+ qwps.eq("product_id", productServiceSaveVO.getProductId());
|
|
|
+ qwps.eq("service_id", productServiceSaveVO.getServiceId());
|
|
|
+ qwps.eq("is_deleted", "N");
|
|
|
+ ProductService productService = this.getOne(qwps);
|
|
|
if (productService == null) {
|
|
|
throw new CommonException(CommonErrorCode.NOT_EXISTS,
|
|
|
"找不到产品服务端");
|
|
@@ -136,38 +142,43 @@ public class ProductServiceFacade extends ProductServiceServiceImpl {
|
|
|
//删除关联令牌
|
|
|
serviceTokenFacade.deleteByProductServiceId(productService.getId());
|
|
|
//删除产品服务端
|
|
|
- this.delById(productService.getId());
|
|
|
+ UpdateWrapper<ProductService> uwps = new UpdateWrapper<>();
|
|
|
+ productService.setIsDeleted("Y");
|
|
|
+ this.updateById(productService);
|
|
|
+ //this.delById(productService.getId());
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
- * @Description:获取当前用户产品服务关联列表
|
|
|
- * @author: zhaops
|
|
|
- * @time: 2018/9/18 16:33
|
|
|
+ * 获取当前用户产品服务关联列表
|
|
|
+ *
|
|
|
+ * @param page
|
|
|
+ * @return
|
|
|
*/
|
|
|
public IPage<ProductServiceWrapper> selectProductServiceByCurrentUserPage(Page<ProductServiceWrapper> page) {
|
|
|
Long userId = Long.parseLong(UserUtils.getCurrentPrincipleID());
|
|
|
//当前登录用户服务端列表
|
|
|
- Map<String, Object> columnMap = new HashMap<>();
|
|
|
- columnMap.put("is_deleted", "N");
|
|
|
- columnMap.put("user_id", userId);
|
|
|
- List<ServiceInfo> serviceInfoList = (List) serviceInfoFacade.listByMap(columnMap);
|
|
|
+ QueryWrapper<ServiceInfo> qwService = new QueryWrapper<>();
|
|
|
+ qwService.eq("is_deleted", "N");
|
|
|
+ qwService.eq("user_id", userId);
|
|
|
+ List<ServiceInfo> serviceInfoList = serviceInfoFacade.list(qwService);
|
|
|
Map<Long, ServiceInfo> serviceData = EntityUtil.makeEntityMap(serviceInfoList, "id");
|
|
|
//服务令牌列表
|
|
|
- columnMap.clear();
|
|
|
- columnMap.put("is_deleted", "N");
|
|
|
- List<ServiceToken> serviceTokenList = (List) serviceTokenFacade.listByMap(columnMap);
|
|
|
+ QueryWrapper<ServiceToken> qwToken = new QueryWrapper<>();
|
|
|
+ qwToken.eq("is_deleted", "N");
|
|
|
+ List<ServiceToken> serviceTokenList = serviceTokenFacade.list(qwToken);
|
|
|
Map<Long, ServiceToken> tokenData = EntityUtil.makeEntityMap(serviceTokenList, "productServiceId");
|
|
|
//产品列表
|
|
|
- columnMap.clear();
|
|
|
- columnMap.put("is_deleted", "N");
|
|
|
- List<LantoneProduct> lantoneProductList = (List) lantoneProductFacade.listByMap(columnMap);
|
|
|
+ QueryWrapper<LantoneProduct> qwProduct = new QueryWrapper<>();
|
|
|
+ qwProduct.eq("is_deleted", "N");
|
|
|
+ List<LantoneProduct> lantoneProductList = lantoneProductFacade.list(qwProduct);
|
|
|
Map<Long, LantoneProduct> lantoneProductData = EntityUtil.makeEntityMap(lantoneProductList, "id");
|
|
|
//当前用户开通的产品列表
|
|
|
- columnMap.clear();
|
|
|
- columnMap.put("is_deleted", "N");
|
|
|
- columnMap.put("user_id", userId);
|
|
|
- List<OpenedProducts> openedProductsList = (List) openedProductsFacade.listByMap(columnMap);
|
|
|
+ QueryWrapper<OpenedProducts> qwOpenedProducts = new QueryWrapper<>();
|
|
|
+ qwOpenedProducts.eq("is_deleted", "N");
|
|
|
+ qwOpenedProducts.eq("user_id", userId);
|
|
|
+ List<OpenedProducts> openedProductsList = openedProductsFacade.list(qwOpenedProducts);
|
|
|
Map<Long, OpenedProducts> openedProductData = EntityUtil.makeEntityMap(openedProductsList, "productId");
|
|
|
|
|
|
ProductServiceWrapper productServiceVO = new ProductServiceWrapper();
|