JSD-8204 ITASK集成(接口+单点)
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.

79 lines
2.1 KiB

package com.fr.plugin.it.handler;
import com.fr.decision.authority.data.User;
import com.fr.decision.fun.impl.BaseHttpHandler;
import com.fr.plugin.it.utils.*;
import com.fr.plugin.transform.FunctionRecorder;
import com.fr.third.springframework.web.bind.annotation.RequestMethod;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.List;
import java.util.Map;
@FunctionRecorder
public class ForbidUser extends BaseHttpHandler {
public ForbidUser() {
}
@Override
public RequestMethod getMethod() {
return RequestMethod.POST;
}
@Override
public String getPath() {
return "/forbidUser";
}
@Override
public boolean isPublic() {
return true;
}
@Override
public void handle(HttpServletRequest req, HttpServletResponse res){
//获取xml报文
StringBuilder stb = new StringBuilder();
try{
BufferedReader in = new BufferedReader(new InputStreamReader(req.getInputStream()));
String line = null;
while ((line = in.readLine()) != null) {
stb.append(line);
}
}catch(Exception e){
FRUtils.FRLogError("获取xml报文异常!");
}
String xml = stb.toString();
FRUtils.FRLogInfo("xml:"+xml);
List<Map<String,String>> map = XMLUtils.xmlToList(xml);
String xmlResponse = ResponseTemplate.xmlTemplate("Y","",xml);
for(Map<String,String> data : map){
try {
String username = data.get("ACCOUNT_NO");
User user = FRUserUtils.getUserByUserName(username);
FRUserUtils.forbidUser(user.getId(),false);
} catch (Exception e) {
String message = Utils.replaceNullStr(e.getMessage(),"禁用用户异常!");
FRUtils.FRLogInfo("禁用用户异常!");
xmlResponse = ResponseTemplate.xmlTemplate("N",message,xml);
}
}
ResponseUtils.responseXml(res,xmlResponse);
}
}