diff --git a/hai-cweb/src/main/java/com/cweb/controller/BsMsgController.java b/hai-cweb/src/main/java/com/cweb/controller/BsMsgController.java index f225b8f3..54f53e3e 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/BsMsgController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/BsMsgController.java @@ -52,13 +52,14 @@ public class BsMsgController { @RequestParam(value = "jumpType", required = false) Integer jumpType, @RequestParam(value = "msgType", required = false) Integer msgType, @RequestParam(value = "title", required = false) String title, + @RequestParam(value = "companyId", required = true) String companyId, @RequestParam(name = "pageNum", required = true) Integer pageNum, @RequestParam(name = "pageSize", required = true) Integer pageSize, HttpServletRequest request ) { try { SessionObject sessionObject = userCenter.getSessionObject(request); - UserInfoModel userInfoModel = (UserInfoModel) sessionObject.getObject(); + HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject(); Map map = new HashMap<>(5); @@ -66,7 +67,7 @@ public class BsMsgController { map.put("jumpType", jumpType); map.put("msgType", msgType); map.put("title", title); - map.put("companyId" , userInfoModel.getBsCompany().getId()); + map.put("companyId" , companyId); PageHelper.startPage(pageNum,pageSize); diff --git a/hai-cweb/src/main/java/com/cweb/controller/CmsContentController.java b/hai-cweb/src/main/java/com/cweb/controller/CmsContentController.java index 00d31f0a..e5f82a01 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/CmsContentController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/CmsContentController.java @@ -7,6 +7,7 @@ import com.hai.common.exception.SysCode; import com.hai.common.security.SessionObject; import com.hai.common.security.UserCenter; import com.hai.common.utils.DateUtil; +import com.hai.common.utils.RedisUtil; import com.hai.common.utils.ResponseMsgUtil; import com.hai.config.CmsContentConfig; import com.hai.entity.*; @@ -47,15 +48,26 @@ public class CmsContentController { @Resource private BsMsgService bsMsgService; + @Autowired + private RedisUtil redisUtil; + + @Autowired + private UserCenter userCenter; + @RequestMapping(value = "/getCmsContent", method = RequestMethod.GET) @ApiOperation(value = "查询cms内容") @ResponseBody public ResponseData getCmsContent(@RequestParam(name = "companyId", required = true) Long companyId, @RequestParam(name = "platform", required = true) Integer platform, - @RequestParam(name = "categoryCode", required = true) String categoryCode) { + @RequestParam(name = "categoryCode", required = true) String categoryCode, HttpServletRequest request) { try { - + SessionObject sessionObject = userCenter.getSessionObjectByCms(request); + HighUserModel userInfoModel = new HighUserModel(); + if (sessionObject != null) { + // 用户 + userInfoModel = (HighUserModel) sessionObject.getObject(); + } CmsCategory category = cmsCategoryService.getCategoryByCode(categoryCode); @@ -101,13 +113,28 @@ public class CmsContentController { object.put("jumpType" , cmsContent.get(0).getJumpType()); object.put("jumpUrl" , cmsContent.get(0).getJumpUrl()); } + List listUser = new ArrayList<>(); + if (sessionObject != null) { + Map mapUser = new HashMap<>(); + + mapUser.put("whereCheck" , false); + mapUser.put("companyId" , companyId); + mapUser.put("msgType" , 1); + mapUser.put("userId" , userInfoModel.getHighUser().getId()); + mapUser.put("num" , 3); + listUser = bsMsgService.queryMsgByList(mapUser); + + } Map map = new HashMap<>(); map.put("companyId" , companyId); map.put("msgType" , 2); + map.put("num" , 3); List list = bsMsgService.queryMsgByList(map); + list.addAll(listUser); + for (BsMsg bsMsg : list) { bsMsg.setTimeData( DateUtil.timeDifference(bsMsg.getCreateTime(), new Date() )); } diff --git a/hai-cweb/src/main/java/com/cweb/controller/OutRechargePriceController.java b/hai-cweb/src/main/java/com/cweb/controller/OutRechargePriceController.java index af8c3cfb..00c376ad 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/OutRechargePriceController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/OutRechargePriceController.java @@ -60,22 +60,17 @@ public class OutRechargePriceController { @ApiOperation(value = "查询充值金额列表") public ResponseData getRechargePriceByList( @RequestParam(name = "platformId", required = true) Integer platformId, - @RequestParam(name = "regionId", required = true) String regionId, + @RequestParam(name = "companyId", required = true) String companyId, @RequestParam(name = "operatorType", required = true) Integer operatorType ) { try { Map map = new HashMap<>(); - SecRegion region = commonService.getParentByRegion(Long.parseLong(regionId)); - if (region != null) { - BsCompany bsCompany = bsCompanyService.selectCompanyByRegion(region.getRegionId().toString()); - map.put("companyId", String.valueOf(bsCompany.getId())); - } + map.put("companyId", companyId); map.put("platformId", platformId); map.put("operatorType", operatorType); - return ResponseMsgUtil.success( outRechargePriceService.getRechargePriceByList(map)); } catch (Exception e) { log.error("OutRechargePriceController --> getListUser() error!", e); diff --git a/hai-order/src/main/resources/dev/logback.xml b/hai-order/src/main/resources/dev/logback.xml index d93f8861..fc978f86 100644 --- a/hai-order/src/main/resources/dev/logback.xml +++ b/hai-order/src/main/resources/dev/logback.xml @@ -91,6 +91,40 @@ UTF-8 + + log/QzLog.log + + log/QzLog.log.%d.%i + + + 64 MB + + + + + %d %p (%file:%line\)- %m%n + + UTF-8 + + + + log/RechargeLog.log + + log/RechargeLog.log.%d.%i + + + 64 MB + + + + + %d %p (%file:%line\)- %m%n + + UTF-8 + + @@ -109,4 +143,10 @@ + + + + + + diff --git a/hai-service/src/main/java/com/hai/common/security/UserCenter.java b/hai-service/src/main/java/com/hai/common/security/UserCenter.java index 0f8987a3..5a75ed12 100644 --- a/hai-service/src/main/java/com/hai/common/security/UserCenter.java +++ b/hai-service/src/main/java/com/hai/common/security/UserCenter.java @@ -122,6 +122,19 @@ public class UserCenter { return (SessionObject) redisUtil.get(token); } + public SessionObject getSessionObjectByCms(HttpServletRequest request) { + String token = request.getHeader("Authorization"); + if (StringUtils.isBlank(token)) { + if (StringUtils.isNotBlank(read(request))) { + token = read(request); + } + } + if (redisUtil.get(token) == null) { + return null; + } + return (SessionObject) redisUtil.get(token); + } + /** * @param request * @param response diff --git a/hai-service/src/main/java/com/hai/config/HuiLianTongUnionCardConfig.java b/hai-service/src/main/java/com/hai/config/HuiLianTongUnionCardConfig.java index bed6c3c0..9802a331 100644 --- a/hai-service/src/main/java/com/hai/config/HuiLianTongUnionCardConfig.java +++ b/hai-service/src/main/java/com/hai/config/HuiLianTongUnionCardConfig.java @@ -162,8 +162,17 @@ public class HuiLianTongUnionCardConfig { dataMap.put("businessType", businessType); dataMap.put("tranVoucher", tranVoucher); dataMap.put("tranDesc", tranDesc); - System.out.println("工会卡支付请求参数" + JSON.toJSONString(dataMap)); - return request("qtk/deposit", dataMap); + + + log.info("============请求任务Start============="); + log.info("汇联通充值-请求参数: " + JSON.toJSONString(dataMap)); + + JSONObject returnObject = request("qtk/deposit", dataMap); + + log.info("汇联通充值-响应参数: " + returnObject.toJSONString()); + log.info("============请求任务End=============="); + return returnObject; + } /** @@ -278,7 +287,17 @@ public class HuiLianTongUnionCardConfig { public static JSONObject resolveResponse(String param) { String data = param.replace("\\n", ""); String decodeData = DesUtil.decode(CommonSysConst.getSysConfig().getHuiLianTongUnionCardSignCode(), data, Charset.forName("UTF-8")); - return JSONObject.parseObject(decodeData); + + log.info("============请求任务Start============="); + log.info("解析响应的参数-请求参数: " + data); + + JSONObject returnObject = JSONObject.parseObject(decodeData); + + log.info("解析响应的参数-响应参数: " + returnObject.toJSONString()); + log.info("============请求任务End=============="); + + return returnObject; + } /** diff --git a/hai-service/src/main/java/com/hai/config/QianZhuConfig.java b/hai-service/src/main/java/com/hai/config/QianZhuConfig.java index 0b109b54..bcbc4b26 100644 --- a/hai-service/src/main/java/com/hai/config/QianZhuConfig.java +++ b/hai-service/src/main/java/com/hai/config/QianZhuConfig.java @@ -12,6 +12,8 @@ import io.swagger.annotations.ApiOperation; import io.swagger.models.auth.In; import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; @@ -27,6 +29,8 @@ import java.util.*; */ public class QianZhuConfig { + private static Logger log = LoggerFactory.getLogger(QianZhuConfig.class); + /** * 获取Token * @param platformUniqueId 用户唯一id @@ -75,7 +79,15 @@ public class QianZhuConfig { map.put("notifyUrl", CommonSysConst.getSysConfig().getQianzhuOrderNotify()); map.put("orderNo", orderNo); map.put("sign", MD5Util.encode(generateSignature(map,CommonSysConst.getSysConfig().getQinzhuSecret()).getBytes()).toLowerCase()); - return HttpsUtils.doPost(CommonSysConst.getSysConfig().getQinzhuUrl()+"/openApi/v1/orders/payKfcOrder", JSONObject.toJSONString(map)); + + log.info("============请求任务Start============="); + log.info("肯德基-请求参数: " + JSON.toJSONString(map)); + + JSONObject object = HttpsUtils.doPost(CommonSysConst.getSysConfig().getQinzhuUrl()+"/openApi/v1/orders/payKfcOrder", JSONObject.toJSONString(map)); + + log.info("肯德基-响应参数: " + object.toJSONString()); + log.info("============请求任务End=============="); + return object; } /** @@ -324,7 +336,17 @@ public class QianZhuConfig { map.put("content", JSON.toJSONString(contentMap)); map.put("timestamp", new Date().getTime()); map.put("sign", MD5Util.encode(QianZhuConfig.generateSignature(map,CommonSysConst.getSysConfig().getQinzhuSecret()).getBytes()).toLowerCase()); - return HttpsUtils.doPost(CommonSysConst.getSysConfig().getQianzhuH5url(), JSONObject.toJSONString(map)); + + + log.info("============请求任务Start============="); + log.info("星巴克下单-请求参数: " + JSON.toJSONString(map)); + + JSONObject object = HttpsUtils.doPost(CommonSysConst.getSysConfig().getQianzhuH5url(), JSONObject.toJSONString(map)); + + log.info("星巴克下单-响应参数: " + object.toJSONString()); + log.info("============请求任务End=============="); + return object; + } /** @@ -346,7 +368,14 @@ public class QianZhuConfig { map.put("traceId", WxUtils.makeNonStr()); map.put("timestamp", new Date().getTime()); map.put("sign", MD5Util.encode(generateSignature(map,CommonSysConst.getSysConfig().getQinzhuSecret()).getBytes()).toLowerCase()); - return HttpsUtils.doPost(CommonSysConst.getSysConfig().getQianzhuH5url(), JSON.toJSONString(map)); + + log.info("============请求任务Start============="); + log.info("星巴克支付-请求参数: " + JSON.toJSONString(map)); + + JSONObject object = HttpsUtils.doPost(CommonSysConst.getSysConfig().getQianzhuH5url(), JSON.toJSONString(map)); + log.info("星巴克支付-响应参数: " + object.toJSONString()); + log.info("============请求任务End=============="); + return object; } /** @@ -369,7 +398,16 @@ public class QianZhuConfig { map.put("platformUniqueId", platformUniqueId); map.put("timestamp", new Date().getTime()); map.put("sign", MD5Util.encode(QianZhuConfig.generateSignature(map,CommonSysConst.getSysConfig().getQinzhuSecret()).getBytes()).toLowerCase()); - return HttpsUtils.doPost(CommonSysConst.getSysConfig().getQinzhuUrl()+"/openApi/v4/orders/createKfcOrder", JSONObject.toJSONString(map)); + + + log.info("============请求任务Start============="); + log.info("肯德基下单-请求参数: " + JSON.toJSONString(map)); + + JSONObject object = HttpsUtils.doPost(CommonSysConst.getSysConfig().getQinzhuUrl()+"/openApi/v4/orders/createKfcOrder", JSONObject.toJSONString(map)); + + log.info("肯德基下单-响应参数: " + object.toJSONString()); + log.info("============请求任务End=============="); + return object; } /** @@ -436,7 +474,15 @@ public class QianZhuConfig { map.put("ChargeAccount", chargeAccount); map.put("CustomerIP", "127.0.0.1"); map.put("sign", MD5Util.encode(generateSignatureByThird(map,CommonSysConst.getSysConfig().getThirdAppSecret()).getBytes())); - return HttpsUtils.doPost(CommonSysConst.getSysConfig().getThirdPostUrl() + "Order/InsertV2", JSON.toJSONString(map)); + + log.info("============请求任务Start============="); + log.info("第三方充值下单-请求参数: " + JSON.toJSONString(map)); + + JSONObject object = HttpsUtils.doPost(CommonSysConst.getSysConfig().getThirdPostUrl() + "Order/InsertV2", JSON.toJSONString(map)); + log.info("第三方充值下单-响应参数: " + object.toJSONString()); + log.info("============请求任务End=============="); + return object; + } /** diff --git a/hai-service/src/main/java/com/hai/config/RechargeConfig.java b/hai-service/src/main/java/com/hai/config/RechargeConfig.java index 19d2bbb7..b239a588 100644 --- a/hai-service/src/main/java/com/hai/config/RechargeConfig.java +++ b/hai-service/src/main/java/com/hai/config/RechargeConfig.java @@ -1,11 +1,14 @@ package com.hai.config; +import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.hai.common.pay.util.sdk.WXPayConstants; import com.hai.common.utils.DateUtil; import com.hai.common.utils.HttpsUtils; import com.hai.common.utils.WxUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; import java.util.Date; @@ -22,6 +25,7 @@ import java.util.Map; @Component public class RechargeConfig { + private static Logger log = LoggerFactory.getLogger(RechargeConfig.class); /** * @Author Sum1Dream @@ -58,7 +62,15 @@ public class RechargeConfig { paramMap.put("notify_url" , object.getString("notifyUrl")); paramMap.put("userid" , CommonSysConst.getSysConfig().getLyMemberId()); paramMap.put("sign", WxUtils.generateSignatureLy(paramMap , CommonSysConst.getSysConfig().getLyApiKey() , WXPayConstants.SignType.MD5)); - return HttpsUtils.doPost(CommonSysConst.getSysConfig().getLyPostUrl()+ "index/recharge", paramMap); + + log.info("============请求任务Start============="); + log.info("龙阅订单充值-请求参数: " + JSON.toJSONString(paramMap)); + + JSONObject jsonObject = HttpsUtils.doPost(CommonSysConst.getSysConfig().getLyPostUrl()+ "index/recharge", paramMap); + + log.info("龙阅订单充值-响应参数: " + jsonObject.toJSONString()); + log.info("============请求任务End=============="); + return jsonObject; } @@ -101,10 +113,16 @@ public class RechargeConfig { map.put("timestamp" , timestamp.substring(0,timestamp.length()-3)); map.put("notify_url" , object.getString("notifyUrl")); String signStr = WxUtils.generateSignatureAppSecret(map, CommonSysConst.getSysConfig().getJjAppSecret() , WXPayConstants.SignType.MD5); - map.put("sign" , signStr); - return HttpsUtils.doPost(CommonSysConst.getSysConfig().getJjUrl() + "createOrder" , map); + log.info("============请求任务Start============="); + log.info("尖椒订单充值-请求参数: " + JSON.toJSONString(map)); + + JSONObject jsonObject = HttpsUtils.doPost(CommonSysConst.getSysConfig().getJjUrl() + "createOrder" , map); + + log.info("尖椒订单充值-响应参数: " + jsonObject.toJSONString()); + log.info("============请求任务End=============="); + return jsonObject; } @@ -153,7 +171,14 @@ public class RechargeConfig { paramMap.put("appid" , CommonSysConst.getSysConfig().getCyApiKey()); paramMap.put("sign", WxUtils.generateSignatureCy(paramMap , CommonSysConst.getSysConfig().getCyAppSecret() , WXPayConstants.SignType.MD5)); - return HttpsUtils.doPostByCy(CommonSysConst.getSysConfig().getCyPostUrl()+ "/api/interface/recharge", paramMap); + log.info("============请求任务Start============="); + log.info("城宇话费下单-请求参数: " + JSON.toJSONString(paramMap)); + + JSONObject jsonObject = HttpsUtils.doPostByCy(CommonSysConst.getSysConfig().getCyPostUrl()+ "/api/interface/recharge", paramMap); + + log.info("城宇话费下单-响应参数: " + jsonObject.toJSONString()); + log.info("============请求任务End=============="); + return jsonObject; } diff --git a/hai-service/src/main/java/com/hai/config/ThirdProductConfig.java b/hai-service/src/main/java/com/hai/config/ThirdProductConfig.java index 53fbb3dd..10e8892f 100644 --- a/hai-service/src/main/java/com/hai/config/ThirdProductConfig.java +++ b/hai-service/src/main/java/com/hai/config/ThirdProductConfig.java @@ -6,6 +6,9 @@ import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; import com.hai.entity.BsProductConfig; import com.hai.entity.BsProductDiscount; +import com.hai.entity.HighChildOrder; +import com.hai.entity.HighOrder; +import com.hai.order.model.CreateOrderChildModel; import com.hai.service.ApiProductService; import com.hai.service.BsConfigService; import org.springframework.stereotype.Component; @@ -86,5 +89,24 @@ public class ThirdProductConfig { return object; } + // 组装星巴克 肯德基 第三方会员充值 话费 订单组装 + public JSONObject assembleOrder(HighOrder order , CreateOrderChildModel child) { + /*********** 组装肯德基,星巴克,第三方会员充值 请求数据************/ + JSONObject object = new JSONObject(); + object.put("customerMobile" , child.getCustomerMobile()); + object.put("productType" , child.getProductType()); + object.put("platformId" , child.getPlatformId()); + object.put("eatType" , child.getEatType()); + object.put("storeCode" , child.getStoreCode()); + object.put("companyId" , order.getCompanyId()); + object.put("userId" , child.getMemId()); + object.put("orderItems" , child.getOrderItems()); + + /*********** 话费 请求数据************/ + object.put("rechargeContent" , child.getRechargeContent()); + object.put("goodsId" , child.getGoodsId()); + + return object; + } } diff --git a/hai-service/src/main/java/com/hai/dao/BsMsgUserMapperExt.java b/hai-service/src/main/java/com/hai/dao/BsMsgUserMapperExt.java index 0524370a..455421d1 100644 --- a/hai-service/src/main/java/com/hai/dao/BsMsgUserMapperExt.java +++ b/hai-service/src/main/java/com/hai/dao/BsMsgUserMapperExt.java @@ -25,7 +25,7 @@ public interface BsMsgUserMapperExt { " and type = #{param.type} ", " and msg_type = #{param.msgType} ", " and where_check = #{param.whereCheck} ", - "order by create_time desc limit 5; " + + "order by create_time desc limit #{param.num}; " + " "}) @Results({ @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true), diff --git a/hai-service/src/main/java/com/hai/dao/OutRechargePriceMapperExt.java b/hai-service/src/main/java/com/hai/dao/OutRechargePriceMapperExt.java index 6b10c95e..d91bb66d 100644 --- a/hai-service/src/main/java/com/hai/dao/OutRechargePriceMapperExt.java +++ b/hai-service/src/main/java/com/hai/dao/OutRechargePriceMapperExt.java @@ -23,6 +23,7 @@ public interface OutRechargePriceMapperExt { "where status in (1,2) and platform_id = #{param.platformId} " + "and operator_type = #{param.operatorType} " + "and company_id = #{param.companyId} " + + "and product_type = 9 " + "order by sort asc; " + " "}) @Results({ diff --git a/hai-service/src/main/java/com/hai/enum_type/ApiProductTypeEnum.java b/hai-service/src/main/java/com/hai/enum_type/ApiProductTypeEnum.java index df5fdf56..a199c7b3 100644 --- a/hai-service/src/main/java/com/hai/enum_type/ApiProductTypeEnum.java +++ b/hai-service/src/main/java/com/hai/enum_type/ApiProductTypeEnum.java @@ -13,9 +13,11 @@ public enum ApiProductTypeEnum { type1(1, "星巴克"), type2(2, "肯德基"), type3(3, "第三方产品"), - type4(5, "卡券"), - type5(6, "在线加油"), - type6(7, "优惠券包 ") + type4(4, "积分充值"), + type5(5, "卡券"), + type6(6, "在线加油"), + type7(7, "优惠券包 "), + type8(8, "汇联通充值 ") ; private Integer type; diff --git a/hai-service/src/main/java/com/hai/order/service/impl/OrderCreateHandleServiceImpl.java b/hai-service/src/main/java/com/hai/order/service/impl/OrderCreateHandleServiceImpl.java index 09936066..d769edd8 100644 --- a/hai-service/src/main/java/com/hai/order/service/impl/OrderCreateHandleServiceImpl.java +++ b/hai-service/src/main/java/com/hai/order/service/impl/OrderCreateHandleServiceImpl.java @@ -605,6 +605,8 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService { // 查询用户 HighUser user = highUserService.findByUserId(object.getLong("userId")); + // 千猪返回订单号 + String orderNo; // 查询详单订单的实际 JSONObject productDetail = thirdProductConfig.getThirdPartyByDetail(object.getInteger("platformId"), object.getInteger("productType"), object.getLong("companyId") , object.getLong("productId")); @@ -665,8 +667,11 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, jsonObject.getString("message")); } + // 定义千猪返回订单号 + orderNo = jsonObject.getJSONObject("data").getString("orderNo"); + // 根据订单号查询订单详情 - JSONObject orderObject = QianZhuConfig.starbucksOrderByOrderNo(jsonObject.getJSONObject("data").getString("orderNo")); + JSONObject orderObject = QianZhuConfig.starbucksOrderByOrderNo(orderNo); // 判断是否成功 if (!orderObject.getBoolean("success")) { @@ -687,6 +692,7 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService { childOrder.setChannelOrderNo(jsonObject.getJSONObject("data").getString("orderNo")); childOrder.setGoodsId(object.getLong("productId")); childOrder.setMemId(user.getId()); + childOrder.setOrderNo(orderNo); childOrder.setMemName(user.getName()); childOrder.setMemPhone(user.getPhone()); childOrder.setStoreAddress(orderObject.getJSONObject("data").getString("storeAddress")); @@ -728,16 +734,16 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService { if (!Objects.equals(jsonObject.getString("code"), "10000")) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, jsonObject.getString("message")); } + // 定义千猪返回订单号 + orderNo = jsonObject.getJSONObject("data").getString("orderNo"); // 根据订单号查询订单详情 - JSONObject orderObject = QianZhuConfig.getKfcOrderByOrderNo(jsonObject.getJSONObject("data").getString("orderNo")); + JSONObject orderObject = QianZhuConfig.getKfcOrderByOrderNo(orderNo); // 判断下单是否成功 if (!orderObject.getBoolean("success")) { throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, jsonObject.getString("message")); } - - // 获取肯德基订单内容 JSONArray kfcOrder = orderObject.getJSONObject("data").getJSONObject("kfcPlaceOrder").getJSONArray("items"); for (Object kfcObject : kfcOrder) { @@ -749,6 +755,7 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService { childOrder.setMemName(user.getName()); childOrder.setMemPhone(user.getPhone()); childOrder.setChildOrderNo(OrderUtil.generateChildOrderNo()); + childOrder.setOrderNo(orderNo); childOrder.setGoodsId(object.getLong("productId")); childOrder.setChannelOrderNo(jsonObject.getJSONObject("data").getString("orderNo")); childOrder.setStoreAddress(orderObject.getJSONObject("data").getJSONObject("kfcPlaceOrder").getString("storeAddress")); @@ -785,14 +792,12 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService { } object.put("productId", memberProduct.getProductId()); - // 计算实际支付金额 BigDecimal childPrice = memberProduct.getCostPrice().add(memberProduct.getPrice().multiply(productDetail.getBigDecimal("priceDiscount").divide(new BigDecimal(100)))).setScale(2, RoundingMode.HALF_UP); if (childPrice.compareTo(memberProduct.getPrice()) > 0) { childPrice = memberProduct.getPrice(); } - HighChildOrder childOrder = new HighChildOrder(); childOrder.setChildOrderStatus(1); childOrder.setGoodsType(10); diff --git a/hai-service/src/main/java/com/hai/order/service/impl/OrderPaySuccessServiceImpl.java b/hai-service/src/main/java/com/hai/order/service/impl/OrderPaySuccessServiceImpl.java index b2bbd856..7362560d 100644 --- a/hai-service/src/main/java/com/hai/order/service/impl/OrderPaySuccessServiceImpl.java +++ b/hai-service/src/main/java/com/hai/order/service/impl/OrderPaySuccessServiceImpl.java @@ -21,6 +21,7 @@ import org.apache.rocketmq.spring.core.RocketMQTemplate; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.integration.support.MessageBuilder; import org.springframework.messaging.Message; +import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Isolation; import org.springframework.transaction.annotation.Propagation; @@ -137,9 +138,8 @@ public class OrderPaySuccessServiceImpl implements OrderPaySuccessService { // 处理订单产品业务 orderBusHandle(order); + pushUserMsg(order.getId() , "支付成功"); - // Todo 需要改成异步推送。推送支付成功消息 - bsMsgService.pushUserMsg(order.getId() , "支付成功"); } return order; @@ -153,6 +153,11 @@ public class OrderPaySuccessServiceImpl implements OrderPaySuccessService { } } + @Async + public void pushUserMsg(Long order, String title) throws Exception { + bsMsgService.pushUserMsg(order , title); + } + /** * 订单业务处理 * @param order @@ -344,16 +349,15 @@ public class OrderPaySuccessServiceImpl implements OrderPaySuccessService { private void kfcHandle(HighOrder order) throws Exception { // 支付给千猪 - JSONObject object = QianZhuConfig.payKfcOrder(order.getOrderNo()); - + QianZhuConfig.payKfcOrder(order.getOrderNo()); // 推送订单记录 - HighGasOrderPush highGasOrderPush = new HighGasOrderPush(); - highGasOrderPush.setType(OrderPushType.type3.getType()); - highGasOrderPush.setOrderNo(order.getOrderNo()); - highGasOrderPush.setCreateTime(new Date()); - highGasOrderPush.setRequestContent(order.getOrderNo()); - highGasOrderPush.setReturnContent(object.toJSONString()); - highGasOrderPushMapper.insert(highGasOrderPush); +// HighGasOrderPush highGasOrderPush = new HighGasOrderPush(); +// highGasOrderPush.setType(OrderPushType.type3.getType()); +// highGasOrderPush.setOrderNo(order.getOrderNo()); +// highGasOrderPush.setCreateTime(new Date()); +// highGasOrderPush.setRequestContent(order.getOrderNo()); +// highGasOrderPush.setReturnContent(object.toJSONString()); +// highGasOrderPushMapper.insert(highGasOrderPush); } /** @@ -406,36 +410,36 @@ public class OrderPaySuccessServiceImpl implements OrderPaySuccessService { // 汇联通卡充值 JSONObject deposit = HuiLianTongUnionCardConfig.deposit(order.getOrderNo(), order.getMemCardNo(), order.getPayPrice(), businessType, order.getPaySerialNo(), tranDesc); - System.out.println("工会卡支付响应参数" + deposit.toJSONString()); - - JSONObject dataObject = HuiLianTongUnionCardConfig.resolveResponse(deposit.getString("data")); - - Map dataMap = new HashMap<>(); - dataMap.put("orderNo", order.getOrderNo()); - dataMap.put("cardType", "ghk"); - dataMap.put("cardNo", order.getMemCardNo()); - dataMap.put("checkPassword", "N"); - dataMap.put("tranAmount", order.getPayPrice()); - dataMap.put("tranChannel", "HiSen"); - dataMap.put("businessType", businessType); - dataMap.put("goodsDesc", goodsDesc); - dataMap.put("tranDesc", tranDesc); - HighGasOrderPush payPush = new HighGasOrderPush(); - payPush.setType(OrderPushType.type7.getType()); - payPush.setOrderNo(order.getOrderNo()); - payPush.setCreateTime(new Date()); - payPush.setCode(deposit.getString("respCode")); - payPush.setRequestContent(JSON.toJSONString(dataMap)); - payPush.setReturnContent(deposit.toJSONString()); - highGasOrderPushMapper.insert(payPush); - - if (!Objects.equals(deposit.getString("respCode"), "0000")) { - throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , deposit.getString("respMessage")); - } - // 记录回调信息 - if (!dataObject.getBoolean("success")) { - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, dataObject.getString("message")); - } + + // 汇联通充值回调解析 + HuiLianTongUnionCardConfig.resolveResponse(deposit.getString("data")); + +// Map dataMap = new HashMap<>(); +// dataMap.put("orderNo", order.getOrderNo()); +// dataMap.put("cardType", "ghk"); +// dataMap.put("cardNo", order.getMemCardNo()); +// dataMap.put("checkPassword", "N"); +// dataMap.put("tranAmount", order.getPayPrice()); +// dataMap.put("tranChannel", "HiSen"); +// dataMap.put("businessType", businessType); +// dataMap.put("goodsDesc", goodsDesc); +// dataMap.put("tranDesc", tranDesc); +// HighGasOrderPush payPush = new HighGasOrderPush(); +// payPush.setType(OrderPushType.type7.getType()); +// payPush.setOrderNo(order.getOrderNo()); +// payPush.setCreateTime(new Date()); +// payPush.setCode(deposit.getString("respCode")); +// payPush.setRequestContent(JSON.toJSONString(dataMap)); +// payPush.setReturnContent(deposit.toJSONString()); +// highGasOrderPushMapper.insert(payPush); +// +// if (!Objects.equals(deposit.getString("respCode"), "0000")) { +// throw ErrorHelp.genException(SysCode.System , ErrorCode.COMMON_ERROR , deposit.getString("respMessage")); +// } +// // 记录回调信息 +// if (!dataObject.getBoolean("success")) { +// throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, dataObject.getString("message")); +// } } /** @@ -451,13 +455,13 @@ public class OrderPaySuccessServiceImpl implements OrderPaySuccessService { JSONObject requestContent = QianZhuConfig.starbucksOrdersPay(order.getOrderNo()); // 推送订单记录 - HighGasOrderPush highGasOrderPush = new HighGasOrderPush(); - highGasOrderPush.setType(OrderPushType.type8.getType()); - highGasOrderPush.setOrderNo(order.getOrderNo()); - highGasOrderPush.setCreateTime(new Date()); - highGasOrderPush.setRequestContent(order.getOrderNo()); - highGasOrderPush.setReturnContent(requestContent.toJSONString()); - highGasOrderPushMapper.insert(highGasOrderPush); +// HighGasOrderPush highGasOrderPush = new HighGasOrderPush(); +// highGasOrderPush.setType(OrderPushType.type8.getType()); +// highGasOrderPush.setOrderNo(order.getOrderNo()); +// highGasOrderPush.setCreateTime(new Date()); +// highGasOrderPush.setRequestContent(order.getOrderNo()); +// highGasOrderPush.setReturnContent(requestContent.toJSONString()); +// highGasOrderPushMapper.insert(highGasOrderPush); } /** @@ -475,14 +479,14 @@ public class OrderPaySuccessServiceImpl implements OrderPaySuccessService { JSONObject object = QianZhuConfig.insertV2(memberProduct.getProductId() , order.getOrderNo() , order.getRemarks()); - // 推送订单记录 - HighGasOrderPush highGasOrderPush = new HighGasOrderPush(); - highGasOrderPush.setType(OrderPushType.type8.getType()); - highGasOrderPush.setOrderNo(order.getOrderNo()); - highGasOrderPush.setCreateTime(new Date()); - highGasOrderPush.setRequestContent(order.getOrderNo()); - highGasOrderPush.setReturnContent(object.toJSONString()); - highGasOrderPushMapper.insert(highGasOrderPush); +// // 推送订单记录 +// HighGasOrderPush highGasOrderPush = new HighGasOrderPush(); +// highGasOrderPush.setType(OrderPushType.type8.getType()); +// highGasOrderPush.setOrderNo(order.getOrderNo()); +// highGasOrderPush.setCreateTime(new Date()); +// highGasOrderPush.setRequestContent(order.getOrderNo()); +// highGasOrderPush.setReturnContent(object.toJSONString()); +// highGasOrderPushMapper.insert(highGasOrderPush); } diff --git a/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java b/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java index 947addcf..ac8aed8b 100644 --- a/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java @@ -8,6 +8,7 @@ import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.SysCode; import com.hai.common.security.AESEncodeUtil; +import com.hai.config.ThirdProductConfig; import com.hai.dao.HighChildOrderMapper; import com.hai.dao.HighOrderMapper; import com.hai.entity.*; @@ -73,14 +74,12 @@ public class OrderServiceImpl implements OrderService { @Resource private OrderCancelHandleService orderCancelHandleService; - @Resource - private OrderRefundHandleService orderRefundHandleService; - @Resource private OrderPaySuccessService paySuccessService; @Resource - private OutRechargeOrderService outRechargeOrderService; + private ThirdProductConfig thirdProductConfig; + @Override public HighOrder insertOrderData(HighOrder order) { @@ -150,25 +149,12 @@ public class OrderServiceImpl implements OrderService { /*********** 组装处理子订单 商品业务************/ List childOrderList = new ArrayList<>(); for (CreateOrderChildModel child : createOrderModel.getChildOrderList()) { - child.setOrderNo(order.getOrderNo()); child.setMemId(order.getMemId()); child.setMemName(order.getMemName()); child.setMemPhone(order.getMemPhone()); - /*********** 组装肯德基,星巴克,第三方会员充值 请求数据************/ - JSONObject object = new JSONObject(); - object.put("customerMobile" , child.getCustomerMobile()); - object.put("productType" , child.getProductType()); - object.put("platformId" , child.getPlatformId()); - object.put("eatType" , child.getEatType()); - object.put("storeCode" , child.getStoreCode()); - object.put("companyId" , order.getCompanyId()); - object.put("userId" , child.getMemId()); - object.put("orderItems" , child.getOrderItems()); - - /*********** 话费 请求数据************/ - object.put("rechargeContent" , child.getRechargeContent()); - object.put("goodsId" , child.getGoodsId()); + /*********** 组装肯德基,星巴克,第三方会员充值 话费 请求数据************/ + JSONObject object = thirdProductConfig.assembleOrder(order , child); // 购买卡券 if (child.getGoodsType().equals(OrderChildGoodsType.TYPE1.getNumber())) { @@ -270,7 +256,6 @@ public class OrderServiceImpl implements OrderService { order.setHighChildOrderList(childOrderList); /*********** 组装处理子订单 商品业务************/ - // 计算订单金额 Map calculateOrderPrice = OrderUtil.calculateOrderPrice(order.getHighChildOrderList()); order.setTotalPrice(new BigDecimal(calculateOrderPrice.get("totalPrice").toString())); diff --git a/hai-service/src/main/java/com/hai/service/impl/ApiProductServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/ApiProductServiceImpl.java index 9f7c87b2..79ac0a15 100644 --- a/hai-service/src/main/java/com/hai/service/impl/ApiProductServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/ApiProductServiceImpl.java @@ -254,7 +254,6 @@ public class ApiProductServiceImpl implements ApiProductService { public void updateProductConfig(JSONObject object) { BsProductConfig productConfig = productConfigMapper.selectByPrimaryKey(object.getLong("id")); - productConfig.setProductId(object.getLong("productType")); productConfig.setCompanyId(object.getLong("companyId")); productConfig.setDiscount(object.getBigDecimal("discount")); productConfig.setStatus(101); @@ -264,6 +263,12 @@ public class ApiProductServiceImpl implements ApiProductService { productConfig.setProductName(ApiProductTypeEnum.getNameByType(object.getInteger("productType"))); productConfig.setProductType(object.getInteger("productType")); + productConfig.setProductId(1L); + + // 产品类型 1:星巴克 2:肯德基 3:会员充值 4:积分充值 5:购买卡券 6:加油服务 7:优惠券包 8:汇联通充值 9:话费充值 + if( object.getInteger("productType") == 5) { + productConfig.setProductId(object.getLong("productId")); + } productConfigMapper.updateByPrimaryKey(productConfig); diff --git a/hai-service/src/main/java/com/hai/service/impl/CommonServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/CommonServiceImpl.java index 9883489d..45ac55df 100644 --- a/hai-service/src/main/java/com/hai/service/impl/CommonServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/CommonServiceImpl.java @@ -558,7 +558,7 @@ public class CommonServiceImpl implements CommonService { @Transactional(propagation= Propagation.REQUIRES_NEW) public void configPayType(JSONObject object) { // 删除原支付方式 - deletePayType(object.getLong("sourceId")); + deletePayType(object.getLong("sourceId") , object.getInteger("productType")); // 支付方式 BsProductPayType productPayType; // 配置支付方式 @@ -586,7 +586,7 @@ public class CommonServiceImpl implements CommonService { @Transactional(propagation= Propagation.REQUIRES_NEW) public void configIntegralDiscount(JSONObject object) { // 清空原积分抵扣比例 - deleteIntegralDiscount(object.getLong("sourceId")); + deleteIntegralDiscount(object.getLong("sourceId") , object.getInteger("productType")); // 折扣比例 BsProductDiscount productDiscount; // 配置积分折扣比例 @@ -606,7 +606,7 @@ public class CommonServiceImpl implements CommonService { @Transactional(propagation= Propagation.REQUIRES_NEW) public void configPlatform(JSONObject object) { - deletePlatform(object.getLong("sourceId")); + deletePlatform(object.getLong("sourceId") , object.getInteger("productType")); BsProductPlatform productPlatform; // 配置展示平台 @@ -657,14 +657,14 @@ public class CommonServiceImpl implements CommonService { } // 清空支付方式配置 - private void deletePayType(Long sourceId) { + private void deletePayType(Long sourceId , Integer productType) { if (sourceId == null) { throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); } BsProductPayTypeExample example = new BsProductPayTypeExample(); - example.createCriteria().andSourceIdEqualTo(sourceId); + example.createCriteria().andSourceIdEqualTo(sourceId).andProductTypeEqualTo(productType); List list = bsProductPayTypeMapper.selectByExample(example); @@ -677,14 +677,14 @@ public class CommonServiceImpl implements CommonService { } // 清空配置积分抵扣比例 - private void deleteIntegralDiscount(Long sourceId) { + private void deleteIntegralDiscount(Long sourceId , Integer productType) { if (sourceId == null) { throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); } BsProductDiscountExample example = new BsProductDiscountExample(); - example.createCriteria().andSourceIdEqualTo(sourceId); + example.createCriteria().andSourceIdEqualTo(sourceId).andProductTypeEqualTo(productType); List list = bsProductDiscountMapper.selectByExample(example); @@ -697,14 +697,14 @@ public class CommonServiceImpl implements CommonService { } // 清空配置展示平台 - private void deletePlatform(Long sourceId) { + private void deletePlatform(Long sourceId, Integer productType) { if (sourceId == null) { throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); } BsProductPlatformExample example = new BsProductPlatformExample(); - example.createCriteria().andSourceIdEqualTo(sourceId); + example.createCriteria().andSourceIdEqualTo(sourceId).andProductTypeEqualTo(productType); List list = bsProductPlatformMapper.selectByExample(example); diff --git a/hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java index 4bd3adf1..a29de437 100644 --- a/hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java @@ -988,17 +988,17 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService { outRechargeChildOrderService.insertOrder(childOrder); // 创建提交记录 - BsRequestRecord requestRecord = new BsRequestRecord(); - requestRecord.setCreateTime(new Date()); - requestRecord.setUpdateTime(new Date()); - requestRecord.setOrderNo(orderNo); - requestRecord.setRequestContent(object.toJSONString()); - requestRecord.setOperatorId(0L); - requestRecord.setOperatorName("系统生成"); - requestRecord.setSourceId(childOrder.getId().toString()); - requestRecord.setSourceType(1); - - bsRequestRecordService.insertRequestRecord(requestRecord); +// BsRequestRecord requestRecord = new BsRequestRecord(); +// requestRecord.setCreateTime(new Date()); +// requestRecord.setUpdateTime(new Date()); +// requestRecord.setOrderNo(orderNo); +// requestRecord.setRequestContent(object.toJSONString()); +// requestRecord.setOperatorId(0L); +// requestRecord.setOperatorName("系统生成"); +// requestRecord.setSourceId(childOrder.getId().toString()); +// requestRecord.setSourceType(1); +// +// bsRequestRecordService.insertRequestRecord(requestRecord); // 判断是否充值提交成功 if (childOrder.getStatus() == 102) { diff --git a/hai-user/target/hai-user-1.0-SNAPSHOT.jar b/hai-user/target/hai-user-1.0-SNAPSHOT.jar index a3270fe2..74e40451 100644 Binary files a/hai-user/target/hai-user-1.0-SNAPSHOT.jar and b/hai-user/target/hai-user-1.0-SNAPSHOT.jar differ diff --git a/hai-user/target/hai-user-1.0-SNAPSHOT.jar.original b/hai-user/target/hai-user-1.0-SNAPSHOT.jar.original index ecaec362..538da033 100644 Binary files a/hai-user/target/hai-user-1.0-SNAPSHOT.jar.original and b/hai-user/target/hai-user-1.0-SNAPSHOT.jar.original differ