|
@@ -1,18 +1,22 @@
|
|
|
package com.diagbot.facade;
|
|
|
|
|
|
-import com.diagbot.entity.OpenedProducts;
|
|
|
-import com.diagbot.service.impl.OpenedProductsServiceImpl;
|
|
|
+import java.util.Date;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-
|
|
|
import com.diagbot.dto.GetConsoleOnTrialDTO;
|
|
|
import com.diagbot.dto.GetConsoleOpenedDTO;
|
|
|
+import com.diagbot.dto.OpenUpOnTrialDTO;
|
|
|
+import com.diagbot.entity.OpenedProducts;
|
|
|
+import com.diagbot.entity.ProductService;
|
|
|
+import com.diagbot.entity.ServiceInfo;
|
|
|
import com.diagbot.service.impl.OpenedProductsServiceImpl;
|
|
|
import com.diagbot.util.UserUtils;
|
|
|
+import com.diagbot.vo.OpenUpOnTrialVO;
|
|
|
+import com.diagbot.vo.ProductServiceSaveVO;
|
|
|
|
|
|
/**
|
|
|
* @Description:已开通产品业务层
|
|
@@ -21,6 +25,10 @@ import com.diagbot.util.UserUtils;
|
|
|
*/
|
|
|
@Component
|
|
|
public class OpenedProductsFacade extends OpenedProductsServiceImpl {
|
|
|
+ @Autowired
|
|
|
+ private ServiceInfoFacade serviceInfoFacade;
|
|
|
+ @Autowired
|
|
|
+ private ProductServiceFacade productServiceFacade;
|
|
|
|
|
|
public List<OpenedProducts> getByAppkeyAndSecretFac(Map map) {
|
|
|
return this.getByAppkeyAndSecret(map);
|
|
@@ -36,5 +44,38 @@ public class OpenedProductsFacade extends OpenedProductsServiceImpl {
|
|
|
Long userId = Long.parseLong(UserUtils.getCurrentPrincipleID());
|
|
|
return baseMapper.getConsoleOnTrial(userId);
|
|
|
}
|
|
|
+
|
|
|
+ public OpenUpOnTrialDTO openUpOnTrial(OpenUpOnTrialVO openUpOnTrialVO){
|
|
|
+ Long userId = Long.parseLong(UserUtils.getCurrentPrincipleID());
|
|
|
+ String userName = UserUtils.getCurrentPrinciple();
|
|
|
+ Date now = new Date();
|
|
|
+ ServiceInfo serviceInfo = new ServiceInfo();
|
|
|
+ serviceInfo.setType(2);
|
|
|
+ serviceInfo.setUserId(userId);
|
|
|
+ serviceInfo.setDescription("用户试用产品-虚拟服务");
|
|
|
+ serviceInfo.setName("虚拟服务");
|
|
|
+ serviceInfo.setCreator(userName);
|
|
|
+ serviceInfo.setGmtCreate(now);
|
|
|
+ serviceInfo.setIsDeleted("N");
|
|
|
+ serviceInfoFacade.save(serviceInfo);
|
|
|
+
|
|
|
+ ProductService productService = new ProductService();
|
|
|
+ productService.setServiceId(serviceInfo.getId());
|
|
|
+ productService.setProductId(openUpOnTrialVO.getProductId());
|
|
|
+ productService.setCreator(userName);
|
|
|
+ productService.setGmtCreate(now);
|
|
|
+ productService.setIsDeleted("N");
|
|
|
+ productServiceFacade.save(productService);
|
|
|
+
|
|
|
+ ProductServiceSaveVO productServiceSaveVO = new ProductServiceSaveVO();
|
|
|
+ productServiceSaveVO.setProductId(openUpOnTrialVO.getProductId());
|
|
|
+ productServiceSaveVO.setServiceId(serviceInfo.getId());
|
|
|
+ productServiceSaveVO.setType(3);
|
|
|
+ productServiceFacade.genProductService(productServiceSaveVO);
|
|
|
+
|
|
|
+ OpenUpOnTrialDTO openUpOnTrialDTO = new OpenUpOnTrialDTO();
|
|
|
+
|
|
|
+ return openUpOnTrialDTO;
|
|
|
+ }
|
|
|
|
|
|
}
|