Merge remote-tracking branch 'origin/dev' into dev

pull/4/head
chenxinying 2024-01-15 17:19:50 +08:00
commit 0fce9d9f9a
10 changed files with 315 additions and 17 deletions

2
.gitignore vendored
View File

@ -15,6 +15,7 @@
*.iws
*.iml
*.ipr
*.log
### NetBeans ###
/nbproject/private/
@ -23,3 +24,4 @@
/dist/
/nbdist/
/.nb-gradle/
/catalina.base_IS_UNDEFINED/

View File

@ -319,15 +319,18 @@ public class CorpInfoController extends BaseController {
PageData corpOfType = new PageData();
corpOfType.put("CORPTYPE_ID", pd.get("CORP_OF_TYPE"));
corpOfType = corptypeService.findById(corpOfType);
if (corpOfType != null) {
pd.put("CORP_OF_TYPE_NAME", corpOfType.get("NAME"));
}
}
if (Tools.notEmpty(pd.getString("CORP_OF_TYPE2"))) {
PageData corpOfType2 = new PageData();
corpOfType2.put("CORPTYPE_ID", pd.get("CORP_OF_TYPE2"));
corpOfType2 = corptypeService.findById(corpOfType2);
if (corpOfType2 != null) {
pd.put("CORP_OF_TYPE_NAME2", corpOfType2.get("NAME"));
}
}
pd.put("POSSESSION", POSSESSIONALL);
pd.put("ECO_TYPEALL", ECO_TYPEALL);

View File

@ -111,7 +111,7 @@ public class OffDutyController extends BaseController {
PageData pd = new PageData();
PageData npd = new PageData();
pd = this.getPageData();
String KEYWORDS = pd.getString("KEYWORDS"); //关键词检索条件
String KEYWORDS = pd.getString("KEYWORDS");//关键词检索条件
if(Tools.notEmpty(KEYWORDS))npd.put("KEYWORDS", KEYWORDS.trim());
npd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID());
npd.put("DEPARTMENT_ID", Jurisdiction.getDEPARTMENT_ID());
@ -139,7 +139,7 @@ public class OffDutyController extends BaseController {
npd.put("DEPARTMENT_IDS", DEPARTMENT_ID);
}
}else {
if(npd.getString("ISMAIN").equals("0")){
if(npd.getString("ISMAIN") != null && npd.getString("ISMAIN").equals("0")){
npd.put("USER_ID",Jurisdiction.getUSER_ID());
}
}

View File

@ -0,0 +1,19 @@
package com.zcloud.entity;
import lombok.Data;
@Data
public class Camera {
private String camName; // 摄像头名称
private String camNo; // 摄像头编号
private String camIp; // 摄像头 IP 地址
private String port; // 摄像头端口号
private String type; // 摄像头类型
private String camUserName; // 摄像头用户名
private String camPassword; // 摄像头密码
private String lon; // 摄像头经度
private String lat; // 摄像头纬度
private String alt; // 摄像头海拔
private String channel; // 通道号
private String indexcode; // 索引编码
}

View File

@ -0,0 +1,12 @@
package com.zcloud.entity;
import lombok.Data;
@Data
public class Card {
private String cardNo; // 卡号
private String psnId; // 绑定人员Id
private String cardType; // 卡类型
private String cardStatus; // 卡状态
private String remark; // 备注
}

View File

@ -100,6 +100,11 @@ public class TextLibraryServiceImpl implements TextLibraryService {
entity.put("SPECIFICATION_TYPES", _labels.stream().filter(n -> n.get("CATEGORY") != null).filter(n -> n.getString("CATEGORY").equals("SPECIFICATION_TYPES")).collect(Collectors.toList()));
entity.put("ATTRIBUTE_LIST", _labels.stream().filter(n -> n.get("CATEGORY") != null).filter(n -> n.getString("CATEGORY").equals("ATTRIBUTE_LIST")).collect(Collectors.toList()));
entity.put("CATEGORY_LIST", _labels.stream().filter(n -> n.get("CATEGORY") != null).filter(n -> n.getString("CATEGORY").equals("CATEGORY_LIST")).collect(Collectors.toList()));
entity.put("LABEL_NAME", _labels.stream()
.filter(n -> n.getString("LABEL_NAME") != null)
.map(n -> n.getString("LABEL_NAME"))
.findFirst()
.orElse(null));
}
return list;
}

View File

@ -1,6 +1,8 @@
package com.zcloud.util;
import com.alibaba.fastjson.JSONObject;
import com.zcloud.entity.Camera;
import com.zcloud.entity.Card;
import com.zcloud.entity.EmployeeData;
import com.zcloud.entity.PageData;
import com.zcloud.service.corp.CorpPlsInfoService;
@ -9,6 +11,8 @@ import okhttp3.*;
import org.springframework.beans.factory.annotation.Autowired;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class PLSUtil {
@ -18,6 +22,12 @@ public class PLSUtil {
@Autowired
public static UsersService usersService;
/**
*
* @param pd
* @return
* @throws Exception
*/
public static boolean getToken(PageData pd) throws Exception {
boolean tokenUpdated = false;
pd = corpplsinfoService.findById(pd);
@ -53,6 +63,11 @@ public class PLSUtil {
return tokenUpdated;
}
/**
*
* @param pd
* @throws Exception
*/
public static void saveUser(PageData pd) throws Exception {
if (getToken(pd)) {
PageData user = usersService.findByUsername(pd);
@ -71,29 +86,243 @@ public class PLSUtil {
String url = pd.getString("POST_URL") + "/deploy/psnmgmt/insertPsnInfo";
Response response = sendPostHttpRequest(url,employeeData.toString(),token);
if (!response.isSuccessful()) {
throw new IOException(String.valueOf(response));
throw new IOException("请求失败:" + response);
}
} else {
throw new Exception("无法获取有效的Token");
}
}
/**
*
* @param pd
* @throws Exception
*/
public static void updateUserCardInfo(PageData pd) throws Exception {
Card card = new Card();
if (getToken(pd)){
card.setCardNo(pd.getString("CARDNO"));
card.setPsnId(pd.getString("PsnId"));
card.setCardType(pd.getString("CARDTYPE"));
card.setCardStatus(pd.getString("CARDSTATUS"));
card.setRemark(pd.getString("REMARK"));
pd = corpplsinfoService.findById(pd);
String token = pd.getString("TOKEN");
String url = pd.getString("POST_URL") + "/deploy/card";
Response response = sendPutHttpRequest(url, card.toString(), token);
if (!response.isSuccessful()) {
throw new IOException("请求失败:" + response);
}
}else {
throw new Exception("无法获取有效的Token");
}
}
/**
*
* @param pd
* @return
* @throws Exception
*/
public static JSONObject cardIdGetUserInfo(PageData pd) throws Exception {
JSONObject result = null;
if (getToken(pd)){
pd = corpplsinfoService.findById(pd);
String token = pd.getString("TOKEN");
String cardId = pd.getString("CARDNO");
String url = pd.getString("POST_URL") + "/deploy/psnmgt/feign-client/getPsnInfoByCardId/" + cardId;
Response response = sendGetHttpRequest(url, null, token);
if (response.isSuccessful()){
String responseBody = response.body().string();
result = new JSONObject(responseBody.isEmpty());
}else {
throw new IOException("请求失败:" + response);
}
}else {
throw new Exception("无法获取有效的Token");
}
return result;
}
/**
*
* @param pd
* @throws Exception
*/
public static void saveCamera(PageData pd) throws Exception {
Camera camera = new Camera();
if (getToken(pd)) {
camera.setCamName(pd.getString("CAMNAME"));
camera.setCamNo(pd.getString("CAMNO"));
camera.setCamIp(pd.getString("CAMIP"));
camera.setPort(pd.getString("PORT"));
camera.setType(pd.getString("TYPE"));
camera.setCamUserName(pd.getString("CAMUSERNAME"));
camera.setCamPassword(pd.getString("CAMPASSWORD"));
camera.setLon(pd.getString("LON"));
camera.setAlt(pd.getString("ALT"));
camera.setChannel(pd.getString("CHANNEL"));
camera.setIndexcode(pd.getString("INDEXCODE"));
pd = corpplsinfoService.findById(pd);
String token = pd.getString("TOKEN");
String url = pd.getString("POST_URL") + "/device/camera";
Response response = sendPostHttpRequest(url, String.valueOf(camera), token);
if (!response.isSuccessful()){
throw new IOException("请求失败:" + response);
}
}else {
throw new Exception("无法获取有效的Token");
}
}
/**
*
* @param pd
* @throws Exception
*/
public static void updateCamera(PageData pd) throws Exception {
Camera camera = new Camera();
if (getToken(pd)){
camera.setCamName(pd.getString("CAMNAME"));
camera.setCamNo(pd.getString("CAMNO"));
camera.setCamIp(pd.getString("CAMIP"));
camera.setPort(pd.getString("PORT"));
camera.setType(pd.getString("TYPE"));
camera.setCamUserName(pd.getString("CAMUSERNAME"));
camera.setCamPassword(pd.getString("CAMPASSWORD"));
camera.setLon(pd.getString("LON"));
camera.setAlt(pd.getString("ALT"));
camera.setChannel(pd.getString("CHANNEL"));
camera.setIndexcode(pd.getString("INDEXCODE"));
pd = corpplsinfoService.findById(pd);
String token = pd.getString("TOKEN");
String url = pd.getString("POST_URL") + "/device/camera";
Response response = sendPutHttpRequest(url, String.valueOf(camera), token);
if (!response.isSuccessful()){
throw new IOException("请求失败:" + response);
}
}else {
throw new Exception("无法获取有效的Token");
}
}
/**
*
* @param pd
* @return
* @throws Exception
*/
public static JSONObject getAListOfElectronicFences(PageData pd) throws Exception {
if (getToken(pd)) {
pd = corpplsinfoService.findById(pd);
String token = pd.getString("TOKEN");
String url = pd.getString("POST_URL") + "/region/api/electronicFence/getAListOfElectronicFences";
Response response = sendGetHttpRequest(url, null, token);
if (response.isSuccessful()){
String responseBody = response.body().string();
return new JSONObject(responseBody.isEmpty());
}else {
throw new IOException("请求失败:" + response);
}
}else {
throw new Exception("无法获取有效的Token");
}
}
/**
*
* @param pd
* @return
* @throws Exception
*/
public static JSONObject getAlarmStatistics(PageData pd) throws Exception {
JSONObject result = null;
if (getToken(pd)){
pd = corpplsinfoService.findById(pd);
String token = pd.getString("TOKEN");
Map<String,String> queryParams = new HashMap<>();
queryParams.put("type",pd.getString("week"));
String url = pd.getString("POST_URL") + "/region/alarm/alarmStatistics";
Response response = sendGetHttpRequest(url, queryParams, token);
if (response.isSuccessful()){
String responseBody = response.body().string();
return new JSONObject(responseBody.isEmpty());
}else {
throw new IOException("请求失败:" + response);
}
}else {
throw new Exception("无法获取有效的Token");
}
}
/**
* post
* @param url
* @param jsonPayload
* @param token
* @return
* @throws IOException
*/
private static Response sendPostHttpRequest(String url, String jsonPayload, String token) throws IOException {
OkHttpClient client = new OkHttpClient();
MediaType JSON = MediaType.parse("application/json; charset=utf-8");
RequestBody body = RequestBody.create(JSON, jsonPayload);
Request.Builder builder = new Request.Builder() // 构建一个新的Request对象。
.url(url)// 设置请求的URL。
.post(body);// 设置请求的方法为POST并设置请求体。
//构建请求头
if (token != null && !token.isEmpty()) {// 检查token是否存在且不为空。
builder.addHeader("Authorization", "Bearer " + token);
}
// 构建请求
Request request = builder.build();
//发起请求并响应数据
return client.newCall(request).execute();
}
/**
* PUT
* @param url
* @param jsonPayload
* @param token
* @return
* @throws IOException
*/
private static Response sendPutHttpRequest(String url, String jsonPayload, String token)throws IOException{
OkHttpClient client = new OkHttpClient();
MediaType JSON = MediaType.parse("application/json; charset=utf-8");
RequestBody body = RequestBody.create(JSON, jsonPayload);
Request.Builder builder = new Request.Builder()
.url(url)
.post(body);
.put(body);
if (token != null && !token.isEmpty()) {
builder.addHeader("Authorization", "Bearer " + token);
}
Request request = builder.build();
return client.newCall(request).execute();
}
/**
* get
* @param url
* @param queryParams
* @param token
* @return
* @throws IOException
*/
private static Response sendGetHttpRequest(String url, Map<String, String> queryParams, String token) throws IOException {
OkHttpClient client = new OkHttpClient();
@ -116,4 +345,32 @@ public class PLSUtil {
//发送请求并返回响应数据
return client.newCall(request).execute();
}
/**
* delete
* @param url
* @param camIds
* @param token
* @return
* @throws IOException
*/
private static Response sendDeleteHttpRequest(String url, List<String> camIds, String token) throws IOException {
OkHttpClient client = new OkHttpClient();
//将要删除的Id列表转换为逗号分隔的字符串
String joinedIds = String.join(",", camIds);
//构建完整的url
url = url + "/" + joinedIds;
Request.Builder builderBuilder = new Request.Builder()
.url(url)
.delete();
if (token != null && !token.isEmpty()) {
builderBuilder.addHeader("Authorization", "Bearer " + token);
}
Request request = builderBuilder.build();
return client.newCall(request).execute();
}
}

View File

@ -171,8 +171,8 @@
<if test="pd.SPEAKER != null and pd.SPEAKER != ''"><!-- 关键词检索 -->
and f.SPEAKER LIKE CONCAT(CONCAT('%', #{pd.SPEAKER}),'%')
</if>
<if test="pd.tarinTypeID != null and pd.tarinTypeID != ''"><!-- 培训行业类型 -->
and f.TRAINTYPE = #{pd.tarinTypeID}
<if test="pd.trainingSectionKey != null and pd.trainingSectionKey != ''"><!-- 培训行业类型 -->
and f.TRAINTYPE = #{pd.trainingSectionKey}
</if>
<if test="pd.TRAINTYPE != null and pd.TRAINTYPE != ''"><!-- 培训行业类型 -->
and f.TRAINTYPE = #{pd.TRAINTYPE}

View File

@ -184,8 +184,8 @@
f.SPEAKER LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
)
</if>
<if test="pd.tarinTypeID != null and pd.tarinTypeID != ''"><!-- 培训行业类型 -->
and f.TRAINTYPE = #{pd.tarinTypeID}
<if test="pd.trainingSectionKey != null and pd.trainingSectionKey != ''"><!-- 培训行业类型 -->
and f.TRAINTYPE = #{pd.trainingSectionKey}
</if>
<if test="pd.TRAINTYPE != null and pd.TRAINTYPE != ''"><!-- 培训行业类型 -->
and f.TRAINTYPE = #{pd.TRAINTYPE}

View File

@ -1290,7 +1290,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
SYS_USER f
LEFT JOIN OA_DEPARTMENT d ON d.DEPARTMENT_ID = f.DEPARTMENT_ID
where f.ISDELETE = 0 and f.ISLEADER = '1'
<if test="DEPT_IDS != null and DEPT_IDS != ''">
<if test="DEPT_IDS != null and !DEPT_IDS.isEmpty()">
and d.DEPARTMENT_ID in
<foreach item="item" index="index"
collection="DEPT_IDS" open="(" separator="," close=")">