提交修改

dev-discount
袁野 3 years ago
parent 8f1b5892c7
commit 51b41946e5
  1. 50
      hai-bweb/src/main/java/com/bweb/controller/OutRechargeOrderController.java
  2. 65
      hai-cweb/src/main/java/com/cweb/config/WxMsgConfig.java
  3. 2
      hai-cweb/src/main/java/com/cweb/controller/HighTestController.java
  4. 3
      hai-cweb/src/main/java/com/cweb/controller/OutRechargeOrderController.java
  5. 216
      hai-cweb/src/main/java/com/cweb/controller/TelApiController.java
  6. 93
      hai-cweb/src/main/java/com/cweb/controller/pay/CzOrderController.java
  7. 32
      hai-service/src/main/java/com/hai/common/utils/TelApiUtil.java
  8. 44
      hai-service/src/main/java/com/hai/enum_type/RechargePayType.java
  9. 68
      hai-service/src/main/java/com/hai/service/OutRechargeOrderRecordService.java
  10. 60
      hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderRecordServiceImpl.java

@ -17,6 +17,8 @@ import com.hai.common.exception.SysCode;
import com.hai.common.pay.util.XmlUtil; import com.hai.common.pay.util.XmlUtil;
import com.hai.common.pay.util.sdk.WXPayConstants; import com.hai.common.pay.util.sdk.WXPayConstants;
import com.hai.common.security.SessionObject; import com.hai.common.security.SessionObject;
import com.hai.common.utils.DateUtil;
import com.hai.common.utils.IDGenerator;
import com.hai.common.utils.ResponseMsgUtil; import com.hai.common.utils.ResponseMsgUtil;
import com.hai.common.utils.WxUtils; import com.hai.common.utils.WxUtils;
import com.hai.config.HuiLianTongUnionCardConfig; import com.hai.config.HuiLianTongUnionCardConfig;
@ -26,6 +28,7 @@ import com.hai.entity.HighRefundAudit;
import com.hai.entity.OutRechargeOrder; import com.hai.entity.OutRechargeOrder;
import com.hai.model.*; import com.hai.model.*;
import com.hai.service.HighRefundAuditService; import com.hai.service.HighRefundAuditService;
import com.hai.service.HighUserService;
import com.hai.service.OutRechargeOrderService; import com.hai.service.OutRechargeOrderService;
import com.hai.service.pay.impl.GoodsOrderServiceImpl; import com.hai.service.pay.impl.GoodsOrderServiceImpl;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
@ -64,6 +67,9 @@ public class OutRechargeOrderController {
@Resource @Resource
private HighRefundAuditService highRefundAuditService; private HighRefundAuditService highRefundAuditService;
@Resource
private HighUserService highUserService;
@RequestMapping(value = "/getOrderById", method = RequestMethod.GET) @RequestMapping(value = "/getOrderById", method = RequestMethod.GET)
@ResponseBody @ResponseBody
@ -356,6 +362,17 @@ public class OutRechargeOrderController {
} }
} }
// 积分退款
if (order.getPayType() == 3) {
highUserService.goldHandle(order.getUserId(), order.getPayRealPrice().multiply(BigDecimal.valueOf(100)).intValue(), 1, 3, order.getId());
order.setStatus(5);
order.setRefundTime(new Date());
order.setOutRefundNo("HFR"+new Date().getTime() );
order.setRefundFee(order.getPayRealPrice());
highRefundAudit.setStatus(1);
highRefundAuditService.updateRefundAudit(highRefundAudit);
outRechargeOrderService.updateOrder(order);
}
// 银联退款 // 银联退款
if (order.getPayType() == 4) { if (order.getPayType() == 4) {
// 订单退款 // 订单退款
@ -550,4 +567,37 @@ public class OutRechargeOrderController {
} }
} }
@RequestMapping(value = "/getMobileRechargeByOrderId", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "话费再次充值充值")
public ResponseData getMobileRechargeByOrderId(
@RequestParam(name = "orderId", required = true) Long orderId) {
try {
OutRechargeOrder outRechargeOrder = outRechargeOrderService.findByOrderId(orderId);
String orderNo = "CZ" + DateUtil.date2String(new Date(),"yyyyMMddHHmmss") + IDGenerator.nextId(5);
JSONObject object = outRechargeOrderService.getMobile(outRechargeOrder.getRechargeContent(),outRechargeOrder.getOrderPrice().intValue(),orderNo);
if (object.getInteger("code") != 200) {
log.error("getMobileRechargeByOrderId error!", "充值失败");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, object.getString("message"));
}
outRechargeOrder.setRechargeStatus(2);
outRechargeOrder.setOrderNo(orderNo);
outRechargeOrderService.updateOrder(outRechargeOrder);
return ResponseMsgUtil.success("请求成功");
} catch (Exception e) {
log.error("HighUserCardController --> getHuiLianTongCardInfo() error!", e);
return ResponseMsgUtil.exception(e);
}
}
} }

@ -49,7 +49,72 @@ public class WxMsgConfig {
} }
public static void rechargedSuccess(String orderName , String price , String orderNo , Date payTime , String payType , String openId) {
try {
List<WxMaSubscribeMessage.Data> list = new ArrayList<>();
Map<String, String> m = new HashMap<>();
m.put("character_string1", orderNo); // 订单号
m.put("thing11", orderName); // 充值项目
m.put("thing10", payType); // 支付方式
m.put("amount8", price); // 支付金额
m.put("date5", DateUtil.date2String(payTime , "yyyy年MM月dd日 HH:mm:ss"));
for (String key: m.keySet()) {
WxMaSubscribeMessage.Data msgElement = new WxMaSubscribeMessage.Data();
msgElement.setName(key);
msgElement.setValue(m.get(key));
list.add(msgElement);
}
WxMaSubscribeMessage subscribeMessage = new WxMaSubscribeMessage();
subscribeMessage.setToUser(openId); // 小程序openId
subscribeMessage.setTemplateId("ZO6kC3oJv0zj9QzL0htsF-mM9vAElcgPZEcUGglxsoU");
subscribeMessage.setData(list);
final WxMaService wxService = WxMaConfiguration.getMaService();
WxMaMsgService maMsgService = wxService.getMsgService();
maMsgService.sendSubscribeMsg(subscribeMessage);
} catch (Exception e) {
log.error(String.valueOf(e));
}
}
public static void rechargedFail(String orderName , String price , String openId) {
try {
List<WxMaSubscribeMessage.Data> list = new ArrayList<>();
Map<String, String> m = new HashMap<>();
m.put("thing1", orderName); // 订单内容
m.put("thing2", "充值通道爆满!"); // 失败原因
m.put("amount3", price); // 退款金额
m.put("thing4", "退款将在1-3日内原路退回"); // 温馨提示
for (String key: m.keySet()) {
WxMaSubscribeMessage.Data msgElement = new WxMaSubscribeMessage.Data();
msgElement.setName(key);
msgElement.setValue(m.get(key));
list.add(msgElement);
}
WxMaSubscribeMessage subscribeMessage = new WxMaSubscribeMessage();
subscribeMessage.setToUser(openId); // 小程序openId
subscribeMessage.setTemplateId("xjacmzuWSRdiKGz4IJVeuvyGE0vOhoy0JVQPgOr-PuI");
subscribeMessage.setData(list);
final WxMaService wxService = WxMaConfiguration.getMaService();
WxMaMsgService maMsgService = wxService.getMsgService();
maMsgService.sendSubscribeMsg(subscribeMessage);
} catch (Exception e) {
log.error(String.valueOf(e));
}
}
} }

File diff suppressed because one or more lines are too long

@ -493,6 +493,9 @@ public class OutRechargeOrderController {
} }
} }
@RequestMapping(value="/orderToUnionPay",method = RequestMethod.POST) @RequestMapping(value="/orderToUnionPay",method = RequestMethod.POST)
@ResponseBody @ResponseBody
@ApiOperation(value = "订单支付发起银联支付") @ApiOperation(value = "订单支付发起银联支付")

@ -1,216 +0,0 @@
package com.cweb.controller;
import com.alibaba.fastjson.JSONObject;
import com.cweb.config.WxMsgConfig;
import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
import com.hai.common.pay.util.IOUtil;
import com.hai.common.pay.util.XmlUtil;
import com.hai.common.utils.*;
import com.hai.config.TelConfig;
import com.hai.entity.HighChildOrder;
import com.hai.entity.HighOrder;
import com.hai.entity.HighTelOrder;
import com.hai.entity.HighUser;
import com.hai.enum_type.GoodsType;
import com.hai.enum_type.PayType;
import com.hai.model.ResponseData;
import com.hai.service.HighOrderService;
import com.hai.service.HighUserService;
import com.hai.service.TelApiService;
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.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.math.BigDecimal;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.SortedMap;
import java.util.regex.Pattern;
@RestController
@RequestMapping(value = "/telApi")
@Api(value = "电话费充值数据接口")
public class TelApiController {
private static Logger log = LoggerFactory.getLogger(TelApiController.class);
@Resource
private TelApiService telApiService;
@Resource
private HighOrderService highOrderService;
@Resource
private HighUserService highUserService;
/**
* 中国电信号码格式验证 手机段 133,153,180,181,189,177,1700,173,199
**/
private static final String CHINA_TELECOM_PATTERN = "(^1(33|53|77|73|99|8[019])\\d{8}$)|(^1700\\d{7}$)";
/**
* 中国联通号码格式验证 手机段130,131,132,155,156,185,186,145,176,1709
**/
private static final String CHINA_UNICOM_PATTERN = "(^1(3[0-2]|4[5]|5[56]|7[6]|8[56])\\d{8}$)|(^1709\\d{7}$)";
/**
* 中国移动号码格式验证
* 手机段134,135,136,137,138,139,150,151,152,157,158,159,182,183,184,187,188,147,178,1705
**/
private static final String CHINA_MOBILE_PATTERN = "(^1(3[4-9]|4[7]|5[0-27-9]|7[8]|8[2-478])\\d{8}$)|(^1705\\d{7}$)";
@RequestMapping(value = "/telPay", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "充值话费")
public ResponseData certification(@RequestBody HighTelOrder highTelOrder) {
try {
if (StringUtils.isBlank(highTelOrder.getTel()) ||
highTelOrder.getPrice() == null
) {
log.error("telApi -> telPay() error!", "参数错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
int random = (int) (1 + Math.random() * (999999 - 100000 + 1));
Map<String, Object> map = new HashMap<>();
String mchid = "HFb44f8_10004";
String tel = highTelOrder.getTel();
String orderid = "HF" + DateUtil.date2String(new Date(), "yyyyMMddHHmmss") + IDGenerator.nextId(5);
BigDecimal price = BigDecimal.valueOf(highTelOrder.getPrice());
String teltype = isChinaMobilePhoneNum(highTelOrder.getTel()).toString();
int timeout = 300;
String notify = "notify";
String time = String.valueOf(new Date().getTime());
String APIKEY = "483e5a68fe9bda2f7ab3f2665a0006cd";
String sign = mchid + tel + price + orderid + teltype + notify + time + random + APIKEY;
String param = "mchid=" + mchid +
"&tel=" + tel +
"&orderid=" + orderid +
"&price=" + price +
"&teltype=" + teltype +
"&notify=" + notify +
"&time=" + time +
"&rand=" + random +
"&sign=" + MD5Util.encode(sign.getBytes());
map.put("from", param);
JSONObject object = HttpsUtils.doSmsPost("http://45.130.154.125:9998/api/telpay", map, new HashMap<>());
return ResponseMsgUtil.success(object);
} catch (Exception e) {
log.error("HighMerchantController -> insertMerchant() error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/notify", method = RequestMethod.POST)
@ApiOperation(value = "话费充值 -> 异步回调")
public void wechatNotify(HttpServletRequest request, HttpServletResponse response) {
try {
log.info("话费充值 -> 异步通知:处理开始");
String notifyXml = null; // 话费充值系统发送的数据(<![CDATA[product_001]]>格式)
notifyXml = IOUtil.inputStreamToString(request.getInputStream(), "UTF-8");
log.info("话费充值系统发送的数据:" + notifyXml);
SortedMap<String, String> map = XmlUtil.parseXmlToTreeMap(notifyXml, "UTF-8");
// resXml = notifyService.wechatNotify(map);
//
//
// BufferedOutputStream out = new BufferedOutputStream(response.getOutputStream());
// out.write(resXml.getBytes());
// out.flush();
// out.close();
log.info("话费充值 -> 异步通知:处理完成");
} catch (Exception e) {
log.error("WechatPayController --> wechatNotify() error!", e);
}
}
/**
* 查询电话属于哪个运营商
*
* @param tel 手机号码
* @return 0不属于任何一个运营商0:移动1联通2电信 99: 什么都不是
*/
public Integer isChinaMobilePhoneNum(String tel) {
boolean b1 = tel != null && !tel.trim().equals("") && match(CHINA_MOBILE_PATTERN, tel);
if (b1) {
return 0;
}
b1 = tel != null && !tel.trim().equals("") && match(CHINA_UNICOM_PATTERN, tel);
if (b1) {
return 1;
}
b1 = tel != null && !tel.trim().equals("") && match(CHINA_TELECOM_PATTERN, tel);
if (b1) {
return 2;
}
return 99;
}
/**
* 匹配函数
*
* @param regex
* @param tel
* @return
*/
private static boolean match(String regex, String tel) {
return Pattern.matches(regex, tel);
}
@RequestMapping(value = "/getMemberGoods", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "获取渠道商获取关联商品")
public ResponseData getMemberGoods() {
try {
JSONObject data = TelConfig.getMemberGoods();
return ResponseMsgUtil.success(data);
} catch (Exception e) {
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value = "/getTest", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "测试接口")
public ResponseData getTest() {
try {
HighOrder order = highOrderService.getOrderById(699L);
HighUser highUser = highUserService.findByUserId(order.getMemId());
HighChildOrder presentation = highOrderService.getChildOrderByPresentation(order.getId());
WxMsgConfig.pushOneUser(
presentation.getGoodsName() + "(" + GoodsType.getNameByType(presentation.getGoodsType()) + ")",
String.valueOf(order.getPayPrice()),
order.getOrderNo(),
order.getPayTime(),
PayType.getNameByType(order.getPayType()), order.getId(),
highUser.getOpenId());
return ResponseMsgUtil.success("1");
} catch (Exception e) {
return ResponseMsgUtil.exception(e);
}
}
}

@ -1,12 +1,15 @@
package com.cweb.controller.pay; package com.cweb.controller.pay;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.cweb.config.WxMsgConfig;
import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode; import com.hai.common.exception.SysCode;
import com.hai.common.pay.util.XmlUtil; import com.hai.common.pay.util.XmlUtil;
import com.hai.common.pay.util.sdk.WXPayConstants; import com.hai.common.pay.util.sdk.WXPayConstants;
import com.hai.common.security.AESEncodeUtil; import com.hai.common.security.AESEncodeUtil;
import com.hai.common.utils.DateUtil;
import com.hai.common.utils.IDGenerator;
import com.hai.common.utils.ResponseMsgUtil; import com.hai.common.utils.ResponseMsgUtil;
import com.hai.common.utils.WxUtils; import com.hai.common.utils.WxUtils;
import com.hai.config.CommonSysConst; import com.hai.config.CommonSysConst;
@ -14,14 +17,15 @@ import com.hai.config.HuiLianTongUnionCardConfig;
import com.hai.config.UnionPayConfig; import com.hai.config.UnionPayConfig;
import com.hai.config.WxOrderConfig; import com.hai.config.WxOrderConfig;
import com.hai.dao.HighGasOrderRefundMapper; import com.hai.dao.HighGasOrderRefundMapper;
import com.hai.entity.HighGasOrderRefund; import com.hai.entity.*;
import com.hai.entity.HighOrder; import com.hai.enum_type.GoodsType;
import com.hai.entity.HighRefundAudit; import com.hai.enum_type.PayType;
import com.hai.entity.OutRechargeOrder; import com.hai.enum_type.RechargePayType;
import com.hai.model.OrderRefundModel; import com.hai.model.OrderRefundModel;
import com.hai.model.ResponseData; import com.hai.model.ResponseData;
import com.hai.service.HighRefundAuditService; import com.hai.service.HighRefundAuditService;
import com.hai.service.HighUserService; import com.hai.service.HighUserService;
import com.hai.service.OutRechargeOrderRecordService;
import com.hai.service.OutRechargeOrderService; import com.hai.service.OutRechargeOrderService;
import com.hai.service.pay.impl.GoodsOrderServiceImpl; import com.hai.service.pay.impl.GoodsOrderServiceImpl;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
@ -66,6 +70,9 @@ public class CzOrderController {
@Resource @Resource
private HighUserService highUserService; private HighUserService highUserService;
@Resource
private OutRechargeOrderRecordService rechargeOrderRecordService;
@RequestMapping(value = "/rechargeCallback", method = RequestMethod.POST) @RequestMapping(value = "/rechargeCallback", method = RequestMethod.POST)
@ApiOperation(value = "话费充值回调") @ApiOperation(value = "话费充值回调")
@ResponseBody @ResponseBody
@ -78,21 +85,67 @@ public class CzOrderController {
HighGasOrderRefund highGasOrderRefund = new HighGasOrderRefund(); HighGasOrderRefund highGasOrderRefund = new HighGasOrderRefund();
highGasOrderRefund.setCreateTime(new Date()); highGasOrderRefund.setCreateTime(new Date());
highGasOrderRefund.setReturnContent(String.valueOf(dataObject)); highGasOrderRefund.setReturnContent(String.valueOf(dataObject));
highGasOrderRefundMapper.insert(highGasOrderRefund);
// 查询订单 if (dataObject.getInteger("status") == 3) {
OutRechargeOrder order = outRechargeOrderService.findByOrderNo(dataObject.getString("out_order_id")); OutRechargeOrder order;
OutRechargeOrderRecord rechargeOrderRecord = rechargeOrderRecordService.findByOrderNo(dataObject.getString("out_order_id"));
// 订单状态 : 订单状态 : 1.待支付 2.已支付 3.已完成 4.已取消 5.已退款 6:退款中 if (rechargeOrderRecord == null) {
if (order != null && order.getStatus() == 2) { // 查询订单
// 退单结果 true:成功 false:失败 order = outRechargeOrderService.findByOrderNo(dataObject.getString("out_order_id"));
if (dataObject.getInteger("status") == 3) {
order.setStatus(3); order.setStatus(3);
order.setFinishTime(new Date());
outRechargeOrderService.updateOrder(order);
} else {
// 查询订单
order = outRechargeOrderService.findByOrderId(rechargeOrderRecord.getRechargeOrderId());
order.setStatus(3);
order.setFinishTime(new Date());
outRechargeOrderService.updateOrder(order); outRechargeOrderService.updateOrder(order);
} else if (dataObject.getInteger("status") == 4) {
orderToRefund(order.getId());
} }
new Thread(() -> {
HighUser highUser = highUserService.findByUserId(order.getUserId());
WxMsgConfig.rechargedSuccess(
order.getRechargeName() + "充值成功",
String.valueOf(order.getPayRealPrice()),
order.getOrderNo(),
order.getFinishTime(),
RechargePayType.getNameByType(order.getPayType()),
highUser.getOpenId());
}).start();
} else {
OutRechargeOrderRecord rechargeOrderRecord = rechargeOrderRecordService.findByOrderNo(dataObject.getString("out_order_id"));
if (rechargeOrderRecord == null) {
rechargeOrderRecord = new OutRechargeOrderRecord();
// 查询订单
OutRechargeOrder order = outRechargeOrderService.findByOrderNo(dataObject.getString("out_order_id"));
if (order.getRechargeType() != null && order.getRechargeType() == 1) {
String orderNo = "CZ" + DateUtil.date2String(new Date(),"yyyyMMddHHmmss") + IDGenerator.nextId(5);
JSONObject object = outRechargeOrderService.getMobile(order.getRechargeContent() , order.getOrderPrice().intValue() , orderNo);
if (object.getInteger("code") != 200) {
order.setRechargeStatus(1);
order.setAbnormalMsg(object.getString("message"));
}
outRechargeOrderService.updateOrder(order);
rechargeOrderRecord.setRechargeOrderId(order.getId());
rechargeOrderRecord.setRechargeOrderNo(orderNo);
rechargeOrderRecord.setCreateTime(new Date());
rechargeOrderRecord.setStatus(1);
rechargeOrderRecordService.insertOrder(rechargeOrderRecord);
}
} else {
// 查询订单
OutRechargeOrder order = outRechargeOrderService.findByOrderId(rechargeOrderRecord.getRechargeOrderId());
if (order.getStatus() == 2) {
orderToRefund(order.getId());
order.setStatus(5);
outRechargeOrderService.updateOrder(order);
}
}
} }
response.setCharacterEncoding("UTF-8"); response.setCharacterEncoding("UTF-8");
response.setContentType("text/html;charset=utf-8"); response.setContentType("text/html;charset=utf-8");
PrintWriter writer= response.getWriter(); PrintWriter writer= response.getWriter();
@ -173,8 +226,9 @@ public class CzOrderController {
} }
} }
// 积分退款
if (order.getPayType() == 3) { if (order.getPayType() == 3) {
highUserService.goldHandle(order.getUserId(), order.getPayRealPrice().intValue() * 100, 1, 3, order.getId()); highUserService.goldHandle(order.getUserId(), order.getPayRealPrice().multiply(BigDecimal.valueOf(100)).intValue(), 1, 3, order.getId());
} }
// 银联退款 // 银联退款
@ -191,6 +245,15 @@ public class CzOrderController {
order.setRefundFee(order.getPayRealPrice()); order.setRefundFee(order.getPayRealPrice());
outRechargeOrderService.updateOrder(order); outRechargeOrderService.updateOrder(order);
} }
new Thread(() -> {
HighUser highUser = highUserService.findByUserId(order.getUserId());
WxMsgConfig.rechargedFail(
"订单号:" + order.getOrderNo() + "-" + order.getRechargeName(),
String.valueOf(order.getPayRealPrice()),
highUser.getOpenId());
}).start();
return true; return true;
} catch (Exception e) { } catch (Exception e) {
log.error("HighOrderController --> getUserOrderList() error!", e); log.error("HighOrderController --> getUserOrderList() error!", e);

@ -0,0 +1,32 @@
package com.hai.common.utils;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
public class TelApiUtil {
/**
* 大陆手机号码11位数匹配格式前三位固定格式+后8位任意数
* 此方法中前三位格式有
* 13+任意数
* 145,147,149
* 15+除4的任意数(不要写^4这样的话字母也会被认为是正确的)
* 166
* 17+3,5,6,7,8
* 18+任意数
* 198,199
*/
public static boolean isChinaPhoneLegal(String str) throws PatternSyntaxException {
// ^ 匹配输入字符串开始的位置
// \d 匹配一个或多个数字,其中 \ 要转义,所以是 \\d
// $ 匹配输入字符串结尾的位置
String regExp = "^((13[0-9])|(14[5,7,9])|(15[0-3,5-9])|(166)|(17[3,5,6,7,8])" +
"|(18[0-9])|(19[8,9]))\\d{8}$";
Pattern p = Pattern.compile(regExp);
Matcher m = p.matcher(str);
return m.matches();
}
}

@ -0,0 +1,44 @@
package com.hai.enum_type;
import java.util.Objects;
public enum RechargePayType {
payType1(1 , "微信"),
payType2(2 , "工会卡"),
payType3(3 , "积分"),
payType4(4 , "银联")
;
private Integer type;
private String name;
RechargePayType(int type , String name) {
this.type = type;
this.name = name;
}
public static String getNameByType(Integer type) {
for (RechargePayType ele : values()) {
if(Objects.equals(type,ele.getType())) return ele.getName();
}
return null;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}

@ -0,0 +1,68 @@
package com.hai.service;
import com.hai.entity.OutRechargeOrder;
import com.hai.entity.OutRechargeOrderRecord;
import java.util.List;
public interface OutRechargeOrderRecordService {
/**
* @Author Sum1Dream
* @name getListRechargeOrderRecord.java
* @Description // 获取充值记录列表
* @Date 2:31 下午 2022/2/11
* @Param []
* @return java.util.List<com.hai.entity.OutRechargeOrderRecord>
*/
List<OutRechargeOrderRecord> getListRechargeOrderRecord();
/**
* @Author Sum1Dream
* @name findById.java
* @Description // 根据ID查询
* @Date 2:32 下午 2022/2/11
* @Param [Long id]
* @return com.hai.entity.OutRechargeOrderRecord
*/
OutRechargeOrderRecord findById(Long id);
/**
* @Author Sum1Dream
* @name findById.java
* @Description // 根据订单ID查询
* @Date 2:32 下午 2022/2/11
* @Param [Long id]
* @return com.hai.entity.OutRechargeOrderRecord
*/
OutRechargeOrderRecord findByOrderNo(String orderNo);
/**
* @Author Sum1Dream
* @name findById.java
* @Description // 根据订单ID查询
* @Date 2:32 下午 2022/2/11
* @Param [Long id]
* @return com.hai.entity.OutRechargeOrderRecord
*/
OutRechargeOrderRecord findByOrderId(Long orderId);
/***
* @Author Sum1Dream
* @Description // 新增订单
* @Date 15:25 2021/6/11
* @Param [rechargeOrderRecord]
* @return void
**/
void insertOrder(OutRechargeOrderRecord rechargeOrderRecord);
/***
* @Author Sum1Dream
* @Description // 修改订单
* @Date 15:26 2021/6/11
* @Param [rechargeOrderRecord]
* @return void
**/
void updateOrder(OutRechargeOrderRecord rechargeOrderRecord);
}

@ -0,0 +1,60 @@
package com.hai.service.impl;
import com.hai.dao.OutRechargeOrderRecordMapper;
import com.hai.entity.OutRechargeOrderRecord;
import com.hai.entity.OutRechargeOrderRecordExample;
import com.hai.service.OutRechargeOrderRecordService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service("outRechargeOrderRecordService")
public class OutRechargeOrderRecordServiceImpl implements OutRechargeOrderRecordService {
@Resource
private OutRechargeOrderRecordMapper rechargeOrderRecordMapper;
@Override
public List<OutRechargeOrderRecord> getListRechargeOrderRecord() {
return null;
}
@Override
public OutRechargeOrderRecord findById(Long id) {
return null;
}
@Override
public OutRechargeOrderRecord findByOrderNo(String orderNo) {
OutRechargeOrderRecordExample example = new OutRechargeOrderRecordExample();
example.createCriteria().andRechargeOrderNoEqualTo(orderNo);
if (rechargeOrderRecordMapper.selectByExample(example).size() == 0) {
return null;
} else {
return rechargeOrderRecordMapper.selectByExample(example).get(0);
}
}
@Override
public OutRechargeOrderRecord findByOrderId(Long orderId) {
OutRechargeOrderRecordExample example = new OutRechargeOrderRecordExample();
example.createCriteria().andRechargeOrderIdEqualTo(orderId);
if (rechargeOrderRecordMapper.selectByExample(example).size() == 0) {
return null;
} else {
return rechargeOrderRecordMapper.selectByExample(example).get(0);
}
}
@Override
public void insertOrder(OutRechargeOrderRecord rechargeOrderRecord) {
rechargeOrderRecordMapper.insert(rechargeOrderRecord);
}
@Override
public void updateOrder(OutRechargeOrderRecord rechargeOrderRecord) {
rechargeOrderRecordMapper.updateByPrimaryKey(rechargeOrderRecord);
}
}
Loading…
Cancel
Save