From be67478cae6bf9308f15949a21e7d0a57a3f0ecb Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期四, 16 七月 2020 15:37:31 +0800 Subject: [PATCH] dubbo集成修改 --- fanli/src/main/java/com/yeshi/fanli/service/impl/order/CommonOrderServiceImpl.java | 84 ++++++++++++++++++++++++++++++------------ 1 files changed, 60 insertions(+), 24 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/order/CommonOrderServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/order/CommonOrderServiceImpl.java index 1ae7da9..96ceb74 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/order/CommonOrderServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/order/CommonOrderServiceImpl.java @@ -10,6 +10,7 @@ import javax.annotation.Resource; +import com.yeshi.fanli.entity.SystemEnum; import org.apache.commons.beanutils.PropertyUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -18,7 +19,6 @@ import org.yeshi.utils.taobao.TbImgUtil; import com.aliyun.openservices.ons.api.Message; -import com.aliyun.openservices.ons.api.Producer; import com.yeshi.fanli.dao.mybatis.order.CommonOrderGoodsMapper; import com.yeshi.fanli.dao.mybatis.order.CommonOrderMapper; import com.yeshi.fanli.dao.mybatis.order.CommonOrderTradeIdMapMapper; @@ -50,7 +50,7 @@ import com.yeshi.fanli.entity.suning.SuningOrderInfo; import com.yeshi.fanli.entity.system.ConfigKeyEnum; import com.yeshi.fanli.entity.system.SystemCoupon.CouponTypeEnum; -import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief; +import com.yeshi.goods.facade.entity.taobao.TaoBaoGoodsBrief; import com.yeshi.fanli.entity.taobao.TaoBaoOrder; import com.yeshi.fanli.entity.taobao.TaoBaoOrderGoods; import com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder; @@ -74,11 +74,12 @@ import com.yeshi.fanli.service.inter.user.UserSystemCouponService; import com.yeshi.fanli.service.inter.user.invite.UserInviteService; import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService; +import com.yeshi.fanli.service.manger.msg.RocketMQManager; import com.yeshi.fanli.service.manger.user.UserLevelManager; import com.yeshi.fanli.util.Constant; -import com.yeshi.fanli.util.MoneyBigDecimalUtil; +import org.yeshi.utils.MoneyBigDecimalUtil; import com.yeshi.fanli.util.StringUtil; -import com.yeshi.fanli.util.TimeUtil; +import org.yeshi.utils.TimeUtil; import com.yeshi.fanli.util.VersionUtil; import com.yeshi.fanli.util.account.UserUtil; import com.yeshi.fanli.util.factory.CommonOrderGoodsFactory; @@ -89,11 +90,12 @@ import com.yeshi.fanli.util.rocketmq.MQMsgBodyFactory; import com.yeshi.fanli.util.rocketmq.MQTopicName; import com.yeshi.fanli.util.suning.SuningApiUtil; +import com.yeshi.fanli.util.suning.SuningUtil; import com.yeshi.fanli.util.taobao.TaoBaoUtil; import com.yeshi.fanli.util.taobao.TaoKeApiUtil; import com.yeshi.fanli.util.user.UserLevelUtil; import com.yeshi.fanli.util.vipshop.VipShopApiUtil; -import com.yeshi.fanli.vo.msg.ClientTextStyleVO; +import com.yeshi.common.vo.ClientTextStyleVO; import com.yeshi.fanli.vo.order.CommonOrderGoodsVO; import com.yeshi.fanli.vo.order.CommonOrderVO; import com.yeshi.fanli.vo.order.HongBaoCountVO; @@ -104,7 +106,6 @@ @Service public class CommonOrderServiceImpl implements CommonOrderService { - @Resource private CommonOrderMapper commonOrderMapper; @@ -160,8 +161,8 @@ @Resource private TaoBaoOrderGoodsMapper taoBaoOrderGoodsMapper; - @Resource(name = "producer") - private Producer orderProducer; + @Resource + private RocketMQManager rocketMQManager; // 濂栧姳璁㈠崟鍥剧墖 public final static String PIC_REWARD = "http://img.flqapp.com/resource/order/order_state_reward.png"; @@ -630,7 +631,6 @@ * @param hasRewardCoupon * @param hongBaoState * @param list - * @param signList */ private void couponFactory(CommonOrderVO order, boolean hasRewardCoupon, Integer hongBaoState, Integer hongBaoType, List<UserSystemCouponRecord> list, Long uid, boolean vip, AcceptData acceptData, BigDecimal hongBao) @@ -1097,7 +1097,7 @@ settlement, firstOrder.getUserInfo().getId(), placeDate, new Date()); Message msg = MQMsgBodyFactory.create(MQTopicName.TOPIC_ORDER, OrderTopicTagEnum.orderConfirm, mqMsg); - orderProducer.send(msg); + rocketMQManager.sendNormalMsg(msg, null); } } } @@ -1292,7 +1292,6 @@ * * @param commonOrder */ - @Transactional(rollbackFor = Exception.class) private CommonOrderAddResultDTO addCommonOrder(CommonOrder commonOrder) throws CommonOrderException { // 鍒ゆ柇鍟嗗搧鏄惁瀛樺湪 if (commonOrder == null) @@ -1468,16 +1467,16 @@ @Override public List<CommonOrderVO> listQuery(long start, int count, Integer keyType, String key, Integer state, Integer type, Integer orderState, String startTime, String endTime, Integer source, List<Long> listShopId, - List<Long> listGoodsId, Date minTime, BigDecimal money, BigDecimal payment) throws CommonOrderException { + List<Long> listGoodsId, Date minTime, BigDecimal money, BigDecimal payment,SystemEnum system) throws CommonOrderException { List<CommonOrderVO> list = null; if (StringUtil.isNullOrEmpty(key) || keyType == 1) {// 鎼滅储妗嗘棤鍊兼垨鑰呮寜璁㈠崟鍙锋悳绱㈡椂閮藉彧鎼滅储涓昏鍗� list = commonOrderMapper.listQueryWithNoChild(start, count, keyType, key, state, type, orderState, - startTime, endTime, source, payment); + startTime, endTime, source, payment,system); } else { list = commonOrderMapper.listQuery(start, count, keyType, key, state, type, orderState, startTime, endTime, - source, listShopId, listGoodsId, minTime, money, payment); + source, listShopId, listGoodsId, minTime, money, payment,system); } if (list == null) { @@ -1663,14 +1662,14 @@ @Override public long countQuery(Integer keyType, String key, Integer state, Integer type, Integer orderState, - String startTime, String endTime, Integer source, List<Long> listShopId, List<Long> listGoodsId, - Date minTime, BigDecimal money, BigDecimal payment) throws CommonOrderException { + String startTime, String endTime, Integer source, List<Long> listShopId, List<Long> listGoodsId, + Date minTime, BigDecimal money, BigDecimal payment, SystemEnum system) throws CommonOrderException { if (StringUtil.isNullOrEmpty(key) || keyType == 1) {// 鎼滅储妗嗘棤鍊兼垨鑰呮寜璁㈠崟鍙锋悳绱㈡椂閮藉彧鎼滅储涓昏鍗� return commonOrderMapper.countQueryWithNoChild(keyType, key, state, type, orderState, startTime, endTime, - source, payment); + source, payment,system); } else { return commonOrderMapper.countQuery(keyType, key, state, type, orderState, startTime, endTime, source, - listShopId, listGoodsId, minTime, money, payment); + listShopId, listGoodsId, minTime, money, payment,system); } } @@ -1854,6 +1853,13 @@ return commonOrderMapper.getByOrderNo(uid, orderNO); } + + @Override + public List<CommonOrder> getByOrderNoAndSourceType(Long uid, String orderNO, int sourceType) { + return commonOrderMapper.getByOrderNoAndSourceType(uid, orderNO, sourceType); + } + + @Override public CommonOrder selectLatestValidByUid(Long uid) { List<Integer> stateList = new ArrayList<>(); @@ -1944,12 +1950,12 @@ @Override public List<CommonOrderVO> getOrderList(AcceptData acceptData, Integer page, Long uid, Integer state, Integer type, Integer orderState, String orderNo, String startTime, String endTime, Integer dateType, - List<Integer> listSource, boolean notBackSuVip) throws CommonOrderException, Exception { + List<Integer> listSource) throws CommonOrderException, Exception { int pageSize = Constant.PAGE_SIZE; List<CommonOrderVO> listOrder = commonOrderMapper.getOrderList((page - 1) * pageSize, pageSize, uid, state, - type, orderState, orderNo, startTime, endTime, dateType, listSource, notBackSuVip); + type, orderState, orderNo, startTime, endTime, dateType, listSource); // 璁㈠崟淇℃伅涓虹┖ if (listOrder == null || listOrder.size() == 0) { @@ -1971,10 +1977,9 @@ @Override public long countOrderList(Long uid, Integer state, Integer type, Integer orderState, String orderNo, - String startTime, String endTime, Integer dateType, List<Integer> listSource, boolean notBackSuVip) - throws CommonOrderException { + String startTime, String endTime, Integer dateType, List<Integer> listSource) { return commonOrderMapper.countOrderList(uid, state, type, orderState, orderNo, startTime, endTime, dateType, - listSource, notBackSuVip); + listSource); } /** @@ -1990,6 +1995,8 @@ List<String> listTB = new ArrayList<String>(); List<String> listJD = new ArrayList<String>(); List<String> listPDD = new ArrayList<String>(); + List<String> listVIP = new ArrayList<String>(); + List<String> listSuNing = new ArrayList<String>(); for (CommonOrderVO order : listOrder) { if (order.getHongBaoType() == HongBaoV2.TYPE_YIJI || order.getHongBaoType() == HongBaoV2.TYPE_ERJI || order.getHongBaoType() == HongBaoV2.TYPE_SHARE_YIJI @@ -2013,6 +2020,10 @@ listJD.add(order.getOrderNo()); } else if (sourceType == Constant.SOURCE_TYPE_PDD) { listPDD.add(order.getOrderNo()); + } else if (sourceType == Constant.SOURCE_TYPE_VIP) { + listVIP.add(order.getOrderNo()); + } else if (sourceType == Constant.SOURCE_TYPE_SUNING) { + listSuNing.add(order.getOrderNo()); } } @@ -2031,6 +2042,17 @@ listRecordPDD = userSystemCouponRecordService.getRecordByOrderNoList(Constant.SOURCE_TYPE_PDD, listPDD); } + List<UserSystemCouponRecord> listRecordVIP = null; + if (listVIP.size() > 0) { + listRecordVIP = userSystemCouponRecordService.getRecordByOrderNoList(Constant.SOURCE_TYPE_VIP, listVIP); + } + + List<UserSystemCouponRecord> listRecordSuNing = null; + if (listSuNing.size() > 0) { + listRecordSuNing = userSystemCouponRecordService.getRecordByOrderNoList(Constant.SOURCE_TYPE_SUNING, listSuNing); + } + + SimpleDateFormat format = new SimpleDateFormat("yyyy.MM.dd HH:mm"); SimpleDateFormat formatday = new SimpleDateFormat("yyyy.MM.dd"); // 鏄惁瀛樺湪濂栧姳鍒� @@ -2093,6 +2115,11 @@ Integer goodsType = commonGoodsVO.getGoodsType(); if (goodsType != null & goodsType == Constant.SOURCE_TYPE_ELME) { order.setOrderType(Constant.SOURCE_TYPE_ELME); // 楗夸簡涔堣鍗� + commonGoodsVO.setGoodsId("0"); + } + + if (goodsType == Constant.SOURCE_TYPE_SUNING) { + commonGoodsVO.setGoodsId(SuningUtil.getConcatGoodsIId(commonGoodsVO.getShopId() +"", commonGoodsVO.getGoodsId())); } order.getListOrderGoods().add(commonGoodsVO); } @@ -2152,7 +2179,7 @@ // 鏄剧ず杩斿埄璇存槑杩炴帴> 鏈け鏁� if (CommonOrder.STATE_SX != orderState && thirdCreateTime.getTime() > TimeUtil.convertDateToTemp(Constant.ORDER_SHOW_BRACE_TIME)) { - String rebateLink = configService.get(ConfigKeyEnum.orderRebateDescLink.getKey()); + String rebateLink = configService.getValue(ConfigKeyEnum.orderRebateDescLink.getKey(),acceptData.getSystem()); order.setRebateLink(rebateLink + "?orderNo=" + orderNo + "&sourceType=" + sourceType); } @@ -2209,6 +2236,10 @@ couponUseFactory(order, listRecordJD); } else if (sourceType == Constant.SOURCE_TYPE_PDD) { couponUseFactory(order, listRecordPDD); + } else if (sourceType == Constant.SOURCE_TYPE_VIP) { + couponUseFactory(order, listRecordVIP); + } else if (sourceType == Constant.SOURCE_TYPE_SUNING) { + couponUseFactory(order, listRecordSuNing); } } else if (HongBaoV2.TYPE_SHARE_GOODS == hongBaoType) { // 鍒嗕韩 @@ -2349,4 +2380,9 @@ return commonOrderMapper.listByOrderNo(orderNo); } + @Override + public CommonOrder getFirstOrder(Long uid) { + return commonOrderMapper.getFirstOrder(uid); + } + } -- Gitblit v1.8.0