20171019

/**
* 需要三个参数 1.电话号码 2.注册人姓名 3.加密后的密码
* */
public static JSONObject queryIsActivation(JSONObject params, ActionContext context) throws SQLException, NamingException {
Connection conn = context.getConnection(DATASOURCE_X5SYS);
JSONObject json = new JSONObject();
String success = null;
HttpServletRequest request = (HttpServletRequest)context.get(ActionContext.REQUEST);
WorkUtil util = new WorkUtil();

String phone = params.getString("phone");
String name = params.getString("name");
String password = params.getString("password");
String uuid = params.getString("uuid");

String sendTime = (String) request.getSession().getAttribute(phone+"Time");
long diff = util.getDateDiff(sendTime, util.getDateFormat(new Date(System.currentTimeMillis()), "yyyy-MM-dd HH:mm:ss"));
diff=0;
if(diff/1000>60){
success = "短信验证超时";
}else{
String phoneSql = "select * from sa_oporg where sPhone = '"+phone+"'";
Table table = DataUtils.queryData(conn, phoneSql, null, null, null, null);
Iterator iterator = table.getRows().iterator();

PreparedStatement ps=null;

if(iterator.hasNext()){
Row info = iterator.next();
String sID = info.getString("sID").split("@")[0];
String dptID =  info.getString("sID").split("@")[1];
String sql = "update sa_oporg set sPersonID = '"+sID+"' where sPhone = '"+phone+"'";
ps = conn.prepareStatement(sql);
ps.executeUpdate();
ps = conn.prepareStatement("insert into sa_opperson (sID,sMobilePhone,sLoginName,sCode,sName,sNumb,sMainOrgID,sPasswordTimeLimit,sPasswordModifyTime,sValidState,sPassword,sFunRole) VALUES(?,?,?,?,?,?,?,?,SYSDATE(),?,?,?)");
ps.setString(1, sID);
ps.setString(2, phone);
ps.setString(3, phone);
ps.setString(4, phone);
ps.setString(5, name);
ps.setInt(6, 00000000);
ps.setString(7, dptID);
ps.setInt(8, 90);
//ps.setDate(9, new Date(System.currentTimeMillis()));
ps.setInt(9,1);
ps.setString(10,password);
ps.setInt(11,3);
try{
int i =ps.executeUpdate();
if(i>0){
success = "注册成功!";
}
}catch(SQLException e){
success = "手机号已被注册!";
}
}else{
ps = conn.prepareStatement("insert into sa_opperson (sID,sMobilePhone,sLoginName,sCode,sName,sNumb,sMainOrgID,sPasswordTimeLimit,sPasswordModifyTime,sValidState,sPassword,sFunRole) VALUES(?,?,?,?,?,?,?,?,SYSDATE(),?,?,?)");
ps.setString(1, uuid);
ps.setString(2, phone);
ps.setString(3, phone);
ps.setString(4, phone);
ps.setString(5, name);
ps.setInt(6, 00000000);
ps.setString(7, "");
ps.setInt(8, 90);
//ps.setDate(9, new Date(System.currentTimeMillis()));
ps.setInt(9,1);
ps.setString(10,password);
ps.setInt(11,3);
try{
int i =ps.executeUpdate();
if(i>0){
success = "注册成功!";
}
}catch(SQLException e){
success = "手机号已被注册!";
}
}
}
json.put("status",success);
return json;

}

fRoleName fRoleID
system 18850242421
 m.sName,m.sID,m.sLoginName,m.sPassword,m.sMainOrgID,m.sDorgName,m.sDorgID
//设置本地缓存
localStorage.setItem("name",a);
localStorage.setItem("pass",b);
localStorage.setItem("id","fasdfe442433");
var name = localStorage.getItem("name"); 
String sql ="select m.fID,m.fPtzhuangID,m.fPtzhuangN,m.fWorkType,m.fProjectName,n.fID,n.fPtfID,n.fPtfMasterID,n.fWorkType,n.fID,n.fMsterID,n.fTeamName,n.f


data1.setValue("fPtzhuangN",fID);//填写项目桩ID,同步ID
"C7B9D333563000018AA98C101FC02110"

你可能感兴趣的:(学习笔记)