dev-discount
袁野 3 years ago
parent 5696119dab
commit 18101bbe99
  1. 2
      hai-bweb/src/main/java/com/bweb/controller/SecUserController.java
  2. 23
      hai-bweb/src/main/java/com/bweb/controller/TelApiController.java
  3. 1
      hai-cweb/src/main/java/com/cweb/config/AuthConfig.java
  4. 55
      hai-cweb/src/main/java/com/cweb/config/WxMsgConfig.java
  5. 216
      hai-cweb/src/main/java/com/cweb/controller/TelApiController.java
  6. 38
      hai-cweb/src/main/java/com/cweb/controller/pay/OrderController.java
  7. 36
      hai-cweb/src/main/java/com/cweb/controller/pay/WechatPayController.java
  8. 36
      hai-service/src/main/java/com/hai/config/CommonSysConfig.java
  9. 7
      hai-service/src/main/java/com/hai/config/TelConfig.java
  10. 33
      hai-service/src/main/java/com/hai/config/WxMaConfiguration.java
  11. 90
      hai-service/src/main/java/com/hai/config/WxMsgConfig.java
  12. 46
      hai-service/src/main/java/com/hai/enum_type/GoodsType.java
  13. 44
      hai-service/src/main/java/com/hai/enum_type/PayType.java
  14. 14
      hai-service/src/main/java/com/hai/service/impl/HighOrderServiceImpl.java
  15. 2
      hai-service/src/main/java/com/hai/service/impl/HighUserServiceImpl.java
  16. 1
      hai-service/src/main/java/com/hai/service/pay/NotifyService.java
  17. 8
      hai-service/src/main/java/com/hai/service/pay/impl/CinemaOrderService.java
  18. 6
      hai-service/src/main/java/com/hai/service/pay/impl/GoodsOrderServiceImpl.java
  19. 8
      hai-service/src/main/java/com/hai/service/pay/impl/KfcOrderService.java
  20. 7
      hai-service/src/main/java/com/hai/service/pay/impl/MobileOrderServiceImpl.java
  21. 15
      hai-service/src/main/java/com/hai/service/pay/impl/NotifyServiceImpl.java
  22. 3
      hai-service/src/main/resources/dev/commonConfig.properties

@ -72,7 +72,7 @@ public class SecUserController {
//查询用户
SecUser secUser = secUserService.findById(userId);
if(secUser == null){
log.error("BaseMemberController --> sendUserPass() error!","未找到用户");
log.error("BaseMemberController --> sendUserPass() error!","");
throw ErrorHelp.genException(SysCode.System, ErrorCode.UN_MEMBER_ERROR, "");
}
if(!secUser.getPassword().equals(MD5Util.encode(oldPassword.getBytes()))) {

@ -1,6 +1,5 @@
package com.bweb.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
@ -8,14 +7,13 @@ 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.CommonSysConst;
import com.hai.config.QianZhuConfig;
import com.hai.config.TelConfig;
import com.hai.config.WxMsgConfig;
import com.hai.entity.HighDiscount;
import com.hai.entity.HighTelOrder;
import com.hai.entity.HighUser;
import com.hai.entity.*;
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;
@ -27,9 +25,7 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.BufferedOutputStream;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@ -45,6 +41,12 @@ public class TelApiController {
@Resource
private TelApiService telApiService;
@Resource
private HighOrderService highOrderService;
@Resource
private HighUserService highUserService;
/**
* 中国电信号码格式验证 手机段 133,153,180,181,189,177,1700,173,199
**/
@ -189,7 +191,8 @@ public class TelApiController {
public ResponseData getTest() {
try {
return ResponseMsgUtil.success(WxMsgConfig.pushOneUser(668L));
return ResponseMsgUtil.success("1");
} catch (Exception e) {
return ResponseMsgUtil.exception(e);
}

@ -119,6 +119,7 @@ public class AuthConfig implements WebMvcConfigurer {
.excludePathPatterns("/order/qzOrderToPay")
.excludePathPatterns("/czOrder/orderRefundNotify")
.excludePathPatterns("/tPig/*")
.excludePathPatterns("/telApi/*")
;
}

@ -0,0 +1,55 @@
package com.cweb.config;
import cn.binarywang.wx.miniapp.api.WxMaMsgService;
import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.bean.WxMaSubscribeMessage;
import com.hai.common.utils.DateUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.*;
public class WxMsgConfig {
private static Logger log = LoggerFactory.getLogger(WxMsgConfig.class);
public static void pushOneUser(String orderName , String price , String orderNo , Date payTime , String remark , Long orderId , String openId) {
try {
List<WxMaSubscribeMessage.Data> list = new ArrayList<>();
Map<String, String> m = new HashMap<>();
m.put("thing1", orderName);
m.put("amount2", price + "元");
m.put("character_string3", orderNo);
m.put("time4", DateUtil.date2String(payTime , "yyyy年MM月dd日 HH:mm:ss"));
m.put("thing6", remark);
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("oUvaCPeeOg4wH6HTvCcSabU6FnzXUXOBXsqBYAPOV-U");
subscribeMessage.setData(list);
subscribeMessage.setPage("pages/user/order_details/order_details?id=" + orderId);
subscribeMessage.setMiniprogramState("developer");
final WxMaService wxService = WxMaConfiguration.getMaService();
WxMaMsgService maMsgService = wxService.getMsgService();
maMsgService.sendSubscribeMsg(subscribeMessage);
} catch (Exception e) {
log.error(String.valueOf(e));
}
}
}

@ -0,0 +1,216 @@
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);
}
}
}

@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.cweb.config.SysConst;
import com.cweb.config.WxMsgConfig;
import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
@ -21,6 +22,8 @@ import com.hai.common.utils.ResponseMsgUtil;
import com.hai.config.QianZhuConfig;
import com.hai.config.TuanYouConfig;
import com.hai.entity.*;
import com.hai.enum_type.GoodsType;
import com.hai.enum_type.PayType;
import com.hai.model.HighCouponModel;
import com.hai.model.HighUserModel;
import com.hai.model.ResponseData;
@ -96,6 +99,9 @@ public class OrderController {
@Resource
private HighUserCardService highUserCardService;
@Resource
private HighUserService highUserService;
/**
*
* @Title: orderToPay
@ -267,6 +273,22 @@ public class OrderController {
highOrderService.goldPayOrder(order.getMemId(), order.getId());
new Thread(() -> {
// 查询订单信息
if (order == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_ORDER, "");
}
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());
}).start();
return ResponseMsgUtil.success("支付成功");
} catch (Exception e) {
log.error("orderToPay error!", e);
@ -344,6 +366,22 @@ public class OrderController {
highOrderService.hltUnionCardPay(userCard.getId(), order.getId());
new Thread(() -> {
// 查询订单信息
if (order == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_ORDER, "");
}
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());
}).start();
return ResponseMsgUtil.success("支付成功");
} catch (Exception e) {
log.error("orderToPay error!", e);

@ -2,6 +2,10 @@ package com.cweb.controller.pay;
import com.alibaba.fastjson.JSONObject;
import com.cweb.config.SysConst;
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.WechatPayUtil;
import com.hai.common.pay.entity.WechatCallBackInfo;
import com.hai.common.pay.util.IOUtil;
@ -10,13 +14,15 @@ import com.hai.common.pay.util.sdk.WXPayConstants;
import com.hai.common.utils.HttpsUtils;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.common.utils.WxUtils;
import com.hai.entity.BsCompany;
import com.hai.entity.HighProfitSharingRecord;
import com.hai.entity.SecRegion;
import com.hai.entity.*;
import com.hai.enum_type.GoodsType;
import com.hai.enum_type.PayType;
import com.hai.model.ResponseData;
import com.hai.model.WxSharingOrderRequestModel;
import com.hai.model.WxSharingReceiversVO;
import com.hai.service.HighOrderService;
import com.hai.service.HighProfitSharingRecordService;
import com.hai.service.HighUserService;
import com.hai.service.TelApiService;
import com.hai.service.pay.NotifyService;
import com.hai.service.pay.PayRecordService;
@ -69,6 +75,12 @@ public class WechatPayController {
@Resource
private WechatPayUtil wechatPayUtil;
@Resource
private HighOrderService highOrderService;
@Resource
private HighUserService highUserService;
@Resource
private TelApiService telApiService;
@Resource
@ -102,6 +114,24 @@ public class WechatPayController {
+ "<return_msg><![CDATA[签名验证错误]]></return_msg>" + "</xml> ";
}*/
new Thread(() -> {
// 查询订单信息
HighOrder order = highOrderService.getOrderByOrderNo(map.get("out_trade_no"));
if (order == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_ORDER, "");
}
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());
}).start();
BufferedOutputStream out = new BufferedOutputStream(response.getOutputStream());
out.write(resXml.getBytes());
out.flush();

@ -39,11 +39,6 @@ public class CommonSysConfig {
private String telUrl;
private String czOrderNotify;
private String apiKey;
private String apiSecret;
private String MpApiSecret;
private String tokenUrl;
public String getHuiLianTongUnionCardUrl() {
return HuiLianTongUnionCardUrl;
}
@ -236,35 +231,4 @@ public class CommonSysConfig {
this.telUrl = telUrl;
}
public String getApiKey() {
return apiKey;
}
public void setApiKey(String apiKey) {
this.apiKey = apiKey;
}
public String getApiSecret() {
return apiSecret;
}
public void setApiSecret(String apiSecret) {
this.apiSecret = apiSecret;
}
public String getMpApiSecret() {
return MpApiSecret;
}
public void setMpApiSecret(String mpApiSecret) {
MpApiSecret = mpApiSecret;
}
public String getTokenUrl() {
return tokenUrl;
}
public void setTokenUrl(String tokenUrl) {
this.tokenUrl = tokenUrl;
}
}

@ -23,13 +23,6 @@ import java.util.Map;
**/
public class TelConfig {
@Resource
private OutRechargeOrderService outRechargeOrderService;
@Resource
private OutRechargePriceService outRechargePriceService;
public static JSONObject getMemberGoods() throws Exception {
Map<String,Object> map = new HashMap<>();

@ -1,33 +0,0 @@
package com.hai.config;
import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl;
import cn.binarywang.wx.miniapp.config.impl.WxMaDefaultConfigImpl;
import org.springframework.context.annotation.Configuration;
import javax.annotation.PostConstruct;
@Configuration
public class WxMaConfiguration {
private static WxMaService maService;
public static WxMaService getMaService() {
if (maService == null) {
throw new IllegalArgumentException(String.format("未找到对应的配置,请核实!"));
}
return maService;
}
@PostConstruct
public void init() {
WxMaDefaultConfigImpl config = new WxMaDefaultConfigImpl();
config.setAppid(CommonSysConst.getSysConfig().getApiKey());
config.setSecret(CommonSysConst.getSysConfig().getApiSecret());
maService = new WxMaServiceImpl();
maService.setWxMaConfig(config);
}
}

@ -1,90 +0,0 @@
package com.hai.config;
import cn.binarywang.wx.miniapp.api.WxMaMsgService;
import cn.binarywang.wx.miniapp.api.WxMaService;
import cn.binarywang.wx.miniapp.bean.WxMaSubscribeMessage;
import cn.binarywang.wx.miniapp.bean.WxMaTemplateData;
import cn.binarywang.wx.miniapp.bean.WxMaUniformMessage;
import com.alibaba.fastjson.JSONObject;
import com.hai.common.utils.DateUtil;
import com.hai.common.utils.HttpsUtils;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.entity.HighChildOrder;
import com.hai.entity.HighOrder;
import com.hai.model.ResponseData;
import com.hai.service.HighOrderService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class WxMsgConfig {
private static Logger log = LoggerFactory.getLogger(WxMsgConfig.class);
@Resource
private static HighOrderService highOrderService;
public static ResponseData pushOneUser(Long orderId) {
try {
List<WxMaSubscribeMessage.Data> list = new ArrayList<>();
HighChildOrder highChildOrder = highOrderService.getChildOrderByPresentation(orderId);
HighOrder highOrder = highOrderService.getOrderById(orderId);
Map<String, String> m = new HashMap<>();
m.put("thing1", highChildOrder.getGoodsName());
m.put("amount2", highChildOrder.getGoodsActualPrice() + "元");
m.put("character_string3", highOrder.getOrderNo());
m.put("time4", DateUtil.date2String(highOrder.getPayTime() , "yyyy年MM月dd天 HH分mm秒"));
m.put("thing6", "微信支付");
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("oUGn_4lkgegcjTc9oR1qBGjtAm3A"); // 小程序openId
subscribeMessage.setTemplateId("oUvaCPeeOg4wH6HTvCcSabU6FnzXUXOBXsqBYAPOV-U");
subscribeMessage.setData(list);
subscribeMessage.setPage("pages/user/order_details/order_details?id=666");
subscribeMessage.setMiniprogramState("developer");
final WxMaService wxService = WxMaConfiguration.getMaService();
WxMaMsgService maMsgService = wxService.getMsgService();
maMsgService.sendSubscribeMsg(subscribeMessage);
return ResponseMsgUtil.success("发送成功");
} catch (Exception e) {
return ResponseMsgUtil.exception(e);
}
}
public static JSONObject getWxMsgToken() {
Map<String, Object> map = new HashMap<>();
map.put("appid", CommonSysConst.getSysConfig().getApiKey());
map.put("secret", CommonSysConst.getSysConfig().getApiSecret());
map.put("grant_type", "client_credential");
return HttpsUtils.doGet(CommonSysConst.getSysConfig().getTokenUrl() + "/cgi-bin/token", map);
}
}

@ -0,0 +1,46 @@
package com.hai.enum_type;
import java.util.Objects;
public enum GoodsType {
goodsType1(1 , "卡卷"),
goodsType2(2 , "金币充值"),
goodsType3(3 , "团油"),
goodsType4(4 , "KFC"),
goodsType5(5 , "电影票"),
goodsType6(6 , "话费充值")
;
private Integer type;
private String name;
GoodsType(int type , String name) {
this.type = type;
this.name = name;
}
public static String getNameByType(Integer type) {
for (GoodsType 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,44 @@
package com.hai.enum_type;
import java.util.Objects;
public enum PayType {
payType1(1 , "支付宝"),
payType2(2 , "微信"),
payType3(3 , "金币"),
payType4(4 , "汇联通工会卡")
;
private Integer type;
private String name;
PayType(int type , String name) {
this.type = type;
this.name = name;
}
public static String getNameByType(Integer type) {
for (PayType 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;
}
}

@ -8,12 +8,11 @@ import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode;
import com.hai.common.utils.DateUtil;
import com.hai.common.utils.IDGenerator;
import com.hai.config.CommonSysConst;
import com.hai.config.HuiLianTongConfig;
import com.hai.config.HuiLianTongUnionCardConfig;
import com.hai.config.TuanYouConfig;
import com.hai.config.*;
import com.hai.dao.*;
import com.hai.entity.*;
import com.hai.enum_type.GoodsType;
import com.hai.enum_type.PayType;
import com.hai.model.*;
import com.hai.service.*;
import org.apache.commons.collections4.MapUtils;
@ -82,6 +81,9 @@ public class HighOrderServiceImpl implements HighOrderService {
@Resource
private HighMerchantStoreService highMerchantStoreService;
@Resource
private HighOrderService highOrderService;
@Override
@Transactional(propagation= Propagation.REQUIRES_NEW)
public void insertOrder(HighOrder highOrder) throws Exception {
@ -472,8 +474,9 @@ public class HighOrderServiceImpl implements HighOrderService {
highChildOrder.setGasOrderNo(orderPushObject.getJSONObject("result").getString("orderNo"));
}
}
updateOrder(order);
}
updateOrder(order);
}
@Override
@ -881,7 +884,6 @@ public class HighOrderServiceImpl implements HighOrderService {
@Override
public HighChildOrder getChildOrderByPresentation(Long orderId) {
HighChildOrderExample example = new HighChildOrderExample();
HighChildOrderExample.Criteria criteria = example.createCriteria();
example.createCriteria().andOrderIdEqualTo(orderId).andGiveawayTypeEqualTo(false);
return highChildOrderMapper.selectByExample(example).get(0);
}

@ -136,7 +136,7 @@ public class HighUserServiceImpl implements HighUserService {
HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject();
HighUser highUser = findByUserId(userInfoModel.getHighUser().getId());
if (highUser == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到用户");
throw ErrorHelp.genException(SysCode.System, ErrorCode.UN_MEMBER_ERROR, "未找到用户");
}
if (StringUtils.isNotBlank(highUser.getPhone())) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "已绑定手机号,请勿重复绑定");

@ -27,4 +27,5 @@ public interface NotifyService {
* @param paramsMap 异步回调返回的参数
*/
String wechatNotify(Map<String, String> paramsMap) throws Exception;
}

@ -6,7 +6,11 @@ import com.hai.dao.HighGasOrderPushMapper;
import com.hai.entity.HighChildOrder;
import com.hai.entity.HighGasOrderPush;
import com.hai.entity.HighOrder;
import com.hai.entity.HighUser;
import com.hai.enum_type.GoodsType;
import com.hai.enum_type.PayType;
import com.hai.service.HighOrderService;
import com.hai.service.HighUserService;
import com.hai.service.pay.PayService;
import org.springframework.stereotype.Service;
@ -24,6 +28,9 @@ public class CinemaOrderService implements PayService {
@Resource
private HighGasOrderPushMapper highGasOrderPushMapper;
@Resource
private HighUserService highUserService;
@Override
public void paySuccess(Map<String, String> map, String payType) throws Exception {
if (payType.equals("Alipay")) {
@ -42,6 +49,7 @@ public class CinemaOrderService implements PayService {
for (HighChildOrder childOrder : order.getHighChildOrderList()) {
childOrder.setChildOrdeStatus(2); // 子订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消
}
highOrderService.updateOrder(order);
// 支付给千猪
JSONObject object = QianZhuConfig.payMovieOrder(order.getOrderNo());

@ -15,9 +15,12 @@ import com.hai.dao.HighCouponCodeOtherMapper;
import com.hai.dao.HighGasOrderPushMapper;
import com.hai.dao.HighUserCouponMapper;
import com.hai.entity.*;
import com.hai.enum_type.GoodsType;
import com.hai.enum_type.PayType;
import com.hai.model.HighMerchantStoreModel;
import com.hai.model.ResultProfitSharing;
import com.hai.service.*;
import com.hai.service.pay.NotifyService;
import com.hai.service.pay.PayService;
import org.apache.http.HttpEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
@ -78,6 +81,9 @@ public class GoodsOrderServiceImpl implements PayService {
@Resource
private HighCouponCodeOtherMapper highCouponCodeOtherMapper;
@Resource
private NotifyService notifyService;
@Override
@Transactional(propagation= Propagation.REQUIRES_NEW)
public void paySuccess(Map<String, String> map, String payType) throws Exception {

@ -7,7 +7,11 @@ import com.hai.dao.HighGasOrderPushMapper;
import com.hai.entity.HighChildOrder;
import com.hai.entity.HighGasOrderPush;
import com.hai.entity.HighOrder;
import com.hai.entity.HighUser;
import com.hai.enum_type.GoodsType;
import com.hai.enum_type.PayType;
import com.hai.service.HighOrderService;
import com.hai.service.HighUserService;
import com.hai.service.pay.PayService;
import org.springframework.stereotype.Service;
@ -25,6 +29,9 @@ public class KfcOrderService implements PayService {
@Resource
private HighGasOrderPushMapper highGasOrderPushMapper;
@Resource
private HighUserService highUserService;
@Override
public void paySuccess(Map<String, String> map, String payType) throws Exception {
if (payType.equals("Alipay")) {
@ -44,6 +51,7 @@ public class KfcOrderService implements PayService {
childOrder.setChildOrdeStatus(2); // 子订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消
}
highOrderService.updateOrder(order);
// 支付给千猪
JSONObject object = QianZhuConfig.payKfcOrder(order.getOrderNo());

@ -6,7 +6,11 @@ import com.hai.dao.HighGasOrderPushMapper;
import com.hai.entity.HighChildOrder;
import com.hai.entity.HighGasOrderPush;
import com.hai.entity.HighOrder;
import com.hai.entity.HighUser;
import com.hai.enum_type.GoodsType;
import com.hai.enum_type.PayType;
import com.hai.service.HighOrderService;
import com.hai.service.HighUserService;
import com.hai.service.pay.PayService;
import org.springframework.stereotype.Service;
@ -31,6 +35,9 @@ public class MobileOrderServiceImpl implements PayService {
@Resource
private HighGasOrderPushMapper highGasOrderPushMapper;
@Resource
private HighUserService highUserService;
@Override
public void paySuccess(Map<String, String> map, String payType) throws Exception {
if (payType.equals("Alipay")) {

@ -1,8 +1,14 @@
package com.hai.service.pay.impl;
import com.alibaba.fastjson.JSONObject;
import com.hai.common.pay.entity.OrderType;
import com.hai.common.utils.SpringContextUtil;
import com.hai.entity.HighChildOrder;
import com.hai.entity.HighOrder;
import com.hai.entity.HighUser;
import com.hai.enum_type.GoodsType;
import com.hai.enum_type.PayType;
import com.hai.service.HighOrderService;
import com.hai.service.HighUserService;
import com.hai.service.pay.NotifyService;
import com.hai.service.pay.PayRecordService;
import com.hai.service.pay.PayService;
@ -22,6 +28,12 @@ public class NotifyServiceImpl implements NotifyService {
@Resource
private PayRecordService payRecordService;
@Resource
private HighOrderService highOrderService;
@Resource
private HighUserService highUserService;
@Override
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public String alipayNotify(Map<String, String> params) throws Exception {
@ -116,4 +128,5 @@ public class NotifyServiceImpl implements NotifyService {
return payService;
}
}

@ -25,6 +25,3 @@ TelApiKey=2d01f6b520254b1a80f6b167832cea18
TelApiSecret=d11ee9b41e014a039f030e53ae6f5295
TelMemberId=d13091df65d64aafbf0f35d2093157b7
apiKey=wx8d49e2f83025229d
apiSecret=d8d6dcaef77d3b659258a01b5ddba5df
tokenUrl=https://api.weixin.qq.com

Loading…
Cancel
Save