人员卡管理

pull/4/head
dearlin 2024-02-22 09:19:36 +08:00
parent c4730709b2
commit 34d95fcf18
4 changed files with 470 additions and 7 deletions

View File

@ -0,0 +1,119 @@
package com.zcloud.controller.positioning;
import com.alibaba.fastjson.JSONObject;
import com.zcloud.controller.base.BaseController;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import com.zcloud.util.Jurisdiction;
import com.zcloud.util.PLSUtil;
import com.zcloud.util.ReturnMap;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
/**
* -
* wangxuan
* www.zcloudchina.com
*/
@Controller
@RequestMapping("/positAlarm")
public class MapSettingController extends BaseController {
/**
* @Description:
* @Author: dearLin
* @Date: 2024/1/26/026 16:43
* @Param: [] []
* @Return: com.zcloud.util.ReturnMap
*/
@RequestMapping(value = "/list")
@ResponseBody
public ReturnMap list(Page page) throws Exception {
PageData pageData = this.getPageData();
ReturnMap returnMap = new ReturnMap();
JSONObject body = PLSUtil.getLayerList(
Jurisdiction.getCORPINFO_ID(), page.getCurrentPage() + 1, page.getShowCount(), pageData.getString("keywords"));
if (body != null) {
List<JSONObject> list = body.getJSONArray("rows").toJavaList(JSONObject.class);
returnMap.put("varList", list);
page.setTotalResult(body.getIntValue("total"));
returnMap.put("page", page);
}
return returnMap;
}
/**
* @Description:
* @Author: dearLin
* @Date: 2024/1/26/026 16:43
* @Param: [] []
* @Return: com.zcloud.util.ReturnMap
*/
@RequestMapping(value = "/save")
@ResponseBody
public ReturnMap save() throws Exception {
PageData pageData = this.getPageData();
ReturnMap returnMap = new ReturnMap();
JSONObject body = PLSUtil.GeneralPost("/region/layer",pageData, Jurisdiction.getCORPINFO_ID());
if (body != null) {
returnMap.putAll(body);
}
return returnMap;
}
/**
* @Description:
* @Author: dearLin
* @Date: 2024/1/26/026 16:43
* @Param: [] []
* @Return: com.zcloud.util.ReturnMap
*/
@RequestMapping(value = "/goEdit")
@ResponseBody
public ReturnMap goEdit() throws Exception {
PageData pageData = this.getPageData();
ReturnMap returnMap = new ReturnMap();
JSONObject body = PLSUtil.GeneralGetById("/region/layer/",Integer.parseInt(pageData.getString("layId")), Jurisdiction.getCORPINFO_ID());
if (body != null) {
returnMap.putAll(body);
}
return returnMap;
}
/**
* @Description:
* @Author: dearLin
* @Date: 2024/1/26/026 16:43
* @Param: [] []
* @Return: com.zcloud.util.ReturnMap
*/
@RequestMapping(value = "/edit")
@ResponseBody
public ReturnMap edit() throws Exception {
PageData pageData = this.getPageData();
ReturnMap returnMap = new ReturnMap();
JSONObject body = PLSUtil.GeneralPut("/region/layer",pageData, Jurisdiction.getCORPINFO_ID());
if (body != null) {
returnMap.putAll(body);
}
return returnMap;
}
/**
* @Description:
* @Author: dearLin
* @Date: 2024/1/26/026 16:43
* @Param: [] []
* @Return: com.zcloud.util.ReturnMap
*/
@RequestMapping(value = "/remove")
@ResponseBody
public ReturnMap remove() throws Exception {
PageData pageData = this.getPageData();
ReturnMap returnMap = new ReturnMap();
JSONObject body = PLSUtil.GeneralDelete("/region/layer/",Integer.parseInt(pageData.getString("layId")), Jurisdiction.getCORPINFO_ID());
if (body != null) {
returnMap.putAll(body);
}
return returnMap;
}
}

View File

@ -0,0 +1,79 @@
package com.zcloud.controller.positioning;
import com.alibaba.fastjson.JSONObject;
import com.zcloud.controller.base.BaseController;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import com.zcloud.util.Jurisdiction;
import com.zcloud.util.PLSUtil;
import com.zcloud.util.ReturnMap;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.HashMap;
import java.util.List;
/**
* -
* wangxuan
* www.zcloudchina.com
*/
@Controller
@RequestMapping("/positAlarm")
public class PositAlarmController extends BaseController {
/**
* @Description:
* @Author: dearLin
* @Date: 2024/1/26/026 16:43
* @Param: [] []
* @Return: com.zcloud.util.ReturnMap
*/
@RequestMapping(value = "/getAlArmDataList")
@ResponseBody
public ReturnMap getAlArmDataList(Page page) throws Exception {
PageData pageData = this.getPageData();
ReturnMap returnMap = new ReturnMap();
JSONObject body = PLSUtil.getAlArmDataList(
Jurisdiction.getCORPINFO_ID(), page.getCurrentPage() + 1, page.getShowCount(), "", Integer.parseInt(pageData.getString("status")), Integer.parseInt(pageData.getString("eleType"))
);
if (body != null) {
List<JSONObject> list = body.getJSONArray("rows").toJavaList(JSONObject.class);
returnMap.put("varList", list);
page.setTotalResult(body.getIntValue("total"));
returnMap.put("page", page);
}
return returnMap;
}
/**
* @Description:
* @Author: dearLin
* @Date: 2024/1/26/026 16:43
* @Param: [] []
* @Return: com.zcloud.util.ReturnMap
*/
@RequestMapping(value = "/alarmHandling")
@ResponseBody
public ReturnMap alarmHandling() throws Exception {
PageData pageData = this.getPageData();
ReturnMap returnMap = new ReturnMap();
JSONObject body = PLSUtil.GeneralPost("/region/alarm/alarmHandling",pageData, Jurisdiction.getCORPINFO_ID());
if (body != null) {
returnMap.putAll(body);
}
return returnMap;
}
@RequestMapping(value = "/alarmHandlingAll")
@ResponseBody
public ReturnMap alarmHandlingAll() throws Exception {
PageData pageData = this.getPageData();
ReturnMap returnMap = new ReturnMap();
JSONObject body = PLSUtil.GeneralPost("/region/alarm/alarmHandlingAll",pageData, Jurisdiction.getCORPINFO_ID());
if (body != null) {
returnMap.putAll(body);
}
return returnMap;
}
}

View File

@ -0,0 +1,164 @@
package com.zcloud.controller.positioning;
import com.alibaba.fastjson.JSONObject;
import com.zcloud.controller.base.BaseController;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import com.zcloud.util.Jurisdiction;
import com.zcloud.util.PLSUtil;
import com.zcloud.util.ReturnMap;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
/**
*
* wangxuan
* www.zcloudchina.com
*/
@Controller
@RequestMapping("/deploy/card")
public class UserCardController extends BaseController {
/**
* @Description:
* @Author: dearLin
* @Date: 2024/1/26/026 16:43
* @Param: [] []
* @Return: com.zcloud.util.ReturnMap
*/
@RequestMapping(value = "/list")
@ResponseBody
public ReturnMap list(Page page) throws Exception {
PageData pageData = this.getPageData();
ReturnMap returnMap = new ReturnMap();
page.setPd(pageData);
JSONObject body = PLSUtil.getUserCardDataList(
Jurisdiction.getCORPINFO_ID(), Integer.parseInt(pageData.getString("currentPage")), Integer.parseInt(pageData.getString("showCount")), pageData.getString("KEYWORDS"));
if (body != null) {
List<JSONObject> list = body.getJSONArray("rows").toJavaList(JSONObject.class);
returnMap.put("varList", list);
page.setTotalResult(body.getIntValue("total"));
returnMap.put("page", page);
}
return returnMap;
}
/**
* @Description:
* @Author: dearLin
* @Date: 2024/1/26/026 16:43
* @Param: [] []
* @Return: com.zcloud.util.ReturnMap
*/
@RequestMapping(value = "/edit")
@ResponseBody
public ReturnMap edit() throws Exception {
PageData pageData = this.getPageData();
ReturnMap returnMap = new ReturnMap();
JSONObject body = PLSUtil.GeneralPut("/deploy/card", pageData, Jurisdiction.getCORPINFO_ID());
if (body != null) {
returnMap.putAll(body);
}
return returnMap;
}
/**
* @Description:
* @Author: dearLin
* @Date: 2024/1/26/026 16:43
* @Param: [] []
* @Return: com.zcloud.util.ReturnMap
*/
@RequestMapping(value = "/thePersonWhoDidNotBindTheCard")
@ResponseBody
public ReturnMap thePersonWhoDidNotBindTheCard() throws Exception {
ReturnMap returnMap = new ReturnMap();
JSONObject body = PLSUtil.GetGeneral("/deploy/card/thePersonWhoDidNotBindTheCard", Jurisdiction.getCORPINFO_ID());
if (body != null) {
returnMap.putAll(body);
}
return returnMap;
}
/**
* @Description:
* @Author: dearLin
* @Date: 2024/1/26/026 16:43
* @Param: [] []
* @Return: com.zcloud.util.ReturnMap
*/
@RequestMapping(value = "/goEdit")
@ResponseBody
public ReturnMap goEdit() throws Exception {
PageData pageData = getPageData();
ReturnMap returnMap = new ReturnMap();
JSONObject body = PLSUtil.GeneralGetById("/deploy/card/feign-client/", Integer.parseInt(pageData.getString("cardNo")), Jurisdiction.getCORPINFO_ID());
if (body != null) {
returnMap.putAll(body);
}
return returnMap;
}
/**
* @Description:
* @Author: dearLin
* @Date: 2024/1/26/026 16:43
* @Param: [] []
* @Return: com.zcloud.util.ReturnMap
*/
@RequestMapping(value = "/remove")
@ResponseBody
public ReturnMap remove() throws Exception {
PageData pageData = getPageData();
ReturnMap returnMap = new ReturnMap();
JSONObject body = PLSUtil.GeneralDelete("/deploy/card/", pageData.getString("DATA_IDS"), Jurisdiction.getCORPINFO_ID());
if (body != null) {
returnMap.putAll(body);
}
return returnMap;
}
/**
* @Description:
* @Author: dearLin
* @Date: 2024/1/26/026 16:43
* @Param: [] []
* @Return: com.zcloud.util.ReturnMap
*/
@RequestMapping(value = "/batchUnbinding")
@ResponseBody
public ReturnMap removeBatch() throws Exception {
PageData pageData = getPageData();
ReturnMap returnMap = new ReturnMap();
JSONObject body = PLSUtil.GeneralDelete("/deploy/card/batchUnbinding/", pageData.getString("DATA_IDS"), Jurisdiction.getCORPINFO_ID());
if (body != null) {
if (!body.getString("code").equals("200")) return ReturnMap.error(body.getString("msg"));
returnMap.putAll(body);
}
return returnMap;
}
/**
* @Description:
* @Author: dearLin
* @Date: 2024/2/21/021 15:33
* @Param: [] []
* @Return: com.zcloud.util.ReturnMap
*/
@RequestMapping(value = "/addInBulk")
@ResponseBody
public ReturnMap addInBulk() throws Exception {
PageData pageData = this.getPageData();
ReturnMap returnMap = new ReturnMap();
JSONObject body = PLSUtil.GeneralPost("/deploy/card/addInBulk", pageData, Jurisdiction.getCORPINFO_ID());
if (body != null) {
returnMap.putAll(body);
}
return returnMap;
}
}

View File

@ -1,5 +1,6 @@
package com.zcloud.util;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.zcloud.entity.PageData;
import com.zcloud.service.corp.CorpPlsInfoService;
@ -44,6 +45,17 @@ public class PLSUtil {
return exchange.getBody();
}
public static JSONObject GetGeneral(String url, String CORPINFO_ID) throws Exception {
HttpHeaders headers = new HttpHeaders();
headers.set("Authorization", getToken(CORPINFO_ID));
HttpEntity<JSONObject> httpEntity = new HttpEntity<>(headers);
ResponseEntity<JSONObject> exchange = restTemplate.exchange(
PLSUtil.BAKEADDR.get(CORPINFO_ID) + url,
HttpMethod.GET, httpEntity,
JSONObject.class);
return exchange.getBody();
}
@Autowired
public void setCorpplsinfoService(CorpPlsInfoService corpplsinfoServicebean, UsersService usersServicebean, RestTemplate restTemplatebean) {
corpplsinfoService = corpplsinfoServicebean;
@ -69,6 +81,69 @@ public class PLSUtil {
return exchange.getBody();
}
public static JSONObject GeneralPost(String Url, PageData pageData, String CORPINFO_ID) throws Exception {
JSONObject uriVariables = JSONObject.parseObject(JSON.toJSONString(pageData));
HttpHeaders headers = new HttpHeaders();
headers.set("Authorization", getToken(CORPINFO_ID));
HttpEntity<JSONObject> httpEntity = new HttpEntity<>(uriVariables, headers);
ResponseEntity<JSONObject> exchange = restTemplate.exchange(PLSUtil.BAKEADDR.get(CORPINFO_ID) + Url,
HttpMethod.POST,
httpEntity,
JSONObject.class);
return exchange.getBody();
}
public static JSONObject GeneralGetById(String Url, Integer id, String CORPINFO_ID) throws Exception {
HttpHeaders headers = new HttpHeaders();
headers.set("Authorization", getToken(CORPINFO_ID));
HttpEntity<JSONObject> httpEntity = new HttpEntity<>(headers);
ResponseEntity<JSONObject> exchange = restTemplate.exchange(PLSUtil.BAKEADDR.get(CORPINFO_ID) + Url + id,
HttpMethod.GET,
httpEntity,
JSONObject.class);
return exchange.getBody();
}
public static JSONObject GeneralPut(String Url, PageData pageData, String CORPINFO_ID) throws Exception {
JSONObject uriVariables = JSONObject.parseObject(JSON.toJSONString(pageData));
HttpHeaders headers = new HttpHeaders();
headers.set("Authorization", getToken(CORPINFO_ID));
HttpEntity<JSONObject> httpEntity = new HttpEntity<>(uriVariables,headers);
ResponseEntity<JSONObject> exchange = restTemplate.exchange(PLSUtil.BAKEADDR.get(CORPINFO_ID) + Url,
HttpMethod.PUT,
httpEntity,
JSONObject.class);
return exchange.getBody();
}
public static JSONObject GeneralDelete(String Url, Object id, String CORPINFO_ID) throws Exception {
HttpHeaders headers = new HttpHeaders();
headers.set("Authorization", getToken(CORPINFO_ID));
HttpEntity<JSONObject> httpEntity = new HttpEntity<>(headers);
ResponseEntity<JSONObject> exchange = restTemplate.exchange(PLSUtil.BAKEADDR.get(CORPINFO_ID) + Url+id,
HttpMethod.DELETE,
httpEntity,
JSONObject.class);
return exchange.getBody();
}
/**
* @Description:
* @Author: dearLin
* @Date: 2024/1/25/025 14:37
* @Param: [java.lang.String, java.lang.Integer, java.lang.Integer] [keywords, currentPage, showCount]
* @Return: com.alibaba.fastjson.JSONObject
*/
public static JSONObject getLayerList(String CORPINFO_ID, Integer currentPage, Integer showCount, String keywords) throws Exception {
HttpHeaders headers = new HttpHeaders();
headers.set("Authorization", getToken(CORPINFO_ID));
HttpEntity<JSONObject> httpEntity = new HttpEntity<>(headers);
String url = "/region/layer/list?pageNum=" + currentPage + "&pageSize=" + showCount + "&str=";
if (Tools.notEmpty(keywords)) {
url = url + keywords;
}
ResponseEntity<JSONObject> exchange = restTemplate.exchange(PLSUtil.BAKEADDR.get(CORPINFO_ID) + url
, HttpMethod.GET, httpEntity, JSONObject.class);
return exchange.getBody();
}
/**
* @Description:
@ -77,7 +152,7 @@ public class PLSUtil {
* @Param: [java.lang.String, java.lang.Integer, java.lang.Integer] [keywords, currentPage, showCount]
* @Return: com.alibaba.fastjson.JSONObject
*/
public static JSONObject getAlArmDataList(String CORPINFO_ID, Integer currentPage, Integer showCount ,String keywords,Integer status,Integer eleType) throws Exception {
public static JSONObject getAlArmDataList(String CORPINFO_ID, Integer currentPage, Integer showCount, String keywords, Integer status, Integer eleType) throws Exception {
HttpHeaders headers = new HttpHeaders();
headers.set("Authorization", getToken(CORPINFO_ID));
@ -85,11 +160,36 @@ public class PLSUtil {
// currentPage + "&pageSize=" + showCount +"&str=" + "&eleType="+eleType+ "&status="+status
HttpEntity<JSONObject> httpEntity = new HttpEntity<>(headers);
ResponseEntity<JSONObject> exchange = restTemplate.exchange(PLSUtil.BAKEADDR.get(CORPINFO_ID) +
"/region/alarm/list?eleType="+eleType+"+&status="+status+"&pageNum="+currentPage+"&pageSize="+showCount+"&str="
,HttpMethod.GET, httpEntity, JSONObject.class);
"/region/alarm/list?eleType=" + eleType + "+&status=" + status + "&pageNum=" + currentPage + "&pageSize=" + showCount + "&str="
, HttpMethod.GET, httpEntity, JSONObject.class);
return exchange.getBody();
}
/**
* @Description:
* @Author: dearLin
* @Date: 2024/1/25/025 14:37
* @Param: [java.lang.String, java.lang.Integer, java.lang.Integer] [keywords, currentPage, showCount]
* @Return: com.alibaba.fastjson.JSONObject
*/
public static JSONObject getUserCardDataList(String CORPINFO_ID, Integer currentPage, Integer showCount, String keywords) throws Exception {
HttpHeaders headers = new HttpHeaders();
headers.set("Authorization", getToken(CORPINFO_ID));
String url = "/deploy/card/list?pageNum=" + currentPage + "&pageSize=" + showCount + "&str=";
if (Tools.notEmpty(keywords)) {
url = url + keywords;
}
HttpEntity<JSONObject> httpEntity = new HttpEntity<>(headers);
ResponseEntity<JSONObject> exchange = restTemplate.exchange(PLSUtil.BAKEADDR.get(CORPINFO_ID) + url
, HttpMethod.GET, httpEntity, JSONObject.class);
return exchange.getBody();
}
/**
* @Description:
* @Author: dearLin
@ -214,7 +314,7 @@ public class PLSUtil {
}
/**
* @Description: 线
* @Description: 线
* @Date: 2024/1/25/025 14:37
* @Return: com.alibaba.fastjson.JSONObject
*/
@ -556,7 +656,7 @@ public class PLSUtil {
*
*
* @param polygon [[lng,lat,alt],[lng,lat,alt],[lng,lat,alt],...]
* @return [lng,lat,alt]
* @return [lng, lat, alt]
* @throws IOException
*/
public static List<String> getRandomPointInPolygon(List<List<Double>> polygon) {
@ -578,7 +678,7 @@ public class PLSUtil {
Double y = minY + rand.nextDouble() * (maxY - minY);
if (pointInPolygon(polygon, x, y)) {
List<String> point = Arrays.asList(x.toString(),y.toString(),polygon.get(0).get(2).toString());
List<String> point = Arrays.asList(x.toString(), y.toString(), polygon.get(0).get(2).toString());
return point;
}
}
@ -586,12 +686,13 @@ public class PLSUtil {
/**
*
*
* @param polygon
* @param lng
* @param lat
* @return
*/
private static boolean pointInPolygon(List<List<Double>> polygon,double lng, double lat) {
private static boolean pointInPolygon(List<List<Double>> polygon, double lng, double lat) {
boolean inside = false;
int n = polygon.size();
for (int i = 0, j = n - 1; i < n; j = i++) {