EsignCallBackController.java 1.86 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
/**  
* <p>Title: EsignCallBackController.java</p>  
* <p>Description: </p>  
* @author dsc  
* @date 2020年5月19日  
* @version 1.0  
*/
package cn.timer.api.callback.esign;

import java.io.IOException;

import javax.servlet.http.HttpServletRequest;
import javax.transaction.Transactional;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import cn.timer.api.callback.esign.service.SafeVerify;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * <p>
 * Title: EsignCallBackController.java
 * </p>
 * <p>
 * Description:
 * </p>
 * 
 * @author dsc
 * @date 2020年5月19日
 * @version 1.0
 */
@RestController
@Transactional
@Api(tags = "99.97 e签宝回调接口")
@RequestMapping(value = "/callback/esign", produces = { "application/json" })
public class EsignCallBackController {
	@Autowired
	private HttpServletRequest request;
//	@Autowired
//	private HttpServletResponse response;

	private static final String appSecret = "7b100813cca2746081c57837855ac5af";

	@PostMapping(value = "/dev") // TODO
	@ApiOperation(value = "合同流程结束通知(dev)", httpMethod = "POST", notes = "接口发布说明")
	public Integer wxcallback_test() {
		String res = null;
		SafeVerify sv = new SafeVerify();
		try {
			res = sv.checkPass(request, appSecret);
//			response.setCharacterEncoding("UTF-8");
//			response.getWriter().append("Served at: ").append(request.getContextPath()).append("\n")
//					.append("是否通过验证:----》").append(res);
		} catch (IOException e) {
			e.printStackTrace();
		}
		if (res != null && res.equals("true"))
			return 200; // 返回响应码
		return 500;
	}
}