|
12 | 12 | import me.chanjar.weixin.cp.api.WxCpExternalContactService;
|
13 | 13 | import me.chanjar.weixin.cp.api.WxCpService;
|
14 | 14 | import me.chanjar.weixin.cp.bean.WxCpBaseResp;
|
| 15 | +import me.chanjar.weixin.cp.bean.external.WxCpAddMomentResult; |
| 16 | +import me.chanjar.weixin.cp.bean.external.WxCpAddMomentTask; |
15 | 17 | import me.chanjar.weixin.cp.bean.external.WxCpContactWayInfo;
|
16 | 18 | import me.chanjar.weixin.cp.bean.external.WxCpContactWayResult;
|
| 19 | +import me.chanjar.weixin.cp.bean.external.WxCpGetMomentComments; |
| 20 | +import me.chanjar.weixin.cp.bean.external.WxCpGetMomentCustomerList; |
| 21 | +import me.chanjar.weixin.cp.bean.external.WxCpGetMomentList; |
| 22 | +import me.chanjar.weixin.cp.bean.external.WxCpGetMomentSendResult; |
| 23 | +import me.chanjar.weixin.cp.bean.external.WxCpGetMomentTask; |
| 24 | +import me.chanjar.weixin.cp.bean.external.WxCpGetMomentTaskResult; |
17 | 25 | import me.chanjar.weixin.cp.bean.external.WxCpMsgTemplate;
|
18 | 26 | import me.chanjar.weixin.cp.bean.external.WxCpMsgTemplateAddResult;
|
19 | 27 | import me.chanjar.weixin.cp.bean.external.WxCpUpdateRemarkRequest;
|
@@ -137,9 +145,12 @@ public String convertToOpenid(@NotNull String externalUserId) throws WxErrorExce
|
137 | 145 | }
|
138 | 146 |
|
139 | 147 | @Override
|
140 |
| - public String unionidToExternalUserid(@NotNull String unionid) throws WxErrorException { |
| 148 | + public String unionidToExternalUserid(@NotNull String unionid,String openid) throws WxErrorException { |
141 | 149 | JsonObject json = new JsonObject();
|
142 | 150 | json.addProperty("unionid", unionid);
|
| 151 | + if(StringUtils.isNotEmpty(openid)){ |
| 152 | + json.addProperty("openid",openid); |
| 153 | + } |
143 | 154 | final String url = this.mainService.getWxCpConfigStorage().getApiUrl(UNIONID_TO_EXTERNAL_USERID);
|
144 | 155 | String responseContent = this.mainService.post(url, json.toString());
|
145 | 156 | JsonObject tmpJson = GsonParser.parse(responseContent);
|
@@ -449,6 +460,105 @@ public WxCpBaseResp markTag(String userid, String externalUserid, String[] addTa
|
449 | 460 | return WxCpBaseResp.fromJson(result);
|
450 | 461 | }
|
451 | 462 |
|
| 463 | + @Override |
| 464 | + public WxCpAddMomentResult addMomentTask(WxCpAddMomentTask task) throws WxErrorException { |
| 465 | + final String url = this.mainService.getWxCpConfigStorage().getApiUrl(ADD_MOMENT_TASK); |
| 466 | + final String result = this.mainService.post(url, task.toJson()); |
| 467 | + return WxCpAddMomentResult.fromJson(result); |
| 468 | + } |
| 469 | + |
| 470 | + @Override |
| 471 | + public WxCpGetMomentTaskResult getMomentTaskResult(String jobId) throws WxErrorException { |
| 472 | + String params = "&jobid=" + jobId; |
| 473 | + final String url = this.mainService.getWxCpConfigStorage().getApiUrl(GET_MOMENT_TASK_RESULT); |
| 474 | + final String result = this.mainService.get(url, params); |
| 475 | + return WxCpGetMomentTaskResult.fromJson(result); |
| 476 | + } |
| 477 | + |
| 478 | + @Override |
| 479 | + public WxCpGetMomentList getMomentList(Long startTime, Long endTime, String creator, Integer filterType, |
| 480 | + String cursor, Integer limit) throws WxErrorException { |
| 481 | + JsonObject json = new JsonObject(); |
| 482 | + json.addProperty("start_time", startTime); |
| 483 | + json.addProperty("end_time", endTime); |
| 484 | + if (!StringUtils.isEmpty(creator)) { |
| 485 | + json.addProperty("creator", creator); |
| 486 | + } |
| 487 | + if (filterType!=null) { |
| 488 | + json.addProperty("filter_type", filterType); |
| 489 | + } |
| 490 | + if (!StringUtils.isEmpty(cursor)) { |
| 491 | + json.addProperty("cursor", cursor); |
| 492 | + } |
| 493 | + if (limit!=null) { |
| 494 | + json.addProperty("limit", limit); |
| 495 | + } |
| 496 | + final String url = this.mainService.getWxCpConfigStorage().getApiUrl(GET_MOMENT_LIST); |
| 497 | + final String result = this.mainService.post(url, json.toString()); |
| 498 | + return WxCpGetMomentList.fromJson(result); |
| 499 | + } |
| 500 | + |
| 501 | + @Override |
| 502 | + public WxCpGetMomentTask getMomentTask(String momentId, String cursor, Integer limit) |
| 503 | + throws WxErrorException { |
| 504 | + JsonObject json = new JsonObject(); |
| 505 | + json.addProperty("moment_id", momentId); |
| 506 | + if (!StringUtils.isEmpty(cursor)) { |
| 507 | + json.addProperty("cursor", cursor); |
| 508 | + } |
| 509 | + if (limit!=null) { |
| 510 | + json.addProperty("limit", limit); |
| 511 | + } |
| 512 | + final String url = this.mainService.getWxCpConfigStorage().getApiUrl(GET_MOMENT_TASK); |
| 513 | + final String result = this.mainService.post(url, json.toString()); |
| 514 | + return WxCpGetMomentTask.fromJson(result); |
| 515 | + } |
| 516 | + |
| 517 | + @Override |
| 518 | + public WxCpGetMomentCustomerList getMomentCustomerList(String momentId, String userId, |
| 519 | + String cursor, Integer limit) throws WxErrorException { |
| 520 | + JsonObject json = new JsonObject(); |
| 521 | + json.addProperty("moment_id", momentId); |
| 522 | + json.addProperty("userid", userId); |
| 523 | + if (!StringUtils.isEmpty(cursor)) { |
| 524 | + json.addProperty("cursor", cursor); |
| 525 | + } |
| 526 | + if (limit!=null) { |
| 527 | + json.addProperty("limit", limit); |
| 528 | + } |
| 529 | + final String url = this.mainService.getWxCpConfigStorage().getApiUrl(GET_MOMENT_CUSTOMER_LIST); |
| 530 | + final String result = this.mainService.post(url, json.toString()); |
| 531 | + return WxCpGetMomentCustomerList.fromJson(result); |
| 532 | + } |
| 533 | + |
| 534 | + @Override |
| 535 | + public WxCpGetMomentSendResult getMomentSendResult(String momentId, String userId, |
| 536 | + String cursor, Integer limit) throws WxErrorException { |
| 537 | + JsonObject json = new JsonObject(); |
| 538 | + json.addProperty("moment_id", momentId); |
| 539 | + json.addProperty("userid", userId); |
| 540 | + if (!StringUtils.isEmpty(cursor)) { |
| 541 | + json.addProperty("cursor", cursor); |
| 542 | + } |
| 543 | + if (limit!=null) { |
| 544 | + json.addProperty("limit", limit); |
| 545 | + } |
| 546 | + final String url = this.mainService.getWxCpConfigStorage().getApiUrl(GET_MOMENT_SEND_RESULT); |
| 547 | + final String result = this.mainService.post(url, json.toString()); |
| 548 | + return WxCpGetMomentSendResult.fromJson(result); |
| 549 | + } |
| 550 | + |
| 551 | + @Override |
| 552 | + public WxCpGetMomentComments getMomentComments(String momentId, String userId) |
| 553 | + throws WxErrorException { |
| 554 | + JsonObject json = new JsonObject(); |
| 555 | + json.addProperty("moment_id", momentId); |
| 556 | + json.addProperty("userid", userId); |
| 557 | + final String url = this.mainService.getWxCpConfigStorage().getApiUrl(GET_MOMENT_COMMENTS); |
| 558 | + final String result = this.mainService.post(url, json.toString()); |
| 559 | + return WxCpGetMomentComments.fromJson(result); |
| 560 | + } |
| 561 | + |
452 | 562 | /**
|
453 | 563 | * <pre>
|
454 | 564 | * 企业和第三方应用可通过此接口获取企业与成员的群发记录。
|
|
0 commit comments