mirror of
				https://gitee.com/binary/weixin-java-tools.git
				synced 2025-10-31 10:38:42 +08:00 
			
		
		
		
	clean code
This commit is contained in:
		| @ -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; | ||||||
|  | |||||||
| @ -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 me.chanjar.weixin.mp.bean.kefu.result.WxMpKfList; | ||||||
| import org.slf4j.Logger; | import me.chanjar.weixin.mp.bean.kefu.result.WxMpKfMsgList; | ||||||
| import org.slf4j.LoggerFactory; | import me.chanjar.weixin.mp.bean.kefu.result.WxMpKfOnlineList; | ||||||
|  | import me.chanjar.weixin.mp.bean.kefu.result.WxMpKfSessionGetResult; | ||||||
| import java.io.File; | import me.chanjar.weixin.mp.bean.kefu.result.WxMpKfSessionList; | ||||||
| import java.util.Date; | 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 | ||||||
|  | |||||||
| @ -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 + "其中之一"); | ||||||
|  |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  | |||||||
| @ -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; | ||||||
|  |  | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 Binary Wang
					Binary Wang