需求调整
This commit is contained in:
@@ -6,6 +6,7 @@ import lombok.Data;
|
|||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import org.springframework.format.annotation.DateTimeFormat;
|
|||||||
|
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -24,4 +24,22 @@ public class ActivationCodeActiveDTO {
|
|||||||
@ApiModelProperty(value = "激活码", required = true)
|
@ApiModelProperty(value = "激活码", required = true)
|
||||||
@NotBlank(message = "激活码不能为空")
|
@NotBlank(message = "激活码不能为空")
|
||||||
private String activationCode;
|
private String activationCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 证件类型
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "证件类型")
|
||||||
|
private String idType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 证件号码
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "证件号码")
|
||||||
|
private String idNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 手机号码
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "手机号码")
|
||||||
|
private String mobile;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import com.ebiz.auth.base.dto.ActivationRecordDTO;
|
|||||||
import com.ebiz.auth.base.dto.CustomerFamilyMemberDTO;
|
import com.ebiz.auth.base.dto.CustomerFamilyMemberDTO;
|
||||||
import com.ebiz.auth.base.dto.CustomerFamilyMemberExDTO;
|
import com.ebiz.auth.base.dto.CustomerFamilyMemberExDTO;
|
||||||
import com.ebiz.auth.base.dto.CustomerInfoDTO;
|
import com.ebiz.auth.base.dto.CustomerInfoDTO;
|
||||||
|
import com.ebiz.auth.base.query.ActivationRecordQueryDTO;
|
||||||
import com.ebiz.auth.base.query.CustomerFamilyMemberQueryDTO;
|
import com.ebiz.auth.base.query.CustomerFamilyMemberQueryDTO;
|
||||||
import com.ebiz.auth.base.query.CustomerInfoQueryDTO;
|
import com.ebiz.auth.base.query.CustomerInfoQueryDTO;
|
||||||
import com.ebiz.auth.base.service.ActivationRecordService;
|
import com.ebiz.auth.base.service.ActivationRecordService;
|
||||||
@@ -25,7 +26,6 @@ import com.ebiz.base.common.constant.BaseConstants;
|
|||||||
import com.ebiz.base.common.exception.ErrConstants;
|
import com.ebiz.base.common.exception.ErrConstants;
|
||||||
import com.ebiz.base.common.exception.WebException;
|
import com.ebiz.base.common.exception.WebException;
|
||||||
import com.ebiz.base.common.util.BeanMapper;
|
import com.ebiz.base.common.util.BeanMapper;
|
||||||
import com.ebiz.base.common.util.DateUtils;
|
|
||||||
import com.ebiz.base.common.util.UserUtils;
|
import com.ebiz.base.common.util.UserUtils;
|
||||||
import com.ebiz.base.db.plugin.SnowflakeIdWorker;
|
import com.ebiz.base.db.plugin.SnowflakeIdWorker;
|
||||||
import com.ebiz.base.log.annotation.SysUserOperation;
|
import com.ebiz.base.log.annotation.SysUserOperation;
|
||||||
@@ -49,8 +49,9 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties
|
|||||||
import org.springframework.context.annotation.Primary;
|
import org.springframework.context.annotation.Primary;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.management.relation.Relation;
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@@ -126,9 +127,9 @@ public class SysUserExServiceImpl implements SysUserExService {
|
|||||||
throw new WebException("用户类型无效", ErrConstants.PARAM_EXCEPTION);
|
throw new WebException("用户类型无效", ErrConstants.PARAM_EXCEPTION);
|
||||||
}
|
}
|
||||||
// 1.生成token
|
// 1.生成token
|
||||||
UserVO userVO = beanMapper.map(sysUserLoginDTO, UserVO.class);
|
UserVO userVO = this.beanMapper.map(sysUserLoginDTO, UserVO.class);
|
||||||
// 生成随机id
|
// 生成随机id
|
||||||
userVO.setId(String.valueOf(idWorker.nextId()));
|
userVO.setId(String.valueOf(this.idWorker.nextId()));
|
||||||
// 设置登录时间
|
// 设置登录时间
|
||||||
userVO.setLoginTime(new Date());
|
userVO.setLoginTime(new Date());
|
||||||
// 生成token
|
// 生成token
|
||||||
@@ -137,10 +138,21 @@ public class SysUserExServiceImpl implements SysUserExService {
|
|||||||
String url;
|
String url;
|
||||||
if (Objects.equals(sysUserLoginDTO.getType(), String.valueOf(BaseEnum.TRUE.getCode()))) {
|
if (Objects.equals(sysUserLoginDTO.getType(), String.valueOf(BaseEnum.TRUE.getCode()))) {
|
||||||
// 客户的情况
|
// 客户的情况
|
||||||
url = appKeyProperties.getCustomerUrl() + BaseConstants.DEFAULT_TOKEN_CONCAT + token;
|
url = this.appKeyProperties.getCustomerUrl() + BaseConstants.DEFAULT_TOKEN_CONCAT + token;
|
||||||
|
// 查询客户信息,客户信息不存在,新增0星客户数据
|
||||||
|
ContentModel<List<CustomerInfoDTO>> customerInfoRes = this.customerInfoService.list(new CustomerInfoQueryDTO().setCustomerNo(sysUserLoginDTO.getCustomerNo()));
|
||||||
|
if (CollectionUtil.isEmpty(customerInfoRes.getContent())) {
|
||||||
|
CustomerInfoDTO customerInfoDTO = new CustomerInfoDTO();
|
||||||
|
customerInfoDTO.setCustomerNo(sysUserLoginDTO.getCustomerNo());
|
||||||
|
customerInfoDTO.setName(sysUserLoginDTO.getName());
|
||||||
|
customerInfoDTO.setGender(sysUserLoginDTO.getSex());
|
||||||
|
customerInfoDTO.setCustomerStarLevel("0");
|
||||||
|
customerInfoDTO.setStandardPremiumAmount(new BigDecimal(0));
|
||||||
|
this.customerInfoService.insert(customerInfoDTO);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// 其他情况
|
// 其他情况
|
||||||
url = appKeyProperties.getGuestUrl() + BaseConstants.DEFAULT_TOKEN_CONCAT + token;
|
url = this.appKeyProperties.getGuestUrl() + BaseConstants.DEFAULT_TOKEN_CONCAT + token;
|
||||||
}
|
}
|
||||||
// 25.7.4新增:输出出入参
|
// 25.7.4新增:输出出入参
|
||||||
log.info("{}接口出参:{}", "跳转登录", url);
|
log.info("{}接口出参:{}", "跳转登录", url);
|
||||||
@@ -156,9 +168,23 @@ public class SysUserExServiceImpl implements SysUserExService {
|
|||||||
public ContentModel<UserVO> getUserInfo() {
|
public ContentModel<UserVO> getUserInfo() {
|
||||||
UserVO userVO = UserUtils.getUser();
|
UserVO userVO = UserUtils.getUser();
|
||||||
if (StringUtils.isNotBlank(userVO.getCustomerNo())) {
|
if (StringUtils.isNotBlank(userVO.getCustomerNo())) {
|
||||||
ContentModel<List<CustomerInfoDTO>> listRes = customerInfoService.list(new CustomerInfoQueryDTO().setCustomerNo(userVO.getCustomerNo()));
|
ContentModel<List<CustomerInfoDTO>> listRes = this.customerInfoService.list(new CustomerInfoQueryDTO().setCustomerNo(userVO.getCustomerNo()));
|
||||||
if (CollectionUtil.isNotEmpty(listRes.getContent())) {
|
if (CollectionUtil.isNotEmpty(listRes.getContent())) {
|
||||||
userVO.setCustomerLevel(Long.valueOf(listRes.getContent().get(0).getCustomerStarLevel()));
|
userVO.setCustomerLevel(Long.valueOf(listRes.getContent().get(0).getCustomerStarLevel()));
|
||||||
|
userVO.setMobile(listRes.getContent().get(0).getMobile());
|
||||||
|
ContentModel<List<ActivationRecordDTO>> activationRecordRes = this.activationRecordService.list(new ActivationRecordQueryDTO().setCustomerNo(userVO.getCustomerNo()).setActivationResult(String.valueOf(BaseEnum.TRUE.getCode())));
|
||||||
|
if (CollectionUtil.isNotEmpty(activationRecordRes.getContent())) {
|
||||||
|
ActivationRecordDTO activationRecordDTO = activationRecordRes.getContent().stream().max(Comparator.comparing(ActivationRecordDTO::getActivationTime)).orElse(new ActivationRecordDTO());
|
||||||
|
LocalDateTime acExpTime = DateUtil.toLocalDateTime(activationRecordDTO.getActivationTime()).plusYears(1);
|
||||||
|
if (acExpTime.isBefore(LocalDateTime.now())) {
|
||||||
|
userVO.setActivationStatus(BaseEnum.FALSE.getCode());
|
||||||
|
} else {
|
||||||
|
userVO.setActivationOrderNo(activationRecordDTO.getActivationCode());
|
||||||
|
userVO.setActivationStatus(BaseEnum.TRUE.getCode());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
userVO.setActivationStatus(BaseEnum.FALSE.getCode());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 这里不返回密钥
|
// 这里不返回密钥
|
||||||
@@ -168,11 +194,25 @@ public class SysUserExServiceImpl implements SysUserExService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ContentModel<String> activationCodeActive(ActivationCodeActiveDTO activationCodeActiveDTO) {
|
public ContentModel<String> activationCodeActive(ActivationCodeActiveDTO activationCodeActiveDTO) {
|
||||||
ContentModel<List<CustomerInfoDTO>> listRes = customerInfoService.list(new CustomerInfoQueryDTO().setCustomerNo(UserUtils.getUser().getCustomerNo()));
|
ContentModel<List<CustomerInfoDTO>> listRes = this.customerInfoService.list(new CustomerInfoQueryDTO().setCustomerNo(UserUtils.getUser().getCustomerNo()));
|
||||||
if (CollectionUtil.isEmpty(listRes.getContent())) {
|
if (CollectionUtil.isEmpty(listRes.getContent())) {
|
||||||
return ContentModel.error("激活码激活失败");
|
return ContentModel.error("激活码激活失败");
|
||||||
}
|
}
|
||||||
CustomerInfoDTO customerInfo = listRes.getContent().get(0);
|
CustomerInfoDTO customerInfo = listRes.getContent().get(0);
|
||||||
|
// 0星客户证件类型证件号必传
|
||||||
|
if (StringUtils.equals(customerInfo.getCustomerStarLevel(), "0")) {
|
||||||
|
if (StringUtils.isBlank(activationCodeActiveDTO.getIdType())
|
||||||
|
|| StringUtils.isBlank(activationCodeActiveDTO.getIdNo())
|
||||||
|
|| StringUtils.isBlank(activationCodeActiveDTO.getMobile())
|
||||||
|
) {
|
||||||
|
return ContentModel.error("激活码激活失败");
|
||||||
|
}
|
||||||
|
// 更新证件类型,证件号码,手机号
|
||||||
|
customerInfo.setIdType(activationCodeActiveDTO.getIdType());
|
||||||
|
customerInfo.setIdNo(activationCodeActiveDTO.getIdNo());
|
||||||
|
customerInfo.setMobile(activationCodeActiveDTO.getMobile());
|
||||||
|
this.customerInfoService.update(customerInfo);
|
||||||
|
}
|
||||||
// 激活码
|
// 激活码
|
||||||
String activationCode = activationCodeActiveDTO.getActivationCode();
|
String activationCode = activationCodeActiveDTO.getActivationCode();
|
||||||
// 激活码激活
|
// 激活码激活
|
||||||
@@ -182,25 +222,25 @@ public class SysUserExServiceImpl implements SysUserExService {
|
|||||||
customerInfo.getCustomerNo(),
|
customerInfo.getCustomerNo(),
|
||||||
customerInfo.getName(),
|
customerInfo.getName(),
|
||||||
customerInfo.getMobile(),
|
customerInfo.getMobile(),
|
||||||
String.valueOf(customerInfo.getIdType()),
|
customerInfo.getIdType(),
|
||||||
customerInfo.getIdNo().replace("([a-zA-Z\\d]{6})[a-zA-Z\\d]+([a-zA-Z\\d]{4})$", "$1" + StringUtils.repeat("*", customerInfo.getIdNo().length() - 8) + "$2"),
|
customerInfo.getIdNo().replace("([a-zA-Z\\d]{6})[a-zA-Z\\d]+([a-zA-Z\\d]{4})$", "$1" + StringUtils.repeat("*", customerInfo.getIdNo().length() - 8) + "$2"),
|
||||||
activationCode)
|
activationCode)
|
||||||
);
|
);
|
||||||
ContentModel<Object> execute = interfaceInfoExService.execute(activationCodeActive);
|
ContentModel<Object> execute = this.interfaceInfoExService.execute(activationCodeActive);
|
||||||
|
|
||||||
// 轨迹信息
|
// 轨迹信息
|
||||||
ActivationRecordDTO activationRecordDTO = new ActivationRecordDTO();
|
ActivationRecordDTO activationRecordDTO = new ActivationRecordDTO();
|
||||||
activationRecordDTO.setId(String.valueOf(idWorker.nextId()));
|
activationRecordDTO.setId(String.valueOf(this.idWorker.nextId()));
|
||||||
activationRecordDTO.setCustomerNo(customerInfo.getCustomerNo());
|
activationRecordDTO.setCustomerNo(customerInfo.getCustomerNo());
|
||||||
activationRecordDTO.setActivationCode(activationCode);
|
activationRecordDTO.setActivationCode(activationCode);
|
||||||
activationRecordDTO.setActivationTime(new Date());
|
activationRecordDTO.setActivationTime(new Date());
|
||||||
if (execute.isError()) {
|
if (execute.isError()) {
|
||||||
activationRecordDTO.setActivationResult(String.valueOf(BaseEnum.FALSE.getCode()));
|
activationRecordDTO.setActivationResult(String.valueOf(BaseEnum.FALSE.getCode()));
|
||||||
activationRecordService.insert(activationRecordDTO);
|
this.activationRecordService.insert(activationRecordDTO);
|
||||||
return ContentModel.error("激活码激活失败");
|
return ContentModel.error("激活码激活失败");
|
||||||
} else {
|
} else {
|
||||||
activationRecordDTO.setActivationResult(String.valueOf(BaseEnum.TRUE.getCode()));
|
activationRecordDTO.setActivationResult(String.valueOf(BaseEnum.TRUE.getCode()));
|
||||||
activationRecordService.insert(activationRecordDTO);
|
this.activationRecordService.insert(activationRecordDTO);
|
||||||
return ContentModel.success();
|
return ContentModel.success();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -210,11 +250,11 @@ public class SysUserExServiceImpl implements SysUserExService {
|
|||||||
String customerNo = UserUtils.getUser().getCustomerNo();
|
String customerNo = UserUtils.getUser().getCustomerNo();
|
||||||
Long level = UserUtils.getUser().getCustomerLevel();
|
Long level = UserUtils.getUser().getCustomerLevel();
|
||||||
// 1. 校验该保单年度用户是否添加过家庭成员
|
// 1. 校验该保单年度用户是否添加过家庭成员
|
||||||
ContentModel<List<CustomerFamilyMemberExDTO>> listRes = customerFamilyMemberService.listEx(new CustomerFamilyMemberQueryDTO().setCustomerNo(customerNo));
|
ContentModel<List<CustomerFamilyMemberExDTO>> listRes = this.customerFamilyMemberService.listEx(new CustomerFamilyMemberQueryDTO().setCustomerNo(customerNo));
|
||||||
List<CustomerFamilyMemberExDTO> list = ObjectUtils.defaultIfNull(listRes.getContent(), new ArrayList<>());
|
List<CustomerFamilyMemberExDTO> list = ObjectUtils.defaultIfNull(listRes.getContent(), new ArrayList<>());
|
||||||
List<String> ids = new ArrayList<>();
|
List<String> ids = new ArrayList<>();
|
||||||
if (CollectionUtil.isNotEmpty(listRes.getContent())) {
|
if (CollectionUtil.isNotEmpty(listRes.getContent())) {
|
||||||
LocalDate currentBenefitStartDate = getCurrentBenefitStartDate();
|
LocalDate currentBenefitStartDate = this.getCurrentBenefitStartDate();
|
||||||
if (currentBenefitStartDate == null) {
|
if (currentBenefitStartDate == null) {
|
||||||
return ContentModel.error("家庭成员添加失败");
|
return ContentModel.error("家庭成员添加失败");
|
||||||
}
|
}
|
||||||
@@ -282,12 +322,12 @@ public class SysUserExServiceImpl implements SysUserExService {
|
|||||||
// 3. 壹加医添加家庭成员
|
// 3. 壹加医添加家庭成员
|
||||||
if (CollectionUtil.isNotEmpty(addYjyFamilyMemberList)) {
|
if (CollectionUtil.isNotEmpty(addYjyFamilyMemberList)) {
|
||||||
// 判断该用户是否注册过壹加医, 没有注册过, 则需要先注册才能添加壹加医用户
|
// 判断该用户是否注册过壹加医, 没有注册过, 则需要先注册才能添加壹加医用户
|
||||||
ContentModel<?> contentModel = benefitApiService.register(customerNo);
|
ContentModel<?> contentModel = this.benefitApiService.register(customerNo);
|
||||||
if (contentModel.isError()) {
|
if (contentModel.isError()) {
|
||||||
log.error("注册壹加医用户失败, 错误信息: {}", contentModel.getResultMessage());
|
log.error("注册壹加医用户失败, 错误信息: {}", contentModel.getResultMessage());
|
||||||
return ContentModel.error("添加家庭成员失败");
|
return ContentModel.error("添加家庭成员失败");
|
||||||
}
|
}
|
||||||
ContentModel<List<BenefitRegistrationDTO>> registrationQueryRes = benefitRegistrationService.list(new BenefitRegistrationQueryDTO().setCustomerNo(customerNo));
|
ContentModel<List<BenefitRegistrationDTO>> registrationQueryRes = this.benefitRegistrationService.list(new BenefitRegistrationQueryDTO().setCustomerNo(customerNo));
|
||||||
if (CollectionUtil.isEmpty(registrationQueryRes.getContent())) {
|
if (CollectionUtil.isEmpty(registrationQueryRes.getContent())) {
|
||||||
log.error("获取壹加医用户注册信息失败, 注册信息不存在");
|
log.error("获取壹加医用户注册信息失败, 注册信息不存在");
|
||||||
return ContentModel.error("添加家庭成员失败");
|
return ContentModel.error("添加家庭成员失败");
|
||||||
@@ -299,7 +339,7 @@ public class SysUserExServiceImpl implements SysUserExService {
|
|||||||
Collections.reverse(registerList);
|
Collections.reverse(registerList);
|
||||||
|
|
||||||
// 添加家庭成员
|
// 添加家庭成员
|
||||||
ContentModel<Object> executeRes = interfaceInfoExService.execute(new InterfaceExecuteDTO()
|
ContentModel<Object> executeRes = this.interfaceInfoExService.execute(new InterfaceExecuteDTO()
|
||||||
.setInterfaceCode("addFamilyMember")
|
.setInterfaceCode("addFamilyMember")
|
||||||
.setParams(Arrays.asList(
|
.setParams(Arrays.asList(
|
||||||
customerNo, // out_user_id: 第三方用户ID,用于标识用户的唯一参数, 传表里面的用户id(客户号可能会变)
|
customerNo, // out_user_id: 第三方用户ID,用于标识用户的唯一参数, 传表里面的用户id(客户号可能会变)
|
||||||
@@ -316,25 +356,25 @@ public class SysUserExServiceImpl implements SysUserExService {
|
|||||||
|
|
||||||
// 4. 添加用户成功, 保存数据至数据库
|
// 4. 添加用户成功, 保存数据至数据库
|
||||||
for (CustomerFamilyMemberDTO customerFamilyMemberDTO : newFamilyMemberList) {
|
for (CustomerFamilyMemberDTO customerFamilyMemberDTO : newFamilyMemberList) {
|
||||||
customerFamilyMemberService.insert(customerFamilyMemberDTO);
|
this.customerFamilyMemberService.insert(customerFamilyMemberDTO);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 5. 删除旧数据(之前添加过, 最新添加时移除的家庭成员)
|
// 5. 删除旧数据(之前添加过, 最新添加时移除的家庭成员)
|
||||||
customerFamilyMemberService.delete(ids);
|
this.customerFamilyMemberService.delete(ids);
|
||||||
|
|
||||||
return ContentModel.success();
|
return ContentModel.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ContentModel<?> checkAddCustomerFamilyMember(String customerNo) {
|
public ContentModel<?> checkAddCustomerFamilyMember(String customerNo) {
|
||||||
Long customerLevel = UserUtils.getUser().getCustomerLevel();
|
Long customerLevel = this.getUserInfo().getContent().getCustomerLevel();
|
||||||
if (customerLevel < 4) {
|
if (customerLevel < 4) {
|
||||||
return ContentModel.error("当前客户等级, 不支持添加家庭成员");
|
return ContentModel.error("当前客户等级, 不支持添加家庭成员");
|
||||||
}
|
}
|
||||||
ContentModel<List<CustomerFamilyMemberExDTO>> listRes = customerFamilyMemberService.listEx(new CustomerFamilyMemberQueryDTO().setCustomerNo(customerNo));
|
ContentModel<List<CustomerFamilyMemberExDTO>> listRes = this.customerFamilyMemberService.listEx(new CustomerFamilyMemberQueryDTO().setCustomerNo(customerNo));
|
||||||
List<CustomerFamilyMemberExDTO> list = ObjectUtils.defaultIfNull(listRes.getContent(), new ArrayList<>());
|
List<CustomerFamilyMemberExDTO> list = ObjectUtils.defaultIfNull(listRes.getContent(), new ArrayList<>());
|
||||||
if (CollectionUtil.isNotEmpty(listRes.getContent())) {
|
if (CollectionUtil.isNotEmpty(listRes.getContent())) {
|
||||||
LocalDate currentBenefitStartDate = getCurrentBenefitStartDate();
|
LocalDate currentBenefitStartDate = this.getCurrentBenefitStartDate();
|
||||||
if (currentBenefitStartDate == null) {
|
if (currentBenefitStartDate == null) {
|
||||||
return ContentModel.error("家庭成员添加失败");
|
return ContentModel.error("家庭成员添加失败");
|
||||||
}
|
}
|
||||||
@@ -357,7 +397,7 @@ public class SysUserExServiceImpl implements SysUserExService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private LocalDate getCurrentBenefitStartDate() {
|
private LocalDate getCurrentBenefitStartDate() {
|
||||||
ContentModel<List<ConfigCodeDTO>> configRes = configCodeService.list(new ConfigCodeQueryDTO().setCodeType("benefit_year"));
|
ContentModel<List<ConfigCodeDTO>> configRes = this.configCodeService.list(new ConfigCodeQueryDTO().setCodeType("benefit_year"));
|
||||||
if (CollectionUtil.isEmpty(configRes.getContent())) {
|
if (CollectionUtil.isEmpty(configRes.getContent())) {
|
||||||
log.error("权益年度日期获取失败, 请检查配置");
|
log.error("权益年度日期获取失败, 请检查配置");
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -78,9 +78,13 @@ public class UserVO implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private Long activationStatus;
|
private Long activationStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 手机号码
|
||||||
|
*/
|
||||||
|
private String mobile;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 随机数(唯一登录适用)
|
* 随机数(唯一登录适用)
|
||||||
*/
|
*/
|
||||||
private String randomKey;
|
private String randomKey;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,10 +3,14 @@ package com.ebiz.benefit.service.impl;
|
|||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||||
|
import com.ebiz.auth.base.dto.ActivationRecordDTO;
|
||||||
import com.ebiz.auth.base.dto.CustomerInfoDTO;
|
import com.ebiz.auth.base.dto.CustomerInfoDTO;
|
||||||
|
import com.ebiz.auth.base.query.ActivationRecordQueryDTO;
|
||||||
import com.ebiz.auth.base.query.CustomerInfoQueryDTO;
|
import com.ebiz.auth.base.query.CustomerInfoQueryDTO;
|
||||||
|
import com.ebiz.auth.base.service.ActivationRecordService;
|
||||||
import com.ebiz.auth.base.service.CustomerInfoService;
|
import com.ebiz.auth.base.service.CustomerInfoService;
|
||||||
import com.ebiz.auth.service.SysUserExService;
|
import com.ebiz.auth.service.SysUserExService;
|
||||||
|
import com.ebiz.base.auth.enums.BaseEnum;
|
||||||
import com.ebiz.base.common.exception.ErrConstants;
|
import com.ebiz.base.common.exception.ErrConstants;
|
||||||
import com.ebiz.base.common.exception.WebException;
|
import com.ebiz.base.common.exception.WebException;
|
||||||
import com.ebiz.base.common.util.UserUtils;
|
import com.ebiz.base.common.util.UserUtils;
|
||||||
@@ -37,6 +41,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@@ -67,6 +72,8 @@ public class BenefitExServiceImpl implements BenefitExService {
|
|||||||
private ConfigCodeService configCodeService;
|
private ConfigCodeService configCodeService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private BenefitUsageRecordService benefitUsageRecordService;
|
private BenefitUsageRecordService benefitUsageRecordService;
|
||||||
|
@Autowired
|
||||||
|
private ActivationRecordService activationRecordService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取权益信息列表
|
* 获取权益信息列表
|
||||||
@@ -180,12 +187,36 @@ public class BenefitExServiceImpl implements BenefitExService {
|
|||||||
throw new WebException("权益信息不存在", ErrConstants.DATA_NOT_EXIST);
|
throw new WebException("权益信息不存在", ErrConstants.DATA_NOT_EXIST);
|
||||||
}
|
}
|
||||||
BenefitCheckRespDTO respDTO = new BenefitCheckRespDTO();
|
BenefitCheckRespDTO respDTO = new BenefitCheckRespDTO();
|
||||||
Optional<StarLevelBenefitMappingDTO> op1 = starLevelBenefitMappingDTOList.stream().max(Comparator.comparing(StarLevelBenefitMappingDTO::getStarLevelRight));
|
Optional<StarLevelBenefitMappingDTO> op1 = starLevelBenefitMappingDTOList.stream().filter(slbm -> slbm.getStarLevelRight() <= Long.parseLong(customerInfoDTO.getCustomerStarLevel())).max(Comparator.comparing(StarLevelBenefitMappingDTO::getStarLevelRight));
|
||||||
|
// 0星客户额外判断是否激活成功
|
||||||
|
if (StringUtils.equals(customerInfoDTO.getCustomerStarLevel(), "0")) {
|
||||||
|
ContentModel<List<ActivationRecordDTO>> activationRecordRes = this.activationRecordService.list(new ActivationRecordQueryDTO().setCustomerNo(customerInfoDTO.getCustomerNo()).setActivationResult(String.valueOf(BaseEnum.TRUE.getCode())));
|
||||||
|
if (activationRecordRes.isError()) {
|
||||||
|
throw new WebException("获取激活记录失败", ErrConstants.DATA_NOT_EXIST);
|
||||||
|
} else {
|
||||||
|
if (CollUtil.isEmpty(activationRecordRes.getContent())) {
|
||||||
|
respDTO.setIsSatisfyStarLevel(BooleanEnum.FALSE.getCode());
|
||||||
|
} else {
|
||||||
|
ActivationRecordDTO activationRecordDTO = activationRecordRes.getContent().stream().max(Comparator.comparing(ActivationRecordDTO::getActivationTime)).orElse(new ActivationRecordDTO());
|
||||||
|
LocalDateTime acExpTime = DateUtil.toLocalDateTime(activationRecordDTO.getActivationTime()).plusYears(1);
|
||||||
|
if (acExpTime.isBefore(LocalDateTime.now())) {
|
||||||
|
respDTO.setIsSatisfyStarLevel(BooleanEnum.FALSE.getCode());
|
||||||
|
} else {
|
||||||
if (!op1.isPresent()) {
|
if (!op1.isPresent()) {
|
||||||
respDTO.setIsSatisfyStarLevel(BooleanEnum.FALSE.getCode());
|
respDTO.setIsSatisfyStarLevel(BooleanEnum.FALSE.getCode());
|
||||||
} else {
|
} else {
|
||||||
respDTO.setIsSatisfyStarLevel(BooleanEnum.TRUE.getCode());
|
respDTO.setIsSatisfyStarLevel(BooleanEnum.TRUE.getCode());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!op1.isPresent()) {
|
||||||
|
respDTO.setIsSatisfyStarLevel(BooleanEnum.FALSE.getCode());
|
||||||
|
} else {
|
||||||
|
respDTO.setIsSatisfyStarLevel(BooleanEnum.TRUE.getCode());
|
||||||
|
}
|
||||||
|
}
|
||||||
// 查询当前客户使用次数
|
// 查询当前客户使用次数
|
||||||
LocalDate currentBenefitStartDate = this.getCurrentBenefitStartDate();
|
LocalDate currentBenefitStartDate = this.getCurrentBenefitStartDate();
|
||||||
if (currentBenefitStartDate == null) {
|
if (currentBenefitStartDate == null) {
|
||||||
@@ -208,7 +239,7 @@ public class BenefitExServiceImpl implements BenefitExService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 查询是否可以添加家庭成员
|
// 查询是否可以添加家庭成员
|
||||||
ContentModel<?> contentModel = sysUserExService.checkAddCustomerFamilyMember(customerInfoDTO.getCustomerNo());
|
ContentModel<?> contentModel = this.sysUserExService.checkAddCustomerFamilyMember(customerInfoDTO.getCustomerNo());
|
||||||
if (contentModel.isSuccess()) {
|
if (contentModel.isSuccess()) {
|
||||||
respDTO.setIsCanAddFamilyMember(BooleanEnum.TRUE.getCode());
|
respDTO.setIsCanAddFamilyMember(BooleanEnum.TRUE.getCode());
|
||||||
} else {
|
} else {
|
||||||
@@ -228,7 +259,7 @@ public class BenefitExServiceImpl implements BenefitExService {
|
|||||||
return ContentModel.error("此权益不可用");
|
return ContentModel.error("此权益不可用");
|
||||||
}
|
}
|
||||||
// 获取权益跳转链接
|
// 获取权益跳转链接
|
||||||
return yjyBenefitApiService.getBenefitServiceUrl(customerNo, benefitCode);
|
return this.yjyBenefitApiService.getBenefitServiceUrl(customerNo, benefitCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -237,7 +268,7 @@ public class BenefitExServiceImpl implements BenefitExService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private LocalDate getCurrentBenefitStartDate() {
|
private LocalDate getCurrentBenefitStartDate() {
|
||||||
ContentModel<List<ConfigCodeDTO>> configRes = configCodeService.list(new ConfigCodeQueryDTO().setCodeType("benefit_year"));
|
ContentModel<List<ConfigCodeDTO>> configRes = this.configCodeService.list(new ConfigCodeQueryDTO().setCodeType("benefit_year"));
|
||||||
if (CollectionUtil.isEmpty(configRes.getContent())) {
|
if (CollectionUtil.isEmpty(configRes.getContent())) {
|
||||||
log.error("权益年度日期获取失败, 请检查配置");
|
log.error("权益年度日期获取失败, 请检查配置");
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -9,6 +9,9 @@ import com.alibaba.fastjson2.JSONObject;
|
|||||||
import com.ebiz.auth.base.dto.CustomerInfoDTO;
|
import com.ebiz.auth.base.dto.CustomerInfoDTO;
|
||||||
import com.ebiz.auth.base.query.CustomerInfoQueryDTO;
|
import com.ebiz.auth.base.query.CustomerInfoQueryDTO;
|
||||||
import com.ebiz.auth.base.service.CustomerInfoService;
|
import com.ebiz.auth.base.service.CustomerInfoService;
|
||||||
|
import com.ebiz.auth.service.SysUserExService;
|
||||||
|
import com.ebiz.base.auth.entity.UserVO;
|
||||||
|
import com.ebiz.base.auth.enums.BaseEnum;
|
||||||
import com.ebiz.base.enums.BooleanEnum;
|
import com.ebiz.base.enums.BooleanEnum;
|
||||||
import com.ebiz.base.platform.rest.ContentModel;
|
import com.ebiz.base.platform.rest.ContentModel;
|
||||||
import com.ebiz.benefit.base.dto.BenefitDTO;
|
import com.ebiz.benefit.base.dto.BenefitDTO;
|
||||||
@@ -36,6 +39,7 @@ import java.time.ZoneId;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service("yjyBenefitApiService")
|
@Service("yjyBenefitApiService")
|
||||||
@@ -54,6 +58,8 @@ public class YjyBenefitApiServiceImpl implements BenefitApiService {
|
|||||||
private YjyEncryptServiceImpl yjyEncryptService;
|
private YjyEncryptServiceImpl yjyEncryptService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private BenefitService benefitService;
|
private BenefitService benefitService;
|
||||||
|
@Autowired
|
||||||
|
private SysUserExService sysUserExService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ContentModel<?> register(String customerNo) {
|
public ContentModel<?> register(String customerNo) {
|
||||||
@@ -134,11 +140,24 @@ public class YjyBenefitApiServiceImpl implements BenefitApiService {
|
|||||||
return ContentModel.error("获取权益服务跳转链接失败");
|
return ContentModel.error("获取权益服务跳转链接失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ContentModel<UserVO> getUserInfoRes = sysUserExService.getUserInfo();
|
||||||
|
if (getUserInfoRes.isError()) {
|
||||||
|
log.error("【医加壹】获取用户信息失败:{}", getUserInfoRes.getResultMessage());
|
||||||
|
return ContentModel.error("获取权益服务跳转链接失败");
|
||||||
|
}
|
||||||
|
UserVO userVO = getUserInfoRes.getContent();
|
||||||
|
// 0星客户无需注册
|
||||||
|
if (userVO.getCustomerLevel() != 0) {
|
||||||
ContentModel<?> contentModel = register(customerNo);
|
ContentModel<?> contentModel = register(customerNo);
|
||||||
if (contentModel.isError()) {
|
if (contentModel.isError()) {
|
||||||
log.error("【医加壹】获取用户注册信息失败:{}", contentModel.getResultMessage());
|
log.error("【医加壹】获取用户注册信息失败:{}", contentModel.getResultMessage());
|
||||||
return ContentModel.error("获取权益服务跳转链接失败");
|
return ContentModel.error("获取权益服务跳转链接失败");
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if (Objects.equals(userVO.getActivationStatus(), BaseEnum.FALSE.getCode())) {
|
||||||
|
return ContentModel.error("请先完成激活");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
String yjyJumpUrl = yjyJumpUrlRes.getContent().get(0).getCode();
|
String yjyJumpUrl = yjyJumpUrlRes.getContent().get(0).getCode();
|
||||||
String benefitJumpCode = benefitQueryRes.getContent().get(0).getJumpThirdCode();
|
String benefitJumpCode = benefitQueryRes.getContent().get(0).getJumpThirdCode();
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
spring:
|
spring:
|
||||||
|
main:
|
||||||
|
allow-circular-references: true
|
||||||
profiles:
|
profiles:
|
||||||
active: dev
|
active: dev
|
||||||
#active: local
|
#active: local
|
||||||
|
|||||||
Reference in New Issue
Block a user