11package me .chanjar .weixin .open .api .impl ;
22
33import cn .binarywang .wx .miniapp .bean .WxMaJscode2SessionResult ;
4- import com .fasterxml .jackson .databind .util .JSONPObject ;
5- import com .google .gson .Gson ;
64import com .google .gson .JsonArray ;
75import com .google .gson .JsonObject ;
86import com .google .gson .reflect .TypeToken ;
97import lombok .AllArgsConstructor ;
108import lombok .extern .slf4j .Slf4j ;
119import me .chanjar .weixin .common .api .WxConsts ;
12- import me .chanjar .weixin .common .bean .result .WxMediaUploadResult ;
13- import me .chanjar .weixin .common .bean .result .WxMinishopImageUploadResult ;
1410import me .chanjar .weixin .common .bean .oauth2 .WxOAuth2AccessToken ;
11+ import me .chanjar .weixin .common .bean .result .WxMinishopImageUploadResult ;
1512import me .chanjar .weixin .common .error .WxError ;
1613import me .chanjar .weixin .common .error .WxErrorException ;
1714import me .chanjar .weixin .common .error .WxRuntimeException ;
2017import me .chanjar .weixin .common .util .json .GsonParser ;
2118import me .chanjar .weixin .common .util .json .WxGsonBuilder ;
2219import me .chanjar .weixin .mp .api .WxMpService ;
23- import me .chanjar .weixin .open .api .WxOpenComponentService ;
24- import me .chanjar .weixin .open .api .WxOpenConfigStorage ;
25- import me .chanjar .weixin .open .api .WxOpenFastMaService ;
26- import me .chanjar .weixin .open .api .WxOpenMaService ;
27- import me .chanjar .weixin .open .api .WxOpenMpService ;
28- import me .chanjar .weixin .open .api .WxOpenService ;
29- import me .chanjar .weixin .open .bean .WxOpenAuthorizerAccessToken ;
30- import me .chanjar .weixin .open .bean .WxOpenComponentAccessToken ;
31- import me .chanjar .weixin .open .bean .WxOpenCreateResult ;
32- import me .chanjar .weixin .open .bean .WxOpenGetResult ;
33- import me .chanjar .weixin .open .bean .WxOpenMaCodeTemplate ;
20+ import me .chanjar .weixin .open .api .*;
21+ import me .chanjar .weixin .open .bean .*;
3422import me .chanjar .weixin .open .bean .auth .WxOpenAuthorizationInfo ;
3523import me .chanjar .weixin .open .bean .message .WxOpenXmlMessage ;
3624import me .chanjar .weixin .open .bean .minishop .*;
4028import me .chanjar .weixin .open .bean .minishop .limitdiscount .LimitDiscountGoods ;
4129import me .chanjar .weixin .open .bean .minishop .limitdiscount .LimitDiscountSku ;
4230import me .chanjar .weixin .open .bean .result .*;
43- import me .chanjar .weixin .open .bean .result .WxOpenAuthorizerInfoResult ;
44- import me .chanjar .weixin .open .bean .result .WxOpenAuthorizerListResult ;
45- import me .chanjar .weixin .open .bean .result .WxOpenAuthorizerOptionResult ;
46- import me .chanjar .weixin .open .bean .result .WxOpenQueryAuthResult ;
47- import me .chanjar .weixin .open .bean .result .WxOpenResult ;
4831import me .chanjar .weixin .open .util .json .WxOpenGsonBuilder ;
4932import org .apache .commons .lang3 .StringUtils ;
5033
@@ -519,7 +502,7 @@ public void addToTemplate(long draftId) throws WxErrorException {
519502 }
520503
521504 @ Override
522- public void addToTemplate (long draftId ,int templateType ) throws WxErrorException {
505+ public void addToTemplate (long draftId , int templateType ) throws WxErrorException {
523506 JsonObject param = new JsonObject ();
524507 param .addProperty ("draft_id" , draftId );
525508 param .addProperty ("template_type" , templateType );
@@ -657,7 +640,7 @@ public String checkAuditStatus(String wxName) throws WxErrorException {
657640 public String checkAuditStatus (String appId , String wxName ) throws WxErrorException {
658641 JsonObject jsonObject = new JsonObject ();
659642 jsonObject .addProperty ("wx_name" , wxName );
660- String url = CHECK_SHOP_AUDITSTATUS_URL + "?access_token=" + getAuthorizerAccessToken (appId , false );
643+ String url = CHECK_SHOP_AUDITSTATUS_URL + "?access_token=" + getAuthorizerAccessToken (appId , false );
661644 String response = post (url , jsonObject .toString ());
662645 log .info ("CHECK_SHOP_AUDITSTATUS_URL: " + response );
663646 return response ;
@@ -700,7 +683,7 @@ public WxOpenResult submitBasicInfo(String appId, MinishopNameInfo nameInfo, Min
700683
701684 @ Override
702685 public WxMinishopImageUploadResult uploadMinishopImagePicFile (String appId , Integer height , Integer width , File file ) throws WxErrorException {
703- String url = WxOpenMinishopService .UPLOAD_IMG_MINISHOP_FILE_URL + "?access_token=" + getAuthorizerAccessToken (appId , false )+ "&height=" + height + "&width=" + width ;
686+ String url = WxOpenMinishopService .UPLOAD_IMG_MINISHOP_FILE_URL + "?access_token=" + getAuthorizerAccessToken (appId , false ) + "&height=" + height + "&width=" + width ;
704687 log .info ("upload url: " + url );
705688// String response = (url, file);
706689 WxMinishopImageUploadResult result = getWxOpenService ().uploadMinishopMediaFile (url , file );
@@ -1114,8 +1097,6 @@ public WxOpenResult minishopGoodsUpdateSkuStock(String appId, Long productId, Lo
11141097 jsonObject .addProperty ("stock_num" , stockNum );
11151098
11161099
1117-
1118-
11191100 String response = getWxOpenService ().post (url , jsonObject .toString ());
11201101
11211102 return WxOpenGsonBuilder .create ().fromJson (response , WxOpenResult .class );
@@ -1155,18 +1136,18 @@ public List<LimitDiscountGoods> getLimitDiscountList(String appId, Integer statu
11551136
11561137 JsonArray jsonArray = respObj .get ("limited_discount_list" ).getAsJsonArray ();
11571138 if (jsonArray != null && jsonArray .size () > 0 ) {
1158- for (int i = 0 ; i < jsonArray .size (); i ++) {
1139+ for (int i = 0 ; i < jsonArray .size (); i ++) {
11591140 JsonObject goodsObj = jsonArray .get (i ).getAsJsonObject ();
11601141 LimitDiscountGoods discountGoods = new LimitDiscountGoods ();
11611142 discountGoods .setTaskId (goodsObj .get ("task_id" ).getAsLong ());
11621143 discountGoods .setStatus (goodsObj .get ("status" ).getAsInt ());
1163- discountGoods .setStartTime (new Date (goodsObj .get ("start_time" ).getAsLong ()* 1000 ));
1164- discountGoods .setEndTime (new Date (goodsObj .get ("end_time" ).getAsLong ()* 1000 ));
1144+ discountGoods .setStartTime (new Date (goodsObj .get ("start_time" ).getAsLong () * 1000 ));
1145+ discountGoods .setEndTime (new Date (goodsObj .get ("end_time" ).getAsLong () * 1000 ));
11651146
11661147 List <LimitDiscountSku > skuList = new ArrayList <>();
11671148 JsonArray skuArray = goodsObj .get ("limited_discount_sku_list" ).getAsJsonArray ();
11681149 if (skuArray != null && skuArray .size () > 0 ) {
1169- for (int j = 0 ; j < skuArray .size (); j ++) {
1150+ for (int j = 0 ; j < skuArray .size (); j ++) {
11701151 JsonObject skuObj = skuArray .get (i ).getAsJsonObject ();
11711152 LimitDiscountSku sku = new LimitDiscountSku ();
11721153 sku .setSkuId (skuObj .get ("sku_id" ).getAsLong ());
@@ -1186,7 +1167,7 @@ public List<LimitDiscountGoods> getLimitDiscountList(String appId, Integer statu
11861167 }
11871168
11881169 @ Override
1189- public WxOpenResult updateLimitDiscountStatus (String appId , Long taskId , Integer status ) throws WxErrorException {
1170+ public WxOpenResult updateLimitDiscountStatus (String appId , Long taskId , Integer status ) throws WxErrorException {
11901171 String url = API_MINISHOP_UPDATE_LIMIT_DICOUNT_STATUS_URL + "access_token=" + getAuthorizerAccessToken (appId , false );
11911172 JsonObject jsonObject = new JsonObject ();
11921173 jsonObject .addProperty ("task_id" , taskId );
0 commit comments