Merge branch 'div' of ssh://193.112.35.168:29418/fanli-server into div
# Conflicts:
# fanli/src/main/java/com/yeshi/fanli/entity/money/UserMoneyDetail.java
New file |
| | |
| | | package com.yeshi.fanli.controller.client.v1;
|
| | |
|
| | | import java.io.PrintWriter;
|
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | |
|
| | | import com.aliyuncs.unmarshaller.JsonUnmashaller;
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | | import com.yeshi.fanli.entity.elme.ElmeHongBaoOrderMap;
|
| | | import com.yeshi.fanli.entity.elme.ElmeOrder;
|
| | | import com.yeshi.fanli.service.inter.elme.ElmeHongBaoOrderMapService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.vo.elme.ElmeUserOrderVO;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | /**
|
| | | * 饿了么
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | @Controller
|
| | | @RequestMapping("api/v1/elme")
|
| | | public class ElmeController {
|
| | | @Resource
|
| | | private ElmeHongBaoOrderMapService elmeHongBaoOrderMapService;
|
| | |
|
| | | /**
|
| | | * 获取订单列表
|
| | | * |
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param page
|
| | | * @param callback
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping("getOrderList")
|
| | | public void getOrderList(AcceptData acceptData, Long uid, int page, String callback, PrintWriter out) {
|
| | | List<ElmeUserOrderVO> voList = new ArrayList<>();
|
| | | List<ElmeHongBaoOrderMap> list = elmeHongBaoOrderMapService.listByHongBaoUid(uid, page, Constant.PAGE_SIZE);
|
| | | if (list != null)
|
| | | for (ElmeHongBaoOrderMap map : list)
|
| | | voList.add(create(map));
|
| | | long count = elmeHongBaoOrderMapService.countByHongBaoUid(uid);
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("count", count);
|
| | | data.put("list", voList);
|
| | | if (!StringUtil.isNullOrEmpty(callback))
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data)));
|
| | | else
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | private ElmeUserOrderVO create(ElmeHongBaoOrderMap map) {
|
| | | HongBaoV2 hognBao = map.getHongBao();
|
| | | ElmeOrder order = map.getElmeOrder();
|
| | |
|
| | | ElmeUserOrderVO vo = new ElmeUserOrderVO();
|
| | | vo.setCreateTime(TimeUtil.getGernalTime(hognBao.getCreateTime().getTime(), "yyyy-MM-dd"));
|
| | | if (hognBao.getState() == HongBaoV2.STATE_BUKELINGQU || hognBao.getState() == HongBaoV2.STATE_KELINGQU)
|
| | | vo.setHongBaoState("未到账");
|
| | | else if (hognBao.getState() == HongBaoV2.STATE_SHIXIAO)
|
| | | vo.setHongBaoState("已失效");
|
| | | else
|
| | | vo.setHongBaoState("已到账");
|
| | | vo.setId(map.getId());
|
| | | vo.setMoney(hognBao.getMoney());
|
| | | vo.setOrderId(order.getOrderId());
|
| | | if (order.getPayMoney() == null || order.getPayMoney().compareTo(new BigDecimal(0)) <= 0)
|
| | | vo.setOrderState("未付款/已退款");
|
| | | else
|
| | | vo.setOrderState("已付款");
|
| | |
|
| | | vo.setOrderTime(TimeUtil.getGernalTime(order.getOrderDate().getTime(), "yyyy-MM-dd"));
|
| | | vo.setPayMoney(order.getPayMoney().toString());
|
| | | if (hognBao.getPreGetTime() != null)
|
| | | vo.setPreGetTime(TimeUtil.getGernalTime(hognBao.getPreGetTime().getTime(), "yyyy-MM-dd"));
|
| | | return vo;
|
| | | }
|
| | | }
|
| | |
| | | */
|
| | | @RequestMapping(value = "getShareGoodsV2", method = RequestMethod.POST)
|
| | | public void getShareGoodsV2(AcceptData acceptData, Long uid, PrintWriter out) {
|
| | | if (uid == null || uid <= 0) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "用户未登录"));
|
| | | return;
|
| | | }
|
| | |
|
| | | String day = TimeUtil.getGernalTime(java.lang.System.currentTimeMillis());
|
| | | List<ShareHotGoods> listHot = shareHotGoodsService.listByDay(day);
|
| | | if (listHot == null) {
|
| | |
| | | package com.yeshi.fanli.dao.mybatis.elme; |
| | | |
| | | import java.util.List;
|
| | |
|
| | | import org.apache.ibatis.annotations.Param;
|
| | |
|
| | | import com.yeshi.fanli.dao.BaseMapper; |
| | | import com.yeshi.fanli.entity.elme.ElmeHongBaoOrderMap; |
| | | |
| | | public interface ElmeHongBaoOrderMapMapper extends BaseMapper<ElmeHongBaoOrderMap> { |
| | | |
| | | /**
|
| | | * 根据红包ID检索
|
| | | * |
| | | * @param hongBaoId
|
| | | * @return
|
| | | */
|
| | | ElmeHongBaoOrderMap selectByHongBaoId(Long hongBaoId);
|
| | |
|
| | | /**
|
| | | * 根据订单号检索
|
| | | * |
| | | * @param orderId
|
| | | * @return
|
| | | */
|
| | | ElmeHongBaoOrderMap selectByOrderId(Long orderId);
|
| | |
|
| | | /**
|
| | | * |
| | | * @param uid
|
| | | * @param start
|
| | | * @param count
|
| | | * @return
|
| | | */
|
| | | List<ElmeHongBaoOrderMap> listByHongBaoUid(@Param("uid") Long uid, @Param("start") long start,
|
| | | @Param("count") int count);
|
| | |
|
| | | /**
|
| | | * 根据红包用户ID计数
|
| | | * |
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | long countByHongBaoUid(Long uid);
|
| | |
|
| | | } |
| | |
| | | @Table("yeshi_ec_msg_money")
|
| | | public class MsgMoneyDetail {
|
| | | public enum MsgTypeMoneyTypeEnum {
|
| | | |
| | | share("分享奖金"), invite("邀请奖金"), fanli("返利到账"), extract("提现"), extractAutoWX("自动提现"), extractValid("提现账号验证"), shareWeiQuan(
|
| | | "分享奖金扣除"), inviteWeiQuan("邀请奖金扣除"), fanliWeiQuan("返利扣除"), orderReward("返利奖励"), systemEqualize("系统补齐");
|
| | | "分享奖金扣除"), inviteWeiQuan("邀请奖金扣除"), fanliWeiQuan("返利扣除"), orderReward("返利奖励"), systemEqualize("系统补齐"),fanliElme("返利到账"); |
| | | private final String desc;
|
| | |
|
| | | private MsgTypeMoneyTypeEnum(String desc) {
|
| | |
| | | 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;
|
| | |
| | | ""), hongbao("官方红包", "http://img.flqapp.com/resource/money_detail/icon_hongbao.png", ""), hongbaoDeduct("红包退款", "http://img.flqapp.com/resource/money_detail/icon_hongbao.png",
|
| | | ""), buyScore("购买积分", "http://img.flqapp.com/resource/money_detail/icon_score.png", ""), extract("提现", "http://img.flqapp.com/resource/money_detail/icon_extract.png",
|
| | | ""), extractVerify("提现验证", "http://img.flqapp.com/resource/money_detail/icon_extract.png", ""), extractReject("提现被拒", "http://img.flqapp.com/resource/money_detail/icon_extract.png", ""),orderReward("返利奖励金","http://img.flqapp.com/resource/money_detail/icon_order_reward.png",""),repeatStatistic("重复统计返利/奖金扣除","http://img.flqapp.com/resource/money_detail/icon_fanli.png",""),
|
| | | elmeFanli("饿了么返利到账","http://img.flqapp.com/resource/money_detail/icon_fanli.png",""),
|
| | | extractAutoWX("自动提现", "http://img.flqapp.com/resource/money_detail/icon_extract.png", ""), extractAutoWXRefund("自动提现失败", "http://img.flqapp.com/resource/money_detail/icon_extract.png", "");
|
| | |
|
| | |
|
| | | private final String desc;
|
| | | private final String picture;
|
| | | private final String helpUrl;
|
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"> |
| | | <id property="id" column="eoh_order_id" /> |
| | | <association property="elmeOrder" column="eoh_order_id"
|
| | | javaType="com.yeshi.fanli.entity.elme.ElmeOrder"
|
| | | select="com.yeshi.fanli.dao.mybatis.elme.ElmeOrderMapper.selectByPrimaryKey">
|
| | | </association> |
| | | <association property="hongBao" column="eoh_hongbao_id"> |
| | | <id property="id" column="eoh_hongbao_id" /> |
| | | <association property="hongBao" column="eoh_hongbao_id"
|
| | | javaType="com.yeshi.fanli.entity.bus.user.HongBaoV2"
|
| | | select="com.yeshi.fanli.dao.mybatis.HongBaoV2Mapper.selectByPrimaryKey">
|
| | | </association> |
| | | |
| | | </resultMap> |
| | |
| | | <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>
|
| | |
|
| | |
|
| | | <select id="listByHongBaoUid" resultMap="BaseResultMap">
|
| | | select
|
| | | <include refid="Base_Column_List" />
|
| | | from yeshi_ec_elme_order_hongbao left join yeshi_ec_hongbao_v2 v on
|
| | | v.hb_id=eoh_hongbao_id where v.hb_uid = #{uid} order by eoh_id desc limit #{start},#{count}
|
| | | </select>
|
| | |
|
| | |
|
| | | <select id="countByHongBaoUid" resultType="java.lang.Long"
|
| | | parameterType="java.lang.Long">
|
| | | select
|
| | | count(eoh_id)
|
| | | from yeshi_ec_elme_order_hongbao left
|
| | | join yeshi_ec_hongbao_v2 v on
|
| | | v.hb_id=eoh_hongbao_id where v.hb_uid =
|
| | | #{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" |
| | |
| | | <select id="listCanBalanceHongBaoByTypeAndUid" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_hongbao_v2 where hb_uid=#{uid} and `hb_version`=2 |
| | | from yeshi_ec_hongbao_v2 where `hb_version`=2
|
| | | <if test="uid!=null">
|
| | | and hb_uid=#{uid}
|
| | | </if>
|
| | | |
| | | <foreach collection="types" item="type" open=" and (" |
| | | separator=" or " close=")"> |
New file |
| | |
| | | package com.yeshi.fanli.service.impl.elme;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | 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);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public ElmeHongBaoOrderMap selectByHongBaoId(Long hongBaoId) {
|
| | | return elmeHongBaoOrderMapMapper.selectByHongBaoId(hongBaoId);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<ElmeHongBaoOrderMap> listByHongBaoUid(Long uid, int page, int pageSize) {
|
| | | return elmeHongBaoOrderMapMapper.listByHongBaoUid(uid, (page - 1) * pageSize, pageSize);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public long countByHongBaoUid(Long uid) {
|
| | | return elmeHongBaoOrderMapMapper.countByHongBaoUid(uid);
|
| | | }
|
| | |
|
| | | }
|
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());
|
| | |
| | | elmeOrderMapper.updateByPrimaryKeySelective(update);
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public ElmeOrder selectByPrimaryKey(Long id) {
|
| | | return elmeOrderMapper.selectByPrimaryKey(id);
|
| | | }
|
| | | }
|
| | |
| | | import com.yeshi.fanli.service.inter.user.UserAccountBindingHistoryService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.factory.UserMoneyDetailFactory;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
| | | }
|
| | | AlipayAccountValidNormalHistory latest = alipayAccountValidNormalHistoryMapper.selectLatestByUid(uid);
|
| | | if (latest != null) {
|
| | | Calendar caLatest = Calendar.getInstance();
|
| | | caLatest.setTimeInMillis(latest.getCreateTime().getTime());
|
| | | Calendar nowLatest = Calendar.getInstance();
|
| | | if (caLatest.get(Calendar.MONTH) == nowLatest.get(Calendar.MONTH))// 上次更改和现在是同一个月
|
| | | if (TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyy-MM")
|
| | | .equalsIgnoreCase(TimeUtil.getGernalTime(latest.getCreateTime().getTime(), "yyyy-MM")))// 上次更改和现在是同一年同一个月
|
| | | throw new BindingAccountException(2, "每月仅可修改1次提现账号,请下月再试吧。");
|
| | | }
|
| | | return true;
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void elmeFanli(Long uid, String orderId, BigDecimal money, BigDecimal balance) {
|
| | | MsgMoneyDetail detail = MsgMoneyDetailFactory.createElmeFanliMsg(uid, orderId, money, balance, null);
|
| | | try {
|
| | | msgMoneyDetailService.addMsgMoneyDetail(detail);
|
| | | } catch (MsgMoneyDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | import com.yeshi.fanli.entity.bus.user.Order;
|
| | | import com.yeshi.fanli.entity.bus.user.UserExtraTaoBaoInfo;
|
| | | 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.entity.jd.JDOrder;
|
| | | import com.yeshi.fanli.entity.jd.JDOrderItem;
|
| | | import com.yeshi.fanli.entity.money.UserMoneyDetail;
|
| | |
| | | import com.yeshi.fanli.exception.order.OrderItemException;
|
| | | import com.yeshi.fanli.exception.order.TaoBaoWeiQuanException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.elme.ElmeHongBaoOrderMapService;
|
| | | import com.yeshi.fanli.service.inter.elme.ElmeOrderService;
|
| | | import com.yeshi.fanli.service.inter.hongbao.AccountDetailsHongBaoMapService;
|
| | | import com.yeshi.fanli.service.inter.money.UserMoneyService;
|
| | | import com.yeshi.fanli.service.inter.money.msg.UserMoneyMsgNotificationService;
|
| | |
| | |
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | public void elmeFanli() {
|
| | |
|
| | | }
|
| | |
|
| | | // 饿了么订单
|
| | | @Resource
|
| | | private ElmeHongBaoOrderMapService elmeHongBaoOrderMapService;
|
| | |
|
| | | @Resource
|
| | | private ElmeOrderService elmeOrderService;
|
| | |
|
| | | /**
|
| | | * 获取饿了么可以返利的红包
|
| | | * |
| | | * @return
|
| | | */
|
| | | @Override
|
| | | public List<HongBaoV2> getCanBalanceElmeFanliHongBao() {
|
| | | List<Integer> list = new ArrayList<>();
|
| | | list.add(HongBaoV2.TYPE_ELME);
|
| | | return hongBaoV2Mapper.listCanBalanceHongBaoByTypeAndUid(list, null, 0, 1000);
|
| | | }
|
| | |
|
| | | @Override
|
| | | @Transactional
|
| | | public void elmeFanli(Long hongBaoId) {
|
| | | // 查询详情
|
| | | HongBaoV2 hongBao = hongBaoV2Mapper.selectByPrimaryKeyForUpdate(hongBaoId);
|
| | | if (hongBao.getType() == HongBaoV2.TYPE_ELME && hongBao.getState() == HongBaoV2.STATE_KELINGQU
|
| | | && hongBao.getPreGetTime() != null && System.currentTimeMillis() > hongBao.getPreGetTime().getTime()) {// 可以到账了
|
| | | // 判断用户状态
|
| | | UserInfo user = userInfoMapper.selectByPrimaryKey(hongBao.getUserInfo().getId());
|
| | | if (user == null || user.getState() != UserInfo.STATE_NORMAL)
|
| | | return;
|
| | | ElmeHongBaoOrderMap map = elmeHongBaoOrderMapService.selectByHongBaoId(hongBaoId);
|
| | | if (map == null)
|
| | | return;
|
| | | ElmeOrder order = elmeOrderService.selectByPrimaryKey(map.getElmeOrder().getId());
|
| | | if (order == null)
|
| | | return;
|
| | |
|
| | | // 到账,加数据
|
| | | HongBaoV2 update = new HongBaoV2(hongBao.getId());
|
| | | update.setUpdateTime(new Date());
|
| | | update.setGetTime(new Date());
|
| | | update.setState(HongBaoV2.STATE_YILINGQU);
|
| | | hongBaoV2Mapper.updateByPrimaryKeySelective(update);
|
| | | // 增加资金
|
| | | UserMoneyDetail detail = null;
|
| | | try {
|
| | | detail = UserMoneyDetailFactory.createElmeFanLi(hongBao.getUserInfo().getId(), order.getOrderId(),
|
| | | hongBao.getId(), hongBao.getMoney());
|
| | | } catch (UserMoneyDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | userMoneyService.addUserMoney(hongBao.getUserInfo().getId(), hongBao.getMoney(), detail);
|
| | | BigDecimal balance = userInfoMapper.selectByPrimaryKey(hongBao.getUserInfo().getId()).getMyHongBao();
|
| | | // 添加消息
|
| | | userMoneyMsgNotificationService.elmeFanli(hongBao.getUserInfo().getId(), order.getOrderId(),
|
| | | hongBao.getMoney(), balance);
|
| | | }
|
| | | // 返利到账
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | @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();
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | if (newUser != null) {
|
| | | throw new UserAccountException(4, "该微信号已被其他帐号绑定");
|
| | | }
|
| | | } else if (wxUnionId.equals(wxUnionIdExist)) {
|
| | | } else if (wxUnionId.equalsIgnoreCase(wxUnionIdExist)) {
|
| | | throw new UserAccountException(3, "微信帐号一致无需更换");
|
| | | }
|
| | |
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.elme;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | 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);
|
| | |
|
| | | /**
|
| | | * 根据hongBaoId查询
|
| | | * |
| | | * @param hongBaoId
|
| | | * @return
|
| | | */
|
| | | public ElmeHongBaoOrderMap selectByHongBaoId(Long hongBaoId);
|
| | |
|
| | | /**
|
| | | * 根据红包用户ID检索
|
| | | * |
| | | * @param uid
|
| | | * @param page
|
| | | * @param pageSize
|
| | | * @return
|
| | | */
|
| | | public List<ElmeHongBaoOrderMap> listByHongBaoUid(Long uid, int page, int pageSize);
|
| | |
|
| | | /**
|
| | | * 根据红包用户ID计数
|
| | | * |
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | public long countByHongBaoUid(Long uid);
|
| | |
|
| | | }
|
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 order
|
| | | */
|
| | | public void addOrder(ElmeOrder order) throws ElmeOrderException;
|
| | |
|
| | | public ElmeOrder selectByPrimaryKey(Long id);
|
| | |
|
| | | }
|
| | |
| | | * @param money
|
| | | * @param balance
|
| | | */
|
| | | public void fanliOrderReceived(Long uid, String orderId,int orderType, int goodsCount, BigDecimal money, BigDecimal balance);
|
| | | public void fanliOrderReceived(Long uid, String orderId, int orderType, int goodsCount, BigDecimal money,
|
| | | BigDecimal balance);
|
| | |
|
| | | /**
|
| | | * 返利订单维权
|
| | |
| | | * @param money
|
| | | * @param balance
|
| | | */
|
| | | public void shareOrderReceived(Long uid,int orderType, int orderCount, int goodsCount, BigDecimal money, BigDecimal balance);
|
| | | public void shareOrderReceived(Long uid, int orderType, int orderCount, int goodsCount, BigDecimal money,
|
| | | BigDecimal balance);
|
| | |
|
| | | /**
|
| | | * 分享订单维权
|
| | |
| | | * @param money
|
| | | * @param balance
|
| | | */
|
| | | public void inviteOrderReceived(Long uid,int orderType, int orderCount, int goodsCount, BigDecimal money, BigDecimal balance);
|
| | | public void inviteOrderReceived(Long uid, int orderType, int orderCount, int goodsCount, BigDecimal money,
|
| | | BigDecimal balance);
|
| | |
|
| | | /**
|
| | | * 邀请订单维权
|
| | |
| | | public void systemEqualize(Long uid, String reason, BigDecimal money, BigDecimal balance);
|
| | |
|
| | | /**
|
| | | * 饿了么返利到账
|
| | | * |
| | | * @param uid
|
| | | * @param orderId
|
| | | * @param money
|
| | | * @param balance
|
| | | */
|
| | | public void elmeFanli(Long uid, String orderId, BigDecimal money, BigDecimal balance);
|
| | |
|
| | | /*
|
| | | * 自动提现消息-微信
|
| | | * |
| | | * @param extractRecord
|
| | | * |
| | | * @param stateDesc
|
| | | * |
| | | * @param desc
|
| | | * |
| | | * @param beiZhu
|
| | | */
|
| | | public void extractAuto(ExtractWeiXinRecord extractRecord, String stateDesc, String desc, String beiZhu);
|
| | |
| | | */
|
| | | public void doTaoBaoSellerNotPaid(TaoBaoOrder order);
|
| | |
|
| | | /**
|
| | | * 获取可以返利的饿了么红包
|
| | | * @return
|
| | | */
|
| | | public List<HongBaoV2> getCanBalanceElmeFanliHongBao();
|
| | |
|
| | | /**
|
| | | * 饿了么返利
|
| | | * @param hongBaoId
|
| | | */
|
| | | public void elmeFanli(Long hongBaoId);
|
| | | }
|
| | |
| | | * @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);
|
| | |
|
| | | /**
|
| | | * 邀请订单状态改变
|
| | |
| | | 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 orderId
|
| | | * @param payMoney
|
| | | * @param goodsCount
|
| | | * @param orderType 1-淘宝
|
| | | * @param orderType
|
| | | * 1-淘宝
|
| | | */
|
| | | 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"));
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | }
|
| | |
|
| | | /**
|
| | | * 饿了么返利
|
| | | * |
| | | * @param uid
|
| | | * @param orderId
|
| | | * @param hbId
|
| | | * @param money
|
| | | * @return
|
| | | * @throws UserMoneyDetailException
|
| | | */
|
| | | public static UserMoneyDetail createElmeFanLi(Long uid, String orderId, Long hbId, BigDecimal money)
|
| | | throws UserMoneyDetailException {
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(orderId))
|
| | | throw new UserMoneyDetailException(1, "订单号为空");
|
| | |
|
| | | if (money == null)
|
| | | throw new UserMoneyDetailException(1, "返利金额为空");
|
| | |
|
| | | if (uid == null)
|
| | | throw new UserMoneyDetailException(1, "UID为空");
|
| | |
|
| | | UserMoneyDetail detail = new UserMoneyDetail();
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setIdentifyCode(StringUtil.Md5(UserMoneyDetailTypeEnum.elmeFanli.name() + "-" + hbId));
|
| | | detail.setMoney(money);
|
| | | detail.setTitle(UserMoneyDetailTypeEnum.elmeFanli.getDesc());
|
| | | detail.setType(UserMoneyDetailTypeEnum.elmeFanli);
|
| | | detail.setDescInfo("订单号:" + orderId);
|
| | | detail.setUpdateTime(new Date());
|
| | | detail.setUserInfo(new UserInfo(uid));
|
| | | detail.setOrderType(Constant.SOURCE_TYPE_ELME);
|
| | | return detail;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 分享奖金到账
|
| | | *
|
| | | * @param uid
|
| | |
| | | detail.setUser(new UserInfo(uid));
|
| | | return detail;
|
| | | }
|
| | | |
| | | |
| | | public static MsgMoneyDetail createElmeFanliMsg(Long uid, String orderId, BigDecimal money, BigDecimal balance,
|
| | | String beiZhu) {
|
| | | if (money == null || money == null || uid == null)
|
| | | return null;
|
| | |
|
| | | MsgMoneyDetail detail = new MsgMoneyDetail();
|
| | | detail.setBalance(balance);
|
| | | detail.setBeiZhu(beiZhu);
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setMoney(money);
|
| | | detail.setMsgType(MsgTypeMoneyTypeEnum.fanliElme);
|
| | | detail.setOrderId(orderId);
|
| | | detail.setRead(false);
|
| | | detail.setUser(new UserInfo(uid));
|
| | | return detail;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | 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, false));
|
| | |
|
| | | 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));
|
| | |
| | | return new UserMsgVO("http://img.flqapp.com/resource/msg/icon_msg_fanli.png", "返利到账",
|
| | | msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
|
| | |
|
| | | } else if (msg.getMsgType() == MsgTypeMoneyTypeEnum.fanliElme) {
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO("饿了么", COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("渠道来源", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | // 返利到账
|
| | | contentList.add(new ClientTextStyleVO(msg.getOrderId(), COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("订单号", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO("¥" + filterMoney(msg.getMoney()) + "", COLOR_HIGHLIGHT_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("返利金额", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO("¥" + filterMoney(msg.getBalance()) + "", COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("账户余额", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(StringUtil.isNullOrEmpty(msg.getBeiZhu()) ? "无" : msg.getBeiZhu(),
|
| | | COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", COLOR_TITLE), contentList));
|
| | |
|
| | | return new UserMsgVO("http://img.flqapp.com/resource/msg/icon_msg_fanli.png", "返利到账",
|
| | | msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
|
| | |
|
| | | } else if (msg.getMsgType() == MsgTypeMoneyTypeEnum.invite || msg.getMsgType() == MsgTypeMoneyTypeEnum.share) {
|
| | |
|
| | | contentList = new ArrayList<>();
|
New file |
| | |
| | | package com.yeshi.fanli.vo.elme;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | |
|
| | | /**
|
| | | * 饿了么前端输出订单
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | public class ElmeUserOrderVO {
|
| | | private Long id;
|
| | | private String orderState;// 订单状态
|
| | | private String hongBaoState;// 红包状态
|
| | | private String orderId;// 订单号
|
| | | private String payMoney;// 支付金额
|
| | | private String orderTime;// 订单时间
|
| | | private String createTime;// 创建时间
|
| | | private String preGetTime;// 预计领取时间
|
| | | private BigDecimal money;// 返利金额
|
| | |
|
| | | public Long getId() {
|
| | | return id;
|
| | | }
|
| | |
|
| | | public void setId(Long id) {
|
| | | this.id = id;
|
| | | }
|
| | |
|
| | | public String getOrderState() {
|
| | | return orderState;
|
| | | }
|
| | |
|
| | | public void setOrderState(String orderState) {
|
| | | this.orderState = orderState;
|
| | | }
|
| | |
|
| | | public String getHongBaoState() {
|
| | | return hongBaoState;
|
| | | }
|
| | |
|
| | | public void setHongBaoState(String hongBaoState) {
|
| | | this.hongBaoState = hongBaoState;
|
| | | }
|
| | |
|
| | | public String getOrderId() {
|
| | | return orderId;
|
| | | }
|
| | |
|
| | | public void setOrderId(String orderId) {
|
| | | this.orderId = orderId;
|
| | | }
|
| | |
|
| | | public String getPayMoney() {
|
| | | return payMoney;
|
| | | }
|
| | |
|
| | | public void setPayMoney(String payMoney) {
|
| | | this.payMoney = payMoney;
|
| | | }
|
| | |
|
| | | public String getOrderTime() {
|
| | | return orderTime;
|
| | | }
|
| | |
|
| | | public void setOrderTime(String orderTime) {
|
| | | this.orderTime = orderTime;
|
| | | }
|
| | |
|
| | | public String getCreateTime() {
|
| | | return createTime;
|
| | | }
|
| | |
|
| | | public void setCreateTime(String createTime) {
|
| | | this.createTime = createTime;
|
| | | }
|
| | |
|
| | | public String getPreGetTime() {
|
| | | return preGetTime;
|
| | | }
|
| | |
|
| | | public void setPreGetTime(String preGetTime) {
|
| | | this.preGetTime = preGetTime;
|
| | | }
|
| | |
|
| | | public BigDecimal getMoney() {
|
| | | return money;
|
| | | }
|
| | |
|
| | | public void setMoney(BigDecimal money) {
|
| | | this.money = money;
|
| | | }
|
| | |
|
| | | }
|