Browse Source

微信第三方平台

dev_shibei_match
zxc 5 years ago
parent
commit
35b2f0227e
  1. 21
      epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/controller/ComponentVerifyTicketController.java
  2. 2
      epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/service/ComponentVerifyTicketService.java
  3. 8
      epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java

21
epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/controller/ComponentVerifyTicketController.java

@ -1,35 +1,30 @@
package com.epmet.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.form.ThirdPlatformEventFormDTO;
import com.epmet.dto.form.WeChatPlatformAuthCodeFormDTO;
import com.epmet.dto.result.ResultBean;
import com.epmet.service.ComponentVerifyTicketService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
/**
* @Author zxc
* @CreateTime 2020/7/6 9:07
*/
@Slf4j
@RestController
@RestController("third")
public class ComponentVerifyTicketController {
@Autowired
private ComponentVerifyTicketService componentVerifyTicketService;
@PostMapping(value = "/event")
public Result weChatPlatformEvent(@RequestBody ThirdPlatformEventFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO, ThirdPlatformEventFormDTO.ThirdPlatForm.class);
componentVerifyTicketService.parseRequest(formDTO);
@PostMapping(value = "/ticket")
public Result weChatPlatformEvent(@RequestParam("timestamp") String timestamp,
@RequestParam("nonce") String nonce,
@RequestParam("msg_signature") String msgSignature,
@RequestBody String postData) {
componentVerifyTicketService.parseRequest(timestamp,nonce,msgSignature,postData);
return new Result();
}

2
epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/service/ComponentVerifyTicketService.java

@ -22,7 +22,7 @@ public interface ComponentVerifyTicketService {
* @return 如果获得只需要返回 SUCCESS
* @Author zxc
*/
void parseRequest(ThirdPlatformEventFormDTO formDTO);
void parseRequest(String timestamp,String nonce,String msgSignature,String postData);
/**
* @Description 定时获取 ticket

8
epmet-module/epmet-third-platform/epmet-third-platform-server/src/main/java/com/epmet/service/impl/ComponentVerifyTicketServiceImpl.java

@ -36,15 +36,11 @@ public class ComponentVerifyTicketServiceImpl implements ComponentVerifyTicketSe
/**
* @Description 获得授权事件的票据
* @param formDTO
* @param
* @author zxc
*/
@Override
public void parseRequest(ThirdPlatformEventFormDTO formDTO) {
String msgSignature = formDTO.getMsgSignature();
String nonce = formDTO.getNonce();
String postData = formDTO.getPostData();
String timeStamp = formDTO.getTimeStamp();
public void parseRequest(String timeStamp,String nonce,String msgSignature,String postData) {
log.info(ModuleConstant.START_RECEIVE);
try {
//这个类是微信官网提供的解密类,需要用到消息校验Token 消息加密Key和服务平台appid

Loading…
Cancel
Save