记得上下班打卡 | git大法好,push需谨慎

Commit afaecdd7 authored by 张国柄's avatar 张国柄

统一用户常住地处理;

parent 4758bc93
...@@ -33,9 +33,9 @@ public class AdamMemberOrderParam implements Serializable { ...@@ -33,9 +33,9 @@ public class AdamMemberOrderParam implements Serializable {
@Pattern(regexp = LnsRegex.Valid.DATETIME_YMD, message = "生日格式有误") @Pattern(regexp = LnsRegex.Valid.DATETIME_YMD, message = "生日格式有误")
@NotBlank(message = "生日不能为空") @NotBlank(message = "生日不能为空")
private String birthday; private String birthday;
@ApiModelProperty(position = 16, required = true, value = "地区[100]", example = "北京 北京市 朝阳区") // @ApiModelProperty(position = 16, required = true, value = "地区[100] ~ 已废除,参见[province、city、county]", example = "北京 北京市 朝阳区")
@NotBlank(message = "地区不能为空") // @NotBlank(message = "地区不能为空")
private String area; // private String area;
@ApiModelProperty(position = 16, required = true, value = "收获地址") @ApiModelProperty(position = 16, required = true, value = "收获地址")
@Size(min = 1, max = 64, message = "收获地址长度限制1-64位字符") @Size(min = 1, max = 64, message = "收获地址长度限制1-64位字符")
@NotBlank(message = "收获地址不能为空") @NotBlank(message = "收获地址不能为空")
...@@ -60,4 +60,14 @@ public class AdamMemberOrderParam implements Serializable { ...@@ -60,4 +60,14 @@ public class AdamMemberOrderParam implements Serializable {
private String name; private String name;
@ApiModelProperty(position = 31, required = false, value = "身份证件号[未实名时必传]", example = "111111111111111111") @ApiModelProperty(position = 31, required = false, value = "身份证件号[未实名时必传]", example = "111111111111111111")
private String idCard; private String idCard;
@ApiModelProperty(position = 32, required = true, value = "常住地/省[50] ~ 替换原字段[area]", example = "北京市")
@NotBlank(message = "省份不能为空")
private String province;
@ApiModelProperty(position = 33, required = true, value = "常住地/市[50] ~ 替换原字段[area]", example = "北京市")
@NotBlank(message = "城市不能为空")
private String city;
@ApiModelProperty(position = 34, required = true, value = "常住地/区县[50] ~ 替换原字段[area]", example = "朝阳区")
@NotBlank(message = "区县不能为空")
private String county;
} }
...@@ -33,13 +33,18 @@ public class AdamUserInfoParam implements java.io.Serializable { ...@@ -33,13 +33,18 @@ public class AdamUserInfoParam implements java.io.Serializable {
@Pattern(regexp = LnsRegex.Valid.DATETIME_YMD, message = "生日格式有误") @Pattern(regexp = LnsRegex.Valid.DATETIME_YMD, message = "生日格式有误")
// @NotBlank(message = "生日不能为空") // @NotBlank(message = "生日不能为空")
private String birthday; private String birthday;
@ApiModelProperty(position = 16, required = true, value = "常住地/区域[100]", example = "北京 北京市 朝阳区") @ApiModelProperty(position = 16, required = false, value = "常住地/区域[100] ~ 已废除,参见[province、city、county]", example = "北京 北京市 朝阳区")
// @NotBlank(message = "常住地不能为空") @NotBlank(message = "常住地不能为空")
private String area; private String area;
@ApiModelProperty(position = 17, required = true, value = "签名[30]", example = "...................") @ApiModelProperty(position = 17, required = true, value = "签名[30]", example = "...................")
// @Size(max = 30, message = "已超出签名长度限制") // @Size(max = 30, message = "已超出签名长度限制")
private String signature; private String signature;
@ApiModelProperty(position = 18, required = true, value = "标签[500]", example = "[{\"val\":\"MMS01\",\"desc\":\"民歌\",\"tagVos\":[{\"val\":\"MMS0101\",\"desc\":\"A\"},{\"val\":\"MMS0102\",\"desc\":\"B\"}]},{\"val\":\"MMS02\",\"desc\":\"house\",\"tagVos\":[{\"val\":\"MMS0201\",\"desc\":\"C\"}]}]") @ApiModelProperty(position = 18, required = true, value = "标签[500]", example = "[{\"val\":\"MMS01\",\"desc\":\"民歌\",\"tagVos\":[{\"val\":\"MMS0101\",\"desc\":\"A\"},{\"val\":\"MMS0102\",\"desc\":\"B\"}]},{\"val\":\"MMS02\",\"desc\":\"house\",\"tagVos\":[{\"val\":\"MMS0201\",\"desc\":\"C\"}]}]")
// @NotNull
private List<AdamTagParentVo> tagMe; private List<AdamTagParentVo> tagMe;
@ApiModelProperty(position = 19, required = false, value = "常住地/省[50] ~ 替换原字段[area]", example = "北京市")
private String province;
@ApiModelProperty(position = 20, required = false, value = "常住地/市[50] ~ 替换原字段[area]", example = "北京市")
private String city;
@ApiModelProperty(position = 21, required = false, value = "常住地/区县[50] ~ 替换原字段[area]", example = "朝阳区")
private String county;
} }
...@@ -12,7 +12,7 @@ public class AdamMemberOrderPreviewVo implements Serializable { ...@@ -12,7 +12,7 @@ public class AdamMemberOrderPreviewVo implements Serializable {
private static final long serialVersionUID = 2035177741044060344L; private static final long serialVersionUID = 2035177741044060344L;
@ApiModelProperty(position = 10, value = "会员ID[50]") @ApiModelProperty(position = 10, value = "会员ID[50]")
private String memberId; private String memberId;
@ApiModelProperty(position = 11, value = "会员标题[50]", example = "摩登天空会员") @ApiModelProperty(position = 11, value = "会员标题[50]")
private String memberTitle; private String memberTitle;
@ApiModelProperty(position = 12, value = "价格详情") @ApiModelProperty(position = 12, value = "价格详情")
private AdamMemberPriceVo priceVo; private AdamMemberPriceVo priceVo;
...@@ -20,11 +20,18 @@ public class AdamMemberOrderPreviewVo implements Serializable { ...@@ -20,11 +20,18 @@ public class AdamMemberOrderPreviewVo implements Serializable {
private AdamRealInfoVo realInfoVo; private AdamRealInfoVo realInfoVo;
@ApiModelProperty(position = 14, value = "生日") @ApiModelProperty(position = 14, value = "生日")
private String birthday; private String birthday;
@ApiModelProperty(position = 15, value = "常住地/区域[100]", example = "北京 北京市 朝阳区") @ApiModelProperty(position = 15, value = "常住地/区域 ~ 已废除,参见[province、city、county]")
private String area; private String area;
@ApiModelProperty(position = 20, value = "标记[0-普通用户|2-过期会员|10-老会员|11-新会员]") @ApiModelProperty(position = 20, value = "标记[0-普通用户|2-过期会员|10-老会员|11-新会员]")
private Integer stageMarker; private Integer stageMarker;
@ApiModelProperty(position = 21, value = "常住地/省 ~ 替换原字段[area]")
private String province;
@ApiModelProperty(position = 22, value = "常住地/市 ~ 替换原字段[area]")
private String city;
@ApiModelProperty(position = 23, value = "常住地/区县 ~ 替换原字段[area]")
private String county;
private static final AdamMemberOrderPreviewVo obj = new AdamMemberOrderPreviewVo(); private static final AdamMemberOrderPreviewVo obj = new AdamMemberOrderPreviewVo();
public static AdamMemberOrderPreviewVo getNew() { public static AdamMemberOrderPreviewVo getNew() {
......
...@@ -14,6 +14,7 @@ import org.apache.commons.lang3.StringUtils; ...@@ -14,6 +14,7 @@ import org.apache.commons.lang3.StringUtils;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.regex.Pattern;
@ApiModel(value = "AdamUserInfoVo", description = "用户详情") @ApiModel(value = "AdamUserInfoVo", description = "用户详情")
@Data @Data
...@@ -35,7 +36,7 @@ public class AdamUserInfoVo implements java.io.Serializable, Cloneable { ...@@ -35,7 +36,7 @@ public class AdamUserInfoVo implements java.io.Serializable, Cloneable {
private AdamTagVo sex; private AdamTagVo sex;
@ApiModelProperty(position = 17, value = "生日[YYYY-MM-DD]") @ApiModelProperty(position = 17, value = "生日[YYYY-MM-DD]")
private String birthday; private String birthday;
@ApiModelProperty(position = 18, value = "常住地/区域") @ApiModelProperty(position = 18, value = "常住地/区域 ~ 已废除,参见[province、city、county]")
private String area; private String area;
@ApiModelProperty(position = 19, value = "个性签名") @ApiModelProperty(position = 19, value = "个性签名")
private String signature; private String signature;
...@@ -63,7 +64,15 @@ public class AdamUserInfoVo implements java.io.Serializable, Cloneable { ...@@ -63,7 +64,15 @@ public class AdamUserInfoVo implements java.io.Serializable, Cloneable {
@ApiModelProperty(position = 30, value = "标记[0-普通用户|2-过期会员|10-老会员|11-新会员]") @ApiModelProperty(position = 30, value = "标记[0-普通用户|2-过期会员|10-老会员|11-新会员]")
private Integer stageMarker; private Integer stageMarker;
@ApiModelProperty(position = 31, value = "常住地/省 ~ 替换原字段[area]")
private String province;
@ApiModelProperty(position = 32, value = "常住地/市 ~ 替换原字段[area]")
private String city;
@ApiModelProperty(position = 33, value = "常住地/区县 ~ 替换原字段[area]")
private String county;
private static final AdamUserInfoVo obj = new AdamUserInfoVo(); private static final AdamUserInfoVo obj = new AdamUserInfoVo();
// private static final Pattern PATTERN_SPACE = Pattern.compile(" ");
public static AdamUserInfoVo getNew() { public static AdamUserInfoVo getNew() {
try { try {
...@@ -140,6 +149,12 @@ public class AdamUserInfoVo implements java.io.Serializable, Cloneable { ...@@ -140,6 +149,12 @@ public class AdamUserInfoVo implements java.io.Serializable, Cloneable {
return this; return this;
} }
/**
* 用户会员身份识别
*
* @param userMemberVo
* @return AdamUserInfoVo
*/
public AdamUserInfoVo rating(AdamUserMemberVo userMemberVo) { public AdamUserInfoVo rating(AdamUserMemberVo userMemberVo) {
if (null == userMemberVo) { if (null == userMemberVo) {
this.setStageMarker(0); this.setStageMarker(0);
...@@ -150,4 +165,36 @@ public class AdamUserInfoVo implements java.io.Serializable, Cloneable { ...@@ -150,4 +165,36 @@ public class AdamUserInfoVo implements java.io.Serializable, Cloneable {
} }
return this; return this;
} }
// /**
// * 用户常驻地处理
// * <p>
// * 原单字段[area]拆分为三个字段[province、city、county]
// * </p>
// *
// * @return AdamUserInfoVo
// */
// public AdamUserInfoVo ratingArea() {
// if (StringUtils.isEmpty(this.province)) {
// String[] areaArr = PATTERN_SPACE.split(this.area, 0);
// for (int i = 0; i < areaArr.length; i++) {
// String areaTmp = areaArr[i];
// if (StringUtils.isEmpty(areaTmp) || areaTmp.trim().length() <= 1) {
// continue;
// }
// switch (i) {
// case 0:
// this.setProvince(areaTmp);
// break;
// case 1:
// this.setCity(areaTmp);
// break;
// case 2:
// this.setCounty(areaTmp);
// break;
// }
// }
// }
// return this;
// }
} }
\ No newline at end of file
...@@ -434,7 +434,7 @@ create table adam_user_busi_acct ...@@ -434,7 +434,7 @@ create table adam_user_busi_acct
comment text comment text
) engine = InnoDB comment '用户业务服务账号表'; ) engine = InnoDB comment '用户业务服务账号表';
create index idx_adam_user_busi_acct_uid on adam_user_busi_acct (uid); create index idx_adam_user_busi_acct_uid on adam_user_busi_acct (uid);
-- >>------------------------------------------------------------------------------------|20210924会员码管理 -- >>------------------------------------------------------------------------------------ |20210924会员码管理
drop table if exists adam_member_code_batch; drop table if exists adam_member_code_batch;
create table adam_member_code_batch create table adam_member_code_batch
( (
...@@ -461,7 +461,7 @@ create table adam_member_code_batch ...@@ -461,7 +461,7 @@ create table adam_member_code_batch
create index idx_adam_member_code_batch_no on adam_member_code_batch (batch_no); create index idx_adam_member_code_batch_no on adam_member_code_batch (batch_no);
alter table adam_member_code add batch_no int null comment '~`adam_member_code_batch.batch_no`' after mid; alter table adam_member_code add batch_no int null comment '~`adam_member_code_batch.batch_no`' after mid;
-- >>------------------------------------------------------------------------------------|20211011手机号地域记录 -- >>------------------------------------------------------------------------------------ |20211011手机号地域记录
drop table if exists adam_user_mobile_locate; drop table if exists adam_user_mobile_locate;
create table adam_user_mobile_locate create table adam_user_mobile_locate
( (
...@@ -487,7 +487,8 @@ create table adam_user_mobile_locate ...@@ -487,7 +487,8 @@ create table adam_user_mobile_locate
comment text comment text
) engine = InnoDB comment '用户手机号地域信息'; ) engine = InnoDB comment '用户手机号地域信息';
create unique index uidx_auser_mobile_locate_id on adam_user_mobile_locate (uid); create unique index uidx_auser_mobile_locate_id on adam_user_mobile_locate (uid);
-- >>------------------------------------------------------------------------------------ -- >>------------------------------------------------------------------------------------ |20211105用户常驻地统一
alter table adam_user_mobile_locate add county varchar(50) null comment '区县' after city;
-- >>------------------------------------------------------------------------------------ -- >>------------------------------------------------------------------------------------
-- >>------------------------------------------------------------------------------------ -- >>------------------------------------------------------------------------------------
-- >>------------------------------------------------------------------------------------ -- >>------------------------------------------------------------------------------------
......
...@@ -145,7 +145,8 @@ public class AdamLoginController { ...@@ -145,7 +145,8 @@ public class AdamLoginController {
loginInfoVo.setUserMemberVo(adamRdmService.getUserMemberVoByUid(userInfoVo.getUid())); loginInfoVo.setUserMemberVo(adamRdmService.getUserMemberVoByUid(userInfoVo.getUid()));
log.info(UserPathDto.setData("登录", ServletUtils.getRequest().getParameterMap(), loginInfoVo)); log.info(UserPathDto.setData("登录", ServletUtils.getRequest().getParameterMap(), loginInfoVo));
return ResponseDto.success(loginInfoVo.desensitize(reviewUserInfo).finalRating()); // return ResponseDto.success(loginInfoVo.desensitize(reviewUserInfo).finalRating());
return this.loginVoResponseProcessing(loginInfoVo);
} }
@ApiOperationSupport(order = 3) @ApiOperationSupport(order = 3)
...@@ -187,7 +188,8 @@ public class AdamLoginController { ...@@ -187,7 +188,8 @@ public class AdamLoginController {
} }
log.info(UserPathDto.setData(toRegister ? "注册" : "登录", ServletUtils.getRequest().getParameterMap(), loginInfoVo)); log.info(UserPathDto.setData(toRegister ? "注册" : "登录", ServletUtils.getRequest().getParameterMap(), loginInfoVo));
return ResponseDto.success(loginInfoVo.desensitize(reviewUserInfo).finalRating()); // return ResponseDto.success(loginInfoVo.desensitize(reviewUserInfo).finalRating());
return this.loginVoResponseProcessing(loginInfoVo);
} }
@ApiOperationSupport(order = 4) @ApiOperationSupport(order = 4)
...@@ -219,7 +221,8 @@ public class AdamLoginController { ...@@ -219,7 +221,8 @@ public class AdamLoginController {
} }
log.info(UserPathDto.setData(toRegister ? "注册" : "登录", ServletUtils.getRequest().getParameterMap(), loginInfoVo)); log.info(UserPathDto.setData(toRegister ? "注册" : "登录", ServletUtils.getRequest().getParameterMap(), loginInfoVo));
return ResponseDto.success(loginInfoVo.desensitize(reviewUserInfo).finalRating()); // return ResponseDto.success(loginInfoVo.desensitize(reviewUserInfo).finalRating());
return this.loginVoResponseProcessing(loginInfoVo);
} }
@ApiOperationSupport(order = 5) @ApiOperationSupport(order = 5)
...@@ -275,7 +278,8 @@ public class AdamLoginController { ...@@ -275,7 +278,8 @@ public class AdamLoginController {
loginInfoVo.setWechatUnionid(wechatUnionid); loginInfoVo.setWechatUnionid(wechatUnionid);
log.info(UserPathDto.setData(toRegister ? "注册" : "登录", ServletUtils.getRequest().getParameterMap(), loginInfoVo)); log.info(UserPathDto.setData(toRegister ? "注册" : "登录", ServletUtils.getRequest().getParameterMap(), loginInfoVo));
return ResponseDto.success(loginInfoVo.desensitize(reviewUserInfo).finalRating()); // return ResponseDto.success(loginInfoVo.desensitize(reviewUserInfo).finalRating());
return this.loginVoResponseProcessing(loginInfoVo);
} }
@ApiOperationSupport(order = 6) @ApiOperationSupport(order = 6)
...@@ -315,7 +319,8 @@ public class AdamLoginController { ...@@ -315,7 +319,8 @@ public class AdamLoginController {
loginInfoVo.setToken(this.ssoProcess(loginInfoVo.getUserInfo())); loginInfoVo.setToken(this.ssoProcess(loginInfoVo.getUserInfo()));
log.info(UserPathDto.setData(toRegister ? "注册" : "登录", ServletUtils.getRequest().getParameterMap(), loginInfoVo)); log.info(UserPathDto.setData(toRegister ? "注册" : "登录", ServletUtils.getRequest().getParameterMap(), loginInfoVo));
return ResponseDto.success(loginInfoVo.desensitize(reviewUserInfo).finalRating()); // return ResponseDto.success(loginInfoVo.desensitize(reviewUserInfo).finalRating());
return this.loginVoResponseProcessing(loginInfoVo);
} }
@ApiOperationSupport(order = 7) @ApiOperationSupport(order = 7)
...@@ -448,4 +453,9 @@ public class AdamLoginController { ...@@ -448,4 +453,9 @@ public class AdamLoginController {
); );
return token; return token;
} }
private ResponseDto<AdamLoginInfoVo> loginVoResponseProcessing(AdamLoginInfoVo loginInfoVo) {
adamRdmService.ratingProvince(loginInfoVo.getUserInfo());
return ResponseDto.success(loginInfoVo.desensitize(reviewUserInfo).finalRating());
}
} }
...@@ -82,9 +82,12 @@ public class AdamMemberOrderController { ...@@ -82,9 +82,12 @@ public class AdamMemberOrderController {
previewVo.setStageMarker(2); previewVo.setStageMarker(2);
} }
AdamUserInfoVo userInfoVo = adamRdmService.getUserInfoVoByUid(currentUid); AdamUserInfoVo userInfoVo = adamRdmService.ratingProvince(adamRdmService.getUserInfoVoByUid(currentUid));
previewVo.setBirthday(userInfoVo.getBirthday()); previewVo.setBirthday(userInfoVo.getBirthday());
previewVo.setArea(userInfoVo.getArea()); previewVo.setArea(userInfoVo.getArea());
previewVo.setProvince(userInfoVo.getProvince());
previewVo.setCity(userInfoVo.getCity());
previewVo.setCounty(userInfoVo.getCounty());
return ResponseDto.success(previewVo); return ResponseDto.success(previewVo);
} }
......
...@@ -377,7 +377,7 @@ public class AdamUserController { ...@@ -377,7 +377,7 @@ public class AdamUserController {
map.put("thirdPartInfo", adamRdmService.getThirdPartVoListByUid(currentUid)); map.put("thirdPartInfo", adamRdmService.getThirdPartVoListByUid(currentUid));
AdamUserMemberVo userMemberVo = adamRdmService.getUserMemberVoByUid(currentUid); AdamUserMemberVo userMemberVo = adamRdmService.getUserMemberVoByUid(currentUid);
map.put("userMemberVo", userMemberVo); map.put("userMemberVo", userMemberVo);
map.put("userInfo", userInfoVo.desensitize(reviewUserInfo).rating(userMemberVo)); map.put("userInfo", adamRdmService.ratingProvince(userInfoVo).desensitize(reviewUserInfo).rating(userMemberVo));
map.put("memberVo", adamRdmService.getMemberSimpleVo()); map.put("memberVo", adamRdmService.getMemberSimpleVo());
return ResponseDto.success(map); return ResponseDto.success(map);
......
...@@ -20,6 +20,7 @@ import java.time.LocalDateTime; ...@@ -20,6 +20,7 @@ import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Slf4j @Slf4j
...@@ -553,7 +554,7 @@ public class AdamRdmService { ...@@ -553,7 +554,7 @@ public class AdamRdmService {
* 会员权益列表 * 会员权益列表
* *
* @param memberId 会员Id * @param memberId 会员Id
* @param vFlag 新老会员标识[0-默认新会员,1-老会员] * @param vFlag 新老会员标识[0-默认新会员,1-老会员]
* @return * @return
*/ */
public List<AdamMemberRightsVo> getMemberRightsVoByMemberId(String memberId, int vFlag) { public List<AdamMemberRightsVo> getMemberRightsVoByMemberId(String memberId, int vFlag) {
...@@ -792,6 +793,23 @@ public class AdamRdmService { ...@@ -792,6 +793,23 @@ public class AdamRdmService {
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | */ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | */
/**
* 赋值新加属性[省、市、区县]
*
* @param vo AdamUserInfoVo
* @return AdamUserInfoVo
*/
public AdamUserInfoVo ratingProvince(AdamUserInfoVo vo) {
Optional.ofNullable(vo).filter(r -> StringUtils.isEmpty(r.getProvince())).ifPresent(r -> {
String[] mobileLocateArr = this.getMobileLocateArr(r.getMobile());
if (null != mobileLocateArr && mobileLocateArr.length > 0) {
r.setProvince(mobileLocateArr[0]);
r.setCity(mobileLocateArr[1]);
}
});
return vo;
}
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | */ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | */
......
...@@ -130,7 +130,7 @@ public class AdamMemberOrderServiceImpl implements IAdamMemberOrderService { ...@@ -130,7 +130,7 @@ public class AdamMemberOrderServiceImpl implements IAdamMemberOrderService {
memberOrderVo.setMemberName(memberVo.getName()); memberOrderVo.setMemberName(memberVo.getName());
memberOrderVo.setMode(param.getMode()); memberOrderVo.setMode(param.getMode());
memberOrderVo.setBirthday(param.getBirthday()); memberOrderVo.setBirthday(param.getBirthday());
memberOrderVo.setArea(param.getArea()); memberOrderVo.setArea(param.getProvince().concat("-").concat(param.getCity()).concat("-").concat(param.getCounty()));
memberOrderVo.setDeviceFrom(param.getDeviceFrom()); memberOrderVo.setDeviceFrom(param.getDeviceFrom());
memberOrderVo.setPayType(param.getPayType()); memberOrderVo.setPayType(param.getPayType());
memberOrderVo.setState(0);// 0-待支付 memberOrderVo.setState(0);// 0-待支付
......
...@@ -29,6 +29,7 @@ import java.time.LocalDateTime; ...@@ -29,6 +29,7 @@ import java.time.LocalDateTime;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.regex.Pattern;
/** /**
* <p> * <p>
...@@ -60,6 +61,8 @@ public class AdamUserInfoServiceImpl implements IAdamUserInfoService { ...@@ -60,6 +61,8 @@ public class AdamUserInfoServiceImpl implements IAdamUserInfoService {
// 用户注册IM的密码 // 用户注册IM的密码
private static final String ppwd = "138CEF91A62088BD3EF329FA3A6176CB18A"; private static final String ppwd = "138CEF91A62088BD3EF329FA3A6176CB18A";
private static final Pattern PATTERN_SPACE = Pattern.compile(" ");
@Override @Override
// @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) // @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public ResponseDto<AdamUserInfoVo> edit(AdamUserInfoVo existUserInfoVo, AdamUserInfoParam parameter) { public ResponseDto<AdamUserInfoVo> edit(AdamUserInfoVo existUserInfoVo, AdamUserInfoParam parameter) {
...@@ -100,27 +103,62 @@ public class AdamUserInfoServiceImpl implements IAdamUserInfoService { ...@@ -100,27 +103,62 @@ public class AdamUserInfoServiceImpl implements IAdamUserInfoService {
tagMe = existUserInfoVo.getTagMe(); tagMe = existUserInfoVo.getTagMe();
} }
String beforeNickname = existUserInfoVo.getNickname(); String beforeNickname = existUserInfoVo.getNickname(), nickname = parameter.getNickname();
if (StringUtils.isEmpty(beforeNickname) || !beforeNickname.equals(parameter.getNickname())) { if (StringUtils.isEmpty(beforeNickname) || (StringUtils.isNotBlank(nickname) && !beforeNickname.equals(nickname))) {
// IM设置推送昵称 // IM设置推送昵称
easemobUtil.settingNoticeNickname(parameter.getNickname(), existUserInfoVo.getUid()); easemobUtil.settingNoticeNickname(nickname, existUserInfoVo.getUid());
} }
existUserInfoVo.setAvatar(parameter.getAvatar()); existUserInfoVo.setAvatar(parameter.getAvatar());
existUserInfoVo.setBackground(parameter.getBackground()); existUserInfoVo.setBackground(parameter.getBackground());
existUserInfoVo.setNickname(parameter.getNickname()); existUserInfoVo.setNickname(nickname);
existUserInfoVo.setSignature(parameter.getSignature()); existUserInfoVo.setSignature(parameter.getSignature());
// existUserInfoVo.setAvatar(StringUtils.isEmpty(existUserInfoVo.getAvatar()) ? AdamConst.DEF_URL_AVATAR : existUserInfoVo.getAvatar());
// existUserInfoVo.setBackground(StringUtils.isEmpty(existUserInfoVo.getBackground()) ? AdamConst.DEF_URL_BACKGROUND : existUserInfoVo.getBackground());
// existUserInfoVo.setNickname(existUserInfoVo.getNickname());
// existUserInfoVo.setSignature(existUserInfoVo.getSignature());
existUserInfoVo.setSex(parameter.getSex()); existUserInfoVo.setSex(parameter.getSex());
existUserInfoVo.setBirthday(parameter.getBirthday()); existUserInfoVo.setBirthday(parameter.getBirthday());
existUserInfoVo.setArea(parameter.getArea()); // existUserInfoVo.setArea(parameter.getArea());
existUserInfoVo.setTagMe(tagMe); existUserInfoVo.setTagMe(tagMe);
existUserInfoVo.setUpdatedAt(LocalDateTime.now()); existUserInfoVo.setUpdatedAt(LocalDateTime.now());
existUserInfoVo.setIsComplete(isComplete); existUserInfoVo.setIsComplete(isComplete);
boolean updateProvinceCityCountyFlg = false;// 标识更新用户常驻地信息
String area = parameter.getArea(), province = parameter.getProvince(), city = parameter.getCity(), county = parameter.getCounty();
if (StringUtils.isNotEmpty(area) && !StringUtils.equals(existUserInfoVo.getArea(), area)) {// 调整前的版本兼容处理,不强更APP
String[] areaArr = PATTERN_SPACE.split(area, 0);
for (int i = 0; i < areaArr.length; i++) {
String areaTmp = areaArr[i];
if (StringUtils.isEmpty(areaTmp) || areaTmp.trim().length() <= 1) {
continue;
}
updateProvinceCityCountyFlg = true;
switch (i) {
case 0:
existUserInfoVo.setProvince(areaTmp);
break;
case 1:
existUserInfoVo.setCity(areaTmp);
break;
case 2:
existUserInfoVo.setCounty(areaTmp);
existUserInfoVo.setArea(areaArr[0].concat("-").concat(areaArr[1]).concat("-").concat(areaTmp));
break;
}
}
}
if (StringUtils.isNotBlank(province) && StringUtils.isNotBlank(city) && StringUtils.isNotBlank(county)) {// 调整后的版本
if (!StringUtils.equals(existUserInfoVo.getProvince(), province)
|| !StringUtils.equals(existUserInfoVo.getCity(), city) || !StringUtils.equals(existUserInfoVo.getCounty(), county)
) {
updateProvinceCityCountyFlg = true;
existUserInfoVo.setProvince(province);
existUserInfoVo.setCity(parameter.getCity());
existUserInfoVo.setCounty(parameter.getCounty());
existUserInfoVo.setArea(province.concat("-").concat(city).concat("-").concat(county));
}
}
long s = System.currentTimeMillis(); long s = System.currentTimeMillis();
adamRdmService.setUserInfoVoByUid(existUserInfoVo.getUid(), existUserInfoVo); adamRdmService.setUserInfoVoByUid(existUserInfoVo.getUid(), existUserInfoVo);
log.debug("#RDS耗时:{}ms", System.currentTimeMillis() - s); log.debug("#RDS耗时:{}ms", System.currentTimeMillis() - s);
...@@ -128,48 +166,64 @@ public class AdamUserInfoServiceImpl implements IAdamUserInfoService { ...@@ -128,48 +166,64 @@ public class AdamUserInfoServiceImpl implements IAdamUserInfoService {
String sexStr = JsonUtils.toJson(existUserInfoVo.getSex()); String sexStr = JsonUtils.toJson(existUserInfoVo.getSex());
String tagMeStr = JsonUtils.toJson(tagMe); String tagMeStr = JsonUtils.toJson(tagMe);
if (syncChimeFlg || null == beforeSex || (null != parameter.getSex() && !parameter.getSex().getVal().equals(beforeSex.getVal()))) { if (syncChimeFlg || null == beforeSex || (null != parameter.getSex() && !parameter.getSex().getVal().equals(beforeSex.getVal()))) {
// 同步`service-chime`
ResponseDto<String> chimeRegisterRstFlg = null; ResponseDto<String> chimeRegisterRstFlg = null;
try { try {// 同步`service-chime`
chimeRegisterRstFlg = feignAdamChimeClient.registerForUser( chimeRegisterRstFlg = feignAdamChimeClient.registerForUser(
existUserInfoVo.getUid(), sexStr, tagMeStr,syncChimeRegisterFlg ? "CREATE" : "UPDATE" existUserInfoVo.getUid(), sexStr, tagMeStr, syncChimeRegisterFlg ? "CREATE" : "UPDATE"
); );
} catch (Exception e) { } catch (Exception e) {
log.error("同步`chime`用户标签信息异常", e); log.error("同步`chime`用户标签信息异常", e);
} }
log.debug("同步`chime`用户标签信息结果:{}", JsonUtils.toJson(chimeRegisterRstFlg)); if (log.isDebugEnabled()) {
log.debug("同步`chime`用户标签信息结果:{}", JsonUtils.toJson(chimeRegisterRstFlg));
}
} }
LinkedList<String> toMqSqls = CollectionUtil.linkedListString(); LinkedList<String> toMqSqls = CollectionUtil.linkedListString();
LinkedList<Object[]> updateUserObjs = CollectionUtil.linkedListObjectArr(), LinkedList<Object[]> updateUserObjs = CollectionUtil.linkedListObjectArr(),
updateUserInfoObjs = CollectionUtil.linkedListObjectArr(); updateUserInfoObjs = CollectionUtil.linkedListObjectArr(),
updateUserMobileLocateObjs = CollectionUtil.linkedListObjectArr(),
initUserBusiAcctObjs = CollectionUtil.linkedListObjectArr();
s = System.currentTimeMillis(); s = System.currentTimeMillis();
toMqSqls.add(SqlMapping.get("adam_user.complete")); toMqSqls.add(SqlMapping.get("adam_user.complete"));
updateUserObjs.add(new Object[]{existUserInfoVo.getIsComplete(), existUserInfoVo.getUpdatedAt(), existUserInfoVo.getUid()}); updateUserObjs.add(new Object[]{existUserInfoVo.getIsComplete(), existUserInfoVo.getUpdatedAt(), existUserInfoVo.getUid()});
toMqSqls.add(SqlMapping.get("adam_user_info.edit")); toMqSqls.add(SqlMapping.get("adam_user_info.edit"));
updateUserInfoObjs.add(new Object[]{ updateUserInfoObjs.add(new Object[]{
existUserInfoVo.getNickname(), sexStr, existUserInfoVo.getBirthday(), existUserInfoVo.getArea(), existUserInfoVo.getNickname(), sexStr, existUserInfoVo.getBirthday(), existUserInfoVo.getArea(),
existUserInfoVo.getSignature(), existUserInfoVo.getAvatar(), existUserInfoVo.getBackground(), existUserInfoVo.getSignature(), existUserInfoVo.getAvatar(), existUserInfoVo.getBackground(), tagMeStr, existUserInfoVo.getUid()
tagMeStr, existUserInfoVo.getUid() });
} toMqSqls.add(SqlMapping.get("adam_user_mobile_locate.update_province"));
); if (updateProvinceCityCountyFlg) {
log.debug("#SQL.GET耗时:{}ms", System.currentTimeMillis() - s); updateUserMobileLocateObjs.add(new Object[]{
existUserInfoVo.getProvince(), existUserInfoVo.getCity(), existUserInfoVo.getCounty(), existUserInfoVo.getUpdatedAt(), existUserInfoVo.getUid()
});
}
toMqSqls.add(SqlMapping.get("adam_user_busi_acct.add"));
if (syncChimeRegisterFlg) { if (syncChimeRegisterFlg) {
toMqSqls.add(SqlMapping.get("adam_user_busi_acct.add"));
LinkedList<Object[]> initUserBusiAcctObjs = CollectionUtil.linkedListObjectArr();
initUserBusiAcctObjs.add(new Object[]{ initUserBusiAcctObjs.add(new Object[]{
existUserInfoVo.getUid(), "IMHX", uuid, type, ppwd, 1, existUserInfoVo.getUpdatedAt() existUserInfoVo.getUid(), "IMHX", uuid, type, ppwd, 1, existUserInfoVo.getUpdatedAt()
}); });
queueUtils.sendMsgByRedis(MQConst.AdamQueue.SQL_UCENTER.getKey(),
SqlMapping.gets(toMqSqls, updateUserObjs, updateUserInfoObjs, initUserBusiAcctObjs)
);
} else {
queueUtils.sendMsgByRedis(MQConst.AdamQueue.SQL_UCENTER.getKey(),
SqlMapping.gets(toMqSqls, updateUserObjs, updateUserInfoObjs)
);
} }
log.debug("#SQL.GET耗时:{}ms", System.currentTimeMillis() - s);
queueUtils.sendMsgByRedis(MQConst.AdamQueue.SQL_UCENTER.getKey(),
SqlMapping.gets(toMqSqls, updateUserObjs, updateUserInfoObjs, updateUserMobileLocateObjs, initUserBusiAcctObjs)
);
// if (syncChimeRegisterFlg) {
// toMqSqls.add(SqlMapping.get("adam_user_busi_acct.add"));
// LinkedList<Object[]> initUserBusiAcctObjs = CollectionUtil.linkedListObjectArr();
// initUserBusiAcctObjs.add(new Object[]{
// existUserInfoVo.getUid(), "IMHX", uuid, type, ppwd, 1, existUserInfoVo.getUpdatedAt()
// });
// queueUtils.sendMsgByRedis(MQConst.AdamQueue.SQL_UCENTER.getKey(),
// SqlMapping.gets(toMqSqls, updateUserObjs, updateUserInfoObjs, updateUserMobileLocateObjs, initUserBusiAcctObjs)
// );
// } else {
// queueUtils.sendMsgByRedis(MQConst.AdamQueue.SQL_UCENTER.getKey(),
// SqlMapping.gets(toMqSqls, updateUserObjs, updateUserInfoObjs, updateUserMobileLocateObjs)
// );
// }
return ResponseDto.success(existUserInfoVo.desensitize(reviewUserInfo)); return ResponseDto.success(existUserInfoVo.desensitize(reviewUserInfo));
} }
......
...@@ -73,21 +73,11 @@ public class AdamUserServiceImpl implements IAdamUserService { ...@@ -73,21 +73,11 @@ public class AdamUserServiceImpl implements IAdamUserService {
userInfoVo.setIsComplete(isComplete); userInfoVo.setIsComplete(isComplete);
userInfoVo.setQrCode("lN".concat(userInfoVo.getUid()).concat(RandomStringUtils.randomAlphanumeric(5).toUpperCase())); userInfoVo.setQrCode("lN".concat(userInfoVo.getUid()).concat(RandomStringUtils.randomAlphanumeric(5).toUpperCase()));
long s = System.currentTimeMillis();
adamRdmService.setUidByMobile(mobile, userInfoVo.getUid());
adamRdmService.setUserInfoVoByUid(userInfoVo.getUid(), userInfoVo);
log.debug("#RDS耗时:{}ms", System.currentTimeMillis() - s);
LinkedList<String> toMqSqls = CollectionUtil.linkedListString(); LinkedList<String> toMqSqls = CollectionUtil.linkedListString();
LinkedList<Object[]> initUserObjs = CollectionUtil.linkedListObjectArr(), LinkedList<Object[]> initUserObjs = CollectionUtil.linkedListObjectArr(),
initUserInfoObjs = CollectionUtil.linkedListObjectArr(), initUserInfoObjs = CollectionUtil.linkedListObjectArr(),
initUserMobileLocateObjs = CollectionUtil.linkedListObjectArr(); initUserMobileLocateObjs = CollectionUtil.linkedListObjectArr();
toMqSqls.add(SqlMapping.get("adam_user.add"));
initUserObjs.add(new Object[]{userInfoVo.getUid(), userInfoVo.getMobile(), userInfoVo.getState(), 0, now});
toMqSqls.add(SqlMapping.get("adam_user_info.add"));
initUserInfoObjs.add(new Object[]{userInfoVo.getUid(), userInfoVo.getNickname(), null, userInfoVo.getQrCode()});
String[] mobileLocateArr = adamRdmService.getMobileLocateArr(mobile); String[] mobileLocateArr = adamRdmService.getMobileLocateArr(mobile);
toMqSqls.add(SqlMapping.get("adam_user_mobile_locate.add")); toMqSqls.add(SqlMapping.get("adam_user_mobile_locate.add"));
if (null != mobileLocateArr && mobileLocateArr.length > 0) { if (null != mobileLocateArr && mobileLocateArr.length > 0) {
...@@ -98,11 +88,23 @@ public class AdamUserServiceImpl implements IAdamUserService { ...@@ -98,11 +88,23 @@ public class AdamUserServiceImpl implements IAdamUserService {
mobileLocateArr[0], mobileLocateArr[1], mobileLocateArr[2], mobileLocateArr[3], mobileLocateArr[4], mobileLocateArr[0], mobileLocateArr[1], mobileLocateArr[2], mobileLocateArr[3], mobileLocateArr[4],
mobile, cliIpAddr, headerCliSource, now, cliIpAddr, headerCliSource, now, now mobile, cliIpAddr, headerCliSource, now, cliIpAddr, headerCliSource, now, now
}); });
userInfoVo.setProvince(mobileLocateArr[0]);
userInfoVo.setCity(mobileLocateArr[1]);
} }
long s = System.currentTimeMillis();
adamRdmService.setUidByMobile(mobile, userInfoVo.getUid());
adamRdmService.setUserInfoVoByUid(userInfoVo.getUid(), userInfoVo);
log.debug("#RDS耗时:{}ms", System.currentTimeMillis() - s);
toMqSqls.add(SqlMapping.get("adam_user.add"));
initUserObjs.add(new Object[]{userInfoVo.getUid(), userInfoVo.getMobile(), userInfoVo.getState(), 0, now});
toMqSqls.add(SqlMapping.get("adam_user_info.add"));
initUserInfoObjs.add(new Object[]{userInfoVo.getUid(), userInfoVo.getNickname(), null, userInfoVo.getQrCode()});
s = System.currentTimeMillis(); s = System.currentTimeMillis();
queueUtils.sendMsgByRedis(MQConst.AdamQueue.SQL_UREGISTER.getKey(), queueUtils.sendMsgByRedis(MQConst.AdamQueue.SQL_UREGISTER.getKey(),
SqlMapping.gets(toMqSqls, initUserObjs, initUserInfoObjs, initUserMobileLocateObjs) SqlMapping.gets(toMqSqls, initUserMobileLocateObjs, initUserObjs, initUserInfoObjs)
); );
log.debug("#MQ耗时:{}ms", System.currentTimeMillis() - s); log.debug("#MQ耗时:{}ms", System.currentTimeMillis() - s);
return userInfoVo; return userInfoVo;
...@@ -125,7 +127,7 @@ public class AdamUserServiceImpl implements IAdamUserService { ...@@ -125,7 +127,7 @@ public class AdamUserServiceImpl implements IAdamUserService {
if (StringUtils.isEmpty(uid)) {// 不存在UID,手机号未注册 if (StringUtils.isEmpty(uid)) {// 不存在UID,手机号未注册
userInfoVo = AdamUserInfoVo.getNew(); userInfoVo = AdamUserInfoVo.getNew();
userInfoVo.setUid(IDGenerator.nextSnowId() + ""); userInfoVo.setUid(IDGenerator.nextSnowId());
userInfoVo.setMobile(param.getMobile()); userInfoVo.setMobile(param.getMobile());
userInfoVo.setNickname(param.getNickname()); userInfoVo.setNickname(param.getNickname());
userInfoVo.setAvatar(param.getAvatar()); userInfoVo.setAvatar(param.getAvatar());
...@@ -134,6 +136,20 @@ public class AdamUserServiceImpl implements IAdamUserService { ...@@ -134,6 +136,20 @@ public class AdamUserServiceImpl implements IAdamUserService {
userInfoVo.setQrCode("lN".concat(userInfoVo.getUid()).concat(RandomStringUtils.randomAlphanumeric(5).toUpperCase())); userInfoVo.setQrCode("lN".concat(userInfoVo.getUid()).concat(RandomStringUtils.randomAlphanumeric(5).toUpperCase()));
userInfoVo.setCreateAt(now); userInfoVo.setCreateAt(now);
String[] mobileLocateArr = adamRdmService.getMobileLocateArr(param.getMobile());
toMqSqls.add(SqlMapping.get("adam_user_mobile_locate.add"));
if (null != mobileLocateArr && mobileLocateArr.length > 0) {
String cliIpAddr = CurrentUtil.getCliIpAddr();
String headerCliSource = CurrentUtil.getHeaderCliSource();
initUserMobileLocateObjs.add(new Object[]{
userInfoVo.getUid(), userInfoVo.getMobile(), 1,
mobileLocateArr[0], mobileLocateArr[1], mobileLocateArr[2], mobileLocateArr[3], mobileLocateArr[4],
userInfoVo.getMobile(), cliIpAddr, headerCliSource, now, cliIpAddr, headerCliSource, now, now
});
userInfoVo.setProvince(mobileLocateArr[0]);
userInfoVo.setCity(mobileLocateArr[1]);
}
adamRdmService.setUserInfoVoByUid(userInfoVo.getUid(), userInfoVo); adamRdmService.setUserInfoVoByUid(userInfoVo.getUid(), userInfoVo);
toMqSqls.add(SqlMapping.get("adam_user.add")); toMqSqls.add(SqlMapping.get("adam_user.add"));
...@@ -156,21 +172,9 @@ public class AdamUserServiceImpl implements IAdamUserService { ...@@ -156,21 +172,9 @@ public class AdamUserServiceImpl implements IAdamUserService {
adamRdmService.setUidByMobile(param.getMobile(), thirdPartInfoVo.getUid()); adamRdmService.setUidByMobile(param.getMobile(), thirdPartInfoVo.getUid());
log.debug("#RDS耗时:{}ms", System.currentTimeMillis() - s); log.debug("#RDS耗时:{}ms", System.currentTimeMillis() - s);
String[] mobileLocateArr = adamRdmService.getMobileLocateArr(param.getMobile());
toMqSqls.add(SqlMapping.get("adam_user_mobile_locate.add"));
if (null != mobileLocateArr && mobileLocateArr.length > 0) {
String cliIpAddr = CurrentUtil.getCliIpAddr();
String headerCliSource = CurrentUtil.getHeaderCliSource();
initUserMobileLocateObjs.add(new Object[]{
userInfoVo.getUid(), userInfoVo.getMobile(), 1,
mobileLocateArr[0], mobileLocateArr[1], mobileLocateArr[2], mobileLocateArr[3], mobileLocateArr[4],
userInfoVo.getMobile(), cliIpAddr, headerCliSource, now, cliIpAddr, headerCliSource, now, now
});
}
s = System.currentTimeMillis(); s = System.currentTimeMillis();
queueUtils.sendMsgByRedis(MQConst.AdamQueue.SQL_UREGISTER.getKey(), queueUtils.sendMsgByRedis(MQConst.AdamQueue.SQL_UREGISTER.getKey(),
SqlMapping.gets(toMqSqls, initUserObjs, initUserInfoObjs, initThirdPartObjs, initUserMobileLocateObjs) SqlMapping.gets(toMqSqls, initUserMobileLocateObjs, initUserObjs, initUserInfoObjs, initThirdPartObjs)
); );
log.debug("#MQ耗时:{}ms", System.currentTimeMillis() - s); log.debug("#MQ耗时:{}ms", System.currentTimeMillis() - s);
......
...@@ -69,6 +69,7 @@ adam_user_busi_acct.add=INSERT INTO adam_user_busi_acct (`uid`, busi, uuid, `wor ...@@ -69,6 +69,7 @@ adam_user_busi_acct.add=INSERT INTO adam_user_busi_acct (`uid`, busi, uuid, `wor
adam_user_mobile_locate.add=INSERT INTO adam_user_mobile_locate (`uid`, mobile, `state`, province, city, corp, area_code, post_code, regist_mobile, regist_addr, regist_source, regist_at, latest_addr, latest_source, latest_at, updated_at) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) adam_user_mobile_locate.add=INSERT INTO adam_user_mobile_locate (`uid`, mobile, `state`, province, city, corp, area_code, post_code, regist_mobile, regist_addr, regist_source, regist_at, latest_addr, latest_source, latest_at, updated_at) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)
adam_user_mobile_locate.modify_mobile=UPDATE adam_user_mobile_locate SET mobile=?, province=?, city=?, corp=?, area_code=?, post_code=?, updated_at=? WHERE uid=? AND `state`=1 adam_user_mobile_locate.modify_mobile=UPDATE adam_user_mobile_locate SET mobile=?, province=?, city=?, corp=?, area_code=?, post_code=?, updated_at=? WHERE uid=? AND `state`=1
adam_user_mobile_locate.real_name=UPDATE adam_user_mobile_locate SET name=?, id_card=?, updated_at=? WHERE uid=? AND `state`=1 adam_user_mobile_locate.real_name=UPDATE adam_user_mobile_locate SET name=?, id_card=?, updated_at=? WHERE uid=? AND `state`=1
adam_user_mobile_locate.update_province=UPDATE adam_user_mobile_locate SET province=?, city=?, county=?, updated_at=? WHERE uid=? AND `state`=1
adam_user_mobile_locate.close=UPDATE adam_user_mobile_locate SET `state`=2, updated_at=? WHERE uid=? AND `state`=1 adam_user_mobile_locate.close=UPDATE adam_user_mobile_locate SET `state`=2, updated_at=? WHERE uid=? AND `state`=1
# ---------------------------------------------------- # ----------------------------------------------------
......
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