Browse Source

clean code

master
Binary Wang 8 years ago
parent
commit
2ae95e48ef
4 changed files with 22 additions and 20 deletions
  1. +0
    -1
      weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/WxMpPayService.java
  2. +21
    -14
      weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpKefuServiceImpl.java
  3. +1
    -4
      weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpPayServiceImpl.java
  4. +0
    -1
      weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/store/WxMpStoreInfo.java

+ 0
- 1
weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/WxMpPayService.java View File

@@ -6,7 +6,6 @@ import me.chanjar.weixin.common.exception.WxErrorException;
import me.chanjar.weixin.mp.bean.pay.WxMpPayCallback; import me.chanjar.weixin.mp.bean.pay.WxMpPayCallback;
import me.chanjar.weixin.mp.bean.pay.WxMpPayRefundResult; import me.chanjar.weixin.mp.bean.pay.WxMpPayRefundResult;
import me.chanjar.weixin.mp.bean.pay.WxMpPayResult; import me.chanjar.weixin.mp.bean.pay.WxMpPayResult;
import me.chanjar.weixin.mp.bean.pay.WxMpPrepayIdResult;
import me.chanjar.weixin.mp.bean.pay.WxRedpackResult; import me.chanjar.weixin.mp.bean.pay.WxRedpackResult;
import me.chanjar.weixin.mp.bean.pay.WxSendRedpackRequest; import me.chanjar.weixin.mp.bean.pay.WxSendRedpackRequest;
import me.chanjar.weixin.mp.bean.pay.WxUnifiedOrderRequest; import me.chanjar.weixin.mp.bean.pay.WxUnifiedOrderRequest;


+ 21
- 14
weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpKefuServiceImpl.java View File

@@ -1,6 +1,13 @@
package me.chanjar.weixin.mp.api.impl; package me.chanjar.weixin.mp.api.impl;


import java.io.File;
import java.util.Date;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.google.gson.JsonObject; import com.google.gson.JsonObject;

import me.chanjar.weixin.common.bean.result.WxError; import me.chanjar.weixin.common.bean.result.WxError;
import me.chanjar.weixin.common.bean.result.WxMediaUploadResult; import me.chanjar.weixin.common.bean.result.WxMediaUploadResult;
import me.chanjar.weixin.common.exception.WxErrorException; import me.chanjar.weixin.common.exception.WxErrorException;
@@ -10,12 +17,12 @@ import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.bean.WxMpCustomMessage; import me.chanjar.weixin.mp.bean.WxMpCustomMessage;
import me.chanjar.weixin.mp.bean.kefu.request.WxMpKfAccountRequest; import me.chanjar.weixin.mp.bean.kefu.request.WxMpKfAccountRequest;
import me.chanjar.weixin.mp.bean.kefu.request.WxMpKfSessionRequest; import me.chanjar.weixin.mp.bean.kefu.request.WxMpKfSessionRequest;
import me.chanjar.weixin.mp.bean.kefu.result.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.util.Date;
import me.chanjar.weixin.mp.bean.kefu.result.WxMpKfList;
import me.chanjar.weixin.mp.bean.kefu.result.WxMpKfMsgList;
import me.chanjar.weixin.mp.bean.kefu.result.WxMpKfOnlineList;
import me.chanjar.weixin.mp.bean.kefu.result.WxMpKfSessionGetResult;
import me.chanjar.weixin.mp.bean.kefu.result.WxMpKfSessionList;
import me.chanjar.weixin.mp.bean.kefu.result.WxMpKfSessionWaitCaseList;


/** /**
* *
@@ -38,7 +45,7 @@ public class WxMpKefuServiceImpl implements WxMpKefuService {
throws WxErrorException { throws WxErrorException {
String url = "https://api.weixin.qq.com/cgi-bin/message/custom/send"; String url = "https://api.weixin.qq.com/cgi-bin/message/custom/send";
String responseContent = this.wxMpService.post(url, message.toJson()); String responseContent = this.wxMpService.post(url, message.toJson());
return true;
return responseContent != null;
} }


@Override @Override
@@ -60,7 +67,7 @@ public class WxMpKefuServiceImpl implements WxMpKefuService {
throws WxErrorException { throws WxErrorException {
String url = API_URL_PREFIX + "/kfaccount/add"; String url = API_URL_PREFIX + "/kfaccount/add";
String responseContent = this.wxMpService.post(url, request.toJson()); String responseContent = this.wxMpService.post(url, request.toJson());
return true;
return responseContent != null;
} }


@Override @Override
@@ -68,14 +75,14 @@ public class WxMpKefuServiceImpl implements WxMpKefuService {
throws WxErrorException { throws WxErrorException {
String url = API_URL_PREFIX + "/kfaccount/update"; String url = API_URL_PREFIX + "/kfaccount/update";
String responseContent = this.wxMpService.post(url, request.toJson()); String responseContent = this.wxMpService.post(url, request.toJson());
return true;
return responseContent != null;
} }


@Override @Override
public boolean kfAccountInviteWorker(WxMpKfAccountRequest request) throws WxErrorException { public boolean kfAccountInviteWorker(WxMpKfAccountRequest request) throws WxErrorException {
String url = API_URL_PREFIX + "/kfaccount/inviteworker"; String url = API_URL_PREFIX + "/kfaccount/inviteworker";
String responseContent = this.wxMpService.post(url, request.toJson()); String responseContent = this.wxMpService.post(url, request.toJson());
return true;
return responseContent != null;
} }


@Override @Override
@@ -84,14 +91,14 @@ public class WxMpKefuServiceImpl implements WxMpKefuService {
String url = API_URL_PREFIX + "/kfaccount/uploadheadimg?kf_account=" + kfAccount; String url = API_URL_PREFIX + "/kfaccount/uploadheadimg?kf_account=" + kfAccount;
WxMediaUploadResult responseContent = this.wxMpService WxMediaUploadResult responseContent = this.wxMpService
.execute(new MediaUploadRequestExecutor(), url, imgFile); .execute(new MediaUploadRequestExecutor(), url, imgFile);
return true;
return responseContent != null;
} }


@Override @Override
public boolean kfAccountDel(String kfAccount) throws WxErrorException { public boolean kfAccountDel(String kfAccount) throws WxErrorException {
String url = API_URL_PREFIX + "/kfaccount/del?kf_account=" + kfAccount; String url = API_URL_PREFIX + "/kfaccount/del?kf_account=" + kfAccount;
String responseContent = this.wxMpService.get(url, null); String responseContent = this.wxMpService.get(url, null);
return true;
return responseContent != null;
} }


@Override @Override
@@ -100,7 +107,7 @@ public class WxMpKefuServiceImpl implements WxMpKefuService {
WxMpKfSessionRequest request = new WxMpKfSessionRequest(kfAccount, openid); WxMpKfSessionRequest request = new WxMpKfSessionRequest(kfAccount, openid);
String url = API_URL_PREFIX + "/kfsession/create"; String url = API_URL_PREFIX + "/kfsession/create";
String responseContent = this.wxMpService.post(url, request.toJson()); String responseContent = this.wxMpService.post(url, request.toJson());
return true;
return responseContent != null;
} }


@Override @Override
@@ -109,7 +116,7 @@ public class WxMpKefuServiceImpl implements WxMpKefuService {
WxMpKfSessionRequest request = new WxMpKfSessionRequest(kfAccount, openid); WxMpKfSessionRequest request = new WxMpKfSessionRequest(kfAccount, openid);
String url = API_URL_PREFIX + "/kfsession/close"; String url = API_URL_PREFIX + "/kfsession/close";
String responseContent = this.wxMpService.post(url, request.toJson()); String responseContent = this.wxMpService.post(url, request.toJson());
return true;
return responseContent != null;
} }


@Override @Override


+ 1
- 4
weixin-java-mp/src/main/java/me/chanjar/weixin/mp/api/impl/WxMpPayServiceImpl.java View File

@@ -11,8 +11,6 @@ import java.util.TreeMap;
import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.joor.Reflect; import org.joor.Reflect;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
@@ -42,7 +40,6 @@ public class WxMpPayServiceImpl implements WxMpPayService {


private static final List<String> TRADE_TYPES = Lists.newArrayList("JSAPI", private static final List<String> TRADE_TYPES = Lists.newArrayList("JSAPI",
"NATIVE", "APP"); "NATIVE", "APP");
private final Logger log = LoggerFactory.getLogger(WxMpPayServiceImpl.class);
private WxMpService wxMpService; private WxMpService wxMpService;


public WxMpPayServiceImpl(WxMpService wxMpService) { public WxMpPayServiceImpl(WxMpService wxMpService) {
@@ -286,7 +283,7 @@ public class WxMpPayServiceImpl implements WxMpPayService {


if (!TRADE_TYPES.contains(request.getTradeType())) { if (!TRADE_TYPES.contains(request.getTradeType())) {
throw new IllegalArgumentException( throw new IllegalArgumentException(
"trade_type目前必须为" + TRADE_TYPES + "其中之一");
"trade_type目前必须为" + TRADE_TYPES + "其中之一");


} }




+ 0
- 1
weixin-java-mp/src/main/java/me/chanjar/weixin/mp/bean/store/WxMpStoreInfo.java View File

@@ -1,6 +1,5 @@
package me.chanjar.weixin.mp.bean.store; package me.chanjar.weixin.mp.bean.store;


import me.chanjar.weixin.mp.util.json.WxMpGsonBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;




Loading…
Cancel
Save