|
@@ -19,6 +19,8 @@ import cn.kdan.pdf.tech.core.service.VppRTeamMemberRoleService;
|
|
|
import cn.kdan.pdf.tech.core.service.VppTeamService;
|
|
|
import cn.kdan.pdf.tech.core.utils.RSAUtils;
|
|
|
import cn.kdan.pdf.tech.core.utils.ThreadPoolSingleUtil;
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import constant.CommonConstant;
|
|
|
import enums.ValidStatusEnum;
|
|
|
import exception.BackendRuntimeException;
|
|
@@ -26,6 +28,8 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
+import org.springframework.http.*;
|
|
|
+import org.springframework.http.MediaType;
|
|
|
import org.springframework.security.core.Authentication;
|
|
|
import org.springframework.security.core.context.SecurityContextHolder;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -33,15 +37,14 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
import org.springframework.util.ObjectUtils;
|
|
|
import org.springframework.util.StringUtils;
|
|
|
+import org.springframework.web.client.RestTemplate;
|
|
|
import pojo.CustomUserDetails;
|
|
|
import utils.CommonUtils;
|
|
|
import cn.kdan.pdf.tech.core.utils.EmailUtils;
|
|
|
import utils.RedisUtils;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
-import java.util.Collections;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.List;
|
|
|
+import java.util.*;
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -148,6 +151,29 @@ public class VppMemberServiceImpl implements VppMemberService {
|
|
|
return vppMember;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Boolean createTrial(VppMemberRegisterParam param) {
|
|
|
+ // 校验
|
|
|
+ validRegisterParam(param);
|
|
|
+ // 发送http请求
|
|
|
+ RestTemplate restTemplate = new RestTemplate();
|
|
|
+ String url = emailImagesUrl + "/api/vpp_members/register";
|
|
|
+ String jsonString = JSON.toJSONString(param);
|
|
|
+ log.info("调用运营后台创建试用用户接口 url:{},json:{}", url, jsonString);
|
|
|
+ HttpHeaders headers = new HttpHeaders();
|
|
|
+ headers.setContentType(MediaType.APPLICATION_JSON);
|
|
|
+ headers.set(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON_VALUE);
|
|
|
+ HttpEntity<String> request = new HttpEntity<>(jsonString, headers);
|
|
|
+ ResponseEntity<JSONObject> response = restTemplate
|
|
|
+ .exchange(url, HttpMethod.POST, request, JSONObject.class);
|
|
|
+ log.info("result:" + response.getStatusCodeValue());
|
|
|
+ if (!response.getStatusCode().is2xxSuccessful()) {
|
|
|
+ log.error("调用运营后台创建试用用户接口失败,返回状态码:{},返回内容:{}", response.getStatusCode(), response.getBody());
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ return Boolean.TRUE;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public void insert(VppMember vppMember) {
|
|
|
vppMemberMapper.insert(vppMember);
|