yanghb
2023-04-21 75a2623173bcc4a235aa1f99f7ef28519186160b
UserTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/util/ICBCPayUtil.java
@@ -9,6 +9,7 @@
import com.icbc.api.request.*;
import com.icbc.api.response.*;
import com.icbc.api.utils.IcbcSignature;
import com.stylefeng.guns.modular.system.util.httpClinet.HttpClientUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;
@@ -83,7 +84,7 @@
     * @param type              支付端类型(1:用户端,2:司机端,3:小程序)
     * @throws UnknownHostException
     */
    public Map<String, String> placeAnOrder1(String out_trade_no, Integer pay_mode, Integer access_type, String deciveInfo, String body, Double total_fee, String mer_url, String attach, Integer type, String openId) throws Exception {
    public Map<String, String> placeAnOrder(String out_trade_no, Integer pay_mode, Integer access_type, String deciveInfo, String body, Double total_fee, String mer_url, String attach, Integer type, String openId) throws Exception {
        //签名类型为RSA时,需传入appid,私钥和网关公钥,签名类型使用定值IcbcConstants.SIGN_TYPE_RSA,其他参数使用缺省值
        DefaultIcbcClient client = new DefaultIcbcClient(app_id, IcbcConstants.SIGN_TYPE_RSA2, privateKey, icbcPulicKey);
        CardbusinessAggregatepayB2cOnlineConsumepurchaseRequestV1 request = new
@@ -102,7 +103,7 @@
        bizContent.setMer_prtcl_no(mer_prtcl_no);
        bizContent.setOrig_date_time(format);
        bizContent.setDecive_info(deciveInfo);
        bizContent.setBody("嘉易行-" + body);
        bizContent.setBody("OK出行-" + body);
        bizContent.setFee_type("001");
        InetAddress ip4 = Inet4Address.getLocalHost();
        bizContent.setSpbill_create_ip(ip4.getHostAddress());
@@ -206,7 +207,7 @@
     * @param order_id      工行订单号
     * @return
     */
    public String queryTransaction1(String out_trade_no, String order_id){
    public String queryTransaction(String out_trade_no, String order_id){
        //签名类型为RSA时,需传入appid,私钥和网关公钥,签名类型使用定值IcbcConstants.SIGN_TYPE_RSA,其他参数使用缺省值
        DefaultIcbcClient client = new DefaultIcbcClient(app_id, IcbcConstants.SIGN_TYPE_RSA2, privateKey, icbcPulicKey);
        CardbusinessAggregatepayB2cOnlineOrderqryRequestV1 request = new CardbusinessAggregatepayB2cOnlineOrderqryRequestV1();
@@ -252,7 +253,7 @@
     * @return
     * @throws Exception
     */
    public Map<String, String> payCallback1(HttpServletRequest request) throws Exception{
    public Map<String, String> payCallback(HttpServletRequest request) throws Exception{
        String biz_content1 = request.getParameter("biz_content");
        JSONObject biz_content = JSON.parseObject(biz_content1);
        int return_code = biz_content.getIntValue("return_code");
@@ -282,7 +283,7 @@
     * @param response
     * @throws Exception
     */
    public void answer1(HttpServletResponse response) throws Exception{
    public void answer(HttpServletResponse response) throws Exception{
        response.setContentType("application/json;charset=UTF-8");
        StringBuffer sb = new StringBuffer();
        String nativeUUID = UUIDUtil.getNativeUUID();
@@ -307,7 +308,7 @@
     * @param payeeCnname       收款账户名称
     * @return
     */
    public ResultUtil<String> transfer1(Long money, String payeeAccount, String payeeCnname) throws Exception{
    public ResultUtil<String> transfer(Long money, String payeeAccount, String payeeCnname) throws Exception{
        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
        SimpleDateFormat sdf_ = new SimpleDateFormat("HHmmssSSS");
        Date date = new Date();
@@ -368,7 +369,7 @@
     * @param serialNo      转账申请序列号(转账接口返回)
     * @return              -1=查询异常,0=交易成功,1=交易处理中,2=交易拒绝
     */
    public Integer queryTransfer1(String serialNo){
    public Integer queryTransfer(String serialNo){
        String url = "https://gw.open.icbc.com.cn/api/mybank/enterprise/pay/qpayent/V1";
        DefaultIcbcClient client = new DefaultIcbcClient(app_id, IcbcConstants.SIGN_TYPE_RSA2, privateKey, icbcPulicKey);
        try {
@@ -549,7 +550,7 @@
     * @return
     * @throws Exception
     */
    public Map<String, Object> merrefund1(String order_id, String out_trade_no, Double ret_total_amt, String order_apd_inf, String outtrx_serial_no) throws Exception{
    public Map<String, Object> merrefund(String order_id, String out_trade_no, Double ret_total_amt, String order_apd_inf, String outtrx_serial_no) throws Exception{
        ret_total_amt = ret_total_amt * 100;
        //签名类型为RSA2时,需传入appid,私钥和网关公钥,签名类型使用定值IcbcConstants.SIGN_TYPE_RSA2,其他参数使用缺省值
        DefaultIcbcClient client = new DefaultIcbcClient(app_id, IcbcConstants.SIGN_TYPE_RSA2, privateKey, icbcPulicKey);
@@ -602,7 +603,7 @@
     * @param outtrx_serial_no      商户系统退货编号
     * @return
     */
    public Map<String, Object> refundqry1(String out_trade_no, String order_id, String outtrx_serial_no){
    public Map<String, Object> refundqry(String out_trade_no, String order_id, String outtrx_serial_no){
        // 签名类型为RSA时,需传入appid,私钥和网关公钥,签名类型使用定值IcbcConstants.SIGN_TYPE_RSA,其他参数使用缺省值
        DefaultIcbcClient client = new DefaultIcbcClient(app_id, IcbcConstants.SIGN_TYPE_RSA2, privateKey, icbcPulicKey);
        CardbusinessAggregatepayB2cOnlineRefundqryRequestV1 request = new CardbusinessAggregatepayB2cOnlineRefundqryRequestV1();
@@ -653,7 +654,12 @@
        String url = "https://bankaddress.shumaidata.com/bankaddress?bankcard=" + code;
        Map<String, String> header = new HashMap<>();
        header.put("Authorization", "APPCODE b7d32437d08149099457dcb50fb57df2");
        String get = httpClientUtil.pushHttpRequset("GET", url, null, header, "form");
        String get = null;
        try {
            get = httpClientUtil.pushHttpRequset("GET", url, null, header, "form").getData();
        } catch (Exception e) {
            e.printStackTrace();
        }
        JSONObject jsonObject = JSON.parseObject(get);
        int code1 = jsonObject.getIntValue("code");
        Map<String, String> map = new HashMap<>();