|
|
@@ -70,75 +70,75 @@ public class StoreHelper extends BaseClass {
|
|
|
}
|
|
|
|
|
|
//改为经销商员工类型
|
|
|
- public void updateUserType22(Controller controller) throws YosException {
|
|
|
- updateUserType(controller, 22);
|
|
|
+ public void updateUserType22(Controller controller,Long userid) throws YosException {
|
|
|
+ updateUserType(controller, userid,22);
|
|
|
|
|
|
ArrayList<Long> deleteroles = dbConnect.runSqlQuery("SELECT visitor_roleid from sys_wechatapp WHERE (systemclient='"
|
|
|
+ controller.systemclient + "' or systemclient_auth='" + controller.systemclient + "' ) and siteid='" + controller.siteid + "' and isvisitor=1").toArrayList("visitor_roleid", new ArrayList<>());
|
|
|
|
|
|
if (deleteroles.size() > 0) {
|
|
|
- deleteUserRole(controller, deleteroles);
|
|
|
+ deleteUserRole(controller, userid,deleteroles);
|
|
|
}
|
|
|
|
|
|
Rows rows = dbConnect.runSqlQuery("select * from sys_role where rolename='" + Parameter.get("storerolename") + "' and siteid='" + controller.siteid + "'");
|
|
|
if (rows.isNotEmpty()) {
|
|
|
- insertUserRole(controller, rows.get(0).getLong("roleid"));
|
|
|
+ insertUserRole(controller,userid, rows.get(0).getLong("roleid"));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public void updateUserType1(Controller controller) throws YosException {
|
|
|
- updateUserType(controller, 1);
|
|
|
+ public void updateUserType1(Controller controller,Long userid) throws YosException {
|
|
|
+ updateUserType(controller,userid, 1);
|
|
|
|
|
|
ArrayList<Long> deleteroles = dbConnect.runSqlQuery("SELECT visitor_roleid from sys_wechatapp WHERE (systemclient='"
|
|
|
+ controller.systemclient + "' or systemclient_auth='" + controller.systemclient + "' ) and siteid='" + controller.siteid + "' and isvisitor=1").toArrayList("visitor_roleid", new ArrayList<>());
|
|
|
|
|
|
if (deleteroles.size() > 0) {
|
|
|
- deleteUserRole(controller, deleteroles);
|
|
|
+ deleteUserRole(controller,userid, deleteroles);
|
|
|
}
|
|
|
|
|
|
Rows rows = dbConnect.runSqlQuery("select * from sys_role where issystem=1 and usertype=1 and siteid='" + controller.siteid + "'");
|
|
|
if (rows.isNotEmpty()) {
|
|
|
- insertUserRole(controller, rows.get(0).getLong("roleid"));
|
|
|
+ insertUserRole(controller,userid, rows.get(0).getLong("roleid"));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public void updateUserType99(Controller controller) throws YosException {
|
|
|
- updateUserType(controller, 99);
|
|
|
+ public void updateUserType99(Controller controller,Long userid) throws YosException {
|
|
|
+ updateUserType(controller, userid,99);
|
|
|
|
|
|
ArrayList<Long> deleteroles = dbConnect.runSqlQuery("select * from sys_role where rolename='" + Parameter.get("storerolename") + "' and siteid='" + controller.siteid + "'").toArrayList("roleid", new ArrayList<>());
|
|
|
|
|
|
if (deleteroles.size() > 0) {
|
|
|
- deleteUserRole(controller, deleteroles);
|
|
|
+ deleteUserRole(controller,userid, deleteroles);
|
|
|
}
|
|
|
Rows rows = dbConnect.runSqlQuery("SELECT visitor_roleid from sys_wechatapp WHERE (systemclient='" + controller.systemclient + "' or systemclient_auth='" + controller.systemclient + "' ) and siteid='" + controller.siteid + "' and isvisitor=1");
|
|
|
|
|
|
if (rows.isNotEmpty()) {
|
|
|
- insertUserRole(controller, rows.get(0).getLong("visitor_roleid"));
|
|
|
+ insertUserRole(controller,userid, rows.get(0).getLong("visitor_roleid"));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
- public void updateUserType(Controller controller, int usertype) throws YosException {
|
|
|
+ public void updateUserType(Controller controller,Long userid, int usertype) throws YosException {
|
|
|
UpdateSQL updateSQL = SQLFactory.createUpdateSQL(controller, "sys_usersite");
|
|
|
updateSQL.setSiteid(controller.siteid);
|
|
|
- updateSQL.setWhere("userid", controller.userid);
|
|
|
+ updateSQL.setWhere("userid", userid);
|
|
|
updateSQL.setValue("usertype", usertype);
|
|
|
updateSQL.update();
|
|
|
}
|
|
|
|
|
|
- public void deleteUserRole(Controller controller, ArrayList<Long> deleteroles) throws YosException {
|
|
|
+ public void deleteUserRole(Controller controller,Long userid, ArrayList<Long> deleteroles) throws YosException {
|
|
|
DeleteSQL deleteSQL = SQLFactory.createDeleteSQL(controller, "sys_userrole");
|
|
|
deleteSQL.setSiteid(controller.siteid);
|
|
|
- deleteSQL.setWhere("userid", controller.userid);
|
|
|
+ deleteSQL.setWhere("userid", userid);
|
|
|
deleteSQL.setWhere("roleid", deleteroles);
|
|
|
deleteSQL.delete();
|
|
|
}
|
|
|
|
|
|
- public void insertUserRole(Controller controller, Long roleid) throws YosException {
|
|
|
+ public void insertUserRole(Controller controller,Long userid, Long roleid) throws YosException {
|
|
|
InsertSQL insertSQL = SQLFactory.createInsertSQL(controller, "sys_userrole");
|
|
|
insertSQL.setSiteid(controller.siteid);
|
|
|
insertSQL.setUniqueid(createTableID("sys_userrole"));
|
|
|
- insertSQL.setValue("userid", controller.userid);
|
|
|
+ insertSQL.setValue("userid",userid);
|
|
|
insertSQL.setValue("roleid", roleid);
|
|
|
insertSQL.insert();
|
|
|
}
|