|
@@ -29,6 +29,7 @@ import com.diagbot.vo.ModifyOpeningTimeVO;
|
|
|
import com.diagbot.vo.OpenUpOnTrialVO;
|
|
|
import com.diagbot.vo.ProductServiceSaveVO;
|
|
|
import com.diagbot.vo.StartAndendByUserIdVO;
|
|
|
+import io.swagger.models.auth.In;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
@@ -58,6 +59,8 @@ public class OpenedProductsFacade extends OpenedProductsServiceImpl {
|
|
|
private ProductOrderFacade productOrderFacade;
|
|
|
@Autowired
|
|
|
private UserServiceClient userServiceClient;
|
|
|
+ @Autowired
|
|
|
+ private ServiceTokenFacade serviceTokenFacade;
|
|
|
|
|
|
public List<OpenedProducts> getByAppkeyAndSecretFac(Map map) {
|
|
|
return this.getByAppkeyAndSecret(map);
|
|
@@ -149,6 +152,14 @@ public class OpenedProductsFacade extends OpenedProductsServiceImpl {
|
|
|
throw new CommonException(CommonErrorCode.NOT_EXISTS, "该产品已删除");
|
|
|
}
|
|
|
Long userId = Long.parseLong(UserUtils.getCurrentPrincipleID());
|
|
|
+ //验证用户是否生成过试用
|
|
|
+ Map<String, Object> paramMap = new HashMap<>();
|
|
|
+ paramMap.put("userId", userId.toString());
|
|
|
+ paramMap.put("productId", openUpOnTrialVO.getProductId());
|
|
|
+ Integer cnt = serviceTokenFacade.getTryTokenCount(paramMap);
|
|
|
+ if (cnt > 0){
|
|
|
+ throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "您已试用过该产品");
|
|
|
+ }
|
|
|
Date now = new Date();
|
|
|
ServiceInfo serviceInfo = new ServiceInfo();
|
|
|
serviceInfo.setType(ServiceTypeEnum.Sys_Create.getKey());
|