DrpAgentHandler.java 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. package com.iamberry.wechat.handles.drp;
  2. import java.util.Date;
  3. import javax.servlet.http.HttpServletRequest;
  4. import org.springframework.beans.factory.annotation.Autowired;
  5. import org.springframework.stereotype.Controller;
  6. import org.springframework.web.bind.annotation.RequestMapping;
  7. import org.springframework.web.bind.annotation.RequestMethod;
  8. import org.springframework.web.bind.annotation.ResponseBody;
  9. import com.iamberry.wechat.core.entity.drp.ApplyUserInfo;
  10. import com.iamberry.wechat.face.drp.PlaceInfoService;
  11. /**
  12. * @description 后台的分销管理
  13. * @author 欧阳明
  14. * @date 2016-4-21
  15. */
  16. @Deprecated
  17. @Controller
  18. @RequestMapping("/agent/drp")
  19. public class DrpAgentHandler {
  20. @Autowired
  21. private PlaceInfoService placeInfoService;
  22. /**
  23. * 我要代理
  24. * 2016年12月14日10:04:55
  25. * @param req
  26. * @param res
  27. */
  28. @ResponseBody
  29. @RequestMapping(value = "/addAgent", method = RequestMethod.POST)
  30. public String addAgent(HttpServletRequest request){
  31. String userName = request.getParameter("userName");
  32. String userTel = request.getParameter("userTel");
  33. String userMail = request.getParameter("userMail");
  34. String userCity = request.getParameter("userCity");
  35. String userTC = request.getParameter("userTC");
  36. ApplyUserInfo applyUserInfo = new ApplyUserInfo();
  37. if(userName == null || userName.equals("")){
  38. return "{\"status\":\"false\"}" ;
  39. }
  40. if(userTel == null || userTel.equals("")){
  41. return "{\"status\":\"false\"}" ;
  42. }
  43. if(userMail == null || userMail.equals("")){
  44. userMail = "mumu@qq,com";
  45. }
  46. if(userCity == null || userCity.equals("")){
  47. userCity = "深圳" ;
  48. }
  49. if(userTC == null || userTC.equals("")){
  50. userTC = "3" ;
  51. }
  52. applyUserInfo.setUserName(userName);
  53. applyUserInfo.setUserTel(userTel);
  54. applyUserInfo.setUserCity(userCity);
  55. applyUserInfo.setUserMail(userMail);
  56. applyUserInfo.setUserDate(new Date());
  57. applyUserInfo.setUserTc(userTC);
  58. Integer falg = placeInfoService.selectApplyAgentByTel(applyUserInfo.getUserTel());
  59. if(falg != null ){
  60. if( falg > 0){
  61. return "{\"status\":\"false\",\"info\":\"已申请用户不能重复申请!\"}" ;
  62. }
  63. }
  64. Integer msg = placeInfoService.addApplyAgent(applyUserInfo);
  65. if(msg > 0){
  66. return "{\"status\":\"true\",\"info\":\"感谢您的加入!\"}" ;
  67. }else{
  68. return "{\"status\":\"false\",\"info\":\"申请失败!\"}" ;
  69. }
  70. }
  71. }