提交实物代码

new-dev
袁野 2 years ago
parent 76e47530dd
commit d9644e41da
  1. 4
      hai-bweb/src/main/java/com/bweb/controller/Goods/GoodsDetailController.java
  2. 8
      hai-cweb/src/main/java/com/cweb/controller/CmsContentController.java
  3. 4
      hai-cweb/src/main/java/com/cweb/controller/Goods/GoodsController.java
  4. 48
      hai-cweb/src/main/java/com/cweb/controller/Goods/ShoppingCartController.java
  5. 117
      hai-service/src/main/java/com/hai/config/RechargeConfig.java
  6. 4
      hai-service/src/main/java/com/hai/goods/service/GoodsPresentService.java
  7. 9
      hai-service/src/main/java/com/hai/goods/service/impl/GoodsDetailServiceImpl.java
  8. 68
      hai-service/src/main/java/com/hai/goods/service/impl/GoodsPresentServiceImpl.java
  9. 30
      hai-service/src/main/java/com/hai/order/service/impl/OrderCreateHandleServiceImpl.java
  10. 47
      hai-service/src/main/java/com/hai/order/service/impl/OrderPaySuccessServiceImpl.java
  11. 101
      hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java
  12. 4
      hai-service/src/main/java/com/hai/service/impl/HighDiscountAgentCodeServiceImpl.java
  13. 26
      v1/src/main/java/com/v1/controller/WxMsgController.java

@ -60,6 +60,7 @@ public class GoodsDetailController {
public ResponseData getListGoodsDetail( public ResponseData getListGoodsDetail(
@RequestParam(value = "title", required = false) String title, @RequestParam(value = "title", required = false) String title,
@RequestParam(value = "status", required = false) Integer status, @RequestParam(value = "status", required = false) Integer status,
@RequestParam(value = "goodsLabel", required = false) String goodsLabel,
@RequestParam(name = "pageNum", required = true) Integer pageNum, @RequestParam(name = "pageNum", required = true) Integer pageNum,
@RequestParam(name = "pageSize", required = true) Integer pageSize @RequestParam(name = "pageSize", required = true) Integer pageSize
, HttpServletRequest request , HttpServletRequest request
@ -73,11 +74,14 @@ public class GoodsDetailController {
map.put("title", title); map.put("title", title);
map.put("status", status); map.put("status", status);
map.put("goodsLabel", goodsLabel);
map.put("companyId", userInfoModel.getBsCompany().getId());
if (userInfoModel.getSecUser().getExt3() != null) { if (userInfoModel.getSecUser().getExt3() != null) {
map.put("opId" , userInfoModel.getSecUser().getId()); map.put("opId" , userInfoModel.getSecUser().getId());
} }
PageHelper.startPage(pageNum,pageSize); PageHelper.startPage(pageNum,pageSize);
List<GoodsDetail> list = goodsDetailService.getGoodsDetailList(map); List<GoodsDetail> list = goodsDetailService.getGoodsDetailList(map);

@ -86,7 +86,6 @@ public class CmsContentController {
List<JSONObject> objectList = new ArrayList<>(); List<JSONObject> objectList = new ArrayList<>();
for (CmsCategory cmsCategory : categoryList) { for (CmsCategory cmsCategory : categoryList) {
JSONObject object = new JSONObject(); JSONObject object = new JSONObject();
// 1.小图一行四个 2.轮播图 3.消息通知 4.大图展示 5.一横图三小图 6.数据库数据 7.小图一行五个 // 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 (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); objectList.add(object);
} }
} else { } else {
objectList.add(object); if (object.getJSONArray("childCategory").size() >0 ) {
objectList.add(object);
}
} }
} }
return ResponseMsgUtil.success(dataWhetherNull ? null:objectList); return ResponseMsgUtil.success(dataWhetherNull ? null:objectList);

@ -64,6 +64,8 @@ public class GoodsController {
@RequestParam(value = "title", required = false) String title, @RequestParam(value = "title", required = false) String title,
@RequestParam(value = "goodsType", required = false) Long goodsType, @RequestParam(value = "goodsType", required = false) Long goodsType,
@RequestParam(value = "price", required = false) Integer price, @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 = "pageNum", required = true) Integer pageNum,
@RequestParam(name = "pageSize", required = true) Integer pageSize @RequestParam(name = "pageSize", required = true) Integer pageSize
) { ) {
@ -74,6 +76,8 @@ public class GoodsController {
map.put("title", title); map.put("title", title);
map.put("goodsType", goodsType); map.put("goodsType", goodsType);
map.put("companyId", companyId);
map.put("goodsLabel", goodsLabel);
map.put("status", 1); map.put("status", 1);

@ -113,8 +113,7 @@ public class ShoppingCartController {
if (shoppingCart == null || if (shoppingCart == null ||
shoppingCart.getGoodsId() == null || shoppingCart.getGoodsId() == null ||
shoppingCart.getSku() == null || shoppingCart.getSku() == null ||
shoppingCart.getNum() == null || shoppingCart.getNum() == null
shoppingCart.getWhetherCheck() == null
) { ) {
log.error("GoodsDetailController -> insertProduct() error!"); log.error("GoodsDetailController -> insertProduct() error!");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
@ -148,6 +147,7 @@ public class ShoppingCartController {
shoppingCart.setImg(sku.getShowImg()); shoppingCart.setImg(sku.getShowImg());
shoppingCart.setOriginalPrice(sku.getOriginalPrice()); shoppingCart.setOriginalPrice(sku.getOriginalPrice());
shoppingCart.setLoseEfficacy(false); shoppingCart.setLoseEfficacy(false);
shoppingCart.setWhetherCheck(true);
shoppingCart.setPrice(sku.getPrice()); shoppingCart.setPrice(sku.getPrice());
shoppingCart.setCreateTime(new Date()); shoppingCart.setCreateTime(new Date());
shoppingCart.setUpdateTime(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);
}
}
} }

@ -56,24 +56,30 @@ public class RechargeConfig {
* @Param [com.alibaba.fastjson.JSONObject] * @Param [com.alibaba.fastjson.JSONObject]
* @return com.alibaba.fastjson.JSONObject * @return com.alibaba.fastjson.JSONObject
*/ */
public static JSONObject rechargeOrderByLy(JSONObject object) throws Exception { public static JSONObject rechargeOrderByLy(JSONObject object) {
Map<String,Object> paramMap = new HashMap<>(); try {
paramMap.put("out_trade_num" , object.getString("out_trade_num")); Map<String,Object> paramMap = new HashMap<>();
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));
log.info("发起龙阅订单充值="); paramMap.put("out_trade_num" , object.getString("out_trade_num"));
log.info("龙阅订单充值-请求参数: " + JSON.toJSONString(paramMap)); 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()); JSONObject jsonObject = HttpsUtils.doPost(CommonSysConst.getSysConfig().getLyPostUrl()+ "index/recharge", paramMap);
return jsonObject;
log.info("龙阅订单充值-响应参数: " + jsonObject.toJSONString());
return jsonObject;
} catch (Exception e) {
return null;
}
} }
@ -112,27 +118,33 @@ public class RechargeConfig {
* @Param [com.alibaba.fastjson.JSONObject] * @Param [com.alibaba.fastjson.JSONObject]
* @return com.alibaba.fastjson.JSONObject * @return com.alibaba.fastjson.JSONObject
*/ */
public static JSONObject rechargeOrderByJj(JSONObject object) throws Exception { public static JSONObject rechargeOrderByJj(JSONObject object) {
String timestamp = String.valueOf(System.currentTimeMillis()); try {
String timestamp = String.valueOf(System.currentTimeMillis());
Map<String , Object> map = new HashMap<>();
map.put("mobile" , object.getString("mobile")); Map<String , Object> map = new HashMap<>();
map.put("amount" , object.getString("amount")); map.put("mobile" , object.getString("mobile"));
map.put("out_order_id" , object.getString("out_order_id")); map.put("amount" , object.getString("amount"));
map.put("app_key" , CommonSysConst.getSysConfig().getJjAppKey()); map.put("out_order_id" , object.getString("out_order_id"));
map.put("timestamp" , timestamp.substring(0,timestamp.length()-3)); map.put("app_key" , CommonSysConst.getSysConfig().getJjAppKey());
map.put("notify_url" , object.getString("notifyUrl")); map.put("timestamp" , timestamp.substring(0,timestamp.length()-3));
String signStr = WxUtils.generateSignatureAppSecret(map, CommonSysConst.getSysConfig().getJjAppSecret() , WXPayConstants.SignType.MD5); map.put("notify_url" , object.getString("notifyUrl"));
map.put("sign" , signStr); String signStr = WxUtils.generateSignatureAppSecret(map, CommonSysConst.getSysConfig().getJjAppSecret() , WXPayConstants.SignType.MD5);
map.put("sign" , signStr);
log.info("发起尖椒充值");
log.info("尖椒订单充值-请求参数: " + JSON.toJSONString(map)); 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] * @Param [object]
* @Return com.alibaba.fastjson.JSONObject * @Return com.alibaba.fastjson.JSONObject
*/ */
public static JSONObject rechargeOrderByHg(JSONObject object) throws Exception { public static JSONObject rechargeOrderByHg(JSONObject object) {
Map<String,Object> paramMap = new HashMap<>(); try {
Map<String,Object> paramMap = new HashMap<>();
paramMap.put("mchid" , CommonSysConst.getSysConfig().getHgMemberId());
paramMap.put("phone" , object.getString("phone")); paramMap.put("mchid" , CommonSysConst.getSysConfig().getHgMemberId());
paramMap.put("orderid" , object.getString("orderid")); paramMap.put("phone" , object.getString("phone"));
paramMap.put("price" , object.getInteger("price").toString()); paramMap.put("orderid" , object.getString("orderid"));
paramMap.put("product_id" , object.getString("product_id")); paramMap.put("price" , object.getInteger("price").toString());
paramMap.put("notify" , CommonSysConst.getSysConfig().getHgNotifyUrl()); paramMap.put("product_id" , object.getString("product_id"));
paramMap.put("sign", WxUtils.generateSignatureHg(paramMap , CommonSysConst.getSysConfig().getHgApiKey() , WXPayConstants.SignType.MD5)); 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)); 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<>()); 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;
} }
/** /**

@ -2,6 +2,8 @@ package com.hai.goods.service;
import com.hai.entity.GoodsPresent; import com.hai.entity.GoodsPresent;
import com.hai.entity.GoodsPresentRecord; import com.hai.entity.GoodsPresentRecord;
import com.hai.entity.HighChildOrder;
import com.hai.entity.HighOrder;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -88,4 +90,6 @@ public interface GoodsPresentService {
* @Return java.util.List<com.hai.entity.GoodsPresentRecord> * @Return java.util.List<com.hai.entity.GoodsPresentRecord>
*/ */
List<GoodsPresentRecord> getPresentRecord(Map<String , Object> map); List<GoodsPresentRecord> getPresentRecord(Map<String , Object> map);
void presentUser(HighOrder order , HighChildOrder highChildOrder);
} }

@ -21,9 +21,6 @@ public class GoodsDetailServiceImpl implements GoodsDetailService {
@Resource @Resource
private GoodsDetailMapper goodsDetailMapper; private GoodsDetailMapper goodsDetailMapper;
@Resource
private GoodsLogisticsMapper logisticsMapper;
@Override @Override
public void insertGoodsDetail(GoodsDetail goodsDetail) { public void insertGoodsDetail(GoodsDetail goodsDetail) {
goodsDetailMapper.insert(goodsDetail); goodsDetailMapper.insert(goodsDetail);
@ -43,12 +40,18 @@ public class GoodsDetailServiceImpl implements GoodsDetailService {
if (MapUtils.getString(map, "title") != null) { if (MapUtils.getString(map, "title") != null) {
criteria.andNameLike("%" + MapUtils.getString(map, "title") + "%"); criteria.andNameLike("%" + MapUtils.getString(map, "title") + "%");
} }
if (MapUtils.getString(map, "goodsLabel") != null) {
criteria.andGoodsLabelLike("%" + MapUtils.getString(map, "goodsLabel") + "%");
}
if (MapUtils.getLong(map, "goodsType") != null) { if (MapUtils.getLong(map, "goodsType") != null) {
criteria.andGoodsTypeEqualTo(MapUtils.getLong(map, "goodsType") ); criteria.andGoodsTypeEqualTo(MapUtils.getLong(map, "goodsType") );
} }
if (MapUtils.getLong(map, "opId") != null) { if (MapUtils.getLong(map, "opId") != null) {
criteria.andOpIdEqualTo(MapUtils.getLong(map, "opId") ); criteria.andOpIdEqualTo(MapUtils.getLong(map, "opId") );
} }
if (MapUtils.getLong(map, "companyId") != null) {
criteria.andCompanyIdEqualTo(MapUtils.getLong(map, "companyId") );
}
if (MapUtils.getInteger(map, "status") != null) { if (MapUtils.getInteger(map, "status") != null) {
criteria.andStatusEqualTo(MapUtils.getInteger(map, "status") ); criteria.andStatusEqualTo(MapUtils.getInteger(map, "status") );
} else { } else {

@ -2,15 +2,17 @@ package com.hai.goods.service.impl;
import com.hai.dao.GoodsPresentMapper; import com.hai.dao.GoodsPresentMapper;
import com.hai.dao.GoodsPresentRecordMapper; import com.hai.dao.GoodsPresentRecordMapper;
import com.hai.entity.GoodsPresent; import com.hai.entity.*;
import com.hai.entity.GoodsPresentExample;
import com.hai.entity.GoodsPresentRecord;
import com.hai.entity.GoodsRegionFreight;
import com.hai.goods.service.GoodsPresentService; 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.apache.commons.collections4.MapUtils;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -23,6 +25,18 @@ public class GoodsPresentServiceImpl implements GoodsPresentService {
@Resource @Resource
private GoodsPresentRecordMapper goodsPresentRecordMapper; private GoodsPresentRecordMapper goodsPresentRecordMapper;
@Resource
private GoodsPresentService goodsPresentService;
@Resource
private HighCouponService highCouponService;
@Resource
private HighCouponCodeService couponCodeService;
@Resource
private HighDiscountAgentCodeService highDiscountAgentCodeService;
@Override @Override
public void insertPresent(GoodsPresent present) { public void insertPresent(GoodsPresent present) {
goodsPresentMapper.insert(present); goodsPresentMapper.insert(present);
@ -78,4 +92,50 @@ public class GoodsPresentServiceImpl implements GoodsPresentService {
public List<GoodsPresentRecord> getPresentRecord(Map<String, Object> map) { public List<GoodsPresentRecord> getPresentRecord(Map<String, Object> map) {
return null; return null;
} }
@Override
@Async
public void presentUser(HighOrder order, HighChildOrder highChildOrder) {
try {
// 赠送卡券or优惠券
List<GoodsPresent> 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) {
}
}
} }

@ -953,21 +953,21 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService {
goodsSkuService.decreaseStockNum(createOrderChild.getSkuId(), createOrderChild.getSaleCount()); goodsSkuService.decreaseStockNum(createOrderChild.getSkuId(), createOrderChild.getSaleCount());
List<GoodsPresent> goodsPresents = goodsPresentService.getPresentList(childOrder.getGoodsId()); // List<GoodsPresent> goodsPresents = goodsPresentService.getPresentList(childOrder.getGoodsId());
//
//
if (goodsPresents.size() > 0) { //// if (goodsPresents.size() > 0) {
for (GoodsPresent present : goodsPresents) { //// for (int j = 0; j < childOrder.getSaleCount(); j++) {
GoodsPresentRecord presentRecord = new GoodsPresentRecord(); //// for (GoodsPresent present : goodsPresents) {
presentRecord.setStatus("0"); //// if (present.getType() == 1) {
if (present.getType() == 1) { //// for (int i = 0; i < present.getNum(); i++) {
for (int i = 0; i < present.getNum(); i++) { //// couponService.assignOrderStock(present.getSourceId(), childOrder.getChildOrderNo());
couponService.assignOrderStock(present.getSourceId(), childOrder.getChildOrderNo()); //// }
} //// }
} ////
//// }
} //// }
} //// }
return childOrder; return childOrder;
} }

@ -74,8 +74,7 @@ public class OrderPaySuccessServiceImpl implements OrderPaySuccessService {
@Resource @Resource
private JinZhuJiaYouService jinZhuJiaYouService; private JinZhuJiaYouService jinZhuJiaYouService;
@Resource
private HighDiscountAgentCodeService highDiscountAgentCodeService;
@Resource @Resource
private PayloService payloService; private PayloService payloService;
@ -108,10 +107,9 @@ public class OrderPaySuccessServiceImpl implements OrderPaySuccessService {
private OutRechargeOrderService outRechargeOrderService; private OutRechargeOrderService outRechargeOrderService;
@Resource @Resource
private GoodsPresentService goodsPresentService; private GoodsPresentService presentService;
@Resource
private HighCouponService highCouponService;
@Override @Override
public HighOrder orderPaySuccessHandle(String orderNo, OrderPayType payType, String paySerialNo, BigDecimal payRealPrice, HighUserCard userCard) { public HighOrder orderPaySuccessHandle(String orderNo, OrderPayType payType, String paySerialNo, BigDecimal payRealPrice, HighUserCard userCard) {
@ -516,47 +514,12 @@ public class OrderPaySuccessServiceImpl implements OrderPaySuccessService {
* @Param [order] * @Param [order]
* @Return void * @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 goodsOrder = goodsOrderExtService.findGoodsOrder(order.getOrderNo());
goodsOrder.setUpdateTime(new Date()); goodsOrder.setUpdateTime(new Date());
goodsOrder.setStatus("1"); goodsOrder.setStatus("1");
goodsOrderExtService.updateGoodsOrder(goodsOrder); goodsOrderExtService.updateGoodsOrder(goodsOrder);
presentService.presentUser(order , highChildOrder);
// 赠送卡券or优惠券
List<GoodsPresent> 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);
}
}
} }
} }

@ -127,7 +127,7 @@ public class OrderServiceImpl implements OrderService {
@Transactional( @Transactional(
propagation= Propagation.REQUIRES_NEW, propagation= Propagation.REQUIRES_NEW,
isolation = Isolation.READ_COMMITTED, isolation = Isolation.READ_COMMITTED,
timeout = 10, timeout = 20,
rollbackFor = Exception.class) rollbackFor = Exception.class)
@Cached(cacheType = CacheType.REMOTE, name="order:", key = "#createOrderModel.orderNo", expire = 3600*24*30) // 缓存一个月 @Cached(cacheType = CacheType.REMOTE, name="order:", key = "#createOrderModel.orderNo", expire = 3600*24*30) // 缓存一个月
public HighOrder createOrder(CreateOrderModel createOrderModel) throws Exception { public HighOrder createOrder(CreateOrderModel createOrderModel) throws Exception {
@ -604,61 +604,68 @@ public class OrderServiceImpl implements OrderService {
timeout = 25, timeout = 25,
rollbackFor = Exception.class) rollbackFor = Exception.class)
@CacheUpdate(name = "order:", key = "#order.orderNo", value = "#order") @CacheUpdate(name = "order:", key = "#order.orderNo", value = "#order")
public HighOrder refundOrder(HighOrder order, String remarks, OrderRefundOpUserType opUserType, Long opUserId, String opUserName) throws Exception { public HighOrder refundOrder(HighOrder order, String remarks, OrderRefundOpUserType opUserType, Long opUserId, String opUserName) {
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();
// 创建退款 try {
order = orderRefundService.createOrderRefund(refundOrderNo, order, remarks, opUserType, opUserId, opUserName);
for (HighChildOrder childOrder : order.getHighChildOrderList()) { if (!order.getOrderStatus().equals(OrderStatus.STATUS2.getNumber())
if (childOrder.getGiveawayType() == false) { && !order.getOrderStatus().equals(OrderStatus.STATUS3.getNumber())) {
childOrder.setRefundRemarks(remarks); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "订单状态错误");
childOrder.setRefundTime(new Date()); }
childOrder.setChildOrderStatus(OrderChildStatus.STATUS4.getNumber()); // 订单是否异常,订单没异常则需要校验产品业务是否支持退款
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 = orderRefundService.createOrderRefund(refundOrderNo, order, remarks, opUserType, opUserId, opUserName);
order.setRefundTime(new Date());
order.setOrderStatus(OrderStatus.STATUS4.getNumber());
// 退回金额,原路返回 for (HighChildOrder childOrder : order.getHighChildOrderList()) {
RefundPriceModel refundPrice = orderRefundService.refundPrice(refundOrderNo if (childOrder.getGiveawayType() == false) {
, order childOrder.setRefundRemarks(remarks);
, OrderPayType.getDataByType(order.getPayType()) childOrder.setRefundTime(new Date());
, order.getPayRealPrice() childOrder.setChildOrderStatus(OrderChildStatus.STATUS4.getNumber());
, order.getPayGold()); }
if (!refundPrice.getRefundSuccess()) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "退款失败,请稍后重试"); }
}
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<HighOrderRefund> refundList = orderRefundService.getRefundByRefundNo(refundOrderNo); List<HighOrderRefund> refundList = orderRefundService.getRefundByRefundNo(refundOrderNo);
for (HighOrderRefund orderRefund : refundList) { for (HighOrderRefund orderRefund : refundList) {
orderRefund.setRefundStatus(OrderRefundStatus.STATUS2.getNumber()); orderRefund.setRefundStatus(OrderRefundStatus.STATUS2.getNumber());
orderRefund.setRefundTime(new Date()); orderRefund.setRefundTime(new Date());
orderRefund.setThirdPartyRefundOrderNo(refundPrice.getThirdPartyRefundOrderNo()); orderRefund.setThirdPartyRefundOrderNo(refundPrice.getThirdPartyRefundOrderNo());
orderRefundService.update(orderRefund); 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 @Override

@ -325,6 +325,10 @@ public class HighDiscountAgentCodeServiceImpl implements HighDiscountAgentCodeSe
highDiscountUserRel.setStatus(1); highDiscountUserRel.setStatus(1);
highDiscountUserRel.setCreateTime(new Date()); highDiscountUserRel.setCreateTime(new Date());
highDiscountUserRel.setDiscountCompanyId(discount.getCompanyId()); 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.setDiscountImg(discount.getDiscountImg());
highDiscountUserRel.setDiscountName(discount.getDiscountName()); highDiscountUserRel.setDiscountName(discount.getDiscountName());
highDiscountUserRel.setDiscountCondition(discount.getDiscountCondition()); highDiscountUserRel.setDiscountCondition(discount.getDiscountCondition());

@ -535,6 +535,32 @@ public class WxMsgController {
} }
@RequestMapping(value = "/createMenu", method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "创建菜单")
public ResponseData createMenu(@RequestBody JSONObject object) {
try {
Map<String, Object> 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) // @RequestMapping(value = "/verifyWx", method = RequestMethod.GET)
// @ResponseBody // @ResponseBody

Loading…
Cancel
Save