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.
63 lines
2.8 KiB
63 lines
2.8 KiB
3 years ago
|
package com.fr.plugin.sms;
|
||
|
|
||
|
import com.fanruan.api.log.LogKit;
|
||
|
import com.fr.decision.webservice.annotation.LoginStatusChecker;
|
||
|
import com.fr.general.GeneralUtils;
|
||
|
import com.fr.json.JSONObject;
|
||
|
import com.fr.log.FineLoggerFactory;
|
||
|
import com.fr.plugin.SMSDBAccess;
|
||
|
import com.fr.plugin.dao.SMSDao;
|
||
|
import com.fr.plugin.entity.SMSConfigEntity;
|
||
|
import com.fr.stable.StringUtils;
|
||
|
import com.fr.stable.db.action.DBAction;
|
||
|
import com.fr.stable.db.dao.DAOContext;
|
||
|
import com.fr.stable.query.QueryFactory;
|
||
|
import com.fr.third.springframework.stereotype.Controller;
|
||
|
import com.fr.third.springframework.web.bind.annotation.RequestMapping;
|
||
|
import com.fr.third.springframework.web.bind.annotation.ResponseBody;
|
||
|
import com.fr.web.utils.WebUtils;
|
||
|
|
||
|
import javax.servlet.http.HttpServletRequest;
|
||
|
import javax.servlet.http.HttpServletResponse;
|
||
|
import java.util.HashMap;
|
||
|
import java.util.List;
|
||
|
import java.util.Map;
|
||
|
|
||
|
|
||
|
@Controller("SmsThirdSheQu")
|
||
|
@RequestMapping(value = "/shequ")
|
||
|
@LoginStatusChecker(required = false)
|
||
|
public class ZSResource {
|
||
|
|
||
|
@RequestMapping(value = "/**")
|
||
|
@ResponseBody
|
||
|
public void dispatcher( HttpServletRequest request, HttpServletResponse response ) throws Exception{
|
||
|
String info = request.getPathInfo();
|
||
|
String method = request.getMethod();
|
||
|
if( "/shequ/v1/user/login/".equals(info) ){
|
||
|
//内网下模拟帆软通行证登录
|
||
|
print(request,response,"{\"code\":200,\"message\":\"success\",\"data\":{\"access_token\":\"Um5rO7Ef5gvCqBWQw08LJkRilxtc4SGN\",\"expires_time\":4070883661,\"refresh_token\":\"HQqs6A9dTn1CElwP3tLJ4McX387pj2Uu\",\"refresh_expires_time\":4070883661,\"client\":{\"appid\":\"shequapp\",\"uid\":99999,\"username\":\"贵阳烟草\"}},\"status\":0}");
|
||
|
}else if("/shequ/v1/sms/".equals(info) && "POST".equals(method)){
|
||
|
//内网下验证短信开启
|
||
|
print(request,response,"{\"status\":\"success\",\"data\":{\"app_key\":\"third_app_key\",\"app_secret\":\"third_app_secret\"}}");
|
||
|
}else if( "/shequ/v1/sms/user_info".equals(info) && "POST".equals(method) ){
|
||
|
//内网下获取短信模板
|
||
|
print( request, response, SMSUserInfo.getData().toString() );
|
||
|
}else if( "/shequ/v1/ping".equals(info) ){
|
||
|
//内网下模拟在线
|
||
|
WebUtils.printAsString(response, StringUtils.EMPTY);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
private static void print(HttpServletRequest req, HttpServletResponse res, String response){
|
||
|
try{
|
||
|
JSONObject obj = new JSONObject(response);
|
||
|
res.setCharacterEncoding("UTF-8");
|
||
|
LogKit.info("接口:{} 返回:{}", req.getRequestURI(), obj.toString());
|
||
|
WebUtils.flushSuccessMessageAutoClose(req,res,obj);
|
||
|
}catch(Exception e){
|
||
|
FineLoggerFactory.getLogger().error(e.getMessage(),e);
|
||
|
}
|
||
|
}
|
||
|
}
|