use of com.coolfish.weixin.redpack.protocol.query.RedPackQueryResData in project vip by guangdada.
the class RedpackLogServiceImpl method updateRedPackLog.
@Transactional(readOnly = false, propagation = Propagation.REQUIRED)
public void updateRedPackLog(RedpackLog redpackLog) {
log.info("进入updateRedPackLog>>redpackLog = " + redpackLog.toString());
if (!gunsProperties.getRedpackFlag()) {
log.info("发送红包开关没有打开");
return;
}
RedPackQueryResData rprd = RedPackUtil.redPackQuery(redpackLog.getBillno(), gunsProperties.getCertPath());
// 通信成功则记录发送日志
if (rprd != null) {
if ("SUCCESS".equals(rprd.getReturn_code())) {
if ("SUCCESS".equals(rprd.getErr_code())) {
Integer code = RedPackSendStatus.getCode(rprd.getStatus());
if (code != null) {
redpackLog.setSendStatus(code);
redpackLog.setReason(rprd.getReason());
if (RedPackSendStatus.REFUND.name().equals(rprd.getStatus())) {
redpackLog.setRefundTime(DateUtil.parseDate(rprd.getRefund_time()));
}
if (RedPackSendStatus.RECEIVED.name().equals(rprd.getStatus())) {
// 修改领取信息
redpackDao.updateReciveInfo(redpackLog.getSendAmount(), redpackLog.getRedpackId());
}
redpackLogMapper.updateById(redpackLog);
}
} else {
log.error("查询红包发送结果>>Err_code_des = " + rprd.getErr_code_des());
redpackLog.setSendStatus(RedPackSendStatus.FAILED.getCode());
redpackLogMapper.updateById(redpackLog);
}
} else {
log.error("查询红包发送结果>>Return_msg = " + rprd.getReturn_msg());
}
}
}
use of com.coolfish.weixin.redpack.protocol.query.RedPackQueryResData in project vip by guangdada.
the class RedpackLogServiceImpl method main.
public static void main(String[] args) {
// RedpackLogServiceImpl d = new RedpackLogServiceImpl();
// d.saveRedPackLog(1, "o19yZsw5CT7CDk_ikBRiGNbyu7Tw", "", merchantId,
// redpackId, actName, remark, wishing);
/*
* String billno = "kryhb" + new
* SimpleDateFormat("yyyyMMddHHmmssSSSS").format(new Date());
* RedPackResData rprd = RedPackUtil.redPackSend(1, "活动名称", "活动备注",
* "恭喜发财,大吉大利", "o19yZsw5CT7CDk_ikBRiGNbyu7Tw", billno,
* "D:\\cert\\apiclient_cert.p12"); System.out.println(rprd);
*/
RedPackQueryResData dd = RedPackUtil.redPackQuery("kryhb201710201653510203", "D:\\cert\\apiclient_cert.p12");
System.out.println(dd.toString());
}
use of com.coolfish.weixin.redpack.protocol.query.RedPackQueryResData in project vip by guangdada.
the class RedPackUtil method redPackQuery.
public static RedPackQueryResData redPackQuery(String mch_billno, String certLocalPath) {
final RedPackQueryResData rprd = new RedPackQueryResData();
try {
WXPay.initSDKConfiguration("JTZM88CKRKSWNUAUUF8HMJ7FJPGIY3NA", "wx71e66431bed0303e", "1229321102", "", certLocalPath, "1229321102");
PayConfig.setIp(Util.localIp());
PayConfig.setHttpsRequestClassName("com.coolfish.weixin.pay.common.HttpsRequest");
RedPackQueryReqData redPackQueryReqData = new RedPackQueryReqData(mch_billno);
WXPay.doRedPackQueryBusiness(redPackQueryReqData, new RedPackQueryListener() {
@Override
public void onXmlError(RedPackResData payResData) {
// TODO Auto-generated method stub
rprd.setErr_code(payResData.getErr_code());
rprd.setErr_code_des(payResData.getErr_code_des());
rprd.setResult_code(payResData.getResult_code());
rprd.setReturn_code(payResData.getReturn_code());
rprd.setReturn_msg(payResData.getReturn_msg());
}
@Override
public void onSystemError(RedPackResData payResData) {
// TODO Auto-generated method stub
rprd.setErr_code(payResData.getErr_code());
rprd.setErr_code_des(payResData.getErr_code_des());
rprd.setResult_code(payResData.getResult_code());
rprd.setReturn_code(payResData.getReturn_code());
rprd.setReturn_msg(payResData.getReturn_msg());
}
@Override
public void onSignError(RedPackResData payResData) {
// TODO Auto-generated method stub
rprd.setErr_code(payResData.getErr_code());
rprd.setErr_code_des(payResData.getErr_code_des());
rprd.setResult_code(payResData.getResult_code());
rprd.setReturn_code(payResData.getReturn_code());
rprd.setReturn_msg(payResData.getReturn_msg());
}
@Override
public void onParamError(RedPackResData payResData) {
// TODO Auto-generated method stub
rprd.setErr_code(payResData.getErr_code());
rprd.setErr_code_des(payResData.getErr_code_des());
rprd.setResult_code(payResData.getResult_code());
rprd.setReturn_code(payResData.getReturn_code());
rprd.setReturn_msg(payResData.getReturn_msg());
}
@Override
public void onNoAuth(RedPackResData payResData) {
// TODO Auto-generated method stub
rprd.setErr_code(payResData.getErr_code());
rprd.setErr_code_des(payResData.getErr_code_des());
rprd.setResult_code(payResData.getResult_code());
rprd.setReturn_code(payResData.getReturn_code());
rprd.setReturn_msg(payResData.getReturn_msg());
}
@Override
public void onFreqLimit(RedPackResData payResData) {
// TODO Auto-generated method stub
rprd.setErr_code(payResData.getErr_code());
rprd.setErr_code_des(payResData.getErr_code_des());
rprd.setResult_code(payResData.getResult_code());
rprd.setReturn_code(payResData.getReturn_code());
rprd.setReturn_msg(payResData.getReturn_msg());
}
@Override
public void onCaError(RedPackResData payResData) {
// TODO Auto-generated method stub
rprd.setErr_code(payResData.getErr_code());
rprd.setErr_code_des(payResData.getErr_code_des());
rprd.setResult_code(payResData.getResult_code());
rprd.setReturn_code(payResData.getReturn_code());
rprd.setReturn_msg(payResData.getReturn_msg());
}
@Override
public void onSuccess(RedPackQueryResData resData) {
// TODO Auto-generated method stub
rprd.setErr_code(resData.getErr_code());
rprd.setErr_code_des(resData.getErr_code_des());
rprd.setResult_code(resData.getResult_code());
rprd.setReturn_code(resData.getReturn_code());
rprd.setReturn_msg(resData.getReturn_msg());
rprd.setStatus(resData.getStatus());
rprd.setReason(resData.getReason());
rprd.setRefund_time(resData.getRefund_time());
}
@Override
public void onOtherError(RedPackQueryResData resData) {
// TODO Auto-generated method stub
rprd.setErr_code(resData.getErr_code());
rprd.setErr_code_des(resData.getErr_code_des());
rprd.setResult_code(resData.getResult_code());
rprd.setReturn_code(resData.getReturn_code());
rprd.setReturn_msg(resData.getReturn_msg());
rprd.setStatus(resData.getStatus());
rprd.setReason(resData.getReason());
rprd.setRefund_time(resData.getRefund_time());
}
@Override
public void onNotFound(RedPackQueryResData resData) {
// TODO Auto-generated method stub
rprd.setErr_code(resData.getErr_code());
rprd.setErr_code_des(resData.getErr_code_des());
rprd.setResult_code(resData.getResult_code());
rprd.setReturn_code(resData.getReturn_code());
rprd.setReturn_msg(resData.getReturn_msg());
rprd.setStatus(resData.getStatus());
rprd.setReason(resData.getReason());
rprd.setRefund_time(resData.getRefund_time());
}
});
return rprd;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
Aggregations