Merge remote-tracking branch 'origin/2.0-dev' into 2.0-dev

new-dev
袁野 1 year ago
parent abde8252ed
commit 2980280f1c
  1. 2
      hai-order/src/main/java/com/web/controller/OrderPayController.java
  2. 12
      hai-service/src/main/java/com/hai/common/GenerateCode.java
  3. 16
      hai-service/src/main/java/com/hai/config/ScPetroConfig.java
  4. 7
      hai-service/src/main/java/com/hai/enum_type/ApiProductTypeEnum.java
  5. 108
      hai-service/src/main/java/com/hai/group/GroupCodeService.java
  6. 6
      hai-service/src/main/java/com/hai/group/GroupService.java
  7. 166
      hai-service/src/main/java/com/hai/group/impl/GroupCodeServiceImpl.java
  8. 5
      hai-service/src/main/java/com/hai/order/model/CreateOrderChildModel.java
  9. 11
      hai-service/src/main/java/com/hai/order/service/OrderCreateHandleService.java
  10. 54
      hai-service/src/main/java/com/hai/order/service/impl/OrderCreateHandleServiceImpl.java
  11. 26
      hai-service/src/main/java/com/hai/order/service/impl/OrderPaySuccessServiceImpl.java
  12. 6
      hai-service/src/main/java/com/hai/order/service/impl/OrderServiceImpl.java
  13. 1
      hai-service/src/main/java/com/hai/order/type/OrderChildGoodsType.java
  14. 1
      hai-service/src/main/java/com/hai/order/type/OrderProductType.java
  15. 3
      hai-service/src/main/java/com/hai/service/impl/HighUserServiceImpl.java

@ -354,6 +354,8 @@ public class OrderPayController {
payPlatformKey = gasChannelConfig.getPayPlatformMerKey();
weChatPayReqInfo.setSub_mch_id(gasChannelConfig.getPayPlatformMerNo());
profitSharing = gasChannelConfig.getProfitSharingStatus().equals(true) ? "Y" : "N";
} else if (order.getProductType().equals(OrderProductType.PRODUCT_TYPE17.getNumber())) {
weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1614670195);
} else {
weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1609882817);
}

@ -14,6 +14,7 @@ public class GenerateCode {
private static final Random RANDOM = new SecureRandom();
private static final String SYMBOLS = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
private static final String SYMBOLSNUM = "0123456789";
/**
* @Author 胡锐
@ -56,4 +57,15 @@ public class GenerateCode {
return new String(nonceChars) + couponAgentRelId;
}
public static String convertCode(Long couponAgentRelId , Integer length) {
// 需要生成的长度
int generateLength = length - couponAgentRelId.toString().length();
char[] nonceChars = new char[generateLength];
for (int index = 0; index < nonceChars.length; ++index) {
nonceChars[index] = SYMBOLSNUM.charAt(RANDOM.nextInt(SYMBOLSNUM.length()));
}
return new String(nonceChars) + couponAgentRelId;
}
}

@ -0,0 +1,16 @@
package com.hai.config;
import org.springframework.stereotype.Component;
/**
* @serviceName .java
* @author Sum1Dream
* @version 1.0.0
* @Description // 四川中石油
* @createTime 18:33 2023/11/13
**/
@Component
public class ScPetroConfig {
}

@ -16,9 +16,10 @@ public enum ApiProductTypeEnum {
type4(4, "积分充值"),
type5(5, "卡券"),
type6(6, "在线加油"),
type7(7, "优惠券包 "),
type8(8, "汇联通充值 "),
type10(10, "实物商品 ")
type7(7, "优惠券包"),
type8(8, "汇联通充值"),
type10(10, "实物商品"),
type17(17, "团购套餐")
;
private Integer type;

@ -0,0 +1,108 @@
package com.hai.group;
import com.alibaba.fastjson.JSONObject;
import com.hai.entity.ApiIpAddress;
import com.hai.entity.HighGroupCode;
import com.hai.entity.HighGroupOrder;
import java.util.List;
import java.util.Map;
public interface GroupCodeService {
/**
* @Author Sum1Dream
* @Name insertGroupCode
* @Description // 新增
* @Date 14:32 2023/11/10
* @Param highGroupCode
* @return void
*/
void insertGroupCode(HighGroupCode highGroupCode);
/**
* @Author Sum1Dream
* @Name updateGroupCode
* @Description // 编辑
* @Date 14:32 2023/11/10
* @Param highGroupCode
* @return void
*/
void updateGroupCode(HighGroupCode highGroupCode);
/**
* @Author Sum1Dream
* @Name findGroupCode
* @Description // 根据id查询
* @Date 14:32 2023/11/10
* @Param id
* @return com.hai.entity.HighGroupCode
*/
HighGroupCode findGroupCode(Long id);
/**
* @Author Sum1Dream
* @Name findGroupCode
* @Description // 查询
* @Date 14:32 2023/11/10
* @Param map
* @return com.hai.entity.HighGroupCode
*/
HighGroupCode findGroupCode(Map<String , Object> map);
/**
* @Author Sum1Dream
* @Name findGroupCodeList
* @Description // 查询列表
* @Date 14:32 2023/11/10
* @Param map
* @return java.util.List<com.hai.entity.HighGroupCode>
*/
List<HighGroupCode> findGroupCodeList(Map<String , Object> map);
/**
* @Author Sum1Dream
* @Name generateCode
* @Description // 生成code
* @Date 14:41 2023/11/10
* @Param object
* @return void
*/
HighGroupCode generateCode(Long userId , Long storeId , Long orderId , Long groupId);
/**
* @Author Sum1Dream
* @Name insertGroupOrder
* @Description // 新增团购订单
* @Date 14:54 2023/11/13
* @Param highGroupOrder
* @return void
*/
void insertGroupOrder(HighGroupOrder highGroupOrder);
/**
* @Author Sum1Dream
* @Name updateGroupOrder
* @Description // 更新团购订单
* @Date 14:55 2023/11/13
* @Param highGroupOrder
* @return void
*/
void updateGroupOrder(HighGroupOrder highGroupOrder);
/**
* @Author Sum1Dream
* @Name findGroupOrder
* @Description // 查询团购订单
* @Date 14:55 2023/11/13
* @Param groupId
* @return com.hai.entity.HighGroupOrder
*/
HighGroupOrder findGroupOrder(Long groupId);
HighGroupOrder findGroupOrder(String orderNo);
}

@ -21,6 +21,7 @@ public class GroupService {
*/
public JSONObject getStoreList(JSONObject params) {
return HttpsUtils.doPost(CommonSysConst.getSysConfig().getPayPostUrl() + "/openGroup/getStoreList" , params);
// return HttpsUtils.doPost("http://localhost:9601/crest/openGroup/getStoreList" , params);
}
/**
@ -63,4 +64,9 @@ public class GroupService {
return HttpsUtils.doPost(CommonSysConst.getSysConfig().getPayPostUrl() + "/openGroup/getBsStoreImgByList" , params);
}
}

@ -0,0 +1,166 @@
package com.hai.group.impl;
import com.alibaba.fastjson.JSONObject;
import com.hai.common.GenerateCode;
import com.hai.common.QRCodeGenerator;
import com.hai.common.utils.DateUtil;
import com.hai.common.utils.IDGenerator;
import com.hai.config.CommonSysConst;
import com.hai.dao.HighGroupCodeMapper;
import com.hai.dao.HighGroupOrderMapper;
import com.hai.entity.HighGroupCode;
import com.hai.entity.HighGroupCodeExample;
import com.hai.entity.HighGroupOrder;
import com.hai.entity.HighGroupOrderExample;
import com.hai.group.GroupCodeService;
import org.apache.commons.collections4.MapUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;
@Service("groupCodeService")
public class GroupCodeServiceImpl implements GroupCodeService {
@Resource
private HighGroupCodeMapper highGroupCodeMapper;
@Resource
private HighGroupOrderMapper highGroupOrderMapper;
@Override
public void insertGroupCode(HighGroupCode highGroupCode) {
highGroupCodeMapper.insert(highGroupCode);
}
@Override
public void updateGroupCode(HighGroupCode highGroupCode) {
highGroupCodeMapper.updateByPrimaryKey(highGroupCode);
}
@Override
public HighGroupCode findGroupCode(Long id) {
return highGroupCodeMapper.selectByPrimaryKey(id);
}
@Override
public HighGroupCode findGroupCode(Map<String , Object> map) {
HighGroupCodeExample example = new HighGroupCodeExample();
HighGroupCodeExample.Criteria criteria = example.createCriteria();
if (MapUtils.getString(map, "groupCode") != null) {
criteria.andGroupCodeEqualTo(MapUtils.getString(map, "groupCode"));
}
if (MapUtils.getLong(map, "userId") != null) {
criteria.andUserIdEqualTo(MapUtils.getLong(map, "userId"));
}
if (MapUtils.getLong(map, "storeId") != null) {
criteria.andSroreIdEqualTo(MapUtils.getLong(map, "storeId"));
}
List<HighGroupCode> list = highGroupCodeMapper.selectByExample(example);
if (list.size() > 0) {
return list.get(0);
}
return null;
}
@Override
public List<HighGroupCode> findGroupCodeList(Map<String, Object> map) {
HighGroupCodeExample example = new HighGroupCodeExample();
HighGroupCodeExample.Criteria criteria = example.createCriteria();
if (MapUtils.getString(map, "groupCode") != null) {
criteria.andGroupCodeEqualTo(MapUtils.getString(map, "groupCode"));
}
if (MapUtils.getLong(map, "userId") != null) {
criteria.andUserIdEqualTo(MapUtils.getLong(map, "userId"));
}
if (MapUtils.getLong(map, "storeId") != null) {
criteria.andSroreIdEqualTo(MapUtils.getLong(map, "storeId"));
}
return highGroupCodeMapper.selectByExample(example);
}
@Override
public HighGroupCode generateCode(Long userId, Long storeId, Long orderId, Long groupId) {
try {
HighGroupCode highGroupCode = new HighGroupCode();
highGroupCode.setGroupId(groupId);
highGroupCode.setCreateTime(new Date());
highGroupCode.setOrderId(orderId);
highGroupCode.setSroreId(storeId);
highGroupCode.setUpdateTime(new Date());
highGroupCode.setUserId(userId);
highGroupCode.setStatus(1);
insertGroupCode(highGroupCode);
highGroupCode.setGroupCode(GenerateCode.convertCode(highGroupCode.getId() , 16));
// 生成二维码
String qrCodeImg = highGroupCode.getGroupCode() +".png";
String qrCodeUrl = CommonSysConst.getSysConfig().getFileUrl() + "/groupCode/" + qrCodeImg;
QRCodeGenerator.generateQRCodeImage(highGroupCode.getGroupCode(), 350, 350, qrCodeUrl);
highGroupCode.setCodeImgUrl(qrCodeUrl);
updateGroupCode(highGroupCode);
return highGroupCode;
} catch (Exception e) {
return null;
}
}
@Override
public void insertGroupOrder(HighGroupOrder highGroupOrder) {
highGroupOrderMapper.insert(highGroupOrder);
}
@Override
public void updateGroupOrder(HighGroupOrder highGroupOrder) {
highGroupOrderMapper.updateByPrimaryKey(highGroupOrder);
}
@Override
public HighGroupOrder findGroupOrder(Long groupId) {
HighGroupOrderExample example = new HighGroupOrderExample();
HighGroupOrderExample.Criteria criteria = example.createCriteria();
criteria.andGroupIdEqualTo(groupId);
List<HighGroupOrder> list = highGroupOrderMapper.selectByExample(example);
if (!list.isEmpty()) {
return list.get(0);
}
return null;
}
@Override
public HighGroupOrder findGroupOrder(String orderNo) {
HighGroupOrderExample example = new HighGroupOrderExample();
HighGroupOrderExample.Criteria criteria = example.createCriteria();
criteria.andOrderNoEqualTo(orderNo);
List<HighGroupOrder> list = highGroupOrderMapper.selectByExample(example);
if (!list.isEmpty()) {
return list.get(0);
}
return null;
}
}

@ -154,4 +154,9 @@ public class CreateOrderChildModel {
// 车牌号
private String carNo;
/** ======================= 比邻星停车核销 end ======================== **/
/** ======================= 实物商品所需参数 start ======================== **/
// 团购id
private Long groupId;
/** ======================= 实物商品所需参数 end ======================== **/
}

@ -119,4 +119,15 @@ public interface OrderCreateHandleService {
*/
HighChildOrder levelUp(HighOrder order , CreateOrderChildModel createOrderChildModel) throws Exception;
/**
* @Author Sum1Dream
* @Name group
* @Description // 购买团购产品
* @Date 13:58 2023/11/13
* @Param order
* @Param createOrderChildModel
* @return com.hai.entity.HighChildOrder
*/
HighChildOrder group(HighOrder order , CreateOrderChildModel createOrderChildModel) throws Exception;
}

@ -15,6 +15,8 @@ import com.hai.goods.service.GoodsDetailService;
import com.hai.goods.service.GoodsPresentService;
import com.hai.goods.service.GoodsSkuService;
import com.hai.goods.service.ShoppingCartService;
import com.hai.group.GroupCodeService;
import com.hai.group.GroupService;
import com.hai.model.GasPayPriceModel;
import com.hai.model.OutRechargePriceModel;
import com.hai.openApi.config.BlxConfig;
@ -91,6 +93,9 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService {
@Resource
private HighDiscountCouponRelService discountCouponRelService;
@Resource
private GroupService groupService;
@Resource
private OutRechargeOrderMapper outRechargeOrderMapper;
@ -153,6 +158,9 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService {
@Resource
private HighOilCardOrderService highOilCardOrderService;
@Resource
private GroupCodeService groupCodeService;
@Override
public List<HighChildOrder> couponHandle(HighDiscountUserRel discountUserRel, CreateOrderChildModel createOrderChild) throws Exception {
if (createOrderChild.getSaleCount() != 1) {
@ -1137,4 +1145,50 @@ public class OrderCreateHandleServiceImpl implements OrderCreateHandleService {
return childOrder;
}
@Override
public HighChildOrder group(HighOrder order, CreateOrderChildModel createOrderChildModel) throws Exception {
HighChildOrder childOrder = new HighChildOrder();
JSONObject object = groupService.getGroupContent(createOrderChildModel.getGroupId());
if (object.getString("return_code").equals("000000")) {
JSONObject data = object.getJSONObject("return_data");
childOrder.setGoodsPrice(data.getBigDecimal("originalPrice"));
childOrder.setGoodsActualPrice(data.getBigDecimal("price"));
childOrder.setGoodsName(data.getString("name"));
} else {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, object.getString("return_msg"));
}
HighGroupOrder highGroupOrder = new HighGroupOrder();
highGroupOrder.setGroupId(createOrderChildModel.getGroupId());
highGroupOrder.setStoreId(createOrderChildModel.getStoreId());
highGroupOrder.setOrderNo(order.getOrderNo());
highGroupOrder.setCreateTime(new Date());
highGroupOrder.setUpdateTime(new Date());
highGroupOrder.setStatus(OrderChildStatus.STATUS1.getNumber());
groupCodeService.insertGroupOrder(highGroupOrder);
childOrder.setOrderNo(order.getOrderNo());
childOrder.setMemId(order.getMemId());
childOrder.setMemName(order.getMemName());
childOrder.setMemPhone(order.getMemPhone());
childOrder.setChildOrderNo(OrderUtil.generateChildOrderNo());
childOrder.setGoodsType(OrderChildGoodsType.TYPE17.getNumber());
childOrder.setGoodsId(order.getMemId());
childOrder.setGoodsSpecName("份");
childOrder.setSaleCount(createOrderChildModel.getSaleCount());
childOrder.setGiveawayType(false);
childOrder.setChildOrderStatus(OrderChildStatus.STATUS1.getNumber());
childOrder.setTotalPrice(childOrder.getGoodsPrice().multiply(new BigDecimal(childOrder.getSaleCount())));
childOrder.setTotalActualPrice(childOrder.getGoodsActualPrice().multiply(new BigDecimal(childOrder.getSaleCount())));
childOrder.setTotalDeductionPrice(childOrder.getTotalPrice().subtract(childOrder.getTotalActualPrice()));
childOrder.setPraiseStatus(0);
childOrder.setCreateTime(new Date());
return childOrder;
}
}

@ -11,6 +11,7 @@ import com.hai.entity.*;
import com.hai.enum_type.*;
import com.hai.goods.service.GoodsOrderExtService;
import com.hai.goods.service.GoodsPresentService;
import com.hai.group.GroupCodeService;
import com.hai.msg.entity.MsgTopic;
import com.hai.openApi.config.BlxConfig;
import com.hai.openApi.service.ApiBlxCouponService;
@ -123,6 +124,9 @@ public class OrderPaySuccessServiceImpl implements OrderPaySuccessService {
@Resource
private HighOilCardOrderService highOilCardOrderService;
@Resource
private GroupCodeService groupCodeService;
@Override
public HighOrder orderPaySuccessHandle(String orderNo, OrderPayType payType, String paySerialNo, BigDecimal payRealPrice, HighUserCard userCard) {
@ -246,6 +250,8 @@ public class OrderPaySuccessServiceImpl implements OrderPaySuccessService {
blxOrderHandle(order);
} else if (childOrder.getGoodsType().equals(OrderChildGoodsType.TYPE14.getNumber())) {
levelUp(order);
} else if (childOrder.getGoodsType().equals(OrderChildGoodsType.TYPE17.getNumber())) {
group(order);
}
}
}
@ -637,4 +643,24 @@ public class OrderPaySuccessServiceImpl implements OrderPaySuccessService {
}
private void group(HighOrder order) {
HighGroupOrder highGroupOrder = groupCodeService.findGroupOrder(order.getOrderNo());
groupCodeService.generateCode(order.getMemId() , highGroupOrder.getStoreId() , order.getId() , highGroupOrder.getGroupId());
highGroupOrder.setStatus(OrderStatus.STATUS2.getNumber());
highGroupOrder.setUpdateTime(new Date());
groupCodeService.updateGroupOrder(highGroupOrder);
order.setOrderStatus(OrderStatus.STATUS2.getNumber());
order.setFinishTime(new Date());
for (HighChildOrder childOrder : order.getHighChildOrderList()) {
childOrder.setChildOrderStatus(OrderChildStatus.STATUS2.getNumber());
}
}
}

@ -363,6 +363,12 @@ public class OrderServiceImpl implements OrderService {
order.setProductType(OrderProductType.PRODUCT_TYPE15.getNumber());
order.setSecUserId(childOrder.getId());
order.setTitle("升级会员");
} else if (child.getGoodsType().equals(OrderChildGoodsType.TYPE17.getNumber())) {
HighChildOrder childOrder = orderCreateHandleService.group(order , child);
childOrderList.add(childOrder);
order.setProductType(OrderProductType.PRODUCT_TYPE17.getNumber());
order.setSecUserId(childOrder.getId());
order.setTitle("团购套餐");
} else {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知业务类型");
}

@ -23,6 +23,7 @@ public enum OrderChildGoodsType {
TYPE12(12, "比邻星停车券"),
TYPE13(13, "比邻星停车"),
TYPE14(14, "升级会员"),
TYPE17(17, "团购套餐"),
;
private Integer number;

@ -25,6 +25,7 @@ public enum OrderProductType {
PRODUCT_TYPE13(13, "比邻星停车券" , "orderLogo/coupon.png", "BLX_COUPON"),
PRODUCT_TYPE14(14, "比邻星停车业务" , "orderLogo/coupon.png", "BLX_PARK"),
PRODUCT_TYPE15(15, "升级会员" , "orderLogo/coupon.png", "LEVEL_UP"),
PRODUCT_TYPE17(17, "团购套餐" , "orderLogo/coupon.png", ""),
PRODUCT_TYPE101(101, "惠支付" , "orderLogo/pay.png", "PAY"),
PRODUCT_TYPE102(102, "门店活动" , "orderLogo/store_activity.png", "STORE_ACTIVITY"),
;

@ -218,7 +218,7 @@ public class HighUserServiceImpl implements HighUserService {
user.setIsSetPayPwd(highUserPayPasswordService.isSetPayPwd(userId));
user.setIsSetHltCard(highUserCardService.isBindHtlCard(userId));
user.setHltCardNo(highUserCardService.getUserHtlCardNo(userId));
user.setBlxCouponBalance(highUserCardService.getBlxCouponBalance(user.getPhone()).getInteger("num"));
// user.setBlxCouponBalance(highUserCardService.getBlxCouponBalance(user.getPhone()).getInteger("num"));
// 查询油卡
List<HighUserCard> oilCardList = highUserCardService.getListByUser(userId, UserCardType.type2.getType());
@ -422,7 +422,6 @@ public class HighUserServiceImpl implements HighUserService {
JSONObject object = new JSONObject();
return null;
}

Loading…
Cancel
Save