|
@@ -3,12 +3,7 @@ package com.miniframe.bisiness.system;
|
|
import com.miniframe.core.ExecProcessFlow;
|
|
import com.miniframe.core.ExecProcessFlow;
|
|
import com.miniframe.core.exception.BusinessException;
|
|
import com.miniframe.core.exception.BusinessException;
|
|
import com.miniframe.core.ext.UtilTools;
|
|
import com.miniframe.core.ext.UtilTools;
|
|
-import com.miniframe.generate.appcode.LoginMedia;
|
|
|
|
-import com.miniframe.generate.appcode.RoleType;
|
|
|
|
import com.miniframe.generate.appcode.SexType;
|
|
import com.miniframe.generate.appcode.SexType;
|
|
-import com.miniframe.generate.appcode.UserDnType;
|
|
|
|
-import com.miniframe.generate.appcode.UserState;
|
|
|
|
-import com.miniframe.generate.appcode.UserType;
|
|
|
|
import com.miniframe.generate.business.system.model.A00003BaseModel;
|
|
import com.miniframe.generate.business.system.model.A00003BaseModel;
|
|
import com.miniframe.model.system.SysUser;
|
|
import com.miniframe.model.system.SysUser;
|
|
import com.miniframe.model.system.SysUserSQLBuilder;
|
|
import com.miniframe.model.system.SysUserSQLBuilder;
|
|
@@ -22,15 +17,13 @@ import org.springframework.util.CollectionUtils;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
|
|
-import static com.miniframe.constant.XIConstant.VERIFYTOKEN_PRE;
|
|
|
|
-import static com.miniframe.tools.XIFileUtils.initHeadFile;
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
- * 基础系统,“注册”逻辑处理(重新生成不覆盖)。
|
|
|
|
|
|
+ * 基础系统,“手机注册”逻辑处理(重新生成不覆盖)。
|
|
*/
|
|
*/
|
|
public class A00003Service extends A00003BaseModel implements ExecProcessFlow {
|
|
public class A00003Service extends A00003BaseModel implements ExecProcessFlow {
|
|
|
|
|
|
private static final long serialVersionUID = -7051358269847459502L;
|
|
private static final long serialVersionUID = -7051358269847459502L;
|
|
|
|
+ private static String verifyTokenKeyPre = "VERIFYTOKEN_";
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -38,49 +31,51 @@ public class A00003Service extends A00003BaseModel implements ExecProcessFlow {
|
|
*/
|
|
*/
|
|
public void transExecute() throws Exception {
|
|
public void transExecute() throws Exception {
|
|
|
|
|
|
- String verifyTokenKey = VERIFYTOKEN_PRE + this.getA_systemhead().getClientToken() + this.getA_a00003().getMail(); // 唯一标识
|
|
|
|
- String isVerify = (String) UtilTools.getUserCache(verifyTokenKey);
|
|
|
|
- boolean verification;
|
|
|
|
- if (UtilTools.isNotNullAndBlank(isVerify) && isVerify.equals("1")) {
|
|
|
|
- verification = true;
|
|
|
|
- } else {
|
|
|
|
- verification = IdentifyingCodeUtil.verification(this.getA_a00003().getMail(), this.getA_a00003().getVerificationCode());
|
|
|
|
-
|
|
|
|
|
|
+ //本地是否存在
|
|
|
|
+ SysUserSQLBuilder sysUserSQLBuilder = new SysUserSQLBuilder();
|
|
|
|
+ String verifyTokenKey = verifyTokenKeyPre
|
|
|
|
+ + this.getA_systemhead().getClientToken()
|
|
|
|
+ + this.getA_a00003().getMailOrPhone(); // 唯一标识
|
|
|
|
+ String isVerify=(String) UtilTools.getUserCache(verifyTokenKey);
|
|
|
|
+ boolean verification=false;
|
|
|
|
+ if(UtilTools.isNotNullAndBlank(isVerify) && isVerify.equals("1")){
|
|
|
|
+ verification=true;
|
|
|
|
+ }else{
|
|
|
|
+ verification = IdentifyingCodeUtil.verification(this.getA_a00003().getMailOrPhone(),
|
|
|
|
+ this.getA_a00003().getVerificationCode());
|
|
}
|
|
}
|
|
-
|
|
|
|
- if (verification) {
|
|
|
|
- UtilTools.putUserCache(verifyTokenKey, "1");
|
|
|
|
-
|
|
|
|
|
|
+ if(verification) {
|
|
|
|
+ UtilTools.putUserCache(verifyTokenKey,"1");
|
|
//本地是否存在
|
|
//本地是否存在
|
|
SysUserMapper sysUserDAO = UtilTools.getBean(SysUserMapper.class);
|
|
SysUserMapper sysUserDAO = UtilTools.getBean(SysUserMapper.class);
|
|
SysUserSQLBuilder sb = new SysUserSQLBuilder();
|
|
SysUserSQLBuilder sb = new SysUserSQLBuilder();
|
|
sb.createCriteria().andUsernameEqualTo(this.getA_a00003().getUserName().trim());
|
|
sb.createCriteria().andUsernameEqualTo(this.getA_a00003().getUserName().trim());
|
|
- sb.or(sb.createCriteria().andUseremailEqualTo(this.getA_a00003().getMail()));
|
|
|
|
|
|
+ sb.or(sb.createCriteria().andUseremailEqualTo(this.getA_a00003().getMailOrPhone()));
|
|
|
|
+ sb.or(sb.createCriteria().andUsermobnubEqualTo(this.getA_a00003().getMailOrPhone()));
|
|
List<SysUser> userInfoList = sysUserDAO.selectByExample(sb);
|
|
List<SysUser> userInfoList = sysUserDAO.selectByExample(sb);
|
|
- if (!CollectionUtils.isEmpty(userInfoList)) {
|
|
|
|
|
|
+ if(!CollectionUtils.isEmpty(userInfoList)) {
|
|
//已经注册
|
|
//已经注册
|
|
throw new BusinessException("EB8000020");
|
|
throw new BusinessException("EB8000020");
|
|
}
|
|
}
|
|
-
|
|
|
|
SysUser sysUser = new SysUser();
|
|
SysUser sysUser = new SysUser();
|
|
sysUser.setId(UtilTools.getUUid());
|
|
sysUser.setId(UtilTools.getUUid());
|
|
- sysUser.setUserstate(UserState.normal.getIndex());
|
|
|
|
- sysUser.setUseremail(this.getA_a00003().getMail());
|
|
|
|
|
|
+ //sysUser.setUsertype(CertificationType.person.getIndex());
|
|
|
|
+ //sysUser.setAuthenticationState(CertificationState.noCertificate.getIndex());
|
|
|
|
+ sysUser.setUserstate("1");
|
|
|
|
+ if(this.getA_a00003().getChannel().equals("2")) {//邮箱
|
|
|
|
+ sysUser.setUseremail(this.getA_a00003().getMailOrPhone());
|
|
|
|
+ }else if(this.getA_a00003().getChannel().equals("1")){//手机
|
|
|
|
+ sysUser.setUsermobnub(this.getA_a00003().getMailOrPhone());
|
|
|
|
+ }
|
|
|
|
+
|
|
sysUser.setCreateTime(XIDateTimeUtils.getNowDate());
|
|
sysUser.setCreateTime(XIDateTimeUtils.getNowDate());
|
|
sysUser.setUpdateTime(sysUser.getCreateTime());
|
|
sysUser.setUpdateTime(sysUser.getCreateTime());
|
|
|
|
|
|
- sysUser.setUserType(UserType.main.getIndex());
|
|
|
|
- sysUser.setRoleids(RoleType.normal.getIndex());
|
|
|
|
-
|
|
|
|
- sysUser.setFuncids(LoginMedia.DATAWEB.getDesc());
|
|
|
|
-
|
|
|
|
- sysUser.setUsername(getA_a00003().getUserName());
|
|
|
|
sysUser.setNickname(getA_a00003().getUserName());//默认
|
|
sysUser.setNickname(getA_a00003().getUserName());//默认
|
|
|
|
+ sysUser.setUsername(getA_a00003().getUserName());
|
|
|
|
|
|
- sysUser.setHeadPortait("head");
|
|
|
|
-
|
|
|
|
- sysUser.setUserdnflag(Integer.parseInt(UserDnType.normal.getIndex()));
|
|
|
|
- sysUser.setUsersex(Short.parseShort(SexType.man.getIndex()));//默认为男
|
|
|
|
|
|
+ sysUser.setUserdnflag(0);//不需要证书
|
|
|
|
+ sysUser.setUsersex((short) Integer.parseInt(SexType.man.getIndex()));//默认为男
|
|
sysUser.setScore(0);
|
|
sysUser.setScore(0);
|
|
|
|
|
|
//3DES解密密码
|
|
//3DES解密密码
|
|
@@ -89,32 +84,34 @@ public class A00003Service extends A00003BaseModel implements ExecProcessFlow {
|
|
String passwordCrypted = LoginService.encodePassword(sysUser.getId(), passwordDecrypted);
|
|
String passwordCrypted = LoginService.encodePassword(sysUser.getId(), passwordDecrypted);
|
|
sysUser.setUserpwd(passwordCrypted);
|
|
sysUser.setUserpwd(passwordCrypted);
|
|
|
|
|
|
|
|
+
|
|
|
|
+ // sysUser.setUserRole(UserRole.visitor.getIndex());
|
|
|
|
+
|
|
sysUserDAO.insertSelective(sysUser);
|
|
sysUserDAO.insertSelective(sysUser);
|
|
|
|
|
|
UtilTools.removeUserCache(verifyTokenKey);
|
|
UtilTools.removeUserCache(verifyTokenKey);
|
|
-
|
|
|
|
- } else {
|
|
|
|
|
|
+ }else{
|
|
throw new BusinessException("EB8000021");
|
|
throw new BusinessException("EB8000021");
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 基础系统,“注册”业务前处理
|
|
|
|
|
|
+ * 基础系统,“手机注册”业务前处理
|
|
*/
|
|
*/
|
|
public void preTransFlow() throws Exception {
|
|
public void preTransFlow() throws Exception {
|
|
this.validater();
|
|
this.validater();
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 基础系统,“注册”业务后处理
|
|
|
|
|
|
+ * 基础系统,“手机注册”业务后处理
|
|
*/
|
|
*/
|
|
- public void afterTransFlow() throws Exception {
|
|
|
|
|
|
+ public void afterTransFolw() throws Exception {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 基础系统,“注册”逻辑入口处理方法
|
|
|
|
|
|
+ * 基础系统,“手机注册”逻辑入口处理方法
|
|
*/
|
|
*/
|
|
@SuppressWarnings("rawtypes")
|
|
@SuppressWarnings("rawtypes")
|
|
@Override
|
|
@Override
|
|
@@ -122,7 +119,7 @@ public class A00003Service extends A00003BaseModel implements ExecProcessFlow {
|
|
this.setTransMap(vars);
|
|
this.setTransMap(vars);
|
|
preTransFlow();// 执行业务开始的规则检查和校验
|
|
preTransFlow();// 执行业务开始的规则检查和校验
|
|
transExecute();// 执行核心业务段
|
|
transExecute();// 执行核心业务段
|
|
- afterTransFlow();// 执行核心逻辑完成后的收尾逻辑
|
|
|
|
|
|
+ afterTransFolw();// 执行核心逻辑完成后的收尾逻辑
|
|
return this.getTransMap();
|
|
return this.getTransMap();
|
|
}
|
|
}
|
|
|
|
|