| | |
| | | package cc.mrbird.febs.pay.service.impl; |
| | | |
| | | import cc.mrbird.febs.mall.entity.MallOrderInfo; |
| | | import cc.mrbird.febs.mall.mapper.MallOrderInfoMapper; |
| | | import cc.mrbird.febs.pay.model.*; |
| | | import cc.mrbird.febs.pay.service.UnipayService; |
| | | import cc.mrbird.febs.pay.util.*; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import cn.hutool.json.JSONUtil; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.codec.digest.DigestUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | |
| | | "cNgAAtydXYWQJALLOFCjCkRgeRVL8YE8bVi4U16b8ltAN1DlbWEzui6VFy2vIga3IryesNVAOOdornyAwf" + |
| | | "1huqB2lYfuQwtrIBKg=="; |
| | | public static final String notifyUrl = "http://47.111.90.145:8800/api/unipay/unipayCallBack"; |
| | | public static final String agreementPayNotifyUrl = "http://47.111.90.145:8800/api/unipay/agreementPayCallBack"; |
| | | public static final String agreementPayNotifyUrl = "http://47.111.90.145:8800/api/unipay/agreeMentPayCallBack"; |
| | | public static final String p1MerchantNo = "888118000001971";/** 商户编号 */ |
| | | public static final String aesKey = "1234567891234567";/** 商户编号 */ |
| | | |
| | | @Autowired |
| | | private MallOrderInfoMapper orderInfoMapper; |
| | | |
| | | @Override |
| | | @Transactional |
| | |
| | | map.put("mch_order_no",agreementPayDto.getOrderNo()); // 商户订单号 |
| | | map.put("order_amount", agreementPayDto.getOrderAmount()); // 订单金额;金额保留两位小数 |
| | | map.put("mch_req_time", agreementPayDto.getOrderTime()); // 订单时间 |
| | | map.put("order_desc", agreementPayDto.getOrderDesc()); // 订单时间 |
| | | map.put("order_desc", agreementPayDto.getOrderDesc()); // 商品名称 |
| | | map.put("callback_url", agreementPayNotifyUrl); // 异步通知地址 |
| | | map.put("bank_card_no", AESUtil.Aes256Encode(agreementPayDto.getBankNo(),aesKey)); // 签约银行卡号 |
| | | |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | map.put("mch_order_no", "NO_"+agreeMentPaySmsDto.getOrderNo()); // 商户订单号 |
| | | map.put("order_amount", agreeMentPaySmsDto.getOrderAmount()); // 订单金额 |
| | | map.put("mch_req_time", agreeMentPaySmsDto.getCreatedTime()); // 下单时间 |
| | | |
| | | MallOrderInfo orderInfo = orderInfoMapper.selectByOrderNo(agreeMentPaySmsDto.getOrderNo()); |
| | | map.put("mch_order_no", "NO_"+orderInfo.getOrderNo()); // 商户订单号 |
| | | |
| | | BigDecimal value = orderInfo.getAmount().setScale(2, BigDecimal.ROUND_DOWN); |
| | | DecimalFormat decimalFormat = new DecimalFormat("0.00#"); |
| | | String strVal = decimalFormat.format(value); |
| | | map.put("order_amount", strVal); // 订单金额 |
| | | map.put("mch_req_time", DateUtil.now()); // 下单时间 |
| | | map.put("payer_name",AESUtil.Aes256Encode(agreeMentPaySmsDto.getName(),aesKey)); // 姓名 |
| | | map.put("id_type", agreeMentPaySmsDto.getIdType()); // 证件类型 |
| | | map.put("id_no", AESUtil.Aes256Encode(agreeMentPaySmsDto.getIdCardNum(),aesKey)); // 证件号码 |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | System.out.println(httpResponseJson); |
| | | if(StrUtil.isNotBlank(httpResponseJson)){ |
| | | cn.hutool.json.JSONObject jsonObject = JSONUtil.parseObj(httpResponseJson); |
| | | System.out.println(jsonObject); |
| | | String biz_code = jsonObject.get("biz_code").toString(); |
| | | if("JS000000" == biz_code){ |
| | | return httpResponseJson; |
| | | } |
| | | return "fail"; |
| | | cn.hutool.json.JSONObject jsonObject = JSONUtil.parseObj(httpResponseJson); |
| | | System.out.println(jsonObject); |
| | | String biz_code = jsonObject.get("biz_code").toString(); |
| | | String biz_msg = jsonObject.get("biz_msg").toString(); |
| | | if("JS000000".equals(biz_code)){ |
| | | return biz_code; |
| | | }else{ |
| | | return "fail"; |
| | | return biz_msg; |
| | | } |
| | | } |
| | | |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | map.put("mch_order_no", agreementSignDto.getOrderNo()); // 商户订单号 |
| | | map.put("mch_order_no", "NO_"+agreementSignDto.getOrderNo()); // 商户订单号 |
| | | map.put("sms_code", agreementSignDto.getSmsCode()); // 签约短信验证码 |
| | | |
| | | requestParam.setData(JsonUtil.toString(map)); |