first commit
This commit is contained in:
117
src/main/java/com/example/sso/controller/BeiSenController.java
Normal file
117
src/main/java/com/example/sso/controller/BeiSenController.java
Normal file
@ -0,0 +1,117 @@
|
||||
package com.example.sso.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.example.sso.config.SSOConfig;
|
||||
import com.example.sso.dao.J9051Dao;
|
||||
import com.example.sso.dao.J9052Dao;
|
||||
import com.example.sso.dao.J9053Dao;
|
||||
import com.example.sso.dao.J905Dao;
|
||||
import com.example.sso.service.JDYAuthService;
|
||||
import com.example.sso.service.SSOService;
|
||||
import com.example.sso.util.BeiSenTest;
|
||||
import com.example.sso.util.J905Util;
|
||||
import com.example.sso.util.JDYUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.security.KeyManagementException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
@RestController
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
class BeiSenController {
|
||||
@Getter @Setter @Autowired private SSOConfig ssoConfig;
|
||||
private JSONObject limitIpInfo_dep1 = new JSONObject();
|
||||
private JSONObject limitIpInfo_dep2 = new JSONObject();
|
||||
private JSONObject limitIpInfo_dep3 = new JSONObject();
|
||||
private JSONObject limitIpInfo_dep4 = new JSONObject();
|
||||
private JSONObject limitIpInfo_dep5 = new JSONObject();
|
||||
private JSONObject limitIpInfo_dep6 = new JSONObject();
|
||||
@Getter @Setter @Autowired private SSOService ssoService;
|
||||
@Getter @Setter @Autowired private JDYAuthService jdyAuthService;
|
||||
Logger logger = LoggerFactory.getLogger(getClass());
|
||||
|
||||
/**
|
||||
* 创建人员信息
|
||||
a */
|
||||
@GetMapping("/createPerson")
|
||||
public void yxMes() throws KeyManagementException, NoSuchAlgorithmException {
|
||||
try {
|
||||
JSONArray drivers=JDYUtil.getAllDrivers();//查询
|
||||
for (Object o:drivers){
|
||||
JSONObject driver=(JSONObject)o;
|
||||
JSONObject orgNos=JDYUtil.getOrgNos();
|
||||
BeiSenTest.createUser(driver,orgNos,"");
|
||||
}
|
||||
}catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 接收简道云新增的人员数据
|
||||
*/
|
||||
@PostMapping("/createPerson_jdy")
|
||||
public void yxMes3(@RequestBody JSONObject driver){
|
||||
try {
|
||||
logger.info(driver.toJSONString());
|
||||
if (driver.getJSONObject("data").getString("status").equals("已择车") ||
|
||||
driver.getJSONObject("data").getString("status").equals("运营")){
|
||||
//if (driver.getJSONObject("data").getString("status").equals("运营")){
|
||||
//这个情况说明上车,创建账户
|
||||
JSONObject orgNos=JDYUtil.getOrgNos();
|
||||
JSONObject data=driver.getJSONObject("data");
|
||||
BeiSenTest.createUser(data,orgNos,driver.getJSONObject("data").getString("_id"));
|
||||
}else if (driver.getJSONObject("data").getString("status").equals("已下车")){
|
||||
//}else if (driver.getJSONObject("data").getString("status").equals("已下车")||
|
||||
//driver.getJSONObject("data").getString("status").equals("休医疗期")){
|
||||
BeiSenTest.deleteUser(driver.getJSONObject("data").getInteger("beisen_id"));
|
||||
}
|
||||
}catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 更新人员数据信息,修护职务、身份证号码信息
|
||||
*/
|
||||
@GetMapping("/updatePersonData")
|
||||
public void yxMes2(){
|
||||
//修改职工基础信息数据
|
||||
try {
|
||||
JSONArray beiSens = JDYUtil.getAllDriversBeiSen();//查询
|
||||
JSONArray drivers = JDYUtil.getAllDrivers();//查询
|
||||
JSONObject orgNos=JDYUtil.getOrgNos();
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
for (Object o : drivers) {
|
||||
HashMap<String, Object> driver = (HashMap<String, Object>) o;
|
||||
jsonObject.put((String) driver.get("shjh") + "@yinjian.com", driver);
|
||||
}
|
||||
for (Object o : beiSens) {
|
||||
JSONObject driver = (JSONObject) o;
|
||||
if (jsonObject.getJSONObject(driver.getString("zhanghao"))!=null){
|
||||
// BeiSenTest.updateUser(driver,driver.getString("oid"),orgNos);
|
||||
// System.out.println(jsonObject.getJSONObject(driver.getString("zhanghao")));
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,77 @@
|
||||
package com.example.sso.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.example.sso.dao.GongZiFaFang;
|
||||
import com.example.sso.dao.UpDataYes;
|
||||
import com.example.sso.util.GongZiUtil;
|
||||
import com.example.sso.util.V5utils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@Slf4j
|
||||
public class GongZiController {
|
||||
@PostMapping("/gongzi")
|
||||
public String gongzi(@RequestBody JSONObject driver){
|
||||
log.info(driver.toJSONString());
|
||||
log.info("------------------------------------------------------------");
|
||||
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("app_id", "667cc6dbaa923599ad735201");
|
||||
jsonObject.put("entry_id", "62f4913c82654a00085de9e4");
|
||||
jsonObject.put("limit",10000);
|
||||
JSONArray fields = new JSONArray();
|
||||
fields.add("yuefen");
|
||||
fields.add("status_jiaoyan");
|
||||
fields.add("sijishenfenzhenghao");
|
||||
fields.add("jine");
|
||||
fields.add("yinhangkahao");
|
||||
fields.add("status_yinhang");
|
||||
|
||||
JSONObject filter = new JSONObject();
|
||||
filter.put("rel","and");
|
||||
JSONArray jsonArray = new JSONArray();
|
||||
JSONObject jsonObject1 = new JSONObject();
|
||||
jsonObject1.put("field","status_jiaoyan");
|
||||
jsonObject1.put("method","empty");
|
||||
jsonArray.add(jsonObject1);
|
||||
filter.put("cond",jsonArray);
|
||||
jsonObject.put("fields",fields);
|
||||
jsonObject.put("filter",filter);
|
||||
String jsonString = jsonObject.toJSONString();
|
||||
String list = V5utils.list(jsonString);
|
||||
JSONObject jsonObject2 = JSON.parseObject(list);
|
||||
JSONArray jsonArray1 = jsonObject2.getJSONArray("data");
|
||||
String yuefen = GongZiUtil.yuefen();
|
||||
for (Object o : jsonArray1){
|
||||
JSONObject test = (JSONObject) o;
|
||||
String yuefen1 = test.getString("yuefen");
|
||||
String sijishenfenzhenghao = test.getString("sijishenfenzhenghao");
|
||||
Integer jine = test.getInteger("jine");
|
||||
String yinhangkahao = test.getString("yinhangkahao");
|
||||
String status_yinhang = test.getString("status_yinhang");
|
||||
String id = test.getString("_id");
|
||||
|
||||
if (yuefen.equals(yuefen1)){
|
||||
String fafang = GongZiFaFang.fafang(yuefen1, sijishenfenzhenghao, jine, yinhangkahao, status_yinhang);
|
||||
log.info(fafang);
|
||||
UpDataYes.updata(id);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return "Success";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,90 @@
|
||||
package com.example.sso.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.example.sso.dao.GuoLvSelect;
|
||||
import com.example.sso.util.BeiSenTest;
|
||||
import com.example.sso.util.JDYUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.security.KeyManagementException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
public class GuoLvController {
|
||||
@PostMapping("/createPersonGuoLv")
|
||||
public String yxMes(@RequestBody JSONObject datas) {
|
||||
String jsonString = datas.toJSONString();
|
||||
log.info(jsonString);
|
||||
JSONObject jsonObject = datas.getJSONObject("data");
|
||||
String xm = jsonObject.getString("xm");
|
||||
String shfzhh = jsonObject.getString("shfzhh");
|
||||
String shjh = jsonObject.getString("shjh");
|
||||
String beisenId = jsonObject.getString("beisen_id");
|
||||
String yxbs = jsonObject.getString("yxbs");
|
||||
String sfjsy = jsonObject.getString("sfjsy");
|
||||
String dlrzt = jsonObject.getString("dlrzt");
|
||||
String fs = jsonObject.getString("fs");
|
||||
String widget1723106903113 = jsonObject.getString("_widget_1723106903113");
|
||||
String dataid = jsonObject.getString("_id");
|
||||
|
||||
try {
|
||||
|
||||
|
||||
|
||||
JSONObject orgNos = JDYUtil.getOrgNos();
|
||||
BeiSenTest.createUserss(xm,yxbs,shfzhh,shjh,fs,beisenId,orgNos,dataid);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return "成功了";
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/deleteuser")
|
||||
public String yxMes11(@RequestBody JSONObject datas) throws NoSuchAlgorithmException, KeyManagementException {
|
||||
String jsonString = datas.toJSONString();
|
||||
log.info(jsonString);
|
||||
JSONObject jsonObject = datas.getJSONObject("data");
|
||||
String xm = jsonObject.getString("xm");
|
||||
String shfzhh = jsonObject.getString("shfzhh");
|
||||
String shjh = jsonObject.getString("shjh");
|
||||
String beisenId = jsonObject.getString("beisen_id");
|
||||
String yxbs = jsonObject.getString("yxbs");
|
||||
String sfjsy = jsonObject.getString("sfjsy");
|
||||
String dlrzt = jsonObject.getString("dlrzt");
|
||||
String fs = jsonObject.getString("fs");
|
||||
String widget1723106903113 = jsonObject.getString("_widget_1723106903113");
|
||||
String dataid = jsonObject.getString("_id");
|
||||
if (!sfjsy.equals("是") && dlrzt.equals("已停用") && !dlrzt.isEmpty() ) {
|
||||
|
||||
Integer i = Integer.parseInt(beisenId);
|
||||
BeiSenTest.deleteUser(i);
|
||||
}
|
||||
|
||||
if (dlrzt.equals("启用") && !dlrzt.isEmpty() ) {
|
||||
|
||||
try {
|
||||
|
||||
|
||||
|
||||
JSONObject orgNos = JDYUtil.getOrgNos();
|
||||
BeiSenTest.createUserss(xm,yxbs,shfzhh,shjh,fs,beisenId,orgNos,dataid);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return "完成了";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
365
src/main/java/com/example/sso/controller/SSOController.java
Normal file
365
src/main/java/com/example/sso/controller/SSOController.java
Normal file
@ -0,0 +1,365 @@
|
||||
package com.example.sso.controller;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.example.sso.config.SSOConfig;
|
||||
import com.example.sso.dao.J9051Dao;
|
||||
import com.example.sso.dao.J9052Dao;
|
||||
import com.example.sso.dao.J9053Dao;
|
||||
import com.example.sso.dao.J905Dao;
|
||||
import com.example.sso.service.*;
|
||||
import com.example.sso.util.J905Util;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.security.KeyManagementException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.Date;
|
||||
@RestController
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
class SSOController {
|
||||
@Getter @Setter @Autowired private SSOConfig ssoConfig;
|
||||
private JSONObject limitIpInfo_dep1 = new JSONObject();
|
||||
private JSONObject limitIpInfo_dep2 = new JSONObject();
|
||||
private JSONObject limitIpInfo_dep3 = new JSONObject();
|
||||
private JSONObject limitIpInfo_dep4 = new JSONObject();
|
||||
private JSONObject limitIpInfo_dep5 = new JSONObject();
|
||||
private JSONObject limitIpInfo_dep6 = new JSONObject();
|
||||
@Getter @Setter @Autowired private SSOService ssoService;
|
||||
@Getter @Setter @Autowired private JDYAuthService jdyAuthService;
|
||||
Logger logger = LoggerFactory.getLogger(getClass());
|
||||
/**
|
||||
* 查询SIM卡号,车牌号和终端号的对应关系
|
||||
* @param jsonMes
|
||||
* @param httpServletRequest
|
||||
* @return
|
||||
* @throws KeyManagementException
|
||||
* @throws NoSuchAlgorithmException
|
||||
*/
|
||||
@PostMapping("/mdnVcn/getPageList")
|
||||
public JSONObject yxMes(@RequestBody JSONObject jsonMes,HttpServletRequest httpServletRequest) throws KeyManagementException, NoSuchAlgorithmException {
|
||||
try {
|
||||
String ip = httpServletRequest.getRemoteAddr();
|
||||
if (limitIpInfo_dep1.getJSONObject(ip) == null) {
|
||||
limitIpInfo_dep1.put(ip, initializationIP());
|
||||
try {
|
||||
String key=jsonMes.getString("key");
|
||||
if (key.equals("5fff9123eadbae0007b9ce3e")){
|
||||
JSONArray jsonArray=J905Dao.getAllSims();
|
||||
return J905Util.returnOK(jsonArray);
|
||||
}else{
|
||||
return J905Util.returnLoser(400,"秘钥错误");//秘钥错误
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
JSONObject limitInfo = limitIpInfo_dep1.getJSONObject(ip);
|
||||
Long time = (new Date().getTime() - limitInfo.getLong("time")) / 1000;//秒
|
||||
//logger.info(ip+":还需等待"+time);
|
||||
if (time>=60) {
|
||||
limitIpInfo_dep1.put(ip, initializationIP());
|
||||
try {
|
||||
String key=jsonMes.getString("key");
|
||||
if (key.equals("5fff9123eadbae0007b9ce3e")){
|
||||
JSONArray jsonArray=J905Dao.getAllSims();
|
||||
return J905Util.returnOK(jsonArray);
|
||||
}else{
|
||||
return J905Util.returnLoser(400,"秘钥错误");//秘钥错误
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
return J905Util.returnLoser(402,"接口频率超出限制,1分钟内允许调取一次,请稍后再试");//秘钥错误
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
return J905Util.returnLoser(401,"系统查询异常,请联系开发人员");
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 查询车队
|
||||
* @param jsonMes
|
||||
* @param httpServletRequest
|
||||
* @return
|
||||
* @throws KeyManagementException
|
||||
* @throws NoSuchAlgorithmException
|
||||
*/
|
||||
@PostMapping("/vDwnoFzr/getPageList")
|
||||
public JSONObject vDwnoFzr(@RequestBody JSONObject jsonMes,HttpServletRequest httpServletRequest) throws KeyManagementException, NoSuchAlgorithmException {
|
||||
try {
|
||||
String ip = httpServletRequest.getRemoteAddr();
|
||||
if (limitIpInfo_dep2.getJSONObject(ip) == null) {
|
||||
limitIpInfo_dep2.put(ip, initializationIP());
|
||||
try {
|
||||
String key=jsonMes.getString("key");
|
||||
if (key.equals("5fff9123eadbae0007b9ce3e")){
|
||||
JSONArray jsonArray=J905Dao.getAllSims();
|
||||
return J905Util.returnOK(jsonArray);
|
||||
}else{
|
||||
return J905Util.returnLoser(400,"秘钥错误");//秘钥错误
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
JSONObject limitInfo = limitIpInfo_dep2.getJSONObject(ip);
|
||||
Long time = (new Date().getTime() - limitInfo.getLong("time")) / 1000;//秒
|
||||
//logger.info(ip+":还需等待"+time);
|
||||
if (time>=60) {
|
||||
limitIpInfo_dep2.put(ip, initializationIP());
|
||||
try {
|
||||
String key=jsonMes.getString("key");
|
||||
if (key.equals("5fff9123eadbae0007b9ce3e")){
|
||||
JSONArray jsonArray=J905Dao.getAllSims();
|
||||
return J905Util.returnOK(jsonArray);
|
||||
}else{
|
||||
return J905Util.returnLoser(400,"秘钥错误");//秘钥错误
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
return J905Util.returnLoser(402,"接口频率超出限制,1分钟内允许调取一次,请稍后再试");//秘钥错误
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
return J905Util.returnLoser(401,"系统查询异常,请联系开发人员");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询车辆
|
||||
* @param jsonMes
|
||||
* @param httpServletRequest
|
||||
* @return
|
||||
* @throws KeyManagementException
|
||||
* @throws NoSuchAlgorithmException
|
||||
*/
|
||||
@PostMapping("/VGpsCheliang/getPageList")
|
||||
public JSONObject VGpsCheliang(@RequestBody JSONObject jsonMes,HttpServletRequest httpServletRequest) throws KeyManagementException, NoSuchAlgorithmException {
|
||||
try {
|
||||
String ip = httpServletRequest.getRemoteAddr();
|
||||
if (limitIpInfo_dep3.getJSONObject(ip) == null) {
|
||||
limitIpInfo_dep3.put(ip, initializationIP());
|
||||
try {
|
||||
String key=jsonMes.getString("key");
|
||||
if (key.equals("5fff9123eadbae0007b9ce3e")){
|
||||
JSONArray jsonArray=J905Dao.getVGpsCheliangs();
|
||||
return J905Util.returnOK(jsonArray);
|
||||
}else{
|
||||
return J905Util.returnLoser(400,"秘钥错误");//秘钥错误
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
JSONObject limitInfo = limitIpInfo_dep3.getJSONObject(ip);
|
||||
Long time = (new Date().getTime() - limitInfo.getLong("time")) / 1000;//秒
|
||||
//logger.info(ip+":还需等待"+time);
|
||||
if (time>=60) {
|
||||
limitIpInfo_dep3.put(ip, initializationIP());
|
||||
try {
|
||||
String key=jsonMes.getString("key");
|
||||
if (key.equals("5fff9123eadbae0007b9ce3e")){
|
||||
JSONArray jsonArray=J905Dao.getVGpsCheliangs();
|
||||
return J905Util.returnOK(jsonArray);
|
||||
}else{
|
||||
return J905Util.returnLoser(400,"秘钥错误");//秘钥错误
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
return J905Util.returnLoser(402,"接口频率超出限制,1分钟内允许调取一次,请稍后再试");//秘钥错误
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
return J905Util.returnLoser(401,"系统查询异常,请联系开发人员");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询驾驶员
|
||||
* @param jsonMes
|
||||
* @param httpServletRequest
|
||||
* @return
|
||||
* @throws KeyManagementException
|
||||
* @throws NoSuchAlgorithmException
|
||||
*/
|
||||
@PostMapping("/vGpsJiashiyuan/getPageList")
|
||||
public JSONObject vGpsJiashiyuan(@RequestBody JSONObject jsonMes,HttpServletRequest httpServletRequest) throws KeyManagementException, NoSuchAlgorithmException {
|
||||
try {
|
||||
String ip = httpServletRequest.getRemoteAddr();
|
||||
if (limitIpInfo_dep4.getJSONObject(ip) == null) {
|
||||
limitIpInfo_dep4.put(ip, initializationIP());
|
||||
try {
|
||||
String key=jsonMes.getString("key");
|
||||
if (key.equals("5fff9123eadbae0007b9ce3e")){
|
||||
JSONArray jsonArray= J9051Dao.getAllJiashiyuans();
|
||||
return J905Util.returnOK(jsonArray);
|
||||
}else{
|
||||
return J905Util.returnLoser(400,"秘钥错误");//秘钥错误
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
JSONObject limitInfo = limitIpInfo_dep4.getJSONObject(ip);
|
||||
Long time = (new Date().getTime() - limitInfo.getLong("time")) / 1000;//秒
|
||||
//logger.info(ip+":还需等待"+time);
|
||||
if (time>=60) {
|
||||
limitIpInfo_dep4.put(ip, initializationIP());
|
||||
try {
|
||||
String key=jsonMes.getString("key");
|
||||
if (key.equals("5fff9123eadbae0007b9ce3e")){
|
||||
JSONArray jsonArray=J9051Dao.getAllJiashiyuans();
|
||||
return J905Util.returnOK(jsonArray);
|
||||
}else{
|
||||
return J905Util.returnLoser(400,"秘钥错误");//秘钥错误
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
return J905Util.returnLoser(402,"接口频率超出限制,1分钟内允许调取一次,请稍后再试");//秘钥错误
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
return J905Util.returnLoser(401,"系统查询异常,请联系开发人员");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询驾驶员和车辆关系
|
||||
* @param jsonMes
|
||||
* @param httpServletRequest
|
||||
* @return
|
||||
* @throws KeyManagementException
|
||||
* @throws NoSuchAlgorithmException
|
||||
*/
|
||||
@PostMapping("/vGpsHetong/getPageList")
|
||||
public JSONObject vGpsHetong(@RequestBody JSONObject jsonMes,HttpServletRequest httpServletRequest) throws KeyManagementException, NoSuchAlgorithmException {
|
||||
try {
|
||||
String ip = httpServletRequest.getRemoteAddr();
|
||||
if (limitIpInfo_dep5.getJSONObject(ip) == null) {
|
||||
limitIpInfo_dep5.put(ip, initializationIP());
|
||||
try {
|
||||
String key=jsonMes.getString("key");
|
||||
if (key.equals("5fff9123eadbae0007b9ce3e")){
|
||||
JSONArray jsonArray= J9052Dao.getAllvGpsHetongs();
|
||||
for (Object o:jsonArray){
|
||||
JSONObject jsonObject=(JSONObject)o;
|
||||
String hphm=jsonObject.getString("hphm");
|
||||
if (hphm.contains("")){
|
||||
System.out.println("");
|
||||
}
|
||||
}
|
||||
return J905Util.returnOK(jsonArray);
|
||||
}else{
|
||||
return J905Util.returnLoser(400,"秘钥错误");//秘钥错误
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
JSONObject limitInfo = limitIpInfo_dep5.getJSONObject(ip);
|
||||
Long time = (new Date().getTime() - limitInfo.getLong("time")) / 1000;//秒
|
||||
//logger.info(ip+":还需等待"+time);
|
||||
if (time>=60) {
|
||||
limitIpInfo_dep5.put(ip, initializationIP());
|
||||
try {
|
||||
String key=jsonMes.getString("key");
|
||||
if (key.equals("5fff9123eadbae0007b9ce3e")){
|
||||
JSONArray jsonArray=J9052Dao.getAllvGpsHetongs();
|
||||
return J905Util.returnOK(jsonArray);
|
||||
}else{
|
||||
return J905Util.returnLoser(400,"秘钥错误");//秘钥错误
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
return J905Util.returnLoser(402,"接口频率超出限制,1分钟内允许调取一次,请稍后再试");//秘钥错误
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
return J905Util.returnLoser(401,"系统查询异常,请联系开发人员");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询历史人车对应关系
|
||||
* @param jsonMes
|
||||
* @param httpServletRequest
|
||||
* @return
|
||||
* @throws KeyManagementException
|
||||
* @throws NoSuchAlgorithmException
|
||||
*/
|
||||
@PostMapping("/vGpsLiShiHeTong/getPageList")
|
||||
public JSONObject vGpsLiShiHeTong(@RequestBody JSONObject jsonMes,HttpServletRequest httpServletRequest) throws KeyManagementException, NoSuchAlgorithmException {
|
||||
try {
|
||||
String ip = httpServletRequest.getRemoteAddr();
|
||||
if (limitIpInfo_dep6.getJSONObject(ip) == null) {
|
||||
limitIpInfo_dep6.put(ip, initializationIP());
|
||||
try {
|
||||
String key=jsonMes.getString("key");
|
||||
if (key.equals("5fff9123eadbae0007b9ce3e")){
|
||||
JSONArray jsonArray= J9053Dao.getAllvGpsLiShiHeTong();
|
||||
return J905Util.returnOK(jsonArray);
|
||||
}else{
|
||||
return J905Util.returnLoser(400,"秘钥错误");//秘钥错误
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
JSONObject limitInfo = limitIpInfo_dep6.getJSONObject(ip);
|
||||
Long time = (new Date().getTime() - limitInfo.getLong("time")) / 1000;//秒
|
||||
//logger.info(ip+":还需等待"+time);
|
||||
if (time>=180) {
|
||||
limitIpInfo_dep6.put(ip, initializationIP());
|
||||
try {
|
||||
String key=jsonMes.getString("key");
|
||||
if (key.equals("5fff9123eadbae0007b9ce3e")){
|
||||
JSONArray jsonArray=J9053Dao.getAllvGpsLiShiHeTong();
|
||||
return J905Util.returnOK(jsonArray);
|
||||
}else{
|
||||
return J905Util.returnLoser(400,"秘钥错误");//秘钥错误
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
return J905Util.returnLoser(402,"接口频率超出限制,3分钟内允许调取一次,请稍后再试");//秘钥错误
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
return J905Util.returnLoser(401,"系统查询异常,请联系开发人员");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private JSONObject initializationIP() {
|
||||
JSONObject info = new JSONObject();
|
||||
info.put("time", new Date().getTime());
|
||||
info.put("num", 1);
|
||||
return info;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user