|
|
@ -8,12 +8,10 @@ import com.epmet.commons.tools.security.dto.TokenDto; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.commons.tools.validator.PhoneValidatorUtils; |
|
|
|
import com.epmet.commons.tools.validator.ValidatorUtils; |
|
|
|
import com.epmet.constant.BadgeConstant; |
|
|
|
import com.epmet.constant.SmsTemplateConstant; |
|
|
|
import com.epmet.dao.BadgeDao; |
|
|
|
import com.epmet.dao.ResiUserBadgeDao; |
|
|
|
import com.epmet.dao.UserBadgeDao; |
|
|
|
import com.epmet.dao.UserRoleDao; |
|
|
|
import com.epmet.dao.*; |
|
|
|
import com.epmet.dto.ResiUserBadgeDTO; |
|
|
|
import com.epmet.dto.UserBadgeCertificateRecordDTO; |
|
|
|
import com.epmet.dto.form.*; |
|
|
@ -29,10 +27,7 @@ import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.util.CollectionUtils; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Collections; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.*; |
|
|
|
import java.util.concurrent.atomic.AtomicReference; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
@ -60,6 +55,8 @@ public class UserBadgeServiceImpl implements UserBadgeService { |
|
|
|
private ResiUserBadgeDao resiUserBadgeDao; |
|
|
|
@Autowired |
|
|
|
private BadgeDao badgeDao; |
|
|
|
@Autowired |
|
|
|
private BadgeCertificationConfigDao badgeCertificationConfigDao; |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 查询已经点亮的徽章 |
|
|
@ -124,7 +121,7 @@ public class UserBadgeServiceImpl implements UserBadgeService { |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
return userOperListResultDTOS; |
|
|
|
return userOperListResultDTOS.stream().sorted(Comparator.comparing(UserOperListResultDTO::getBadgeName)).collect(Collectors.toList()); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -218,9 +215,14 @@ public class UserBadgeServiceImpl implements UserBadgeService { |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public Result authBadgeRecord(CertificationAddFormDTO certificationAddFormDTO) { |
|
|
|
log.info(JSON.toJSONString(certificationAddFormDTO)); |
|
|
|
if (StringUtils.isNotBlank(certificationAddFormDTO.getMobile())){ |
|
|
|
AuthFieldFormDTO authFieldFormDTO = new AuthFieldFormDTO(); |
|
|
|
authFieldFormDTO.setCustomerId(certificationAddFormDTO.getCustomerId()); |
|
|
|
authFieldFormDTO.setBadgeId(certificationAddFormDTO.getBadgeId()); |
|
|
|
|
|
|
|
validateParams(certificationAddFormDTO, authFieldFormDTO); |
|
|
|
if (StringUtils.isNotBlank(certificationAddFormDTO.getMobile())) { |
|
|
|
String smsCode = userBadgeRedis.getBadgeSmsCode(certificationAddFormDTO.getMobile()); |
|
|
|
if (!StringUtils.isNotBlank(smsCode)){ |
|
|
|
if (!StringUtils.isNotBlank(smsCode)) { |
|
|
|
return new Result().error(EpmetErrorCode.MOBILE_CODE_ERROR.getCode()); |
|
|
|
} |
|
|
|
} |
|
|
@ -228,7 +230,7 @@ public class UserBadgeServiceImpl implements UserBadgeService { |
|
|
|
List<String> userIds = new ArrayList<>(); |
|
|
|
userIds.add(certificationAddFormDTO.getUserId()); |
|
|
|
List<UserBaseInfoResultDTO> userBaseInfoResultDTOS = userBaseInfoService.queryUserBaseInfo(userIds); |
|
|
|
if (CollectionUtils.isEmpty(userBaseInfoResultDTOS)){ |
|
|
|
if (CollectionUtils.isEmpty(userBaseInfoResultDTOS)) { |
|
|
|
throw new RenException("查询用户基本信息集合为空......"); |
|
|
|
} |
|
|
|
userBadgeDao.updateCertificateRecordIsLast(form.getBadgeId(),form.getUserId()); |
|
|
@ -245,13 +247,27 @@ public class UserBadgeServiceImpl implements UserBadgeService { |
|
|
|
return new Result(); |
|
|
|
} |
|
|
|
|
|
|
|
private void validateParams(CertificationAddFormDTO certificationAddFormDTO, AuthFieldFormDTO authFieldFormDTO) { |
|
|
|
List<AuthFieldResultDTO> authFieldResultDTOS = this.authField(authFieldFormDTO); |
|
|
|
if (CollectionUtils.isEmpty(authFieldResultDTOS)) { |
|
|
|
throw new RenException("该徽章配置配置错误"); |
|
|
|
} |
|
|
|
Set<String> requiredColumns = authFieldResultDTOS.stream() |
|
|
|
.filter(o -> NumConstant.ONE_STR.equals(o.getIsRequired())) |
|
|
|
.map(AuthFieldResultDTO::getEnName).collect(Collectors.toSet()); |
|
|
|
List<String> missColumns = ValidatorUtils.hasAllRequired(JSON.toJSONString(certificationAddFormDTO), requiredColumns); |
|
|
|
if (!CollectionUtils.isEmpty(missColumns)) { |
|
|
|
throw new RenException(JSON.toJSONString(missColumns).concat("不能为空")); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 站内信发送——提交徽章认证 |
|
|
|
* @Param form |
|
|
|
* @author zxc |
|
|
|
* @date 2020/11/10 9:04 上午 |
|
|
|
*/ |
|
|
|
public void sendMessageByUser(UserBadgeCertificateRecordDTO form){ |
|
|
|
public void sendMessageByUser(UserBadgeCertificateRecordDTO form) { |
|
|
|
List<UserMessageFormDTO> msgList = new ArrayList<>(); |
|
|
|
UserMessageFormDTO formDTO = new UserMessageFormDTO(); |
|
|
|
formDTO.setApp(BadgeConstant.RESI); |
|
|
|