Browse Source

Merge branch 'master' of http://git.dayaedu.com/yonge/mec

zouxuan 4 years ago
parent
commit
59abfbfce1

+ 9 - 6
mec-auth/mec-auth-server/src/main/java/com/ym/mec/auth/web/controller/UserController.java

@@ -15,6 +15,8 @@ import com.ym.mec.common.security.SecurityUtils;
 import com.ym.mec.common.service.IdGeneratorService;
 import com.ym.mec.im.ImFeignService;
 import com.ym.mec.thirdparty.eseal.ESealPlugin;
+import com.ym.mec.thirdparty.user.realname.RealnameAuthenticationPluginContext;
+import com.ym.mec.thirdparty.user.realname.provider.LinkfaceRealnameAuthenticationPlugin;
 import com.ym.mec.util.date.DateUtil;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
@@ -23,6 +25,7 @@ import io.swagger.annotations.ApiOperation;
 import org.apache.commons.beanutils.BeanUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.http.MediaType;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
@@ -48,6 +51,10 @@ public class UserController extends BaseController {
 	private IdGeneratorService smsCodeService;
 	@Autowired
 	private ESealPlugin eSealPlugin;
+	@Value("${message.debugMode}")
+	private boolean debugMode;
+	@Autowired
+	private RealnameAuthenticationPluginContext realnameAuthenticationPluginContext;
 
 	@ApiOperation(value = "分页查询用户信息")
 	@ApiImplicitParams({ @ApiImplicitParam(name = "userType", value = "用户类型", required = false, dataType = "String"),
@@ -231,12 +238,8 @@ public class UserController extends BaseController {
 				throw new BizException("出生日期不可超过当前时间");
 			}
 
-			String accountId = eSealPlugin.createUserAccount(
-					sysUser.getRealName(),
-					sysUser.getIdCardNo(),
-					user.getUsername().split(":")[1]);
-			if (StringUtils.isBlank(accountId)) {
-				throw new BizException("用户信息错误");
+			if(debugMode){
+				realnameAuthenticationPluginContext.getRealnameAuthenticationPlugin(LinkfaceRealnameAuthenticationPlugin.getName()).verify(sysUser.getRealName(), sysUser.getIdCardNo());
 			}
 
 			sysUserService.updateBaseInfo(sysUser);

+ 12 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ContractServiceImpl.java

@@ -10,6 +10,8 @@ import java.util.Map.Entry;
 import java.util.stream.Collectors;
 
 import com.ym.mec.biz.dal.dao.StudentDao;
+import com.ym.mec.thirdparty.user.realname.RealnameAuthenticationPluginContext;
+import com.ym.mec.thirdparty.user.realname.provider.LinkfaceRealnameAuthenticationPlugin;
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
@@ -126,6 +128,12 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
 	@Value("${contract.baseDir:/var/pdf}")
 	private String contractBaseDir;
 
+	@Value("${message.debugMode}")
+	private boolean debugMode;
+
+	@Autowired
+	private RealnameAuthenticationPluginContext realnameAuthenticationPluginContext;
+
 	private DateFormat dateFormatOss = new SimpleDateFormat("yyyy/MM/dd");
 
 	private DateFormat dateFormat1 = new SimpleDateFormat("yyMMddHHmmSS");
@@ -178,6 +186,10 @@ public class ContractServiceImpl implements ContractService, InitializingBean {
 		SysUserTsign sysUserTsign = sysUserTsignService.get(userId);
 		if (sysUserTsign == null) {
 
+			if(debugMode){
+				realnameAuthenticationPluginContext.getRealnameAuthenticationPlugin(LinkfaceRealnameAuthenticationPlugin.getName()).verify(realName, idCardNo);
+			}
+
 			String accountId = eSealPlugin.createUserAccount(realName, idCardNo, mobileNo);
 
 			if (StringUtils.isBlank(accountId)) {

+ 13 - 0
mec-biz/src/main/java/com/ym/mec/biz/service/impl/StudentRegistrationServiceImpl.java

@@ -22,12 +22,15 @@ import com.ym.mec.common.service.impl.BaseServiceImpl;
 import com.ym.mec.im.ImFeignService;
 import com.ym.mec.thirdparty.eseal.ESealPlugin;
 import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
+import com.ym.mec.thirdparty.user.realname.RealnameAuthenticationPluginContext;
+import com.ym.mec.thirdparty.user.realname.provider.LinkfaceRealnameAuthenticationPlugin;
 import com.ym.mec.util.collection.MapUtil;
 import com.ym.mec.util.http.HttpUtil;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -103,6 +106,12 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
     @Autowired
     private GoodsDao goodsDao;
 
+    @Value("${message.debugMode}")
+    private boolean debugMode;
+
+    @Autowired
+    private RealnameAuthenticationPluginContext realnameAuthenticationPluginContext;
+
     @Override
     public BaseDAO<Long, StudentRegistration> getDAO() {
         return studentRegistrationDao;
@@ -267,6 +276,10 @@ public class StudentRegistrationServiceImpl extends BaseServiceImpl<Long, Studen
                 teacherDao.updateUser(sysUser);
             }
 
+            if(debugMode){
+                realnameAuthenticationPluginContext.getRealnameAuthenticationPlugin(LinkfaceRealnameAuthenticationPlugin.getName()).verify(sysUser.getRealName(), sysUser.getIdCardNo());
+            }
+
             studentRegistration.setActualSubjectId(studentRegistration.getSubjectId());
             studentRegistration.setCreateTime(date);
             studentRegistration.setUpdateTime(date);

+ 1 - 1
mec-thirdparty/src/main/java/com/ym/mec/thirdparty/user/realname/provider/LinkfaceRealnameAuthenticationPlugin.java

@@ -87,7 +87,7 @@ public class LinkfaceRealnameAuthenticationPlugin implements RealnameAuthenticat
 			String msg = "";
 			if (result != null) {
 				if (result == 2) {
-					msg = "身份证号和姓名不致";
+					msg = "身份证号和姓名不致";
 				} else if (result == 3) {
 					msg = "查无此身份证号";
 				}