diff --git a/hai-bweb/src/main/java/com/bweb/controller/Goods/GoodsDetailController.java b/hai-bweb/src/main/java/com/bweb/controller/Goods/GoodsDetailController.java index 65378f8f..66354cf9 100644 --- a/hai-bweb/src/main/java/com/bweb/controller/Goods/GoodsDetailController.java +++ b/hai-bweb/src/main/java/com/bweb/controller/Goods/GoodsDetailController.java @@ -60,6 +60,7 @@ public class GoodsDetailController { public ResponseData getListGoodsDetail( @RequestParam(value = "title", required = false) String title, @RequestParam(value = "status", required = false) Integer status, + @RequestParam(value = "goodsLabel", required = false) String goodsLabel, @RequestParam(name = "pageNum", required = true) Integer pageNum, @RequestParam(name = "pageSize", required = true) Integer pageSize , HttpServletRequest request @@ -73,11 +74,14 @@ public class GoodsDetailController { map.put("title", title); map.put("status", status); + map.put("goodsLabel", goodsLabel); + map.put("companyId", userInfoModel.getBsCompany().getId()); if (userInfoModel.getSecUser().getExt3() != null) { map.put("opId" , userInfoModel.getSecUser().getId()); } + PageHelper.startPage(pageNum,pageSize); List list = goodsDetailService.getGoodsDetailList(map); 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 5b51a182..e3273ac2 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/CmsContentController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/CmsContentController.java @@ -86,7 +86,6 @@ public class CmsContentController { List objectList = new ArrayList<>(); - for (CmsCategory cmsCategory : categoryList) { JSONObject object = new JSONObject(); // 1.小图一行四个 2.轮播图 3.消息通知 4.大图展示 5.一横图三小图 6.数据库数据 7.小图一行五个 @@ -153,13 +152,14 @@ public class CmsContentController { } if (cmsCategory.getType() == 3 || cmsCategory.getType() == 6 || cmsCategory.getType() == 9) { - if (object.getJSONArray("childDate") != null && object.getJSONArray("childDate").size() >0) { + if (object.getJSONArray("childDate") != null && object.getJSONArray("childDate").size() >0 ) { objectList.add(object); } } else { - objectList.add(object); + if (object.getJSONArray("childCategory").size() >0 ) { + objectList.add(object); + } } - } return ResponseMsgUtil.success(dataWhetherNull ? null:objectList); diff --git a/hai-cweb/src/main/java/com/cweb/controller/Goods/GoodsController.java b/hai-cweb/src/main/java/com/cweb/controller/Goods/GoodsController.java index 60876085..417c6be0 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/Goods/GoodsController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/Goods/GoodsController.java @@ -64,6 +64,8 @@ public class GoodsController { @RequestParam(value = "title", required = false) String title, @RequestParam(value = "goodsType", required = false) Long goodsType, @RequestParam(value = "price", required = false) Integer price, + @RequestParam(value = "companyId", required = false) Long companyId, + @RequestParam(value = "goodsLabel", required = false) String goodsLabel, @RequestParam(name = "pageNum", required = true) Integer pageNum, @RequestParam(name = "pageSize", required = true) Integer pageSize ) { @@ -74,6 +76,8 @@ public class GoodsController { map.put("title", title); map.put("goodsType", goodsType); + map.put("companyId", companyId); + map.put("goodsLabel", goodsLabel); map.put("status", 1); diff --git a/hai-cweb/src/main/java/com/cweb/controller/Goods/ShoppingCartController.java b/hai-cweb/src/main/java/com/cweb/controller/Goods/ShoppingCartController.java index 289fe082..4031cd03 100644 --- a/hai-cweb/src/main/java/com/cweb/controller/Goods/ShoppingCartController.java +++ b/hai-cweb/src/main/java/com/cweb/controller/Goods/ShoppingCartController.java @@ -113,8 +113,7 @@ public class ShoppingCartController { if (shoppingCart == null || shoppingCart.getGoodsId() == null || shoppingCart.getSku() == null || - shoppingCart.getNum() == null || - shoppingCart.getWhetherCheck() == null + shoppingCart.getNum() == null ) { log.error("GoodsDetailController -> insertProduct() error!"); throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); @@ -148,6 +147,7 @@ public class ShoppingCartController { shoppingCart.setImg(sku.getShowImg()); shoppingCart.setOriginalPrice(sku.getOriginalPrice()); shoppingCart.setLoseEfficacy(false); + shoppingCart.setWhetherCheck(true); shoppingCart.setPrice(sku.getPrice()); shoppingCart.setCreateTime(new Date()); shoppingCart.setUpdateTime(new Date()); @@ -249,4 +249,48 @@ public class ShoppingCartController { } + @RequestMapping(value = "/whetherCheck", method = RequestMethod.GET) + @ResponseBody + @ApiOperation(value = "是否选中") + public ResponseData whetherCheck( + @RequestParam(value = "ids", required = true) String ids, + @RequestParam(value = "whetherCheck", required = true) Boolean whetherCheck + , HttpServletRequest request + ) { + try { + + // 用户 + SessionObject sessionObject = userCenter.getSessionObject(request); + HighUserModel userInfoModel = (HighUserModel) sessionObject.getObject(); + + String[] idArray = ids.split(","); + + for (String id : idArray) { + GoodsShoppingCart shoppingCart = shoppingCartService.findShoppingCartById(Long.valueOf(id)); + + if (!Objects.equals(userInfoModel.getHighUser().getId(), shoppingCart.getUserId())) { + log.error("GoodsDetailController -> findGoodsDetailById() error!"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "用户信息错误"); + } + + if (shoppingCart == null) { + log.error("GoodsDetailController -> insertProduct() error!"); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到相关内容!"); + } + + shoppingCart.setWhetherCheck(whetherCheck); + shoppingCart.setUpdateTime(new Date()); + shoppingCartService.updateShoppingCart(shoppingCart); + } + + + + return ResponseMsgUtil.success("成功"); + + } catch (Exception e) { + log.error("GoodsDetailController --> findGoodsDetailById() error!", e); + return ResponseMsgUtil.exception(e); + } + } + } 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 ac5bcda2..817fd6ef 100644 --- a/hai-service/src/main/java/com/hai/config/RechargeConfig.java +++ b/hai-service/src/main/java/com/hai/config/RechargeConfig.java @@ -56,24 +56,30 @@ public class RechargeConfig { * @Param [com.alibaba.fastjson.JSONObject] * @return com.alibaba.fastjson.JSONObject */ - public static JSONObject rechargeOrderByLy(JSONObject object) throws Exception { + public static JSONObject rechargeOrderByLy(JSONObject object) { - Map paramMap = new HashMap<>(); + try { - paramMap.put("out_trade_num" , object.getString("out_trade_num")); - paramMap.put("product_id" , object.getString("product_id")); - paramMap.put("mobile" , object.getString("mobile")); - 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)); + Map paramMap = new HashMap<>(); - log.info("发起龙阅订单充值="); - log.info("龙阅订单充值-请求参数: " + JSON.toJSONString(paramMap)); + paramMap.put("out_trade_num" , object.getString("out_trade_num")); + paramMap.put("product_id" , object.getString("product_id")); + paramMap.put("mobile" , object.getString("mobile")); + 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)); - JSONObject jsonObject = HttpsUtils.doPost(CommonSysConst.getSysConfig().getLyPostUrl()+ "index/recharge", paramMap); + log.info("发起龙阅订单充值="); + log.info("龙阅订单充值-请求参数: " + JSON.toJSONString(paramMap)); - log.info("龙阅订单充值-响应参数: " + jsonObject.toJSONString()); - return jsonObject; + JSONObject jsonObject = HttpsUtils.doPost(CommonSysConst.getSysConfig().getLyPostUrl()+ "index/recharge", paramMap); + + log.info("龙阅订单充值-响应参数: " + jsonObject.toJSONString()); + return jsonObject; + + } catch (Exception e) { + return null; + } } @@ -112,27 +118,33 @@ public class RechargeConfig { * @Param [com.alibaba.fastjson.JSONObject] * @return com.alibaba.fastjson.JSONObject */ - public static JSONObject rechargeOrderByJj(JSONObject object) throws Exception { - - String timestamp = String.valueOf(System.currentTimeMillis()); - - Map map = new HashMap<>(); - map.put("mobile" , object.getString("mobile")); - map.put("amount" , object.getString("amount")); - map.put("out_order_id" , object.getString("out_order_id")); - map.put("app_key" , CommonSysConst.getSysConfig().getJjAppKey()); - 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); - - log.info("发起尖椒充值"); - log.info("尖椒订单充值-请求参数: " + JSON.toJSONString(map)); + public static JSONObject rechargeOrderByJj(JSONObject object) { + + try { + String timestamp = String.valueOf(System.currentTimeMillis()); + + Map map = new HashMap<>(); + map.put("mobile" , object.getString("mobile")); + map.put("amount" , object.getString("amount")); + map.put("out_order_id" , object.getString("out_order_id")); + map.put("app_key" , CommonSysConst.getSysConfig().getJjAppKey()); + 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); + + log.info("发起尖椒充值"); + log.info("尖椒订单充值-请求参数: " + JSON.toJSONString(map)); + + JSONObject jsonObject = HttpsUtils.doPost(CommonSysConst.getSysConfig().getJjUrl() + "createOrder" , map); + + log.info("尖椒订单充值-响应参数: " + jsonObject.toJSONString()); + return jsonObject; + } catch (Exception e) { + return null; + } - JSONObject jsonObject = HttpsUtils.doPost(CommonSysConst.getSysConfig().getJjUrl() + "createOrder" , map); - log.info("尖椒订单充值-响应参数: " + jsonObject.toJSONString()); - return jsonObject; } @@ -175,25 +187,30 @@ public class RechargeConfig { * @Param [object] * @Return com.alibaba.fastjson.JSONObject */ - public static JSONObject rechargeOrderByHg(JSONObject object) throws Exception { - Map paramMap = new HashMap<>(); - - paramMap.put("mchid" , CommonSysConst.getSysConfig().getHgMemberId()); - paramMap.put("phone" , object.getString("phone")); - paramMap.put("orderid" , object.getString("orderid")); - paramMap.put("price" , object.getInteger("price").toString()); - paramMap.put("product_id" , object.getString("product_id")); - paramMap.put("notify" , CommonSysConst.getSysConfig().getHgNotifyUrl()); - paramMap.put("sign", WxUtils.generateSignatureHg(paramMap , CommonSysConst.getSysConfig().getHgApiKey() , WXPayConstants.SignType.MD5)); - - log.info("发起畅停话费查询订单="); - log.info("畅停话费查询订单-请求参数: " + JSON.toJSONString(paramMap)); - - System.out.println("畅停话费查询订单-请求参数: " + JSON.toJSONString(paramMap)); - JSONObject repsObject = HttpsUtils.doPostForm(CommonSysConst.getSysConfig().getHgPostUrl()+ "external/api/telPay", paramSort(paramMap), new HashMap<>()); + public static JSONObject rechargeOrderByHg(JSONObject object) { + try { + Map paramMap = new HashMap<>(); + + paramMap.put("mchid" , CommonSysConst.getSysConfig().getHgMemberId()); + paramMap.put("phone" , object.getString("phone")); + paramMap.put("orderid" , object.getString("orderid")); + paramMap.put("price" , object.getInteger("price").toString()); + paramMap.put("product_id" , object.getString("product_id")); + paramMap.put("notify" , CommonSysConst.getSysConfig().getHgNotifyUrl()); + paramMap.put("sign", WxUtils.generateSignatureHg(paramMap , CommonSysConst.getSysConfig().getHgApiKey() , WXPayConstants.SignType.MD5)); + + log.info("发起畅停话费查询订单="); + log.info("畅停话费查询订单-请求参数: " + JSON.toJSONString(paramMap)); + + System.out.println("畅停话费查询订单-请求参数: " + JSON.toJSONString(paramMap)); + JSONObject repsObject = HttpsUtils.doPostForm(CommonSysConst.getSysConfig().getHgPostUrl()+ "external/api/telPay", paramSort(paramMap), new HashMap<>()); + + log.info("畅停话费查询订单-响应参数: " + repsObject.toJSONString()); + return repsObject; + }catch (Exception e) { + return null; + } - log.info("畅停话费查询订单-响应参数: " + repsObject.toJSONString()); - return repsObject; } /** diff --git a/hai-service/src/main/java/com/hai/goods/service/GoodsPresentService.java b/hai-service/src/main/java/com/hai/goods/service/GoodsPresentService.java index 55bd9b4e..1600be4b 100644 --- a/hai-service/src/main/java/com/hai/goods/service/GoodsPresentService.java +++ b/hai-service/src/main/java/com/hai/goods/service/GoodsPresentService.java @@ -2,6 +2,8 @@ package com.hai.goods.service; import com.hai.entity.GoodsPresent; import com.hai.entity.GoodsPresentRecord; +import com.hai.entity.HighChildOrder; +import com.hai.entity.HighOrder; import java.util.List; import java.util.Map; @@ -88,4 +90,6 @@ public interface GoodsPresentService { * @Return java.util.List */ List getPresentRecord(Map map); + + void presentUser(HighOrder order , HighChildOrder highChildOrder); } diff --git a/hai-service/src/main/java/com/hai/goods/service/impl/GoodsDetailServiceImpl.java b/hai-service/src/main/java/com/hai/goods/service/impl/GoodsDetailServiceImpl.java index d15c2ee9..b16cae50 100644 --- a/hai-service/src/main/java/com/hai/goods/service/impl/GoodsDetailServiceImpl.java +++ b/hai-service/src/main/java/com/hai/goods/service/impl/GoodsDetailServiceImpl.java @@ -21,9 +21,6 @@ public class GoodsDetailServiceImpl implements GoodsDetailService { @Resource private GoodsDetailMapper goodsDetailMapper; - @Resource - private GoodsLogisticsMapper logisticsMapper; - @Override public void insertGoodsDetail(GoodsDetail goodsDetail) { goodsDetailMapper.insert(goodsDetail); @@ -43,12 +40,18 @@ public class GoodsDetailServiceImpl implements GoodsDetailService { if (MapUtils.getString(map, "title") != null) { criteria.andNameLike("%" + MapUtils.getString(map, "title") + "%"); } + if (MapUtils.getString(map, "goodsLabel") != null) { + criteria.andGoodsLabelLike("%" + MapUtils.getString(map, "goodsLabel") + "%"); + } if (MapUtils.getLong(map, "goodsType") != null) { criteria.andGoodsTypeEqualTo(MapUtils.getLong(map, "goodsType") ); } if (MapUtils.getLong(map, "opId") != null) { criteria.andOpIdEqualTo(MapUtils.getLong(map, "opId") ); } + if (MapUtils.getLong(map, "companyId") != null) { + criteria.andCompanyIdEqualTo(MapUtils.getLong(map, "companyId") ); + } if (MapUtils.getInteger(map, "status") != null) { criteria.andStatusEqualTo(MapUtils.getInteger(map, "status") ); } else { diff --git a/hai-service/src/main/java/com/hai/goods/service/impl/GoodsPresentServiceImpl.java b/hai-service/src/main/java/com/hai/goods/service/impl/GoodsPresentServiceImpl.java index 9fb901a5..aee8543d 100644 --- a/hai-service/src/main/java/com/hai/goods/service/impl/GoodsPresentServiceImpl.java +++ b/hai-service/src/main/java/com/hai/goods/service/impl/GoodsPresentServiceImpl.java @@ -2,15 +2,17 @@ package com.hai.goods.service.impl; import com.hai.dao.GoodsPresentMapper; import com.hai.dao.GoodsPresentRecordMapper; -import com.hai.entity.GoodsPresent; -import com.hai.entity.GoodsPresentExample; -import com.hai.entity.GoodsPresentRecord; -import com.hai.entity.GoodsRegionFreight; +import com.hai.entity.*; import com.hai.goods.service.GoodsPresentService; +import com.hai.service.HighCouponCodeService; +import com.hai.service.HighCouponService; +import com.hai.service.HighDiscountAgentCodeService; import org.apache.commons.collections4.MapUtils; +import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.util.Date; import java.util.List; import java.util.Map; @@ -23,6 +25,18 @@ public class GoodsPresentServiceImpl implements GoodsPresentService { @Resource private GoodsPresentRecordMapper goodsPresentRecordMapper; + @Resource + private GoodsPresentService goodsPresentService; + + @Resource + private HighCouponService highCouponService; + + @Resource + private HighCouponCodeService couponCodeService; + + @Resource + private HighDiscountAgentCodeService highDiscountAgentCodeService; + @Override public void insertPresent(GoodsPresent present) { goodsPresentMapper.insert(present); @@ -78,4 +92,50 @@ public class GoodsPresentServiceImpl implements GoodsPresentService { public List getPresentRecord(Map map) { return null; } + + @Override + @Async + public void presentUser(HighOrder order, HighChildOrder highChildOrder) { + + try { + // 赠送卡券or优惠券 + List goodsPresents = goodsPresentService.getPresentList(highChildOrder.getGoodsId()); + + if (goodsPresents.size() > 0) { + for (int j = 0; j < highChildOrder.getSaleCount(); j++) { + for (GoodsPresent present : goodsPresents) { + GoodsPresentRecord presentRecord = new GoodsPresentRecord(); + presentRecord.setStatus("0"); + if (present.getType() == 1) { + for (int i = 0; i < present.getNum(); i++) { + HighCoupon coupon = highCouponService.getCouponById(present.getSourceId()); + // 支付购买卡券 + couponCodeService.payCoupon(order,highChildOrder,coupon); + } + } + if (present.getType() == 2) { + highDiscountAgentCodeService.giveDiscount(present.getSourceId() , Long.valueOf(present.getNum()), order.getMemId()); + } + + presentRecord.setOrderNo(order.getOrderNo()); + presentRecord.setOrderId(order.getId()); + presentRecord.setChildOrderId(highChildOrder.getOrderId()); + presentRecord.setCreateTime(new Date()); + presentRecord.setNum(presentRecord.getNum()); + presentRecord.setUpdateTime(new Date()); + presentRecord.setType(present.getType()); + presentRecord.setStatus("1"); + presentRecord.setSourceId(present.getSourceId()); + presentRecord.setSourceName(present.getSourceName()); + presentRecord.setOpName("系统赠送"); + presentRecord.setPresentId(present.getId()); + + goodsPresentService.insertPresentRecord(presentRecord); + } + } + } + } catch (Exception e) { + + } + } } 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 2b28b6ba..cb282846 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 @@ -953,21 +953,21 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService { goodsSkuService.decreaseStockNum(createOrderChild.getSkuId(), createOrderChild.getSaleCount()); - List goodsPresents = goodsPresentService.getPresentList(childOrder.getGoodsId()); - - - if (goodsPresents.size() > 0) { - for (GoodsPresent present : goodsPresents) { - GoodsPresentRecord presentRecord = new GoodsPresentRecord(); - presentRecord.setStatus("0"); - if (present.getType() == 1) { - for (int i = 0; i < present.getNum(); i++) { - couponService.assignOrderStock(present.getSourceId(), childOrder.getChildOrderNo()); - } - } - - } - } +// List goodsPresents = goodsPresentService.getPresentList(childOrder.getGoodsId()); +// +// +//// if (goodsPresents.size() > 0) { +//// for (int j = 0; j < childOrder.getSaleCount(); j++) { +//// for (GoodsPresent present : goodsPresents) { +//// if (present.getType() == 1) { +//// for (int i = 0; i < present.getNum(); i++) { +//// couponService.assignOrderStock(present.getSourceId(), childOrder.getChildOrderNo()); +//// } +//// } +//// +//// } +//// } +//// } return childOrder; } 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 9037f58e..2da87f62 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 @@ -74,8 +74,7 @@ public class OrderPaySuccessServiceImpl implements OrderPaySuccessService { @Resource private JinZhuJiaYouService jinZhuJiaYouService; - @Resource - private HighDiscountAgentCodeService highDiscountAgentCodeService; + @Resource private PayloService payloService; @@ -108,10 +107,9 @@ public class OrderPaySuccessServiceImpl implements OrderPaySuccessService { private OutRechargeOrderService outRechargeOrderService; @Resource - private GoodsPresentService goodsPresentService; + private GoodsPresentService presentService; + - @Resource - private HighCouponService highCouponService; @Override public HighOrder orderPaySuccessHandle(String orderNo, OrderPayType payType, String paySerialNo, BigDecimal payRealPrice, HighUserCard userCard) { @@ -516,47 +514,12 @@ public class OrderPaySuccessServiceImpl implements OrderPaySuccessService { * @Param [order] * @Return void */ - private void goodsRecharge(HighOrder order , HighChildOrder highChildOrder) throws Exception { + private void goodsRecharge(HighOrder order , HighChildOrder highChildOrder) { GoodsOrder goodsOrder = goodsOrderExtService.findGoodsOrder(order.getOrderNo()); goodsOrder.setUpdateTime(new Date()); goodsOrder.setStatus("1"); goodsOrderExtService.updateGoodsOrder(goodsOrder); - - // 赠送卡券or优惠券 - List goodsPresents = goodsPresentService.getPresentList(highChildOrder.getGoodsId()); - - if (goodsPresents.size() > 0) { - for (GoodsPresent present : goodsPresents) { - GoodsPresentRecord presentRecord = new GoodsPresentRecord(); - presentRecord.setStatus("0"); - if (present.getType() == 1) { - for (int i = 0; i < present.getNum(); i++) { - HighCoupon coupon = highCouponService.getCouponById(present.getSourceId()); - // 支付购买卡券 - couponCodeService.payCoupon(order,highChildOrder,coupon); - } - } - if (present.getType() == 2) { - highDiscountAgentCodeService.giveDiscount(present.getSourceId() , Long.valueOf(present.getNum()), order.getMemId()); - } - - presentRecord.setOrderNo(order.getOrderNo()); - presentRecord.setOrderId(order.getId()); - presentRecord.setChildOrderId(highChildOrder.getOrderId()); - presentRecord.setCreateTime(new Date()); - presentRecord.setNum(presentRecord.getNum()); - presentRecord.setUpdateTime(new Date()); - presentRecord.setType(present.getType()); - presentRecord.setStatus("1"); - presentRecord.setSourceId(present.getSourceId()); - presentRecord.setSourceName(present.getSourceName()); - presentRecord.setOpName("系统赠送"); - presentRecord.setPresentId(present.getId()); - - goodsPresentService.insertPresentRecord(presentRecord); - } - } - + presentService.presentUser(order , highChildOrder); } } 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 9f6dcfcd..c5913677 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 @@ -127,7 +127,7 @@ public class OrderServiceImpl implements OrderService { @Transactional( propagation= Propagation.REQUIRES_NEW, isolation = Isolation.READ_COMMITTED, - timeout = 10, + timeout = 20, rollbackFor = Exception.class) @Cached(cacheType = CacheType.REMOTE, name="order:", key = "#createOrderModel.orderNo", expire = 3600*24*30) // 缓存一个月 public HighOrder createOrder(CreateOrderModel createOrderModel) throws Exception { @@ -604,61 +604,68 @@ public class OrderServiceImpl implements OrderService { timeout = 25, rollbackFor = Exception.class) @CacheUpdate(name = "order:", key = "#order.orderNo", value = "#order") - public HighOrder refundOrder(HighOrder order, String remarks, OrderRefundOpUserType opUserType, Long opUserId, String opUserName) throws Exception { - if (!order.getOrderStatus().equals(OrderStatus.STATUS2.getNumber()) - && !order.getOrderStatus().equals(OrderStatus.STATUS3.getNumber())) { - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "订单状态错误"); - } - // 订单是否异常,订单没异常则需要校验产品业务是否支持退款 - if (order.getExceptionStatus().equals(false) - // 产品业务是否支付退款 - && (order.getProductType().equals(OrderProductType.PRODUCT_TYPE3.getNumber()) - || order.getProductType().equals(OrderProductType.PRODUCT_TYPE4.getNumber()) - || order.getProductType().equals(OrderProductType.PRODUCT_TYPE5.getNumber())) - ) { - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "订单无法退款!"); - } - - // 退款订单号 - String refundOrderNo = OrderUtil.generateRefundOrderNo(); + public HighOrder refundOrder(HighOrder order, String remarks, OrderRefundOpUserType opUserType, Long opUserId, String opUserName) { - // 创建退款 - order = orderRefundService.createOrderRefund(refundOrderNo, order, remarks, opUserType, opUserId, opUserName); + try { - for (HighChildOrder childOrder : order.getHighChildOrderList()) { - if (childOrder.getGiveawayType() == false) { - childOrder.setRefundRemarks(remarks); - childOrder.setRefundTime(new Date()); - childOrder.setChildOrderStatus(OrderChildStatus.STATUS4.getNumber()); + if (!order.getOrderStatus().equals(OrderStatus.STATUS2.getNumber()) + && !order.getOrderStatus().equals(OrderStatus.STATUS3.getNumber())) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "订单状态错误"); + } + // 订单是否异常,订单没异常则需要校验产品业务是否支持退款 + if (order.getExceptionStatus().equals(false) + // 产品业务是否支付退款 + && (order.getProductType().equals(OrderProductType.PRODUCT_TYPE3.getNumber()) + || order.getProductType().equals(OrderProductType.PRODUCT_TYPE4.getNumber()) + || order.getProductType().equals(OrderProductType.PRODUCT_TYPE5.getNumber())) + ) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "订单无法退款!"); } - } + // 退款订单号 + String refundOrderNo = OrderUtil.generateRefundOrderNo(); - order.setSurplusRefundIntegral(0); - order.setSurplusRefundPrice(new BigDecimal("0")); - order.setRefundTime(new Date()); - order.setOrderStatus(OrderStatus.STATUS4.getNumber()); + // 创建退款 + order = orderRefundService.createOrderRefund(refundOrderNo, order, remarks, opUserType, opUserId, opUserName); - // 退回金额,原路返回 - RefundPriceModel refundPrice = orderRefundService.refundPrice(refundOrderNo - , order - , OrderPayType.getDataByType(order.getPayType()) - , order.getPayRealPrice() - , order.getPayGold()); - if (!refundPrice.getRefundSuccess()) { - throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "退款失败,请稍后重试"); - } + for (HighChildOrder childOrder : order.getHighChildOrderList()) { + if (childOrder.getGiveawayType() == false) { + childOrder.setRefundRemarks(remarks); + childOrder.setRefundTime(new Date()); + childOrder.setChildOrderStatus(OrderChildStatus.STATUS4.getNumber()); + } + + } + + order.setSurplusRefundIntegral(0); + order.setSurplusRefundPrice(new BigDecimal("0")); + order.setRefundTime(new Date()); + order.setOrderStatus(OrderStatus.STATUS4.getNumber()); + + // 退回金额,原路返回 + RefundPriceModel refundPrice = orderRefundService.refundPrice(refundOrderNo + , order + , OrderPayType.getDataByType(order.getPayType()) + , order.getPayRealPrice() + , order.getPayGold()); + if (!refundPrice.getRefundSuccess()) { + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "退款失败,请稍后重试"); + } - List refundList = orderRefundService.getRefundByRefundNo(refundOrderNo); - for (HighOrderRefund orderRefund : refundList) { - orderRefund.setRefundStatus(OrderRefundStatus.STATUS2.getNumber()); - orderRefund.setRefundTime(new Date()); - orderRefund.setThirdPartyRefundOrderNo(refundPrice.getThirdPartyRefundOrderNo()); - orderRefundService.update(orderRefund); + List refundList = orderRefundService.getRefundByRefundNo(refundOrderNo); + for (HighOrderRefund orderRefund : refundList) { + orderRefund.setRefundStatus(OrderRefundStatus.STATUS2.getNumber()); + orderRefund.setRefundTime(new Date()); + orderRefund.setThirdPartyRefundOrderNo(refundPrice.getThirdPartyRefundOrderNo()); + orderRefundService.update(orderRefund); - rocketMQTemplate.syncSend(OrderTopic.ORDER_TOPIC_REFUND_SUCCESS.getTopic(), orderRefund); + rocketMQTemplate.syncSend(OrderTopic.ORDER_TOPIC_REFUND_SUCCESS.getTopic(), orderRefund); + } + return updateOrderData(order); + } catch (Exception e) { + return null; } - return updateOrderData(order); + } @Override diff --git a/hai-service/src/main/java/com/hai/service/impl/HighDiscountAgentCodeServiceImpl.java b/hai-service/src/main/java/com/hai/service/impl/HighDiscountAgentCodeServiceImpl.java index 3b0d2322..ac863337 100644 --- a/hai-service/src/main/java/com/hai/service/impl/HighDiscountAgentCodeServiceImpl.java +++ b/hai-service/src/main/java/com/hai/service/impl/HighDiscountAgentCodeServiceImpl.java @@ -325,6 +325,10 @@ public class HighDiscountAgentCodeServiceImpl implements HighDiscountAgentCodeSe highDiscountUserRel.setStatus(1); highDiscountUserRel.setCreateTime(new Date()); highDiscountUserRel.setDiscountCompanyId(discount.getCompanyId()); + highDiscountUserRel.setDiscountUseScope(discount.getUseScope()); + highDiscountUserRel.setDiscountUsingRange(discount.getUsingRange()); + highDiscountUserRel.setDiscountCondition(discount.getDiscountCondition()); + highDiscountUserRel.setDiscountType(discount.getDiscountType()); highDiscountUserRel.setDiscountImg(discount.getDiscountImg()); highDiscountUserRel.setDiscountName(discount.getDiscountName()); highDiscountUserRel.setDiscountCondition(discount.getDiscountCondition()); diff --git a/v1/src/main/java/com/v1/controller/WxMsgController.java b/v1/src/main/java/com/v1/controller/WxMsgController.java index 650618e4..ef928d4d 100644 --- a/v1/src/main/java/com/v1/controller/WxMsgController.java +++ b/v1/src/main/java/com/v1/controller/WxMsgController.java @@ -535,6 +535,32 @@ public class WxMsgController { } + @RequestMapping(value = "/createMenu", method = RequestMethod.POST) + @ResponseBody + @ApiOperation(value = "创建菜单") + public ResponseData createMenu(@RequestBody JSONObject object) { + try { + Map params = new HashMap<>(); + params.put("appid", SysConst.getSysConfig().getWxH5AppId()); + params.put("secret", SysConst.getSysConfig().getWxH5AppSecret()); + params.put("grant_type", "client_credential"); + + JSONObject accessTokenObject = HttpsUtils.doGet("https://api.weixin.qq.com/cgi-bin/token", params); + if (accessTokenObject == null) { + log.error("getH5UserInfo error!", "获取微信access_token失败" ); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "获取微信access_token失败"); + } + + JSONObject jsonObject = HttpsUtils.doPost("https://api.weixin.qq.com/cgi-bin/menu/create?access_token=" + accessTokenObject.getString("access_token"), object); + + return ResponseMsgUtil.success(jsonObject); + + } catch (Exception e) { + return ResponseMsgUtil.exception(e); + } + } + + // @RequestMapping(value = "/verifyWx", method = RequestMethod.GET) // @ResponseBody