validform验证是一种非常方便的,实用的验证方式

对于需要验证后台数据的,validform是一个非常明智的选择

validform的ajaxurl属性能够完美的实现:当输入完成某一输入框,就会调用后台方法进行验证,如果符合要求就返回y,如果不符合要求就返回n

现在以添加乡镇信息为例作为讲解:

业务需求:用户录入乡镇信息,包括乡镇编码和乡镇名称,每当输入完成编号或名称光标移开的时候,就要验证编码或者名称是否在数据库中已经存在,如果存在,那么就提示进行重新输入,如果不存在就提示编码或名称可用

用户界面:

前台页面:

  1. <%@ page pageEncoding="UTF-8" contentType="text/html;charset=UTF-8"%>
  2. <%@ include file="/back/main/include/baseInclude.jsp" %>
  3. <html>
  4. <head>
  5. <title>个人设置</title>
  6. <meta name="menu" content="user" />
  7. <link href="${basePath}/common/css/table.css" rel="stylesheet" type="text/css" />
  8. <script src="${basePath}/common/js/validform.min.js" type="text/javascript" ></script>
  9. <script src="${basePath}/common/js/validform_datatype.js" type="text/javascript" ></script>
  10. <script src="${basePath}/back/user/js/dealerUser.js" type="text/javascript"></script>
  11. </head>
  12.  
  13. <body style="text-align:left;">
  14. <input type="hidden" id="basePath" value="${basePath}"/>
  15. <h3 style="text-align:center;">个人设置</h3>
  16. <s:form name="myform" action="personalSettings.action" method="post" id="pageform">
  17. <table id="mytable" cellspacing="" summary="个人设置">
  18. <caption>
  19. 个人信息
  20. <a style="float:right;margin:0 -100px" href="javascript:history.go(-1);">返回</a>
  21. </caption>
  22. <tr>
  23. <th scope="col" style="width:100px;text-align:right;" class="specalt">帐号:</th>
  24. <td scope="col" class="alt" style="text-align: left;">
  25. ${operatorUser.loginName}
  26. </td>
  27. </tr>
  28. <tr>
  29. <th scope="col" style="width:100px;text-align:right;" class="specalt">旧密码:</th>
  30. <td scope="col" class="alt" style="text-align: left;">
  31. <input type="password" name="oldPass" nullmsg="请填写密码!" datatype="*6-20" errormsg="密码范围在6~20位之间!" ajaxurl="checkPassword.action" />
  32. </td>
  33. </tr>
  34. <tr>
  35. <th scope="col" style="width:100px;text-align:right;" class="specalt">密码:</th>
  36. <td scope="col" class="alt" style="text-align: left;">
  37. <input type="password" name="operatorUser.password" id="password" nullmsg="请填写密码!" datatype="*6-20" errormsg="密码范围在6~20位之间!" ajaxurl="checkNewPassword.action" />
  38. </td>
  39. </tr>
  40. <tr>
  41. <th scope="col" style="width:100px;text-align:right;" class="specalt">确认密码:</th>
  42. <td scope="col" class="alt" style="text-align: left;">
  43. <input type="password" nullmsg="请再输入一次密码!" recheck="operatorUser.password" datatype="*" />
  44. </td>
  45. </tr>
  46. <tr>
  47. <th scope="col" style="width:100px;text-align:right;" class="specalt">原授权码:</th>
  48. <td scope="col" class="alt" style="text-align: left;">
  49. <input type="password" nullmsg="请填写授权码!" datatype="*6-20" errormsg="授权码范围在6~20位之间!" ajaxurl="checkAuthorizepwd.action" />
  50. </td>
  51. </tr>
  52. <tr>
  53. <th scope="col" style="width:100px;text-align:right;" class="specalt">授权码:</th>
  54. <td scope="col" class="alt" style="text-align: left;">
  55. <input type="password" nullmsg="请填写授权码!" name="operatorUser.authorizepwd" datatype="*6-20" errormsg="授权码范围在6~20位之间!" />
  56. </td>
  57. </tr>
  58. <tr>
  59. <th scope="col" style="width:100px;text-align:right;" class="specalt">真实姓名:</th>
  60. <td scope="col" class="alt" style="text-align: left;">
  61. <input type="text" name="operatorUser.userName" id="userName" value="${operatorUser.userName}" nullmsg="请填写真实姓名!" datatype="*" />
  62. </td>
  63. </tr>
  64. <tr>
  65. <th scope="col" style="width:100px;text-align:right;" class="specalt">email:</th>
  66. <td scope="col" class="alt" style="text-align: left;">
  67. <input type="text" name="operatorUser.email" id="email" value="${operatorUser.email}" nullmsg="请填写邮箱信息!" datatype="e" errormsg="请填写正确的邮箱地址!" />
  68. </td>
  69. </tr>
  70. <tr>
  71. <td colspan="">
  72. <input type="submit" onclick="return checkField();" value="确 定"/>
  73. <input type="button" onclick="qxBtn();" value="取 消"/>
  74. </td>
  75. </tr>
  76. </table>
  77. </s:form>
  78. </body>
  79.  
  80. </html>

后台代码实现:

  1. import java.text.SimpleDateFormat;
  2. import java.util.*;
  3. import java.util.regex.Matcher;
  4. import java.util.regex.Pattern;
  5. import javax.annotation.Resource;
  6. import org.apache.commons.lang.StringUtils;
  7. import org.apache.log4j.Logger;
  8. import org.springframework.context.annotation.Scope;
  9. import org.springframework.stereotype.Controller;
  10. import com.hsmpay.back.action.base.BackBaseAction;
  11. import com.hsmpay.back.pojo.organization.Organization;
  12. import com.hsmpay.back.pojo.system.Role;
  13. import com.hsmpay.back.pojo.user.OperatorUser;
  14. import com.hsmpay.back.service.organization.OrganizationService;
  15. import com.hsmpay.back.service.system.RoleService;
  16. import com.hsmpay.back.service.user.OperatorUserService;
  17. import com.hsmpay.back.util.GlobalConstant;
  18. import com.hsmpay.back.util.PageDown;
  19. import com.hsmpay.common.util.MD5;
  20.  
  21. /**
  22. * 后台用户action
  23. * @author 颜铃璋
  24. * @version 1.0
  25. * @date 2012-11-28
  26. */
  27. @Controller("operatorUserAction")
  28. @Scope("prototype")
  29. public class OperatorUserAction extends BackBaseAction{
  30. private static final long serialVersionUID = -5319745710227353987L;
  31. static Logger log = Logger.getLogger(OperatorUserAction.class);
  32. private OperatorUser operatorUser;//jsp直接引用或传参 操作员对象
  33. private List<OperatorUser> operatorUserList;
  34. private List<Role> roleList;//角色列表
  35. private List<Organization> organizationList;//后台操作员列表
  36.  
  37. @Resource(name="roleService")
  38. private RoleService<Role,Long> roleService;
  39. @Resource(name="organizationService")
  40. private OrganizationService<Organization,Long> organizationService;//
  41.  
  42. @Resource(name="operatorUserService")
  43. private OperatorUserService<OperatorUser,Long> operatorUserService;//操作员服务对象
  44. //机构
  45. private Organization organization;
  46.  
  47. /**
  48. * 授权码验证
  49. * @return
  50. * @throws Exception
  51. */
  52. public String passWordVerify() throws Exception{
  53. try{
  54. log.debug("*****************进入密码验证*******************");
  55.  
  56. String password = getRequest().getParameter("password");
  57. // String type = getRequest().getParameter("type");
  58.  
  59. if(null == password||"".equals(password)){
  60. sendAjaxResponse("传递参数错误!!");
  61. return null;
  62. }
  63.  
  64. if(getSessionUser()==null){
  65. sendAjaxResponse("noLogin");
  66. return null;
  67. }
  68.  
  69. operatorUser = new OperatorUser();
  70. operatorUser.setId(getSessionUser().getId());
  71. operatorUser.setAuthorizepwd(MD5.mD5ofStr(password));
  72. boolean tag = operatorUserService.checkAuthorizePassword(operatorUser);
  73. if(tag){//密码验证成功
  74. sendAjaxResponse("");
  75. }else{
  76. sendAjaxResponse("-1");
  77. }
  78. log.debug("*****************密码验证结束*******************");
  79. return null;
  80. }catch(Exception e){
  81. e.printStackTrace();
  82. throw e;
  83. }
  84. }
  85.  
  86. /**
  87. * 进入后台操作员列表 准备好 将要使用的数据
  88. * @return
  89. * @throws Exception
  90. */
  91. public String list()throws Exception{
  92. try{
  93.  
  94. log.debug("进入后台操作员list: OperatorUser "+(OperatorUser)getSession().getAttribute(SESSION_OPERATORUSER));
  95. log.debug("进入后台操作员list: checkOperatorUser "+checkOperatorUser());
  96. initRpo("OperatorUserAction");
  97. if(null == operatorUser){
  98. operatorUser = new OperatorUser();
  99. }else{
  100. String startDateStr = getRequest().getParameter("startDateStr");
  101. String endDateStr = getRequest().getParameter("endDateStr");
  102. SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  103. if(StringUtils.isNotBlank(startDateStr)){
  104. Date startDate = sdf.parse(startDateStr);
  105. operatorUser.setStartDate(startDate);
  106. }
  107. if(StringUtils.isNotBlank(endDateStr)){
  108. Date endDate = sdf.parse(endDateStr);
  109. operatorUser.setEndDate(endDate);
  110. }
  111. }
  112. operatorUser.setDeleted();
  113. //查询出所有的 关于你所在后台操作员的用户列表
  114. if(!GlobalConstant.ROOT_ORGANIZATIONID.equals(getSessionUser().getRpOrganId())){//如果不是管理员身份 查出用户所属后台操作员的用户列表
  115. //operatorUser.setLayer(getSessionUser().getLayer());
  116. operatorUser.setOrganizationId(getSessionUser().getRpOrganId());
  117. //operatorUserList = operatorUserService.searchEntityList(operatorUser);
  118. }
  119. // if(null != operatorUser.getOrganizationId()){//添加 层级
  120. // organization = organizationService.searchEntityById(Organization.class, operatorUser.getOrganizationId());
  121. // operatorUser.setLayer(organization.getLayer());
  122. // }
  123.  
  124. /* 屏蔽自己
  125. //operatorUser.setId(getSessionUser().getId()); */
  126.  
  127. PageDown pageDown = new PageDown(getCurrentPage(), ); //计算起始和终止的条数
  128. int categoryCount = (int)operatorUserService.getEntityCount(operatorUser);//计算总条数
  129. pageDown.setTotalRecordNumber(categoryCount); //总数存到分页方法里。
  130. operatorUser.setStart(pageDown.getStart());
  131. operatorUser.setStop(pageDown.getStop());
  132. operatorUserList = operatorUserService.searchEntityList(operatorUser);
  133. pagerString = pageDown.getScript();
  134.  
  135. //后台用户角色
  136. Role role = new Role();
  137. role.setLayer(operatorUser.getLayer());
  138. role.setDeleted();
  139. if(!ADMIN_ROLEID.equals(getSessionUser().getRoleId())){//如果是管理员 就显示所有角色
  140. role.setOrganizationId(operatorUser.getOrganizationId());
  141. //添加登录后台用户所属角色
  142. roleList = new LinkedList<Role>();
  143. roleList = roleService.searchEntityList(role);
  144. Role r = new Role();
  145. r.setId(getSessionUser().getRoleId());
  146. r = roleService.searchEntity(r);
  147. roleList.add(,r);
  148. }else{
  149. //添加登录后台用户所属角色
  150. roleList = roleService.searchEntityList(role);
  151. }
  152.  
  153. log.debug("退出后台操作员list");
  154.  
  155. if(GlobalConstant.ROOT_ORGANIZATIONID.equals(getSessionUser().getRpOrganId())){//如果不是顶级机构
  156. return "list";
  157. }else{
  158. return "agent_list";
  159. }
  160.  
  161. }catch(Exception e){
  162. e.printStackTrace();
  163. throw e;
  164. }
  165. }
  166.  
  167. /**
  168. * 删除单个后台用户
  169. * @return
  170. * @throws Exception
  171. */
  172. public String delete(){
  173. try{
  174. if(operatorUser.getId().equals(getSessionUser().getId())){
  175. log.warn("非法操作!您不能删除当前用户!");
  176. sendAjaxResponse("false");
  177. return null;
  178. }
  179. //删除后台用户
  180. // if(ZYZF_ORGANIZATIONID.equals(getSessionUser().getRpOrganId())){
  181. int flag = operatorUserService.logicDelete(operatorUser);
  182. if(flag > ){
  183. sendAjaxResponse("true");
  184. }else{
  185. sendAjaxResponse("false");
  186. }
  187. // }else{
  188. // notice = "非法操作!";
  189. // return "globalGoback";
  190. // }
  191. }catch(Exception e){
  192. e.printStackTrace();
  193. sendAjaxResponse("error");
  194. }
  195. return null;
  196. }
  197.  
  198. /**
  199. * 批量删除后台用户
  200. * @return
  201. * @throws Exception
  202. */
  203. public String batchDelete(){
  204. try{
  205. log.debug("批量删除后台用户"+ids);
  206. String[] idArray = ids.split(",");
  207. for(String id : idArray){
  208. if(id.equals(getSessionUser().getId())){
  209. log.warn("非法操作!您不能删除当前用户!");
  210. sendAjaxResponse("false");
  211. return null;
  212. }
  213. }
  214. // if(ZYZF_ORGANIZATIONID.equals(getSessionUser().getRpOrganId())){
  215. int flag = operatorUserService.logicDeletes(ids);
  216. if(flag > ){
  217. sendAjaxResponse("true");
  218. }else{
  219. sendAjaxResponse("false");
  220. }
  221. // }else{
  222. // notice = "非法操作!";
  223. // return "globalGoback";
  224. // }
  225. }catch(Exception e){
  226. e.printStackTrace();
  227. sendAjaxResponse("error");
  228. }
  229. return null;
  230. }
  231.  
  232. /**
  233. * 跳转到添加
  234. * @return
  235. * @throws Exception
  236. */
  237. public String addS() throws Exception{
  238. try{
  239. operatorUser = getSessionUser();
  240.  
  241. //登录用户所属机构
  242. Organization org = new Organization();
  243. org.setId(operatorUser.getOrganizationId());
  244. org = organizationService.searchEntity(org);
  245.  
  246. Role role = new Role();
  247.  
  248. List<Role> rList = new ArrayList<Role>();
  249. if(ADMIN_ROLEID.equals(operatorUser.getRoleId())){//超级管理员
  250. //登录用户所属机构角色
  251. role.setOrganizationId(operatorUser.getOrganizationId());
  252. role.setDeleted();
  253. roleList = roleService.searchEntityList(role);
  254. }else{
  255. if( == org.getType() && == operatorUser.getType()){//OEM管理员
  256. //登录用户所属机构角色
  257. role.setOrganizationId(operatorUser.getOrganizationId());
  258. role.setDeleted();
  259. roleList = roleService.searchEntityList(role);
  260. //特殊指定角色
  261. role = new Role();
  262. role.setAssignOrgId(org.getId());
  263. role.setDeleted();
  264. rList = roleService.searchEntityList(role);
  265. if(null != rList && rList.size() > ){
  266. roleList.addAll(, rList);
  267. }
  268. //OEM公有角色
  269. role = new Role();
  270. role.setType();
  271. role.setDeleted();
  272. rList = new ArrayList<Role>();
  273. rList = roleService.searchEntityList(role);
  274. if(null != rList || rList.size() > ){
  275. roleList.addAll(, rList);
  276. }
  277. }else if( < org.getType() && == operatorUser.getType()){//代理商管理员
  278. //登录用户所属机构角色
  279. role.setOrganizationId(operatorUser.getOrganizationId());
  280. role.setDeleted();
  281. roleList = roleService.searchEntityList(role);
  282. //特殊指定角色
  283. role = new Role();
  284. role.setAssignOrgId(org.getId());
  285. role.setDeleted();
  286. rList = roleService.searchEntityList(role);
  287. if(null != rList && rList.size() > ){
  288. roleList.addAll(, rList);
  289. }
  290. //代理商公有角色
  291. role = new Role();
  292. role.setType();
  293. role.setDeleted();
  294. rList = new ArrayList<Role>();
  295. rList = roleService.searchEntityList(role);
  296. if(null != rList || rList.size() > ){
  297. roleList.addAll(, rList);
  298. }
  299. }else if( == operatorUser.getType()){
  300. if(GlobalConstant.ROOT_ORGANIZATIONID.equals(operatorUser.getOrganizationId())){//顶层用户登录
  301. //顶级机构角色
  302. role.setOrganizationId(operatorUser.getOrganizationId());
  303. role.setIsOperatorRole();//不是超级管理员的角色
  304. role.setDeleted();
  305. roleList = roleService.searchEntityList(role);
  306. }else if( == org.getType()){//OEM用户登录
  307. role.setOrganizationId(org.getId());
  308. role.setDeleted();
  309. roleList = roleService.searchEntityList(role);
  310. //特殊指定角色
  311. role = new Role();
  312. role.setAssignOrgId(org.getId());
  313. role.setDeleted();
  314. rList = roleService.searchEntityList(role);
  315. if(null != rList && rList.size() > ){
  316. roleList.addAll(, rList);
  317. }
  318. //OEM公有角色
  319. role = new Role();
  320. role.setType();
  321. role.setDeleted();
  322. rList = new ArrayList<Role>();
  323. rList = roleService.searchEntityList(role);
  324. if(null != rList || rList.size() > ){
  325. roleList.addAll(, rList);
  326. }
  327. }else if( < org.getType()){//代理商用户登录
  328. role.setOrganizationId(org.getId());
  329. role.setDeleted();
  330. roleList = roleService.searchEntityList(role);
  331. //特殊指定角色
  332. role = new Role();
  333. role.setAssignOrgId(org.getId());
  334. role.setDeleted();
  335. rList = roleService.searchEntityList(role);
  336. if(null != rList && rList.size() > ){
  337. roleList.addAll(, rList);
  338. }
  339. //代理商公有角色
  340. role = new Role();
  341. role.setType();
  342. role.setDeleted();
  343. rList = new ArrayList<Role>();
  344. rList = roleService.searchEntityList(role);
  345. if(null != rList || rList.size() > ){
  346. roleList.addAll(, rList);
  347. }
  348. }
  349. }
  350. }
  351.  
  352. if(GlobalConstant.ROOT_ORGANIZATIONID.equals(operatorUser.getRpOrganId())){//如果不是顶级机构
  353. return "add";
  354. }else{
  355. return "agent_add";
  356. }
  357. /*
  358. if(WANJX_ORGANIZATIONID.equals(user.getRpOrganId())){//所属帐号
  359. Role role = new Role();
  360. // role.setLayer(user.getLayer());
  361. role.setDeleted(0);
  362. roleList = roleService.searchEntityList(role);
  363. return "add";
  364. }else{//代理商帐号跳转到添加经销商管理员界面 -- 弃用
  365. // Organization param = new Organization();
  366. // param.setParentId(user.getRpOrganId());
  367. // organizationList = organizationService.searchOrganizationNameList(param);
  368. // return "addDealer";
  369. notice = "非法操作!";
  370. return "globalGoback";
  371. }*/
  372. }catch(Exception e){
  373. e.printStackTrace();
  374. throw e;
  375. }
  376. }
  377.  
  378. /**
  379. * 添加或修改用户时,根据选择的角色查询角色机构
  380. * @return
  381. * @throws Exception
  382. */
  383. public String searchRoleRpOrganIDAndName()throws Exception{
  384. try{
  385. String roleId = getRequest().getParameter("roleId");
  386. if(StringUtils.isBlank(roleId)){
  387. notice = "非法操作!";
  388. return "globalGoback";
  389. }
  390. Role role = new Role();
  391. role.setId(Long.parseLong(roleId));
  392. role = roleService.searchEntity(role);
  393. Map<String,Object> element = new LinkedHashMap<String,Object>();
  394. element.put("rpOrganName", role.getOrganizationName());
  395. element.put("rpOrganId", role.getOrganizationId());
  396. sendAjaxResponse(element);
  397. return null;
  398. }catch(Exception e){
  399. e.printStackTrace();
  400. throw e;
  401. }
  402. }
  403.  
  404. /**
  405. * 添加经销商管理员
  406. * @return
  407. * @throws Exception
  408. */
  409. // public String addDealer() throws Exception{
  410. // try{
  411. // log.debug("************* 添加经销商管理员操作开始 ******************");
  412. // //判断是否为其所属经销商机构
  413. // Organization params = new Organization();
  414. // params.setId(operatorUser.getRpOrganId());
  415. // params.setParentId(getSessionUser().getRpOrganId());
  416. // params = organizationService.searchEntity(params);
  417. // if(null == params){
  418. // notice = "非法操作!";
  419. // return "globalGoback";
  420. // }
  421. // //所属代理商、角色
  422. // operatorUser.setOrganizationId(getSessionUser().getOrganizationId());
  423. // operatorUser.setRoleId(GlobalConstant.DEALER_ROLEID);//添加
  424. // long id = operatorUserService.insertEntity(operatorUser);
  425. // if(id > 0){//添加成功返回列表
  426. // return "listAction";
  427. // }else{//添加失败 返回登录页
  428. // notice = "添加失败!";
  429. // return "globalGoback";
  430. // }
  431. // }catch(Exception e){
  432. // e.printStackTrace();
  433. // throw e;
  434. // }finally{
  435. // log.debug("************* 添加经销商管理员操作结束 ******************");
  436. // }
  437. // }
  438.  
  439. /**
  440. * 添加后台操作员
  441. * @return
  442. * @throws Exception
  443. */
  444. public String add() throws Exception{
  445. try{
  446. //不能添加超级管理员
  447. if(ADMIN_ROLEID.equals(operatorUser.getRoleId())){
  448. notice = "非法操作!";
  449. return "globalGoback";
  450. }
  451. if(null == operatorUser.getRpOrganId()){
  452. notice = "非法操作!权限机构不能为空!";
  453. return "globalGoback";
  454. }
  455.  
  456. //--- 暂时所属机构与权限机构一致 均为 ---
  457. operatorUser.setOrganizationId(operatorUser.getRpOrganId());
  458. operatorUser.setType();//普通用户
  459.  
  460. operatorUser.setPassword(MD5.mD5ofStr(operatorUser.getLoginName()+operatorUser.getPassword()));
  461. operatorUser.setAuthorizepwd(MD5.mD5ofStr(operatorUser.getAuthorizepwd()));
  462. //添加
  463. long id = operatorUserService.insertEntity(operatorUser);
  464. if(id > ){//添加成功返回列表
  465. return "listAction";
  466. }else{//添加失败 返回登录页
  467. return "globalLogin";
  468. }
  469. }catch(Exception e){
  470. e.printStackTrace();
  471. throw e;
  472. }
  473. }
  474.  
  475. /**
  476. * 跳转到添加代理商管理员页面
  477. * @return
  478. * @throws Exception
  479. */
  480. public String addRootS() throws Exception{
  481. try{
  482. operatorUser = getSessionUser();
  483. /*if(!ADMIN_ROLEID.equals(operatorUser.getRoleId()) && !WANJX_ORGANIZATIONID.equals(operatorUser.getRpOrganId())){//不是管理员
  484. notice = "非法操作!";
  485. return "globalGoback";
  486. }
  487. if(WANJX_ORGANIZATIONID.equals(organization.getId())){
  488. notice = "非法操作!";
  489. return "globalGoback";
  490. }*/
  491. //代理商验证
  492. // Organization params = new Organization();
  493. // params.setId(organization.getId());
  494. // params = organizationService.searchEntity(params);
  495. if(1L == organization.getId()){
  496. notice = "非法操作,顶级机构不能添加管理员!";
  497. return "globalGoback";
  498. }
  499. Organization params = new Organization();
  500. params.setId(organization.getId());
  501. organization = organizationService.searchEntity(params);
  502. //查询 当前机构管理员是否存在 限制一个用户只能添加一个管理员
  503. OperatorUser paramUser = operatorUserService.searchOperatorUserByRoot(organization.getId());
  504. if(null != paramUser){//
  505. notice = "非法操作!该机构已经存在一个管理员了!";
  506. return "globalGoback";
  507. }
  508. return "addRootS";
  509. }catch(Exception e){
  510. e.printStackTrace();
  511. throw e;
  512. }
  513. }
  514.  
  515. public String addRoot() throws Exception{
  516. try{
  517. //要添加超级管理员 或者 要添加管理员
  518. /*if(ADMIN_ROLEID.equals(operatorUser.getRoleId()) || WANJX_ORGANIZATIONID.equals(operatorUser.getOrganizationId())){
  519. notice = "非法操作!";
  520. return "globalGoback";
  521. }*/
  522. if(null == operatorUser.getOrganizationId()){
  523. notice = "非法操作!权限机构不能为空!";
  524. return "globalGoback";
  525. }
  526.  
  527. //设置权限机构
  528. operatorUser.setRpOrganId(operatorUser.getOrganizationId());
  529. //设置此机构管理员角色 判断代理商或经销商
  530. Organization params = new Organization();
  531. params.setId(operatorUser.getOrganizationId());
  532. params = organizationService.searchEntity(params);
  533.  
  534. operatorUser.setPassword(MD5.mD5ofStr(operatorUser.getLoginName()+operatorUser.getPassword()));
  535. operatorUser.setAuthorizepwd(MD5.mD5ofStr(operatorUser.getAuthorizepwd()));
  536. if( == params.getType().intValue()){//OEM
  537. operatorUser.setRoleId(GlobalConstant.OEM_ROLEID);
  538. }else if( == params.getType().intValue()){//省代
  539. operatorUser.setRoleId(GlobalConstant.AGENT_ROLEID);//暂时没有定义
  540. }else if( == params.getType().intValue()){//市代
  541. operatorUser.setRoleId(GlobalConstant.AGENT_ROLEID);//暂时没有定义
  542. }else{//其他代理
  543. operatorUser.setRoleId(GlobalConstant.AGENT_ROLEID);
  544. }
  545. operatorUser.setType();
  546. operatorUserService.insertEntity(operatorUser);
  547.  
  548. //直接返回到 机构树形页面
  549. return "organizationList";
  550. }catch(Exception e){
  551. e.printStackTrace();
  552. throw e;
  553. }
  554. }
  555.  
  556. /**
  557. * 修改时 查询后台操作员
  558. * @return
  559. * @throws Exception
  560. */
  561. public String modifyS() throws Exception{
  562. try{
  563. log.debug("**************** 进入修改后台用户界面 ***********************");
  564. if(null!= operatorUser.getOrganizationId() && 1L == operatorUser.getOrganizationId()){//屏蔽最上级 多用户
  565. notice = "非法操作,顶级机构不能编辑管理员!";
  566. return "globalGoback";
  567. }
  568.  
  569. operatorUser = operatorUserService.searchEntity(operatorUser);
  570. if(null == operatorUser){
  571. notice = "非法操作,该机构暂时没有管理员不能编辑!";
  572. return "globalGoback";
  573. }
  574.  
  575. if(ADMIN_ROLEID.equals(operatorUser.getRoleId())){
  576. notice = "非法操作,超级管理员不能修改!";
  577. return "globalGoback";
  578. }
  579.  
  580. //被修改用户所属机构
  581. Organization org = new Organization();
  582. org.setId(operatorUser.getOrganizationId());
  583. org = organizationService.searchEntity(org);
  584.  
  585. Role role = new Role();
  586.  
  587. List<Role> rList = new ArrayList<Role>();
  588. if(ADMIN_ROLEID.equals(getSessionUser().getRoleId())){//超级管理员
  589. if(GlobalConstant.ROOT_ORGANIZATIONID.equals(org.getId())){//顶级机构
  590. role.setOrganizationId(org.getId());
  591. role.setDeleted();
  592. roleList = roleService.searchEntityList(role);
  593. }else if( == org.getType()){//OEM
  594. //机构所属角色
  595. role.setOrganizationId(org.getId());
  596. role.setDeleted();
  597. roleList = roleService.searchEntityList(role);
  598. //特殊指定角色
  599. role = new Role();
  600. role.setAssignOrgId(org.getId());
  601. role.setDeleted();
  602. rList = roleService.searchEntityList(role);
  603. if(null != rList && rList.size() > ){
  604. roleList.addAll(, rList);
  605. }
  606. //OEM公有角色
  607. role = new Role();
  608. role.setType();
  609. role.setDeleted();
  610. rList = new ArrayList<Role>();
  611. rList = roleService.searchEntityList(role);
  612. if(null != rList || rList.size() > ){
  613. roleList.addAll(, rList);
  614. }
  615. }else if( < org.getType()){//代理商
  616. //机构所属角色
  617. role.setOrganizationId(org.getId());
  618. role.setDeleted();
  619. roleList = roleService.searchEntityList(role);
  620. //特殊指定角色
  621. role = new Role();
  622. role.setAssignOrgId(org.getId());
  623. role.setDeleted();
  624. rList = roleService.searchEntityList(role);
  625. if(null != rList && rList.size() > ){
  626. roleList.addAll(, rList);
  627. }
  628. //代理商公有角色
  629. role = new Role();
  630. role.setType();
  631. role.setDeleted();
  632. rList = new ArrayList<Role>();
  633. rList = roleService.searchEntityList(role);
  634. if(null != rList || rList.size() > ){
  635. roleList.addAll(, rList);
  636. }
  637. }
  638. }else{
  639. if( == org.getType() && == getSessionUser().getType()){//OEM管理员
  640. //登录用户所属机构角色
  641. role.setOrganizationId(getSessionUser().getOrganizationId());
  642. role.setDeleted();
  643. roleList = roleService.searchEntityList(role);
  644. //特殊指定角色
  645. role = new Role();
  646. role.setAssignOrgId(org.getId());
  647. role.setDeleted();
  648. rList = roleService.searchEntityList(role);
  649. if(null != rList && rList.size() > ){
  650. roleList.addAll(, rList);
  651. }
  652. //OEM公有角色
  653. role = new Role();
  654. role.setType();
  655. role.setDeleted();
  656. rList = new ArrayList<Role>();
  657. rList = roleService.searchEntityList(role);
  658. if(null != rList || rList.size() > ){
  659. roleList.addAll(, rList);
  660. }
  661. }else if( < org.getType() && == getSessionUser().getType()){//代理商管理员
  662. //登录用户所属机构角色
  663. role.setOrganizationId(getSessionUser().getOrganizationId());
  664. role.setDeleted();
  665. roleList = roleService.searchEntityList(role);
  666. //特殊指定角色
  667. role = new Role();
  668. role.setAssignOrgId(org.getId());
  669. role.setDeleted();
  670. rList = roleService.searchEntityList(role);
  671. if(null != rList && rList.size() > ){
  672. roleList.addAll(, rList);
  673. }
  674. //代理商公有角色
  675. role = new Role();
  676. role.setType();
  677. role.setDeleted();
  678. rList = new ArrayList<Role>();
  679. rList = roleService.searchEntityList(role);
  680. if(null != rList || rList.size() > ){
  681. roleList.addAll(, rList);
  682. }
  683. }else if( == getSessionUser().getType()){
  684. if(GlobalConstant.ROOT_ORGANIZATIONID.equals(getSessionUser().getOrganizationId())){//顶层用户登录
  685. //顶级机构角色
  686. role.setOrganizationId(getSessionUser().getOrganizationId());
  687. role.setIsOperatorRole();//不是超级管理员的角色
  688. role.setDeleted();
  689. roleList = roleService.searchEntityList(role);
  690. }else if( == org.getType()){//OEM用户登录
  691. role.setOrganizationId(org.getId());
  692. role.setDeleted();
  693. roleList = roleService.searchEntityList(role);
  694. //特殊指定角色
  695. role = new Role();
  696. role.setAssignOrgId(org.getId());
  697. role.setDeleted();
  698. rList = roleService.searchEntityList(role);
  699. if(null != rList && rList.size() > ){
  700. roleList.addAll(, rList);
  701. }
  702. //OEM公有角色
  703. role = new Role();
  704. role.setType();
  705. role.setDeleted();
  706. rList = new ArrayList<Role>();
  707. rList = roleService.searchEntityList(role);
  708. if(null != rList || rList.size() > ){
  709. roleList.addAll(, rList);
  710. }
  711. }else if( < org.getType()){//代理商用户登录
  712. role.setOrganizationId(org.getId());
  713. role.setDeleted();
  714. roleList = roleService.searchEntityList(role);
  715. //特殊指定角色
  716. role = new Role();
  717. role.setAssignOrgId(org.getId());
  718. role.setDeleted();
  719. rList = roleService.searchEntityList(role);
  720. if(null != rList && rList.size() > ){
  721. roleList.addAll(, rList);
  722. }
  723. //代理商公有角色
  724. role = new Role();
  725. role.setType();
  726. role.setDeleted();
  727. rList = new ArrayList<Role>();
  728. rList = roleService.searchEntityList(role);
  729. if(null != rList || rList.size() > ){
  730. roleList.addAll(, rList);
  731. }
  732. }
  733. }
  734. }
  735.  
  736. return "modify";
  737. // if(WANJX_ORGANIZATIONID.equals(user.getRpOrganId())){//所属帐号
  738. // Role role = new Role();
  739. //// role.setLayer(user.getLayer());
  740. // role.setDeleted(0);
  741. // roleList = roleService.searchEntityList(role);
  742. // return "modify";
  743. // }else{
  744. //// Organization param = new Organization();
  745. //// param.setParentId(user.getRpOrganId());
  746. //// organizationList = organizationService.searchOrganizationNameList(param);
  747. //// return "modifyDealer";
  748. // notice = "非法操作!";
  749. // return "globalGoback";
  750. // }
  751. }catch(Exception e){
  752. e.printStackTrace();
  753. throw e;
  754. }finally{
  755. log.debug("**************** 进入修改后台用户界面完成 ***********************");
  756. }
  757. }
  758.  
  759. /**
  760. * 修改经销商管理员
  761. * @return
  762. * @throws Exception
  763. */
  764. // public String modifyDealer() throws Exception{
  765. // try{
  766. // log.debug("************* 修改经销商管理员操作开始 ******************");
  767. // //判断是否为其所属经销商机构
  768. // Organization params = new Organization();
  769. // params.setId(operatorUser.getRpOrganId());
  770. // params.setParentId(getSessionUser().getRpOrganId());
  771. // params = organizationService.searchEntity(params);
  772. // if(null == params){
  773. // notice = "非法操作!";
  774. // return "globalGoback";
  775. // }
  776. // //所属代理商、角色
  777. // operatorUser.setOrganizationId(getSessionUser().getOrganizationId());
  778. // operatorUser.setRoleId(GlobalConstant.DEALER_ROLEID);//添加
  779. // long id = operatorUserService.updateEntity(operatorUser);
  780. // if(id > 0){//添加成功返回列表
  781. // return "listAction";
  782. // }else{//添加失败 返回登录页
  783. // notice = "修改失败!";
  784. // return "globalGoback";
  785. // }
  786. // }catch(Exception e){
  787. // e.printStackTrace();
  788. // throw e;
  789. // }finally{
  790. // log.debug("************* 修改经销商管理员操作结束 ******************");
  791. // }
  792. // }
  793.  
  794. /**
  795. * 修改后台操作员
  796. * @return
  797. * @throws Exception
  798. */
  799. public String modify() throws Exception{
  800. try{
  801. if(null == operatorUser.getRpOrganId()){
  802. notice = "非法操作!权限机构不能为空!";
  803. return "globalGoback";
  804. }
  805.  
  806. //不能修改为超级管理员 非管理员角色不能修改
  807. if(ADMIN_ROLEID.equals(operatorUser.getRoleId()) ){//|| !ADMIN_ROLEID.equals(getSessionUser().getRoleId())
  808. notice = "非法操作,超级管理员不能修改!";
  809. return "globalGoback";
  810. }
  811. //查询角色 所对应的机构ID
  812. // Role role = new Role();
  813. // role.setId(operatorUser.getRoleId());
  814. // role = roleService.searchEntity(role);
  815. if(operatorUser.getRoleId() != GlobalConstant.DEALER_ROLEID){
  816. operatorUser.setOrganizationId(operatorUser.getRpOrganId());
  817. }
  818. int flag = ;
  819. operatorUser.setPassword(MD5.mD5ofStr(operatorUser.getLoginName()+operatorUser.getPassword()));
  820. // operatorUser.setAuthorizepwd(MD5.mD5ofStr(operatorUser.getAuthorizepwd()));
  821. if(ZYZF_ORGANIZATIONID.equals(operatorUser.getRpOrganId())){
  822. operatorUser.setAuthorizepwd(MD5.mD5ofStr(operatorUser.getAuthorizepwd()));
  823. flag = operatorUserService.updateEntity(operatorUser);
  824. }else{
  825. OperatorUser param = new OperatorUser();
  826. param.setId(operatorUser.getId());
  827. param.setPassword(operatorUser.getPassword());
  828. param.setUserName(operatorUser.getUserName());
  829. param.setEmail(operatorUser.getEmail());
  830. param.setRoleId(operatorUser.getRoleId());
  831. param.setRpOrganId(operatorUser.getRpOrganId());
  832. param.setOrganizationId(operatorUser.getRpOrganId());
  833. param.setMerchantId(operatorUser.getMerchantId());
  834. param.setAuthorizepwd(MD5.mD5ofStr(operatorUser.getAuthorizepwd()));
  835. flag = operatorUserService.updateEntity(param);
  836. }
  837. if(flag > ){//修改成功 返回列表
  838. OperatorUser param = new OperatorUser();
  839. param.setId(operatorUser.getId());
  840. operatorUser = operatorUserService.searchEntity(param);
  841. if(null != operatorUser.getType() && == operatorUser.getType().intValue()){
  842. //直接返回到 机构树形页面
  843. return "organizationList";
  844. }else{
  845. return "listAction";
  846. }
  847. }else{//修改失败 返回登录页面
  848. return "globalLogin";
  849. }
  850. }catch(Exception e){
  851. e.printStackTrace();
  852. throw e;
  853. }
  854. }
  855.  
  856. /**
  857. * 检测登录名是否已经存在
  858. * @throws Exception
  859. */
  860. public void checkName() throws Exception{
  861. try{
  862. String name = getRequest().getParameter("param");
  863. log.debug("************ 检测用户名: "+name+" 是否存在 ************");
  864. Map<String,Object> element = new LinkedHashMap<String,Object>();
  865. OperatorUser params = new OperatorUser();
  866. params.setLoginName(name);
  867. params.setDeleted();
  868. int flag = operatorUserService.getEntityCount(params);
  869.  
  870. //验证是否包含中文
  871. String regex = ".*?[\u4E00-\u9FFF]+.*";
  872. Pattern p = Pattern.compile(regex);
  873. Matcher m = p.matcher(name);
  874.  
  875. //验证是否包含特殊字符
  876. String regex1 = "[`~!@#$%^&*()+=|{}':;',\\[\\].<>/?~!@#¥%……&*()——+|{}【】‘;:”“’。,、?]";
  877. Pattern p1 = Pattern.compile(regex1);
  878. Matcher m1 = p1.matcher(name);
  879.  
  880. //验证是否全为数字
  881. String regex2 = "^[0-9]*$";
  882. Pattern p2 = Pattern.compile(regex2);
  883. Matcher m2 = p2.matcher(name);
  884.  
  885. if(flag > ){
  886. element.put("info", "用户名已存在!");
  887. element.put("status", "n");
  888. log.debug("************ 用户名: "+name+" 已存在 ************");
  889. }else if(m.matches()){
  890. element.put("info", "用户名不能包含中文!");
  891. element.put("status", "n");
  892. log.debug("************ 用户名: "+name+" 包含中文 ************");
  893. }else if(m1.find()){
  894. element.put("info", "用户名不能包含特殊字符!");
  895. element.put("status", "n");
  896. log.debug("************ 用户名: "+name+" 包含特殊字符 ************");
  897. }else if(m2.matches()){
  898. element.put("info", "用户名不能全为数字!");
  899. element.put("status", "n");
  900. log.debug("************ 用户名: "+name+" 全为数字 ************");
  901. }else{
  902. element.put("info", "用户名可以使用!");
  903. element.put("status", "y");
  904. log.debug("************ 用户名: "+name+" 可以使用 ************");
  905. }
  906. sendAjaxResponse(element);
  907. }catch(Exception e){
  908. e.printStackTrace();
  909. throw e;
  910. }
  911. }
  912.  
  913. /**
  914. * 检测旧密码是否正确
  915. * @throws Exception
  916. */
  917. public void checkPassword() throws Exception{
  918. try{
  919. log.debug("************ 检测旧密码开始 ************");
  920. String old=getRequest().getParameter("param");
  921. operatorUser = getSessionUser();
  922. String pass = MD5.mD5ofStr(operatorUser.getLoginName()+old);
  923. Map<String,Object> element = new LinkedHashMap<String,Object>();
  924. if(pass.equals(getSessionUser().getPassword())){
  925. element.put("info", "");
  926. element.put("status", "y");
  927. log.debug("************ 旧密码正确! ************");
  928. }else{
  929. element.put("info", "旧密码输入错误!");
  930. element.put("status", "n");
  931. log.debug("************ 旧密码错误! ************");
  932. }
  933. sendAjaxResponse(element);
  934. }catch(Exception e){
  935. e.printStackTrace();
  936. throw e;
  937. }finally{
  938. log.debug("************ 检测旧密码结束 ************");
  939. }
  940. }
  941.  
  942. /**
  943. * 检测新密码格式是否符合要求
  944. * @throws Exception
  945. */
  946. public void checkNewPassword() throws Exception{
  947. try{
  948. log.debug("************ 检测新密码格式是否符合要求开始 ************");
  949. String newPass = getRequest().getParameter("param");
  950.  
  951. String regex = "(?!^\\d+$)(?!^[a-zA-Z]+$)(?!^[_#@]+$).{6,}";//必须包含字母和数字
  952. Pattern p = Pattern.compile(regex);
  953. Matcher m = p.matcher(newPass);
  954.  
  955. Map<String,Object> element = new LinkedHashMap<String,Object>();
  956. if(m.matches()){
  957. element.put("info", "");
  958. element.put("status", "y");
  959. log.debug("************ 新密码格式符合要求! ************");
  960. }else{
  961. element.put("info", "密码必须包含字母和数字,请重新输入!");
  962. element.put("status", "n");
  963. log.debug("************ 新密码格式不符合要求! ************");
  964. }
  965. sendAjaxResponse(element);
  966. }catch(Exception e){
  967. e.printStackTrace();
  968. throw e;
  969. }finally{
  970. log.debug("************ 检测新密码格式是否符合要求结束 ************");
  971. }
  972. }
  973.  
  974. /**
  975. * 检测原授权码是否正确
  976. * @throws Exception
  977. */
  978. public void checkAuthorizepwd() throws Exception{
  979. try{
  980. log.debug("************ 检测原授权码开始 ************");
  981. String oldAuthorizepwd=getRequest().getParameter("param");
  982. String authorizepwd = MD5.mD5ofStr(oldAuthorizepwd);
  983. Map<String,Object> element = new LinkedHashMap<String,Object>();
  984. String auhol=getSessionUser().getAuthorizepwd();
  985. if(authorizepwd.equals(auhol)){
  986. element.put("info", "");
  987. element.put("status", "y");
  988. log.debug("************ 原授权码正确! ************");
  989. }else{
  990. element.put("info", "原授权码输入错误!");
  991. element.put("status", "n");
  992. log.debug("************ 原授权码错误! ************");
  993. }
  994. sendAjaxResponse(element);
  995. }catch(Exception e){
  996. e.printStackTrace();
  997. throw e;
  998. }finally{
  999. log.debug("************ 检测原授权码结束 ************");
  1000. }
  1001. }
  1002.  
  1003. /**
  1004. * 跳转至个人设置视图
  1005. * @return
  1006. * @throws Exception
  1007. */
  1008. public String prePersonalSettings() throws Exception{
  1009. try{
  1010. log.debug("************** 进入个人设置页面开始 ********************");
  1011. operatorUser = getSessionUser();
  1012. return "settings";
  1013. }catch(Exception e){
  1014. e.printStackTrace();
  1015. throw e;
  1016. }finally{
  1017. log.debug("************** 进入个人设置页面完成 ********************");
  1018. }
  1019. }
  1020.  
  1021. /**
  1022. * 个人设置
  1023. * @return
  1024. * @throws Exception
  1025. */
  1026. public String personalSettings() throws Exception{
  1027. try{
  1028. log.debug("************** 个人设置修改操作开始 ********************");
  1029. OperatorUser operaUserSession = getSessionUser();
  1030. String oldPass = MD5.mD5ofStr(operaUserSession.getLoginName()+getRequest().getParameter("oldPass"));
  1031. String password = MD5.mD5ofStr(operaUserSession.getLoginName()+operatorUser.getPassword());
  1032. if(oldPass.equals(getSessionUser().getPassword())){
  1033. OperatorUser user = new OperatorUser();
  1034. user.setId(getSessionUser().getId());
  1035. user.setRoleId(getSessionUser().getRoleId());
  1036. user.setOrganizationId(getSessionUser().getOrganizationId());
  1037. user.setLoginName(getSessionUser().getLoginName());
  1038. user.setRpOrganId(getSessionUser().getRpOrganId());
  1039. //个人设置里要更新的字段
  1040. user.setPassword(password);
  1041. user.setAuthorizepwd(MD5.mD5ofStr(operatorUser.getAuthorizepwd()));
  1042. user.setUserName(operatorUser.getUserName());
  1043. user.setEmail(operatorUser.getEmail());
  1044. int flag = operatorUserService.updateEntity(user);
  1045. if( < flag){
  1046. log.debug("******************* 个人设置修改成功 ********************");
  1047. //修改SESSION里保存的信息
  1048. getSessionUser().setPassword(password);
  1049. getSessionUser().setUserName(user.getUserName());
  1050. getSessionUser().setEmail(user.getEmail());
  1051. return "settingsAction";
  1052. }else{
  1053. log.debug("******************* 个人设置修改失败 ********************");
  1054. notice = "修改失败!";
  1055. return "globalGoback";
  1056. }
  1057. }else{
  1058. log.debug("******************* 旧密码输入错误,个人设置修改失败 ********************");
  1059. notice = "旧密码输入错误!!!";
  1060. return "globalGoback";
  1061. }
  1062. }catch(Exception e){
  1063. e.printStackTrace();
  1064. throw e;
  1065. }finally{
  1066. log.debug("************** 个人设置修改操作完成 ********************");
  1067. }
  1068. }
  1069.  
  1070. /**
  1071. * 将所有用户的密码 md5 加密
  1072. * @throws Exception
  1073. */
  1074. public String modifyAllUserPaswd()throws Exception{
  1075. try{
  1076. log.debug("************** 将所有用户的密码 md5 加密 ********************");
  1077. operatorUser = new OperatorUser();
  1078. operatorUserList = operatorUserService.searchEntityList(operatorUser);
  1079. OperatorUser param = new OperatorUser();
  1080. for(OperatorUser user : operatorUserList){
  1081. param.setId(user.getId());
  1082. param.setPassword(MD5.mD5ofStr(user.getLoginName()+user.getPassword()));
  1083. operatorUserService.updateEntity(param);
  1084. }
  1085. }catch(Exception e){
  1086. e.printStackTrace();
  1087. throw e;
  1088. }finally{
  1089. log.debug("************** 将所有用户的密码 md5 加密 ********************");
  1090. }
  1091. return null;
  1092. }
  1093.  
  1094. public String searchRoleList() throws Exception{
  1095. try {
  1096. List<Role> roleList = new LinkedList<Role>();
  1097. List<Role> rList = new ArrayList<Role>();
  1098. Role role = new Role();
  1099. String rpOrganId = getRequest().getParameter("rpOrganId");
  1100. if(StringUtils.isBlank(rpOrganId)){
  1101. notice = "非法操作!";
  1102. return "globalGoback";
  1103. }
  1104. //登录用户所属机构
  1105. Organization organ = new Organization();
  1106. organ.setId(getSessionUser().getOrganizationId());
  1107. organ = organizationService.searchEntity(organ);
  1108. //权限机构
  1109. Organization org = new Organization();
  1110. org.setId(Long.parseLong(rpOrganId));
  1111. org = organizationService.searchEntity(org);
  1112.  
  1113. if(ADMIN_ROLEID.equals(getSessionUser().getRoleId())){//超级管理员登录
  1114. if(GlobalConstant.ROOT_ORGANIZATIONID.equals(org.getId())){//顶级机构
  1115. role.setOrganizationId(org.getId());
  1116. role.setDeleted();
  1117. roleList = roleService.searchEntityList(role);
  1118. }else if( == org.getType()){//OEM
  1119. //机构所属角色
  1120. role.setOrganizationId(org.getId());
  1121. role.setDeleted();
  1122. roleList = roleService.searchEntityList(role);
  1123. //特殊指定角色
  1124. role = new Role();
  1125. role.setAssignOrgId(org.getId());
  1126. role.setDeleted();
  1127. rList = roleService.searchEntityList(role);
  1128. if(null != rList && rList.size() > ){
  1129. roleList.addAll(, rList);
  1130. }
  1131. //OEM公有角色
  1132. role = new Role();
  1133. role.setType();
  1134. role.setDeleted();
  1135. rList = new ArrayList<Role>();
  1136. rList = roleService.searchEntityList(role);
  1137. if(null != rList || rList.size() > ){
  1138. roleList.addAll(, rList);
  1139. }
  1140. }else if( < org.getType()){//代理商
  1141. //机构所属角色
  1142. role.setOrganizationId(org.getId());
  1143. role.setDeleted();
  1144. roleList = roleService.searchEntityList(role);
  1145. //特殊指定角色
  1146. role = new Role();
  1147. role.setAssignOrgId(org.getId());
  1148. role.setDeleted();
  1149. rList = roleService.searchEntityList(role);
  1150. if(null != rList && rList.size() > ){
  1151. roleList.addAll(, rList);
  1152. }
  1153. //代理商公有角色
  1154. role = new Role();
  1155. role.setType();
  1156. role.setDeleted();
  1157. rList = new ArrayList<Role>();
  1158. rList = roleService.searchEntityList(role);
  1159. if(null != rList || rList.size() > ){
  1160. roleList.addAll(, rList);
  1161. }
  1162. }
  1163. }else{
  1164. if( == getSessionUser().getType() && == organ.getType()){//OEM管理员登录
  1165. if( == org.getType()){//权限机构 OEM
  1166. //机构所属角色
  1167. role.setOrganizationId(org.getId());
  1168. role.setDeleted();
  1169. roleList = roleService.searchEntityList(role);
  1170. //特殊指定角色
  1171. role = new Role();
  1172. role.setAssignOrgId(org.getId());
  1173. role.setDeleted();
  1174. rList = roleService.searchEntityList(role);
  1175. if(null != rList && rList.size() > ){
  1176. roleList.addAll(, rList);
  1177. }
  1178. //OEM公有角色
  1179. role = new Role();
  1180. role.setType();
  1181. role.setDeleted();
  1182. rList = new ArrayList<Role>();
  1183. rList = roleService.searchEntityList(role);
  1184. if(null != rList || rList.size() > ){
  1185. roleList.addAll(, rList);
  1186. }
  1187. }else if( < org.getType()){//代理商
  1188. //机构所属角色
  1189. role.setOrganizationId(org.getId());
  1190. role.setDeleted();
  1191. roleList = roleService.searchEntityList(role);
  1192. //特殊指定角色
  1193. role = new Role();
  1194. role.setAssignOrgId(org.getId());
  1195. role.setDeleted();
  1196. rList = roleService.searchEntityList(role);
  1197. if(null != rList && rList.size() > ){
  1198. roleList.addAll(, rList);
  1199. }
  1200. //代理商公有角色
  1201. role = new Role();
  1202. role.setType();
  1203. role.setDeleted();
  1204. rList = new ArrayList<Role>();
  1205. rList = roleService.searchEntityList(role);
  1206. if(null != rList || rList.size() > ){
  1207. roleList.addAll(, rList);
  1208. }
  1209. }
  1210.  
  1211. }else if( == getSessionUser().getType() && < organ.getType()){//代理商管理员
  1212. //机构所属角色
  1213. role.setOrganizationId(org.getId());
  1214. role.setDeleted();
  1215. roleList = roleService.searchEntityList(role);
  1216. //特殊指定角色
  1217. role = new Role();
  1218. role.setAssignOrgId(org.getId());
  1219. role.setDeleted();
  1220. rList = roleService.searchEntityList(role);
  1221. if(null != rList && rList.size() > ){
  1222. roleList.addAll(, rList);
  1223. }
  1224. //代理商公有角色
  1225. role = new Role();
  1226. role.setType();
  1227. role.setDeleted();
  1228. rList = new ArrayList<Role>();
  1229. rList = roleService.searchEntityList(role);
  1230. if(null != rList || rList.size() > ){
  1231. roleList.addAll(, rList);
  1232. }
  1233. }else if( == getSessionUser().getType()){//普通用户
  1234. if(GlobalConstant.ROOT_ORGANIZATIONID.equals(getSessionUser().getOrganizationId())){//顶级机构用户登录
  1235. if(GlobalConstant.ROOT_ORGANIZATIONID.equals(org.getId())){//权限机构 顶级机构
  1236. //顶级机构角色
  1237. role.setOrganizationId(getSessionUser().getOrganizationId());
  1238. role.setIsOperatorRole();//不是超级管理员的角色
  1239. role.setDeleted();
  1240. roleList = roleService.searchEntityList(role);
  1241. }else if( == org.getType()){//权限机构 OEM
  1242. role.setOrganizationId(org.getId());
  1243. role.setDeleted();
  1244. roleList = roleService.searchEntityList(role);
  1245. //特殊指定角色
  1246. role = new Role();
  1247. role.setAssignOrgId(org.getId());
  1248. role.setDeleted();
  1249. rList = roleService.searchEntityList(role);
  1250. if(null != rList && rList.size() > ){
  1251. roleList.addAll(, rList);
  1252. }
  1253. //OEM公有角色
  1254. role = new Role();
  1255. role.setType();
  1256. role.setDeleted();
  1257. rList = new ArrayList<Role>();
  1258. rList = roleService.searchEntityList(role);
  1259. if(null != rList || rList.size() > ){
  1260. roleList.addAll(, rList);
  1261. }
  1262. }else if( < org.getType()){//权限机构 代理商
  1263. role.setOrganizationId(org.getId());
  1264. role.setDeleted();
  1265. roleList = roleService.searchEntityList(role);
  1266. //特殊指定角色
  1267. role = new Role();
  1268. role.setAssignOrgId(org.getId());
  1269. role.setDeleted();
  1270. rList = roleService.searchEntityList(role);
  1271. if(null != rList && rList.size() > ){
  1272. roleList.addAll(, rList);
  1273. }
  1274. //代理商公有角色
  1275. role = new Role();
  1276. role.setType();
  1277. role.setDeleted();
  1278. rList = new ArrayList<Role>();
  1279. rList = roleService.searchEntityList(role);
  1280. if(null != rList || rList.size() > ){
  1281. roleList.addAll(, rList);
  1282. }
  1283. }
  1284. }else if( == organ.getType()){//OEM普通用户登录
  1285. if( == org.getType()){//权限机构 OEM
  1286. role.setOrganizationId(org.getId());
  1287. role.setDeleted();
  1288. roleList = roleService.searchEntityList(role);
  1289. //特殊指定角色
  1290. role = new Role();
  1291. role.setAssignOrgId(org.getId());
  1292. role.setDeleted();
  1293. rList = roleService.searchEntityList(role);
  1294. if(null != rList && rList.size() > ){
  1295. roleList.addAll(, rList);
  1296. }
  1297. //OEM公有角色
  1298. role = new Role();
  1299. role.setType();
  1300. role.setDeleted();
  1301. rList = new ArrayList<Role>();
  1302. rList = roleService.searchEntityList(role);
  1303. if(null != rList || rList.size() > ){
  1304. roleList.addAll(, rList);
  1305. }
  1306. }else if( < org.getType()){//权限机构 代理商
  1307. role.setOrganizationId(org.getId());
  1308. role.setDeleted();
  1309. roleList = roleService.searchEntityList(role);
  1310. //特殊指定角色
  1311. role = new Role();
  1312. role.setAssignOrgId(org.getId());
  1313. role.setDeleted();
  1314. rList = roleService.searchEntityList(role);
  1315. if(null != rList && rList.size() > ){
  1316. roleList.addAll(, rList);
  1317. }
  1318. //代理商公有角色
  1319. role = new Role();
  1320. role.setType();
  1321. role.setDeleted();
  1322. rList = new ArrayList<Role>();
  1323. rList = roleService.searchEntityList(role);
  1324. if(null != rList || rList.size() > ){
  1325. roleList.addAll(, rList);
  1326. }
  1327. }
  1328. }else if( < organ.getType()){//代理商普通用户登录
  1329. role.setOrganizationId(org.getId());
  1330. role.setDeleted();
  1331. roleList = roleService.searchEntityList(role);
  1332. //特殊指定角色
  1333. role = new Role();
  1334. role.setAssignOrgId(org.getId());
  1335. role.setDeleted();
  1336. rList = roleService.searchEntityList(role);
  1337. if(null != rList && rList.size() > ){
  1338. roleList.addAll(, rList);
  1339. }
  1340. //代理商公有角色
  1341. role = new Role();
  1342. role.setType();
  1343. role.setDeleted();
  1344. rList = new ArrayList<Role>();
  1345. rList = roleService.searchEntityList(role);
  1346. if(null != rList || rList.size() > ){
  1347. roleList.addAll(, rList);
  1348. }
  1349. }
  1350. }
  1351. }
  1352.  
  1353. StringBuilder sb = new StringBuilder("");
  1354.  
  1355. for(Role r : roleList){
  1356. sb.append(r.getId()).append(",").append(r.getName()).append("<-->");
  1357. }
  1358.  
  1359. this.sendAjaxResponse(sb.toString());
  1360. return null;
  1361. } catch (Exception e) {
  1362. e.printStackTrace();
  1363. throw e;
  1364. }
  1365. }
  1366.  
  1367. public String searchRoleByOrgId() throws Exception{
  1368. try{
  1369. log.debug("***********************进入添加合作银行前 查询数据**********************");
  1370. List<Role> roleList = new LinkedList<Role>();
  1371. List<Role> rList = new ArrayList<Role>();
  1372. Role role = new Role();
  1373. String rpOrganId = getRequest().getParameter("rpOrganId");
  1374. if(StringUtils.isBlank(rpOrganId)){
  1375. notice = "非法操作!";
  1376. return "globalGoback";
  1377. }
  1378. //登录用户所属机构
  1379. Organization organ = new Organization();
  1380. organ.setId(getSessionUser().getOrganizationId());
  1381. organ = organizationService.searchEntity(organ);
  1382. //权限机构
  1383. Organization org = new Organization();
  1384. org.setId(Long.parseLong(rpOrganId));
  1385. org = organizationService.searchEntity(org);
  1386.  
  1387. if(ADMIN_ROLEID.equals(getSessionUser().getRoleId())){//超级管理员登录
  1388. if(GlobalConstant.ROOT_ORGANIZATIONID.equals(org.getId())){//顶级机构
  1389. role.setOrganizationId(org.getId());
  1390. role.setDeleted();
  1391. roleList = roleService.searchEntityList(role);
  1392. }else if( == org.getType()){//OEM
  1393. //机构所属角色
  1394. role.setOrganizationId(org.getId());
  1395. role.setDeleted();
  1396. roleList = roleService.searchEntityList(role);
  1397. //特殊指定角色
  1398. role = new Role();
  1399. role.setAssignOrgId(org.getId());
  1400. role.setDeleted();
  1401. rList = roleService.searchEntityList(role);
  1402. if(null != rList && rList.size() > ){
  1403. roleList.addAll(, rList);
  1404. }
  1405. //OEM公有角色
  1406. role = new Role();
  1407. role.setType();
  1408. role.setDeleted();
  1409. rList = new ArrayList<Role>();
  1410. rList = roleService.searchEntityList(role);
  1411. if(null != rList || rList.size() > ){
  1412. roleList.addAll(, rList);
  1413. }
  1414. }else if( < org.getType()){//代理商
  1415. //机构所属角色
  1416. role.setOrganizationId(org.getId());
  1417. role.setDeleted();
  1418. roleList = roleService.searchEntityList(role);
  1419. //特殊指定角色
  1420. role = new Role();
  1421. role.setAssignOrgId(org.getId());
  1422. role.setDeleted();
  1423. rList = roleService.searchEntityList(role);
  1424. if(null != rList && rList.size() > ){
  1425. roleList.addAll(, rList);
  1426. }
  1427. //代理商公有角色
  1428. role = new Role();
  1429. role.setType();
  1430. role.setDeleted();
  1431. rList = new ArrayList<Role>();
  1432. rList = roleService.searchEntityList(role);
  1433. if(null != rList || rList.size() > ){
  1434. roleList.addAll(, rList);
  1435. }
  1436. }
  1437. }else{
  1438. if( == getSessionUser().getType() && == organ.getType()){//OEM管理员登录
  1439. if( == org.getType()){//权限机构 OEM
  1440. //机构所属角色
  1441. role.setOrganizationId(org.getId());
  1442. role.setDeleted();
  1443. roleList = roleService.searchEntityList(role);
  1444. //特殊指定角色
  1445. role = new Role();
  1446. role.setAssignOrgId(org.getId());
  1447. role.setDeleted();
  1448. rList = roleService.searchEntityList(role);
  1449. if(null != rList && rList.size() > ){
  1450. roleList.addAll(, rList);
  1451. }
  1452. //OEM公有角色
  1453. role = new Role();
  1454. role.setType();
  1455. role.setDeleted();
  1456. rList = new ArrayList<Role>();
  1457. rList = roleService.searchEntityList(role);
  1458. if(null != rList || rList.size() > ){
  1459. roleList.addAll(, rList);
  1460. }
  1461. }else if( < org.getType()){//代理商
  1462. //机构所属角色
  1463. role.setOrganizationId(org.getId());
  1464. role.setDeleted();
  1465. roleList = roleService.searchEntityList(role);
  1466. //特殊指定角色
  1467. role = new Role();
  1468. role.setAssignOrgId(org.getId());
  1469. role.setDeleted();
  1470. rList = roleService.searchEntityList(role);
  1471. if(null != rList && rList.size() > ){
  1472. roleList.addAll(, rList);
  1473. }
  1474. //代理商公有角色
  1475. role = new Role();
  1476. role.setType();
  1477. role.setDeleted();
  1478. rList = new ArrayList<Role>();
  1479. rList = roleService.searchEntityList(role);
  1480. if(null != rList || rList.size() > ){
  1481. roleList.addAll(, rList);
  1482. }
  1483. }
  1484.  
  1485. }else if( == getSessionUser().getType() && < organ.getType()){//代理商管理员
  1486. //机构所属角色
  1487. role.setOrganizationId(org.getId());
  1488. role.setDeleted();
  1489. roleList = roleService.searchEntityList(role);
  1490. //特殊指定角色
  1491. role = new Role();
  1492. role.setAssignOrgId(org.getId());
  1493. role.setDeleted();
  1494. rList = roleService.searchEntityList(role);
  1495. if(null != rList && rList.size() > ){
  1496. roleList.addAll(, rList);
  1497. }
  1498. //代理商公有角色
  1499. role = new Role();
  1500. role.setType();
  1501. role.setDeleted();
  1502. rList = new ArrayList<Role>();
  1503. rList = roleService.searchEntityList(role);
  1504. if(null != rList || rList.size() > ){
  1505. roleList.addAll(, rList);
  1506. }
  1507. }else if( == getSessionUser().getType()){//普通用户
  1508. if(GlobalConstant.ROOT_ORGANIZATIONID.equals(getSessionUser().getOrganizationId())){//顶级机构用户登录
  1509. if(GlobalConstant.ROOT_ORGANIZATIONID.equals(org.getId())){//权限机构 顶级机构
  1510. //顶级机构角色
  1511. role.setOrganizationId(getSessionUser().getOrganizationId());
  1512. role.setIsOperatorRole();//不是超级管理员的角色
  1513. role.setDeleted();
  1514. roleList = roleService.searchEntityList(role);
  1515. }else if( == org.getType()){//权限机构 OEM
  1516. role.setOrganizationId(org.getId());
  1517. role.setDeleted();
  1518. roleList = roleService.searchEntityList(role);
  1519. //特殊指定角色
  1520. role = new Role();
  1521. role.setAssignOrgId(org.getId());
  1522. role.setDeleted();
  1523. rList = roleService.searchEntityList(role);
  1524. if(null != rList && rList.size() > ){
  1525. roleList.addAll(, rList);
  1526. }
  1527. //OEM公有角色
  1528. role = new Role();
  1529. role.setType();
  1530. role.setDeleted();
  1531. rList = new ArrayList<Role>();
  1532. rList = roleService.searchEntityList(role);
  1533. if(null != rList || rList.size() > ){
  1534. roleList.addAll(, rList);
  1535. }
  1536. }else if( < org.getType()){//权限机构 代理商
  1537. role.setOrganizationId(org.getId());
  1538. role.setDeleted();
  1539. roleList = roleService.searchEntityList(role);
  1540. //特殊指定角色
  1541. role = new Role();
  1542. role.setAssignOrgId(org.getId());
  1543. role.setDeleted();
  1544. rList = roleService.searchEntityList(role);
  1545. if(null != rList && rList.size() > ){
  1546. roleList.addAll(, rList);
  1547. }
  1548. //代理商公有角色
  1549. role = new Role();
  1550. role.setType();
  1551. role.setDeleted();
  1552. rList = new ArrayList<Role>();
  1553. rList = roleService.searchEntityList(role);
  1554. if(null != rList || rList.size() > ){
  1555. roleList.addAll(, rList);
  1556. }
  1557. }
  1558. }else if( == organ.getType()){//OEM普通用户登录
  1559. if( == org.getType()){//权限机构 OEM
  1560. role.setOrganizationId(org.getId());
  1561. role.setDeleted();
  1562. roleList = roleService.searchEntityList(role);
  1563. //特殊指定角色
  1564. role = new Role();
  1565. role.setAssignOrgId(org.getId());
  1566. role.setDeleted();
  1567. rList = roleService.searchEntityList(role);
  1568. if(null != rList && rList.size() > ){
  1569. roleList.addAll(, rList);
  1570. }
  1571. //OEM公有角色
  1572. role = new Role();
  1573. role.setType();
  1574. role.setDeleted();
  1575. rList = new ArrayList<Role>();
  1576. rList = roleService.searchEntityList(role);
  1577. if(null != rList || rList.size() > ){
  1578. roleList.addAll(, rList);
  1579. }
  1580. }else if( < org.getType()){//权限机构 代理商
  1581. role.setOrganizationId(org.getId());
  1582. role.setDeleted();
  1583. roleList = roleService.searchEntityList(role);
  1584. //特殊指定角色
  1585. role = new Role();
  1586. role.setAssignOrgId(org.getId());
  1587. role.setDeleted();
  1588. rList = roleService.searchEntityList(role);
  1589. if(null != rList && rList.size() > ){
  1590. roleList.addAll(, rList);
  1591. }
  1592. //代理商公有角色
  1593. role = new Role();
  1594. role.setType();
  1595. role.setDeleted();
  1596. rList = new ArrayList<Role>();
  1597. rList = roleService.searchEntityList(role);
  1598. if(null != rList || rList.size() > ){
  1599. roleList.addAll(, rList);
  1600. }
  1601. }
  1602. }else if( < organ.getType()){//代理商普通用户登录
  1603. role.setOrganizationId(org.getId());
  1604. role.setDeleted();
  1605. roleList = roleService.searchEntityList(role);
  1606. //特殊指定角色
  1607. role = new Role();
  1608. role.setAssignOrgId(org.getId());
  1609. role.setDeleted();
  1610. rList = roleService.searchEntityList(role);
  1611. if(null != rList && rList.size() > ){
  1612. roleList.addAll(, rList);
  1613. }
  1614. //代理商公有角色
  1615. role = new Role();
  1616. role.setType();
  1617. role.setDeleted();
  1618. rList = new ArrayList<Role>();
  1619. rList = roleService.searchEntityList(role);
  1620. if(null != rList || rList.size() > ){
  1621. roleList.addAll(, rList);
  1622. }
  1623. }
  1624. }
  1625. }
  1626.  
  1627. StringBuilder sb = new StringBuilder("");
  1628.  
  1629. for(Role r : roleList){
  1630. sb.append(r.getId()).append(",").append(r.getName()).append("<-->");
  1631. }
  1632.  
  1633. this.sendAjaxResponse(sb.toString());
  1634. return null;
  1635. }catch(Exception e){
  1636. e.printStackTrace();
  1637. throw e;
  1638. }
  1639.  
  1640. }
  1641.  
  1642. //---------------------set get start
  1643. public OperatorUser getOperatorUser() {
  1644. return operatorUser;
  1645. }
  1646. public void setOperatorUser(OperatorUser operatorUser) {
  1647. this.operatorUser = operatorUser;
  1648. }
  1649.  
  1650. public List<OperatorUser> getOperatorUserList() {
  1651. return operatorUserList;
  1652. }
  1653. public void setOperatorUserList(List<OperatorUser> operatorUserList) {
  1654. this.operatorUserList = operatorUserList;
  1655. }
  1656.  
  1657. public List<Role> getRoleList() {
  1658. return roleList;
  1659. }
  1660. public void setRoleList(List<Role> roleList) {
  1661. this.roleList = roleList;
  1662. }
  1663.  
  1664. public List<Organization> getOrganizationList() {
  1665. return organizationList;
  1666. }
  1667. public void setOrganizationList(List<Organization> organizationList) {
  1668. this.organizationList = organizationList;
  1669. }
  1670.  
  1671. public Organization getOrganization() {
  1672. return organization;
  1673. }
  1674.  
  1675. public void setOrganization(Organization organization) {
  1676. this.organization = organization;
  1677. }
  1678. //---------------------set get end
  1679.  
  1680. }

JEECG中的validform验证ajaxurl的使用方法的更多相关文章

  1. ThinkPHP3.2中字段unique验证出错的解决方法

    protected $_validate=array( array('stu_id','','学号已存在',1,'unique',1), ) 当一次插入多条数据时: 在进行循环 使用create验证时 ...

  2. 防御CSRF的方法有哪些(一) HTTP 头中自定义属性并验证 CSRF跨站域请求伪造攻击

    CSRF (Cross Site Request Forgery, 跨站域请求伪造)是一种网络的攻击方式,该攻击可以在受害者毫不知情的情况下以受害者名义伪造请求发送给受攻击站点,从而在并未授权的情况下 ...

  3. jeecg中vaildfrom的复杂的表单校验

    简介 jeecg生成的页面都是使用validfrom组件来确保数据的完整性和准确性. 凡要验证格式的元素均需绑定datatype属性,datatype可选值内置有10类,用来指定不同的验证格式. 如果 ...

  4. 改造一下jeecg中的部门树

    假装有需求 关于 jeecg 提供的部门树,相信很多小伙伴都已经用过了,今天假装有那么一个需求 "部门树弹窗选择默认展开下级部门",带着这个需求再次去探索一下吧. 一.改造之前的部 ...

  5. ASP.NET MVC5中的Model验证

    Model验证是ASP.NET MVC中的重要部分,它主要用于判断输入的数据类型及值是否符合我们设定的规则,这篇文章就介绍下ASP.NET MVC中Model验证的几种方式. 后台验证 DataAnn ...

  6. 用Retrofit发送请求中添加身份验证

    用Retrofit发送请求中添加身份验证====================在安卓应用开发中, retrofit可以极大的方便发送http网络请求,不管是GET, POST, 还是PUT, DEL ...

  7. Azure Service Bus 中的身份验证方式 Shared Access Signature

    var appInsights=window.appInsights||function(config){ function r(config){t[config]=function(){var i= ...

  8. WPF中的数据验证

    数据验证 WPF的Binding使得数据能够在数据源和目标之间流通,在数据流通的中间,便能够对数据做一些处理. 数据转换和数据验证便是在数据从源到目标 or 从目标到源 的时候对数据的验证和转换. V ...

  9. thinkphp自动验证中的静态验证和动态验证和批量验证

    1.静态定义 在模型类里面预先定义好该模型的自动验证规则,我们称为静态定义. 举例说明,我们在模型类里面定义了$_validate属性如下: class UserModel extends Model ...

随机推荐

  1. 点击cell动态修改高度动画

    点击cell动态修改高度动画 效果 源码 https://github.com/YouXianMing/Animations // // TapCellAnimationController.m // ...

  2. Asp.Net Mvc表单提交之List集合

    一.说明 1.Asp.Net Mvc中Action的参数可以自动接收和反序列化form表单的值, 2.对于name=value类型,只要Action参数的变量名和input的name相同就行,不区分大 ...

  3. Caffe SSD AttributeError: 'module' object has no attribute 'LabelMap'

    caffe ssd 错误描述: AttributeError: 'module' object has no attribute 'LabelMap' SSD from caffe.proto imp ...

  4. MySql清空所有表数据【慎用】

    CREATE PROCEDURE `up_truncate_all_table`() BEGIN ; ); DECLARE cur1 CURSOR FOR SELECT table_name from ...

  5. golang的日志系统log和glog

    go语言有一个标准库,log,提供了最基本的日志功能,但是没有什么高级的功能,如果需要高级的特性,可以选择glog或log4go. 参考:https://cloud.tencent.com/devel ...

  6. Grizzly HTTP CoDec ThreadCache 浅析

    Grizzly 的 HTTP CoDec 实现方法更 Netty 的 CoDec 完全不同, 他们思想上的差异主要在于: 1. 解码方式 Grizzly 使用流式解码, 它的HttpHeader对象内 ...

  7. DP思路

    在这里记录一些在大神们的博客,以及自己做过的一些DP的神奇思路吧 1.2015/04 NEUQ 月赛  转自:http://zyfzyf.is-programmer.com/posts/89993.h ...

  8. 《UNIX环境高级编程》笔记--环境变量

    ISO C定义了一个函数getenv,可以用其取环境变量值. #include <stdlib.h> char* getenv(const char* name); //返回与name关联 ...

  9. hdu4753 Fishhead’s Little Game 状态压缩,总和一定的博弈

    此题和UVA 10891 Game of Sum 总和一定的博弈,区间dp是一个道理,就是预处理麻烦 这是南京网络赛的一题,一直没做,今天做了,虽然时间有点长,但是1ac,这几乎是南京现场赛的最后一道 ...

  10. ZMQ和MessagePack的简单使用(转)

    近段日子在做一个比较复杂的项目,其中用到了开源软件ZMQ和MessagePack.ZMQ对底层网络通信进行了封装,是一个消息处理队列库, 使用起来非常方便.MessagePack是一个基于二进制的对象 ...