| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165 |
- package com.kede.common.controller;
- import javax.annotation.Resource;
- import javax.servlet.http.HttpServletRequest;
- import javax.servlet.http.HttpServletResponse;
- import org.springframework.web.bind.annotation.CrossOrigin;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RequestMethod;
- import org.springframework.web.bind.annotation.RestController;
- import com.kede.activity.bo.InputActivity;
- import com.kede.activity.service.ActivityService;
- import com.kede.banners.service.BannersService;
- import com.kede.common.bo.Result;
- import com.kede.common.constant.ErrorConstants;
- import com.kede.common.model.VisitingCustomers;
- import com.kede.common.utils.LoggerUtils;
- import com.kede.common.utils.StringUtils;
- import com.kede.customerCase.bo.InputCustomerCase;
- import com.kede.customerCase.service.CustomerCaseService;
- import com.kede.news.bo.InputNews;
- import com.kede.news.service.NewsService;
- import com.kede.organization.bo.InputOrganization;
- import com.kede.organization.service.OrganizationService;
- import com.kede.project.service.ProjectService;
- import com.kede.project.service.ProjectTypeService;
- import com.kede.recruitment.bo.InputRecruitment;
- import com.kede.recruitment.service.RecruitmentService;
- import com.kede.visitingCustomers.service.VisitingCustomersService;
- import com.kede.wxsdk.service.WxService;
- @RestController
- @RequestMapping(value = "/open")
- public class PublicApiController extends BaseController {
-
- @Resource
- private BannersService bannersService;
- @Resource
- private NewsService newsService;
- @Resource
- private CustomerCaseService customerCaseService;
- @Resource
- private OrganizationService organizationService;
- @Resource
- private RecruitmentService recruitmentService;
- @Resource
- private VisitingCustomersService visitingCustomersService;
- @Resource
- private ActivityService activityService;
- @Resource
- private ProjectTypeService projectTypeService;
- @Resource
- private ProjectService projectService;
- @Resource
- private WxService wxService;
-
- /**
- * 微信支付,通知--- 成功结果
- */
- public static String NOTIFY_SUCCESS = "<xml><return_code><![CDATA[SUCCESS]]></return_code><return_msg><![CDATA[OK]]></return_msg></xml>";
- /**
- * 微信支付,通知--- 失败结果
- */
- public static String NOTIFY_FAIL = "<xml><return_code><![CDATA[FAIL]]></return_code><return_msg><![CDATA[报文为空]]></return_msg></xml>";
-
- @RequestMapping(value = "/listNews", method = RequestMethod.GET)
- public Result listNews(InputNews in,Integer pageSize,Integer pageNo) {
- Result res =new Result();
- in.setReleaseStatus(1);
- res.data(newsService.listnewsDetails(in,pageSize,pageNo));
- return res;
- }
-
- @RequestMapping(value = "/listRecruitment", method = RequestMethod.GET)
- public Result listRecruitment(InputRecruitment ir,Integer pageSize,Integer pageNo) {
- Result res =new Result();
- ir.setReleaseStatus(1);
- res.data(recruitmentService.listRecruitment(ir,pageSize,pageNo));
- return res;
- }
-
- @RequestMapping(value = "/listOrganization", method = RequestMethod.GET)
- public Result listOrganization(InputOrganization io,Integer pageSize,Integer pageNo) {
- Result res =new Result();
- io.setReleaseStatus(1);
- res.data(organizationService.listOrganization(io,pageSize,pageNo));
- return res;
- }
-
- @RequestMapping(value = "/listCustomerCase", method = RequestMethod.GET)
- public Result listCustomerCase(InputCustomerCase ic,Integer pageSize,Integer pageNo) {
- Result res =new Result();
- ic.setReleaseStatus(1);
- res.data(customerCaseService.listCustomerCase(ic,pageSize,pageNo));
- return res;
- }
-
- @RequestMapping(value = "/addVisitingCustomers", method = RequestMethod.POST)
- public Result addVisitingCustomers(VisitingCustomers vc) {
- Result res =new Result();
- if(StringUtils.isBlank(vc.getName())||StringUtils.isBlank(vc.getMobile())) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR,"名字和电话","名字和电话"));
- return res;
- }
- if (!res.getError().isEmpty()) {
- return res;
- }
- res.data(visitingCustomersService.addVisitingCustomers(vc));
- return res;
- }
- @RequestMapping(value = "/activity/list", method = RequestMethod.GET)
- public Result list(InputActivity in,Integer pageSize,Integer pageNo) {
- Result res =new Result();
- in.setReleaseStatus(1);
- res.data(activityService.listDetails(in,pageSize,pageNo));
- return res;
- }
-
-
- @RequestMapping(value = "/projectTypeList", method = RequestMethod.GET)
- public Result projectTypeList(String name) {
- Result res =new Result();
-
- res.data(projectTypeService.list(name));
- return res;
- }
-
- @RequestMapping(value = "/projectList", method = RequestMethod.GET)
- public Result projectList(String name, String startTime, String endTime,Integer pageNo,Integer pageSize) {
- Result res =new Result();
-
- res.data(projectService.list( name, startTime, endTime, 1,1,pageNo, pageSize));
- return res;
- }
-
- @RequestMapping(value = "/selectProject", method = RequestMethod.GET)
- @CrossOrigin(origins="*",allowCredentials="true")
- public Result selectProject(Integer id) {
- Result res =new Result();
- if (id==null) {
- res.getError().add(buildError(ErrorConstants.PARAM_EMPTY_ERROR, "ID","ID"));
- }
- res.data(projectService.getProject( id));
- return res;
- }
-
-
- @RequestMapping(value = "/payCallBack", method = RequestMethod.POST)
- public String wxPayCallBack(HttpServletRequest req, HttpServletResponse response) {
- LoggerUtils.debug(getClass(), "===============微信支付回调==========================");
- wxService.wxPayCallBack(req);
- return NOTIFY_SUCCESS;
- }
-
-
-
- }
|