| | |
| | | package com.yeshi.fanli.util.factory.msg;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
|
| | | import com.google.gson.Gson;
|
| | | 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.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
|
| | | * @param orderId 订单号
|
| | | * @param source 订单来源:淘宝、京东、天猫
|
| | | * @param type 订单类型:自购、分享、团队
|
| | | * @param goodsCount 商品数量
|
| | | * @param payMoney 付款金额
|
| | | * @param money 返利金额
|
| | | * @param downTime 下单时间
|
| | | * @param beiZhu 备注信息 - 非必填
|
| | | * @return
|
| | | */
|
| | | public static MsgOrderDetail createFanLiOrder(Long uid, String orderId, int goodsCount, int orderState,
|
| | | BigDecimal payMoney, BigDecimal money, String beiZhu) {
|
| | | if (uid == null)
|
| | | @Transactional
|
| | | public static MsgOrderDetail createOrderStatistics(Long uid, String orderId, int source, int type, int goodsCount,
|
| | | BigDecimal payMoney, BigDecimal money, Date downTime, String beiZhu) {
|
| | | if (uid == null || StringUtil.isNullOrEmpty(orderId) || downTime == null)
|
| | | return null;
|
| | |
|
| | | String fanliName = "";
|
| | | MsgTypeOrderTypeEnum orderTypeEnum = null;
|
| | | String sourceName = Constant.getSourceName(source);
|
| | | if (Constant.TYPE_REBATE == type) {
|
| | | fanliName = "预估返利:";
|
| | | sourceName += "-返利订单";
|
| | | orderTypeEnum = MsgTypeOrderTypeEnum.orderStatistics;
|
| | | } else if (Constant.TYPE_SHAER == type) {
|
| | | fanliName = "预估奖金:";
|
| | | sourceName += "-分享订单";
|
| | | orderTypeEnum = MsgTypeOrderTypeEnum.orderShare;
|
| | | } else if (Constant.TYPE_INVITE == type) {
|
| | | fanliName = "预估收益:";
|
| | | sourceName += "-团队订单";
|
| | | orderTypeEnum = MsgTypeOrderTypeEnum.orderInvite;
|
| | | }
|
| | |
|
| | | // 添加内容
|
| | | List<CommonMsgItemVO> listMsg = new ArrayList<>();
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("订单详情", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO(sourceName, ClientTextStyleVO.COLOR_CONTENT)));
|
| | | |
| | | 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("共", 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));
|
| | |
|
| | | List<ClientTextStyleVO> contentList2 = new ArrayList<>();
|
| | | 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));
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("金额", ClientTextStyleVO.COLOR_TITLE),
|
| | | contentList2));
|
| | |
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("备注", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO(StringUtil.isNullOrEmpty(beiZhu) ? "无" : beiZhu,
|
| | | ClientTextStyleVO.COLOR_CONTENT)));
|
| | |
|
| | | MsgOrderDetail detail = new MsgOrderDetail();
|
| | | detail.setBeiZhu(beiZhu);
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setGoodsCount(goodsCount);
|
| | | detail.setHongBaoMoney(money);
|
| | | detail.setOrderId(orderId);
|
| | | detail.setOrderType(source);
|
| | | detail.setPayMoney(payMoney);
|
| | | detail.setRead(false);
|
| | | detail.setState(orderState);
|
| | | detail.setType(MsgTypeOrderTypeEnum.fanli);
|
| | | detail.setType(orderTypeEnum);
|
| | | detail.setUser(new UserInfo(uid));
|
| | | detail.setExtraInfo(new Gson().toJson(listMsg));
|
| | | return detail;
|
| | | }
|
| | | |
| | | private static BigDecimal filterMoney(BigDecimal money) {
|
| | | if (money == null)
|
| | | return BigDecimal.valueOf(0.00) ;
|
| | | else
|
| | | return money.setScale(2);
|
| | | }
|
| | | |
| | | |
| | | /**
|
| | | * 订单找回成功
|
| | | * @param uid
|
| | | * @param orderId 订单号
|
| | | * @param source 订单来源:淘宝、京东、天猫
|
| | | * @param type 订单类型:自购、分享、团队
|
| | | * @param goodsCount 商品数量
|
| | | * @param payMoney 付款金额
|
| | | * @param money 返利金额
|
| | | * @param submitTime 提交时间
|
| | | * @param beiZhu 备注信息 - 非必填
|
| | | * @return
|
| | | */
|
| | | public static MsgOrderDetail createOrderFoundSuccess(Long uid, String orderId, int source, int type, int goodsCount,
|
| | | BigDecimal payMoney, BigDecimal money, Date submitTime, String beiZhu) {
|
| | | if (uid == null || StringUtil.isNullOrEmpty(orderId) || submitTime == null)
|
| | | return null;
|
| | | |
| | | String fanliName = "";
|
| | | String sourceName = Constant.getSourceName(source);
|
| | | if (Constant.TYPE_REBATE == type) {
|
| | | fanliName = "预估返利:";
|
| | | sourceName += "-返利订单";
|
| | | } else if (Constant.TYPE_SHAER == type) {
|
| | | fanliName = "预估奖金:";
|
| | | sourceName += "-分享订单";
|
| | | }
|
| | | |
| | | List<CommonMsgItemVO> listMsg = new ArrayList<>();
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("找回状态", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO("订单找回成功", ClientTextStyleVO.COLOR_CONTENT)));
|
| | | |
| | | 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));
|
| | | |
| | | 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("共", 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));
|
| | | |
| | | List<ClientTextStyleVO> contentList2 = new ArrayList<>();
|
| | | 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));
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("金额", ClientTextStyleVO.COLOR_TITLE),contentList2));
|
| | | |
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("备注", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO(StringUtil.isNullOrEmpty(beiZhu)?"无" : beiZhu, ClientTextStyleVO.COLOR_CONTENT)));
|
| | | |
| | | |
| | | MsgOrderDetail detail = new MsgOrderDetail();
|
| | | detail.setOrderId(orderId);
|
| | | detail.setBeiZhu(beiZhu);
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setOrderType(source);
|
| | | detail.setPayMoney(payMoney);
|
| | | detail.setRead(false);
|
| | | detail.setType(MsgTypeOrderTypeEnum.foundSucceed);
|
| | | detail.setUser(new UserInfo(uid));
|
| | | detail.setExtraInfo(new Gson().toJson(listMsg));
|
| | | |
| | | 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 goodsCount, int orderState,
|
| | | BigDecimal payMoney, BigDecimal money, String beiZhu) {
|
| | | if (payMoney == null || money == null || uid == null)
|
| | | public static MsgOrderDetail createOrderFoundFail(Long uid, String orderId, String beiZhu) {
|
| | | if (uid == null || StringUtil.isNullOrEmpty(orderId))
|
| | | return null;
|
| | | |
| | | List<CommonMsgItemVO> listMsg = new ArrayList<>();
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("找回状态", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO("订单找回失败", 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)));
|
| | | listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("备注", ClientTextStyleVO.COLOR_TITLE),
|
| | | new ClientTextStyleVO(StringUtil.isNullOrEmpty(beiZhu)?"无" : beiZhu, ClientTextStyleVO.COLOR_CONTENT)));
|
| | | |
| | | MsgOrderDetail detail = new MsgOrderDetail();
|
| | | detail.setBeiZhu(beiZhu);
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setGoodsCount(goodsCount);
|
| | | detail.setHongBaoMoney(money);
|
| | | detail.setOrderId(orderId);
|
| | | detail.setPayMoney(payMoney);
|
| | | detail.setRead(false);
|
| | | detail.setState(orderState);
|
| | | detail.setType(MsgTypeOrderTypeEnum.invite);
|
| | | detail.setType(MsgTypeOrderTypeEnum.foundFail);
|
| | | detail.setUser(new UserInfo(uid));
|
| | | detail.setRead(false);
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setExtraInfo(new Gson().toJson(listMsg));
|
| | | return detail;
|
| | | }
|
| | |
|
| | | |
| | | |
| | | /**
|
| | | * 分享订单
|
| | | * |
| | | * 商家跑路
|
| | | * @param uid
|
| | | * @param orderId
|
| | | * @param goodsCount
|
| | | * @param orderState
|
| | | * @param payMoney
|
| | | * @param money
|
| | | * @param state
|
| | | * @param beiZhu
|
| | | * @param orderSource
|
| | | * @param type
|
| | | * @return
|
| | | */
|
| | | public static MsgOrderDetail createShareOrder(Long uid, String orderId, int goodsCount, int orderState,
|
| | | BigDecimal payMoney, BigDecimal money, String beiZhu) {
|
| | | if (payMoney == null || money == null || uid == null)
|
| | | 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.setBeiZhu(beiZhu);
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setGoodsCount(goodsCount);
|
| | | detail.setHongBaoMoney(money);
|
| | | detail.setOrderId(orderId);
|
| | | detail.setPayMoney(payMoney);
|
| | | detail.setRead(false);
|
| | | detail.setState(orderState);
|
| | | detail.setType(MsgTypeOrderTypeEnum.share);
|
| | | 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;
|
| | | }
|
| | |
|
| | | }
|