diff --git a/hai-bweb/src/main/java/com/bweb/config/AuthConfig.java b/hai-bweb/src/main/java/com/bweb/config/AuthConfig.java index b359904b..97be7a1f 100644 --- a/hai-bweb/src/main/java/com/bweb/config/AuthConfig.java +++ b/hai-bweb/src/main/java/com/bweb/config/AuthConfig.java @@ -93,7 +93,6 @@ public class AuthConfig implements WebMvcConfigurer { .excludePathPatterns("/login/logout") .excludePathPatterns("/common/*") .excludePathPatterns("/sms/*") - .excludePathPatterns("/telApi/*") .excludePathPatterns("/coupon/getGuizhouSinopec") .excludePathPatterns("/cmsContent/get*") .excludePathPatterns("/highGoldRec/*") diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighOrderController.java b/hai-bweb/src/main/java/com/bweb/controller/HighOrderController.java index 2b01c359..e10805b2 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/HighOrderController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/HighOrderController.java @@ -1,6 +1,7 @@ package com.bweb.controller; import com.alibaba.excel.EasyExcel; +import com.alibaba.fastjson.JSONObject; import com.bweb.config.SysConst; import com.bweb.model.ExportHighOrderModel; import com.github.pagehelper.PageHelper; @@ -8,10 +9,17 @@ import com.github.pagehelper.PageInfo; import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; +import com.hai.common.pay.util.XmlUtil; +import com.hai.common.pay.util.sdk.WXPayConstants; import com.hai.common.security.SessionObject; import com.hai.common.security.UserCenter; import com.hai.common.utils.ResponseMsgUtil; +import com.hai.common.utils.WxUtils; +import com.hai.config.HuiLianTongUnionCardConfig; +import com.hai.entity.HighOrder; +import com.hai.entity.OutRechargeOrder; import com.hai.model.HighOrderModel; +import com.hai.model.OrderRefundModel; import com.hai.model.ResponseData; import com.hai.model.UserInfoModel; import com.hai.service.HighCouponCodeService; @@ -27,6 +35,8 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import java.io.File; +import java.math.BigDecimal; +import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -565,5 +575,47 @@ public class HighOrderController { } + @RequestMapping(value = "/orderToRefundHlt", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "汇联通订单退款") + public ResponseData orderToRefund(@RequestParam(name = "orderId", required = false) Long orderId, + HttpServletRequest request) { + try { + + HighOrder order = highOrderService.getOrderById(orderId); + if (order == null) { + log.error("orderToPay error!", "未找到充值订单"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到充值订单"); + } + + // 订单状态 : 1.待支付 2.已支付 3.已完成 4.已取消 5.已退款 +// if (order.getOrderStatus() != 2) { +// log.error("orderToPay error!", "无法退款,订单不处于已支付状态"); +// throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法退款,订单不处于已支付状态"); +// } + + + JSONObject jsonObject = HuiLianTongUnionCardConfig.refund( "HFR"+new Date().getTime() , order.getOrderNo()); + JSONObject dataObject = HuiLianTongUnionCardConfig.resolveResponse(jsonObject.getString("data")); + + if (dataObject.getBoolean("success")) { + order.setOrderStatus(4); + order.setRefundTime(new Date()); + order.setRefundContent(dataObject.getString("orderId")); + order.setRefusalRefundContent("HFR"+new Date().getTime() ); + order.setRefundPrice(order.getPayRealPrice()); + highOrderService.updateOrder(order); + return ResponseMsgUtil.success("退款成功"); + } else { + log.error("orderToPay error!", dataObject.getString("message")); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, dataObject.getString("message")); + } + + } catch (Exception e) { + log.error("HighOrderController --> getUserOrderList() error!", e); + return ResponseMsgUtil.exception(e); + } + } + } diff --git a/hai-bweb/src/main/java/com/bweb/controller/HighRefundAuditController.java b/hai-bweb/src/main/java/com/bweb/controller/HighRefundAuditController.java new file mode 100644 index 00000000..6c63e9a0 --- /dev/null +++ b/hai-bweb/src/main/java/com/bweb/controller/HighRefundAuditController.java @@ -0,0 +1,178 @@ +package com.bweb.controller; + +import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; +import com.hai.common.exception.ErrorCode; +import com.hai.common.exception.ErrorHelp; +import com.hai.common.exception.SysCode; +import com.hai.common.security.SessionObject; +import com.hai.common.security.UserCenter; +import com.hai.common.utils.ResponseMsgUtil; +import com.hai.entity.HighRefundAudit; +import com.hai.entity.OutRechargeOrder; +import com.hai.model.HighAgentModel; +import com.hai.model.ResponseData; +import com.hai.model.UserInfoModel; +import com.hai.service.HighRefundAuditService; +import com.hai.service.OutRechargeOrderService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +/** + * @Auther: 袁野 + * @Description: + * @Date: 2021/3/26 23:08 + */ +@Controller +@RequestMapping(value = "/highRefundAudit") +@Api(value = "退款审核接口") +public class HighRefundAuditController { + + private static Logger log = LoggerFactory.getLogger(HighMerchantStoreController.class); + + @Resource + private HighRefundAuditService highRefundAuditService; + + @Resource + private OutRechargeOrderService outRechargeOrderService; + + @Autowired + private UserCenter userCenter; + + + @RequestMapping(value = "/getOrderList", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "获取审核") + public ResponseData getOrderList( + @RequestParam(name = "status", required = false) Integer status, + @RequestParam(name = "orderNo", required = false) String orderNo, + @RequestParam(name = "payType", required = false) Integer payType, + @RequestParam(name = "payTimeS", required = false) Long payTimeS, + @RequestParam(name = "payTimeE", required = false) Long payTimeE, + @RequestParam(name = "pageNum", required = true) Integer pageNum, + @RequestParam(name = "pageSize", required = true) Integer pageSize, + HttpServletRequest request) { + try { + + Map map = new HashMap<>(); + + SessionObject sessionObject = userCenter.getSessionObject(request); + UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); + + if (userInfoModel.getBsCompany() == null) { + log.error("HighCouponController -> getCouponList() error!","权限不足"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMPETENCE_INSUFFICIENT, ""); + } + + map.put("companyId", String.valueOf(userInfoModel.getBsCompany().getId())); + + if (status != null) { + map.put("status", status.toString()); + } + if (StringUtils.isNotBlank(orderNo)) { + map.put("orderNo", orderNo); + } + + if (payType != null) { + map.put("payType" , payType.toString()); + } + + if (payTimeS != null) { + map.put("payTimeS", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(payTimeS)); + } + if (payTimeE != null) { + map.put("payTimeE", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(payTimeE)); + } + + + PageHelper.startPage(pageNum,pageSize); + return ResponseMsgUtil.success(new PageInfo<>(highRefundAuditService.getListRefundAudit(map))); + + } catch (Exception e) { + log.error("HighOrderController --> getUserOrderList() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value = "/insertRefundAudit", method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "新增退款审核") + public ResponseData insertRefundAudit(@RequestBody HighRefundAudit highRefundAudit, HttpServletRequest request) { + try { + //发布人员 + SessionObject sessionObject = userCenter.getSessionObject(request); + UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); + if (userInfoModel.getBsCompany() == null) { + log.error("HighAgentController -> insertAgent() error!","该主角色没有权限"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.MENU_TREE_HAS_NOT_ERROR, ""); + } + + if (StringUtils.isBlank(highRefundAudit.getSourceOrderNo()) || + highRefundAudit.getRefundSource() == null + ) { + log.error("HighAgentController -> insertAgent() error!","参数错误"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); + } + + highRefundAuditService.insertRefundAudit(highRefundAudit , userInfoModel); + + return ResponseMsgUtil.success("新增成功"); + + } catch (Exception e) { + log.error("HighAgentController --> insertAgent() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value = "/getRefundReject", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "拒绝退款") + public ResponseData getRefundReject(@RequestParam(name = "id", required = true) Integer id) { + try { + + HighRefundAudit highRefundAudit = highRefundAuditService.getRefundAuditById(id); + + OutRechargeOrder outRechargeOrder = outRechargeOrderService.findByOrderNo(highRefundAudit.getSourceOrderNo()); + + highRefundAudit.setStatus(2); + outRechargeOrder.setStatus(2); + + highRefundAuditService.updateRefundAudit(highRefundAudit); + outRechargeOrderService.updateOrder(outRechargeOrder); + + return ResponseMsgUtil.success(highRefundAuditService.getRefundAuditById(id)); + + } catch (Exception e) { + log.error("HighOrderController --> getOrderById() error!", e); + return ResponseMsgUtil.exception(e); + } + } + + @RequestMapping(value = "/getRefundAuditById", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "根据id查询详情") + public ResponseData getRefundAuditById(@RequestParam(name = "id", required = true) Integer id) { + try { + + return ResponseMsgUtil.success(highRefundAuditService.getRefundAuditById(id)); + + } catch (Exception e) { + log.error("HighOrderController --> getOrderById() error!", e); + return ResponseMsgUtil.exception(e); + } + } + +} diff --git a/hai-bweb/src/main/java/com/bweb/controller/OutRechargeOrderController.java b/hai-bweb/src/main/java/com/bweb/controller/OutRechargeOrderController.java index 932b1211..95431ccd 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/OutRechargeOrderController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/OutRechargeOrderController.java @@ -16,8 +16,10 @@ import com.hai.common.pay.util.sdk.WXPayConstants; import com.hai.common.utils.ResponseMsgUtil; import com.hai.common.utils.WxUtils; import com.hai.config.HuiLianTongUnionCardConfig; +import com.hai.entity.HighRefundAudit; import com.hai.entity.OutRechargeOrder; import com.hai.model.*; +import com.hai.service.HighRefundAuditService; import com.hai.service.OutRechargeOrderService; import com.hai.service.pay.impl.GoodsOrderServiceImpl; import io.swagger.annotations.Api; @@ -56,6 +58,9 @@ public class OutRechargeOrderController { @Resource private GoodsOrderServiceImpl goodsOrderService; + @Resource + private HighRefundAuditService highRefundAuditService; + @RequestMapping(value = "/getOrderById", method = RequestMethod.GET) @ResponseBody @@ -238,14 +243,17 @@ public class OutRechargeOrderController { try { OutRechargeOrder order = outRechargeOrderService.findByOrderId(orderId); + + HighRefundAudit highRefundAudit = highRefundAuditService.findByOrderNo(order.getOrderNo()); + if (order == null) { log.error("orderToPay error!", "未找到充值订单"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到充值订单"); } - // 订单状态 : 1.待支付 2.已支付 3.已完成 4.已取消 5.已退款 - if (order.getStatus() != 2) { - log.error("orderToPay error!", "无法退款,订单不处于已支付状态"); + // 订单状态 : 1.待支付 2.已支付 3.已完成 4.已取消 5.已退款 6:退款中 + if (order.getStatus() != 6) { + log.error("orderToPay error!", "无法退款,订单不处于退款中状态"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法退款,订单不处于已支付状态"); } @@ -259,6 +267,9 @@ public class OutRechargeOrderController { order.setOutRefundNo("HFR"+new Date().getTime() ); order.setRefundFee(order.getPayRealPrice()); order.setRefundId(dataObject.getString("orderId")); + + highRefundAudit.setStatus(1); + highRefundAuditService.updateRefundAudit(highRefundAudit); outRechargeOrderService.updateOrder(order); return ResponseMsgUtil.success("退款成功"); } else { @@ -281,7 +292,7 @@ public class OutRechargeOrderController { String signStr = WxUtils.generateSignature(param, "Skufk5oi85wDFGl888i6wsRSTkdd5df5" , WXPayConstants.SignType.HMACSHA256); param.put("sign", signStr); - String resultXmL = doRefundRequest(param.get("mch_id"), null, WxUtils.mapToXml(param)); + String resultXmL = doRefundRequest(param.get("mch_id"), WxUtils.mapToXml(param)); OrderRefundModel orderRefundModel = XmlUtil.getObjectFromXML(resultXmL, OrderRefundModel.class); if(orderRefundModel.getResult_code().equals("SUCCESS")) { order.setStatus(5); @@ -290,6 +301,8 @@ public class OutRechargeOrderController { order.setRefundId(orderRefundModel.getRefund_id()); order.setRefundFee(new BigDecimal(orderRefundModel.getRefund_fee()).divide(new BigDecimal("100"))); outRechargeOrderService.updateOrder(order); + highRefundAudit.setStatus(1); + highRefundAuditService.updateRefundAudit(highRefundAudit); return ResponseMsgUtil.success("退款成功"); } else { log.error("orderToPay error!", "退款失败"); @@ -303,7 +316,7 @@ public class OutRechargeOrderController { } } - public String doRefundRequest(String mchId, String url, String data) throws Exception { + public String doRefundRequest(String mchId,String data) throws Exception { //小程序退款需要调用双向证书的认证 CloseableHttpClient httpClient = goodsOrderService.readCertificate(mchId); diff --git a/hai-bweb/src/main/resources/pre/application.yml b/hai-bweb/src/main/resources/pre/application.yml index 4c2e5f66..f945f8c0 100644 --- a/hai-bweb/src/main/resources/pre/application.yml +++ b/hai-bweb/src/main/resources/pre/application.yml @@ -9,7 +9,7 @@ debug: false #datasource数据源设置 spring: datasource: - url: jdbc:mysql://139.159.177.244:3306/hsg_pre?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false + url: jdbc:mysql://122.9.135.148:3306/hsg?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false username: root password: HF123456. type: com.alibaba.druid.pool.DruidDataSource diff --git a/hai-cweb/src/main/java/com/cweb/config/AuthConfig.java b/hai-cweb/src/main/java/com/cweb/config/AuthConfig.java index 670959fe..a166949d 100644 --- a/hai-cweb/src/main/java/com/cweb/config/AuthConfig.java +++ b/hai-cweb/src/main/java/com/cweb/config/AuthConfig.java @@ -121,8 +121,6 @@ public class AuthConfig implements WebMvcConfigurer { .excludePathPatterns("/common/*") .excludePathPatterns("/order/qzOrderToPay") .excludePathPatterns("/czOrder/orderRefundNotify") - .excludePathPatterns("/tPig/*") - .excludePathPatterns("/telApi/*") .excludePathPatterns("/cmsContent/*") .excludePathPatterns("/sendSms/*") .excludePathPatterns("/test/*") diff --git a/hai-cweb/src/main/java/com/cweb/controller/HighUserCardController.java b/hai-cweb/src/main/java/com/cweb/controller/HighUserCardController.java index a982734b..f003a776 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/HighUserCardController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/HighUserCardController.java @@ -269,13 +269,13 @@ public class HighUserCardController { HttpServletRequest request) { try { // 用户 - SessionObject sessionObject = userCenter.getSessionObject(request); - HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject(); - - HighUserCard card = highUserCardService.getDetailByUserCardNo(userInfoModel.getHighUser().getId(), cardNo); - if (card == null) { - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到数据"); - } +// SessionObject sessionObject = userCenter.getSessionObject(request); +// HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject(); +// +// HighUserCard card = highUserCardService.getDetailByUserCardNo(userInfoModel.getHighUser().getId(), cardNo); +// if (card == null) { +// throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到数据"); +// } JSONObject consumptionRecord = HuiLianTongUnionCardConfig.queryConsumptionRecordByBusiness(businessType, cardNo, sdate, edate, pageNum, pageSize); if (StringUtils.isBlank(consumptionRecord.getString("data"))) { diff --git a/hai-cweb/src/main/java/com/cweb/controller/pay/OrderController.java b/hai-cweb/src/main/java/com/cweb/controller/pay/OrderController.java index 4eff972b..40d9f67e 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/pay/OrderController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/pay/OrderController.java @@ -421,10 +421,10 @@ public class OrderController { if (childOrder.getGiveawayType() == false && childOrder.getGoodsType() == 1) { HighCoupon coupon = highCouponService.getCouponById(childOrder.getGoodsId()); // 支付类型:1.微信支付 2.金币支付 - if (coupon.getPayType() != 1) { - log.error("OrderController --> orderToPay() ERROR", "只支持微信支持"); - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, coupon.getCouponName() + ",只支持微信支付"); - } +// if (coupon.getPayType() != 1) { +// log.error("OrderController --> orderToPay() ERROR", "只支持微信支持"); +// throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, coupon.getCouponName() + ",只支持微信支付"); +// } } if (childOrder.getGoodsType() == 3) { diff --git a/hai-service/src/main/java/com/hai/service/HighRefundAuditService.java b/hai-service/src/main/java/com/hai/service/HighRefundAuditService.java new file mode 100644 index 00000000..7ae2e2e5 --- /dev/null +++ b/hai-service/src/main/java/com/hai/service/HighRefundAuditService.java @@ -0,0 +1,58 @@ +package com.hai.service; + +import com.hai.entity.HighRefundAudit; +import com.hai.entity.OutRechargeOrder; +import com.hai.model.UserInfoModel; + +import java.util.List; +import java.util.Map; + +public interface HighRefundAuditService { + + /** + * @Author Sum1Dream + * @Description // 查询充值订单 + * @Date 15:18 2021/6/11 + * @Param [map] + * @return java.util.List + **/ + List getListRefundAudit(Map map); + + + /** + * @Author Sum1Dream + * @Description // 根据订单ID查询订单 + * @Date 15:19 2021/6/11 + * @Param [orderId] + * @return com.hai.entity.HighRefundAudit + **/ + HighRefundAudit getRefundAuditById(Integer id); + + /** + * @Author Sum1Dream + * @Description // 根据订单号查询订单 + * @Date 15:20 2021/6/11 + * @Param [orderNo] + * @return com.hai.entity.OutRechargeOrder + **/ + HighRefundAudit findByOrderNo(String orderNo); + + /*** + * @Author Sum1Dream + * @Description // 新增 + * @Date 15:25 2021/6/11 + * @Param [HighRefundAudit] + * @return void + **/ + void insertRefundAudit(HighRefundAudit highRefundAudit , UserInfoModel userInfoModel); + + /*** + * @Author Sum1Dream + * @Description // 修改 + * @Date 15:26 2021/6/11 + * @Param [HighRefundAudit] + * @return void + **/ + void updateRefundAudit(HighRefundAudit highRefundAudit); + +} diff --git a/hai-service/src/main/java/com/hai/service/impl/HighRefundAuditServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighRefundAuditServiceImpl.java new file mode 100644 index 00000000..f6444767 --- /dev/null +++ b/hai-service/src/main/java/com/hai/service/impl/HighRefundAuditServiceImpl.java @@ -0,0 +1,110 @@ +package com.hai.service.impl; + +import com.hai.common.utils.DateUtil; +import com.hai.dao.HighRefundAuditMapper; +import com.hai.entity.HighRefundAudit; +import com.hai.entity.HighRefundAuditExample; +import com.hai.entity.OutRechargeOrder; +import com.hai.entity.OutRechargeOrderExample; +import com.hai.model.UserInfoModel; +import com.hai.service.HighRefundAuditService; +import com.hai.service.OutRechargeOrderService; +import io.swagger.models.auth.In; +import org.apache.commons.collections4.MapUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.util.Date; +import java.util.List; +import java.util.Map; + +@Service("highRefundAuditService") +public class HighRefundAuditServiceImpl implements HighRefundAuditService { + + + @Resource + private HighRefundAuditMapper highRefundAuditMapper; + + @Resource + private OutRechargeOrderService outRechargeOrderService; + + @Override + public List getListRefundAudit(Map map) { + + HighRefundAuditExample example = new HighRefundAuditExample(); + HighRefundAuditExample.Criteria criteria = example.createCriteria(); + + if (MapUtils.getInteger(map, "status") != null) { + criteria.andStatusEqualTo(MapUtils.getInteger(map, "status")); + } + if (MapUtils.getInteger(map, "payType") != null) { + criteria.andPayTypeEqualTo(MapUtils.getInteger(map, "payType")); + } + + if (MapUtils.getInteger(map, "companyId") != null) { + criteria.andCompanIdEqualTo(MapUtils.getInteger(map, "companyId")); + } + + if (MapUtils.getString(map, "orderNo") != null) { + criteria.andSourceOrderNoLike("%" + MapUtils.getString(map, "orderNo") + "%"); + } + + if (StringUtils.isNotBlank(map.get("payTimeS")) && StringUtils.isNotBlank(map.get("payTimeE"))) { + criteria.andPayTimeBetween( + DateUtil.format(map.get("payTimeS") , "yyyy-MM-dd HH:mm:ss") , + DateUtil.format(map.get("payTimeE") , "yyyy-MM-dd HH:mm:ss")); + } + + if (StringUtils.isNotBlank(map.get("createTimeS")) && StringUtils.isNotBlank(map.get("createTimeE"))) { + criteria.andCreatedTimeBetween( + DateUtil.format(map.get("createTimeS") , "yyyy-MM-dd HH:mm:ss") , + DateUtil.format(map.get("createTimeE") , "yyyy-MM-dd HH:mm:ss")); + } + + return highRefundAuditMapper.selectByExample(example); + } + + @Override + public HighRefundAudit getRefundAuditById(Integer id) { + return highRefundAuditMapper.selectByPrimaryKey(id); + } + + @Override + public HighRefundAudit findByOrderNo(String orderNo) { + HighRefundAuditExample example = new HighRefundAuditExample(); + example.createCriteria().andSourceOrderNoEqualTo(orderNo); + return highRefundAuditMapper.selectByExample(example).get(0); + } + + @Override + @Transactional(propagation= Propagation.REQUIRES_NEW) + public void insertRefundAudit(HighRefundAudit highRefundAudit , UserInfoModel userInfoModel) { + + OutRechargeOrder outRechargeOrder = outRechargeOrderService.findByOrderNo(highRefundAudit.getSourceOrderNo()); + + highRefundAudit.setCompanId(userInfoModel.getBsCompany().getId().intValue()); + highRefundAudit.setStatus(0); + highRefundAudit.setRefundPrice(outRechargeOrder.getPayPrice()); + highRefundAudit.setCreatedTime(new Date()); + highRefundAudit.setCreatedUserId(userInfoModel.getSecUser().getId().intValue()); + highRefundAudit.setCreatedUserName(userInfoModel.getSecUser().getUserName()); + highRefundAudit.setPayType(outRechargeOrder.getPayType()); + highRefundAudit.setPayTime(outRechargeOrder.getPayTime()); + highRefundAudit.setExt1(String.valueOf(outRechargeOrder.getId())); + + outRechargeOrder.setStatus(6); + outRechargeOrderService.updateOrder(outRechargeOrder); + + highRefundAuditMapper.insert(highRefundAudit); + } + + @Override + public void updateRefundAudit(HighRefundAudit highRefundAudit) { + highRefundAuditMapper.updateByPrimaryKey(highRefundAudit); + } + + +}