|
|
@@ -20,6 +20,8 @@ import com.webflux.launchadmin.mysql.entity.listening.ListeningPlanNew;
|
|
|
import com.webflux.launchadmin.mysql.entity.planNew.*;
|
|
|
import com.webflux.launchadmin.mysql.service.planNew.structure.GoRequest;
|
|
|
import com.webflux.launchadmin.mysql.service.planNew.structure.Item;
|
|
|
+import com.webflux.launchadmin.mysql.service.readBookPlan.ReadBookPlanServicesImpl;
|
|
|
+import com.webflux.launchadmin.mysql.service.readBookPlan.ReadBookPlanServicesInterface;
|
|
|
import com.webflux.launchcommon.returnObj.RStatus;
|
|
|
import jakarta.annotation.Resource;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
@@ -53,6 +55,7 @@ public class GoGenerateService {
|
|
|
@Resource
|
|
|
private R2dbcEntityTemplate template;
|
|
|
|
|
|
+
|
|
|
// http://wx-share-test.duiweize.com
|
|
|
// http://wx-share-8.duiweize.com 正式
|
|
|
public String goGenerate(String temStr) {
|
|
|
@@ -658,27 +661,32 @@ public class GoGenerateService {
|
|
|
if (first5.isPresent()) {
|
|
|
Item item = first5.get();
|
|
|
Boolean isRandom = item.getIsRandom();
|
|
|
- if (isRandom && Objects.nonNull(qsSetting.getStatus()) && qsSetting.getStatus() == 1
|
|
|
- && Objects.nonNull(qsSetting.getServiceGroupType()) && qsSetting.getServiceGroupType() == 2) {
|
|
|
- String kefu = qsSetting.getKefu();
|
|
|
- if (Objects.nonNull(kefu) && kefu.contains("[") && kefu.contains("]")) {
|
|
|
- JSONArray jsonArray = JSONUtil.parseArray(kefu);
|
|
|
- if (!jsonArray.isEmpty()) {
|
|
|
- String s = jsonArray.get(0, String.class);
|
|
|
- item.setV(s);
|
|
|
- item.setName("客服二维码");
|
|
|
- }
|
|
|
- } else {
|
|
|
- throw new BaseException("客服二维码 上传图片 为空");
|
|
|
- }
|
|
|
- } else if (Objects.nonNull(qsSetting.getStatus()) && qsSetting.getStatus() == 0) {
|
|
|
- StringBuilder t6 = f.getT6();
|
|
|
- if ("".equals(t6)) {
|
|
|
- throw new BaseException("获取H5链接为空");
|
|
|
- }
|
|
|
- item.setV(t6.toString());
|
|
|
- item.setName("H5二维码");
|
|
|
- }
|
|
|
+ if(Objects.nonNull(saveRequest.getType()) && 5==saveRequest.getType()){
|
|
|
+ item.setV(f.getT6().toString());
|
|
|
+ item.setName("客服二维码");
|
|
|
+ }else {
|
|
|
+ if (isRandom && Objects.nonNull(qsSetting.getStatus()) && qsSetting.getStatus() == 1
|
|
|
+ && Objects.nonNull(qsSetting.getServiceGroupType()) && qsSetting.getServiceGroupType() == 2) {
|
|
|
+ String kefu = qsSetting.getKefu();
|
|
|
+ if (Objects.nonNull(kefu) && kefu.contains("[") && kefu.contains("]")) {
|
|
|
+ JSONArray jsonArray = JSONUtil.parseArray(kefu);
|
|
|
+ if (!jsonArray.isEmpty()) {
|
|
|
+ String s = jsonArray.get(0, String.class);
|
|
|
+ item.setV(s);
|
|
|
+ item.setName("客服二维码");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ throw new BaseException("客服二维码 上传图片 为空");
|
|
|
+ }
|
|
|
+ } else if (Objects.nonNull(qsSetting.getStatus()) && qsSetting.getStatus() == 0) {
|
|
|
+ StringBuilder t6 = f.getT6();
|
|
|
+ if ("".equals(t6)) {
|
|
|
+ throw new BaseException("获取H5链接为空");
|
|
|
+ }
|
|
|
+ item.setV(t6.toString());
|
|
|
+ item.setName("H5二维码");
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
// 图片
|
|
|
List<Image> t2 = f.getT2().stream().filter(ft -> Objects.nonNull(ft.id())).collect(Collectors.toList());
|
|
|
@@ -808,10 +816,75 @@ public class GoGenerateService {
|
|
|
QrcodeInfo qrcodeInfo = new QrcodeInfo(null,first.isPresent()?first.get().getV():"",first3.isPresent()?first3.get().getV():"");
|
|
|
return qrcodeInfo;
|
|
|
}
|
|
|
+ @Value("${go.data.contactWay}")
|
|
|
+ private String contactWayUrl;
|
|
|
+
|
|
|
+ public String byCustomerIdGetUrl(String channelCodeId) {
|
|
|
+ //?channelCodeId=941873&state=1
|
|
|
+ long l = System.currentTimeMillis();
|
|
|
+ String body;
|
|
|
+ String url = contactWayUrl + "?channelCodeId="+channelCodeId+"&state="+l;
|
|
|
+ try {
|
|
|
+ body = HttpUtil.get(url, 100000);
|
|
|
+ } catch (Exception e) {
|
|
|
+ String format = StrUtil.format("请求【客服活码对外接口】errrr:{} channelCodeId:{} Get请求url:{}", e.getMessage(), channelCodeId, url);
|
|
|
+ log.error(format);
|
|
|
+ throw new BaseException(format);
|
|
|
+ }
|
|
|
+ if (Objects.isNull(body)||"".equals(body.trim()) ) {
|
|
|
+ String format = StrUtil.format("请求【客服活码对外接口】返回结果异常:{} channelCodeId:{} Get请求url:{}", body, channelCodeId, url);
|
|
|
+ log.error(format);
|
|
|
+ throw new BaseException(format);
|
|
|
+ }
|
|
|
+ JSONObject jsonObject;
|
|
|
+ try {
|
|
|
+ jsonObject = JSONUtil.parseObj(body);
|
|
|
+ }catch (Exception e){
|
|
|
+ String format = StrUtil.format("请求【客服活码对外接口】返回结果解析JSONERRR:{} channelCodeId:{} Get请求url:{} Body:{}", e.getMessage(), channelCodeId, url,body);
|
|
|
+ log.error(format);
|
|
|
+ throw new BaseException(format);
|
|
|
+ }
|
|
|
+ if (jsonObject.containsKey("code")
|
|
|
+ && Objects.nonNull(jsonObject.get("code"))
|
|
|
+ && jsonObject.get("code", Integer.class) == 200
|
|
|
+ && jsonObject.containsKey("data")
|
|
|
+ && Objects.nonNull(jsonObject.get("data"))
|
|
|
+ ) {
|
|
|
+ return jsonObject.get("data", String.class);
|
|
|
+ }else {
|
|
|
+ String format = StrUtil.format("请求【客服活码对外接口】返回结果失败 channelCodeId:{} Get请求url:{} Body:{}", channelCodeId, url,body);
|
|
|
+ log.error(format);
|
|
|
+ throw new BaseException(format);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
public Mono<StringBuilder> getImportDomain(PlanReq saveRequest) {
|
|
|
- if (Objects.isNull(saveRequest.getImportDomain()) || "".equals(saveRequest.getImportDomain())) {
|
|
|
- throw new BaseException("入口页域名值不可为空");
|
|
|
+ if(Objects.nonNull(saveRequest.getType()) && 5==saveRequest.getType()){
|
|
|
+ String configJson = saveRequest.getConfigJson();
|
|
|
+ if(Objects.nonNull(configJson) ){
|
|
|
+ JSONObject jsonObject;
|
|
|
+ try {
|
|
|
+ jsonObject = JSONUtil.parseObj(configJson);
|
|
|
+ }catch (Exception e){
|
|
|
+ throw new BaseException("解析configJson异常"+e.getMessage());
|
|
|
+ }
|
|
|
+ if(!jsonObject.containsKey("posterCustomerServiceId")){
|
|
|
+ throw new BaseException("解析configJson 不包含字段 posterCustomerServiceId");
|
|
|
+ }
|
|
|
+ String posterCustomerServiceId ;
|
|
|
+ try {
|
|
|
+ posterCustomerServiceId = jsonObject.get("posterCustomerServiceId", String.class);
|
|
|
+ }catch (Exception e){
|
|
|
+ throw new BaseException("解析posterCustomerServiceId异常"+e.getMessage());
|
|
|
+ }
|
|
|
+ String s = byCustomerIdGetUrl(posterCustomerServiceId);
|
|
|
+ return Mono.just(new StringBuilder(s));
|
|
|
+ }
|
|
|
+ //saveRequest.setImportDomain(String.valueOf(saveRequest.getGroupId()));
|
|
|
+ }else {
|
|
|
+ if (Objects.isNull(saveRequest.getImportDomain()) || "".equals(saveRequest.getImportDomain())) {
|
|
|
+ throw new BaseException("入口页域名值不可为空");
|
|
|
+ }
|
|
|
}
|
|
|
return template.select(Query.query(Criteria.where("group_type_id").is(saveRequest.getImportDomain())
|
|
|
.and("status").is(1)
|