2 files added
21 files modified
| | |
| | | public enum PayTypeEnum { |
| | | |
| | | /* 支付类型 汇旺财 */ |
| | | HWC("HWC", "汇旺财"), |
| | | HWC("HWC", "汇旺财1721415002"), |
| | | |
| | | /* 支付类型 汇旺财 */ |
| | | HWC2("HWC2", "汇旺财1721753752"), |
| | | |
| | | UNKNOWN("UNKNOWN", "暂未开放"); |
| | | |
| | |
| | | package com.oying.modules.hwc.rest; |
| | | |
| | | import com.oying.annotation.rest.AnonymousPostMapping; |
| | | import com.oying.modules.hwc.service.SwiftPassService; |
| | | import com.oying.modules.hwc.service.CallbackService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | |
| | | @RequestMapping("/api/swiftPass") |
| | | public class SwiftPassController { |
| | | |
| | | private final SwiftPassService swiftPassService; |
| | | private final CallbackService callbackService; |
| | | |
| | | @ApiOperation("HWS支付回调") |
| | | @AnonymousPostMapping(value = "/alipayCallback") |
| | | public void alipayCallback(HttpServletRequest request, HttpServletResponse response) { |
| | | swiftPassService.alipayCallback(request, response); |
| | | callbackService.alipayCallback(request, response); |
| | | } |
| | | |
| | | @ApiOperation("HWS退款回调") |
| | | @AnonymousPostMapping(value = "/returnNotify") |
| | | public void returnNotify(HttpServletRequest request, HttpServletResponse response) { |
| | | swiftPassService.returnNotify(request, response); |
| | | callbackService.returnNotify(request, response); |
| | | } |
| | | } |
New file |
| | |
| | | package com.oying.modules.hwc.service; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | public interface CallbackService { |
| | | |
| | | void alipayCallback(HttpServletRequest request, HttpServletResponse response); |
| | | |
| | | void returnNotify(HttpServletRequest request, HttpServletResponse response); |
| | | } |
| | |
| | | import com.oying.modules.hwc.domain.HwcResponse; |
| | | import com.oying.utils.enums.PayTypeEnum; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.io.IOException; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | |
| | | * |
| | | * @see [类、类#方法、类#成员] |
| | | */ |
| | | JSONObject query(String orderNum, PayTypeEnum status) throws IOException; |
| | | JSONObject query(String orderNum, PayTypeEnum status); |
| | | |
| | | void closeOrder(String outTradeNo, PayTypeEnum status) throws IOException; |
| | | void closeOrder(String outTradeNo, PayTypeEnum status); |
| | | |
| | | /** |
| | | * <一句话功能简述> |
| | |
| | | * @see [类、类#方法、类#成员] |
| | | */ |
| | | Map<String, String> refund(String returnNum, String orderNum, @NotNull(message = "备注不能为空") String reason, |
| | | long refund, long total, PayTypeEnum payType) throws IOException; |
| | | |
| | | void alipayCallback(HttpServletRequest request, HttpServletResponse response); |
| | | |
| | | void returnNotify(HttpServletRequest request, HttpServletResponse response); |
| | | long refund, long total, PayTypeEnum payType); |
| | | } |
New file |
| | |
| | | package com.oying.modules.hwc.service.impl; |
| | | |
| | | import com.oying.exception.BadRequestException; |
| | | import com.oying.modules.hwc.service.CallbackService; |
| | | import com.oying.modules.hwc.utils.SignUtil; |
| | | import com.oying.modules.hwc.utils.XmlUtils; |
| | | import com.oying.modules.security.config.SwiftPassProperties; |
| | | import com.oying.modules.sh.domain.Order; |
| | | import com.oying.modules.sh.domain.OrderReturn; |
| | | import com.oying.modules.sh.service.OrderReturnService; |
| | | import com.oying.modules.sh.service.OrderService; |
| | | import com.oying.utils.enums.PayStateEnum; |
| | | import com.oying.utils.enums.PayTypeEnum; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @author xin |
| | | * @description |
| | | * @date 2025/7/8 18:47 |
| | | */ |
| | | @SuppressWarnings({"unchecked", "all"}) |
| | | @Slf4j |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class CallbackServiceImpl implements CallbackService { |
| | | |
| | | private final OrderService orderService; |
| | | private final OrderReturnService returnService; |
| | | private final SwiftPassProperties properties; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void alipayCallback(HttpServletRequest request, HttpServletResponse response) { |
| | | try { |
| | | String resString = XmlUtils.parseRequest(request); |
| | | String respString = "error"; |
| | | if (!resString.isEmpty()) { |
| | | Map<String, String> map = XmlUtils.toMap(resString.getBytes(), "utf-8"); |
| | | String sign_type = map.get("sign_type"); |
| | | String reSign = map.get("sign"); |
| | | if (map.containsKey("sign")) { |
| | | Order order = orderService.getByOrderNum(map.get("out_trade_no")); |
| | | PayTypeEnum status = PayTypeEnum.find(order.getPayType()); |
| | | if (SignUtil.verifySign(reSign, sign_type, map, properties, status)) { |
| | | log.error("验证签名错误!:{}", map.toString()); |
| | | } else { |
| | | if ("0".equals(map.get("status"))) { |
| | | if ("0".equals(map.get("result_code"))) { |
| | | //业务处理 |
| | | if (PayStateEnum.SUCCESS.getKey().equals(order.getPayState())) { |
| | | // 已处理 |
| | | respString = "success"; |
| | | } else { |
| | | PayStateEnum stateEnum = PayStateEnum.NOTPAY; |
| | | if ("0".equals(map.get("pay_result"))) { |
| | | stateEnum = PayStateEnum.SUCCESS; |
| | | } |
| | | orderService.updatePayStatus(map.get("out_trade_no"), stateEnum, map.get("pay_info"), map.get("time_end")); |
| | | // 处理成功 |
| | | respString = "success"; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | response.getWriter().write(respString); |
| | | } catch (Exception e) { |
| | | throw new BadRequestException("操作失败,原因:" + e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void returnNotify(HttpServletRequest request, HttpServletResponse response) { |
| | | try { |
| | | String resString = XmlUtils.parseRequest(request); |
| | | String respString = "error"; |
| | | if (!resString.isEmpty()) { |
| | | Map<String, String> map = XmlUtils.toMap(resString.getBytes(), "utf-8"); |
| | | String sign_type = map.get("sign_type"); |
| | | String reSign = map.get("sign"); |
| | | if (map.containsKey("sign")) { |
| | | OrderReturn order = returnService.getByReturnNum(map.get("out_refund_no")); |
| | | PayTypeEnum status = PayTypeEnum.find(order.getPayType()); |
| | | if (SignUtil.verifySign(reSign, sign_type, map, properties, status)) { |
| | | log.error("验证签名错误!:{}", map.toString()); |
| | | } else { |
| | | if ("0".equals(map.get("status"))) { |
| | | if ("0".equals(map.get("result_code"))) { |
| | | // 业务处理 |
| | | returnService.updatePayStatus(map.get("out_refund_no"), map.get("refund_status"), |
| | | map.get("refund_time")); |
| | | // 业务处理 |
| | | respString = "success"; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | response.getWriter().write(respString); |
| | | } catch (Exception e) { |
| | | System.out.println("操作失败,原因:" + e.getMessage()); |
| | | } |
| | | } |
| | | } |
| | |
| | | package com.oying.modules.hwc.service.impl; |
| | | |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.google.gson.Gson; |
| | | import com.oying.exception.BadRequestException; |
| | | import com.oying.modules.hwc.domain.HwcResponse; |
| | | import com.oying.modules.hwc.service.SwiftPassService; |
| | |
| | | import com.oying.modules.hwc.utils.XmlUtils; |
| | | import com.oying.modules.security.config.SwiftPassProperties; |
| | | import com.oying.modules.security.config.WeiXinProperties; |
| | | import com.oying.modules.sh.service.OrderReturnService; |
| | | import com.oying.modules.sh.service.OrderService; |
| | | import com.oying.utils.CloseUtil; |
| | | import com.oying.utils.enums.PayTypeEnum; |
| | | import lombok.RequiredArgsConstructor; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.util.*; |
| | | |
| | | /** |
| | |
| | | private final static String service_close = "unified.trade.close"; |
| | | |
| | | private final SwiftPassProperties properties; |
| | | private final OrderService orderService; |
| | | private final OrderReturnService returnService; |
| | | private final WeiXinProperties weiXinProperties; |
| | | |
| | | @Override |
| | |
| | | switch (status) { |
| | | case HWC: |
| | | map.put("mch_id", properties.getMchId()); |
| | | break; |
| | | case HWC2: |
| | | map.put("mch_id", properties.getMchId2()); |
| | | break; |
| | | default: |
| | | throw new BadRequestException("汇旺财类型错误"); |
| | |
| | | throw new BadRequestException("验证签名错误"); |
| | | } else { |
| | | if ("0".equals(resultMap.get("status")) && "0".equals(resultMap.get("result_code"))) { |
| | | // Gson gson = new Gson(); |
| | | // return gson.fromJson(resultMap.get("pay_info"), HwcResponse.class); |
| | | return null; |
| | | Gson gson = new Gson(); |
| | | return gson.fromJson(resultMap.get("pay_info"), HwcResponse.class); |
| | | } else { |
| | | throw new BadRequestException(resultMap.get("err_code") + " : " + resultMap.get("err_msg") + "\n" + |
| | | resultMap.get("status") + " : " + resultMap.get("message")); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public JSONObject query(String orderNum, PayTypeEnum status) throws IOException { |
| | | public JSONObject query(String orderNum, PayTypeEnum status) { |
| | | // 参数 |
| | | SortedMap<String, String> map = new TreeMap<>(); |
| | | map.put("service", service_query); |
| | |
| | | switch (status) { |
| | | case HWC: |
| | | map.put("mch_id", properties.getMchId()); |
| | | break; |
| | | case HWC2: |
| | | map.put("mch_id", properties.getMchId2()); |
| | | break; |
| | | default: |
| | | throw new BadRequestException("汇旺财类型错误"); |
| | |
| | | throw new BadRequestException("操作失败,原因:" + e.getMessage()); |
| | | } finally { |
| | | if (response != null) { |
| | | response.close(); |
| | | CloseUtil.close(response); |
| | | } |
| | | if (client != null) { |
| | | client.close(); |
| | | CloseUtil.close(client); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void closeOrder(String outTradeNo, PayTypeEnum status) throws IOException { |
| | | public void closeOrder(String outTradeNo, PayTypeEnum status) { |
| | | // 参数 |
| | | SortedMap<String, String> map = new TreeMap<>(); |
| | | map.put("service", service_close); |
| | |
| | | switch (status) { |
| | | case HWC: |
| | | map.put("mch_id", properties.getMchId()); |
| | | break; |
| | | case HWC2: |
| | | map.put("mch_id", properties.getMchId2()); |
| | | break; |
| | | default: |
| | | throw new BadRequestException("汇旺财类型错误"); |
| | |
| | | throw new BadRequestException("操作失败,原因:" + e.getMessage()); |
| | | } finally { |
| | | if (response != null) { |
| | | response.close(); |
| | | CloseUtil.close(response); |
| | | } |
| | | if (client != null) { |
| | | client.close(); |
| | | CloseUtil.close(client); |
| | | } |
| | | } |
| | | } |
| | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Map<String, String> refund(String returnNum, String orderNum, String reason, long refund, |
| | | long total, PayTypeEnum payType) throws IOException { |
| | | long total, PayTypeEnum payType) { |
| | | // 参数 |
| | | SortedMap<String, String> map = new TreeMap<>(); |
| | | map.put("service", service_refund); |
| | |
| | | case HWC: |
| | | map.put("mch_id", properties.getMchId()); |
| | | map.put("op_user_id", properties.getMchId()); |
| | | break; |
| | | case HWC2: |
| | | map.put("mch_id", properties.getMchId2()); |
| | | map.put("op_user_id", properties.getMchId2()); |
| | | break; |
| | | default: |
| | | throw new BadRequestException("汇旺财类型错误"); |
| | |
| | | throw new BadRequestException("操作失败,原因:" + e); |
| | | } finally { |
| | | if (response != null) { |
| | | response.close(); |
| | | CloseUtil.close(response); |
| | | } |
| | | if (client != null) { |
| | | client.close(); |
| | | CloseUtil.close(client); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void alipayCallback(HttpServletRequest request, HttpServletResponse response) { |
| | | try { |
| | | String resString = XmlUtils.parseRequest(request); |
| | | String respString = "error"; |
| | | if (!resString.isEmpty()) { |
| | | Map<String, String> map = XmlUtils.toMap(resString.getBytes(), "utf-8"); |
| | | String sign_type = map.get("sign_type"); |
| | | String reSign = map.get("sign"); |
| | | if (map.containsKey("sign")) { |
| | | // OrderDto order = orderService.findByOrderNum(map.get("out_trade_no")); |
| | | PayTypeEnum status = PayTypeEnum.find("order.getPayType()"); |
| | | if (SignUtil.verifySign(reSign, sign_type, map, properties, status)) { |
| | | System.out.println("验证签名错误!:" + map); |
| | | } else { |
| | | if ("0".equals(map.get("status"))) { |
| | | if ("0".equals(map.get("result_code"))) { |
| | | //业务处理 |
| | | respString = "success"; |
| | | response.getWriter().write(respString); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | response.getWriter().write(respString); |
| | | } catch (Exception e) { |
| | | throw new BadRequestException("操作失败,原因:" + e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void returnNotify(HttpServletRequest request, HttpServletResponse response) { |
| | | try { |
| | | String resString = XmlUtils.parseRequest(request); |
| | | String respString = "error"; |
| | | if (!resString.isEmpty()) { |
| | | Map<String, String> map = XmlUtils.toMap(resString.getBytes(), "utf-8"); |
| | | String sign_type = map.get("sign_type"); |
| | | String reSign = map.get("sign"); |
| | | if (map.containsKey("sign")) { |
| | | // ReturnOrder returnOrder = returnOrderRepository.findByReturnNum(map.get("out_refund_no")); |
| | | PayTypeEnum status = PayTypeEnum.find("order.getPayType()"); |
| | | if (SignUtil.verifySign(reSign, sign_type, map, properties, status)) { |
| | | System.out.println("验证签名错误!:" + map); |
| | | } else { |
| | | if ("0".equals(map.get("status"))) { |
| | | if ("0".equals(map.get("result_code"))) { |
| | | // 业务处理 |
| | | respString = "success"; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | response.getWriter().write(respString); |
| | | } catch (Exception e) { |
| | | System.out.println("操作失败,原因:" + e.getMessage()); |
| | | } |
| | | } |
| | | } |
| | |
| | | throw new BadRequestException(e1.getMessage()); |
| | | } |
| | | } else { |
| | | if (status.equals(PayTypeEnum.HWC)) { |
| | | switch (status) { |
| | | case HWC: |
| | | return MD5.sign(preStr, "&key=" + properties.getKey(), "utf-8"); |
| | | case HWC2: |
| | | return MD5.sign(preStr, "&key=" + properties.getKey2(), "utf-8"); |
| | | } |
| | | throw new BadRequestException("汇旺财类型错误"); |
| | | } |
| | |
| | | String preStr = builder.toString(); |
| | | return !SignUtil.verifySign(preStr, sign, "RSA_1_256", properties.getPlatPublicKey()); |
| | | } else if ("MD5".equals(signType)) { |
| | | if (status.equals(PayTypeEnum.HWC)) { |
| | | switch (status) { |
| | | case HWC: |
| | | return !SignUtils.checkParam(resultMap, properties.getKey()); |
| | | case HWC2: |
| | | return !SignUtils.checkParam(resultMap, properties.getKey2()); |
| | | } |
| | | throw new BadRequestException("汇旺财类型错误"); |
| | | } |
| | |
| | | public class SwiftPassProperties { |
| | | // 交易密钥1 |
| | | private String key; |
| | | // 交易密钥2 |
| | | private String key2; |
| | | // 平台私钥 |
| | | private String mchPrivateKey; |
| | | // 平台公钥 |
| | | private String platPublicKey; |
| | | // 门店编号1 |
| | | private String mchId; |
| | | // 门店编号2 |
| | | private String mchId2; |
| | | // 签名方式 |
| | | private String signType; |
| | | // 原生JS |
| | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import cn.hutool.core.bean.copier.CopyOptions; |
| | | |
| | | import java.sql.Timestamp; |
| | | import java.math.BigDecimal; |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | import java.io.Serializable; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | |
| | | import lombok.Setter; |
| | | |
| | | /** |
| | | * @description / |
| | | * @author lixin |
| | | * @description / |
| | | * @date 2025-06-11 |
| | | **/ |
| | | @Getter |
| | |
| | | @ApiModelProperty(value = "订单号") |
| | | private String orderNum; |
| | | |
| | | @NotBlank |
| | | @ApiModelProperty(value = "支付类型") |
| | | private String payType; |
| | | |
| | | @NotNull |
| | | @ApiModelProperty(value = "用户") |
| | | private Long userId; |
| | |
| | | @ApiModelProperty(value = "订单号") |
| | | private String orderNum; |
| | | |
| | | @ApiModelProperty(value = "支付类型") |
| | | private String payType; |
| | | |
| | | @ApiModelProperty(value = "用户") |
| | | private Long userId; |
| | | |
| | |
| | | import com.oying.modules.sh.domain.Order; |
| | | import com.oying.modules.sh.domain.dto.OrderQueryCriteria; |
| | | import java.util.List; |
| | | |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | |
| | | IPage<Order> findAll(@Param("criteria") OrderQueryCriteria criteria, Page<Object> page); |
| | | |
| | | List<Order> findAll(@Param("criteria") OrderQueryCriteria criteria); |
| | | |
| | | Order getByOrderNum(String orderNum); |
| | | |
| | | void updatePayStatus(String orderNum, String payState, String payMessage, String payTime); |
| | | |
| | | void updateCloseStatus(String orderNum, String payState); |
| | | } |
| | |
| | | IPage<OrderReturn> findAll(@Param("criteria") OrderReturnQueryCriteria criteria, Page<Object> page); |
| | | |
| | | List<OrderReturn> findAll(@Param("criteria") OrderReturnQueryCriteria criteria); |
| | | |
| | | OrderReturn getByReturnNum(String returnNum); |
| | | |
| | | void updatePayStatus(String returnNum, String status, String time); |
| | | } |
| | |
| | | } |
| | | |
| | | @GetMapping("mini") |
| | | @ApiOperation("小程序:查询订单信息") |
| | | @ApiOperation("小程序:查询订单信息列") |
| | | public ResponseEntity<Object> miniQueryOrder(OrderQueryCriteria criteria) { |
| | | Page<Object> page = new Page<>(criteria.getPage(), criteria.getSize()); |
| | | criteria.setUserId(SecurityUtils.getCurrentUserId()); |
| | |
| | | orderService.deleteAll(ids); |
| | | return new ResponseEntity<>(R.success(), HttpStatus.OK); |
| | | } |
| | | |
| | | @Log("关闭订单") |
| | | @ApiOperation("关闭订单") |
| | | @PostMapping(value = "/closeOrder") |
| | | public ResponseEntity<Object> closeOrder(@RequestParam String orderNum) { |
| | | orderService.closeOrder(orderNum); |
| | | return new ResponseEntity<>(R.success(), HttpStatus.OK); |
| | | } |
| | | |
| | | @ApiOperation("订单号查询订单") |
| | | @GetMapping(value = "/getByOrderNum") |
| | | public ResponseEntity<Object> getByOrderNum(@RequestParam String orderNum) { |
| | | return new ResponseEntity<>(R.success(orderService.getByOrderNum(orderNum)), HttpStatus.OK); |
| | | } |
| | | } |
| | |
| | | * @throws IOException / |
| | | */ |
| | | void download(List<OrderReturn> all, HttpServletResponse response) throws IOException; |
| | | |
| | | OrderReturn getByReturnNum(String outRefundNo); |
| | | |
| | | void updatePayStatus(String outRefundNo, String status, String time); |
| | | } |
| | |
| | | import com.oying.modules.sh.domain.request.SubmitOrder; |
| | | import com.oying.modules.sh.domain.vo.OrderInfo; |
| | | import com.oying.utils.PageResult; |
| | | import com.oying.utils.enums.PayStateEnum; |
| | | |
| | | /** |
| | | * @author lixin |
| | |
| | | OrderInfo generatorOrder(GeneratorOrder generator); |
| | | |
| | | Order submitOrder(SubmitOrder submit, HttpServletRequest request); |
| | | |
| | | Order getByOrderNum(String orderNum); |
| | | |
| | | void paySuccess(Order order); |
| | | |
| | | void updatePayStatus(String outTradeNo, PayStateEnum stateEnum, String payInfo, String timeEnd); |
| | | |
| | | /** |
| | | * 创建 |
| | |
| | | * @throws IOException / |
| | | */ |
| | | void download(List<Order> all, HttpServletResponse response) throws IOException; |
| | | |
| | | void closeOrder(String orderNum); |
| | | } |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import com.oying.utils.PageUtil; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.io.IOException; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | | import java.util.LinkedHashMap; |
| | | |
| | | import com.oying.utils.PageResult; |
| | | |
| | | /** |
| | | * @description 服务实现 |
| | | * @author lixin |
| | | * @description 服务实现 |
| | | * @date 2025-06-11 |
| | | **/ |
| | | @Service |
| | |
| | | } |
| | | |
| | | @Override |
| | | public OrderReturn getByReturnNum(String returnNum) { |
| | | return orderReturnMapper.getByReturnNum(returnNum); |
| | | } |
| | | |
| | | @Override |
| | | public void updatePayStatus(String returnNum, String status, String time) { |
| | | orderReturnMapper.updatePayStatus(returnNum, status, time); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void create(OrderReturn resources) { |
| | | orderReturnMapper.insert(resources); |
| | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Order getByOrderNum(String orderNum) { |
| | | return orderMapper.getByOrderNum(orderNum); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void paySuccess(Order order) { |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void updatePayStatus(String orderNum, PayStateEnum payState, String payMessage, String payTime) { |
| | | orderMapper.updatePayStatus(orderNum, payState.getKey(), payMessage, payTime); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void closeOrder(String orderNum) { |
| | | Order order = getByOrderNum(orderNum); |
| | | if (order == null) { |
| | | throw new BadRequestException("订单不存在"); |
| | | } |
| | | PayTypeEnum anEnum = PayTypeEnum.find(order.getPayType()); |
| | | switch (anEnum) { |
| | | case HWC: |
| | | case HWC2: |
| | | JSONObject object = swiftPassService.query(orderNum, anEnum); |
| | | if (object.getString("trade_state").equals(PayStateEnum.SUCCESS.getKey())) { |
| | | throw new BadRequestException("订单已支付"); |
| | | } |
| | | if (object.getString("trade_state").equals(PayStateEnum.CLOSED.getKey())) { |
| | | throw new BadRequestException("订单已关闭"); |
| | | } |
| | | swiftPassService.closeOrder(orderNum, anEnum); |
| | | break; |
| | | } |
| | | orderMapper.updateCloseStatus(orderNum, PayStateEnum.CLOSED.getKey()); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void create(Order resources) { |
| | | orderMapper.insert(resources); |
| | | } |
| | |
| | | @ApiModelProperty(value = "ID", hidden = true) |
| | | private Long managerId; |
| | | |
| | | @TableId(value = "store_id") |
| | | @ApiModelProperty(value = "门店id") |
| | | private Long storeId; |
| | | |
| | | @TableId(value = "user_id") |
| | | @ApiModelProperty(value = "用户id") |
| | | private Long userId; |
| | | |
| | |
| | | swift-pass: |
| | | # 密钥 |
| | | key: vJB6683s4NtQtXBgHTvE1hWOUtcre7nj |
| | | # 密钥2 |
| | | key-2: s7Jf1eEM5QlxihWSxZh673pDhGY7p0s0 |
| | | # 私钥 |
| | | mch-private-key: MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC2YNuGqSAFcIVOc9mnmIbnVfQoyyMBoyGqTD3beiy/UsXZrGF4OIrPEevwXnwHktURupjHAKvt92PL4L9wTz7cknaQkF0NH5saOdY3sL88xH7F3qSgIwHPvkRileFeEHx+pKnXBms8yiliDqPk0MV3iRRoXKhRnojrWAYJhyz+1iJ13qWXCWcpr9hf77Uu/r1N7wsJKN4Z75M2qQC6LgRTaHoBroLGVtld4PM30ee6o9RR8yiFVx4FDVukinGR15nTsrNh+sUx3piVXqYrq23UPjUWVtJlf9cEvfNVXCMsa71LGEzUl0zxDfeyXRQhel3E27p2oovEYvhl5s+pZhtXAgMBAAECggEBAKXZLKinccwgh8lRBrQmuz7x5ieWms3pWDryPCozTy/pCKyq2rQlzu0BIiqi8W09tG773eTSEodDOkhzqANsvQB+XD2YWlYN0NEnmUtpem67TYGItvI9A2+0WaHBJIGSwnO0MBKu7qQIP1vBbn8s7vWF/b3tzM70ORSzJkJR37QY435+ZG9rKMKyL/tuGW7E5AgrHmyl2aK9me3vgUrZct2e9l5XLrn9oU1niEmbDbFARhphXDCEPIvFiu7WtFDBmp/jEOc4u/y/sYMjS1RWpO9iOyTZDO8Mi9iofXugmoot4Tn0lBckeR6YVRb/I3EcVADoMfk1iaN1aWv1u+Ska8ECgYEA3ZFYMvo5y7SztrEbyLpWGsp6aM4a5ght8p52/rFhS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nKa/YX++1Lv69Te8LCSjeGe+TNqkAui4EU2h6Aa6CxlbZXeDzN9HnuqPUUfMohVceBQ1bpIpxkdeZ07KzYfrFMd6YlV6mK6tt1D41FlbSZX/XBL3zVVwjLGu9SxhM1JdM8Q33sl0UIXpdxNu6dqKLxGL4ZebPqWYbVwIDAQAB |
| | | # 门店编号 |
| | | mch-id: 1030238092 |
| | | # 门店编号2 |
| | | mch-id-2: 1030238093 |
| | | # 签名方式 |
| | | sign-type: MD5 |
| | | # 原生JS |
| | |
| | | # 请求url |
| | | req-url: https://pay.hstypay.com/v2/pay/gateway |
| | | # 支付通知地址 |
| | | notify-url: http://1.95.124.88:8088/oying/api/swiftPass/alipayCallback |
| | | notify-url: http://1.95.124.88:8088/api/swiftPass/alipayCallback |
| | | # 退款通知地址 |
| | | refund-url: https://1.95.124.88:8088/oying/api/swiftPass/returnNotify |
| | | refund-url: https://1.95.124.88:8088/api/swiftPass/returnNotify |
| | | |
| | | obs: |
| | | access_key_id: RZ1UIOZDZ58DD4NWPD6Q |
| | |
| | | swift-pass: |
| | | # 密钥 |
| | | key: vJB6683s4NtQtXBgHTvE1hWOUtcre7nj |
| | | # 密钥2 |
| | | key-2: s7Jf1eEM5QlxihWSxZh673pDhGY7p0s0 |
| | | # 私钥 |
| | | mch-private-key: MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC2YNuGqSAFcIVOc9mnmIbnVfQoyyMBoyGqTD3beiy/UsXZrGF4OIrPEevwXnwHktURupjHAKvt92PL4L9wTz7cknaQkF0NH5saOdY3sL88xH7F3qSgIwHPvkRileFeEHx+pKnXBms8yiliDqPk0MV3iRRoXKhRnojrWAYJhyz+1iJ13qWXCWcpr9hf77Uu/r1N7wsJKN4Z75M2qQC6LgRTaHoBroLGVtld4PM30ee6o9RR8yiFVx4FDVukinGR15nTsrNh+sUx3piVXqYrq23UPjUWVtJlf9cEvfNVXCMsa71LGEzUl0zxDfeyXRQhel3E27p2oovEYvhl5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h8nUzFzTiW7ACyG2jAxGtu0dtqfwx2LkesUKGhD1JGlxdDQ6jSv9tbhAgbZjTAULSo03626ZaiSDF+nCwFsobd3wRiij8LiL9amW5t6XBeX6bS5SCh45GbgnNBtzBqUI19/CGH09YXNpCYnADsY4fab4wNpR |
| | | # 公钥 |
| | | plat-public-key: MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtmDbhqkgBXCFTnPZp5iG51X0KMsjAaMhqkw923osv1LF2axheDiKzxHr8F58B5LVEbqYxwCr7fdjy+C/cE8+3JJ2kJBdDR+bGjnWN7C/PMR+xd6koCMBz75EYpXhXhB8fqSp1wZrPMopYg6j5NDFd4kUaFyoUZ6I61gGCYcs/tYidd6llwlnKa/YX++1Lv69Te8LCSjeGe+TNqkAui4EU2h6Aa6CxlbZXeDzN9HnuqPUUfMohVceBQ1bpIpxkdeZ07KzYfrFMd6YlV6mK6tt1D41FlbSZX/XBL3zVVwjLGu9SxhM1JdM8Q33sl0UIXpdxNu6dqKLxGL4ZebPqWYbVwIDAQAB |
| | | # 门店编号 |
| | | mch-id: 1030238092 |
| | | # 门店编号2 |
| | | mch-id-2: 1030238093 |
| | | # 签名方式 |
| | | sign-type: MD5 |
| | | # 原生JS |
| | |
| | | # 请求url |
| | | req-url: https://pay.hstypay.com/v2/pay/gateway |
| | | # 支付通知地址 |
| | | notify-url: http://1.95.124.88:8088/oying/api/swiftPass/alipayCallback |
| | | notify-url: http://1.95.124.88:8088/api/swiftPass/alipayCallback |
| | | # 退款通知地址 |
| | | refund-url: https://1.95.124.88:8088/oying/api/swiftPass/returnNotify |
| | | refund-url: https://1.95.124.88:8088/api/swiftPass/returnNotify |
| | | |
| | | obs: |
| | | access_key_id: RZ1UIOZDZ58DD4NWPD6Q |
| | |
| | | order_id, order_num, order_status, order_status_describe, user_id, username, store_id, store_name, store_logo, order_describe, original_price, paid_price, actually_pay_price, pay_state, pay_message, pay_type, pay_time, expire_time, openid, app_id, timestamp, nonce_str, package_val, sign_type, pay_sign, create_by, create_time, update_by, update_time |
| | | </sql> |
| | | |
| | | <update id="updatePayStatus"> |
| | | update sh_order set pay_state = #{payState}, pay_message = #{payMessage}, |
| | | pay_time = #{payTime} where order_num = #{orderNum} |
| | | </update> |
| | | |
| | | <update id="updateCloseStatus"> |
| | | update sh_order set pay_state = #{payState} where order_num = #{orderNum} |
| | | </update> |
| | | |
| | | <select id="findAll" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List"/> |
| | |
| | | </where> |
| | | order by order_id desc |
| | | </select> |
| | | <select id="getByOrderNum" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List"/> |
| | | from sh_order |
| | | where order_num = #{orderNum} |
| | | </select> |
| | | </mapper> |
| | |
| | | <result column="return_status" property="returnStatus"/> |
| | | <result column="return_status_describe" property="returnStatusDescribe"/> |
| | | <result column="order_num" property="orderNum"/> |
| | | <result column="pay_type" property="payType"/> |
| | | <result column="user_id" property="userId"/> |
| | | <result column="username" property="username"/> |
| | | <result column="store_id" property="storeId"/> |
| | |
| | | </resultMap> |
| | | |
| | | <sql id="Base_Column_List"> |
| | | return_id, return_num, return_status, return_status_describe, order_num, user_id, username, store_id, store_name, store_logo, original_price, paid_price, actually_pay_price, refund_price, refund_status, success_time, channel, reason, remark, photos, audit_status, audit_user, audit_time, audit_message, create_by, create_time, update_by, update_time |
| | | return_id, return_num, return_status, return_status_describe, order_num, pay_type, user_id, username, store_id, store_name, store_logo, original_price, paid_price, actually_pay_price, refund_price, refund_status, success_time, channel, reason, remark, photos, audit_status, audit_user, audit_time, audit_message, create_by, create_time, update_by, update_time |
| | | </sql> |
| | | <update id="updatePayStatus"> |
| | | update sh_order_return set return_status = #{payState}, success_time = #{payTime} |
| | | where order_num = #{orderNum} |
| | | </update> |
| | | |
| | | <select id="findAll" resultMap="BaseResultMap"> |
| | | select |
| | |
| | | </if> |
| | | <if test="criteria.orderNum != null"> |
| | | and order_num like concat('%',#{criteria.orderNum},'%') |
| | | </if> |
| | | <if test="criteria.payType != null"> |
| | | and pay_type = #{criteria.payType} |
| | | </if> |
| | | <if test="criteria.userId != null"> |
| | | and user_id = #{criteria.userId} |
| | |
| | | </where> |
| | | order by return_id desc |
| | | </select> |
| | | <select id="getByReturnNum" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List"/> |
| | | from sh_order_return where return_num = #{returnNum} |
| | | </select> |
| | | </mapper> |
| | |
| | | </exclusions> |
| | | </dependency> |
| | | |
| | | <!-- Google Gson 依赖 --> |
| | | <dependency> |
| | | <groupId>com.google.code.gson</groupId> |
| | | <artifactId>gson</artifactId> |
| | | <version>2.10.1</version> <!-- 使用最新版本 --> |
| | | </dependency> |
| | | |
| | | <!--Spring boot 测试--> |
| | | <dependency> |
| | | <groupId>org.springframework.boot</groupId> |