| | |
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
|
| | | import com.google.gson.Gson;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgExtra;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgOrderDetail;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgOrderDetail.MsgTypeOrderTypeEnum;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.exception.msg.MsgOrderDetailException;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.account.UserUtil;
|
| | | import com.yeshi.fanli.vo.msg.ClientTextStyleVO;
|
| | | import com.yeshi.fanli.vo.msg.CommonMsgItemVO;
|
| | | import com.yeshi.fanli.vo.msg.CommonMsgItemVOFactory;
|
| | |
|
| | | public class MsgOrderDetailFactory {
|
| | |
|
| | | /**
|
| | | * 返利订单
|
| | | * |
| | | * @param uid
|
| | | * @param orderId
|
| | | * @param goodsCount
|
| | | * @param orderState
|
| | | * @param payMoney
|
| | | * @param money
|
| | | * @param state
|
| | | * @param beiZhu
|
| | | * @return
|
| | | */
|
| | | public static MsgOrderDetail createFanLiOrder(Long uid, String orderId, int orderType, int goodsCount,
|
| | | int orderState, BigDecimal payMoney, BigDecimal money, String beiZhu) {
|
| | | if (uid == null)
|
| | | return null;
|
| | | MsgOrderDetail detail = new MsgOrderDetail();
|
| | | detail.setBeiZhu(beiZhu);
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setGoodsCount(goodsCount);
|
| | | detail.setHongBaoMoney(money);
|
| | | detail.setOrderId(orderId);
|
| | | detail.setOrderType(orderType);
|
| | | detail.setPayMoney(payMoney);
|
| | | detail.setRead(false);
|
| | | detail.setState(orderState);
|
| | | detail.setType(MsgTypeOrderTypeEnum.fanli);
|
| | | detail.setUser(new UserInfo(uid));
|
| | | return detail;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 邀请订单
|
| | | * |
| | | * @param uid
|
| | | * @param orderId
|
| | | * @param goodsCount
|
| | | * @param orderState
|
| | | * @param payMoney
|
| | | * @param money
|
| | | * @param state
|
| | | * @param beiZhu
|
| | | * @return
|
| | | */
|
| | | public static MsgOrderDetail createInviteOrder(Long uid, String orderId, int orderType, int goodsCount,
|
| | | int orderState, BigDecimal payMoney, BigDecimal money, String beiZhu) {
|
| | | if (payMoney == null || money == null || uid == null)
|
| | | return null;
|
| | | MsgOrderDetail detail = new MsgOrderDetail();
|
| | | detail.setBeiZhu(beiZhu);
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setGoodsCount(goodsCount);
|
| | | detail.setHongBaoMoney(money);
|
| | | detail.setOrderId(orderId);
|
| | | detail.setOrderType(orderType);
|
| | | detail.setPayMoney(payMoney);
|
| | | detail.setRead(false);
|
| | | detail.setState(orderState);
|
| | | detail.setType(MsgTypeOrderTypeEnum.invite);
|
| | | detail.setUser(new UserInfo(uid));
|
| | | return detail;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 分享订单
|
| | | * |
| | | * @param uid
|
| | | * @param orderId
|
| | | * @param goodsCount
|
| | | * @param orderState
|
| | | * @param payMoney
|
| | | * @param money
|
| | | * @param state
|
| | | * @param beiZhu
|
| | | * @return
|
| | | */
|
| | | public static MsgOrderDetail createShareOrder(Long uid, String orderId, int orderType, int goodsCount,
|
| | | int orderState, BigDecimal payMoney, BigDecimal money, String beiZhu) {
|
| | | if (payMoney == null || money == null || uid == null)
|
| | | return null;
|
| | | MsgOrderDetail detail = new MsgOrderDetail();
|
| | | detail.setBeiZhu(beiZhu);
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setGoodsCount(goodsCount);
|
| | | detail.setHongBaoMoney(money);
|
| | | detail.setOrderId(orderId);
|
| | | detail.setOrderType(orderType);
|
| | | detail.setPayMoney(payMoney);
|
| | | detail.setRead(false);
|
| | | detail.setState(orderState);
|
| | | detail.setType(MsgTypeOrderTypeEnum.share);
|
| | | detail.setUser(new UserInfo(uid));
|
| | | return detail;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 订单找回
|
| | | * |
| | | * @param uid
|
| | | * @param orderId
|
| | | * -订单号
|
| | | * @param isSuccess-是否找回成功
|
| | | * @param payMoney
|
| | | * @param orderType
|
| | | * 1-淘宝订单 3-拼多多订单 4-京东订单
|
| | | * @param beiZhu
|
| | | * @return
|
| | | */
|
| | | public static MsgOrderDetail createFoundOrder(Long uid, String orderId, boolean isSuccess, BigDecimal payMoney,
|
| | | int orderType, Date happendDate, String beiZhu) {
|
| | | if (orderId == null || uid == null)
|
| | | return null;
|
| | | MsgOrderDetail detail = new MsgOrderDetail();
|
| | | detail.setBeiZhu(beiZhu);
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setOrderType(orderType);
|
| | | detail.setPayMoney(payMoney);
|
| | | detail.setRead(false);
|
| | | detail.setState(isSuccess ? 1 : 0);
|
| | | detail.setType(MsgTypeOrderTypeEnum.found);
|
| | | detail.setUser(new UserInfo(uid));
|
| | | detail.setHappendDate(happendDate);
|
| | | return detail;
|
| | | }
|
| | | |
| | | /**
|
| | | * 饿了么订单消息
|
| | | * @param uid
|
| | | * @param orderId
|
| | | * @param orderType
|
| | | * @param orderState
|
| | | * @param payMoney
|
| | | * @param money
|
| | | * @param beiZhu
|
| | | * @return
|
| | | */
|
| | | public static MsgOrderDetail createElmeOrder(Long uid, String orderId, int orderType,
|
| | | int orderState, BigDecimal payMoney, BigDecimal money, String beiZhu) {
|
| | | if (uid == null)
|
| | | return null;
|
| | | MsgOrderDetail detail = new MsgOrderDetail();
|
| | | detail.setBeiZhu(beiZhu);
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setHongBaoMoney(money);
|
| | | detail.setOrderId(orderId);
|
| | | detail.setOrderType(orderType);
|
| | | detail.setPayMoney(payMoney);
|
| | | detail.setRead(false);
|
| | | detail.setState(orderState);
|
| | | detail.setType(MsgTypeOrderTypeEnum.elme);
|
| | | detail.setUser(new UserInfo(uid));
|
| | | return detail;
|
| | | }
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 创建订单被统计消息
|
| | |
| | | return null;
|
| | |
|
| | | String fanliName = "";
|
| | | MsgTypeOrderTypeEnum typeEnum = null;
|
| | | MsgTypeOrderTypeEnum orderTypeEnum = null;
|
| | | String sourceName = Constant.getSourceName(source);
|
| | | if (Constant.TYPE_REBATE == type) {
|
| | | fanliName = "返利:";
|
| | | fanliName = "预估返利:";
|
| | | sourceName += "-返利订单";
|
| | | typeEnum = MsgTypeOrderTypeEnum.fanli;
|
| | | orderTypeEnum = MsgTypeOrderTypeEnum.orderStatistics;
|
| | | } else if (Constant.TYPE_SHAER == type) {
|
| | | fanliName = "奖金:";
|
| | | fanliName = "预估奖金:";
|
| | | sourceName += "-分享订单";
|
| | | typeEnum = MsgTypeOrderTypeEnum.share;
|
| | | orderTypeEnum = MsgTypeOrderTypeEnum.orderShare;
|
| | | } else if (Constant.TYPE_INVITE == type) {
|
| | | fanliName = "收益:";
|
| | | fanliName = "预估收益:";
|
| | | sourceName += "-团队订单";
|
| | | typeEnum = MsgTypeOrderTypeEnum.invite;
|
| | | orderTypeEnum = MsgTypeOrderTypeEnum.orderInvite;
|
| | | }
|
| | |
|
| | | // 添加内容
|
| | | List<CommonMsgItemVO> listMsg = new ArrayList<>();
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("订单详情", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO(sourceName, ClientTextStyleVO.COLOR_CONTENT)));
|
| | | // 订单号可点击
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("订单号", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO(orderId, ClientTextStyleVO.COLOR_CONTENT), true));
|
| | | |
| | | if (Constant.TYPE_INVITE == type) {
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("订单号", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO(UserUtil.filterOrderId(orderId), ClientTextStyleVO.COLOR_CONTENT), true));
|
| | | } else {
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("订单号", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO(orderId, ClientTextStyleVO.COLOR_CONTENT), true));
|
| | | }
|
| | |
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("下单时间", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO(TimeUtil.formatDate(downTime), ClientTextStyleVO.COLOR_CONTENT)));
|
| | | |
| | | List<ClientTextStyleVO> contentList = new ArrayList<>();
|
| | | contentList
|
| | | .add(new ClientTextStyleVO("下单时间:" + TimeUtil.formatDate(downTime), ClientTextStyleVO.COLOR_CONTENT));
|
| | | contentList.add(new ClientTextStyleVO("-商品数量:共", ClientTextStyleVO.COLOR_CONTENT));
|
| | | contentList.add(new ClientTextStyleVO("共", ClientTextStyleVO.COLOR_CONTENT));
|
| | | contentList.add(new ClientTextStyleVO(goodsCount + "", ClientTextStyleVO.COLOR_HIGHLIGHT_CONTENT));
|
| | | contentList.add(new ClientTextStyleVO("件商品", ClientTextStyleVO.COLOR_CONTENT));
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("订单相关", ClientTextStyleVO.COLOR_TITLE),
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("商品数量", ClientTextStyleVO.COLOR_TITLE),
|
| | | contentList));
|
| | |
|
| | | List<ClientTextStyleVO> contentList2 = new ArrayList<>();
|
| | | contentList2.add(new ClientTextStyleVO("实付款:", ClientTextStyleVO.COLOR_CONTENT));
|
| | | contentList2.add(new ClientTextStyleVO("实付款:", ClientTextStyleVO.COLOR_CONTENT));
|
| | | contentList2.add(new ClientTextStyleVO("¥" + filterMoney(payMoney), ClientTextStyleVO.COLOR_HIGHLIGHT_CONTENT));
|
| | | contentList2.add(new ClientTextStyleVO("&" + fanliName, ClientTextStyleVO.COLOR_CONTENT));
|
| | | contentList2.add(new ClientTextStyleVO("¥" + filterMoney(money), ClientTextStyleVO.COLOR_HIGHLIGHT_CONTENT));
|
| | |
| | | detail.setOrderType(source);
|
| | | detail.setPayMoney(payMoney);
|
| | | detail.setRead(false);
|
| | | detail.setType(typeEnum);
|
| | | detail.setType(orderTypeEnum);
|
| | | detail.setUser(new UserInfo(uid));
|
| | | detail.setExtraInfo(new Gson().toJson(listMsg));
|
| | | return detail;
|
| | |
| | | String fanliName = "";
|
| | | String sourceName = Constant.getSourceName(source);
|
| | | if (Constant.TYPE_REBATE == type) {
|
| | | fanliName = "返利:";
|
| | | fanliName = "预估返利:";
|
| | | sourceName += "-返利订单";
|
| | | } else if (Constant.TYPE_SHAER == type) {
|
| | | fanliName = "奖金:";
|
| | | fanliName = "预估奖金:";
|
| | | sourceName += "-分享订单";
|
| | | }
|
| | |
|
| | |
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("订单号", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO(orderId, ClientTextStyleVO.COLOR_CONTENT), true));
|
| | |
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("提交时间", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO(TimeUtil.formatDate(submitTime), ClientTextStyleVO.COLOR_CONTENT)));
|
| | | |
| | | List<ClientTextStyleVO> contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO("提交时间:" + TimeUtil.formatDate(submitTime), ClientTextStyleVO.COLOR_CONTENT));
|
| | | contentList.add(new ClientTextStyleVO("-商品数量:共", ClientTextStyleVO.COLOR_CONTENT));
|
| | | contentList.add(new ClientTextStyleVO("共", ClientTextStyleVO.COLOR_CONTENT));
|
| | | contentList.add(new ClientTextStyleVO(goodsCount + "", ClientTextStyleVO.COLOR_HIGHLIGHT_CONTENT));
|
| | | contentList.add(new ClientTextStyleVO("件商品", ClientTextStyleVO.COLOR_CONTENT));
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("订单相关", ClientTextStyleVO.COLOR_TITLE),contentList));
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("商品数量", ClientTextStyleVO.COLOR_TITLE),contentList));
|
| | |
|
| | | List<ClientTextStyleVO> contentList2 = new ArrayList<>();
|
| | | contentList2.add(new ClientTextStyleVO("实付款:", ClientTextStyleVO.COLOR_CONTENT));
|
| | | contentList2.add(new ClientTextStyleVO("实付款:", ClientTextStyleVO.COLOR_CONTENT));
|
| | | contentList2.add(new ClientTextStyleVO("¥" + filterMoney(payMoney), ClientTextStyleVO.COLOR_HIGHLIGHT_CONTENT));
|
| | | contentList2.add(new ClientTextStyleVO("&" + fanliName, ClientTextStyleVO.COLOR_CONTENT));
|
| | | contentList2.add(new ClientTextStyleVO("¥" + filterMoney(money), ClientTextStyleVO.COLOR_HIGHLIGHT_CONTENT));
|
| | |
| | |
|
| | |
|
| | | MsgOrderDetail detail = new MsgOrderDetail();
|
| | | detail.setOrderId(orderId);
|
| | | detail.setBeiZhu(beiZhu);
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setOrderType(source);
|
| | |
| | | return detail;
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 商家跑路
|
| | | * @param uid
|
| | | * @param orderId
|
| | | * @param orderSource
|
| | | * @param type
|
| | | * @return
|
| | | */
|
| | | public static MsgOrderDetail orderInvalidToBusinessRunning(Long uid, String orderId, int orderSource, int type) {
|
| | | if (uid == null || StringUtil.isNullOrEmpty(orderId))
|
| | | return null;
|
| | | |
| | | String fanliName = "";
|
| | | String sourceName = Constant.getSourceName(orderSource);
|
| | | if (Constant.TYPE_REBATE == type) {
|
| | | fanliName = "返利订单";
|
| | | } else {
|
| | | fanliName = "分享订单";
|
| | | }
|
| | | |
| | | List<CommonMsgItemVO> listMsg = new ArrayList<>();
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("订单状态", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO("商家店铺已被"+sourceName+"封禁,商品佣金已被冻结,无法结算佣金,订单已失效", ClientTextStyleVO.COLOR_CONTENT)));
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("订单详情", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO(fanliName, ClientTextStyleVO.COLOR_CONTENT)));
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("订单号", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO(orderId, ClientTextStyleVO.COLOR_CONTENT)));
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("备注", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO("无", ClientTextStyleVO.COLOR_CONTENT)));
|
| | | |
| | | MsgOrderDetail detail = new MsgOrderDetail();
|
| | | detail.setOrderId(orderId);
|
| | | detail.setOrderType(orderSource);
|
| | | detail.setType(MsgTypeOrderTypeEnum.businessRunning);
|
| | | detail.setUser(new UserInfo(uid));
|
| | | detail.setRead(false);
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setUniquekey(StringUtil.Md5(uid+"&"+ orderId + "&" +orderSource + "&" + MsgTypeOrderTypeEnum.businessRunning.name()));
|
| | | detail.setExtraInfo(new Gson().toJson(listMsg));
|
| | | return detail;
|
| | | }
|
| | | }
|