Authored by tanling

邀请

@@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
14 <result column="show_invite_code" property="showInviteCoe" jdbcType="VARCHAR" /> 14 <result column="show_invite_code" property="showInviteCoe" jdbcType="VARCHAR" />
15 </resultMap> 15 </resultMap>
16 <sql id="Base_Column_List" > 16 <sql id="Base_Column_List" >
17 - id, uid, order_code, payment, status, amount, type, create_time, update_time 17 + id, uid, order_code, payment, status, amount, type, create_time, update_time, show_invite_code
18 </sql> 18 </sql>
19 <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" > 19 <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
20 select 20 select
1 package com.yohoufo.order.common; 1 package com.yohoufo.order.common;
2 2
  3 +import org.apache.commons.lang3.StringUtils;
  4 +
3 public enum InviterType { 5 public enum InviterType {
4 STORED_SELLER(1, "UFO", "入驻商家"), 6 STORED_SELLER(1, "UFO", "入驻商家"),
5 CLASS_B_AGENT(2, "NB", "一级代理"); 7 CLASS_B_AGENT(2, "NB", "一级代理");
@@ -10,6 +12,13 @@ public enum InviterType { @@ -10,6 +12,13 @@ public enum InviterType {
10 12
11 private String name; 13 private String name;
12 14
  15 + // 邀请码数字部分
  16 + private String value;
  17 +
  18 + public void setValue(String value) {
  19 + this.value = value;
  20 + }
  21 +
13 public int getType() { 22 public int getType() {
14 return type; 23 return type;
15 } 24 }
@@ -36,7 +45,7 @@ public enum InviterType { @@ -36,7 +45,7 @@ public enum InviterType {
36 public static InviterType getInviteType(String inputInviteCode){ 45 public static InviterType getInviteType(String inputInviteCode){
37 InviterType inviterType = null; 46 InviterType inviterType = null;
38 for (InviterType item : values()){ 47 for (InviterType item : values()){
39 - if (inputInviteCode.startsWith(item.getAlphabet())){ 48 + if (StringUtils.startsWithIgnoreCase(inputInviteCode, item.getAlphabet())){
40 inviterType = item; 49 inviterType = item;
41 break; 50 break;
42 } 51 }
@@ -46,8 +55,9 @@ public enum InviterType { @@ -46,8 +55,9 @@ public enum InviterType {
46 return null; 55 return null;
47 } 56 }
48 57
49 - String digit = inputInviteCode.replaceFirst(inviterType.getAlphabet(),""); 58 + String digit = StringUtils.removeStartIgnoreCase(inputInviteCode, inviterType.getAlphabet());
50 if (digit.matches("\\d+")){ 59 if (digit.matches("\\d+")){
  60 + inviterType.setValue(digit);
51 return inviterType; 61 return inviterType;
52 } 62 }
53 63
@@ -37,7 +37,7 @@ import java.util.stream.Collectors; @@ -37,7 +37,7 @@ import java.util.stream.Collectors;
37 @Service 37 @Service
38 public class InviteServiceImpl implements IInviteService { 38 public class InviteServiceImpl implements IInviteService {
39 39
40 - private static final Logger LOGGER = LoggerFactory.getLogger(AppraiseService.class); 40 + private static final Logger LOGGER = LoggerFactory.getLogger(InviteServiceImpl.class);
41 41
42 @Autowired 42 @Autowired
43 IStoredSellerService storedSellerService; 43 IStoredSellerService storedSellerService;