admin
2019-02-25 8c66e480d8a3c129a9032a90d39688e875f45ee5
奖励订单到账逻辑添加
15个文件已修改
5个文件已添加
522 ■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/client/ConfigController.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/GoodsController.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/UserMsgController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/order/OrderHongBaoMapMapper.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/bus/msg/MsgMoneyDetail.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/order/OrderHongBaoMap.java 59 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/order/OrderHongBaoMapMapper.xml 67 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/msg/UserMoneyMsgNotificationServiceImpl.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/order/OrderHongBaoMapServiceImpl.java 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserAccountServiceImpl.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserMoneyDetailServiceImpl.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java 181 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/msg/UserMoneyMsgNotificationService.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/order/OrderHongBaoMapService.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/user/UserMoneyDetailService.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/user/UserSystemCouponService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/Constant.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/factory/UserMoneyDetailFactory.java 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/factory/msg/MsgMoneyDetailFactory.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/factory/msg/UserMsgVOFactory.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/ConfigController.java
@@ -54,13 +54,18 @@
        AppHomeFloatImg appHomeFloatImg = configService.getAppHomeFloatImg();
        if ("ios".equalsIgnoreCase(acceptData.getPlatform()) && !Constant.IS_TEST)
            appHomeFloatImg = null;
        JSONObject data = new JSONObject();
        JSONObject data =new JSONObject();
        if (appHomeFloatImg != null)
            data.put("floatImg", appHomeFloatImg);
        String notifyImg = configService.getAppHomeFloatNotifyImg();
        if (!StringUtil.isNullOrEmpty(notifyImg)) {
            data.put("floatNotifyImg", notifyImg);
        }
        //
        String config = configService.get("home_float_img_new");
        if (!StringUtil.isNullOrEmpty(config)) {
            data.put("floatImgDetail", config);
        }
        out.print(JsonUtil.loadTrueResult(data));
    }
fanli/src/main/java/com/yeshi/fanli/controller/client/GoodsController.java
@@ -19,6 +19,7 @@
import com.yeshi.fanli.entity.taobao.TaoBaoLink;
import com.yeshi.fanli.entity.taobao.TaoBaoUnionConfig;
import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException;
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.service.inter.goods.ShareGoodsService;
import com.yeshi.fanli.service.inter.monitor.MonitorService;
import com.yeshi.fanli.service.inter.taobao.TaoBaoUnionConfigService;
@@ -105,6 +106,12 @@
            } catch (TaobaoGoodsDownException e) {
                out.print(JsonUtil.loadFalseResult(3, "商品已下架"));
                return;
            } catch (Exception e) {
                try {
                    LogHelper.errorDetailInfo(e, "获取商品简版详情出错", auctionId + "");
                } catch (Exception e1) {
                    e1.printStackTrace();
                }
            }
            pid = Constant.TAOBAO_SPECIAL_PID_DEFAULT;
fanli/src/main/java/com/yeshi/fanli/controller/client/UserMsgController.java
@@ -416,7 +416,7 @@
            volist.add(vo);
        }
        Long time = userInfoService.getUserById(uid).getCreatetime();
        Long time = userInfoService.selectByPKey(uid).getCreatetime();
        if (time > TimeUtil.convertToTimeTemp("2019-01-28", "yyyy-MM-dd"))
            count++;// 计算欢迎语的数量
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/order/OrderHongBaoMapMapper.java
New file
@@ -0,0 +1,9 @@
package com.yeshi.fanli.dao.mybatis.order;
import com.yeshi.fanli.dao.BaseMapper;
import com.yeshi.fanli.entity.order.OrderHongBaoMap;
public interface OrderHongBaoMapMapper extends BaseMapper<OrderHongBaoMap>{
}
fanli/src/main/java/com/yeshi/fanli/entity/bus/msg/MsgMoneyDetail.java
@@ -20,7 +20,7 @@
public class MsgMoneyDetail {
    public enum MsgTypeMoneyTypeEnum {
        share("分享奖金"), invite("邀请奖金"), fanli("返利到账"), extract("提现"), extractValid("提现账号验证"), shareWeiQuan(
                "分享奖金扣除"), inviteWeiQuan("邀请奖金扣除"), fanliWeiQuan("返利扣除");
                "分享奖金扣除"), inviteWeiQuan("邀请奖金扣除"), fanliWeiQuan("返利扣除"),orderReward("奖励订单");
        private final String desc;
        private MsgTypeMoneyTypeEnum(String desc) {
fanli/src/main/java/com/yeshi/fanli/entity/order/OrderHongBaoMap.java
New file
@@ -0,0 +1,59 @@
package com.yeshi.fanli.entity.order;
import java.util.Date;
import org.yeshi.utils.mybatis.Column;
import org.yeshi.utils.mybatis.Table;
import com.yeshi.fanli.entity.bus.user.HongBaoV2;
import com.yeshi.fanli.entity.bus.user.Order;
/**
 * 订单与红包关联(用于订单活动)
 *
 * @author Administrator
 *
 */
@Table("yeshi_ec_order_hongbaov2_map")
public class OrderHongBaoMap {
    @Column(name = "ohm_id")
    private Long id;
    @Column(name = "ohm_order_id")
    private Order order;// 订单
    @Column(name = "ohm_hongbao_id")
    private HongBaoV2 hongBao;
    @Column(name = "ohm_create_time")
    private Date createTime;
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public Order getOrder() {
        return order;
    }
    public void setOrder(Order order) {
        this.order = order;
    }
    public HongBaoV2 getHongBao() {
        return hongBao;
    }
    public void setHongBao(HongBaoV2 hongBao) {
        this.hongBao = hongBao;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}
fanli/src/main/java/com/yeshi/fanli/mapping/order/OrderHongBaoMapMapper.xml
New file
@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeshi.fanli.dao.mybatis.order.OrderHongBaoMapMapper">
    <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.order.OrderHongBaoMap">
        <id column="ohm_id" property="id" jdbcType="BIGINT" />
        <result column="ohm_create_time" property="createTime"
            jdbcType="TIMESTAMP" />
        <association property="order" column="ohm_order_id"
            javaType="com.yeshi.fanli.entity.bus.user.Order">
            <id column="ohm_order_id" property="id" jdbcType="BIGINT" />
        </association>
        <association property="hongBao" column="ohm_hongbao_id"
            javaType="com.yeshi.fanli.entity.bus.user.HongBaoV2">
            <id column="ohm_hongbao_id" property="id" jdbcType="BIGINT" />
        </association>
    </resultMap>
    <sql id="Base_Column_List">ohm_id,ohm_order_id,ohm_hongbao_id,ohm_create_time</sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_order_hongbaov2_map where ohm_id = #{id,jdbcType=BIGINT}
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
        yeshi_ec_order_hongbaov2_map where ohm_id = #{id,jdbcType=BIGINT}
    </delete>
    <insert id="insert" parameterType="com.yeshi.fanli.entity.order.OrderHongBaoMap"
        useGeneratedKeys="true" keyProperty="id">insert into
        yeshi_ec_order_hongbaov2_map
        (ohm_id,ohm_order_id,ohm_hongbao_id,ohm_create_time) values
        (#{id,jdbcType=BIGINT},#{order.id,jdbcType=BIGINT},#{hongBao.id,jdbcType=BIGINT},#{createTime,jdbcType=TIMESTAMP})
    </insert>
    <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.order.OrderHongBaoMap"
        useGeneratedKeys="true" keyProperty="id">
        insert into yeshi_ec_order_hongbaov2_map
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">ohm_id,</if>
            <if test="order != null">ohm_order_id,</if>
            <if test="hongBao != null">ohm_hongbao_id,</if>
            <if test="createTime != null">ohm_create_time,</if>
        </trim>
        values
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id,jdbcType=BIGINT},</if>
            <if test="order != null">#{order.id,jdbcType=BIGINT},</if>
            <if test="hongBao != null">#{hongBao.id,jdbcType=BIGINT},</if>
            <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
        </trim>
    </insert>
    <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.order.OrderHongBaoMap">update
        yeshi_ec_order_hongbaov2_map set ohm_order_id =
        #{order.id,jdbcType=BIGINT},ohm_hongbao_id =
        #{hongBao.id,jdbcType=BIGINT},ohm_create_time =
        #{createTime,jdbcType=TIMESTAMP} where ohm_id = #{id,jdbcType=BIGINT}
    </update>
    <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.order.OrderHongBaoMap">
        update yeshi_ec_order_hongbaov2_map
        <set>
            <if test="order != null">ohm_order_id=#{order.id,jdbcType=BIGINT},</if>
            <if test="hongBao != null">ohm_hongbao_id=#{hongBao.id,jdbcType=BIGINT},</if>
            <if test="createTime != null">ohm_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
        </set>
        where ohm_id = #{id,jdbcType=BIGINT}
    </update>
</mapper>
fanli/src/main/java/com/yeshi/fanli/service/impl/msg/UserMoneyMsgNotificationServiceImpl.java
@@ -131,4 +131,15 @@
    }
    @Override
    public void orderReward(Long uid, String orderId, BigDecimal money, BigDecimal balance) {
        MsgMoneyDetail detail = MsgMoneyDetailFactory.createOrderRewardMsg(uid, orderId, money, balance, null);
        try {
            msgMoneyDetailService.addMsgMoneyDetail(detail);
        } catch (MsgMoneyDetailException e) {
            e.printStackTrace();
        }
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/order/OrderHongBaoMapServiceImpl.java
New file
@@ -0,0 +1,33 @@
package com.yeshi.fanli.service.impl.order;
import java.util.Date;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.yeshi.fanli.dao.mybatis.order.OrderHongBaoMapMapper;
import com.yeshi.fanli.entity.bus.user.HongBaoV2;
import com.yeshi.fanli.entity.bus.user.Order;
import com.yeshi.fanli.entity.order.OrderHongBaoMap;
import com.yeshi.fanli.service.inter.order.OrderHongBaoMapService;
@Service
public class OrderHongBaoMapServiceImpl implements OrderHongBaoMapService {
    @Resource
    private OrderHongBaoMapMapper orderHongBaoMapMapper;
    @Override
    public void addOrderHongBaoMap(HongBaoV2 hongBao, Order order) {
        if (hongBao == null)
            return;
        if (order == null)
            return;
        OrderHongBaoMap map = new OrderHongBaoMap();
        map.setCreateTime(new Date());
        map.setHongBao(hongBao);
        map.setOrder(order);
        orderHongBaoMapMapper.insertSelective(map);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserAccountServiceImpl.java
@@ -499,9 +499,9 @@
        if (!StringUtil.isNullOrEmpty(mainUser.getPhone()) && !StringUtil.isNullOrEmpty(lessUser.getPhone()))
            throw new UserAccountException(9, "两个账号都绑定了手机号码,请解绑其中一个");
        if (lessUser.getMyHongBao().compareTo(new BigDecimal("20")) >= 0
                && mainUser.getMyHongBao().compareTo(new BigDecimal("20")) > 0)
            throw new UserAccountException(10, String.format("账户ID:%s 的资金超过20元,为保证资金安全请联系客服打通", lessUser.getId() + ""));
        if (lessUser.getMyHongBao().compareTo(new BigDecimal("10")) >= 0
                && mainUser.getMyHongBao().compareTo(new BigDecimal("10")) > 0)
            throw new UserAccountException(10, String.format("账户ID:%s 的资金超过10元,为保证资金安全请联系客服打通", lessUser.getId() + ""));
        // 判定是否绑定了同一支付宝
        List<BindingAccount> mainUserAccountList = bindingAccountMapper.selectByUid(mainUser.getId());
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserMoneyDetailServiceImpl.java
@@ -18,6 +18,7 @@
import com.yeshi.fanli.dao.mybatis.money.UserMoneyDetailMapper;
import com.yeshi.fanli.entity.money.UserMoneyDetail;
import com.yeshi.fanli.entity.money.UserMoneyDetail.UserMoneyDetailTypeEnum;
import com.yeshi.fanli.exception.money.UserMoneyDetailException;
import com.yeshi.fanli.service.inter.user.UserMoneyDetailService;
import com.yeshi.fanli.util.TimeUtil;
import com.yeshi.fanli.vo.money.UserMoneyDetailHistoryVO;
@@ -30,6 +31,13 @@
    private UserMoneyDetailMapper userMoneyDetailMapper;
    @Override
    public void addUserMoneyDetail(UserMoneyDetail detail) throws UserMoneyDetailException {
        if (detail == null || detail.getMoney() == null || detail.getType() == null || detail.getUserInfo() == null)
            throw new UserMoneyDetailException(1, "信息不完整");
        userMoneyDetailMapper.insertSelective(detail);
    }
    @Override
    public List<UserMoneyDetailHistoryVO> listUserMoneyDetailForClient(Long uid, Long userMoneyDetailId, Date maxTime) {
        List<UserMoneyDetailHistoryVO> finalList = new ArrayList<>();
        List<UserMoneyDetail> list = null;
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserSystemCouponServiceImpl.java
@@ -11,14 +11,17 @@
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.yeshi.utils.DateUtil;
import com.yeshi.fanli.dao.mybatis.user.UserSystemCouponMapper;
import com.yeshi.fanli.entity.bus.user.HongBaoV2;
import com.yeshi.fanli.entity.bus.user.Order;
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.entity.bus.user.UserSystemCoupon;
import com.yeshi.fanli.entity.bus.user.UserSystemCouponRecord;
import com.yeshi.fanli.entity.common.JumpDetailV2;
import com.yeshi.fanli.entity.money.UserMoneyDetail;
import com.yeshi.fanli.entity.order.CommonOrder;
import com.yeshi.fanli.entity.order.HongBaoOrder;
import com.yeshi.fanli.entity.system.SystemCoupon;
@@ -28,12 +31,18 @@
import com.yeshi.fanli.service.inter.config.ConfigService;
import com.yeshi.fanli.service.inter.config.SystemCouponService;
import com.yeshi.fanli.service.inter.hongbao.HongBaoV2Service;
import com.yeshi.fanli.service.inter.msg.UserMoneyMsgNotificationService;
import com.yeshi.fanli.service.inter.order.CommonOrderService;
import com.yeshi.fanli.service.inter.order.HongBaoOrderService;
import com.yeshi.fanli.service.inter.order.OrderHongBaoMapService;
import com.yeshi.fanli.service.inter.order.OrderService;
import com.yeshi.fanli.service.inter.user.UserInfoService;
import com.yeshi.fanli.service.inter.user.UserMoneyDetailService;
import com.yeshi.fanli.service.inter.user.UserSystemCouponRecordService;
import com.yeshi.fanli.service.inter.user.UserSystemCouponService;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.MoneyBigDecimalUtil;
import com.yeshi.fanli.util.factory.UserMoneyDetailFactory;
import com.yeshi.fanli.vo.msg.ClientTextStyleVO;
import com.yeshi.fanli.vo.order.CommonOrderVO;
import com.yeshi.fanli.vo.user.UserSystemCouponRecordVO;
@@ -67,11 +76,24 @@
    @Resource
    private HongBaoOrderService hongBaoOrderService;
    @Resource
    private OrderHongBaoMapService orderHongBaoMapService;
    @Resource
    private OrderService orderService;
    @Resource
    private UserMoneyDetailService userMoneyDetailService;
    @Resource
    private UserInfoService userInfoService;
    @Resource
    private UserMoneyMsgNotificationService userMoneyMsgNotificationService;
    // 券失效图片
    public final static String PIC_INVALID= "http://192.168.1.200/icon/mian_invalid.png";
    public final static String PIC_INVALID = "http://192.168.1.200/icon/mian_invalid.png";
    @Override
    public int insertSelective(UserSystemCoupon record) {
@@ -147,15 +169,14 @@
            userCouponVO.setCouponPicture(systemCoupon.getPicture());
            userCouponVO.setCouponEffect(systemCoupon.getEffect());
            userCouponVO.setCouponRule(systemCoupon.getRule());
            // 使用中状态 改变为已使用
            Integer state = userCouponVO.getState();
            if (UserSystemCoupon.STATE_IN_USE == state) {
            if (UserSystemCoupon.STATE_IN_USE == state) {
                state = UserSystemCoupon.STATE_END_USE;
                userCouponVO.setState(state);
            }
            // 按钮跳转
            Map<String, Object> jumpBtn = null;
@@ -164,7 +185,7 @@
                // 显示规则
                userCouponVO.setCouponRule(systemCoupon.getRemark());
                systemCoupon.setEffect("待激活");
                // 状态未激活
                userCouponVO.setState(0);
@@ -201,7 +222,7 @@
                } else if (UserSystemCoupon.STATE_END_USE == state || UserSystemCoupon.STATE_OVERDUE == state) {
                    userCouponVO.setCouponPicture(PIC_INVALID);
                }
            }
            userCouponVO.setJumpBtn(jumpBtn);
@@ -241,9 +262,8 @@
            listCouponId.add(systemCoupon.getId());
        }
        List<UserSystemCouponVO> listVO = userSystemCouponMapper.getEnableListByCouponId(uid, activated,
                listCouponId);
        List<UserSystemCouponVO> listVO = userSystemCouponMapper.getEnableListByCouponId(uid, activated, listCouponId);
        if (listVO == null || listVO.size() == 0) {
            return null;
        }
@@ -268,7 +288,7 @@
            userCouponVO.setCouponName(systemCoupon.getName());
            userCouponVO.setCouponEffect(systemCoupon.getEffect());
            userCouponVO.setCouponRule(systemCoupon.getRule());
            Integer stateActivated = userCouponVO.getStateActivated();
            if (stateActivated == null || stateActivated == 0) {
                userCouponVO.setCouponPicture(PIC_INVALID); // 未激活
@@ -374,9 +394,9 @@
        if (!uid.equals(couponUid)) {
            throw new UserSystemCouponException(1, "传递参数不匹配");
        }
        SystemCoupon systemCoupon = userSystemCoupon.getSystemCoupon();
        SystemCoupon baseCoupon = systemCouponService.selectByPrimaryKey(systemCoupon.getId());
        if (baseCoupon == null || baseCoupon.getId() == null) {
            throw new UserSystemCouponException(1, "未找到券基本信息");
@@ -401,6 +421,7 @@
        userSystemCouponRecordService.insertSelective(couponRecord);
    }
    @Transactional
    @Override
    public void useOrderCoupon(Long uid, Long id, String orderNo) throws UserSystemCouponException, Exception {
@@ -444,6 +465,10 @@
        // 条件: A:必须是返利订单 、B:必须已经处于已到账状态
        if (HongBaoV2.TYPE_ZIGOU == hongBaoType && HongBaoV2.STATE_YILINGQU == hongBaoState || hongBao != null) {
            Order order = orderService.findOrderByOrderIdAndType(orderNo, Order.ORDER_TYPE_TAOBAO);
            if (order == null)
                return;
            /* 奖金计算 以及相关红包信息处理 */
            // 转换成小数点
@@ -460,15 +485,22 @@
            hongBaoV2.setCreateTime(new Date());
            hongBaoV2.setUpdateTime(new Date());
            hongBaoV2.setUserInfo(new UserInfo(uid));
            hongBaoV2.setPreGetTime(new Date());
            hongBaoV2.setGetTime(new Date());
            hongBaoV2Service.insertSelective(hongBaoV2);
            // 2、订单关联红包表
            HongBaoOrder hongBaoOrder = new HongBaoOrder();
            hongBaoOrder.setHongBaoV2(hongBaoV2);
            hongBaoOrder.setCommonOrder(new CommonOrder(commonOrderId));
            hongBaoOrderService.insertSelective(hongBaoOrder);
            // 2.插入关联
            orderHongBaoMapService.addOrderHongBaoMap(hongBaoV2, order);
            // TODO 红包相关信息插入以及通知
            // 3.插入资金明细,用户余额
            UserMoneyDetail userMoneyDetail = UserMoneyDetailFactory.createOrderReward(orderNo, money,
                    new UserInfo(uid));
            userMoneyDetailService.addUserMoneyDetail(userMoneyDetail);
            userInfoService.addMoney(new UserInfo(uid), money);
            // 插入资金通知
            userMoneyMsgNotificationService.orderReward(uid, orderNo, money,
                    userInfoService.selectByPKey(uid).getMyHongBao());
            /* 用户券信息状态及记录处理 */
@@ -492,7 +524,6 @@
    }
    @Override
    public UserSystemCouponRecordVO getRewardCouponRecord(String orderNo) throws UserSystemCouponException, Exception {
@@ -563,7 +594,6 @@
        return userRecordVO;
    }
    @Override
    public UserSystemCouponRecordVO getFreeCouponRecord(String orderNo) throws UserSystemCouponException, Exception {
@@ -597,20 +627,19 @@
        if (orderVO == null) {
            throw new UserSystemCouponException(1, "订单信息获取失败");
        }
        UserSystemCouponRecordVO userRecordVO = new UserSystemCouponRecordVO();
        userRecordVO.setCommonOrder(orderVO);
        ClientTextStyleVO fanMoney = new ClientTextStyleVO();
        fanMoney.setContent("返利: ¥" + orderVO.getHongBao().setScale(2, BigDecimal.ROUND_DOWN));
        fanMoney.setContent("返利: ¥" + orderVO.getHongBao().setScale(2, BigDecimal.ROUND_DOWN));
        fanMoney.setColor("#000000"); // 默认黑色
        userRecordVO.setFanMoney(fanMoney);
        ClientTextStyleVO payMoney = new ClientTextStyleVO();
        payMoney.setContent("实付款:¥"+ orderVO.getPayment().setScale(2, BigDecimal.ROUND_DOWN));
        payMoney.setContent("实付款:¥" + orderVO.getPayment().setScale(2, BigDecimal.ROUND_DOWN));
        payMoney.setColor("#000000"); // 默认黑色
        String progressMsg = "";
        String progressColor = "";
        // 跳转奖励券规则
@@ -618,62 +647,62 @@
        // 进度: 1 灰色 2 红色 3 绿色
        String progressState1 = "3";
        String progressState2 = "1";
        String progressState2 = "1";
        String progressState3 = "1";
        String progressState4 = "1";
        String goodsState = "商品收货";
        // 文字状态
        String text2Color = "#999999";
        String text3Color = "#999999";
        String text4Color = "#999999";
        // 底部备注
        String rewardCouponRemark = "";
        // 状态跳转
        JumpDetailV2 jumpDetail = null;
        // 进度状态 1等待 2 失败  3成功
        // 进度状态 1等待 2 失败 3成功
        int progressState = 1;
        Integer stateRecord = record.getState();
        if (UserSystemCouponRecord.STATE_FAIL_RULE == stateRecord) {
            // 规则不匹配
            progressState = 2;
            progressColor = "#E41212";
            progressMsg = "抱歉不符合免单规则,免单失败" ;
            progressState1 = "2"; //不匹配
            progressMsg = "抱歉不符合免单规则,免单失败";
            progressState1 = "2"; // 不匹配
            payMoney.setColor("#E41212");
            userRecordVO.setCouponMoneyState("已退回");
            userRecordVO.setCouponName(baseCoupon.getName());
            jumpDetail = jumpDetailV2Service.getByTypeCache("welfareCore");
            rewardCouponRemark = configService.get("free_coupon_back_remark");
        } else if (UserSystemCouponRecord.STATE_FAIL_DRAWBACK == stateRecord) {
            // 退款
            progressState = 2;
            progressColor = "#E41212";
            progressMsg = "商品已退款,免单失败";
            text2Color = "#E41212";
            goodsState = "商品已退款";
            progressState2 = "2";
            userRecordVO.setCouponMoneyState("已退回");
            userRecordVO.setCouponName(baseCoupon.getName());
            jumpDetail = jumpDetailV2Service.getByTypeCache("welfareCore");
            rewardCouponRemark = configService.get("free_coupon_back_remark");
        }  else if (UserSystemCouponRecord.STATE_FREE_ON == stateRecord) {
        } else if (UserSystemCouponRecord.STATE_FREE_ON == stateRecord) {
            // 免单中
            if (CommonOrder.STATE_JS == orderVO.getState()) {
                progressColor = "#ECA01B";
@@ -684,65 +713,65 @@
                progressColor = "#ECA01B";
                progressMsg = "免单发起,等待收货";
            }
            rewardCouponRemark = configService.get("free_coupon_remark");
        }  else if (UserSystemCouponRecord.STATE_SUCCESS == stateRecord) {
        } else if (UserSystemCouponRecord.STATE_SUCCESS == stateRecord) {
            // 免单成功
            progressState = 3;
            progressColor = "#3EBF13";
            progressMsg = "免单成功,免单金已转入余额";
            progressState2 = "3";
            progressState3 = "3";
            progressState4 = "3";
            text2Color = "#000000";
            text3Color = "#000000";
            text4Color = "#000000";
            userRecordVO.setCouponMoneyState("已到账");
            userRecordVO.setCouponName("返利: ¥" + orderVO.getHongBao().setScale(2, BigDecimal.ROUND_DOWN));
            jumpDetail = jumpDetailV2Service.getByTypeCache("capitalDetails");
            rewardCouponRemark = configService.get("free_coupon_remark");
        }
        userRecordVO.setProgressState(progressState);
        userRecordVO.setPayMoney(payMoney);
        // 显示提示较大字
        ClientTextStyleVO progressMsgStyle = new ClientTextStyleVO();
        progressMsgStyle.setContent(progressMsg);
        progressMsgStyle.setContent(progressMsg);
        progressMsgStyle.setColor(progressColor);
        userRecordVO.setProgressMsg(progressMsgStyle);
        /* --- 进度点 ----  */
        /* --- 进度点 ---- */
        Map<String, Object> map1 = new HashMap<String, Object>();
        map1.put("state", progressState1);
        Map<String, Object> map2 = new HashMap<String, Object>();
        map2.put("state", progressState2);
        ClientTextStyleVO style2 = new ClientTextStyleVO();
        style2.setContent(goodsState);
        style2.setContent(goodsState);
        style2.setColor(text2Color);
        map2.put("text", style2);
        Map<String, Object> map3 = new HashMap<String, Object>();
        map3.put("state", progressState3);
        ClientTextStyleVO style3 = new ClientTextStyleVO();
        style3.setContent("返利到账");
        style3.setContent("返利到账");
        style3.setColor(text3Color);
        map3.put("text", style3);
        Map<String, Object> map4 = new HashMap<String, Object>();
        map4.put("state", progressState4);
        ClientTextStyleVO style4 = new ClientTextStyleVO();
        style4.setContent("免单成功");
        style4.setContent("免单成功");
        style4.setColor(text4Color);
        map4.put("text", style4);
        // 圆点颜色
        List<Object> progressList = new ArrayList<Object>();
        progressList.add(map1);
@@ -750,7 +779,7 @@
        progressList.add(map3);
        progressList.add(map4);
        userRecordVO.setProgressList(progressList);
        if (jumpDetail != null) {
            Map<String, Object> jumpState = new HashMap<String, Object>();
            jumpState.put("jumpDetail", jumpDetail);
@@ -762,8 +791,8 @@
        if (rewardCouponRemark != null && rewardCouponRemark.trim().length() > 0) {
            userRecordVO.setRemark(JSONObject.fromObject(rewardCouponRemark));
        }
        return userRecordVO;
    }
}
fanli/src/main/java/com/yeshi/fanli/service/inter/msg/UserMoneyMsgNotificationService.java
@@ -106,4 +106,14 @@
     */
    public void inviteOrderWeiQuan(Long uid, String orderId, BigDecimal money, BigDecimal balance);
    /**
     * 奖励订单到账
     *
     * @param uid
     * @param orderId
     * @param money
     * @param balance
     */
    public void orderReward(Long uid, String orderId, BigDecimal money, BigDecimal balance);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/order/OrderHongBaoMapService.java
New file
@@ -0,0 +1,22 @@
package com.yeshi.fanli.service.inter.order;
import com.yeshi.fanli.entity.bus.user.HongBaoV2;
import com.yeshi.fanli.entity.bus.user.Order;
/**
 * 订单红包对应表用于活动)
 *
 * @author Administrator
 *
 */
public interface OrderHongBaoMapService {
    /**
     * 添加红包订单映射
     *
     * @param hongBao
     * @param order
     */
    public void addOrderHongBaoMap(HongBaoV2 hongBao, Order order);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/user/UserMoneyDetailService.java
@@ -6,6 +6,7 @@
import com.yeshi.fanli.entity.money.UserMoneyDetail;
import com.yeshi.fanli.entity.money.UserMoneyDetail.UserMoneyDetailTypeEnum;
import com.yeshi.fanli.exception.money.UserMoneyDetailException;
import com.yeshi.fanli.vo.money.UserMoneyDetailHistoryVO;
/**
@@ -17,6 +18,14 @@
public interface UserMoneyDetailService {
    /**
     * 添加用户资金记录
     *
     * @param detail
     * @throws UserMoneyDetailException
     */
    public void addUserMoneyDetail(UserMoneyDetail detail) throws UserMoneyDetailException;
    /**
     * 客户端查询用户的资金记录
     * 
     * @param uid
fanli/src/main/java/com/yeshi/fanli/service/inter/user/UserSystemCouponService.java
@@ -74,7 +74,7 @@
    /**
     * 更新券使用记录
     * @param uid
     * @param id
     * @param id
     * @throws UserSystemCouponException
     * @throws Exception
     */
fanli/src/main/java/com/yeshi/fanli/util/Constant.java
@@ -78,6 +78,12 @@
    public static final String TAOBAO_RELATION_PID_DEFAULT = "mm_124933865_56750082_87140050199";
    public static final String TAOBAO_SPECIAL_PID_DEFAULT = "mm_124933865_56750082_89555600043";
    // 返回给客户端的账号封禁提示语
    public static final String FORBIDDEN_USER_REASON_DESC = "你的账号或绑定的第三方账号已被封禁,封禁原因可在帮助中心的相关规则中参看,如有疑问或申诉解除封禁请联系客服";
    // 用户被封禁
    public static final int CODE_FORBIDDEN_USER = 80001;
    // 来源-淘宝
    public static final int SOURCE_TYPE_TAOBAO = 1;
    // 来源-京东
fanli/src/main/java/com/yeshi/fanli/util/factory/UserMoneyDetailFactory.java
@@ -24,7 +24,7 @@
     * @param hongBaoList
     * @return
     */
    public static UserMoneyDetail createFanLi(Long uid, String orderId, int orderType,Long hbId, BigDecimal money)
    public static UserMoneyDetail createFanLi(Long uid, String orderId, int orderType, Long hbId, BigDecimal money)
            throws UserMoneyDetailException {
        if (StringUtil.isNullOrEmpty(orderId))
@@ -38,8 +38,8 @@
        UserMoneyDetail detail = new UserMoneyDetail();
        detail.setCreateTime(new Date());
        detail.setIdentifyCode(
                StringUtil.Md5(UserMoneyDetailTypeEnum.fanli.name() + "-" + uid + "-" + orderType + "-" + orderId+"-"+hbId));
        detail.setIdentifyCode(StringUtil
                .Md5(UserMoneyDetailTypeEnum.fanli.name() + "-" + uid + "-" + orderType + "-" + orderId + "-" + hbId));
        detail.setMoney(money);
        detail.setTitle(UserMoneyDetailTypeEnum.fanli.getDesc());
        detail.setType(UserMoneyDetailTypeEnum.fanli);
@@ -590,4 +590,35 @@
        return detail;
    }
    /**
     * 返利奖励
     *
     * @param orderId
     * @param money
     * @param user
     * @return
     * @throws UserMoneyDetailException
     */
    public static UserMoneyDetail createOrderReward(String orderId, BigDecimal money, UserInfo user)
            throws UserMoneyDetailException {
        if (StringUtil.isNullOrEmpty(orderId))
            throw new UserMoneyDetailException(1, "订单号不能为空");
        if (user == null)
            throw new UserMoneyDetailException(1, "UID不能为空");
        if (money == null)
            throw new UserMoneyDetailException(1, "金额不能为空");
        UserMoneyDetail detail = new UserMoneyDetail();
        detail.setCreateTime(new Date());
        detail.setIdentifyCode(StringUtil.Md5(UserMoneyDetailTypeEnum.hongbao.name() + "-" + "老版本" + "-" + orderId));
        detail.setMoney(money);
        detail.setTitle(UserMoneyDetailTypeEnum.hongbao.getDesc());
        detail.setSubTitle("返利奖励");
        detail.setType(UserMoneyDetailTypeEnum.hongbao);
        detail.setUpdateTime(new Date());
        detail.setUserInfo(user);
        detail.setDescInfo("订单号:" + orderId);
        return detail;
    }
}
fanli/src/main/java/com/yeshi/fanli/util/factory/msg/MsgMoneyDetailFactory.java
@@ -278,5 +278,23 @@
        detail.setUser(new UserInfo(uid));
        return detail;
    }
    public static MsgMoneyDetail createOrderRewardMsg(Long uid, String orderId, BigDecimal money, BigDecimal balance,
            String beiZhu) {
        if (money == null || orderId == 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.orderReward);
        detail.setOrderId(orderId);
        detail.setRead(false);
        detail.setUser(new UserInfo(uid));
        return detail;
    }
}
fanli/src/main/java/com/yeshi/fanli/util/factory/msg/UserMsgVOFactory.java
@@ -334,6 +334,32 @@
            return new UserMsgVO("http://img.flqapp.com/resource/msg/icon_msg_invite_money.png",
                    msg.getMsgType().getDesc(), msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(),
                    items);
        } else if (msg.getMsgType() == MsgTypeMoneyTypeEnum.orderReward) {//奖励订单
            contentList.add(new ClientTextStyleVO(msg.getOrderId(), COLOR_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("邀请订单", COLOR_TITLE), contentList));
            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("¥" + MoneyBigDecimalUtil.getWithNoZera(msg.getMoney()) + "",
                    COLOR_HIGHLIGHT_CONTENT));
            items.add(new CommonMsgItemVO(new ClientTextStyleVO("奖金扣除", COLOR_TITLE), contentList));
            contentList = new ArrayList<>();
            contentList.add(new ClientTextStyleVO("¥" + MoneyBigDecimalUtil.getWithNoZera(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_invite_money.png",
                    msg.getMsgType().getDesc(), msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(),
                    items);
        }
        return null;