Authored by chenchao

Merge branch 'dev6.8.3_order' into test6.8.3

Showing 32 changed files with 1203 additions and 33 deletions
@@ -32,7 +32,9 @@ public class DateUtil { @@ -32,7 +32,9 @@ public class DateUtil {
32 public static final String MM_dd_yyyy = "MM/dd/yyyy"; 32 public static final String MM_dd_yyyy = "MM/dd/yyyy";
33 private static final String MM_dd_yyyy_HH_mm = "MM/dd/yyyy HH:mm"; 33 private static final String MM_dd_yyyy_HH_mm = "MM/dd/yyyy HH:mm";
34 private static final String MM_dd_yyyy_HH_mm_ss = "MM/dd/yyyy HH:mm:ss"; 34 private static final String MM_dd_yyyy_HH_mm_ss = "MM/dd/yyyy HH:mm:ss";
35 - public static final String yyyyMMdd = "yyyyMMdd", yyyyMMddHHmm = "yyyyMMddHHmm", 35 + public static final String yyyyMMdd = "yyyyMMdd",
  36 + yyyyMMddHH = "yyyyMMddHH",
  37 + yyyyMMddHHmm = "yyyyMMddHHmm",
36 yyyyMMddHHmmss = "yyyyMMddHHmmss"; 38 yyyyMMddHHmmss = "yyyyMMddHHmmss";
37 public static final String yyyy_MM_dd_HH_mm_SS = "yyyy-MM-dd HH:mm:ss"; 39 public static final String yyyy_MM_dd_HH_mm_SS = "yyyy-MM-dd HH:mm:ss";
38 public static final String yyyy_MM_dd_HH_mm = "yyyy-MM-dd HH:mm"; 40 public static final String yyyy_MM_dd_HH_mm = "yyyy-MM-dd HH:mm";
  1 +package com.yohoufo.dal.order;
  2 +
  3 +import com.yohoufo.dal.order.model.NoticeCase;
  4 +
  5 +public interface NoticeCaseMapper {
  6 + int deleteByPrimaryKey(Integer id);
  7 +
  8 + int insert(NoticeCase record);
  9 +
  10 + int insertSelective(NoticeCase record);
  11 +
  12 + NoticeCase selectByPrimaryKey(Integer id);
  13 +
  14 + int updateByPrimaryKeySelective(NoticeCase record);
  15 +
  16 + int updateByPrimaryKey(NoticeCase record);
  17 +
  18 + NoticeCase selectByMetaKey(String metaKey);
  19 +}
  1 +package com.yohoufo.dal.order;
  2 +
  3 +import com.yohoufo.dal.order.model.Notice;
  4 +
  5 +public interface NoticeMapper {
  6 + int deleteByPrimaryKey(Long id);
  7 +
  8 + int insert(Notice record);
  9 +
  10 + int insertSelective(Notice record);
  11 +
  12 + Notice selectByPrimaryKey(Long id);
  13 +
  14 + int updateByPrimaryKeySelective(Notice record);
  15 +
  16 + int updateByPrimaryKey(Notice record);
  17 +}
  1 +package com.yohoufo.dal.order;
  2 +
  3 +import com.yohoufo.dal.order.model.NoticeRule;
  4 +
  5 +public interface NoticeRuleMapper {
  6 + int deleteByPrimaryKey(Integer id);
  7 +
  8 + int insert(NoticeRule record);
  9 +
  10 + int insertSelective(NoticeRule record);
  11 +
  12 + NoticeRule selectByPrimaryKey(Integer id);
  13 +
  14 + int updateByPrimaryKeySelective(NoticeRule record);
  15 +
  16 + int updateByPrimaryKey(NoticeRule record);
  17 +}
  1 +package com.yohoufo.dal.order.model;
  2 +
  3 +public class Notice {
  4 + private Long id;
  5 +
  6 + private Integer uid;
  7 +
  8 + private String bizKey;
  9 +
  10 + private Integer caseId;
  11 +
  12 + private Integer ruleId;
  13 +
  14 + private Short method;
  15 +
  16 + private Integer limitQuantity;
  17 +
  18 + private Integer quantity;
  19 +
  20 + private String updateDtp;
  21 +
  22 + private Integer timeUnitRegion;
  23 +
  24 + private Short timeUnit;
  25 +
  26 + private Integer updateTime;
  27 +
  28 + private Integer createTime;
  29 +
  30 + public Long getId() {
  31 + return id;
  32 + }
  33 +
  34 + public void setId(Long id) {
  35 + this.id = id;
  36 + }
  37 +
  38 + public Integer getUid() {
  39 + return uid;
  40 + }
  41 +
  42 + public void setUid(Integer uid) {
  43 + this.uid = uid;
  44 + }
  45 +
  46 + public String getBizKey() {
  47 + return bizKey;
  48 + }
  49 +
  50 + public void setBizKey(String bizKey) {
  51 + this.bizKey = bizKey == null ? null : bizKey.trim();
  52 + }
  53 +
  54 + public Integer getCaseId() {
  55 + return caseId;
  56 + }
  57 +
  58 + public void setCaseId(Integer caseId) {
  59 + this.caseId = caseId;
  60 + }
  61 +
  62 + public Integer getRuleId() {
  63 + return ruleId;
  64 + }
  65 +
  66 + public void setRuleId(Integer ruleId) {
  67 + this.ruleId = ruleId;
  68 + }
  69 +
  70 + public Short getMethod() {
  71 + return method;
  72 + }
  73 +
  74 + public void setMethod(Short method) {
  75 + this.method = method;
  76 + }
  77 +
  78 + public Integer getLimitQuantity() {
  79 + return limitQuantity;
  80 + }
  81 +
  82 + public void setLimitQuantity(Integer limitQuantity) {
  83 + this.limitQuantity = limitQuantity;
  84 + }
  85 +
  86 + public Integer getQuantity() {
  87 + return quantity;
  88 + }
  89 +
  90 + public void setQuantity(Integer quantity) {
  91 + this.quantity = quantity;
  92 + }
  93 +
  94 + public String getUpdateDtp() {
  95 + return updateDtp;
  96 + }
  97 +
  98 + public void setUpdateDtp(String updateDtp) {
  99 + this.updateDtp = updateDtp == null ? null : updateDtp.trim();
  100 + }
  101 +
  102 + public Integer getTimeUnitRegion() {
  103 + return timeUnitRegion;
  104 + }
  105 +
  106 + public void setTimeUnitRegion(Integer timeUnitRegion) {
  107 + this.timeUnitRegion = timeUnitRegion;
  108 + }
  109 +
  110 + public Short getTimeUnit() {
  111 + return timeUnit;
  112 + }
  113 +
  114 + public void setTimeUnit(Short timeUnit) {
  115 + this.timeUnit = timeUnit;
  116 + }
  117 +
  118 + public Integer getUpdateTime() {
  119 + return updateTime;
  120 + }
  121 +
  122 + public void setUpdateTime(Integer updateTime) {
  123 + this.updateTime = updateTime;
  124 + }
  125 +
  126 + public Integer getCreateTime() {
  127 + return createTime;
  128 + }
  129 +
  130 + public void setCreateTime(Integer createTime) {
  131 + this.createTime = createTime;
  132 + }
  133 +}
  1 +package com.yohoufo.dal.order.model;
  2 +
  3 +public class NoticeCase {
  4 + private Integer id;
  5 +
  6 + private String metaKey;
  7 +
  8 + private String title;
  9 +
  10 + private String ruleIds;
  11 +
  12 + private String rules;
  13 +
  14 + public Integer getId() {
  15 + return id;
  16 + }
  17 +
  18 + public void setId(Integer id) {
  19 + this.id = id;
  20 + }
  21 +
  22 + public String getMetaKey() {
  23 + return metaKey;
  24 + }
  25 +
  26 + public void setMetaKey(String metaKey) {
  27 + this.metaKey = metaKey == null ? null : metaKey.trim();
  28 + }
  29 +
  30 + public String getTitle() {
  31 + return title;
  32 + }
  33 +
  34 + public void setTitle(String title) {
  35 + this.title = title == null ? null : title.trim();
  36 + }
  37 +
  38 + public String getRuleIds() {
  39 + return ruleIds;
  40 + }
  41 +
  42 + public void setRuleIds(String ruleIds) {
  43 + this.ruleIds = ruleIds == null ? null : ruleIds.trim();
  44 + }
  45 +
  46 + public String getRules() {
  47 + return rules;
  48 + }
  49 +
  50 + public void setRules(String rules) {
  51 + this.rules = rules == null ? null : rules.trim();
  52 + }
  53 +}
  1 +package com.yohoufo.dal.order.model;
  2 +
  3 +public class NoticeRule {
  4 + private Integer id;
  5 +
  6 + private Integer caseId;
  7 +
  8 + private Short method;
  9 +
  10 + private Integer quantity;
  11 +
  12 + private Integer timeUnitRegion;
  13 +
  14 + private Short timeUnit;
  15 +
  16 + public Integer getId() {
  17 + return id;
  18 + }
  19 +
  20 + public void setId(Integer id) {
  21 + this.id = id;
  22 + }
  23 +
  24 + public Integer getCaseId() {
  25 + return caseId;
  26 + }
  27 +
  28 + public void setCaseId(Integer caseId) {
  29 + this.caseId = caseId;
  30 + }
  31 +
  32 + public Short getMethod() {
  33 + return method;
  34 + }
  35 +
  36 + public void setMethod(Short method) {
  37 + this.method = method;
  38 + }
  39 +
  40 + public Integer getQuantity() {
  41 + return quantity;
  42 + }
  43 +
  44 + public void setQuantity(Integer quantity) {
  45 + this.quantity = quantity;
  46 + }
  47 +
  48 + public Integer getTimeUnitRegion() {
  49 + return timeUnitRegion;
  50 + }
  51 +
  52 + public void setTimeUnitRegion(Integer timeUnitRegion) {
  53 + this.timeUnitRegion = timeUnitRegion;
  54 + }
  55 +
  56 + public Short getTimeUnit() {
  57 + return timeUnit;
  58 + }
  59 +
  60 + public void setTimeUnit(Short timeUnit) {
  61 + this.timeUnit = timeUnit;
  62 + }
  63 +}
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3 +<mapper namespace="com.yohoufo.dal.order.NoticeCaseMapper">
  4 + <resultMap id="BaseResultMap" type="com.yohoufo.dal.order.model.NoticeCase">
  5 + <id column="id" jdbcType="INTEGER" property="id" />
  6 + <result column="meta_key" jdbcType="VARCHAR" property="metaKey" />
  7 + <result column="title" jdbcType="VARCHAR" property="title" />
  8 + <result column="rule_ids" jdbcType="VARCHAR" property="ruleIds" />
  9 + <result column="rules" jdbcType="VARCHAR" property="rules" />
  10 + </resultMap>
  11 + <sql id="Base_Column_List">
  12 + id, meta_key, title, rule_ids, rules
  13 + </sql>
  14 +
  15 + <select id="selectByMetaKey" parameterType="java.lang.String" resultMap="BaseResultMap">
  16 + select
  17 + <include refid="Base_Column_List" />
  18 + from notice_case
  19 + where meta_key = #{metaKey,jdbcType=VARCHAR}
  20 + </select>
  21 +
  22 + <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
  23 + select
  24 + <include refid="Base_Column_List" />
  25 + from notice_case
  26 + where id = #{id,jdbcType=INTEGER}
  27 + </select>
  28 + <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
  29 + delete from notice_case
  30 + where id = #{id,jdbcType=INTEGER}
  31 + </delete>
  32 + <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.yohoufo.dal.order.model.NoticeCase" useGeneratedKeys="true">
  33 + insert into notice_case (meta_key, title, rule_ids,
  34 + rules)
  35 + values (#{metaKey,jdbcType=VARCHAR}, #{title,jdbcType=VARCHAR}, #{ruleIds,jdbcType=VARCHAR},
  36 + #{rules,jdbcType=VARCHAR})
  37 + </insert>
  38 + <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.yohoufo.dal.order.model.NoticeCase" useGeneratedKeys="true">
  39 + insert into notice_case
  40 + <trim prefix="(" suffix=")" suffixOverrides=",">
  41 + <if test="metaKey != null">
  42 + meta_key,
  43 + </if>
  44 + <if test="title != null">
  45 + title,
  46 + </if>
  47 + <if test="ruleIds != null">
  48 + rule_ids,
  49 + </if>
  50 + <if test="rules != null">
  51 + rules,
  52 + </if>
  53 + </trim>
  54 + <trim prefix="values (" suffix=")" suffixOverrides=",">
  55 + <if test="metaKey != null">
  56 + #{metaKey,jdbcType=VARCHAR},
  57 + </if>
  58 + <if test="title != null">
  59 + #{title,jdbcType=VARCHAR},
  60 + </if>
  61 + <if test="ruleIds != null">
  62 + #{ruleIds,jdbcType=VARCHAR},
  63 + </if>
  64 + <if test="rules != null">
  65 + #{rules,jdbcType=VARCHAR},
  66 + </if>
  67 + </trim>
  68 + </insert>
  69 + <update id="updateByPrimaryKeySelective" parameterType="com.yohoufo.dal.order.model.NoticeCase">
  70 + update notice_case
  71 + <set>
  72 + <if test="metaKey != null">
  73 + meta_key = #{metaKey,jdbcType=VARCHAR},
  74 + </if>
  75 + <if test="title != null">
  76 + title = #{title,jdbcType=VARCHAR},
  77 + </if>
  78 + <if test="ruleIds != null">
  79 + rule_ids = #{ruleIds,jdbcType=VARCHAR},
  80 + </if>
  81 + <if test="rules != null">
  82 + rules = #{rules,jdbcType=VARCHAR},
  83 + </if>
  84 + </set>
  85 + where id = #{id,jdbcType=INTEGER}
  86 + </update>
  87 + <update id="updateByPrimaryKey" parameterType="com.yohoufo.dal.order.model.NoticeCase">
  88 + update notice_case
  89 + set meta_key = #{metaKey,jdbcType=VARCHAR},
  90 + title = #{title,jdbcType=VARCHAR},
  91 + rule_ids = #{ruleIds,jdbcType=VARCHAR},
  92 + rules = #{rules,jdbcType=VARCHAR}
  93 + where id = #{id,jdbcType=INTEGER}
  94 + </update>
  95 +</mapper>
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3 +<mapper namespace="com.yohoufo.dal.order.NoticeMapper">
  4 + <resultMap id="BaseResultMap" type="com.yohoufo.dal.order.model.Notice">
  5 + <id column="id" jdbcType="BIGINT" property="id" />
  6 + <result column="uid" jdbcType="INTEGER" property="uid" />
  7 + <result column="biz_key" jdbcType="VARCHAR" property="bizKey" />
  8 + <result column="case_id" jdbcType="INTEGER" property="caseId" />
  9 + <result column="rule_id" jdbcType="INTEGER" property="ruleId" />
  10 + <result column="method" jdbcType="SMALLINT" property="method" />
  11 + <result column="limit_quantity" jdbcType="INTEGER" property="limitQuantity" />
  12 + <result column="quantity" jdbcType="INTEGER" property="quantity" />
  13 + <result column="update_dtp" jdbcType="VARCHAR" property="updateDtp" />
  14 + <result column="time_unit_region" jdbcType="INTEGER" property="timeUnitRegion" />
  15 + <result column="time_unit" jdbcType="SMALLINT" property="timeUnit" />
  16 + <result column="update_time" jdbcType="INTEGER" property="updateTime" />
  17 + <result column="create_time" jdbcType="INTEGER" property="createTime" />
  18 + </resultMap>
  19 + <sql id="Base_Column_List">
  20 + id, uid, biz_key, case_id, rule_id, method, limit_quantity, quantity, update_dtp,
  21 + time_unit_region, time_unit, update_time, create_time
  22 + </sql>
  23 + <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
  24 + select
  25 + <include refid="Base_Column_List" />
  26 + from notice
  27 + where id = #{id,jdbcType=BIGINT}
  28 + </select>
  29 + <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
  30 + delete from notice
  31 + where id = #{id,jdbcType=BIGINT}
  32 + </delete>
  33 + <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.yohoufo.dal.order.model.Notice" useGeneratedKeys="true">
  34 + insert into notice (uid, biz_key, case_id,
  35 + rule_id, method, limit_quantity,
  36 + quantity, update_dtp, time_unit_region,
  37 + time_unit, update_time, create_time
  38 + )
  39 + values (#{uid,jdbcType=INTEGER}, #{bizKey,jdbcType=VARCHAR}, #{caseId,jdbcType=INTEGER},
  40 + #{ruleId,jdbcType=INTEGER}, #{method,jdbcType=SMALLINT}, #{limitQuantity,jdbcType=INTEGER},
  41 + #{quantity,jdbcType=INTEGER}, #{updateDtp,jdbcType=VARCHAR}, #{timeUnitRegion,jdbcType=INTEGER},
  42 + #{timeUnit,jdbcType=SMALLINT}, #{updateTime,jdbcType=INTEGER}, #{createTime,jdbcType=INTEGER}
  43 + )
  44 + </insert>
  45 + <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.yohoufo.dal.order.model.Notice" useGeneratedKeys="true">
  46 + insert into notice
  47 + <trim prefix="(" suffix=")" suffixOverrides=",">
  48 + <if test="uid != null">
  49 + uid,
  50 + </if>
  51 + <if test="bizKey != null">
  52 + biz_key,
  53 + </if>
  54 + <if test="caseId != null">
  55 + case_id,
  56 + </if>
  57 + <if test="ruleId != null">
  58 + rule_id,
  59 + </if>
  60 + <if test="method != null">
  61 + method,
  62 + </if>
  63 + <if test="limitQuantity != null">
  64 + limit_quantity,
  65 + </if>
  66 + <if test="quantity != null">
  67 + quantity,
  68 + </if>
  69 + <if test="updateDtp != null">
  70 + update_dtp,
  71 + </if>
  72 + <if test="timeUnitRegion != null">
  73 + time_unit_region,
  74 + </if>
  75 + <if test="timeUnit != null">
  76 + time_unit,
  77 + </if>
  78 + <if test="updateTime != null">
  79 + update_time,
  80 + </if>
  81 + <if test="createTime != null">
  82 + create_time,
  83 + </if>
  84 + </trim>
  85 + <trim prefix="values (" suffix=")" suffixOverrides=",">
  86 + <if test="uid != null">
  87 + #{uid,jdbcType=INTEGER},
  88 + </if>
  89 + <if test="bizKey != null">
  90 + #{bizKey,jdbcType=VARCHAR},
  91 + </if>
  92 + <if test="caseId != null">
  93 + #{caseId,jdbcType=INTEGER},
  94 + </if>
  95 + <if test="ruleId != null">
  96 + #{ruleId,jdbcType=INTEGER},
  97 + </if>
  98 + <if test="method != null">
  99 + #{method,jdbcType=SMALLINT},
  100 + </if>
  101 + <if test="limitQuantity != null">
  102 + #{limitQuantity,jdbcType=INTEGER},
  103 + </if>
  104 + <if test="quantity != null">
  105 + #{quantity,jdbcType=INTEGER},
  106 + </if>
  107 + <if test="updateDtp != null">
  108 + #{updateDtp,jdbcType=VARCHAR},
  109 + </if>
  110 + <if test="timeUnitRegion != null">
  111 + #{timeUnitRegion,jdbcType=INTEGER},
  112 + </if>
  113 + <if test="timeUnit != null">
  114 + #{timeUnit,jdbcType=SMALLINT},
  115 + </if>
  116 + <if test="updateTime != null">
  117 + #{updateTime,jdbcType=INTEGER},
  118 + </if>
  119 + <if test="createTime != null">
  120 + #{createTime,jdbcType=INTEGER},
  121 + </if>
  122 + </trim>
  123 + </insert>
  124 + <update id="updateByPrimaryKeySelective" parameterType="com.yohoufo.dal.order.model.Notice">
  125 + update notice
  126 + <set>
  127 + <if test="uid != null">
  128 + uid = #{uid,jdbcType=INTEGER},
  129 + </if>
  130 + <if test="bizKey != null">
  131 + biz_key = #{bizKey,jdbcType=VARCHAR},
  132 + </if>
  133 + <if test="caseId != null">
  134 + case_id = #{caseId,jdbcType=INTEGER},
  135 + </if>
  136 + <if test="ruleId != null">
  137 + rule_id = #{ruleId,jdbcType=INTEGER},
  138 + </if>
  139 + <if test="method != null">
  140 + method = #{method,jdbcType=SMALLINT},
  141 + </if>
  142 + <if test="limitQuantity != null">
  143 + limit_quantity = #{limitQuantity,jdbcType=INTEGER},
  144 + </if>
  145 + <if test="quantity != null">
  146 + quantity = #{quantity,jdbcType=INTEGER},
  147 + </if>
  148 + <if test="updateDtp != null">
  149 + update_dtp = #{updateDtp,jdbcType=VARCHAR},
  150 + </if>
  151 + <if test="timeUnitRegion != null">
  152 + time_unit_region = #{timeUnitRegion,jdbcType=INTEGER},
  153 + </if>
  154 + <if test="timeUnit != null">
  155 + time_unit = #{timeUnit,jdbcType=SMALLINT},
  156 + </if>
  157 + <if test="updateTime != null">
  158 + update_time = #{updateTime,jdbcType=INTEGER},
  159 + </if>
  160 + <if test="createTime != null">
  161 + create_time = #{createTime,jdbcType=INTEGER},
  162 + </if>
  163 + </set>
  164 + where id = #{id,jdbcType=BIGINT}
  165 + </update>
  166 + <update id="updateByPrimaryKey" parameterType="com.yohoufo.dal.order.model.Notice">
  167 + update notice
  168 + set uid = #{uid,jdbcType=INTEGER},
  169 + biz_key = #{bizKey,jdbcType=VARCHAR},
  170 + case_id = #{caseId,jdbcType=INTEGER},
  171 + rule_id = #{ruleId,jdbcType=INTEGER},
  172 + method = #{method,jdbcType=SMALLINT},
  173 + limit_quantity = #{limitQuantity,jdbcType=INTEGER},
  174 + quantity = #{quantity,jdbcType=INTEGER},
  175 + update_dtp = #{updateDtp,jdbcType=VARCHAR},
  176 + time_unit_region = #{timeUnitRegion,jdbcType=INTEGER},
  177 + time_unit = #{timeUnit,jdbcType=SMALLINT},
  178 + update_time = #{updateTime,jdbcType=INTEGER},
  179 + create_time = #{createTime,jdbcType=INTEGER}
  180 + where id = #{id,jdbcType=BIGINT}
  181 + </update>
  182 +</mapper>
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3 +<mapper namespace="com.yohoufo.dal.order.NoticeRuleMapper">
  4 + <resultMap id="BaseResultMap" type="com.yohoufo.dal.order.model.NoticeRule">
  5 + <id column="id" jdbcType="INTEGER" property="id" />
  6 + <result column="case_id" jdbcType="INTEGER" property="caseId" />
  7 + <result column="method" jdbcType="SMALLINT" property="method" />
  8 + <result column="quantity" jdbcType="INTEGER" property="quantity" />
  9 + <result column="time_unit_region" jdbcType="INTEGER" property="timeUnitRegion" />
  10 + <result column="time_unit" jdbcType="SMALLINT" property="timeUnit" />
  11 + </resultMap>
  12 + <sql id="Base_Column_List">
  13 + id, case_id, method, quantity, time_unit_region, time_unit
  14 + </sql>
  15 + <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
  16 + select
  17 + <include refid="Base_Column_List" />
  18 + from notice_rule
  19 + where id = #{id,jdbcType=INTEGER}
  20 + </select>
  21 + <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
  22 + delete from notice_rule
  23 + where id = #{id,jdbcType=INTEGER}
  24 + </delete>
  25 + <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.yohoufo.dal.order.model.NoticeRule" useGeneratedKeys="true">
  26 + insert into notice_rule (case_id, method, quantity,
  27 + time_unit_region, time_unit)
  28 + values (#{caseId,jdbcType=INTEGER}, #{method,jdbcType=SMALLINT}, #{quantity,jdbcType=INTEGER},
  29 + #{timeUnitRegion,jdbcType=INTEGER}, #{timeUnit,jdbcType=SMALLINT})
  30 + </insert>
  31 + <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.yohoufo.dal.order.model.NoticeRule" useGeneratedKeys="true">
  32 + insert into notice_rule
  33 + <trim prefix="(" suffix=")" suffixOverrides=",">
  34 + <if test="caseId != null">
  35 + case_id,
  36 + </if>
  37 + <if test="method != null">
  38 + method,
  39 + </if>
  40 + <if test="quantity != null">
  41 + quantity,
  42 + </if>
  43 + <if test="timeUnitRegion != null">
  44 + time_unit_region,
  45 + </if>
  46 + <if test="timeUnit != null">
  47 + time_unit,
  48 + </if>
  49 + </trim>
  50 + <trim prefix="values (" suffix=")" suffixOverrides=",">
  51 + <if test="caseId != null">
  52 + #{caseId,jdbcType=INTEGER},
  53 + </if>
  54 + <if test="method != null">
  55 + #{method,jdbcType=SMALLINT},
  56 + </if>
  57 + <if test="quantity != null">
  58 + #{quantity,jdbcType=INTEGER},
  59 + </if>
  60 + <if test="timeUnitRegion != null">
  61 + #{timeUnitRegion,jdbcType=INTEGER},
  62 + </if>
  63 + <if test="timeUnit != null">
  64 + #{timeUnit,jdbcType=SMALLINT},
  65 + </if>
  66 + </trim>
  67 + </insert>
  68 + <update id="updateByPrimaryKeySelective" parameterType="com.yohoufo.dal.order.model.NoticeRule">
  69 + update notice_rule
  70 + <set>
  71 + <if test="caseId != null">
  72 + case_id = #{caseId,jdbcType=INTEGER},
  73 + </if>
  74 + <if test="method != null">
  75 + method = #{method,jdbcType=SMALLINT},
  76 + </if>
  77 + <if test="quantity != null">
  78 + quantity = #{quantity,jdbcType=INTEGER},
  79 + </if>
  80 + <if test="timeUnitRegion != null">
  81 + time_unit_region = #{timeUnitRegion,jdbcType=INTEGER},
  82 + </if>
  83 + <if test="timeUnit != null">
  84 + time_unit = #{timeUnit,jdbcType=SMALLINT},
  85 + </if>
  86 + </set>
  87 + where id = #{id,jdbcType=INTEGER}
  88 + </update>
  89 + <update id="updateByPrimaryKey" parameterType="com.yohoufo.dal.order.model.NoticeRule">
  90 + update notice_rule
  91 + set case_id = #{caseId,jdbcType=INTEGER},
  92 + method = #{method,jdbcType=SMALLINT},
  93 + quantity = #{quantity,jdbcType=INTEGER},
  94 + time_unit_region = #{timeUnitRegion,jdbcType=INTEGER},
  95 + time_unit = #{timeUnit,jdbcType=SMALLINT}
  96 + where id = #{id,jdbcType=INTEGER}
  97 + </update>
  98 +</mapper>
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +
  3 +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  5 + <parent>
  6 + <artifactId>yohoufo-fore-parent</artifactId>
  7 + <groupId>com.yohoufo.fore</groupId>
  8 + <version>1.0.0-SNAPSHOT</version>
  9 + </parent>
  10 + <modelVersion>4.0.0</modelVersion>
  11 +
  12 + <artifactId>yohoufo-fore-msg-center</artifactId>
  13 +
  14 + <name>yohoufo-fore-msg-center</name>
  15 + <dependencies>
  16 +
  17 + <dependency>
  18 + <groupId>com.yohoufo.fore</groupId>
  19 + <artifactId>yohoufo-fore-dal</artifactId>
  20 + </dependency>
  21 +
  22 +
  23 + <dependency>
  24 + <groupId>com.yoho.ufo.model</groupId>
  25 + <artifactId>order-ufo-model</artifactId>
  26 + </dependency>
  27 +
  28 + <dependency>
  29 + <groupId>com.yohoufo.fore</groupId>
  30 + <artifactId>yohoufo-fore-inboxclient</artifactId>
  31 + </dependency>
  32 + </dependencies>
  33 +
  34 +
  35 +
  36 +
  37 +
  38 +
  39 +
  40 +</project>
  1 +package com.yohoufo.msg.cache;
  2 +
  3 +import com.yoho.core.redis.cluster.operations.serializer.RedisKeyBuilder;
  4 +import org.slf4j.helpers.MessageFormatter;
  5 +
  6 +/**
  7 + * Created by chenchao on 2018/10/16.
  8 + */
  9 +public class CacheKeyBuilder {
  10 + public enum KeyTemp{
  11 + BASE_NOTICE_CASE("ufo:msg:notice:case:","metaKey:{}"),
  12 +
  13 + LOWER_PRICE_NOTICE_SELLER("ufo:msg:lowerPrice:seller:","uid:{}:storageId:{}case:{}:method:{}:dtp{}:num");
  14 +
  15 +
  16 + private String fix;
  17 +
  18 + private String placeHolder;
  19 +
  20 + KeyTemp(String fix, String placeHolder) {
  21 + this.fix = fix;
  22 + this.placeHolder = placeHolder;
  23 + }
  24 +
  25 +
  26 + public String fillPlaceHolder(Object[] args){
  27 + if (placeHolder == null){
  28 + return null;
  29 + }
  30 + return MessageFormatter.arrayFormat(placeHolder, args).getMessage();
  31 + }
  32 +
  33 + public RedisKeyBuilder builderKey(Object[] args){
  34 + String appendPart = fillPlaceHolder(args);
  35 + return new RedisKeyBuilder().appendFixed(fix).appendVar(appendPart);
  36 + }
  37 + }
  38 +
  39 +
  40 + public static RedisKeyBuilder lowerPriceNoticeSellerKey(int uid, int storageId, Integer caseId, Short method, String dtp){
  41 + return KeyTemp.LOWER_PRICE_NOTICE_SELLER.builderKey(new Object[]{uid, storageId, caseId, method, dtp});
  42 + }
  43 +
  44 + public static RedisKeyBuilder baseNoticeCaseKey(String metaKey){
  45 + return KeyTemp.BASE_NOTICE_CASE.builderKey(new Object[]{metaKey});
  46 + }
  47 +
  48 +
  49 +}
  1 +package com.yohoufo.msg.cache;
  2 +
  3 +/**
  4 + * Created by chao.chen on 2018/12/5.
  5 + */
  6 +public interface ExpiredTime {
  7 +
  8 + int CASE_EXPIRED_TIME = 300;
  9 +}
  1 +package com.yohoufo.msg.config;
  2 +
  3 +/**
  4 + * Created by chao.chen on 2018/12/5.
  5 + */
  6 +public interface CaseIdConfig {
  7 +
  8 + String LOWER_PRICE_NOTICE_SELLER = "LOWER_PRICE_NOTICE_SELLER";
  9 +}
  1 +package com.yohoufo.msg.constants;
  2 +
  3 +import java.util.HashMap;
  4 +import java.util.Map;
  5 +
  6 +/**
  7 + * 时间单位,1:秒,2:分钟,3:小时,4:天,5:周,6:月,7:年
  8 + * Created by chao.chen on 2018/12/5.
  9 + */
  10 +public enum TimeUnitEnum {
  11 + SECOND((short)1),
  12 + MIN((short)2),
  13 + HOUR((short)3),
  14 + DAY((short)4),
  15 + WEEK((short)5),
  16 + MONTH((short)6),
  17 + YEAR((short)7);
  18 + short code;
  19 +
  20 + TimeUnitEnum(short code) {
  21 + this.code = code;
  22 + }
  23 +
  24 + public short getCode() {
  25 + return code;
  26 + }
  27 +
  28 + private static Map<Short,TimeUnitEnum> cache;
  29 +
  30 + static {
  31 + cache = new HashMap<>(values().length);
  32 + for(TimeUnitEnum tu: values()){
  33 + cache.put(tu.code, tu);
  34 + }
  35 + }
  36 +
  37 + public static TimeUnitEnum getByCode(Short code){
  38 + return cache.get(code);
  39 + }
  40 +}
  1 +package com.yohoufo.msg.model;
  2 +
  3 +import com.yohoufo.dal.order.model.NoticeCase;
  4 +import lombok.Data;
  5 +
  6 +import java.util.List;
  7 +import java.util.Map;
  8 +
  9 +/**
  10 + * Created by chao.chen on 2018/12/5.
  11 + */
  12 +@Data
  13 +public class NoticeCaseNode {
  14 +
  15 + private Integer id;
  16 +
  17 + private Integer uid;
  18 +
  19 + private String bizKey;
  20 +
  21 + private NoticeCase noticeCase;
  22 +
  23 + private Map<Integer, NoticeRuleNode> noticeRuleNodeMap;
  24 +}
  1 +package com.yohoufo.msg.model;
  2 +
  3 +import com.yohoufo.dal.order.model.Notice;
  4 +import lombok.Data;
  5 +
  6 +/**
  7 + * Created by chao.chen on 2018/12/5.
  8 + */
  9 +@Data
  10 +public class NoticeNode {
  11 +
  12 + private Integer id;
  13 +
  14 + private Integer uid;
  15 +
  16 + private String bizKey;
  17 +
  18 + private Integer caseId;
  19 +
  20 + private Integer ruleId;
  21 +
  22 + private Notice notice;
  23 +
  24 +}
  1 +package com.yohoufo.msg.model;
  2 +
  3 +import com.yohoufo.dal.order.model.NoticeRule;
  4 +import lombok.Data;
  5 +
  6 +/**
  7 + * Created by chao.chen on 2018/12/5.
  8 + */
  9 +@Data
  10 +public class NoticeRuleNode {
  11 + private Integer id;
  12 + private NoticeRule noticeRule;
  13 + private NoticeNode noticeNode;
  14 +}
  1 +package com.yohoufo.msg.service.impl;
  2 +
  3 +import com.yohoufo.common.cache.CacheClient;
  4 +import com.yohoufo.common.utils.DateUtil;
  5 +import com.yohoufo.dal.order.model.NoticeRule;
  6 +import com.yohoufo.msg.cache.CacheKeyBuilder;
  7 +import com.yohoufo.msg.config.CaseIdConfig;
  8 +import com.yohoufo.msg.constants.TimeUnitEnum;
  9 +import com.yohoufo.msg.model.NoticeCaseNode;
  10 +import com.yohoufo.msg.model.NoticeRuleNode;
  11 +import org.springframework.beans.factory.annotation.Autowired;
  12 +import org.springframework.stereotype.Service;
  13 +
  14 +import java.util.Arrays;
  15 +import java.util.Date;
  16 +import java.util.List;
  17 +import java.util.Map;
  18 +import java.util.stream.Collectors;
  19 +
  20 +/**
  21 + * Created by chao.chen on 2018/12/5.
  22 + */
  23 +@Service
  24 +public class MsgService {
  25 +
  26 + @Autowired
  27 + private NoticeCaseService noticeCaseService;
  28 +
  29 + @Autowired
  30 + private CacheClient cacheClient;
  31 +
  32 +
  33 + private Map<Short,String> getTimeUnitPartten(Date date, List<TimeUnitEnum> tueList){
  34 + return tueList.parallelStream().collect(Collectors.toMap(TimeUnitEnum::getCode, tue->{
  35 + String fmtp = null;
  36 + switch (tue){
  37 + case HOUR:
  38 + fmtp = DateUtil.format(date, DateUtil.yyyyMMddHH);
  39 + break;
  40 + }
  41 + return fmtp;
  42 + }));
  43 + }
  44 +
  45 + public void noticeSellerWhenLowerPrice(List<Integer> uidList, int storageId){
  46 + NoticeCaseNode ncNode = noticeCaseService.getNoticeCaseNode(CaseIdConfig.LOWER_PRICE_NOTICE_SELLER);
  47 + Map<Integer, NoticeRuleNode> noticeRuleNodeMap = ncNode.getNoticeRuleNodeMap();
  48 + Integer caseId = ncNode.getId();
  49 + Date now = new Date();
  50 + Map<Short,String> tupMap = this.getTimeUnitPartten(now, Arrays.asList(TimeUnitEnum.HOUR, TimeUnitEnum.DAY));
  51 + for(Map.Entry<Integer, NoticeRuleNode> nrEntry : noticeRuleNodeMap.entrySet()){
  52 + NoticeRuleNode nrNode = nrEntry.getValue();
  53 + NoticeRule pnr = nrNode.getNoticeRule();
  54 + Short method = pnr.getMethod();
  55 + Short timeUnit = pnr.getTimeUnit();
  56 + TimeUnitEnum tue = TimeUnitEnum.getByCode(timeUnit);
  57 + if (tue == null){
  58 + continue;
  59 + }
  60 + for(Integer uid :uidList) {
  61 + String dtp = tupMap.get(tue.getCode());
  62 + CacheKeyBuilder.lowerPriceNoticeSellerKey(uid, storageId, caseId, method, dtp);
  63 + }
  64 +
  65 + }
  66 +
  67 +
  68 + }
  69 +}
  1 +package com.yohoufo.msg.service.impl;
  2 +
  3 +import com.alibaba.fastjson.JSONObject;
  4 +import com.alibaba.fastjson.TypeReference;
  5 +import com.yoho.core.redis.cluster.operations.serializer.RedisKeyBuilder;
  6 +import com.yohoufo.common.cache.CacheClient;
  7 +import com.yohoufo.common.exception.UfoServiceException;
  8 +import com.yohoufo.dal.order.NoticeCaseMapper;
  9 +import com.yohoufo.dal.order.model.NoticeCase;
  10 +import com.yohoufo.dal.order.model.NoticeRule;
  11 +import com.yohoufo.msg.cache.CacheKeyBuilder;
  12 +import com.yohoufo.msg.cache.ExpiredTime;
  13 +import com.yohoufo.msg.model.NoticeCaseNode;
  14 +import com.yohoufo.msg.model.NoticeRuleNode;
  15 +import org.apache.commons.collections.CollectionUtils;
  16 +import org.apache.commons.lang3.StringUtils;
  17 +import org.slf4j.Logger;
  18 +import org.slf4j.LoggerFactory;
  19 +import org.springframework.beans.factory.annotation.Autowired;
  20 +import org.springframework.stereotype.Service;
  21 +
  22 +import java.util.List;
  23 +import java.util.Map;
  24 +import java.util.Objects;
  25 +import java.util.stream.Collectors;
  26 +
  27 +/**
  28 + * Created by chao.chen on 2018/12/5.
  29 + */
  30 +@Service
  31 +public class NoticeCaseService {
  32 +
  33 + private final Logger logger = LoggerFactory.getLogger(getClass());
  34 +
  35 + @Autowired
  36 + private CacheClient cacheClient;
  37 +
  38 + @Autowired
  39 + private NoticeCaseMapper noticeCaseMapper;
  40 +
  41 + public NoticeCaseNode getNoticeCaseNode(String metaKey){
  42 + RedisKeyBuilder rkb = CacheKeyBuilder.baseNoticeCaseKey(metaKey);
  43 + NoticeCaseNode ncn = cacheClient.get(rkb, NoticeCaseNode.class);
  44 + if (Objects.nonNull(ncn)){
  45 + return ncn;
  46 + }
  47 + NoticeCase noticeCase = noticeCaseMapper.selectByMetaKey(metaKey);
  48 + if (Objects.isNull(noticeCase)){
  49 + logger.warn("in getNoticeCaseNode selectByMetaKey is none, metaKey {}", metaKey );
  50 + throw new UfoServiceException(501, "推送规则配置错误");
  51 + }
  52 + ncn = new NoticeCaseNode();
  53 + ncn.setId(noticeCase.getId());
  54 + ncn.setNoticeCase(noticeCase);
  55 + //
  56 + String rulesStr = noticeCase.getRules();
  57 + List<NoticeRule> noticeRules = null;
  58 + if (StringUtils.isNotBlank(rulesStr)){
  59 + try {
  60 + noticeRules = JSONObject.parseObject(rulesStr, new TypeReference<List<NoticeRule>>(){});
  61 + }catch (Exception ex){
  62 + logger.warn("in getNoticeCaseNode parse rulesStr {} fail metaKey {}", rulesStr, metaKey );
  63 + throw new UfoServiceException(501, "推送规则配置错误");
  64 + }
  65 + }
  66 + Map<Integer, NoticeRuleNode> noticeRuleNodeMap;
  67 + if(CollectionUtils.isEmpty(noticeRules)){
  68 + logger.warn("in getNoticeCaseNode parse rulesStr {} get noticeRules is empty metaKey {}", rulesStr, metaKey );
  69 + throw new UfoServiceException(501, "推送规则配置错误");
  70 + }
  71 + noticeRuleNodeMap = noticeRules.parallelStream().collect(Collectors.toMap(NoticeRule::getId, nr -> {
  72 + NoticeRuleNode nrn = new NoticeRuleNode();
  73 + nrn.setId(nr.getId());
  74 + nrn.setNoticeRule(nr);
  75 + return nrn;
  76 + }));
  77 + ncn.setNoticeRuleNodeMap(noticeRuleNodeMap);
  78 +
  79 + //
  80 + cacheClient.setEx(rkb, ncn, ExpiredTime.CASE_EXPIRED_TIME);
  81 + return ncn;
  82 + }
  83 +}
  1 +package com.yohoufo.msg.service.impl;
  2 +
  3 +import com.yohoufo.common.cache.CacheClient;
  4 +import com.yohoufo.msg.model.NoticeCaseNode;
  5 +import org.springframework.beans.factory.annotation.Autowired;
  6 +import org.springframework.stereotype.Service;
  7 +
  8 +/**
  9 + * Created by chao.chen on 2018/12/5.
  10 + */
  11 +@Service
  12 +public class NoticeService {
  13 +
  14 +
  15 + @Autowired
  16 + private CacheClient cacheClient;
  17 +
  18 +
  19 + public void addByCase(NoticeCaseNode ncNode){
  20 +
  21 + }
  22 +}
@@ -43,10 +43,7 @@ @@ -43,10 +43,7 @@
43 <groupId>com.yoho.core</groupId> 43 <groupId>com.yoho.core</groupId>
44 <artifactId>yoho-core-rest-client-simple</artifactId> 44 <artifactId>yoho-core-rest-client-simple</artifactId>
45 </dependency> 45 </dependency>
46 - <dependency>  
47 - <groupId>com.yohoufo.fore</groupId>  
48 - <artifactId>yohoufo-fore-dal</artifactId>  
49 - </dependency> 46 +
50 47
51 48
52 <dependency> 49 <dependency>
  1 +package com.yohoufo.order.event;
  2 +
  3 +import com.yohoufo.common.alarm.Event;
  4 +import lombok.AllArgsConstructor;
  5 +import lombok.Data;
  6 +import lombok.NoArgsConstructor;
  7 +import lombok.experimental.Builder;
  8 +
  9 +import java.math.BigDecimal;
  10 +
  11 +/**
  12 + * Created by chao.chen on 2018/12/4.
  13 + */
  14 +@Data
  15 +@Builder
  16 +@AllArgsConstructor
  17 +@NoArgsConstructor
  18 +public class LowerPriceFiredEvent extends Event {
  19 + Integer uid;
  20 + BigDecimal salePrice;
  21 + Integer storageId;
  22 +}
  1 +package com.yohoufo.order.service.handler;
  2 +
  3 +import com.google.common.eventbus.Subscribe;
  4 +import com.yohoufo.common.alarm.IEventHandler;
  5 +import com.yohoufo.order.event.LowerPriceFiredEvent;
  6 +import com.yohoufo.order.service.impl.SellerService;
  7 +import com.yohoufo.order.utils.LoggerUtils;
  8 +import org.slf4j.Logger;
  9 +import org.springframework.beans.factory.annotation.Autowired;
  10 +import org.springframework.stereotype.Component;
  11 +
  12 +/**
  13 + * Created by chao.chen on 2018/12/4.
  14 + */
  15 +@Component
  16 +public class LowerPriceFiredHandler implements IEventHandler<LowerPriceFiredEvent> {
  17 +
  18 + private final Logger logger = LoggerUtils.getSellerOrderLogger();
  19 +
  20 + @Autowired
  21 + private SellerService sellerService;
  22 +
  23 + @Override
  24 + @Subscribe
  25 + public void handle(LowerPriceFiredEvent event) {
  26 + logger.info("handle LowerPriceFiredEvent {}", event);
  27 + sellerService.lowerPriceFired(event.getUid(), event.getSalePrice(), event.getStorageId());
  28 + logger.info("finish handle LowerPriceFiredEvent {}", event);
  29 + }
  30 +}
@@ -162,13 +162,7 @@ public abstract class AbsOrderDetailService extends AbsOrderViewService implemen @@ -162,13 +162,7 @@ public abstract class AbsOrderDetailService extends AbsOrderViewService implemen
162 .build(); 162 .build();
163 orderDetailInfo.setPriceInfo(priceInfo); 163 orderDetailInfo.setPriceInfo(priceInfo);
164 // 支付状态 164 // 支付状态
165 - if (buyerOrder.getPayment() != null){  
166 - Payment payment = Payment.getPayment(buyerOrder.getPayment());  
167 - if (payment != null){  
168 - orderDetailInfo.setPaymentStr(payment.getDesc());  
169 - orderDetailInfo.setPayment(buyerOrder.getPayment());  
170 - }  
171 - } 165 + setPayment(orderDetailInfo, buyerOrder.getPayment());
172 orderDetailInfo.setCreateTime(DateUtil.formatDate(buyerOrder.getCreateTime(), DateUtil.yyyy_MM_dd_HH_mm_SS)); 166 orderDetailInfo.setCreateTime(DateUtil.formatDate(buyerOrder.getCreateTime(), DateUtil.yyyy_MM_dd_HH_mm_SS));
173 orderDetailInfo.setSecendLevelCreateTime(buyerOrder.getCreateTime()); 167 orderDetailInfo.setSecendLevelCreateTime(buyerOrder.getCreateTime());
174 // 需要查询 时间点 and 物流定位 168 // 需要查询 时间点 and 物流定位
@@ -6,6 +6,8 @@ import com.yohobuy.ufo.model.order.common.OrderStatus; @@ -6,6 +6,8 @@ import com.yohobuy.ufo.model.order.common.OrderStatus;
6 import com.yohobuy.ufo.model.order.common.SkupStatus; 6 import com.yohobuy.ufo.model.order.common.SkupStatus;
7 import com.yohobuy.ufo.model.order.common.TabType; 7 import com.yohobuy.ufo.model.order.common.TabType;
8 import com.yohoufo.common.utils.DateUtil; 8 import com.yohoufo.common.utils.DateUtil;
  9 +import com.yohoufo.order.common.Payment;
  10 +import com.yohoufo.order.model.response.OrderDetailInfo;
9 import org.apache.commons.collections.CollectionUtils; 11 import org.apache.commons.collections.CollectionUtils;
10 import org.slf4j.helpers.MessageFormatter; 12 import org.slf4j.helpers.MessageFormatter;
11 import org.springframework.beans.factory.annotation.Autowired; 13 import org.springframework.beans.factory.annotation.Autowired;
@@ -114,4 +116,14 @@ public abstract class AbsOrderViewService { @@ -114,4 +116,14 @@ public abstract class AbsOrderViewService {
114 protected int calLeftTime(int creatTime){ 116 protected int calLeftTime(int creatTime){
115 return OrderInfo.PAY_TIME_SECOND - (DateUtil.getCurrentTimeSecond() - creatTime); 117 return OrderInfo.PAY_TIME_SECOND - (DateUtil.getCurrentTimeSecond() - creatTime);
116 } 118 }
  119 +
  120 + protected void setPayment(OrderDetailInfo orderDetailInfo, Integer paymentCode){
  121 + if (paymentCode != null){
  122 + Payment payment = Payment.getPayment(paymentCode);
  123 + if (payment != null){
  124 + orderDetailInfo.setPaymentStr(payment.getDesc());
  125 + orderDetailInfo.setPayment(paymentCode);
  126 + }
  127 + }
  128 + }
117 } 129 }
@@ -7,6 +7,7 @@ import com.yohobuy.ufo.model.order.common.SkupStatus; @@ -7,6 +7,7 @@ import com.yohobuy.ufo.model.order.common.SkupStatus;
7 import com.yohoufo.order.common.Payment; 7 import com.yohoufo.order.common.Payment;
8 import com.yohoufo.order.service.proxy.ProductProxyService; 8 import com.yohoufo.order.service.proxy.ProductProxyService;
9 import com.yohoufo.product.response.StorageDataResp; 9 import com.yohoufo.product.response.StorageDataResp;
  10 +import org.slf4j.Logger;
10 11
11 import java.util.Arrays; 12 import java.util.Arrays;
12 import java.util.List; 13 import java.util.List;
@@ -15,6 +16,7 @@ import java.util.List; @@ -15,6 +16,7 @@ import java.util.List;
15 * Created by chao.chen on 2018/11/26. 16 * Created by chao.chen on 2018/11/26.
16 */ 17 */
17 public interface AbsSellerOrderViewService { 18 public interface AbsSellerOrderViewService {
  19 + Logger getLogger();
18 enum ViewType{ 20 enum ViewType{
19 DETAIL, LIST 21 DETAIL, LIST
20 } 22 }
@@ -69,6 +71,7 @@ public interface AbsSellerOrderViewService { @@ -69,6 +71,7 @@ public interface AbsSellerOrderViewService {
69 prdPrice.setLeastPrice(storage.getLeastPrice()); 71 prdPrice.setLeastPrice(storage.getLeastPrice());
70 }catch (Exception ex){ 72 }catch (Exception ex){
71 prdPrice = new ProductProxyService.PrdPrice(); 73 prdPrice = new ProductProxyService.PrdPrice();
  74 + getLogger().warn("in getPrdPrice fail, storageId {}", storageId);
72 } 75 }
73 76
74 return prdPrice; 77 return prdPrice;
@@ -146,7 +146,7 @@ public class SellerOrderCancelService { @@ -146,7 +146,7 @@ public class SellerOrderCancelService {
146 146
147 SellerOrderStatusNode statusNode = SellerOrderStatusNode.builder() 147 SellerOrderStatusNode statusNode = SellerOrderStatusNode.builder()
148 .exceptStatus(SellerOrderStatus.WAITING_PAY).targetStatus(targetSOStatus).build(); 148 .exceptStatus(SellerOrderStatus.WAITING_PAY).targetStatus(targetSOStatus).build();
149 - result = cancelBeforePayAction(uid, orderCode, skup, statusNode); 149 + result = cancelBeforeBuyerPayAction(uid, orderCode, skup, statusNode);
150 } 150 }
151 151
152 //case 2: 支付完成,没有买家下单 152 //case 2: 支付完成,没有买家下单
@@ -180,7 +180,7 @@ public class SellerOrderCancelService { @@ -180,7 +180,7 @@ public class SellerOrderCancelService {
180 SellerOrderStatusNode statusNode = SellerOrderStatusNode.builder() 180 SellerOrderStatusNode statusNode = SellerOrderStatusNode.builder()
181 .exceptStatus(SellerOrderStatus.WAITING_PAY) 181 .exceptStatus(SellerOrderStatus.WAITING_PAY)
182 .targetStatus(targetSOStatus).build(); 182 .targetStatus(targetSOStatus).build();
183 - result = cancelBeforePayAction(uid, orderCode, sellerOrder.getSkup(), statusNode); 183 + result = cancelBeforeBuyerPayAction(uid, orderCode, sellerOrder.getSkup(), statusNode);
184 } 184 }
185 185
186 return result; 186 return result;
@@ -192,7 +192,7 @@ public class SellerOrderCancelService { @@ -192,7 +192,7 @@ public class SellerOrderCancelService {
192 SellerOrderStatus exceptStatus; 192 SellerOrderStatus exceptStatus;
193 } 193 }
194 194
195 - private int cancelBeforePayAction(int uid, long orderCode, Integer skup, SellerOrderStatusNode statusNode){ 195 + private int cancelBeforeBuyerPayAction(int uid, long orderCode, Integer skup, SellerOrderStatusNode statusNode){
196 SellerOrderStatus targetSOStatus = statusNode.targetStatus; 196 SellerOrderStatus targetSOStatus = statusNode.targetStatus;
197 SellerOrderStatus exceptStatus = statusNode.exceptStatus; 197 SellerOrderStatus exceptStatus = statusNode.exceptStatus;
198 logger.info("in seller cancel before Buy Action, uid {} skup {} orderCode {} targetSOStatus {}, exceptStatus {}", 198 logger.info("in seller cancel before Buy Action, uid {} skup {} orderCode {} targetSOStatus {}, exceptStatus {}",
@@ -236,9 +236,14 @@ public class SellerOrderCancelService { @@ -236,9 +236,14 @@ public class SellerOrderCancelService {
236 logger.warn("in seller cancel before Buy Action syncSkup fail, uid {}, skup {}", uid, skup, ex); 236 logger.warn("in seller cancel before Buy Action syncSkup fail, uid {}, skup {}", uid, skup, ex);
237 } 237 }
238 238
239 - cacheCleaner.cleanList(uid, TabType.SELL.getValue());  
240 - SellerOrderGoods psog = sellerOrderGoodsMapper.selectByPrimaryKey(skup);  
241 - cacheCleaner.cleanSellerDetail(psog); 239 + try{
  240 + cacheCleaner.cleanList(uid, TabType.SELL.getValue());
  241 + SellerOrderGoods psog = sellerOrderGoodsMapper.selectByPrimaryKey(skup);
  242 + cacheCleaner.cleanSellerDetail(psog);
  243 + }catch (Exception ex){
  244 + logger.warn("in seller cancel before Buy Action clean cache of list and detail fail, uid {}, skup {}",
  245 + uid, skup, ex);
  246 + }
242 } 247 }
243 248
244 return result; 249 return result;
@@ -263,7 +268,7 @@ public class SellerOrderCancelService { @@ -263,7 +268,7 @@ public class SellerOrderCancelService {
263 268
264 SellerOrderStatusNode statusNode = SellerOrderStatusNode.builder().targetStatus(targetSOStatus) 269 SellerOrderStatusNode statusNode = SellerOrderStatusNode.builder().targetStatus(targetSOStatus)
265 .exceptStatus(expectStatus).build(); 270 .exceptStatus(expectStatus).build();
266 - int result = cancelBeforePayAction(sellerUid, orderCode, skup, statusNode); 271 + int result = cancelBeforeBuyerPayAction(sellerUid, orderCode, skup, statusNode);
267 272
268 if(result > 0 ){ 273 if(result > 0 ){
269 double earnestMoney = sellerOrder.getEarnestMoney().doubleValue(); 274 double earnestMoney = sellerOrder.getEarnestMoney().doubleValue();
@@ -10,11 +10,11 @@ import com.yohobuy.ufo.model.order.constants.OrderConstant; @@ -10,11 +10,11 @@ import com.yohobuy.ufo.model.order.constants.OrderConstant;
10 import com.yohobuy.ufo.model.order.resp.ExpressInfoDetail; 10 import com.yohobuy.ufo.model.order.resp.ExpressInfoDetail;
11 import com.yohobuy.ufo.model.order.resp.ExpressInfoRespBo; 11 import com.yohobuy.ufo.model.order.resp.ExpressInfoRespBo;
12 import com.yohoufo.common.constant.ExpressInfoConstant; 12 import com.yohoufo.common.constant.ExpressInfoConstant;
13 -import com.yohoufo.common.helper.ImageUrlAssist;  
14 import com.yohoufo.common.utils.DateUtil; 13 import com.yohoufo.common.utils.DateUtil;
15 import com.yohoufo.dal.order.*; 14 import com.yohoufo.dal.order.*;
16 import com.yohoufo.dal.order.model.*; 15 import com.yohoufo.dal.order.model.*;
17 -import com.yohoufo.order.common.*; 16 +import com.yohoufo.order.common.ActionStatusHold;
  17 +import com.yohoufo.order.common.Payment;
18 import com.yohoufo.order.constants.MetaKey; 18 import com.yohoufo.order.constants.MetaKey;
19 import com.yohoufo.order.convert.GoodsInfoConvertor; 19 import com.yohoufo.order.convert.GoodsInfoConvertor;
20 import com.yohoufo.order.convert.SellerOrderConvertor; 20 import com.yohoufo.order.convert.SellerOrderConvertor;
@@ -30,12 +30,9 @@ import com.yohoufo.order.service.proxy.ProductProxyService; @@ -30,12 +30,9 @@ import com.yohoufo.order.service.proxy.ProductProxyService;
30 import com.yohoufo.order.service.proxy.UserProxyService; 30 import com.yohoufo.order.service.proxy.UserProxyService;
31 import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator; 31 import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator;
32 import com.yohoufo.order.service.support.codegenerator.bean.CodeMeta; 32 import com.yohoufo.order.service.support.codegenerator.bean.CodeMeta;
33 -  
34 import com.yohoufo.order.utils.LoggerUtils; 33 import com.yohoufo.order.utils.LoggerUtils;
35 -import org.apache.commons.collections.CollectionUtils;  
36 import org.apache.commons.lang3.StringUtils; 34 import org.apache.commons.lang3.StringUtils;
37 import org.slf4j.Logger; 35 import org.slf4j.Logger;
38 -import org.slf4j.LoggerFactory;  
39 import org.springframework.beans.factory.annotation.Autowired; 36 import org.springframework.beans.factory.annotation.Autowired;
40 import org.springframework.stereotype.Service; 37 import org.springframework.stereotype.Service;
41 38
@@ -95,8 +92,6 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I @@ -95,8 +92,6 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I
95 private static final List<Long> SELLER_TYPES = Arrays.asList(OrderCodeType.SELLER_TYPE.getType()); 92 private static final List<Long> SELLER_TYPES = Arrays.asList(OrderCodeType.SELLER_TYPE.getType());
96 93
97 94
98 -  
99 -  
100 @Override 95 @Override
101 public OrderDetailInfo getOrderDetail(OrderRequest orderRequest) { 96 public OrderDetailInfo getOrderDetail(OrderRequest orderRequest) {
102 int uid; 97 int uid;
@@ -361,13 +356,7 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I @@ -361,13 +356,7 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I
361 orderDetailInfo.setGoodsInfo(goodsInfo); 356 orderDetailInfo.setGoodsInfo(goodsInfo);
362 357
363 // 支付状态 358 // 支付状态
364 - if (order.getPayment() != null){  
365 - Payment payment = Payment.getPayment(order.getPayment());  
366 - if (payment != null){  
367 - orderDetailInfo.setPaymentStr(payment.getDesc());  
368 - orderDetailInfo.setPayment(order.getPayment());  
369 - }  
370 - } 359 + setPayment(orderDetailInfo, order.getPayment());
371 // 360 //
372 orderDetailInfo.setIsPaid(getIsPaid(skupStatus)); 361 orderDetailInfo.setIsPaid(getIsPaid(skupStatus));
373 orderDetailInfo.setSecendLevelCreateTime(order.getCreateTime()); 362 orderDetailInfo.setSecendLevelCreateTime(order.getCreateTime());
@@ -412,6 +401,11 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I @@ -412,6 +401,11 @@ public class SellerOrderDetailService extends AbsOrderDetailService implements I
412 } 401 }
413 402
414 @Override 403 @Override
  404 + public Logger getLogger() {
  405 + return logger;
  406 + }
  407 +
  408 + @Override
415 public ProductProxyService getProductProxyService() { 409 public ProductProxyService getProductProxyService() {
416 return productProxyService; 410 return productProxyService;
417 } 411 }
@@ -28,6 +28,7 @@ import com.yohoufo.order.service.proxy.UserProxyService; @@ -28,6 +28,7 @@ import com.yohoufo.order.service.proxy.UserProxyService;
28 import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator; 28 import com.yohoufo.order.service.support.codegenerator.OrderCodeGenerator;
29 import lombok.extern.slf4j.Slf4j; 29 import lombok.extern.slf4j.Slf4j;
30 import org.apache.commons.collections.CollectionUtils; 30 import org.apache.commons.collections.CollectionUtils;
  31 +import org.slf4j.Logger;
31 import org.springframework.beans.factory.annotation.Autowired; 32 import org.springframework.beans.factory.annotation.Autowired;
32 import org.springframework.stereotype.Service; 33 import org.springframework.stereotype.Service;
33 34
@@ -299,6 +300,11 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde @@ -299,6 +300,11 @@ public class SellerOrderListService extends AbsOrderListService implements IOrde
299 } 300 }
300 301
301 @Override 302 @Override
  303 + public Logger getLogger() {
  304 + return log;
  305 + }
  306 +
  307 + @Override
302 public ProductProxyService getProductProxyService() { 308 public ProductProxyService getProductProxyService() {
303 return productProxyService; 309 return productProxyService;
304 } 310 }
  1 +package com.yohoufo.order.service.impl;
  2 +
  3 +import com.yohoufo.order.utils.LoggerUtils;
  4 +import org.slf4j.Logger;
  5 +import org.springframework.stereotype.Service;
  6 +
  7 +import java.math.BigDecimal;
  8 +
  9 +/**
  10 + * 卖家服务(竞价提醒)
  11 + *
  12 + * 卖家出售(发布或变价) 出更低价格的推送或者短信
  13 + * Created by chao.chen on 2018/12/4.
  14 + */
  15 +@Service
  16 +public class SellerService {
  17 +
  18 + private final Logger logger = LoggerUtils.getSellerOrderLogger();
  19 +
  20 + /**更低出价提醒
  21 + * 1)当有新卖家出价成功或调价成功时,给所有正在出售该sku(尺码)的其他卖家推送一条消息(push+消息盒子)
  22 + *2)同一卖家的同一SKU 1小时内仅推送一条提醒(最先推送的那条)
  23 + *3)同一卖家的同一SKU一天最多接收8条消息提醒
  24 + * 需要考虑的是发布和变价是个不间断的操作,若高并发必影响调用者处理速度
  25 + * 还好,我已经把这个定义成非核心功能,可以异步实现
  26 + * @param whoReducePrice
  27 + * @param lowerSalePrice
  28 + * @param storageId
  29 + */
  30 + public void lowerPriceFired(Integer whoReducePrice, BigDecimal lowerSalePrice, Integer storageId){
  31 + logger.info("in lowerPriceFired, uid whoReducePrice {} lowerSalePrice {} storageId {}",
  32 + whoReducePrice, lowerSalePrice, storageId);
  33 +
  34 + //TODO finish blow step
  35 + // step 1: 找到所有出售中 & 指定storageId的skup &不是whoReducePrice这个uid & 价格高于lowerSalePrice(seller_order_goods表)集合 --> one sq1
  36 + // step 2:消息或短信 给所有的用户(多么贴心,也许以后可以干掉毒,然后收费^v^)
  37 + // step 2.1 超过多少数量 使用多线程并行处理(实际上是对用户分组)
  38 + // step 2.2 根据消息发送规则 对单个用户发送的消息数量做限制
  39 + //使用redis的过期时间做倒计时,一小时 key(单个用户:场景:告知方式:时间标记:) uid:{}:storageId:{}case:{}:method:{}:dtp{}:num
  40 + //dtp 为时间标记 小时:yyyyMMddHH,天:yyyyMMdd
  41 + //倒计时 需要考虑跨天,计算当前日期的最后一秒
  42 +
  43 + }
  44 +}
@@ -126,6 +126,7 @@ @@ -126,6 +126,7 @@
126 <module>web</module> 126 <module>web</module>
127 <module>deploy</module> 127 <module>deploy</module>
128 <module>inbox</module> 128 <module>inbox</module>
  129 + <module>msg-center</module>
129 </modules> 130 </modules>
130 131
131 132