Преглед изворни кода

Merge branch 'dev' of huangwenjie/patient-co-management into dev

chenweida пре 7 година
родитељ
комит
05ff54094b

+ 62 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PatientPrescriptionPayService.java

@ -1348,7 +1348,69 @@ public class PatientPrescriptionPayService extends BaseService {
        return result;
    }
    
    public String getSignFamilyPayResult(String outChargeNo, String accessToken, String appId, String appSecret) throws Exception {
        int flag = 0;
        Boolean isSuccess = true;
        String msgBody = "";
        String response = "";
        String error = "";
        String result = null;
//      ***************************  测通流程 ***************************************
        OnepayDefaultClient onepayClient = new OnepayDefaultClient(config.getOnepayApi(), appId, appSecret, signType, encryptType);
    
        try {
            RequestParams requestParams = new RequestParams();
            requestParams.setAppId(appId);
            requestParams.setTimestamp(DateUtil.getCurrentDateTime());
            requestParams.setSignType(signType);
            requestParams.setEncryptType(encryptType);
            requestParams.setTransType(config.getChargeQueryType());
        
            //业务参数
            JSONObject params = new JSONObject();
            params.put("outChargeNo", outChargeNo);  //接入应用结算业务流水号
            params.put("wxToken", accessToken);
        
            requestParams.setParam(params);
            msgBody = JSON.toJSONString(requestParams);
//              ***************************  测通流程 ***************************************
            //执行支付 返回原生返回值
            ResponseParams<JSONObject> res = onepayClient.execute(requestParams);
            response = JSON.toJSONString(res);
        
            if (OnepayDefaultClient.isSuccessful(res)) {
                //业务处理*******************
//                只返回业务出参
                flag = 1;
                result = JSON.toJSONString(res.getParam());
            
                logger.info("请求成功,返回参数: " + result);
            } else {
                isSuccess = false;
                error = "请求失败,返回结果:" + res.getRespCode() + "," + res.getRespMsg();
            }
        } catch (Exception ex) {
            isSuccess = false;
            StringWriter sw = new StringWriter();
            PrintWriter pw = new PrintWriter(sw);
            ex.printStackTrace(pw);
            error = sw.toString();
        }
    
        //type = 3易联众接口保存http日志
        logger.info("api - " + config.getChargeQueryType());
        logger.info("request - " + msgBody);
        logger.info("responses - " + response);
        logger.info("error - " + error);
        if (!isSuccess) {
            throw new Exception(error);
        }
    
        return result;
    }
}

+ 23 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prescription/PatientPrescriptionPayController.java

@ -114,6 +114,29 @@ public class PatientPrescriptionPayController extends WeixinBaseController {
            return error(-1, "获取失败!");
        }
    }
    
    /**
     * 查询家庭签约支付结果
     * @return
     */
    @RequestMapping(value = "/getSignFamilyPayResult", method = RequestMethod.GET)
    @ApiOperation(value = "查询家庭签约支付结果")
    public String getSignFamilyPayResult(
            @RequestParam(required = true)
            @ApiParam(value = "支付应用流水号", name = "outChargeNo") String outChargeNo,
            @RequestParam(required = true)
            @ApiParam(value = "易联众appid", name = "appId") String appId,
            @RequestParam(required = true)
            @ApiParam(value = "易联众app secret", name = "appSecret") String appSecret) throws Exception {
        try {
            String accessToken = getAccessToken();
            String result = payService.getSignFamilyPayResult(outChargeNo, accessToken,appId,appSecret);
            return write(200, "获取成功!", "data", result);
        } catch (Exception e) {
            error(e);
            return error(-1, "获取失败!");
        }
    }
    /**