You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

84 lines
3.1 KiB

package com.eco.plugin.xx.jbsync.controller;
import com.eco.plugin.xx.jbsync.config.PluginSimpleConfig;
import com.eco.plugin.xx.jbsync.utils.*;
import com.fr.decision.webservice.annotation.LoginStatusChecker;
import com.fr.json.JSONObject;
import com.fr.plugin.transform.FunctionRecorder;
import com.fr.third.springframework.stereotype.Controller;
import com.fr.third.springframework.web.bind.annotation.PostMapping;
import com.fr.third.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@Controller
@LoginStatusChecker(required = false)
@FunctionRecorder
public class ControllerSelf {
@PostMapping(value = "/org")
@ResponseBody
public void org(HttpServletRequest req,HttpServletResponse res){
String token =req.getParameter("access_token");
boolean verify = JWTUtils.verify(token, PluginSimpleConfig.getInstance().getSecret());
if(!verify){
JSONObject result = new JSONObject();
result.put("code","302");
result.put("msg","token鉴权失败");
ResponseUtils.response(res,result);
return ;
}
JSONObject param = Utils.getRequestBody(req);
LogUtils.debug4plugin("组织操作请求报文[{}]", param);
JSONObject result = OrgUtils.operOrg(param);
LogUtils.debug4plugin("组织操作响应报文[{}]", result);
ResponseUtils.response(res,result);
}
@PostMapping(value = "/job")
@ResponseBody
public void job(HttpServletRequest req,HttpServletResponse res){
String token =req.getParameter("access_token");
boolean verify = JWTUtils.verify(token, PluginSimpleConfig.getInstance().getSecret());
if(!verify){
JSONObject result = new JSONObject();
result.put("code","302");
result.put("msg","token鉴权失败");
ResponseUtils.response(res,result);
return ;
}
JSONObject param = Utils.getRequestBody(req);
LogUtils.debug4plugin("职务操作请求报文[{}]", param);
JSONObject result = PostUtils.operPost(param);
LogUtils.debug4plugin("职务操作响应报文[{}]", result);
ResponseUtils.response(res,result);
}
@PostMapping(value = "/users")
@ResponseBody
public void users(HttpServletRequest req,HttpServletResponse res){
String token =req.getParameter("access_token");
boolean verify = JWTUtils.verify(token, PluginSimpleConfig.getInstance().getSecret());
if(!verify){
JSONObject result = new JSONObject();
result.put("code","302");
result.put("msg","token鉴权失败");
ResponseUtils.response(res,result);
return ;
}
JSONObject param = Utils.getRequestBody(req);
LogUtils.debug4plugin("用户操作请求报文[{}]", param);
JSONObject result = UserUtils.operUser(param);
LogUtils.debug4plugin("用户操作响应报文[{}]", param);
ResponseUtils.response(res,result);
}
}