🎨 优化代码

This commit is contained in:
Binary Wang 2021-08-13 14:51:11 +08:00
parent b3eadb4ffa
commit 426ad57aa5
4 changed files with 28 additions and 15 deletions

View File

@ -16,7 +16,7 @@ import java.io.IOException;
public abstract class QrcodeRequestExecutor<H, P> implements RequestExecutor<File, AbstractWxMaQrcodeWrapper> { public abstract class QrcodeRequestExecutor<H, P> implements RequestExecutor<File, AbstractWxMaQrcodeWrapper> {
protected RequestHttp<H, P> requestHttp; protected RequestHttp<H, P> requestHttp;
public QrcodeRequestExecutor(RequestHttp<H, P> requestHttp) { protected QrcodeRequestExecutor(RequestHttp<H, P> requestHttp) {
this.requestHttp = requestHttp; this.requestHttp = requestHttp;
} }
@ -30,10 +30,9 @@ public abstract class QrcodeRequestExecutor<H, P> implements RequestExecutor<Fil
switch (requestHttp.getRequestType()) { switch (requestHttp.getRequestType()) {
case APACHE_HTTP: case APACHE_HTTP:
return new ApacheQrcodeFileRequestExecutor(requestHttp, path); return new ApacheQrcodeFileRequestExecutor(requestHttp, path);
case JODD_HTTP:
return null;
case OK_HTTP: case OK_HTTP:
return new OkHttpQrcodeFileRequestExecutor(requestHttp, path); return new OkHttpQrcodeFileRequestExecutor(requestHttp, path);
case JODD_HTTP:
default: default:
return null; return null;
} }

View File

@ -35,13 +35,13 @@ public class WxMaLiveGoodsServiceImplTest {
WxMaLiveGoodInfo goods = new WxMaLiveGoodInfo(); WxMaLiveGoodInfo goods = new WxMaLiveGoodInfo();
goods.setCoverImgUrl(mediaUpload.getMediaId()); goods.setCoverImgUrl(mediaUpload.getMediaId());
goods.setName("宫廷奢华真丝四件套"); goods.setName("宫廷奢华真丝四件套");
goods.setPrice(new BigDecimal("1599")); goods.setPrice(BigDecimal.valueOf(1599));
goods.setPrice2(new BigDecimal("0")); goods.setPrice2(BigDecimal.ZERO);
goods.setPriceType(1); goods.setPriceType(1);
goods.setUrl("pages/goods/goods?id=b7c4fbf95493bd294054fe4296d0d9ad"); goods.setUrl("pages/goods/goods?id=b7c4fbf95493bd294054fe4296d0d9ad");
WxMaLiveResult liveResult = this.wxService.getLiveGoodsService().addGoods(goods); WxMaLiveResult liveResult = this.wxService.getLiveGoodsService().addGoods(goods);
assertNotNull(liveResult); assertNotNull(liveResult);
System.out.println(liveResult.toString()); System.out.println(liveResult);
} }
@Test @Test
@ -69,8 +69,8 @@ public class WxMaLiveGoodsServiceImplTest {
goods.setGoodsId(8); goods.setGoodsId(8);
goods.setName("宫廷奢华真丝四件套"); goods.setName("宫廷奢华真丝四件套");
goods.setCoverImgUrl("http://mmbiz.qpic.cn/mmbiz_png/omYktZNGamuUQE0WPVfqdnLV61JDhluXOac7PiaoZeticFpcR7wvicC0aXUC2VXkl7r1gN0QSKosv2satn6oCFeiaQ/0"); goods.setCoverImgUrl("http://mmbiz.qpic.cn/mmbiz_png/omYktZNGamuUQE0WPVfqdnLV61JDhluXOac7PiaoZeticFpcR7wvicC0aXUC2VXkl7r1gN0QSKosv2satn6oCFeiaQ/0");
goods.setPrice(new BigDecimal("2299")); goods.setPrice(BigDecimal.valueOf(2299));
goods.setPrice2(new BigDecimal("0")); goods.setPrice2(BigDecimal.ZERO);
goods.setPriceType(1); goods.setPriceType(1);
goods.setUrl("pages/goods/goods?id=b7c4fbf95493bd294054fe4296d0d9ad"); goods.setUrl("pages/goods/goods?id=b7c4fbf95493bd294054fe4296d0d9ad");
boolean maLiveInfo = this.wxService.getLiveGoodsService().updateGoods(goods); boolean maLiveInfo = this.wxService.getLiveGoodsService().updateGoods(goods);
@ -81,13 +81,13 @@ public class WxMaLiveGoodsServiceImplTest {
public void getGoodsWareHouse() throws Exception { public void getGoodsWareHouse() throws Exception {
WxMaLiveResult liveResult = this.wxService.getLiveGoodsService().getGoodsWareHouse(Arrays.asList(1, 2)); WxMaLiveResult liveResult = this.wxService.getLiveGoodsService().getGoodsWareHouse(Arrays.asList(1, 2));
assertNotNull(liveResult); assertNotNull(liveResult);
System.out.println(liveResult.toString()); System.out.println(liveResult);
} }
@Test @Test
public void getApprovedGoods() throws Exception { public void getApprovedGoods() throws Exception {
WxMaLiveResult liveResult = this.wxService.getLiveGoodsService().getApprovedGoods(0, 4, 2); WxMaLiveResult liveResult = this.wxService.getLiveGoodsService().getApprovedGoods(0, 4, 2);
assertNotNull(liveResult); assertNotNull(liveResult);
System.out.println(liveResult.toString()); System.out.println(liveResult);
} }
} }

View File

@ -70,7 +70,7 @@ public interface WxMpService extends WxService {
* *
* @return token access token * @return token access token
* @throws WxErrorException . * @throws WxErrorException .
* @see #getAccessToken(boolean) #getAccessToken(boolean) * @see #getAccessToken(boolean) #getAccessToken(boolean)#getAccessToken(boolean)
*/ */
String getAccessToken() throws WxErrorException; String getAccessToken() throws WxErrorException;
@ -98,7 +98,7 @@ public interface WxMpService extends WxService {
* @param type ticket 类型 * @param type ticket 类型
* @return ticket ticket * @return ticket ticket
* @throws WxErrorException . * @throws WxErrorException .
* @see #getTicket(TicketType, boolean) #getTicket(TicketType, boolean) * @see #getTicket(TicketType, boolean) #getTicket(TicketType, boolean)#getTicket(TicketType, boolean)
*/ */
String getTicket(TicketType type) throws WxErrorException; String getTicket(TicketType type) throws WxErrorException;
@ -120,7 +120,7 @@ public interface WxMpService extends WxService {
* *
* @return jsapi ticket * @return jsapi ticket
* @throws WxErrorException . * @throws WxErrorException .
* @see #getJsapiTicket(boolean) #getJsapiTicket(boolean) * @see #getJsapiTicket(boolean) #getJsapiTicket(boolean)#getJsapiTicket(boolean)
*/ */
String getJsapiTicket() throws WxErrorException; String getJsapiTicket() throws WxErrorException;
@ -563,7 +563,7 @@ public interface WxMpService extends WxService {
/** /**
* 返回电子发票报销方相关接口 * 返回电子发票报销方相关接口
* *
* @return WxMpReimburseInvoiceService * @return WxMpReimburseInvoiceService reimburse invoice service
*/ */
WxMpReimburseInvoiceService getReimburseInvoiceService(); WxMpReimburseInvoiceService getReimburseInvoiceService();
@ -804,4 +804,18 @@ public interface WxMpService extends WxService {
* @param guideMassedJobService the guide service * @param guideMassedJobService the guide service
*/ */
void setGuideMassedJobService(WxMpGuideMassedJobService guideMassedJobService); void setGuideMassedJobService(WxMpGuideMassedJobService guideMassedJobService);
/**
* Gets merchant invoice service.
*
* @return the merchant invoice service
*/
WxMpMerchantInvoiceService getMerchantInvoiceService();
/**
* Sets merchant invoice service.
*
* @param merchantInvoiceService the merchant invoice service
*/
void setMerchantInvoiceService(WxMpMerchantInvoiceService merchantInvoiceService);
} }

View File

@ -101,7 +101,7 @@ public class WxPayUnifiedOrderV3Result implements Serializable {
private String sign; private String sign;
private String getSignStr() { private String getSignStr() {
return String.format("%s\n%s\n%s\n%s\n", appid, timestamp, noncestr, prepayid); return String.format("%s\n%s\n%s\n%s\n", appid, timestamp, noncestr, prepayId);
} }
} }