当前位置:   article > 正文

ai电销机器人代码部署源码

ai电销机器人代码部署源码
  1. package cn.jeeweb.modules.vrgateway.controller;
  2. import cn.jeeweb.core.common.controller.BaseCRUDController;
  3. import cn.jeeweb.core.model.AjaxJson;
  4. import cn.jeeweb.core.query.data.Queryable;
  5. import cn.jeeweb.core.security.shiro.authz.annotation.RequiresPathPermission;
  6. import cn.jeeweb.modules.sys.entity.Role;
  7. import cn.jeeweb.modules.sys.entity.User;
  8. import cn.jeeweb.modules.sys.service.IRoleService;
  9. import cn.jeeweb.modules.sys.service.IUserService;
  10. import cn.jeeweb.modules.sys.utils.UserUtils;
  11. import cn.jeeweb.modules.vrgateway.entity.VrGateway;
  12. import cn.jeeweb.modules.vrgateway.service.IVrGatewayService;
  13. import cn.jeeweb.modules.vrgateway.util.ExecuteLinux;
  14. import cn.jeeweb.modules.vrgateway.util.WriteXml;
  15. import cn.jeeweb.modules.vrline.service.IVrUserLineService;
  16. import java.io.PrintStream;
  17. import java.util.ArrayList;
  18. import java.util.List;
  19. import javax.servlet.http.HttpServletRequest;
  20. import javax.servlet.http.HttpServletResponse;
  21. import org.hibernate.criterion.DetachedCriteria;
  22. import org.springframework.beans.factory.annotation.Autowired;
  23. import org.springframework.stereotype.Controller;
  24. import org.springframework.ui.Model;
  25. import org.springframework.validation.BindingResult;
  26. import org.springframework.web.bind.annotation.RequestMapping;
  27. @Controller
  28. @RequestMapping({"${admin.url.prefix}/vrgateway/vrgateway"})
  29. @RequiresPathPermission("vrgateway:vrgateway")
  30. public class VrGatewayController extends BaseCRUDController<VrGateway, String>
  31. {
  32. @Autowired
  33. private IUserService iUserService;
  34. @Autowired
  35. private IRoleService iRoleService;
  36. @Autowired
  37. private IVrGatewayService iVrGatewayService;
  38. @Autowired
  39. private IVrUserLineService iVrUserLineService;
  40. public void preEdit(VrGateway entity, Model model, HttpServletRequest request, HttpServletResponse response)
  41. {
  42. User user = UserUtils.getUser();
  43. List roleList = UserUtils.getRoleList();
  44. boolean flag = false;
  45. boolean dlsflag = false;
  46. boolean yysflag = false;
  47. for (Role r : roleList) {
  48. if ("cjgly".equals(r.getCode())) {
  49. flag = true;
  50. }
  51. if ("dls".equals(r.getCode())) {
  52. dlsflag = true;
  53. }
  54. if ("yys".equals(r.getCode())) {
  55. yysflag = true;
  56. }
  57. }
  58. List userList = new ArrayList();
  59. String sql = "select * from sys_user where del_flag='0'";
  60. if (flag) {
  61. userList = this.iUserService.listEntityByAliasSql(sql, null);
  62. } else if (dlsflag) {
  63. sql = sql + " and create_by ='" + user.getId() + "'";
  64. userList = this.iUserService.listEntityByAliasSql(sql, null);
  65. userList.add(user);
  66. } else if (yysflag) {
  67. sql = sql + " and yysId ='" + user.getId() + "'";
  68. userList = this.iUserService.listEntityByAliasSql(sql, null);
  69. userList.add(user);
  70. }
  71. request.setAttribute("userList", userList);
  72. request.setAttribute("vrgateway", entity);
  73. super.preEdit(entity, model, request, response);
  74. }
  75. public void preAjaxList(Queryable queryable, DetachedCriteria detachedCriteria, HttpServletRequest request, HttpServletResponse response)
  76. {
  77. User user = UserUtils.getUser();
  78. List roleList = UserUtils.getRoleList();
  79. boolean flag = false;
  80. boolean yysFlag = false;
  81. boolean dlsFlag = false;
  82. for (Role r : roleList) {
  83. if ("cjgly".equals(r.getCode())) {
  84. flag = true;
  85. }
  86. if ("yys".equals(r.getCode())) {
  87. yysFlag = true;
  88. }
  89. if ("dls".equals(r.getCode())) {
  90. dlsFlag = true;
  91. }
  92. }
  93. if (yysFlag)
  94. queryable.addCondition("yysId", user);
  95. else if (dlsFlag) {
  96. queryable.addCondition("dlsId", user);
  97. }
  98. else if (!flag) {
  99. queryable.addCondition("gatewayUser", user);
  100. }
  101. super.preAjaxList(queryable, detachedCriteria, request, response);
  102. }
  103. public AjaxJson create(Model model, VrGateway entity, BindingResult result, HttpServletRequest request, HttpServletResponse response)
  104. {
  105. String id = request.getParameter("userIdstr");
  106. if ((id != null) && (!"".equals(id))) {
  107. User user = (User)this.iUserService.get(id);
  108. entity.setGatewayUser(user);
  109. }
  110. User dquser = UserUtils.getUser();
  111. Role dqrole = UserUtils.getRole();
  112. if ("dls".equals(dqrole.getCode())) {
  113. entity.setDlsId(dquser);
  114. if ((dquser.getYysId() != null) && (!"".equals(dquser.getYysId())))
  115. entity.setYysId(UserUtils.get(dquser.getYysId()));
  116. }
  117. else if ("yys".equals(dqrole.getCode())) {
  118. entity.setYysId(dquser);
  119. if ((id != null) && (!"".equals(id))) {
  120. List roleList = this.iRoleService.findListByUserId(id);
  121. User user = (User)this.iUserService.get(id);
  122. for (Role r : roleList) {
  123. if ("dls".equals(r.getCode())) {
  124. entity.setDlsId(UserUtils.get(id));
  125. }
  126. if ("DLSGLY".equals(r.getCode())) {
  127. if ((user.getDlsId() != null) && (!"".equals(user.getDlsId()))) {
  128. entity.setDlsId(UserUtils.get(user.getDlsId()));
  129. }
  130. if ((user.getYysId() != null) && (!"".equals(user.getYysId())))
  131. entity.setYysId(UserUtils.get(user.getYysId()));
  132. }
  133. }
  134. }
  135. }
  136. else if ("DLSGLY".equals(dqrole.getCode())) {
  137. if ((dquser.getDlsId() != null) && (!"".equals(dquser.getDlsId()))) {
  138. entity.setDlsId(UserUtils.get(dquser.getDlsId()));
  139. }
  140. if ((dquser.getYysId() != null) && (!"".equals(dquser.getYysId()))) {
  141. entity.setYysId(UserUtils.get(dquser.getYysId()));
  142. }
  143. }
  144. WriteXml wx = new WriteXml();
  145. wx.writeXmlGoip(entity.getGatewayUserId(), entity.getPassword(), entity.getGatewayUserId() + ".xml");
  146. ExecuteLinux el = new ExecuteLinux();
  147. el.executeNewFlow();
  148. return super.create(model, entity, result, request, response);
  149. }
  150. public AjaxJson update(Model model, VrGateway entity, BindingResult result, HttpServletRequest request, HttpServletResponse response)
  151. {
  152. String id = request.getParameter("userIdstr");
  153. VrGateway vg = (VrGateway)get(entity.getId());
  154. String sql = "update vr_gateway vg set vg.gatewayName='" + entity.getGatewayName() + "',vg.gatewayUserId='" + entity.getGatewayUserId() + "',vg.password='" + entity.getPassword() + "'";
  155. if ((id != null) && (!"".equals(id))) {
  156. User user = (User)this.iUserService.get(id);
  157. sql = sql + ", vg.gatewayUser='" + user.getId() + "'";
  158. } else {
  159. sql = sql + ", vg.gatewayUser=null";
  160. }
  161. User dquser = UserUtils.getUser();
  162. Role dqrole = UserUtils.getRole();
  163. if ("dls".equals(dqrole.getCode())) {
  164. sql = sql + ", vg.dlsId='" + dquser.getId() + "',vg.yysId='" + dquser.getYysId() + "'";
  165. }
  166. else if ("yys".equals(dqrole.getCode())) {
  167. if ((id != null) && (!"".equals(id))) {
  168. List roleList = this.iRoleService.findListByUserId(id);
  169. User user = (User)this.iUserService.get(id);
  170. for (Role r : roleList) {
  171. if ("dls".equals(r.getCode())) {
  172. sql = sql + ", vg.dlsId='" + user.getId() + "',vg.yysId='" + user.getYysId() + "'";
  173. }
  174. if ("DLSGLY".equals(r.getCode()))
  175. sql = sql + ", vg.dlsId='" + user.getDlsId() + "',vg.yysId='" + user.getYysId() + "'";
  176. }
  177. }
  178. }
  179. else if ("DLSGLY".equals(dqrole.getCode())) {
  180. sql = sql + ", vg.dlsId='" + dquser.getDlsId() + "',vg.yysId='" + dquser.getYysId() + "'";
  181. }
  182. sql = sql + " where vg.id='" + entity.getId() + "'";
  183. WriteXml wx = new WriteXml();
  184. WriteXml.deleteFile(vg.getGatewayUserId() + ".xml");
  185. wx.writeXmlGoip(entity.getGatewayUserId(), entity.getPassword(), entity.getGatewayUserId() + ".xml");
  186. ExecuteLinux el = new ExecuteLinux();
  187. el.executeNewFlow();
  188. this.iVrGatewayService.executeSql(sql, null);
  189. AjaxJson aj = new AjaxJson();
  190. aj.success("修改成功");
  191. return aj;
  192. }
  193. public AjaxJson delete(String id)
  194. {
  195. String sql = "select * from vr_user_line where gateWay = '" + id + "'";
  196. List list = this.iVrUserLineService.listByAliasSql(sql, null);
  197. if (list.size() > 0) {
  198. AjaxJson aj = new AjaxJson();
  199. aj.fail("请先删除线路,在删除网关");
  200. return aj;
  201. }
  202. VrGateway vg = (VrGateway)get(id);
  203. WriteXml wx = new WriteXml();
  204. WriteXml.deleteFile(vg.getGatewayUserId() + ".xml");
  205. return super.delete(id);
  206. }
  207. @RequestMapping(value={"/undo"}, method={org.springframework.web.bind.annotation.RequestMethod.GET, org.springframework.web.bind.annotation.RequestMethod.POST})
  208. public void undo(String id, HttpServletRequest request, HttpServletResponse response) {
  209. System.out.println("------------------------------------------------0000000000000000000000000000000000000");
  210. try
  211. {
  212. ExecuteLinux el = new ExecuteLinux();
  213. el.executeNewFlow();
  214. } catch (Exception e) {
  215. e.printStackTrace();
  216. }
  217. }
  218. }

青藤ai电销机器人系统部署

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/羊村懒王/article/detail/633120
推荐阅读
相关标签
  

闽ICP备14008679号