Commit 3399be45 authored by xiaoguang.xu's avatar xiaoguang.xu

非关键代码,使用 baseEntity 生成createdAt&updatedAt

parent 88f90166
...@@ -519,9 +519,6 @@ public class InnerController implements IBaseController { ...@@ -519,9 +519,6 @@ public class InnerController implements IBaseController {
Address addressObj = addressService.findByUserId(userId); Address addressObj = addressService.findByUserId(userId);
if (addressObj == null) { if (addressObj == null) {
addressObj = new Address(); addressObj = new Address();
Timestamp now = new Timestamp(System.currentTimeMillis());
addressObj.setCreatedAt(now);
addressObj.setUpdateAt(now);
} }
addressObj.setUserId(userId); addressObj.setUserId(userId);
addressObj.setProvince(province); addressObj.setProvince(province);
...@@ -546,13 +543,10 @@ public class InnerController implements IBaseController { ...@@ -546,13 +543,10 @@ public class InnerController implements IBaseController {
return JsonResult.buildErrorStateResult("用户ID不能为空", null); return JsonResult.buildErrorStateResult("用户ID不能为空", null);
} }
UserExtInfo info = userExtInfoService.findByUserId(userId); UserExtInfo info = userExtInfoService.findByUserId(userId);
Timestamp now = new Timestamp(System.currentTimeMillis());
if (info == null) { if (info == null) {
info = new UserExtInfo(); info = new UserExtInfo();
info.setUserId(userId); info.setUserId(userId);
info.setCreatedAt(now);
} }
info.setUpdateAt(now);
if (incomeEnum != null) { if (incomeEnum != null) {
info.setIncomeEnum(cn.quantgroup.user.enums.IncomeEnum.valueOf(incomeEnum.name())); info.setIncomeEnum(cn.quantgroup.user.enums.IncomeEnum.valueOf(incomeEnum.name()));
} }
...@@ -946,12 +940,10 @@ public class InnerController implements IBaseController { ...@@ -946,12 +940,10 @@ public class InnerController implements IBaseController {
Timestamp timestamp = new Timestamp(System.currentTimeMillis()); Timestamp timestamp = new Timestamp(System.currentTimeMillis());
if (userSpouse == null) { if (userSpouse == null) {
userSpouse = new UserSpouse(userId); userSpouse = new UserSpouse(userId);
userSpouse.setCreatedAt(timestamp);
} }
userSpouse.setSpouseName(status == MaritalStatus.MARRIED ? spouseName : ""); userSpouse.setSpouseName(status == MaritalStatus.MARRIED ? spouseName : "");
userSpouse.setSpousePhone(status == MaritalStatus.MARRIED ? spousePhone : ""); userSpouse.setSpousePhone(status == MaritalStatus.MARRIED ? spousePhone : "");
userSpouse.setStatus(cn.quantgroup.user.enums.MaritalStatus.valueOf(status.name())); userSpouse.setStatus(cn.quantgroup.user.enums.MaritalStatus.valueOf(status.name()));
userSpouse.setUpdateAt(timestamp);
userSpouse = userSpouseService.save(userSpouse); userSpouse = userSpouseService.save(userSpouse);
return JsonResult.buildSuccessResult(null, UserSpouseRet.getUserSpouseRet(userSpouse)); return JsonResult.buildSuccessResult(null, UserSpouseRet.getUserSpouseRet(userSpouse));
} }
......
...@@ -253,10 +253,8 @@ public class UserCenterController { ...@@ -253,10 +253,8 @@ public class UserCenterController {
} }
//查询用户是否有保存地址信息 //查询用户是否有保存地址信息
Address addressInfo = addressService.findByUserId(userId); Address addressInfo = addressService.findByUserId(userId);
Timestamp now = new Timestamp(System.currentTimeMillis());
if (null == addressInfo) { if (null == addressInfo) {
addressInfo = new Address(); addressInfo = new Address();
addressInfo.setCreatedAt(now);
} }
addressInfo.setUserId(userId); addressInfo.setUserId(userId);
addressInfo.setProvince(province); addressInfo.setProvince(province);
...@@ -266,7 +264,6 @@ public class UserCenterController { ...@@ -266,7 +264,6 @@ public class UserCenterController {
addressInfo.setDistrictCode(districtCode); addressInfo.setDistrictCode(districtCode);
addressInfo.setDistrict(district); addressInfo.setDistrict(district);
addressInfo.setAddress(address); addressInfo.setAddress(address);
addressInfo.setUpdateAt(now);
addressService.save(addressInfo); addressService.save(addressInfo);
return JsonResult.buildSuccessResult(null, addressInfo); return JsonResult.buildSuccessResult(null, addressInfo);
} }
...@@ -336,13 +333,10 @@ public class UserCenterController { ...@@ -336,13 +333,10 @@ public class UserCenterController {
} }
//查询用户是否保存过. //查询用户是否保存过.
UserExtInfo userExtInfo = userExtInfoService.findByUserId(userId); UserExtInfo userExtInfo = userExtInfoService.findByUserId(userId);
Timestamp now = new Timestamp(System.currentTimeMillis());
if (null == userExtInfo) { if (null == userExtInfo) {
userExtInfo = new UserExtInfo(); userExtInfo = new UserExtInfo();
userExtInfo.setUserId(userId); userExtInfo.setUserId(userId);
} }
userExtInfo.setCreatedAt(now);
userExtInfo.setUpdateAt(now);
userExtInfo.setEducationEnum(educationEnum); userExtInfo.setEducationEnum(educationEnum);
userExtInfo.setMarryStatus(maritalStatus); userExtInfo.setMarryStatus(maritalStatus);
userExtInfo.setOccupationEnum(occupationEnum); userExtInfo.setOccupationEnum(occupationEnum);
......
...@@ -65,9 +65,6 @@ public class Step1Req implements Serializable { ...@@ -65,9 +65,6 @@ public class Step1Req implements Serializable {
public static ModifyPhoneNo adapt(Step1Req step1Req) { public static ModifyPhoneNo adapt(Step1Req step1Req) {
ModifyPhoneNo modifyPhoneNo = new ModifyPhoneNo(); ModifyPhoneNo modifyPhoneNo = new ModifyPhoneNo();
BeanUtils.copyProperties(step1Req, modifyPhoneNo); BeanUtils.copyProperties(step1Req, modifyPhoneNo);
Date date = new Date();
modifyPhoneNo.setCreatedAt(date);
modifyPhoneNo.setUpdatedAt(date);
return modifyPhoneNo ; return modifyPhoneNo ;
} }
} }
...@@ -13,14 +13,10 @@ import java.sql.Timestamp; ...@@ -13,14 +13,10 @@ import java.sql.Timestamp;
@Data @Data
@Entity @Entity
@Table(name = "address", uniqueConstraints = @UniqueConstraint(columnNames = "user_id")) @Table(name = "address", uniqueConstraints = @UniqueConstraint(columnNames = "user_id"))
public class Address implements Serializable { public class Address extends BaseEntity implements Serializable {
private static final long serialVersionUID = -1L; private static final long serialVersionUID = -1L;
@Id
@Column(name = "id")
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "user_id") @Column(name = "user_id")
private Long userId; private Long userId;
@Column(name = "province_code") @Column(name = "province_code")
...@@ -37,15 +33,7 @@ public class Address implements Serializable { ...@@ -37,15 +33,7 @@ public class Address implements Serializable {
private String district; private String district;
@Column(name = "address") @Column(name = "address")
private String address; private String address;
@Column(name = "created_at")
private Timestamp createdAt;
@Column(name = "updated_at")
private Timestamp updateAt;
@PreUpdate
public void preUpdate() {
this.updateAt = new Timestamp(System.currentTimeMillis());
}
public String toString() { public String toString() {
return province + "(省)" + city + "(市)" + district + "(区/县)" + address; return province + "(省)" + city + "(市)" + district + "(区/县)" + address;
......
package cn.quantgroup.xyqb.entity;
import lombok.Data;
import javax.persistence.*;
import java.io.Serializable;
import java.sql.Timestamp;
/**
* 所有数据库实体,都要继承 BaseEntity
* 1. 统一的 ID 设计。
* 2. 统一的创建和更新时间。
*/
@MappedSuperclass
@Data
public abstract class BaseEntity implements Serializable {
private static final long serialVersionUID = -1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Basic(optional = false)
private Long id;
@Column(name = "created_at")
private Timestamp createdAt;
@Column(name = "updated_at")
private Timestamp updatedAt;
@PrePersist
public void prePersist() {
Timestamp now = new Timestamp(System.currentTimeMillis());
this.createdAt = now;
this.updatedAt = now;
}
@PreUpdate
public void preUpdate() {
this.updatedAt = new Timestamp(System.currentTimeMillis());
}
}
...@@ -16,15 +16,9 @@ import java.util.Date; ...@@ -16,15 +16,9 @@ import java.util.Date;
@Data @Data
@Entity @Entity
@Table(name = "user_modify_phone_no") @Table(name = "user_modify_phone_no")
public class ModifyPhoneNo implements Serializable { public class ModifyPhoneNo extends BaseEntity implements Serializable {
private static final long serialVersionUID = -7797532159380593454L; private static final long serialVersionUID = -7797532159380593454L;
/**
* id
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
/** /**
* user.id * user.id
...@@ -90,18 +84,4 @@ public class ModifyPhoneNo implements Serializable { ...@@ -90,18 +84,4 @@ public class ModifyPhoneNo implements Serializable {
*/ */
@Column(name = "processing_status") @Column(name = "processing_status")
private Integer processingStatus; private Integer processingStatus;
/**
*
*/
@Column(name = "created_at")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createdAt;
/**
*
*/
@Column(name = "updated_at")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date updatedAt;
} }
...@@ -12,19 +12,11 @@ import java.sql.Timestamp; ...@@ -12,19 +12,11 @@ import java.sql.Timestamp;
@Data @Data
@Entity @Entity
@Table(name = "user_attached") @Table(name = "user_attached")
public class UserAttached implements Serializable { public class UserAttached extends BaseEntity implements Serializable {
@Id
@Column(name = "id")
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "user_id") @Column(name = "user_id")
private Long userId; private Long userId;
@Column(name = "avatar") @Column(name = "avatar")
private String avatar; private String avatar;
@Column(name = "nick") @Column(name = "nick")
private String nick; private String nick;
@Column(name = "created_at")
private Timestamp createdAt;
@Column(name = "updated_at")
private Timestamp updatedAt;
} }
...@@ -14,13 +14,9 @@ import java.sql.Timestamp; ...@@ -14,13 +14,9 @@ import java.sql.Timestamp;
@Data @Data
@Entity @Entity
@Table(name = "user_ext_info") @Table(name = "user_ext_info")
public class UserExtInfo implements Serializable { public class UserExtInfo extends BaseEntity implements Serializable {
private static final long serialVersionUID = -1L; private static final long serialVersionUID = -1L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private Long id;
@Column(name = "user_id") @Column(name = "user_id")
private Long userId; private Long userId;
@Column(name = "means_of_income_payment") @Column(name = "means_of_income_payment")
...@@ -41,14 +37,10 @@ public class UserExtInfo implements Serializable { ...@@ -41,14 +37,10 @@ public class UserExtInfo implements Serializable {
private Boolean hasCreditCard = false; private Boolean hasCreditCard = false;
@Column(name = "marry_status") @Column(name = "marry_status")
private MaritalStatus marryStatus = MaritalStatus.UNKNOWN; private MaritalStatus marryStatus = MaritalStatus.UNKNOWN;
@Column(name = "created_at")
private Timestamp createdAt;
@Column(name = "updated_at")
private Timestamp updateAt;
public XUserExtInfo toXUserExtInfo() { public XUserExtInfo toXUserExtInfo() {
XUserExtInfo xUserExtInfo = new XUserExtInfo(); XUserExtInfo xUserExtInfo = new XUserExtInfo();
xUserExtInfo.setId(this.id); xUserExtInfo.setId(getId());
xUserExtInfo.setUserId(this.userId); xUserExtInfo.setUserId(this.userId);
xUserExtInfo.setEducationEnum(cn.quantgroup.motan.enums.EducationEnum.valueOf(this.educationEnum.name())); xUserExtInfo.setEducationEnum(cn.quantgroup.motan.enums.EducationEnum.valueOf(this.educationEnum.name()));
xUserExtInfo.setIncomeEnum(cn.quantgroup.motan.enums.IncomeEnum.valueOf(this.incomeEnum.name())); xUserExtInfo.setIncomeEnum(cn.quantgroup.motan.enums.IncomeEnum.valueOf(this.incomeEnum.name()));
...@@ -58,8 +50,8 @@ public class UserExtInfo implements Serializable { ...@@ -58,8 +50,8 @@ public class UserExtInfo implements Serializable {
xUserExtInfo.setHasSocialSecurity(this.hasSocialSecurity); xUserExtInfo.setHasSocialSecurity(this.hasSocialSecurity);
xUserExtInfo.setHasCreditCard(this.hasCreditCard); xUserExtInfo.setHasCreditCard(this.hasCreditCard);
xUserExtInfo.setMarryStatus(cn.quantgroup.motan.enums.MaritalStatus.valueOf(this.marryStatus.name())); xUserExtInfo.setMarryStatus(cn.quantgroup.motan.enums.MaritalStatus.valueOf(this.marryStatus.name()));
xUserExtInfo.setCreatedAt(this.createdAt); xUserExtInfo.setCreatedAt(getCreatedAt());
xUserExtInfo.setUpdateAt(this.updateAt); xUserExtInfo.setUpdateAt(getUpdatedAt());
return xUserExtInfo; return xUserExtInfo;
} }
} }
...@@ -12,18 +12,13 @@ import java.sql.Timestamp; ...@@ -12,18 +12,13 @@ import java.sql.Timestamp;
@Entity @Entity
@Table(name = "user_hash_mapping") @Table(name = "user_hash_mapping")
@NoArgsConstructor @NoArgsConstructor
public class UserHashMapping implements Serializable { public class UserHashMapping extends BaseEntity implements Serializable {
private static final long serialVersionUID = -1L; private static final long serialVersionUID = -1L;
public UserHashMapping(Long userId) { public UserHashMapping(Long userId) {
this.userId = userId; this.userId = userId;
} }
@Id
@Column(name = "id")
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "user_id") @Column(name = "user_id")
private Long userId; private Long userId;
...@@ -39,25 +34,6 @@ public class UserHashMapping implements Serializable { ...@@ -39,25 +34,6 @@ public class UserHashMapping implements Serializable {
@Column(name = "id_no_md5_short") @Column(name = "id_no_md5_short")
private Long idNoMd5Short; private Long idNoMd5Short;
@Column(name = "created_at")
private Timestamp createdAt;
@Column(name = "updated_at")
private Timestamp updatedAt;
@PrePersist
public void prePersist() {
Timestamp timestamp = new Timestamp(System.currentTimeMillis());
createdAt = timestamp;
updatedAt = timestamp;
}
@PreUpdate
public void preUpdate() {
updatedAt = new Timestamp(System.currentTimeMillis());
}
public void setPhoneNoMd5(String phoneNoMd5) { public void setPhoneNoMd5(String phoneNoMd5) {
this.phoneNoMd5 = phoneNoMd5; this.phoneNoMd5 = phoneNoMd5;
this.phoneNoMd5Short = HashUtil.crc32(phoneNoMd5); this.phoneNoMd5Short = HashUtil.crc32(phoneNoMd5);
......
...@@ -8,19 +8,12 @@ import java.sql.Timestamp; ...@@ -8,19 +8,12 @@ import java.sql.Timestamp;
@Data @Data
@Entity @Entity
@Table(name = "user_hash_phone_no_id_no_mapping") @Table(name = "user_hash_phone_no_id_no_mapping")
public class UserHashPhoneNoIdNoMapping { public class UserHashPhoneNoIdNoMapping extends BaseEntity {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "user_id") @Column(name = "user_id")
private Long userId; private Long userId;
@Column(name = "phone_no_id_no_md5") @Column(name = "phone_no_id_no_md5")
private String phoneNoIdNoMd5; private String phoneNoIdNoMd5;
@Column(name = "created_at")
private Timestamp createdAt;
@Column(name = "updated_at")
private Timestamp updatedAt;
public UserHashPhoneNoIdNoMapping() { public UserHashPhoneNoIdNoMapping() {
} }
...@@ -28,16 +21,4 @@ public class UserHashPhoneNoIdNoMapping { ...@@ -28,16 +21,4 @@ public class UserHashPhoneNoIdNoMapping {
public UserHashPhoneNoIdNoMapping(Long userId) { public UserHashPhoneNoIdNoMapping(Long userId) {
this.userId = userId; this.userId = userId;
} }
@PrePersist
public void prePersist() {
Timestamp timestamp = new Timestamp(System.currentTimeMillis());
createdAt = timestamp;
updatedAt = timestamp;
}
@PreUpdate
public void preUpdate() {
updatedAt = new Timestamp(System.currentTimeMillis());
}
} }
...@@ -17,15 +17,10 @@ import java.sql.Timestamp; ...@@ -17,15 +17,10 @@ import java.sql.Timestamp;
@Getter @Getter
@Setter @Setter
@ToString @ToString
public class UserJr58 implements Serializable { public class UserJr58 extends BaseEntity implements Serializable {
private static final long serialVersionUID = -1L; private static final long serialVersionUID = -1L;
@Id
@Column(name = "id")
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "user_id") @Column(name = "user_id")
private Long userId; private Long userId;
...@@ -68,12 +63,6 @@ public class UserJr58 implements Serializable { ...@@ -68,12 +63,6 @@ public class UserJr58 implements Serializable {
@Column(name = "app_id") @Column(name = "app_id")
private String appId; private String appId;
@Column(name = "created_at")
private Timestamp createdAt;
@Column(name = "updated_at")
private Timestamp updatedAt;
@Column(name = "edu") @Column(name = "edu")
private String edu; private String edu;
@Column(name = "income") @Column(name = "income")
......
...@@ -16,13 +16,9 @@ import java.sql.Timestamp; ...@@ -16,13 +16,9 @@ import java.sql.Timestamp;
@Setter @Setter
@ToString @ToString
@NoArgsConstructor @NoArgsConstructor
public class UserSpouse implements Serializable { public class UserSpouse extends BaseEntity implements Serializable {
private static final long serialVersionUID = -1L; private static final long serialVersionUID = -1L;
@Id
@Column(name = "id")
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "user_id") @Column(name = "user_id")
private Long userId; private Long userId;
...@@ -33,12 +29,6 @@ public class UserSpouse implements Serializable { ...@@ -33,12 +29,6 @@ public class UserSpouse implements Serializable {
@Column(name = "spouse_name") @Column(name = "spouse_name")
private String spouseName; private String spouseName;
@Column(name = "created_at")
private Timestamp createdAt;
@Column(name = "updated_at")
private Timestamp updateAt;
@Column(name = "status") @Column(name = "status")
private MaritalStatus status; private MaritalStatus status;
......
...@@ -15,13 +15,9 @@ import java.sql.Timestamp; ...@@ -15,13 +15,9 @@ import java.sql.Timestamp;
@Entity @Entity
@Table(name = "wechat_userinfo") @Table(name = "wechat_userinfo")
@Data @Data
public class WechatUserInfo implements Serializable { public class WechatUserInfo extends BaseEntity implements Serializable {
private static final long serialVersionUID = -1L; private static final long serialVersionUID = -1L;
@Id
@Column(name = "id")
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(name = "user_id") @Column(name = "user_id")
private Long userId; private Long userId;
@Column(name = "open_id") @Column(name = "open_id")
...@@ -42,10 +38,6 @@ public class WechatUserInfo implements Serializable { ...@@ -42,10 +38,6 @@ public class WechatUserInfo implements Serializable {
private String country; private String country;
@Column(name = "head_img_url") @Column(name = "head_img_url")
private String headImgUrl; private String headImgUrl;
@Column(name = "created_at")
private Timestamp createdAt = new Timestamp(System.currentTimeMillis());
@Column(name = "updated_at")
private Timestamp updatedAt = new Timestamp(System.currentTimeMillis());
public WechatUserInfo convertEmoji() { public WechatUserInfo convertEmoji() {
......
...@@ -30,9 +30,6 @@ public class AddressRegisteredEventListener implements ApplicationListener<Regis ...@@ -30,9 +30,6 @@ public class AddressRegisteredEventListener implements ApplicationListener<Regis
} }
User user = userRegisterParam.getUser(); User user = userRegisterParam.getUser();
address.setUserId(user.getId()); address.setUserId(user.getId());
Timestamp currentTime = new Timestamp(System.currentTimeMillis());
address.setCreatedAt(currentTime);
address.setUpdateAt(currentTime);
addressRepository.save(address); addressRepository.save(address);
} }
} }
...@@ -37,7 +37,7 @@ public class AddressRet { ...@@ -37,7 +37,7 @@ public class AddressRet {
ret.setCity(address.getCity()); ret.setCity(address.getCity());
ret.setAddress(address.getAddress()); ret.setAddress(address.getAddress());
ret.setCreatedAt(address.getCreatedAt().getTime()); ret.setCreatedAt(address.getCreatedAt().getTime());
ret.setUpdateAt(address.getUpdateAt().getTime()); ret.setUpdateAt(address.getUpdatedAt().getTime());
return ret; return ret;
} }
} }
...@@ -46,7 +46,7 @@ public class UserExtInfoRet { ...@@ -46,7 +46,7 @@ public class UserExtInfoRet {
ret.setHasCreditCard(defaultBoolean(extInfo.getHasCreditCard())); ret.setHasCreditCard(defaultBoolean(extInfo.getHasCreditCard()));
ret.setMarryStatus(extInfo.getMarryStatus()); ret.setMarryStatus(extInfo.getMarryStatus());
ret.setCreatedAt(extInfo.getCreatedAt().getTime()); ret.setCreatedAt(extInfo.getCreatedAt().getTime());
ret.setUpdateAt(extInfo.getUpdateAt().getTime()); ret.setUpdateAt(extInfo.getUpdatedAt().getTime());
return ret; return ret;
} }
} }
...@@ -30,8 +30,8 @@ public class UserSpouseRet { ...@@ -30,8 +30,8 @@ public class UserSpouseRet {
ret.setUserId(userSpouse.getUserId()); ret.setUserId(userSpouse.getUserId());
ret.setSpouseName(userSpouse.getSpouseName()); ret.setSpouseName(userSpouse.getSpouseName());
ret.setSpousePhone(userSpouse.getSpousePhone()); ret.setSpousePhone(userSpouse.getSpousePhone());
if (userSpouse.getUpdateAt() != null) { if (userSpouse.getUpdatedAt() != null) {
ret.setUpdateAt(userSpouse.getUpdateAt().getTime()); ret.setUpdateAt(userSpouse.getUpdatedAt().getTime());
} }
if (userSpouse.getCreatedAt() != null) { if (userSpouse.getCreatedAt() != null) {
ret.setCreatedAt(userSpouse.getCreatedAt().getTime()); ret.setCreatedAt(userSpouse.getCreatedAt().getTime());
......
...@@ -191,7 +191,6 @@ public class ModifyPhoneNoServiceImpl implements IModifyPhoneNoService { ...@@ -191,7 +191,6 @@ public class ModifyPhoneNoServiceImpl implements IModifyPhoneNoService {
throw new DataException("数据不存在。"); throw new DataException("数据不存在。");
} }
modifyPhoneNo.setProcessingStatus(ModifyPhoneNoProcessingStatusEnum.DONE.ordinal()); modifyPhoneNo.setProcessingStatus(ModifyPhoneNoProcessingStatusEnum.DONE.ordinal());
modifyPhoneNo.setUpdatedAt(new Date());
} }
@Override @Override
...@@ -205,7 +204,6 @@ public class ModifyPhoneNoServiceImpl implements IModifyPhoneNoService { ...@@ -205,7 +204,6 @@ public class ModifyPhoneNoServiceImpl implements IModifyPhoneNoService {
modifyPhoneNo.setApplyStatus(ModifyPhoneNoApplyStatusEnum.NO_ALLOW.ordinal()); modifyPhoneNo.setApplyStatus(ModifyPhoneNoApplyStatusEnum.NO_ALLOW.ordinal());
modifyPhoneNo.setApplyStatusReason(auditReq.getApplyStatusReason()); modifyPhoneNo.setApplyStatusReason(auditReq.getApplyStatusReason());
modifyPhoneNo.setProcessingStatus(ModifyPhoneNoProcessingStatusEnum.WAIT_4_USER_FEEDBACK.ordinal()); modifyPhoneNo.setProcessingStatus(ModifyPhoneNoProcessingStatusEnum.WAIT_4_USER_FEEDBACK.ordinal());
modifyPhoneNo.setUpdatedAt(new Date());
} }
if (ModifyPhoneNoApplyStatusEnum.DONE == auditReq.getApplyStatus()) { if (ModifyPhoneNoApplyStatusEnum.DONE == auditReq.getApplyStatus()) {
log.info("audit userId = 【{}】, name = 【{}】, idCard = 【{}】, prevPhoneNo = 【{}】, " + log.info("audit userId = 【{}】, name = 【{}】, idCard = 【{}】, prevPhoneNo = 【{}】, " +
...@@ -220,7 +218,6 @@ public class ModifyPhoneNoServiceImpl implements IModifyPhoneNoService { ...@@ -220,7 +218,6 @@ public class ModifyPhoneNoServiceImpl implements IModifyPhoneNoService {
userService.modifyPhoneNo(modifyPhoneNo.getPrevPhoneNo(), modifyPhoneNo.getCurPhoneNo()); userService.modifyPhoneNo(modifyPhoneNo.getPrevPhoneNo(), modifyPhoneNo.getCurPhoneNo());
modifyPhoneNo.setApplyStatus(ModifyPhoneNoApplyStatusEnum.DONE.ordinal()); modifyPhoneNo.setApplyStatus(ModifyPhoneNoApplyStatusEnum.DONE.ordinal());
modifyPhoneNo.setProcessingStatus(ModifyPhoneNoProcessingStatusEnum.WAIT_4_USER_FEEDBACK.ordinal()); modifyPhoneNo.setProcessingStatus(ModifyPhoneNoProcessingStatusEnum.WAIT_4_USER_FEEDBACK.ordinal());
modifyPhoneNo.setUpdatedAt(new Date());
} }
} }
......
...@@ -41,7 +41,6 @@ public class UserCenterServiceImpl implements UserCenterService { ...@@ -41,7 +41,6 @@ public class UserCenterServiceImpl implements UserCenterService {
} }
if(!Objects.equals(avatar, userAttached.getAvatar())){ if(!Objects.equals(avatar, userAttached.getAvatar())){
userAttached.setAvatar(avatar); userAttached.setAvatar(avatar);
userAttached.setUpdatedAt(new Timestamp(System.currentTimeMillis()));
userAttached = userAttachedRepository.save(userAttached); userAttached = userAttachedRepository.save(userAttached);
} }
return userAttached; return userAttached;
...@@ -58,7 +57,6 @@ public class UserCenterServiceImpl implements UserCenterService { ...@@ -58,7 +57,6 @@ public class UserCenterServiceImpl implements UserCenterService {
} }
if(!Objects.equals(nick, userAttached.getNick())){ if(!Objects.equals(nick, userAttached.getNick())){
userAttached.setNick(nick); userAttached.setNick(nick);
userAttached.setUpdatedAt(new Timestamp(System.currentTimeMillis()));
try { try {
userAttached = userAttachedRepository.save(userAttached); userAttached = userAttachedRepository.save(userAttached);
}catch (ConstraintViolationException e){ }catch (ConstraintViolationException e){
...@@ -81,7 +79,6 @@ public class UserCenterServiceImpl implements UserCenterService { ...@@ -81,7 +79,6 @@ public class UserCenterServiceImpl implements UserCenterService {
UserAttached userAttached = userAttachedRepository.findByUserId(userId); UserAttached userAttached = userAttachedRepository.findByUserId(userId);
// 更新实例 // 更新实例
userAttached = Optional.ofNullable(userAttached).orElse(new UserAttached()); userAttached = Optional.ofNullable(userAttached).orElse(new UserAttached());
Timestamp now = new Timestamp(System.currentTimeMillis());
userAttached.setUserId(userId); userAttached.setUserId(userId);
if(StringUtils.isBlank(userAttached.getAvatar())){ if(StringUtils.isBlank(userAttached.getAvatar())){
userAttached.setAvatar(avatar); userAttached.setAvatar(avatar);
...@@ -89,10 +86,6 @@ public class UserCenterServiceImpl implements UserCenterService { ...@@ -89,10 +86,6 @@ public class UserCenterServiceImpl implements UserCenterService {
if(StringUtils.isBlank(userAttached.getNick())){ if(StringUtils.isBlank(userAttached.getNick())){
userAttached.setNick(nick); userAttached.setNick(nick);
} }
if(Objects.isNull(userAttached.getCreatedAt())){
userAttached.setCreatedAt(now);
}
userAttached.setUpdatedAt(now);
return userAttachedRepository.save(userAttached); return userAttachedRepository.save(userAttached);
} }
} }
...@@ -84,7 +84,6 @@ public class UserDetailVO { ...@@ -84,7 +84,6 @@ public class UserDetailVO {
xUserDetail.setUpdatedAt(new Timestamp(this.getUpdatedAt())); xUserDetail.setUpdatedAt(new Timestamp(this.getUpdatedAt()));
} }
xUserDetail.setIsAuthenticated(this.getIsAuthenticated()); xUserDetail.setIsAuthenticated(this.getIsAuthenticated());
xUserDetail.setEnable(this.getEnable()); xUserDetail.setEnable(this.getEnable());
return xUserDetail; return xUserDetail;
......
...@@ -66,9 +66,6 @@ public class UserServiceTest { ...@@ -66,9 +66,6 @@ public class UserServiceTest {
addressObj.setProvince("悉尼"); addressObj.setProvince("悉尼");
addressObj.setProvinceCode(1L); addressObj.setProvinceCode(1L);
addressObj.setAddress("嘻哈"); addressObj.setAddress("嘻哈");
Timestamp timestamp=Timestamp.valueOf( LocalDateTime.now());
addressObj.setCreatedAt(timestamp);
addressObj.setUpdateAt(timestamp);
return Arrays.asList(new Object[][]{{addressObj}}); return Arrays.asList(new Object[][]{{addressObj}});
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment