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

Commit c7880cf9 authored by 胡佳晨's avatar 胡佳晨

Merge branch 'master' into dev_plaform_check_title

parents 728d1d0d 580d3dd1
......@@ -24,6 +24,10 @@ public class AdamRedisConst {
public static final String INFO_ENTERS = INFO.concat("enters:");
public static final String INFO_ADDRESSES = INFO.concat("addresses:");
public static final String INFO_CERTIFICATION = INFO.concat("certification:");
/**
* 认证失败标记
*/
public static final String INFO_CERTIFICATION_JUNK = INFO.concat("certification_junk:");
public static final String INFO_MEMBER_SIMPLE = INFO.concat("member:simple");
public static final String INFO_MEMBER_CATEGORY = INFO.concat("member:category:");
......
......@@ -54,7 +54,7 @@
align: 'center',
formatter: function (value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + updateFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.performancesId + '\')"><i class="fa fa-edit"></i>审核</a> ');
actions.push('<a class="btn btn-success btn-xs" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.performancesId + '\')"><i class="fa fa-edit"></i>审核</a> ');
return actions.join('');
}
}]
......
......@@ -17,7 +17,7 @@ public class LnsRegex {
/**
* 汉字-姓名(2~20位)
*/
public static final String CN_HANZI = "^[\\u4e00-\\u9fa5]{2,20}$";
public static final String CN_HANZI = "^[\\u4e00-\\u9fa5+\\·?\\u4e00-\\u9fa5+]{2,30}$";
/**
* 汉字-省|市|区(2~30位)
*/
......
......@@ -136,6 +136,9 @@ public class AdamEntersController {
if (!Pattern.matches(LnsRegex.Valid.CN_HANZI, parameter.getName())) {
return ResponseDto.failure(ErrorMapping.get("10103"));
}
if (!Pattern.matches(LnsRegex.Valid.CN_ID_CARD_REF, parameter.getIdCard())) {
return ResponseDto.failure(ErrorMapping.get("10104"));
}
}
if (StringUtils.isBlank(parameter.getEntersId())) {
return ResponseDto.failure(ErrorMapping.get("10015"));
......
......@@ -231,9 +231,6 @@ public class AdamUserController {
return ResponseDto.failure(ErrorMapping.get("10104"));
}
AdamRealInfoVo vo = adamUserService.identity(CurrentUtil.getCurrentUid(), name, idCard);
if (null == vo) {
return ResponseDto.failure(ErrorMapping.get("10000"));
}
vo.setName(SensitizeUtil.chineseName(vo.getName()));
vo.setIdCard(SensitizeUtil.custom(vo.getIdCard(), 3, 2));
return ResponseDto.success(vo);
......
package com.liquidnet.service.adam.service;
import com.fasterxml.jackson.databind.JsonNode;
import com.liquidnet.common.cache.redis.util.RedisUtil;
import com.liquidnet.common.exception.LiquidnetServiceException;
import com.liquidnet.commons.lang.util.IdentityUtils;
import com.liquidnet.commons.lang.util.JsonUtils;
import com.liquidnet.commons.lang.util.SensitizeUtil;
import com.liquidnet.service.adam.constant.AdamRedisConst;
import com.liquidnet.service.adam.dto.vo.*;
import com.liquidnet.service.adam.util.NknameUtil;
import com.liquidnet.service.adam.util.ObjectUtil;
import com.liquidnet.service.base.ErrorMapping;
import com.liquidnet.service.kylin.constant.KylinRedisConst;
import com.liquidnet.service.kylin.dto.vo.mongo.KylinPerformanceVo;
import lombok.extern.slf4j.Slf4j;
......@@ -15,7 +19,9 @@ import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.time.LocalDateTime;
import java.util.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
@Slf4j
......@@ -156,15 +162,81 @@ public class AdamRdmService {
return vo;
}
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | <ID_TYPE+ID_NO, ID_NAME> */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 认证失败的<ID_TYPE+ID_NO, ID_NAME> */
public boolean setCertificationJunk(int idType, String idNo, String idName) {
return redisUtil.set(AdamRedisConst.INFO_CERTIFICATION_JUNK + idType + idNo, idName, 604800);
}
public boolean isCertificationJunk(int idType, String idNo, String idName) {
String o = (String) redisUtil.get(AdamRedisConst.INFO_CERTIFICATION_JUNK + idType + idNo);
return !StringUtils.isEmpty(o) && o.equals(idName);
}
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 认证成功的<ID_TYPE+ID_NO, ID_NAME> */
/**
* 目前只针对身份证类型三方服务认证成功的标记
*
* @param idType
* @param idNo
* @param idName
* @return
*/
public boolean setCertification(int idType, String idNo, String idName) {
return redisUtil.set(AdamRedisConst.INFO_CERTIFICATION + idType + idNo, idName);
}
public boolean isCertification(int idType, String idNo, String idName) {
/**
* 目前只针对身份证类型三方服务认证成功的标记
*
* @param idType
* @param idNo
* @param idName
* @return
*/
public int isCertification(int idType, String idNo, String idName) {
String o = (String) redisUtil.get(AdamRedisConst.INFO_CERTIFICATION + idType + idNo);
return !StringUtils.isEmpty(o) && o.equals(idName);
if (StringUtils.isEmpty(o)) {
return -1;
}
return o.equals(idName) ? 1 : 0;
// return !StringUtils.isEmpty(o) && o.equals(idName);
}
/**
* 身份证实名处理
*
* @param uid
* @param name
* @param idCard
*/
public void identityHandler1(String uid, String name, String idCard) {
int rst = this.isCertification(1, idCard, name);
switch (rst) {
case -1:// 本地不存在
if (this.isCertificationJunk(1, idCard, name)) {
ErrorMapping.ErrorMessage errorMessage = ErrorMapping.get("10102");
throw new LiquidnetServiceException(errorMessage.getCode(), errorMessage.getMessage());
}
String respStr = IdentityUtils.aliThird(name, idCard);
JsonNode respJNode = JsonUtils.fromJson(respStr, JsonNode.class);
if (null == respJNode || !"0".equals(respJNode.get("error_code").asText())) {
log.info("###实名认证失败[{}]", respStr);
this.setCertificationJunk(1, idCard, name);
ErrorMapping.ErrorMessage errorMessage = ErrorMapping.get("10102");
throw new LiquidnetServiceException(errorMessage.getCode(), errorMessage.getMessage());
}
this.setCertification(1, idCard, name);
break;
case 0:// 本地存在,验证不通过
ErrorMapping.ErrorMessage errorMessage = ErrorMapping.get("10102");
throw new LiquidnetServiceException(errorMessage.getCode(), errorMessage.getMessage());
case 1:// 本地存在,验证通过
break;
}
}
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | <UID, List<AdamThirdPartInfoVo>> */
......
......@@ -49,11 +49,12 @@ public class AdamEntersServiceImpl implements IAdamEntersService {
if (1 == parameter.getType()) {
if (!adamRdmService.isCertification(1, parameter.getIdCard(), parameter.getName())) {
identityHandler(currentUid, parameter.getName(), parameter.getIdCard());
adamRdmService.setCertification(1, parameter.getIdCard(), parameter.getName());
}
// if (!adamRdmService.isCertification(1, parameter.getIdCard(), parameter.getName())) {
// identityHandler(currentUid, parameter.getName(), parameter.getIdCard());
//
// adamRdmService.setCertification(1, parameter.getIdCard(), parameter.getName());
// }
adamRdmService.identityHandler1(currentUid, parameter.getName(), parameter.getIdCard());
}
......@@ -134,9 +135,12 @@ public class AdamEntersServiceImpl implements IAdamEntersService {
LocalDateTime now = LocalDateTime.now();
if (1 == parameter.getType()) {
if (!adamRdmService.isCertification(1, parameter.getIdCard(), parameter.getName())) {
identityHandler(currentUid, parameter.getName(), parameter.getIdCard());
}
// if (!adamRdmService.isCertification(1, parameter.getIdCard(), parameter.getName())) {
// identityHandler(currentUid, parameter.getName(), parameter.getIdCard());
//
// adamRdmService.setCertification(1, parameter.getIdCard(), parameter.getName());
// }
adamRdmService.identityHandler1(currentUid, parameter.getName(), parameter.getIdCard());
}
List<AdamEntersVo> vos = adamRdmService.getEntersVoByUid(currentUid);
......@@ -214,14 +218,4 @@ public class AdamEntersServiceImpl implements IAdamEntersService {
log.debug("#collect.process耗时:{}ms", System.currentTimeMillis() - s);
return vos;
}
private void identityHandler(String currentUid, String name, String idCard) {
String respStr = IdentityUtils.aliThird(name, idCard);
JsonNode respJNode = JsonUtils.fromJson(respStr, JsonNode.class);
if (null == respJNode || !"0".equals(respJNode.get("error_code").asText())) {
log.info("###实名认证失败[{}]", respStr);
ErrorMapping.ErrorMessage errorMessage = ErrorMapping.get("10102");
throw new LiquidnetServiceException(errorMessage.getCode(), errorMessage.getMessage());
}
}
}
......@@ -321,17 +321,24 @@ public class AdamUserServiceImpl implements IAdamUserService {
@Override
// @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
public AdamRealInfoVo identity(String uid, String name, String idCard) {
AdamRealInfoVo vo = null;
if (!adamRdmService.isCertification(1, idCard, name)) {
String respStr = IdentityUtils.aliThird(name, idCard);
JsonNode respJNode = JsonUtils.fromJson(respStr, JsonNode.class);
if (null == respJNode || !"0".equals(respJNode.get("error_code").asText())) {
log.info("###实名认证失败[{}]", respStr);
ErrorMapping.ErrorMessage errorMessage = ErrorMapping.get("10102");
throw new LiquidnetServiceException(errorMessage.getCode(), errorMessage.getMessage());
}
adamRdmService.setCertification(1, idCard, name);
}
// if (!adamRdmService.isCertification(1, idCard, name)) {
// if (adamRdmService.isCertificationJunk(1, idCard, name)) {
// ErrorMapping.ErrorMessage errorMessage = ErrorMapping.get("10102");
// throw new LiquidnetServiceException(errorMessage.getCode(), errorMessage.getMessage());
// }
//
// String respStr = IdentityUtils.aliThird(name, idCard);
// JsonNode respJNode = JsonUtils.fromJson(respStr, JsonNode.class);
// if (null == respJNode || !"0".equals(respJNode.get("error_code").asText())) {
// log.info("###实名认证失败[{}]", respStr);
// adamRdmService.setCertificationJunk(1, idCard, name);
// ErrorMapping.ErrorMessage errorMessage = ErrorMapping.get("10102");
// throw new LiquidnetServiceException(errorMessage.getCode(), errorMessage.getMessage());
// }
// adamRdmService.setCertification(1, idCard, name);
// }
adamRdmService.identityHandler1(uid, name, idCard);
AdamRealName realName = new AdamRealName();
realName.setRealNameId(IDGenerator.nextSnowId() + "");
......@@ -343,12 +350,7 @@ public class AdamUserServiceImpl implements IAdamUserService {
realName.setCreatedAt(LocalDateTime.now());
adamRealNameService.add(realName);
vo = AdamRealInfoVo.getNew();
vo.setUid(uid);
vo.setName(name);
vo.setIdCard(idCard);
vo.setType(realName.getType());
vo.setState(1);
AdamRealInfoVo vo = AdamRealInfoVo.getNew().copy(realName);
long s = System.currentTimeMillis();
adamRdmService.setRealInfoVoByUid(uid, vo);
......
......@@ -27,7 +27,7 @@
10101=姓名或身份证件号无效
10102=身份证号与姓名不符
10103=已超出姓名长度限制
10103=身份证姓名不合规
10104=身份证号码不合规
10105=入场人不存在
10106=收获地址不存在
......
......@@ -40,6 +40,7 @@ import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
......@@ -410,6 +411,58 @@ public class KylinOrderTicketsServiceImpl implements IKylinOrderTicketsService {
if (refundSinglePrice.compareTo(BigDecimal.ZERO) <= 0) {
return "申请金额不得小于0";
}
// 临时手续费
if (orderTicketVo.getPerformanceId().equals("245383231370444809122956")) {
// 手续费比例
float chargesNum = 0.0f;
// 票种演出开始时间
String useStart = orderTicketVo.getUseStart();
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
LocalDateTime useStartD = LocalDateTime.parse(useStart, df);
// 3、15天之前的时间
LocalDateTime useStartD15Before = useStartD.minusDays(15);
LocalDateTime useStartD3Before = useStartD.minusDays(3);
// 当前时间
LocalDateTime nowTime = LocalDateTime.now();
if (useStartD15Before.isAfter(nowTime)) { // 15天以前的时间大于当前时间 距离演出开始日期>15天
chargesNum = 0.1f;
log.info("距离演出开始日期>15天");
log.info("票种演出开始时间 {}", useStartD);
log.info("15天之前的时间 {}", useStartD15Before);
log.info("3天之前的时间 {}", useStartD3Before);
log.info("当前时间 {}", nowTime);
log.info("手续费比例 {}", chargesNum);
} else if (useStartD3Before.isAfter(nowTime)) { // 3天以前的时间大于当前时间 距离演出开始日期>3天-15天 含15天
chargesNum = 0.5f;
log.info("距离演出开始日期3-15天");
log.info("票种演出开始时间 {}", useStartD);
log.info("15天之前的时间 {}", useStartD15Before);
log.info("3天之前的时间 {}", useStartD3Before);
log.info("当前时间 {}", nowTime);
log.info("手续费比例 {}", chargesNum);
} else { // 三天以内 <=3
log.info("距离演出开始日期<=3");
log.info("票种演出开始时间 {}", useStartD);
log.info("15天之前的时间 {}", useStartD15Before);
log.info("3天之前的时间 {}", useStartD3Before);
log.info("当前时间 {}", nowTime);
log.info("手续费比例 {}", chargesNum);
return "当前日期不支持退票";
}
BigDecimal multiply = refundSinglePrice.multiply(BigDecimal.valueOf(chargesNum));
log.info("multiply {}", multiply);
refundSinglePrice = refundSinglePrice.subtract(multiply);
log.info("去除手续费申请金额 {}", refundSinglePrice);
if (refundSinglePrice.compareTo(BigDecimal.ZERO) <= 0) {
return "申请金额不得小于0";
// return "去除手续费申请金额不得小于0";
}
} else{
log.info("演出id1111 {}", orderTicketVo.getPerformanceId());
}
// 临时手续费 end
Map token = CurrentUtil.getTokenClaims();
String username = StringUtils.defaultString(((String) token.get("nickname")), "");
String result = refundsStatusService.userOrderTicketRefunding(orderTicketVo, refundSinglePrice.doubleValue(), orderTicketEntitiesId, reason, picList, uid, username, kylinOrderRefundsVoBaseList.size());
......
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