| @@ -12,6 +12,9 @@ import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.domain.vo.WxWeappInfo; | |||
| import com.iformall.douyin.pay.TtPayService; | |||
| import com.iformall.douyin.payv2.request.CallBackSettingsRequest; | |||
| import com.iformall.douyin.payv2.request.TtSolutionSetImplRequest; | |||
| import com.iformall.douyin.payv2.result.Templateeffabilityimpl; | |||
| import com.iformall.douyin.web.api.order.TtWebPayService; | |||
| import com.iformall.enums.*; | |||
| import com.iformall.service.*; | |||
| import com.iformall.shiro.PasswordHelper; | |||
| @@ -891,4 +894,101 @@ public class WxProjectConfigController extends BaseController { | |||
| } | |||
| } | |||
| @ApiOperation("配置开放能力实现接口") | |||
| @PostMapping("/solution/set_impl") | |||
| @SystemControllerLog(description = "商场集团-更新") | |||
| @TenantIgnore | |||
| public ResultData solutionSetImpl(@RequestBody Map<String, Object> map) { | |||
| logger.debug("[" + getIpAddr() + "] WxProjectConfigController::solutionSetImpl"); | |||
| String appid = (String) map.get("appid"); | |||
| String operator = (String) map.get("operator"); | |||
| String releaseReason = (String) map.get("releaseReason"); | |||
| Integer templateId = (Integer) map.get("templateId"); | |||
| String implName = (String) map.get("implName"); | |||
| Integer abilityType = (Integer) map.get("abilityType"); | |||
| String abilityIdentity = (String) map.get("abilityIdentity"); | |||
| String testUrl = (String) map.get("testUrl"); | |||
| String prodUrl = (String) map.get("prodUrl"); | |||
| //todo 判断参数 | |||
| if(StringUtils.isBlank(appid)){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||
| } | |||
| try { | |||
| WxAppinfo appinfo = wxAppinfoService.getOnlyByAppIdFromRedis(appid); | |||
| if(appinfo == null){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"未找到对应的小程序"); | |||
| } | |||
| if(!EnumAppPlat.TOUTIAO.getCode().equals(appinfo.getPlat()) | |||
| || !EnumAppType.C.getCode().equals(appinfo.getType())){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"该小程序不支持"); | |||
| } | |||
| TtWebPayService ttWebPayService = maUtil.getTtWebPayService(appinfo); | |||
| TtSolutionSetImplRequest request = new TtSolutionSetImplRequest(); | |||
| request.setOperator(operator); | |||
| request.setReleaseReason(releaseReason); | |||
| List<TtSolutionSetImplRequest.Industryimpl> industry_impl_list = new ArrayList<>(); | |||
| TtSolutionSetImplRequest.Industryimpl industry_impl = new TtSolutionSetImplRequest.Industryimpl(); | |||
| industry_impl.setTemplateId(templateId); | |||
| List<TtSolutionSetImplRequest.Openabilityimpl> open_ability_impl_list = new ArrayList<>(); | |||
| TtSolutionSetImplRequest.Openabilityimpl open_ability_impl = new TtSolutionSetImplRequest.Openabilityimpl(); | |||
| open_ability_impl.setAbilityIdentity(abilityIdentity); | |||
| open_ability_impl.setDelete(false); | |||
| open_ability_impl.setTestUrl(testUrl); | |||
| open_ability_impl.setProdUrl(prodUrl); | |||
| open_ability_impl.setAbilityType(abilityType); | |||
| open_ability_impl.setImplName(implName); | |||
| open_ability_impl_list.add(open_ability_impl); | |||
| industry_impl.setOpenAbilityImplList(open_ability_impl_list); | |||
| industry_impl_list.add(industry_impl); | |||
| request.setIndustryImpList(industry_impl_list); | |||
| List<TtSolutionSetImplRequest.Appconfigitem> app_config_item_list = new ArrayList<>(); | |||
| request.setAppConfigItemList(app_config_item_list); | |||
| boolean flag = ttWebPayService.getTtWebSolutionService().setImpl(request); | |||
| return new ResultData(flag); | |||
| }catch (Exception e){ | |||
| logger.error(e.getMessage(),e); | |||
| return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),e.getMessage()); | |||
| } | |||
| } | |||
| @ApiOperation(" 查询生效中配置接口") | |||
| @GetMapping("/solution/query_impl") | |||
| @SystemControllerLog(description = "") | |||
| @TenantIgnore | |||
| public ResultData solutionQueryImpl(String appid,Integer templateid) { | |||
| logger.debug("[" + getIpAddr() + "] WxProjectConfigController::solutionQueryImpl"); | |||
| if(StringUtils.isBlank(appid) || templateid == null){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||
| } | |||
| try { | |||
| WxAppinfo appinfo = wxAppinfoService.getOnlyByAppIdFromRedis(appid); | |||
| if(appinfo == null){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"未找到对应的小程序"); | |||
| } | |||
| if(!EnumAppPlat.TOUTIAO.getCode().equals(appinfo.getPlat()) | |||
| || !EnumAppType.C.getCode().equals(appinfo.getType())){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"该小程序不支持"); | |||
| } | |||
| WxPayAccount payAccount = wxPayAccountService.getByIdFromRedis(appinfo.getPayId()); | |||
| if(payAccount == null){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"未找到对应的支付数据"); | |||
| } | |||
| TtWebPayService ttWebPayService = maUtil.getTtWebPayService(appinfo); | |||
| List<Templateeffabilityimpl> templateeffabilityimpls = ttWebPayService.getTtWebSolutionService().queryImpl(templateid); | |||
| return new ResultData(templateeffabilityimpls); | |||
| }catch (Exception e){ | |||
| logger.error(e.getMessage(),e); | |||
| return new ResultData(ErrorCode.SYS_SERVER_ERROR); | |||
| } | |||
| } | |||
| } | |||
| @@ -0,0 +1,159 @@ | |||
| package com.iformall.douyin.payv2.request; | |||
| import com.google.gson.annotations.SerializedName; | |||
| import lombok.Data; | |||
| import lombok.NoArgsConstructor; | |||
| import lombok.experimental.Accessors; | |||
| import java.io.Serializable; | |||
| import java.util.List; | |||
| /** | |||
| * <pre> | |||
| * | |||
| * </pre> | |||
| * | |||
| * @author thinsstar | |||
| */ | |||
| @Data | |||
| @NoArgsConstructor | |||
| @Accessors(chain = true) | |||
| public class TtSolutionSetImplRequest implements Serializable { | |||
| private static final long serialVersionUID = 1L; | |||
| /** | |||
| * <pre> | |||
| * 当次请求操作人 | |||
| * </pre> | |||
| */ | |||
| @SerializedName(value = "operator") | |||
| private String operator; | |||
| /** | |||
| * <pre> | |||
| * 发布原因 | |||
| * | |||
| * 140字以内 | |||
| * </pre> | |||
| */ | |||
| @SerializedName(value = "release_reason") | |||
| private String releaseReason; | |||
| /** | |||
| * <pre> | |||
| * 各行业的实现数据 | |||
| * 不设置时传 [ ] | |||
| * </pre> | |||
| */ | |||
| @SerializedName(value = "industry_impl_list") | |||
| private List<Industryimpl> industryImpList; | |||
| /** | |||
| * <pre> | |||
| * 小程序配置项列表 | |||
| * </pre> | |||
| */ | |||
| @SerializedName(value = "app_config_item_list") | |||
| private List<Appconfigitem> appConfigItemList; | |||
| @Data | |||
| @NoArgsConstructor | |||
| public static class Industryimpl implements Serializable { | |||
| private static final long serialVersionUID = 1L; | |||
| /** | |||
| * 行业模板ID | |||
| */ | |||
| @SerializedName(value = "template_id") | |||
| private Integer templateId; | |||
| /** | |||
| *当前模板内包含的开放能力的具体实现列表 | |||
| */ | |||
| @SerializedName(value = "open_ability_impl_list") | |||
| private List<Openabilityimpl> openAbilityImplList; | |||
| } | |||
| @Data | |||
| @NoArgsConstructor | |||
| public static class Openabilityimpl implements Serializable { | |||
| private static final long serialVersionUID = 1L; | |||
| /** | |||
| * 开放能力唯一标识 | |||
| * | |||
| * 获取方式:行业模板详情-选择某个扩展点-点击右上角实现说明文档-唯一标识 | |||
| * | |||
| * //营销信息扩展点 | |||
| * /common/order/query_marketing_info | |||
| * //算价扩展点 | |||
| * /common/order/calculate_price | |||
| * //退款申请扩展点 | |||
| * /common/order/refund_callback | |||
| * //预下单扩展点 | |||
| * /common/order/create_order_callback_url | |||
| * //交易系统退款通知 | |||
| * /msg/trade/refund/notify | |||
| * //交易系统支付结果通知 | |||
| * /msg/trade/payment/notify | |||
| * //交易系统分账结果通知 | |||
| * /msg/trade/settle/notify | |||
| */ | |||
| @SerializedName(value = "ability_identity") | |||
| private String abilityIdentity; | |||
| /** | |||
| * 是否删除当前生效的实现地址 | |||
| */ | |||
| @SerializedName(value = "is_delete") | |||
| private boolean isDelete; | |||
| /** | |||
| * 测试地址 | |||
| */ | |||
| @SerializedName(value = "test_url") | |||
| private String testUrl; | |||
| /** | |||
| * 正式地址 | |||
| */ | |||
| @SerializedName(value = "prod_url") | |||
| private String prodUrl; | |||
| /** | |||
| * 开放能力类型:1为扩展点,2为消息 | |||
| */ | |||
| @SerializedName(value = "ability_type") | |||
| private Integer abilityType; | |||
| /** | |||
| *实现名称,随意填写,128字符以内 | |||
| */ | |||
| @SerializedName(value = "impl_name") | |||
| private String implName; | |||
| } | |||
| @Data | |||
| @NoArgsConstructor | |||
| public static class Appconfigitem implements Serializable { | |||
| private static final long serialVersionUID = 1L; | |||
| /** | |||
| * 配置项唯一标识 | |||
| * /cfg/trade/fulfillment/qrcode_redirect //核销二维码跳转配置 | |||
| */ | |||
| @SerializedName(value = "identity") | |||
| private String identity; | |||
| /** | |||
| *配置项对应值 | |||
| */ | |||
| @SerializedName(value = "value") | |||
| private String value; | |||
| } | |||
| } | |||
| @@ -0,0 +1,90 @@ | |||
| package com.iformall.douyin.payv2.result; | |||
| import com.google.gson.annotations.SerializedName; | |||
| import lombok.Data; | |||
| import lombok.NoArgsConstructor; | |||
| import java.io.Serializable; | |||
| import java.util.List; | |||
| /** | |||
| * | |||
| * @author thinsstar | |||
| */ | |||
| @Data | |||
| @NoArgsConstructor | |||
| public class Templateeffabilityimpl implements Serializable { | |||
| private static final long serialVersionUID = -1L; | |||
| /** | |||
| * 行业模板生效的实现数据列表 | |||
| */ | |||
| @SerializedName(value = "template_id") | |||
| private Integer template_id; | |||
| /** | |||
| * 指定模板内扩展点生效数据 | |||
| */ | |||
| @SerializedName(value = "extension_ability_impl_list") | |||
| private List<EffAbilityImpl> extensionAbilityImplList; | |||
| /** | |||
| * 指定模板内消息配置数据 | |||
| */ | |||
| @SerializedName(value = "message_ability_impl_list") | |||
| private List<EffAbilityImpl> messageAbilityImplList; | |||
| @Data | |||
| @NoArgsConstructor | |||
| public static class EffAbilityImpl implements Serializable { | |||
| private static final long serialVersionUID = 1L; | |||
| /** | |||
| * 开放能力唯一标识 | |||
| */ | |||
| @SerializedName(value = "ability_identity") | |||
| private String abilityIdentity; | |||
| /** | |||
| * 通信协议类型:HTTP=1 RPC=2 | |||
| * | |||
| * (该字段已废弃,目前支持测试与生产地址使用不同的协议类型) | |||
| */ | |||
| @SerializedName(value = "protocol_type") | |||
| private Integer protocolType; | |||
| /** | |||
| * 实现名称 | |||
| */ | |||
| @SerializedName(value = "name") | |||
| private String name; | |||
| /** | |||
| * 测试地址 | |||
| */ | |||
| @SerializedName(value = "test_url") | |||
| private String testUrl; | |||
| /** | |||
| * 正式地址 | |||
| */ | |||
| @SerializedName(value = "prod_url") | |||
| private String prodUrl; | |||
| /** | |||
| * 小程序ID | |||
| */ | |||
| @SerializedName(value = "app_id") | |||
| private String appId; | |||
| /** | |||
| * 行业编码 | |||
| */ | |||
| @SerializedName(value = "industry_code") | |||
| private String industryCode; | |||
| } | |||
| } | |||
| @@ -0,0 +1,116 @@ | |||
| package com.iformall.douyin.web.api.basic; | |||
| import com.alibaba.fastjson.JSON; | |||
| import com.alibaba.fastjson.JSONObject; | |||
| import me.chanjar.weixin.common.WxType; | |||
| import me.chanjar.weixin.common.error.WxError; | |||
| import me.chanjar.weixin.common.error.WxErrorException; | |||
| import me.chanjar.weixin.common.util.http.RequestExecutor; | |||
| import me.chanjar.weixin.common.util.http.RequestHttp; | |||
| import me.chanjar.weixin.common.util.http.ResponseHandler; | |||
| import me.chanjar.weixin.common.util.http.apache.Utf8ResponseHandler; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.apache.http.Consts; | |||
| import org.apache.http.HttpHost; | |||
| import org.apache.http.client.config.RequestConfig; | |||
| import org.apache.http.client.methods.CloseableHttpResponse; | |||
| import org.apache.http.client.methods.HttpPost; | |||
| import org.apache.http.entity.StringEntity; | |||
| import org.apache.http.impl.client.CloseableHttpClient; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import java.io.IOException; | |||
| import java.util.regex.Matcher; | |||
| import java.util.regex.Pattern; | |||
| /** | |||
| * . | |||
| * | |||
| * @author ecoolper | |||
| * @date 2017/5/4 | |||
| */ | |||
| public class TtWebSolutionPostRequestExecutor implements RequestExecutor<String, String> { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| protected RequestHttp<CloseableHttpClient, HttpHost> requestHttp; | |||
| public TtWebSolutionPostRequestExecutor(RequestHttp requestHttp) { | |||
| this.requestHttp = requestHttp; | |||
| } | |||
| @Override | |||
| public void execute(String uri, String data, ResponseHandler<String> handler, WxType wxType) | |||
| throws WxErrorException, IOException { | |||
| handler.handle(this.execute(uri, data, wxType)); | |||
| } | |||
| @Override | |||
| public String execute(String uri, String postEntity, WxType wxType) throws WxErrorException, IOException { | |||
| String access_token = handleUrl(uri); | |||
| if(StringUtils.isBlank(access_token)){ | |||
| WxError wxError = WxError.fromJson("{\n" + | |||
| " \"description\": \"未找到access_token\",\n" + | |||
| " \"error_code\": -1\n" + | |||
| " }"); | |||
| throw new WxErrorException(wxError); | |||
| } | |||
| HttpPost httpPost = new HttpPost(uri); | |||
| httpPost.addHeader("Content-Type","application/json"); | |||
| httpPost.addHeader("access-token",access_token); | |||
| logger.info("post请求地址uri{}"+uri); | |||
| logger.info("header-----access_token{}"+access_token); | |||
| logger.info("请求参数{}"+postEntity); | |||
| if (requestHttp.getRequestHttpProxy() != null) { | |||
| RequestConfig config = RequestConfig.custom().setProxy(requestHttp.getRequestHttpProxy()).build(); | |||
| httpPost.setConfig(config); | |||
| } | |||
| if (postEntity != null) { | |||
| StringEntity entity = new StringEntity(postEntity, Consts.UTF_8); | |||
| entity.setContentType("application/json; charset=utf-8"); | |||
| httpPost.setEntity(entity); | |||
| } | |||
| try (CloseableHttpResponse response = requestHttp.getRequestHttpClient().execute(httpPost)) { | |||
| String responseContent = Utf8ResponseHandler.INSTANCE.handleResponse(response); | |||
| logger.info("response{}"+responseContent); | |||
| if (responseContent.isEmpty()) { | |||
| throw new WxErrorException(WxError.builder().errorCode(9999).errorMsg("无响应内容").build()); | |||
| } | |||
| if (responseContent.startsWith("<xml>")) { | |||
| //xml格式输出直接返回 | |||
| return responseContent; | |||
| } | |||
| JSONObject jsonObject = JSON.parseObject(responseContent); | |||
| JSONObject data = jsonObject.getJSONObject("data"); | |||
| WxError error = WxError.fromJson(data.toJSONString()); | |||
| if (error.getErrorCode() != 0) { | |||
| throw new WxErrorException(error); | |||
| } | |||
| return responseContent; | |||
| } finally { | |||
| httpPost.releaseConnection(); | |||
| } | |||
| } | |||
| //去除链接中access_token 并返回 | |||
| private String handleUrl(String url){ | |||
| String access_token = null; | |||
| Pattern pXM = Pattern.compile("access_token=([^&]*)"); | |||
| Matcher mXM = pXM.matcher(url); | |||
| int i = 0; | |||
| while (mXM.find()) { | |||
| i++; | |||
| access_token = mXM.group(1); | |||
| } | |||
| if(i > 1){ | |||
| return null; | |||
| } | |||
| url = url.replaceAll("&?access_token=[^&]*",""); | |||
| return access_token; | |||
| } | |||
| } | |||
| @@ -31,4 +31,12 @@ public interface TtWebPayService extends TtBasicService{ | |||
| * @return | |||
| */ | |||
| TtWebRefundService getTtWebRefundService(); | |||
| /** | |||
| * 行业模板相关接口 | |||
| * | |||
| * @return | |||
| */ | |||
| TtWebSolutionService getTtWebSolutionService(); | |||
| } | |||
| @@ -0,0 +1,39 @@ | |||
| package com.iformall.douyin.web.api.order; | |||
| import com.iformall.douyin.payv2.request.TtSolutionSetImplRequest; | |||
| import com.iformall.douyin.payv2.result.Templateeffabilityimpl; | |||
| import com.iformall.douyin.payv2.result.TtPayOrderQueryV2Result; | |||
| import me.chanjar.weixin.common.error.WxErrorException; | |||
| import java.util.List; | |||
| /** | |||
| * 行业模板 | |||
| * | |||
| * @author | |||
| */ | |||
| public interface TtWebSolutionService { | |||
| /** | |||
| *0 配置开放能力实现接口 | |||
| */ | |||
| String SET_IMPL = "/api/industry/v1/solution/set_impl"; | |||
| /** | |||
| *1 该接口用于查询小程序的行业模板配置数据 | |||
| */ | |||
| String QUERY_IMPL = "/api/industry/v1/solution/query_impl"; | |||
| /** | |||
| * <pre> | |||
| * | |||
| */ | |||
| boolean setImpl(TtSolutionSetImplRequest request) throws WxErrorException; | |||
| /** | |||
| * <pre> | |||
| * | |||
| */ | |||
| List<Templateeffabilityimpl> queryImpl(Integer template_id) throws WxErrorException; | |||
| } | |||
| @@ -1,10 +1,7 @@ | |||
| package com.iformall.douyin.web.api.order.impl; | |||
| import com.iformall.douyin.web.api.basic.TtBasicServiceImpl; | |||
| import com.iformall.douyin.web.api.order.TtWebOrderService; | |||
| import com.iformall.douyin.web.api.order.TtWebPayService; | |||
| import com.iformall.douyin.web.api.order.TtWebRefundService; | |||
| import com.iformall.douyin.web.api.order.TtWebShareService; | |||
| import com.iformall.douyin.web.api.order.*; | |||
| import com.iformall.douyin.web.api.web.*; | |||
| import com.iformall.douyin.web.api.web.impl.TtWebGoodsServiceImpl; | |||
| import com.iformall.douyin.web.api.web.impl.TtWebPoiPlanServiceImpl; | |||
| @@ -21,6 +18,7 @@ public class TtWebPayServiceImpl extends TtBasicServiceImpl implements TtWebPayS | |||
| private TtWebOrderService webOrderService = new TtWebOrderServiceImpl(this); | |||
| private TtWebShareService webShareService = new TtWebShareServiceImpl(this); | |||
| private TtWebRefundService webRefundService = new TtWebRefundServiceImpl(this); | |||
| private TtWebSolutionService webSolutionService = new TtWebSolutionServiceImpl(this); | |||
| @Override | |||
| public TtWebOrderService getTtWebOrderService() { | |||
| @@ -37,5 +35,10 @@ public class TtWebPayServiceImpl extends TtBasicServiceImpl implements TtWebPayS | |||
| return this.webRefundService; | |||
| } | |||
| @Override | |||
| public TtWebSolutionService getTtWebSolutionService() { | |||
| return this.webSolutionService; | |||
| } | |||
| } | |||
| @@ -0,0 +1,62 @@ | |||
| package com.iformall.douyin.web.api.order.impl; | |||
| import com.alibaba.fastjson.TypeReference; | |||
| import com.google.gson.Gson; | |||
| import com.google.gson.GsonBuilder; | |||
| import com.google.gson.JsonArray; | |||
| import com.google.gson.JsonObject; | |||
| import com.iformall.douyin.payv2.request.TtOrderPushDeliveryRequest; | |||
| import com.iformall.douyin.payv2.request.TtPayOrderQueryV2Request; | |||
| import com.iformall.douyin.payv2.request.TtSolutionSetImplRequest; | |||
| import com.iformall.douyin.payv2.result.Templateeffabilityimpl; | |||
| import com.iformall.douyin.payv2.result.TtPayCpsOrderQueryV2Result; | |||
| import com.iformall.douyin.payv2.result.TtPayOrderQueryV2Result; | |||
| import com.iformall.douyin.payv2.result.TtSettleResult; | |||
| import com.iformall.douyin.web.api.basic.TtWebPostRequestExecutor; | |||
| import com.iformall.douyin.web.api.basic.TtWebSolutionPostRequestExecutor; | |||
| import com.iformall.douyin.web.api.order.TtWebOrderService; | |||
| import com.iformall.douyin.web.api.order.TtWebPayService; | |||
| import com.iformall.douyin.web.api.order.TtWebSolutionService; | |||
| import lombok.AllArgsConstructor; | |||
| import me.chanjar.weixin.common.error.WxErrorException; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import java.util.ArrayList; | |||
| import java.util.HashMap; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| /** | |||
| * | |||
| */ | |||
| @AllArgsConstructor | |||
| public class TtWebSolutionServiceImpl implements TtWebSolutionService { | |||
| private static final Gson GSON = new GsonBuilder().create(); | |||
| private TtWebPayService service; | |||
| @Override | |||
| public boolean setImpl(TtSolutionSetImplRequest request) throws WxErrorException { | |||
| final TtWebSolutionPostRequestExecutor executor = new TtWebSolutionPostRequestExecutor(this.service.getRequestHttp()); | |||
| String apiUrl = this.service.getTtWebConfig().getApiBegin().getPrefix() + this.SET_IMPL; | |||
| String result = this.service.execute(executor, apiUrl, GSON.toJson(request)); | |||
| return true; | |||
| } | |||
| @Override | |||
| public List<Templateeffabilityimpl> queryImpl(Integer template_id) throws WxErrorException { | |||
| Map<String,Object> request = new HashMap<>(); | |||
| List<Integer> template_id_list = new ArrayList<>(); | |||
| template_id_list.add(template_id); | |||
| request.put("template_id_list",template_id_list); | |||
| final TtWebSolutionPostRequestExecutor executor = new TtWebSolutionPostRequestExecutor(this.service.getRequestHttp()); | |||
| String apiUrl = this.service.getTtWebConfig().getApiBegin().getPrefix() + this.QUERY_IMPL; | |||
| String result = this.service.execute(executor, apiUrl, GSON.toJson(request)); | |||
| JsonObject jsonObject = GSON.fromJson(result, JsonObject.class); | |||
| String template_eff_ability_impl_list = jsonObject.getAsJsonArray("template_eff_ability_impl_list").getAsString(); | |||
| List<Templateeffabilityimpl> list = GSON.fromJson(template_eff_ability_impl_list, | |||
| new TypeReference<List<Templateeffabilityimpl>>() {}.getType()); | |||
| return list; | |||
| } | |||
| } | |||
| @@ -3,6 +3,8 @@ package com.iformall.utils; | |||
| import cn.binarywang.wx.miniapp.api.WxMaService; | |||
| import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl; | |||
| import cn.binarywang.wx.miniapp.config.impl.WxMaDefaultConfigImpl; | |||
| import com.alibaba.fastjson.JSON; | |||
| import com.alibaba.fastjson.JSONObject; | |||
| import com.github.binarywang.wxpay.config.WxPayConfig; | |||
| import com.github.binarywang.wxpay.service.WxPayService; | |||
| import com.github.binarywang.wxpay.service.impl.WxPayServiceImpl; | |||
| @@ -13,12 +15,14 @@ import com.iformall.douyin.miniapp.api.TtMaService; | |||
| import com.iformall.douyin.miniapp.api.impl.TtMaServiceImpl; | |||
| import java.util.Date; | |||
| import java.util.List; | |||
| import java.util.Map; | |||
| import java.util.concurrent.ConcurrentHashMap; | |||
| import com.iformall.douyin.pay.TtPayService; | |||
| import com.iformall.douyin.pay.impl.TtPayServiceImpl; | |||
| import com.iformall.douyin.payv2.config.TtPayConfig; | |||
| import com.iformall.douyin.payv2.result.Templateeffabilityimpl; | |||
| import com.iformall.douyin.web.api.goodlifesaas.TtGoodLifeSaasService; | |||
| import com.iformall.douyin.web.api.goodlifesaas.impl.TtGoodLifeSaasServiceImpl; | |||
| import com.iformall.douyin.web.api.order.TtWebPayService; | |||
| @@ -38,7 +42,7 @@ import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.stereotype.Service; | |||
| @Service | |||
| public class MaUtil { | |||
| public class MaUtil<main> { | |||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||
| @@ -406,4 +410,26 @@ public class MaUtil { | |||
| } | |||
| return service; | |||
| } | |||
| public static void main(String[] args) { | |||
| // TtWebDefaultConfigImpl config = new TtWebDefaultConfigImpl(); | |||
| // config.setAppid("ttb93ecf832602477001"); | |||
| // config.setSecret("de8c284a667cf7af26e546587d521061ddb10d72"); | |||
| // config.setApacheHttpClientBuilder(FmHttpClientBuilder.get()); | |||
| // | |||
| // //默认抖音 | |||
| // config.setApiBegin(TtWebApiBeginEnum.DY); | |||
| // TtWebPayService service = new TtWebPayServiceImpl(); | |||
| // service.setTtWebConfig(config); | |||
| // | |||
| // List<Templateeffabilityimpl> templateeffabilityimpls = null; | |||
| // try { | |||
| // templateeffabilityimpls = service.getTtWebSolutionService().queryImpl(80111); | |||
| // } catch (WxErrorException e) { | |||
| // e.printStackTrace(); | |||
| // } | |||
| // System.out.println(JSON.toJSONString(templateeffabilityimpls)); | |||
| } | |||
| } | |||