Authored by zhaoyue

add qrcode related code

1 git pull 1 git pull
2 -git add --all src/* 2 +git add --all src/main/java/*
3 git add push.sh 3 git add push.sh
4 git add pom.xml 4 git add pom.xml
5 git commit -m "add qrcode related code" 5 git commit -m "add qrcode related code"
@@ -34,6 +34,7 @@ import org.springframework.web.bind.annotation.RequestParam; @@ -34,6 +34,7 @@ import org.springframework.web.bind.annotation.RequestParam;
34 import org.springframework.web.bind.annotation.RestController; 34 import org.springframework.web.bind.annotation.RestController;
35 35
36 import javax.servlet.http.HttpServletRequest; 36 import javax.servlet.http.HttpServletRequest;
  37 +import java.text.SimpleDateFormat;
37 import java.util.Date; 38 import java.util.Date;
38 39
39 /** 40 /**
@@ -53,6 +54,7 @@ public class QRCodeController { @@ -53,6 +54,7 @@ public class QRCodeController {
53 @Autowired 54 @Autowired
54 private XklMemberRespository xklMemberRespository; 55 private XklMemberRespository xklMemberRespository;
55 56
  57 + private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");//小写的mm表示的是分钟
56 58
57 @LogAnnotation 59 @LogAnnotation
58 @AntiXSS 60 @AntiXSS
@@ -71,6 +73,7 @@ public class QRCodeController { @@ -71,6 +73,7 @@ public class QRCodeController {
71 return new ResponseEntity<>(ResultModel.ok(qrModel), HttpStatus.OK); 73 return new ResponseEntity<>(ResultModel.ok(qrModel), HttpStatus.OK);
72 } 74 }
73 } 75 }
  76 +
74 @LogAnnotation 77 @LogAnnotation
75 @AntiXSS 78 @AntiXSS
76 @Sign 79 @Sign
@@ -128,15 +131,19 @@ public class QRCodeController { @@ -128,15 +131,19 @@ public class QRCodeController {
128 return new ResponseEntity<>(ResultModel.error(ResultStatus.USER_NOT_FOUND), HttpStatus.OK); 131 return new ResponseEntity<>(ResultModel.error(ResultStatus.USER_NOT_FOUND), HttpStatus.OK);
129 } 132 }
130 XklMemberEntity xklMemberEntity = xklMemberRespository.findOne((long) user.getMemberId()); 133 XklMemberEntity xklMemberEntity = xklMemberRespository.findOne((long) user.getMemberId());
131 - int age = DatetimeTools.getAge(xklMemberEntity.getBirthDate(), new Date()); 134 + Date birthDate = new Date();
  135 + try {
  136 + birthDate = sdf.parse(xklMemberEntity.getBirthDate());
  137 + } catch (Exception e) {
  138 + e.printStackTrace();
  139 + }
  140 + int age = DatetimeTools.getAge(birthDate, new Date());
132 UsrInfoModel usrInfo = new UsrInfoModel(user.getLoginAccount(), xklMemberEntity.getName(), 141 UsrInfoModel usrInfo = new UsrInfoModel(user.getLoginAccount(), xklMemberEntity.getName(),
133 - xklMemberEntity.getIdcard(), xklMemberEntity.getPhone(), xklMemberEntity.getSex(), age, qrcode, genWebloginUrl(qrcode)); 142 + xklMemberEntity.getIdcard(), xklMemberEntity.getPhone(), xklMemberEntity.isSex() ? 1 : 0, age, qrcode, genWebloginUrl(qrcode));
134 return new ResponseEntity<>(ResultModel.ok(usrInfo), HttpStatus.OK); 143 return new ResponseEntity<>(ResultModel.ok(usrInfo), HttpStatus.OK);
135 } 144 }
136 145
137 private static String genWebloginUrl(String qrcode) { 146 private static String genWebloginUrl(String qrcode) {
138 return Constants.WEB_LOGIN_URL + qrcode.trim(); 147 return Constants.WEB_LOGIN_URL + qrcode.trim();
139 } 148 }
140 -  
141 -  
142 } 149 }
@@ -34,4 +34,51 @@ public class User { @@ -34,4 +34,51 @@ public class User {
34 @Column(name = "member_id") 34 @Column(name = "member_id")
35 private long memberId; 35 private long memberId;
36 36
  37 + public String getLoginAccount() {
  38 + return loginAccount;
  39 + }
  40 +
  41 + public void setLoginAccount(String loginAccount) {
  42 + this.loginAccount = loginAccount;
  43 + }
  44 +
  45 + public String getLoginPwd() {
  46 + return loginPwd;
  47 + }
  48 +
  49 + public void setLoginPwd(String loginPwd) {
  50 + this.loginPwd = loginPwd;
  51 + }
  52 +
  53 + public long getId() {
  54 + return id;
  55 + }
  56 +
  57 + public void setId(long id) {
  58 + this.id = id;
  59 + }
  60 +
  61 + public String getSalt() {
  62 + return salt;
  63 + }
  64 +
  65 + public void setSalt(String salt) {
  66 + this.salt = salt;
  67 + }
  68 +
  69 + public boolean isStatus() {
  70 + return status;
  71 + }
  72 +
  73 + public void setStatus(boolean status) {
  74 + this.status = status;
  75 + }
  76 +
  77 + public long getMemberId() {
  78 + return memberId;
  79 + }
  80 +
  81 + public void setMemberId(long memberId) {
  82 + this.memberId = memberId;
  83 + }
37 } 84 }
@@ -44,4 +44,92 @@ public class XklCompanyEntity { @@ -44,4 +44,92 @@ public class XklCompanyEntity {
44 @Basic 44 @Basic
45 @Column(name = "status") 45 @Column(name = "status")
46 private int status; 46 private int status;
  47 +
  48 + public long getId() {
  49 + return id;
  50 + }
  51 +
  52 + public void setId(long id) {
  53 + this.id = id;
  54 + }
  55 +
  56 + public String getName() {
  57 + return name;
  58 + }
  59 +
  60 + public void setName(String name) {
  61 + this.name = name;
  62 + }
  63 +
  64 + public long getParentId() {
  65 + return parentId;
  66 + }
  67 +
  68 + public void setParentId(long parentId) {
  69 + this.parentId = parentId;
  70 + }
  71 +
  72 + public long getProvinceId() {
  73 + return provinceId;
  74 + }
  75 +
  76 + public void setProvinceId(long provinceId) {
  77 + this.provinceId = provinceId;
  78 + }
  79 +
  80 + public long getCityId() {
  81 + return cityId;
  82 + }
  83 +
  84 + public void setCityId(long cityId) {
  85 + this.cityId = cityId;
  86 + }
  87 +
  88 + public long getCountryId() {
  89 + return countryId;
  90 + }
  91 +
  92 + public void setCountryId(long countryId) {
  93 + this.countryId = countryId;
  94 + }
  95 +
  96 + public long getCompanyCode() {
  97 + return companyCode;
  98 + }
  99 +
  100 + public void setCompanyCode(long companyCode) {
  101 + this.companyCode = companyCode;
  102 + }
  103 +
  104 + public int getCompanyType() {
  105 + return companyType;
  106 + }
  107 +
  108 + public void setCompanyType(int companyType) {
  109 + this.companyType = companyType;
  110 + }
  111 +
  112 + public int getLevel() {
  113 + return level;
  114 + }
  115 +
  116 + public void setLevel(int level) {
  117 + this.level = level;
  118 + }
  119 +
  120 + public int getShowLevel() {
  121 + return showLevel;
  122 + }
  123 +
  124 + public void setShowLevel(int showLevel) {
  125 + this.showLevel = showLevel;
  126 + }
  127 +
  128 + public int getStatus() {
  129 + return status;
  130 + }
  131 +
  132 + public void setStatus(int status) {
  133 + this.status = status;
  134 + }
47 } 135 }
@@ -55,4 +55,107 @@ public class XklMemberEntity { @@ -55,4 +55,107 @@ public class XklMemberEntity {
55 @Column(name = "status") 55 @Column(name = "status")
56 private int status; 56 private int status;
57 57
  58 + public long getId() {
  59 + return id;
  60 + }
  61 +
  62 + public void setId(long id) {
  63 + this.id = id;
  64 + }
  65 +
  66 + public String getName() {
  67 + return name;
  68 + }
  69 +
  70 + public void setName(String name) {
  71 + this.name = name;
  72 + }
  73 +
  74 + public boolean isSex() {
  75 + return sex;
  76 + }
  77 +
  78 + public void setSex(boolean sex) {
  79 + this.sex = sex;
  80 + }
  81 +
  82 + public String getBirthDate() {
  83 + return birthDate;
  84 + }
  85 +
  86 + public void setBirthDate(String birthDate) {
  87 + this.birthDate = birthDate;
  88 + }
  89 +
  90 + public String getIdcard() {
  91 + return idcard;
  92 + }
  93 +
  94 + public void setIdcard(String idcard) {
  95 + this.idcard = idcard;
  96 + }
  97 +
  98 + public String getPhone() {
  99 + return phone;
  100 + }
  101 +
  102 + public void setPhone(String phone) {
  103 + this.phone = phone;
  104 + }
  105 +
  106 + public String getRegisterTime() {
  107 + return registerTime;
  108 + }
  109 +
  110 + public void setRegisterTime(String registerTime) {
  111 + this.registerTime = registerTime;
  112 + }
  113 +
  114 + public long getCompanyId() {
  115 + return companyId;
  116 + }
  117 +
  118 + public void setCompanyId(long companyId) {
  119 + this.companyId = companyId;
  120 + }
  121 +
  122 + public long getProvince() {
  123 + return province;
  124 + }
  125 +
  126 + public void setProvince(long province) {
  127 + this.province = province;
  128 + }
  129 +
  130 + public long getCity() {
  131 + return city;
  132 + }
  133 +
  134 + public void setCity(long city) {
  135 + this.city = city;
  136 + }
  137 +
  138 + public long getCountry() {
  139 + return country;
  140 + }
  141 +
  142 + public void setCountry(long country) {
  143 + this.country = country;
  144 + }
  145 +
  146 + public long getRegisterBy() {
  147 + return registerBy;
  148 + }
  149 +
  150 + public void setRegisterBy(long registerBy) {
  151 + this.registerBy = registerBy;
  152 + }
  153 +
  154 + public int getStatus() {
  155 + return status;
  156 + }
  157 +
  158 + public void setStatus(int status) {
  159 + this.status = status;
  160 + }
58 } 161 }
1 package com.xkl.model; 1 package com.xkl.model;
2 2
3 -import lombok.AllArgsConstructor;  
4 import lombok.Data; 3 import lombok.Data;
5 4
6 /** 5 /**
@@ -13,4 +12,44 @@ public class CityModel { @@ -13,4 +12,44 @@ public class CityModel {
13 long city = 0;//市(直辖市的区) 12 long city = 0;//市(直辖市的区)
14 long county = 0;//县 13 long county = 0;//县
15 int type = 0; 14 int type = 0;
16 -} 15 +
  16 + public long getCountry() {
  17 + return country;
  18 + }
  19 +
  20 + public void setCountry(long country) {
  21 + this.country = country;
  22 + }
  23 +
  24 + public long getProvince() {
  25 + return province;
  26 + }
  27 +
  28 + public void setProvince(long province) {
  29 + this.province = province;
  30 + }
  31 +
  32 + public long getCity() {
  33 + return city;
  34 + }
  35 +
  36 + public void setCity(long city) {
  37 + this.city = city;
  38 + }
  39 +
  40 + public long getCounty() {
  41 + return county;
  42 + }
  43 +
  44 + public void setCounty(long county) {
  45 + this.county = county;
  46 + }
  47 +
  48 + public int getType() {
  49 + return type;
  50 + }
  51 +
  52 + public void setType(int type) {
  53 + this.type = type;
  54 + }
  55 +}