yujian
2020-04-27 609bf69362497854cbe1a10b4d9898c0103695de
商家跑路消息
8个文件已修改
132 ■■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/msg/MsgOrderDetailMapper.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/bus/msg/MsgOrderDetail.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/msg/MsgOrderDetailMapper.xml 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/order/OrderProcessServiceImpl.java 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/order/msg/MsgOrderDetailServiceImpl.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/order/msg/UserOrderMsgNotificationServiceImpl.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/order/msg/UserOrderMsgNotificationService.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/factory/msg/MsgOrderDetailFactory.java 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/msg/MsgOrderDetailMapper.java
@@ -23,5 +23,13 @@
     * @param uid
     */
    void setMsgReadByUid(Long uid);
    /**
     * 根据唯一索引查询
     *
     * @param uniqueKey
     * @return
     */
    MsgOrderDetail getByUniqueKey(@Param("uniqueKey") String uniqueKey);
}
fanli/src/main/java/com/yeshi/fanli/entity/bus/msg/MsgOrderDetail.java
@@ -29,6 +29,7 @@
        foundSucceed("订单找回", "http://img.flqapp.com/resource/msg/icon_msg_order.png"), 
        foundFail("订单找回", "http://img.flqapp.com/resource/msg/icon_msg_order.png"),
        orderStatistics("订单统计", "http://img.flqapp.com/resource/msg/icon_msg_order.png"), 
        businessRunning("订单失效", "http://img.flqapp.com/resource/msg/icon_msg_order.png"),
        elme("饿了么订单", "http://img.flqapp.com/resource/msg/icon_msg_order.png");
        
        private final String desc;
@@ -76,6 +77,9 @@
    private Date createTime;
    @Column(name = "mo_update_time")
    private Date updateTime;
    // 唯一索引
    @Column(name = "mo_unique_key")
    private String uniquekey;
    
    private String extraInfo;// 新版消息内容
@@ -198,5 +202,13 @@
    public void setExtraInfo(String extraInfo) {
        this.extraInfo = extraInfo;
    }
    public String getUniquekey() {
        return uniquekey;
    }
    public void setUniquekey(String uniquekey) {
        this.uniquekey = uniquekey;
    }
}
fanli/src/main/java/com/yeshi/fanli/mapping/msg/MsgOrderDetailMapper.xml
@@ -19,6 +19,7 @@
        <result column="mo_happen_date" property="happendDate"
            jdbcType="TIMESTAMP" />
        <result column="mo_order_type" property="orderType" jdbcType="INTEGER" />
         <result column="mo_unique_key" property="uniquekey" jdbcType="VARCHAR"/>
        <result column="extraInfo" property="extraInfo" jdbcType="VARCHAR"/>
        <association property="user" column="mo_uid"
            javaType="com.yeshi.fanli.entity.bus.user.UserInfo">
@@ -26,7 +27,7 @@
        </association>
    </resultMap>
    <sql id="Base_Column_List">mo_id,mo_uid,mo_type,mo_order_id,mo_state,mo_goods_count,mo_pay_money,mo_hongbao_money,mo_beizhu,mo_read,mo_create_time,mo_update_time,mo_happen_date,mo_order_type
    <sql id="Base_Column_List">mo_id,mo_uid,mo_type,mo_order_id,mo_state,mo_goods_count,mo_pay_money,mo_hongbao_money,mo_beizhu,mo_read,mo_create_time,mo_update_time,mo_happen_date,mo_order_type,mo_unique_key
    </sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
@@ -57,14 +58,22 @@
        parameterType="java.lang.Long">select count(mo_id) from yeshi_ec_msg_order where mo_uid
        = #{uid,jdbcType=BIGINT}
    </select>
    <select id="getByUniqueKey" resultMap="BaseResultMap">
        select * from yeshi_ec_msg_order
        where unique_key = #{uniqueKey}
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
        yeshi_ec_msg_order where mo_id = #{id,jdbcType=BIGINT}
    </delete>
    <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.msg.MsgOrderDetail"
        useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_msg_order
        (mo_id,mo_uid,mo_type,mo_order_id,mo_state,mo_goods_count,mo_pay_money,mo_hongbao_money,mo_beizhu,mo_read,mo_create_time,mo_update_time,mo_happen_date,mo_order_type)
        (mo_id,mo_uid,mo_type,mo_order_id,mo_state,mo_goods_count,mo_pay_money,mo_hongbao_money,mo_beizhu,mo_read,mo_create_time,mo_update_time,mo_happen_date,mo_order_type,mo_unique_key)
        values
        (#{id,jdbcType=BIGINT},#{user.id,jdbcType=BIGINT},#{type,jdbcType=VARCHAR},#{orderId,jdbcType=VARCHAR},#{state,jdbcType=INTEGER},#{goodsCount,jdbcType=INTEGER},#{payMoney,jdbcType=DECIMAL},#{hongBaoMoney,jdbcType=DECIMAL},#{beiZhu,jdbcType=VARCHAR},#{read,jdbcType=BOOLEAN},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{happendDate,jdbcType=TIMESTAMP},#{orderType,jdbcType=INTEGER})
        (#{id,jdbcType=BIGINT},#{user.id,jdbcType=BIGINT},#{type,jdbcType=VARCHAR},#{orderId,jdbcType=VARCHAR},#{state,jdbcType=INTEGER},#{goodsCount,jdbcType=INTEGER},#{payMoney,jdbcType=DECIMAL},#{hongBaoMoney,jdbcType=DECIMAL},#{beiZhu,jdbcType=VARCHAR},#{read,jdbcType=BOOLEAN},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{happendDate,jdbcType=TIMESTAMP},#{orderType,jdbcType=INTEGER},#{uniquekey,jdbcType=VARCHAR})
    </insert>
    <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.msg.MsgOrderDetail"
        useGeneratedKeys="true" keyProperty="id">
@@ -84,6 +93,7 @@
            <if test="updateTime != null">mo_update_time,</if>
            <if test="happendDate != null">mo_happen_date,</if>
            <if test="orderType != null">mo_order_type,</if>
            <if test="uniquekey != null">mo_unique_key,</if>
        </trim>
        values
        <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -101,6 +111,7 @@
            <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
            <if test="happendDate != null">#{happendDate,jdbcType=TIMESTAMP},</if>
            <if test="orderType != null">#{orderType,jdbcType=INTEGER},</if>
            <if test="uniquekey != null">#{uniquekey,jdbcType=VARCHAR},</if>
        </trim>
    </insert>
    <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.msg.MsgOrderDetail">update
@@ -115,8 +126,8 @@
        #{read,jdbcType=BOOLEAN},mo_create_time =
        #{createTime,jdbcType=TIMESTAMP},mo_update_time =
        #{updateTime,jdbcType=TIMESTAMP},mo_happen_date=#{happendDate,jdbcType=TIMESTAMP}
        ,mo_order_type =#{orderType,jdbcType=INTEGER}  where mo_id =
        #{id,jdbcType=BIGINT}
        ,mo_order_type =#{orderType,jdbcType=INTEGER},mo_unique_key = #{uniquekey,jdbcType=VARCHAR}
        where mo_id = #{id,jdbcType=BIGINT}
    </update>
    <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.msg.MsgOrderDetail">
        update yeshi_ec_msg_order
@@ -134,6 +145,7 @@
            <if test="updateTime != null">mo_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
            <if test="happendDate != null">mo_happen_date=#{happendDate,jdbcType=TIMESTAMP},</if>
            <if test="orderType !=null">mo_order_type =#{orderType,jdbcType=INTEGER},</if>
             <if test="uniquekey != null">mo_unique_key=#{uniquekey,jdbcType=VARCHAR},</if>
        </set>
        where mo_id = #{id,jdbcType=BIGINT}
    </update>
fanli/src/main/java/com/yeshi/fanli/service/impl/order/OrderProcessServiceImpl.java
@@ -76,6 +76,7 @@
import com.yeshi.fanli.service.inter.order.OrderMoneySettleService;
import com.yeshi.fanli.service.inter.order.OrderProcessService;
import com.yeshi.fanli.service.inter.order.jd.JDOrderService;
import com.yeshi.fanli.service.inter.order.msg.UserOrderMsgNotificationService;
import com.yeshi.fanli.service.inter.order.pdd.PDDOrderService;
import com.yeshi.fanli.service.inter.order.tb.TaoBaoOrderService;
import com.yeshi.fanli.service.inter.taobao.TaoBaoBuyRelationMapService;
@@ -132,7 +133,10 @@
    @Resource
    private UserMoneyMsgNotificationService userMoneyMsgNotificationService;
    @Resource
    private UserOrderMsgNotificationService userOrderMsgNotificationService;
    @Resource
    private UserExtraTaoBaoInfoService userExtraTaoBaoInfoService;
@@ -1277,9 +1281,11 @@
                update.setUpdateTime(new Date());
                hongBaoV2Service.updateByPrimaryKeySelective(update);
            }
        // TODO 商家关店跑路需要赠送金币
        // userSystemCouponService.rewardCouponWin(uid,
        // UserSystemCoupon.SOURCE_SYSTEM_PUSH, 1, true, new BigDecimal("31"));
        if (hongBao.getType() == HongBaoV2.TYPE_ZIGOU || hongBao.getType() == HongBaoV2.TYPE_SHARE_GOODS) {
            userOrderMsgNotificationService.orderInvalidToBusinessRunning(uid, orderId, sourceType, hongBao.getType());
        }
    }
    @Transactional
fanli/src/main/java/com/yeshi/fanli/service/impl/order/msg/MsgOrderDetailServiceImpl.java
@@ -10,6 +10,7 @@
import com.yeshi.fanli.dao.mybatis.msg.MsgOrderDetailMapper;
import com.yeshi.fanli.entity.bus.msg.MsgExtra;
import com.yeshi.fanli.entity.bus.msg.MsgOrderDetail;
import com.yeshi.fanli.entity.bus.msg.MsgOrderDetail.MsgTypeOrderTypeEnum;
import com.yeshi.fanli.entity.order.CommonOrder;
import com.yeshi.fanli.exception.msg.MsgOrderDetailException;
import com.yeshi.fanli.service.inter.msg.MsgExtraService;
@@ -44,6 +45,15 @@
        if (detail.getOrderId() == null || detail.getType() == null    || detail.getUser() == null
                || StringUtil.isNullOrEmpty(detail.getExtraInfo()))
            throw new MsgOrderDetailException(2, "消息不完整");
        if (detail.getType() == MsgTypeOrderTypeEnum.businessRunning) {
            MsgOrderDetail msgOrderDetail = msgOrderDetailMapper.getByUniqueKey(detail.getUniquekey());
            if (msgOrderDetail != null) {
                return;
            }
        }
        // 锁住订单号
        Jedis jedis = jedisPool.getResource();
        try {
@@ -129,4 +139,5 @@
        return msgOrderDetailMapper.listByOrderId(orderId);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/order/msg/UserOrderMsgNotificationServiceImpl.java
@@ -150,4 +150,15 @@
        }
    }
    @Override
    public void orderInvalidToBusinessRunning(Long uid, String orderId, int orderSource, int type) {
        try {
            MsgOrderDetail detail = MsgOrderDetailFactory.orderInvalidToBusinessRunning(uid, orderId, orderSource, type);
            // 消息
            msgOrderDetailService.addMsgOrderDetail(detail, true);
        } catch (MsgOrderDetailException e) {
            e.printStackTrace();
        }
    }
}
fanli/src/main/java/com/yeshi/fanli/service/inter/order/msg/UserOrderMsgNotificationService.java
@@ -85,4 +85,14 @@
    public void orderFoundFail(Long uid, String orderId);
    /**
     * 商品跑路订单失效消息
     * @param uid
     * @param orderId
     * @param orderSource
     * @param type
     */
    public void orderInvalidToBusinessRunning(Long uid, String orderId, int orderSource, int type);
}
fanli/src/main/java/com/yeshi/fanli/util/factory/msg/MsgOrderDetailFactory.java
@@ -217,4 +217,46 @@
        return detail;
    }
    
    /**
     * 商家跑路
     * @param uid
     * @param orderId
     * @param orderSource
     * @param type
     * @return
     */
    public static MsgOrderDetail orderInvalidToBusinessRunning(Long uid, String orderId, int orderSource, int type) {
        if (uid == null || StringUtil.isNullOrEmpty(orderId))
            return null;
        String fanliName = "";
        String sourceName = Constant.getSourceName(orderSource);
        if (Constant.TYPE_REBATE == type) {
            fanliName = "返利订单";
        } else {
            fanliName = "分享订单";
        }
        List<CommonMsgItemVO> listMsg = new ArrayList<>();
        listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("订单状态", ClientTextStyleVO.COLOR_TITLE),
                new ClientTextStyleVO("商家店铺已被"+sourceName+"封禁,商品佣金已被冻结,无法结算佣金,订单已失效", ClientTextStyleVO.COLOR_CONTENT)));
        listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("订单详情", ClientTextStyleVO.COLOR_TITLE),
                new ClientTextStyleVO(fanliName, ClientTextStyleVO.COLOR_CONTENT)));
        listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("订单号", ClientTextStyleVO.COLOR_TITLE),
                new ClientTextStyleVO(orderId, ClientTextStyleVO.COLOR_CONTENT)));
        listMsg.add(CommonMsgItemVOFactory.createMsgItemVO(new ClientTextStyleVO("备注", ClientTextStyleVO.COLOR_TITLE),
                new ClientTextStyleVO("无", ClientTextStyleVO.COLOR_CONTENT)));
        MsgOrderDetail detail = new MsgOrderDetail();
        detail.setOrderId(orderId);
        detail.setOrderType(orderSource);
        detail.setType(MsgTypeOrderTypeEnum.businessRunning);
        detail.setUser(new UserInfo(uid));
        detail.setRead(false);
        detail.setCreateTime(new Date());
        detail.setUniquekey(StringUtil.Md5(uid+"&"+ orderId + "&" +orderSource + "&" + MsgTypeOrderTypeEnum.businessRunning.name()));
        detail.setExtraInfo(new Gson().toJson(listMsg));
        return detail;
    }
}