Authored by zhaoyue

add qrcode related code

git pull
git add --all src/*
git add --all src/main/java/*
git add push.sh
git add pom.xml
git commit -m "add qrcode related code"
... ...
... ... @@ -34,6 +34,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
... ... @@ -53,6 +54,7 @@ public class QRCodeController {
@Autowired
private XklMemberRespository xklMemberRespository;
private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");//小写的mm表示的是分钟
@LogAnnotation
@AntiXSS
... ... @@ -71,6 +73,7 @@ public class QRCodeController {
return new ResponseEntity<>(ResultModel.ok(qrModel), HttpStatus.OK);
}
}
@LogAnnotation
@AntiXSS
@Sign
... ... @@ -128,15 +131,19 @@ public class QRCodeController {
return new ResponseEntity<>(ResultModel.error(ResultStatus.USER_NOT_FOUND), HttpStatus.OK);
}
XklMemberEntity xklMemberEntity = xklMemberRespository.findOne((long) user.getMemberId());
int age = DatetimeTools.getAge(xklMemberEntity.getBirthDate(), new Date());
Date birthDate = new Date();
try {
birthDate = sdf.parse(xklMemberEntity.getBirthDate());
} catch (Exception e) {
e.printStackTrace();
}
int age = DatetimeTools.getAge(birthDate, new Date());
UsrInfoModel usrInfo = new UsrInfoModel(user.getLoginAccount(), xklMemberEntity.getName(),
xklMemberEntity.getIdcard(), xklMemberEntity.getPhone(), xklMemberEntity.getSex(), age, qrcode, genWebloginUrl(qrcode));
xklMemberEntity.getIdcard(), xklMemberEntity.getPhone(), xklMemberEntity.isSex() ? 1 : 0, age, qrcode, genWebloginUrl(qrcode));
return new ResponseEntity<>(ResultModel.ok(usrInfo), HttpStatus.OK);
}
private static String genWebloginUrl(String qrcode) {
return Constants.WEB_LOGIN_URL + qrcode.trim();
}
}
... ...
... ... @@ -34,4 +34,51 @@ public class User {
@Column(name = "member_id")
private long memberId;
public String getLoginAccount() {
return loginAccount;
}
public void setLoginAccount(String loginAccount) {
this.loginAccount = loginAccount;
}
public String getLoginPwd() {
return loginPwd;
}
public void setLoginPwd(String loginPwd) {
this.loginPwd = loginPwd;
}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getSalt() {
return salt;
}
public void setSalt(String salt) {
this.salt = salt;
}
public boolean isStatus() {
return status;
}
public void setStatus(boolean status) {
this.status = status;
}
public long getMemberId() {
return memberId;
}
public void setMemberId(long memberId) {
this.memberId = memberId;
}
}
... ...
... ... @@ -44,4 +44,92 @@ public class XklCompanyEntity {
@Basic
@Column(name = "status")
private int status;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public long getParentId() {
return parentId;
}
public void setParentId(long parentId) {
this.parentId = parentId;
}
public long getProvinceId() {
return provinceId;
}
public void setProvinceId(long provinceId) {
this.provinceId = provinceId;
}
public long getCityId() {
return cityId;
}
public void setCityId(long cityId) {
this.cityId = cityId;
}
public long getCountryId() {
return countryId;
}
public void setCountryId(long countryId) {
this.countryId = countryId;
}
public long getCompanyCode() {
return companyCode;
}
public void setCompanyCode(long companyCode) {
this.companyCode = companyCode;
}
public int getCompanyType() {
return companyType;
}
public void setCompanyType(int companyType) {
this.companyType = companyType;
}
public int getLevel() {
return level;
}
public void setLevel(int level) {
this.level = level;
}
public int getShowLevel() {
return showLevel;
}
public void setShowLevel(int showLevel) {
this.showLevel = showLevel;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
}
... ...
... ... @@ -55,4 +55,107 @@ public class XklMemberEntity {
@Column(name = "status")
private int status;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public boolean isSex() {
return sex;
}
public void setSex(boolean sex) {
this.sex = sex;
}
public String getBirthDate() {
return birthDate;
}
public void setBirthDate(String birthDate) {
this.birthDate = birthDate;
}
public String getIdcard() {
return idcard;
}
public void setIdcard(String idcard) {
this.idcard = idcard;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getRegisterTime() {
return registerTime;
}
public void setRegisterTime(String registerTime) {
this.registerTime = registerTime;
}
public long getCompanyId() {
return companyId;
}
public void setCompanyId(long companyId) {
this.companyId = companyId;
}
public long getProvince() {
return province;
}
public void setProvince(long province) {
this.province = province;
}
public long getCity() {
return city;
}
public void setCity(long city) {
this.city = city;
}
public long getCountry() {
return country;
}
public void setCountry(long country) {
this.country = country;
}
public long getRegisterBy() {
return registerBy;
}
public void setRegisterBy(long registerBy) {
this.registerBy = registerBy;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
}
... ...
package com.xkl.model;
import lombok.AllArgsConstructor;
import lombok.Data;
/**
... ... @@ -13,4 +12,44 @@ public class CityModel {
long city = 0;//市(直辖市的区)
long county = 0;//县
int type = 0;
}
public long getCountry() {
return country;
}
public void setCountry(long country) {
this.country = country;
}
public long getProvince() {
return province;
}
public void setProvince(long province) {
this.province = province;
}
public long getCity() {
return city;
}
public void setCity(long city) {
this.city = city;
}
public long getCounty() {
return county;
}
public void setCounty(long county) {
this.county = county;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
}
\ No newline at end of file
... ...