| | |
| | | |
| | | public interface ElmeHongBaoOrderMapMapper extends BaseMapper<ElmeHongBaoOrderMap> { |
| | | |
| | | /** |
| | | * 根据红包ID检索 |
| | | * |
| | | * @param hongBaoId |
| | | * @return |
| | | */ |
| | | ElmeHongBaoOrderMap selectByHongBaoId(Long hongBaoId); |
| | | |
| | | /** |
| | | * 根据订单号检索 |
| | | * |
| | | * @param orderId |
| | | * @return |
| | | */ |
| | | ElmeHongBaoOrderMap selectByOrderId( Long orderId); |
| | | |
| | | } |
| | |
| | | public final static int STATE_SX = 4;// 未付款/已退款
|
| | |
|
| | | public enum MsgTypeOrderTypeEnum {
|
| | | fanli("返利订单"), share("分享订单"), invite("邀请订单"), found("订单找回");
|
| | | fanli("返利订单"), share("分享订单"), invite("邀请订单"), found("订单找回"),elme("饿了么订单");
|
| | | private final String desc;
|
| | |
|
| | | private MsgTypeOrderTypeEnum(String desc) {
|
| | |
| | |
|
| | | // 金币兑换红包
|
| | | public final static int TYPE_EXCHANGE = 30;
|
| | | |
| | | //饿了么红包
|
| | | public final static int TYPE_ELME=25;
|
| | |
|
| | | @Column(name = "hb_id")
|
| | | private Long id;
|
New file |
| | |
| | | package com.yeshi.fanli.exception.elme;
|
| | |
|
| | | import com.yeshi.fanli.exception.BaseException;
|
| | |
|
| | | public class ElmeHongBaoOrderMapException extends BaseException {
|
| | | |
| | | private static final long serialVersionUID = 1L;
|
| | | |
| | | public ElmeHongBaoOrderMapException(int code, String msg) {
|
| | | super(code, msg);
|
| | | }
|
| | |
|
| | | public ElmeHongBaoOrderMapException() {
|
| | | super();
|
| | | }
|
| | | }
|
| | |
| | | <id column="eoh_id" property="id" jdbcType="BIGINT" /> |
| | | <result column="eoh_create_time" property="createTime" |
| | | jdbcType="TIMESTAMP" /> |
| | | <association property="elmeOrder" column="eoh_order_id"> |
| | | <association property="elmeOrder" column="eoh_order_id" javaType="com.yeshi.fanli.entity.elme.ElmeOrder"> |
| | | <id property="id" column="eoh_order_id" /> |
| | | </association> |
| | | <association property="hongBao" column="eoh_hongbao_id"> |
| | | <association property="hongBao" column="eoh_hongbao_id" javaType="com.yeshi.fanli.entity.bus.user.HongBaoV2"> |
| | | <id property="id" column="eoh_hongbao_id" /> |
| | | </association> |
| | | |
| | |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_elme_order_hongbao where eoh_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | |
| | | |
| | | <select id="selectByHongBaoId" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_elme_order_hongbao where eoh_hongbao_id = #{0} |
| | | </select> |
| | | |
| | | <select id="selectByOrderId" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_elme_order_hongbao where eoh_order_id = #{0} |
| | | </select> |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_elme_order_hongbao where eoh_id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_elme_order where eo_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | |
| | | <select id="selectByOrderId" resultMap="BaseResultMap" |
| | | parameterType="java.lang.String"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_elme_order where eo_order_id = #{0} |
| | | </select> |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_elme_order where eo_id = #{id,jdbcType=BIGINT}</delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.elme.ElmeOrder" |
New file |
| | |
| | | package com.yeshi.fanli.service.impl.elme;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.elme.ElmeHongBaoOrderMapMapper;
|
| | | import com.yeshi.fanli.entity.elme.ElmeHongBaoOrderMap;
|
| | | import com.yeshi.fanli.exception.elme.ElmeHongBaoOrderMapException;
|
| | | import com.yeshi.fanli.service.inter.elme.ElmeHongBaoOrderMapService;
|
| | |
|
| | | /**
|
| | | * 饿了么红包订单映射
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | @Service
|
| | | public class ElmeHongBaoOrderMapServiceImpl implements ElmeHongBaoOrderMapService {
|
| | |
|
| | | @Resource
|
| | | private ElmeHongBaoOrderMapMapper elmeHongBaoOrderMapMapper;
|
| | |
|
| | | @Transactional
|
| | | @Override
|
| | | public void addHongBaoOrderMap(ElmeHongBaoOrderMap map) throws ElmeHongBaoOrderMapException {
|
| | | if (map.getElmeOrder() == null || map.getElmeOrder().getId() == null || map.getHongBao() == null
|
| | | || map.getHongBao().getId() == null)
|
| | | throw new ElmeHongBaoOrderMapException(1, "信息不完整");
|
| | | ElmeHongBaoOrderMap oldMap = elmeHongBaoOrderMapMapper.selectByOrderId(map.getElmeOrder().getId());
|
| | | if (oldMap != null)
|
| | | throw new ElmeHongBaoOrderMapException(2, "订单ID已经添加过映射");
|
| | | oldMap = elmeHongBaoOrderMapMapper.selectByHongBaoId(map.getHongBao().getId());
|
| | | if (oldMap != null)
|
| | | throw new ElmeHongBaoOrderMapException(3, "红包ID已经添加过映射");
|
| | | elmeHongBaoOrderMapMapper.insertSelective(map);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public ElmeHongBaoOrderMap selectByOrderId(Long orderId) {
|
| | |
|
| | | return elmeHongBaoOrderMapMapper.selectByOrderId(orderId);
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.impl.elme;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Date;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.elme.ElmeHongBaoOrderMap;
|
| | | import com.yeshi.fanli.entity.elme.ElmeOrder;
|
| | | import com.yeshi.fanli.exception.elme.ElmeHongBaoOrderMapException;
|
| | | import com.yeshi.fanli.exception.elme.ElmeOrderException;
|
| | | import com.yeshi.fanli.service.inter.elme.ElmeHongBaoOrderMapService;
|
| | | import com.yeshi.fanli.service.inter.elme.ElmeOrderProcessService;
|
| | | import com.yeshi.fanli.service.inter.elme.ElmeOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.HongBaoV2Service;
|
| | | import com.yeshi.fanli.service.inter.order.config.HongBaoManageService;
|
| | | import com.yeshi.fanli.service.inter.order.msg.UserOrderMsgNotificationService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.elme.ElmeOrderUtil;
|
| | |
|
| | | @Service
|
| | | public class ElmeOrderProcessServiceImpl implements ElmeOrderProcessService {
|
| | |
|
| | | @Resource
|
| | | private ElmeOrderService elmeOrderService;
|
| | |
|
| | | @Resource
|
| | | private ElmeHongBaoOrderMapService elmeHongBaoOrderMapService;
|
| | |
|
| | | @Resource
|
| | | private UserInfoService userInfoService;
|
| | |
|
| | | @Resource
|
| | | private HongBaoManageService hongBaoManageService;
|
| | |
|
| | | @Resource
|
| | | private HongBaoV2Service hongBaoV2Service;
|
| | |
|
| | | @Resource
|
| | | private UserOrderMsgNotificationService userOrderMsgNotificationService;
|
| | |
|
| | | @Transactional
|
| | | @Override
|
| | | public void processOrder(ElmeOrder elmeOrder) throws ElmeOrderException {
|
| | | try {
|
| | | elmeOrderService.addOrder(elmeOrder);
|
| | | } catch (ElmeOrderException e) {
|
| | | return;
|
| | | }
|
| | |
|
| | | if (elmeOrder.getId() == null)
|
| | | return;
|
| | | // 查询订单是否存在
|
| | | ElmeHongBaoOrderMap map = elmeHongBaoOrderMapService.selectByOrderId(elmeOrder.getId());
|
| | | if (map == null)// 订单不存在
|
| | | {
|
| | | String rid = elmeOrder.getRid();
|
| | | if (StringUtil.isNullOrEmpty(rid))
|
| | | return;
|
| | | // 查询映射用户
|
| | | UserInfo user = userInfoService.selectByPKey(Long.parseLong(rid));
|
| | | if (user == null)
|
| | | return;
|
| | | // 制造hongbao
|
| | | HongBaoV2 hongBao = createHongBao(elmeOrder, user);
|
| | | hongBao.setUpdateTime(new Date());
|
| | | hongBaoV2Service.insertSelective(hongBao);
|
| | | // 添加红包映射
|
| | | ElmeHongBaoOrderMap newMap = new ElmeHongBaoOrderMap();
|
| | | newMap.setCreateTime(new Date());
|
| | | newMap.setElmeOrder(elmeOrder);
|
| | | newMap.setHongBao(hongBao);
|
| | | try {
|
| | | elmeHongBaoOrderMapService.addHongBaoOrderMap(newMap);
|
| | | } catch (ElmeHongBaoOrderMapException e) {
|
| | | throw new ElmeOrderException(e.getCode(), e.getMsg());
|
| | | }
|
| | | // 发送消息
|
| | | userOrderMsgNotificationService.orderElmeStatistic(user.getId(), elmeOrder.getOrderId(),
|
| | | Constant.SOURCE_TYPE_ELME, elmeOrder.getPayMoney(), hongBao.getMoney(), hongBao.getState());
|
| | | } else {// 订单存在
|
| | | HongBaoV2 oldHongBao = hongBaoV2Service.selectByPrimaryKey(map.getHongBao().getId());
|
| | | if (oldHongBao == null)
|
| | | return;
|
| | | // 失效与到账状态的红包不需要修改
|
| | | if (oldHongBao.getState() == HongBaoV2.STATE_SHIXIAO || oldHongBao.getState() == HongBaoV2.STATE_YILINGQU)
|
| | | return;
|
| | |
|
| | | HongBaoV2 hongBao = createHongBao(elmeOrder, null);
|
| | | if (hongBao.getState() != oldHongBao.getState()) {// 是否需要修改红包状态
|
| | | HongBaoV2 update = new HongBaoV2(oldHongBao.getId());
|
| | | update.setState(hongBao.getState());
|
| | | update.setPreGetTime(hongBao.getPreGetTime());
|
| | | update.setUpdateTime(new Date());
|
| | | hongBaoV2Service.updateByPrimaryKeySelective(update);
|
| | | // 发送消息
|
| | | userOrderMsgNotificationService.orderElmeStateChanged(oldHongBao.getUserInfo().getId(),
|
| | | elmeOrder.getOrderId(), Constant.SOURCE_TYPE_ELME, elmeOrder.getPayMoney(), hongBao.getMoney(),
|
| | | hongBao.getState());
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | private HongBaoV2 createHongBao(ElmeOrder elmeOrder, UserInfo userInfo) {
|
| | | BigDecimal fanliRate = hongBaoManageService.getFanLiRate(elmeOrder.getOrderDate().getTime());
|
| | | HongBaoV2 hongBao = new HongBaoV2();
|
| | | hongBao.setCreateTime(new Date());
|
| | | hongBao.setGetTime(null);
|
| | | hongBao.setMoney(MoneyBigDecimalUtil.div(
|
| | | MoneyBigDecimalUtil.mul(ElmeOrderUtil.getCommission(elmeOrder.getPayMoney()), fanliRate),
|
| | | new BigDecimal(100)));
|
| | | if (elmeOrder.getIsSettle() == true)
|
| | | hongBao.setPreGetTime(new Date(elmeOrder.getOrderDate().getTime() + 1000 * 60 * 60 * 24 * 15L));
|
| | | if (elmeOrder.getPayMoney().compareTo(new BigDecimal(0)) <= 0)
|
| | | hongBao.setState(HongBaoV2.STATE_SHIXIAO);
|
| | | else {
|
| | | if (elmeOrder.getIsSettle() == true) {
|
| | | hongBao.setState(HongBaoV2.STATE_KELINGQU);
|
| | | } else {
|
| | | hongBao.setState(HongBaoV2.STATE_BUKELINGQU);
|
| | | }
|
| | | }
|
| | |
|
| | | hongBao.setType(HongBaoV2.TYPE_ELME);
|
| | | if (userInfo != null)
|
| | | hongBao.setUrank(userInfo.getRank());
|
| | | hongBao.setUserInfo(userInfo);
|
| | | hongBao.setVersion(2);
|
| | | return hongBao;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | order.setUpdateTime(new Date());
|
| | | elmeOrderMapper.insertSelective(order);
|
| | | } else {
|
| | | order.setId(oldOrder.getId());
|
| | | // 更新付款金额,计算状态
|
| | | ElmeOrder update = new ElmeOrder();
|
| | | update.setId(oldOrder.getId());
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void orderElmeStatistic(Long uid, String orderId, int orderType, BigDecimal payMoney, BigDecimal money,
|
| | | int orderState) {
|
| | | MsgOrderDetail detail = MsgOrderDetailFactory.createElmeOrder(uid, orderId, orderType, orderState, payMoney,
|
| | | money, null);
|
| | | try {
|
| | | msgOrderDetailService.addMsgOrderDetail(detail,
|
| | | (payMoney == null || payMoney.compareTo(new BigDecimal(0)) <= 0) ? false : true);
|
| | | } catch (MsgOrderDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void orderElmeStateChanged(Long uid, String orderId, int orderType, BigDecimal payMoney, BigDecimal money,
|
| | | int orderState) {
|
| | | MsgOrderDetail detail = MsgOrderDetailFactory.createElmeOrder(uid, orderId, orderType, orderState, payMoney,
|
| | | money, null);
|
| | | // 暂时不推送
|
| | | try {
|
| | | msgOrderDetailService.updateMsgOrderDetail(detail, false);
|
| | | } catch (MsgOrderDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.elme;
|
| | |
|
| | | import com.yeshi.fanli.entity.elme.ElmeHongBaoOrderMap;
|
| | | import com.yeshi.fanli.exception.elme.ElmeHongBaoOrderMapException;
|
| | |
|
| | | /**
|
| | | * 饿了么红包订单映射
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | public interface ElmeHongBaoOrderMapService {
|
| | | /**
|
| | | * 添加映射
|
| | | * |
| | | * @param map
|
| | | */
|
| | | public void addHongBaoOrderMap(ElmeHongBaoOrderMap map) throws ElmeHongBaoOrderMapException;
|
| | |
|
| | | /**
|
| | | * 根据订单ID查询
|
| | | * |
| | | * @param orderId
|
| | | * @return
|
| | | */
|
| | | public ElmeHongBaoOrderMap selectByOrderId(Long orderId);
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.elme;
|
| | |
|
| | | import com.yeshi.fanli.entity.elme.ElmeOrder;
|
| | | import com.yeshi.fanli.exception.elme.ElmeOrderException;
|
| | |
|
| | | public interface ElmeOrderProcessService {
|
| | | /**
|
| | | * 处理订单
|
| | | * |
| | | * @param elmeOrder
|
| | | */
|
| | | public void processOrder(ElmeOrder elmeOrder) throws ElmeOrderException;
|
| | | }
|
| | |
| | | * @param orderState
|
| | | */
|
| | |
|
| | | public void orderFanLiStatistic(Long uid, String orderId,int orderType, BigDecimal payMoney, BigDecimal money, int goodsCount,
|
| | | int orderState);
|
| | | public void orderFanLiStatistic(Long uid, String orderId, int orderType, BigDecimal payMoney, BigDecimal money,
|
| | | int goodsCount, int orderState);
|
| | |
|
| | | /**
|
| | | * 返利订单状态改变
|
| | |
| | | * @param money
|
| | | * @param orderState
|
| | | */
|
| | | public void orderFanLiStateChanged(Long uid, String orderId,int orderType, BigDecimal payMoney, BigDecimal money, int orderState);
|
| | | public void orderFanLiStateChanged(Long uid, String orderId, int orderType, BigDecimal payMoney, BigDecimal money,
|
| | | int orderState);
|
| | |
|
| | | /**
|
| | | * 分享订单统计
|
| | |
| | | * @param goodsCount
|
| | | * @param orderState
|
| | | */
|
| | | public void orderShareStatistic(Long uid, String orderId,int orderType, BigDecimal payMoney, BigDecimal money, int goodsCount,
|
| | | int orderState);
|
| | | public void orderShareStatistic(Long uid, String orderId, int orderType, BigDecimal payMoney, BigDecimal money,
|
| | | int goodsCount, int orderState);
|
| | |
|
| | | /**
|
| | | * 分享订单状态改变
|
| | |
| | | * @param money
|
| | | * @param orderState
|
| | | */
|
| | | public void orderShareStateChanged(Long uid, String orderId,int orderType, BigDecimal payMoney, BigDecimal money, int orderState);
|
| | | public void orderShareStateChanged(Long uid, String orderId, int orderType, BigDecimal payMoney, BigDecimal money,
|
| | | int orderState);
|
| | |
|
| | | /**
|
| | | * 邀请订单统计
|
| | |
| | | * @param goodsCount
|
| | | * @param orderState
|
| | | */
|
| | | public void orderInviteStatistic(Long uid, String orderId,int orderType, BigDecimal payMoney, BigDecimal money, int goodsCount,
|
| | | int orderState);
|
| | | public void orderInviteStatistic(Long uid, String orderId, int orderType, BigDecimal payMoney, BigDecimal money,
|
| | | int goodsCount, int orderState);
|
| | |
|
| | | /**
|
| | | * 邀请订单状态改变
|
| | |
| | | * @param money
|
| | | * @param orderState
|
| | | */
|
| | | public void orderInviteStateChanged(Long uid, String orderId,int orderType, BigDecimal payMoney, BigDecimal money,
|
| | | public void orderInviteStateChanged(Long uid, String orderId, int orderType, BigDecimal payMoney, BigDecimal money,
|
| | | int orderState);
|
| | |
|
| | | public void orderShareFirstLevelStatistic(Long uid, String orderId,int orderType, BigDecimal payMoney, BigDecimal money,
|
| | | int goodsCount, int orderState, String sourceUserName);
|
| | | public void orderShareFirstLevelStatistic(Long uid, String orderId, int orderType, BigDecimal payMoney,
|
| | | BigDecimal money, int goodsCount, int orderState, String sourceUserName);
|
| | |
|
| | | /**
|
| | | * 分享订单状态改变
|
| | |
| | | * @param money
|
| | | * @param orderState
|
| | | */
|
| | | public void orderShareFirstLevelStateChanged(Long uid, String orderId,int orderType, BigDecimal payMoney, BigDecimal money,
|
| | | int orderState);
|
| | | public void orderShareFirstLevelStateChanged(Long uid, String orderId, int orderType, BigDecimal payMoney,
|
| | | BigDecimal money, int orderState);
|
| | |
|
| | | /**
|
| | | * 订单找回成功
|
| | |
| | | * @param money
|
| | | * @param orderType
|
| | | */
|
| | | public void orderFoundSuccess(Long uid, String orderId, BigDecimal payMoney, int orderType,Date happendDate);
|
| | | public void orderFoundSuccess(Long uid, String orderId, BigDecimal payMoney, int orderType, Date happendDate);
|
| | |
|
| | | /**
|
| | | * 订单找回失败
|
| | |
| | | * @param orderId
|
| | | * @param payMoney
|
| | | * @param goodsCount
|
| | | * @param orderType 1-淘宝
|
| | | * @param orderType
|
| | | * 1-淘宝
|
| | | */
|
| | | public void orderFoundFail(Long uid, String orderId, BigDecimal payMoney, int orderType,Date happendDate);
|
| | | public void orderFoundFail(Long uid, String orderId, BigDecimal payMoney, int orderType, Date happendDate);
|
| | |
|
| | | /**
|
| | | * 饿了么订单统计
|
| | | * |
| | | * @param uid
|
| | | * @param orderId
|
| | | * @param orderType
|
| | | * @param payMoney
|
| | | * @param money
|
| | | * @param orderState
|
| | | */
|
| | | public void orderElmeStatistic(Long uid, String orderId, int orderType, BigDecimal payMoney, BigDecimal money,
|
| | | int orderState);
|
| | |
|
| | | /**
|
| | | * 饿了么订单状态改变
|
| | | * |
| | | * @param uid
|
| | | * @param orderId
|
| | | * @param orderType
|
| | | * @param payMoney
|
| | | * @param money
|
| | | * @param orderState
|
| | | */
|
| | | public void orderElmeStateChanged(Long uid, String orderId, int orderType, BigDecimal payMoney, BigDecimal money,
|
| | | int orderState);
|
| | |
|
| | | }
|
| | |
| | | public static final int SOURCE_TYPE_WPH = 4;
|
| | | // 来源-苏宁
|
| | | public static final int SOURCE_TYPE_SUNING = 5;
|
| | | // 来源-饿了么
|
| | | public static final int SOURCE_TYPE_ELME = 6;
|
| | |
|
| | | // 自购-返利
|
| | | public static final int TYPE_REBATE = 1;
|
| | |
| | | return "唯品会";
|
| | | case SOURCE_TYPE_SUNING:
|
| | | return "苏宁";
|
| | | case SOURCE_TYPE_ELME:
|
| | | return "饿了么";
|
| | | default:// 其他类型
|
| | | return "";
|
| | | }
|
| | |
| | | package com.yeshi.fanli.util.elme;
|
| | |
|
| | | import java.io.InputStream;
|
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.entity.elme.ElmeOrder;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | |
|
| | | import jxl.Sheet;
|
| | | import jxl.Workbook;
|
| | |
|
| | | public class ElmeOrderUtil {
|
| | |
|
| | |
| | | * @return
|
| | | */
|
| | | public static List<ElmeOrder> parseOrder(InputStream input) {
|
| | | List<ElmeOrder> list = new ArrayList<>();
|
| | | try {
|
| | | jxl.Workbook rwb = Workbook.getWorkbook(input);
|
| | | Sheet sheet = rwb.getSheet(0);
|
| | | for (int r = 1; r < sheet.getRows(); r++) {
|
| | | ElmeOrder order = new ElmeOrder();
|
| | | for (int c = 0; c < sheet.getColumns(); c++) {
|
| | | String content = sheet.getCell(c, r).getContents();
|
| | | String columnName = sheet.getCell(c, 0).getContents().trim();
|
| | | switch (columnName) {
|
| | | case "渠道号":
|
| | | order.setChannelId(content);
|
| | | break;
|
| | | case "渠道名称":
|
| | | order.setChannelName(content);
|
| | | break;
|
| | | case "track_pid":
|
| | | order.setTrackPid(content);
|
| | | break;
|
| | | case "rid":
|
| | | order.setRid(content);
|
| | | break;
|
| | | case "订单日期":
|
| | | order.setOrderDate(new Date(TimeUtil.convertToTimeTemp(content, "yyyy-MM-dd")));
|
| | | break;
|
| | | case "订单号":
|
| | | order.setOrderId(content.replace("<", "").replace(">", ""));
|
| | | break;
|
| | | case "支付金额":
|
| | | order.setPayMoney(new BigDecimal(content));
|
| | | break;
|
| | | case "下单城市":
|
| | | order.setCity(content);
|
| | | break;
|
| | | case "用券金额":
|
| | | order.setCouponMoney(new BigDecimal(content));
|
| | | break;
|
| | | case "是否新客首单":
|
| | | order.setNewerFirstOrder(Integer.parseInt(content));
|
| | | break;
|
| | | case "是否新客复购单":
|
| | | order.setNewerRepayOrder(Integer.parseInt(content));
|
| | | break;
|
| | | case "是否使用淘客红包":
|
| | | order.setTaokeHongBao(Integer.parseInt(content));
|
| | | break;
|
| | | case "是否有在会场内该门店的点击记录":
|
| | | order.setShopClick(Integer.parseInt(content));
|
| | | break;
|
| | | case "是否领券后7天内首单":
|
| | | order.setRecieveCoupon7DayFirstOrder(Integer.parseInt(content));
|
| | | break;
|
| | | case "是否6结佣":
|
| | | if ("是".equalsIgnoreCase(content))
|
| | | order.setIsSettle(true);
|
| | | else
|
| | | order.setIsSettle(false);
|
| | | break;
|
| | | }
|
| | | }
|
| | | list.add(order);
|
| | | }
|
| | | rwb.close();
|
| | | } catch (Exception e) {
|
| | | }
|
| | | return list;
|
| | | }
|
| | |
|
| | | |
| | | |
| | | |
| | | |
| | | return null;
|
| | | public static BigDecimal getCommission(BigDecimal payMoney) {
|
| | | return MoneyBigDecimalUtil.mul(payMoney, new BigDecimal("0.06"));
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | 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;
|
| | | }
|
| | |
|
| | |
|
| | | }
|
| | |
| | | import com.yeshi.fanli.entity.bus.msg.MsgOtherDetail.MsgTypeOtherTypeEnum;
|
| | | import com.yeshi.fanli.entity.bus.user.BindingAccount;
|
| | | import com.yeshi.fanli.entity.bus.user.Extract;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | | import com.yeshi.fanli.entity.common.JumpDetailV2;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | |
| | | List<CommonMsgItemVO> items = new ArrayList<>();
|
| | | List<ClientTextStyleVO> contentList = new ArrayList<>();
|
| | | if (msg.getType() == MsgTypeOrderTypeEnum.found) {
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(Constant.getSourceName(msg.getOrderType()), COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("渠道来源", COLOR_TITLE), contentList));
|
| | |
| | | COLOR_HIGHLIGHT_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("找回金额", COLOR_TITLE), contentList));
|
| | |
|
| | | } else {
|
| | | } else if (msg.getType() == MsgTypeOrderTypeEnum.elme) {
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(Constant.getSourceName(msg.getOrderType()), COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("渠道来源", COLOR_TITLE), contentList));
|
| | |
|
| | | String orderId = msg.getOrderId();
|
| | | MsgTypeOrderTypeEnum type = msg.getType();
|
| | | if (type == MsgTypeOrderTypeEnum.invite || type == MsgTypeOrderTypeEnum.share) {
|
| | | orderId = UserUtil.filterOrderId(orderId);
|
| | | }
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(orderId, COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("订单号", COLOR_TITLE), contentList, true));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(msg.getType().getDesc(), COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("订单类型", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | if (msg.getState() == HongBaoV2.STATE_BUKELINGQU||msg.getState() == HongBaoV2.STATE_KELINGQU)
|
| | | contentList.add(new ClientTextStyleVO("已付款", COLOR_HIGHLIGHT_CONTENT));
|
| | | else if (msg.getState() == HongBaoV2.STATE_SHIXIAO)
|
| | | contentList.add(new ClientTextStyleVO("未付款/已退款", COLOR_HIGHLIGHT_CONTENT));
|
| | |
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("订单状态", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO("¥" + filterMoney(msg.getPayMoney()), COLOR_HIGHLIGHT_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("付款金额", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO("¥" + filterMoney(msg.getHongBaoMoney()), COLOR_HIGHLIGHT_CONTENT));
|
| | |
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("返利金额", COLOR_TITLE), contentList));
|
| | | if (params != null)
|
| | | vo.setParams(params.toString());
|
| | | } else {
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(Constant.getSourceName(msg.getOrderType()), COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("渠道来源", COLOR_TITLE), contentList));
|