forked from integrated_whb/integrated_whb
绑定人员定位卡号
parent
0650dffac0
commit
8187112f9a
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -66,7 +66,10 @@ public class PageData extends HashMap<Object, Object> implements Map<Object, Obj
|
|||
public String getString(Object key) {
|
||||
return get(key) == null ? null : get(key).toString().trim();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOrDefault(Object key,Object defaultValue) {
|
||||
return map.getOrDefault(key,defaultValue);
|
||||
}
|
||||
@Override
|
||||
public Object put(Object key, Object value) {
|
||||
if (value instanceof ClobProxyImpl) { // 读取oracle Clob类型数据
|
||||
|
|
|
@ -251,4 +251,8 @@ public interface UsersMapper {
|
|||
PageData findByRegulatoryId(PageData pd);
|
||||
|
||||
PageData findByIdForEmis(PageData pd);
|
||||
|
||||
PageData findByCardNo(PageData getCordNo);
|
||||
|
||||
List<PageData> getUserCardNoAll(PageData departPd);
|
||||
}
|
||||
|
|
|
@ -281,4 +281,14 @@ public interface UsersService {
|
|||
*/
|
||||
public PageData findByIdForEmis(PageData pd)throws Exception;
|
||||
|
||||
/**
|
||||
* @Description: 修改人员定位卡号
|
||||
* @Author: dearLin
|
||||
* @Date: 2024/1/24/024 14:12
|
||||
* @Param: [com.zcloud.entity.PageData] [pd]
|
||||
* @Return: boolean
|
||||
*/
|
||||
String changeOrUpdUserCardNo(PageData pd) throws Exception;
|
||||
|
||||
List<PageData> getUserCardNoAll(PageData departPd);
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -68,4 +68,8 @@ public class Const {
|
|||
public static final String ENDPOINT = "vod.cn-beijing.aliyuncs.com";// 访问的域名
|
||||
|
||||
public static final String TOPIC_EIGHTWORK="eightWork_whb_chen";
|
||||
|
||||
// 修改用户相关
|
||||
public static final String CAN_CHENG_USER="SUCCEEDS";
|
||||
public static final String CARD_ALREADY_BEEN_USED="当前卡号已经被使用。使用人:";
|
||||
}
|
||||
|
|
|
@ -193,6 +193,21 @@ public class DateUtil {
|
|||
return dateStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* 当前时间加n小时之后的时间
|
||||
* @param days
|
||||
* @return
|
||||
*/
|
||||
public static String getAfterHourDate(String hours) {
|
||||
int hoursInt = Integer.parseInt(hours);
|
||||
Calendar canlendar = Calendar.getInstance(); // java.util包
|
||||
canlendar.add(Calendar.HOUR, hoursInt); // 日期减 如果不够减会将月变动
|
||||
Date date = canlendar.getTime();
|
||||
SimpleDateFormat sdfd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
String dateStr = sdfd.format(date);
|
||||
return dateStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* 得到n天之后是周几
|
||||
* @param days
|
||||
|
@ -759,7 +774,8 @@ public class DateUtil {
|
|||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println(getHalfYearMonth(true));
|
||||
String afterHourDate = DateUtil.getAfterHourDate("12");
|
||||
System.out.println(afterHourDate);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.zcloud.util;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.zcloud.entity.Camera;
|
||||
import com.zcloud.entity.Card;
|
||||
|
@ -8,325 +9,209 @@ import com.zcloud.entity.PageData;
|
|||
import com.zcloud.service.corp.CorpPlsInfoService;
|
||||
import com.zcloud.service.system.UsersService;
|
||||
import okhttp3.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
|
||||
@Component
|
||||
public class PLSUtil {
|
||||
private static final Logger logger = LoggerFactory.getLogger(PLSUtil.class);
|
||||
|
||||
private static CorpPlsInfoService corpplsinfoService;
|
||||
private static UsersService usersService;
|
||||
// 后台地址
|
||||
public static HashMap<String, String> BAKEADDR = new HashMap<>();
|
||||
|
||||
|
||||
@Autowired
|
||||
public static CorpPlsInfoService corpplsinfoService;
|
||||
@Autowired
|
||||
public static UsersService usersService;
|
||||
public void setCorpplsinfoService(CorpPlsInfoService corpplsinfoServicebean, UsersService usersServicebean) {
|
||||
corpplsinfoService = corpplsinfoServicebean;
|
||||
usersService = usersServicebean;
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
private void initBakeAddr() throws Exception {
|
||||
List<PageData> dataList = corpplsinfoService.listAll(new PageData());
|
||||
dataList.forEach(item -> {
|
||||
BAKEADDR.put(item.getString("CORPINFO_ID"), item.getString("POST_URL"));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证登录
|
||||
* @param pd
|
||||
* @return
|
||||
* @throws Exception
|
||||
* @Description: 获取token
|
||||
* @Author: dearLin
|
||||
* @Date: 2024/1/24/024 9:59
|
||||
* @Param: [] []
|
||||
* @Return: java.lang.String
|
||||
*/
|
||||
public static boolean getToken(PageData pd) throws Exception {
|
||||
boolean tokenUpdated = false;
|
||||
public static String getToken() throws Exception {
|
||||
PageData pd = new PageData();
|
||||
pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID());
|
||||
pd = corpplsinfoService.findById(pd);
|
||||
String token = pd.getString("TOKEN");
|
||||
String backAddr = pd.getString("POST_URL");
|
||||
String expireTime = pd.getString("EXPIRE_TIME");
|
||||
String userName = pd.getString("ACCOUNT");
|
||||
String passWord = pd.getString("PASSWORD");
|
||||
String loginUrl = pd.getString("POST_URL") + "/auth/login";
|
||||
|
||||
if (token == null || expireTime == null || expireTime.trim().isEmpty() || DateUtil.compareDate(DateUtil.getTime(), expireTime)) {
|
||||
JSONObject loginPayload = new JSONObject();
|
||||
loginPayload.put("username", userName);
|
||||
loginPayload.put("password", passWord);
|
||||
loginPayload.put("isPresentationMode", "2");
|
||||
|
||||
Response response = sendPostHttpRequest(loginPayload.toJSONString(), loginUrl,null);
|
||||
if (response.isSuccessful()) {
|
||||
String responseBody = response.body().string();
|
||||
JSONObject responseJSON = new JSONObject(responseBody.isEmpty());
|
||||
JSONObject data = responseJSON.getJSONObject("data");
|
||||
token = data.getString("access_token");
|
||||
String newExpireTime = DateUtil.getAfterDayDate("1");
|
||||
PageData response = sendPostHttpRequest(loginUrl, loginPayload.toJSONString(), null);
|
||||
if (response != null) {
|
||||
PageData valueData = JSONObject.parseObject(response.getString("data"), PageData.class);
|
||||
token = valueData.getString("access_token");
|
||||
String newExpireTime = DateUtil.getAfterHourDate("12");
|
||||
pd.put("TOKEN", token);
|
||||
pd.put("EXPIRE_TIME", newExpireTime);
|
||||
corpplsinfoService.edit(pd);
|
||||
tokenUpdated = true;
|
||||
return token;
|
||||
} else {
|
||||
System.out.println("登录失败" + response.code());
|
||||
System.out.println("登录失败");
|
||||
}
|
||||
} else {
|
||||
tokenUpdated = true;
|
||||
}
|
||||
return tokenUpdated;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增员工信息
|
||||
* @param pd
|
||||
* @throws Exception
|
||||
*/
|
||||
public static void saveUser(PageData pd) throws Exception {
|
||||
if (getToken(pd)) {
|
||||
PageData user = usersService.findByUsername(pd);
|
||||
EmployeeData employeeData = new EmployeeData();
|
||||
|
||||
if (user == null) {
|
||||
employeeData.setName(user.getString("NAME"));
|
||||
employeeData.setAvatar(user.getString("USERAVATARPREFIX") + user.getString("USERAVATARURL"));
|
||||
employeeData.setCardNo(user.getString("CARDNO"));
|
||||
employeeData.setSex(user.getString("SEX"));
|
||||
employeeData.setPhone(user.getString("PHONE"));
|
||||
}
|
||||
|
||||
pd = corpplsinfoService.findById(pd);
|
||||
String token = pd.getString("TOKEN");
|
||||
String url = pd.getString("POST_URL") + "/deploy/psnmgmt/insertPsnInfo";
|
||||
Response response = sendPostHttpRequest(url,employeeData.toString(),token);
|
||||
if (!response.isSuccessful()) {
|
||||
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");
|
||||
}
|
||||
return token;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 发送post类型请求
|
||||
* @param url
|
||||
* @param jsonPayload
|
||||
* @param token
|
||||
* @return
|
||||
* @throws IOException
|
||||
* @Description: 查询这个人的定位卡号是否存在
|
||||
* @Author: dearLin
|
||||
* @Date: 2024/1/24/024 10:00
|
||||
* @Param: [com.zcloud.entity.PageData] [user]
|
||||
* @Return: void
|
||||
*/
|
||||
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);
|
||||
public static boolean hasCardNumber(PageData user) throws Exception {
|
||||
// 根据 定位卡号获取对应的人
|
||||
String url = BAKEADDR.get(Jurisdiction.getCORPINFO_ID()) + "/deploy/card/peopleDisplay/" + user.getString("CARDNO");
|
||||
PageData response = sendGetHttpRequest(url, null, getToken());
|
||||
if (response != null) {
|
||||
if (!"200".equals(response.getString("code"))) {
|
||||
return false;
|
||||
}
|
||||
List<PageData> dataList = JSONObject.parseArray(response.getString("data"), PageData.class);
|
||||
return dataList.isEmpty();
|
||||
}
|
||||
|
||||
// 构建请求
|
||||
Request request = builder.build();
|
||||
//发起请求并响应数据
|
||||
return client.newCall(request).execute();
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送PUT类型请求
|
||||
* @param url
|
||||
* @param jsonPayload
|
||||
* @param token
|
||||
* @return
|
||||
* @throws IOException
|
||||
* @Description: 查询这个人的定位卡号是否存在
|
||||
* @Author: dearLin
|
||||
* @Date: 2024/1/24/024 10:00
|
||||
* @Param: [com.zcloud.entity.PageData] [user]
|
||||
* @Return: void
|
||||
*/
|
||||
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)
|
||||
.put(body);
|
||||
if (token != null && !token.isEmpty()) {
|
||||
builder.addHeader("Authorization", "Bearer " + token);
|
||||
public static PageData getCardNumberPeople(PageData user) throws Exception {
|
||||
// 根据 定位卡号获取对应的人
|
||||
String url = BAKEADDR.get(Jurisdiction.getCORPINFO_ID()) + "/deploy/card/peopleDisplay/" + user.getString("CARDNO");
|
||||
PageData response = sendGetHttpRequest(url, null, getToken());
|
||||
if (response != null) {
|
||||
if (!"200".equals(response.getString("code"))) {
|
||||
return null;
|
||||
}
|
||||
List<PageData> dataList = JSONObject.parseArray(response.getString("data"), PageData.class);
|
||||
return dataList.size() > 0 ? dataList.get(0) : null;
|
||||
}
|
||||
Request request = builder.build();
|
||||
return null;
|
||||
}
|
||||
|
||||
return client.newCall(request).execute();
|
||||
/**
|
||||
* @Description: 把人新增到 人员定位系统
|
||||
* @Author: dearLin
|
||||
* @Date: 2024/1/24/024 10:00
|
||||
* @Param: [com.zcloud.entity.PageData] [user]
|
||||
* @Return: void
|
||||
*/
|
||||
public static boolean saveUser(PageData user) throws Exception {
|
||||
String url = BAKEADDR.get(Jurisdiction.getCORPINFO_ID()) + "/deploy/psnmgt/insertPsnIfon";
|
||||
JSONObject loginPayload = new JSONObject();
|
||||
loginPayload.put("name", user.getString("NAME"));
|
||||
loginPayload.put("cardNo", user.getString("CARDNO"));
|
||||
loginPayload.put("empNo", "");
|
||||
loginPayload.put("sex", "");
|
||||
loginPayload.put("certType", "");
|
||||
loginPayload.put("certNo", "");
|
||||
loginPayload.put("office", "");
|
||||
loginPayload.put("staffType", "");
|
||||
loginPayload.put("phone", "");
|
||||
loginPayload.put("empId", "");
|
||||
loginPayload.put("age", "");
|
||||
loginPayload.put("addr", "");
|
||||
loginPayload.put("remark", "");
|
||||
loginPayload.put("enterpriseName", "");
|
||||
loginPayload.put("officeName", "");
|
||||
loginPayload.put("jobsName", "");
|
||||
loginPayload.put("deptName", "");
|
||||
loginPayload.put("deptId", "");
|
||||
loginPayload.put("avatar", "");
|
||||
PageData response = sendPostHttpRequest(url, loginPayload.toJSONString(), getToken());
|
||||
return "200".equals(response.getString("code"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description: 把人新增到 人员定位系统
|
||||
* @Author: dearLin
|
||||
* @Date: 2024/1/24/024 10:00
|
||||
* @Param: [com.zcloud.entity.PageData] [user]
|
||||
* @Return: void
|
||||
*/
|
||||
public static boolean editUser(PageData user) throws Exception {
|
||||
String url = BAKEADDR.get(Jurisdiction.getCORPINFO_ID()) + "/deploy/psnmgt/updPsnInfoById";
|
||||
JSONObject loginPayload = new JSONObject();
|
||||
loginPayload.put("name", user.getString("NAME"));
|
||||
loginPayload.put("psnId", user.getString("PLS_ID"));
|
||||
loginPayload.put("cardNo", user.getString("CARDNO"));
|
||||
loginPayload.put("empNo", "");
|
||||
loginPayload.put("sex", "");
|
||||
loginPayload.put("certType", "");
|
||||
loginPayload.put("certNo", "");
|
||||
loginPayload.put("office", "");
|
||||
loginPayload.put("staffType", "");
|
||||
loginPayload.put("phone", "");
|
||||
loginPayload.put("empId", "");
|
||||
loginPayload.put("age", "");
|
||||
loginPayload.put("addr", "");
|
||||
loginPayload.put("remark", "");
|
||||
loginPayload.put("enterpriseName", "");
|
||||
loginPayload.put("officeName", "");
|
||||
loginPayload.put("jobsName", "");
|
||||
loginPayload.put("deptName", "");
|
||||
loginPayload.put("deptId", "");
|
||||
loginPayload.put("avatar", "");
|
||||
PageData response = sendPostHttpRequest(url, loginPayload.toJSONString(), getToken());
|
||||
return "200".equals(response.getString("code"));
|
||||
}
|
||||
public static boolean removeUser(PageData user) throws Exception {
|
||||
String url = BAKEADDR.get(Jurisdiction.getCORPINFO_ID()) + "/deploy/psnmgt";
|
||||
PageData removeUser = usersService.findById(user);
|
||||
PageData response = sendDeleteHttpRequest(url, Long.parseLong(removeUser.getString("PLS_ID")), getToken());
|
||||
return "200".equals(response.getString("code"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送get类型请求
|
||||
*
|
||||
* @param url
|
||||
* @param queryParams
|
||||
* @param token
|
||||
* @return
|
||||
* @return PageData
|
||||
* @throws IOException
|
||||
*/
|
||||
private static Response sendGetHttpRequest(String url, Map<String, String> queryParams, String token) throws IOException {
|
||||
|
||||
private static PageData sendGetHttpRequest(String url, Map<String, String> queryParams, String token) throws IOException {
|
||||
OkHttpClient client = new OkHttpClient();
|
||||
|
||||
HttpUrl.Builder httpBuilder = HttpUrl.parse(url).newBuilder();
|
||||
HttpUrl.Builder httpBuilder = Objects.requireNonNull(HttpUrl.parse(url)).newBuilder();
|
||||
//封装请求参数
|
||||
if (queryParams != null) {
|
||||
for (Map.Entry<String, String> param : queryParams.entrySet()) {
|
||||
|
@ -342,24 +227,90 @@ public class PLSUtil {
|
|||
}
|
||||
|
||||
Request request = requestBuilder.build();
|
||||
Response execute = client.newCall(request).execute();
|
||||
if (execute.code() != 200) {
|
||||
logger.error("get请求失败,返回状态码:{},url:{}", execute.code(), url);
|
||||
throw new RuntimeException("get请求失败");
|
||||
}
|
||||
return JSONObject.parseObject(execute.body().string(), PageData.class);
|
||||
//发送请求并返回响应数据
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 发送post类型请求
|
||||
*
|
||||
* @param url
|
||||
* @param jsonPayload
|
||||
* @param token
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
private static PageData 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();
|
||||
Response execute = client.newCall(request).execute();
|
||||
if (execute.code() != 200) {
|
||||
logger.error("post请求失败,返回状态码:{},url:{}", execute.code(), url);
|
||||
throw new RuntimeException("get请求失败");
|
||||
}
|
||||
PageData pageData = JSONObject.parseObject(execute.body().string(), PageData.class);
|
||||
if (!"200".equals(pageData.getString("code"))) {
|
||||
logger.error("post请求失败,返回值:{},url:{}", pageData.getString("msg"), url);
|
||||
}
|
||||
return pageData;
|
||||
//发起请求并响应数据
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送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)
|
||||
.put(body);
|
||||
if (token != null && !token.isEmpty()) {
|
||||
builder.addHeader("Authorization", "Bearer " + token);
|
||||
}
|
||||
Request request = builder.build();
|
||||
|
||||
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 {
|
||||
private static PageData sendDeleteHttpRequest(String url,Long camIds, String token) throws IOException {
|
||||
OkHttpClient client = new OkHttpClient();
|
||||
//将要删除的Id列表转换为逗号分隔的字符串
|
||||
String joinedIds = String.join(",", camIds);
|
||||
//构建完整的url
|
||||
url = url + "/" + joinedIds;
|
||||
url = url + "/" + camIds;
|
||||
|
||||
Request.Builder builderBuilder = new Request.Builder()
|
||||
.url(url)
|
||||
|
@ -370,7 +321,15 @@ public class PLSUtil {
|
|||
}
|
||||
|
||||
Request request = builderBuilder.build();
|
||||
|
||||
return client.newCall(request).execute();
|
||||
Response execute = client.newCall(request).execute();
|
||||
if (execute.code() != 200) {
|
||||
logger.error("post请求失败,返回状态码:{},url:{}", execute.code(), url);
|
||||
throw new RuntimeException("get请求失败");
|
||||
}
|
||||
PageData pageData = JSONObject.parseObject(execute.body().string(), PageData.class);
|
||||
if (!"200".equals(pageData.getString("code"))) {
|
||||
logger.error("post请求失败,返回值:{},url:{}", pageData.getString("msg"), url);
|
||||
}
|
||||
return pageData;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ public class RegexPatterns {
|
|||
* 验证码正则, 6位数字或字母
|
||||
*/
|
||||
public static final String VERIFY_CODE_REGEX = "^[a-zA-Z\\d]{6}$";
|
||||
public static final String VERIFY_CARDNO_REGEX = "^[0-9]{4}$";
|
||||
/**
|
||||
* 身份证号正则, 15位或者18位,最后一位可以为字母
|
||||
*/
|
||||
|
|
|
@ -0,0 +1,146 @@
|
|||
package com.zcloud.util;
|
||||
|
||||
/**
|
||||
* 说明:TODO
|
||||
* 作者:wangxuan
|
||||
* 官网:www.zcloudchina.com
|
||||
*/
|
||||
|
||||
import com.zcloud.util.examUntil.CodeMessageEnum;
|
||||
import org.apache.http.HttpStatus;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @description: R类
|
||||
**/
|
||||
public class ReturnMap extends HashMap<String, Object> {
|
||||
/**
|
||||
* 序列ID
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* R的无参构造, 初始化信息
|
||||
*/
|
||||
public ReturnMap() {
|
||||
put("code", 0);
|
||||
put("msg", "success");
|
||||
put("result", "success");
|
||||
}
|
||||
|
||||
/**
|
||||
* error1: 返回默认error
|
||||
*
|
||||
* @return 返回默认error
|
||||
*/
|
||||
public static ReturnMap error() {
|
||||
return error(HttpStatus.SC_INTERNAL_SERVER_ERROR, "未知异常, 请联系管理员");
|
||||
}
|
||||
|
||||
/**
|
||||
* error2
|
||||
*
|
||||
* @param msg 错误信息
|
||||
* @return 返回自定义信息的error
|
||||
*/
|
||||
public static ReturnMap error(String msg) {
|
||||
return error(HttpStatus.SC_INTERNAL_SERVER_ERROR, msg);
|
||||
}
|
||||
|
||||
public static ReturnMap error(CodeMessageEnum codeMessageEnum, String uri) {
|
||||
return error(codeMessageEnum.getCode(), codeMessageEnum.getMessage(), uri);
|
||||
}
|
||||
|
||||
/**
|
||||
* 原先R的code和msg被覆盖
|
||||
*
|
||||
* @param code 错误码
|
||||
* @param msg 错误信息
|
||||
* @return 自定义的错误码和错误信息
|
||||
*/
|
||||
public static ReturnMap error(int code, String msg) {
|
||||
ReturnMap r = new ReturnMap();
|
||||
r.put("code", code);
|
||||
r.put("result", "error");
|
||||
r.put("msg", msg);
|
||||
return r;
|
||||
}
|
||||
|
||||
public static ReturnMap error(String code, String msg) {
|
||||
ReturnMap r = new ReturnMap();
|
||||
r.put("code", code);
|
||||
r.put("result", "error");
|
||||
r.put("msg", msg);
|
||||
return r;
|
||||
}
|
||||
|
||||
public static ReturnMap error(String code, String msg, String uri) {
|
||||
ReturnMap r = new ReturnMap();
|
||||
r.put("code", code);
|
||||
r.put("result", "error");
|
||||
r.put("msg", msg);
|
||||
r.put("uri", uri);
|
||||
return r;
|
||||
}
|
||||
|
||||
/**
|
||||
* ok1
|
||||
* 加入了msg
|
||||
*
|
||||
* @param msg
|
||||
* @return
|
||||
*/
|
||||
public static ReturnMap ok(String msg) {
|
||||
ReturnMap r = new ReturnMap();
|
||||
r.put("msg", msg);
|
||||
return r;
|
||||
}
|
||||
|
||||
/**
|
||||
* ok2: 加入了map
|
||||
*
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
public static ReturnMap ok(Map<String, Object> map) {
|
||||
ReturnMap r = new ReturnMap();
|
||||
r.putAll(map);
|
||||
return r;
|
||||
}
|
||||
|
||||
/**
|
||||
* ok3: 直接返回"0", "success"
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static ReturnMap ok() {
|
||||
return new ReturnMap();
|
||||
}
|
||||
|
||||
/**
|
||||
* 放入自定义的key和value, 然后返回
|
||||
*
|
||||
* @param key
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public ReturnMap put(String key, Object value) {
|
||||
super.put(key, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 得到这个对象的code
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public Integer getCode() {
|
||||
return (Integer) this.get("code");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.zcloud.util.examUntil;
|
||||
|
||||
/**
|
||||
* 说明:TODO
|
||||
* 作者:wangxuan
|
||||
* 官网:www.zcloudchina.com
|
||||
*/
|
||||
/**
|
||||
* @desc 对象返回到前端以及异常抛出的接口类
|
||||
*/
|
||||
public interface BaseResultInterface {
|
||||
|
||||
|
||||
String getCode();
|
||||
|
||||
|
||||
String getMessage();
|
||||
}
|
|
@ -0,0 +1,84 @@
|
|||
package com.zcloud.util.examUntil;
|
||||
|
||||
/**
|
||||
* 说明:TODO
|
||||
* 作者:wangxuan
|
||||
* 官网:www.zcloudchina.com
|
||||
*/
|
||||
|
||||
public class BizException extends RuntimeException implements BaseResultInterface {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
/**
|
||||
* 错误码
|
||||
*/
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 错误信息
|
||||
*/
|
||||
private String message;
|
||||
|
||||
public BizException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public BizException(CodeMessageEnum codeMessageEnum) {
|
||||
super(codeMessageEnum.getCode(),new Throwable());
|
||||
this.code = codeMessageEnum.getCode();
|
||||
this.message = codeMessageEnum.getMessage();
|
||||
}
|
||||
|
||||
public BizException(CodeMessageEnum codeMessageEnum, Throwable cause) {
|
||||
super(codeMessageEnum.getCode(), cause);
|
||||
this.code = codeMessageEnum.getCode();
|
||||
this.message = codeMessageEnum.getMessage();
|
||||
}
|
||||
public BizException (CodeMessageEnum codeMessageEnum, Throwable cause,String details) {
|
||||
super(codeMessageEnum.getCode(), cause);
|
||||
this.code = codeMessageEnum.getCode();
|
||||
this.message = codeMessageEnum.getMessage() + details;
|
||||
}
|
||||
public BizException(CodeMessageEnum codeMessageEnum, String message, Throwable cause) {
|
||||
super(codeMessageEnum.getCode(), cause);
|
||||
this.code = codeMessageEnum.getCode();
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public BizException(String message) {
|
||||
super(message);
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public BizException(String code, String message) {
|
||||
super(code);
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public BizException(String code, String message, Throwable cause) {
|
||||
super(code, cause);
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Throwable fillInStackTrace() {
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getCode() {
|
||||
return this.code;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return this.message;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,197 @@
|
|||
package com.zcloud.util.examUntil;
|
||||
|
||||
/**
|
||||
* 说明:TODO
|
||||
* 作者:wangxuan
|
||||
* 官网:www.zcloudchina.com
|
||||
*/
|
||||
public enum CodeMessageEnum implements BaseResultInterface {
|
||||
|
||||
/** ********* 0000成功 *************** */
|
||||
SUCCESS("0000", "成功!"),
|
||||
SUCCESS_LOGIN("0001", "用户登录成功"),
|
||||
SUCCESS_LOGOUT("0002", "用户退出成功"),
|
||||
|
||||
/* 默认失败 */
|
||||
COMMON_FAIL("999", "失败"),
|
||||
|
||||
/** ********* 1xxx系统错误 *************** */
|
||||
SERVER_BUSY("1001", "服务器正忙,请稍后再试!"),
|
||||
INTERNAL_SERVER_ERROR("1002", "服务器内部错误"),
|
||||
NOT_FOUND("1003", "未找到该资源!"),
|
||||
REQUEST_METHOD_ERROR("1004", "接口请求方法异常"),
|
||||
SQL_SYNTAX_ERROR_EXCEPTION("1005", "SQL语法错误异常"),
|
||||
NULL_POINT_ERROR_EXCEPTION("1006", "空指针异常信息"),
|
||||
INNER_FRAME_EXCEPTION("1007", "内部框架执行异常"),
|
||||
PARSE_TOKEN_EXCEPTION("1008", "解析token异常"),
|
||||
TOKEN_NOT_EXIST("1009", "token不存在"),
|
||||
TOKEN_SIGNATURE_EXCEPTION("1010", "token签名异常"),
|
||||
TOKEN_EXPIRE("1011", "token过期,请重新登录"),
|
||||
IMG_TYPE_NOT_CONFIG("1012", "请配置图片类型"),
|
||||
NOT_CONFIG_FILE_DIR("1013", "请配置文件路径"),
|
||||
UPLOAD_FILE_ERROR("1014", "文件上传失败"),
|
||||
FILE_NOT_EXIST("1015", "文件不存在"),
|
||||
FILE_HAS_DELETED("1016", "文件已被删除"),
|
||||
DRIVER_CLASS_NOT_FOUND("1017", "数据库的连接驱动正在加载中..."),
|
||||
TRY_CONNECT_DATABASE_ERROR("1018", "尝试连接数据库失败"),
|
||||
CLOSE_CONNECT_DATABASE_ERROR("1019", "关闭数据库连接失败"),
|
||||
DATABASE_NAME_NOT_EXIST("1020", "数据库名称不存在"),
|
||||
CLOSE_DATASOURCE_ERROR("1021", "释放数据库资源异常"),
|
||||
DRUID_DATASOURCE_ERROR("1022", "数据源创建中..."),
|
||||
CREATE_DATABASE_ERROR("1023", "创建数据库失败"),
|
||||
CREATE_TABLE_ERROR("1024", "创建表失败"),
|
||||
UPDATE_TABLE_FIELD_ERROR("1025", "更新表字段失败"),
|
||||
DELETE_TABLE_FIELD_ERROR("1026", "删除表字段失败"),
|
||||
QUERY_ROLE_ERROR("1027", "查询角色失败"),
|
||||
UPDATE_GROUP_ERROR("1028", "更新接口组失败"),
|
||||
DELETE_GROUP_ERROR("1029", "删除接口组失败"),
|
||||
SAVE_INTERFACE_ERROR("1030", "保存接口信息失败"),
|
||||
|
||||
/**
|
||||
* ******2xxx参数错误 *********************
|
||||
*/
|
||||
BODY_NOT_MATCH("2001", "请求的数据格式不符"),
|
||||
SIGNATURE_NOT_MATCH("2002", "请求的数字签名不匹配!"),
|
||||
REQUEST_PATH_NOT_MATCH("2003", "当前请求路径没有权限!"),
|
||||
NOT_UPLOAD_FILE_NAME_ERROR("2004", "上传的文件名不存在,请重新上传"),
|
||||
NOT_SUPPORT_IMG_TYPE("2005", "图片格式不正确,请重新上传"),
|
||||
NOT_SUPPORT_USERNAME_TYPE("2006", "excel用户名不能为空"),
|
||||
NOT_SUPPORT_ROLE_TYPE("2007", "角色不存在"),
|
||||
NOT_SUPPORT_DEPT_TYPE("2008", "部门不存在"),
|
||||
SQL_INJECT_NOT_ALLOWED("2009", "参数中存在数据库关键字,请修改"),
|
||||
TABLE_FIELD_NOT_EXIST("2010", "表字段不存在"),
|
||||
FILE_PICTURE_IS_NULL("2011", "附件不存在"),
|
||||
FILE_PICTURE_DELETE("2012", "删除附件失败"),
|
||||
DIC_BIANMA_REPEAT("2013", "字典编码重复"),
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/** *********** 3xxx用户错误 ******************* */
|
||||
USER_NOT_LOGIN("3001", "用户未登录"),
|
||||
USER_ACCOUNT_EXPIRED("3002", "账号已过期"),
|
||||
USER_CREDENTIALS_ERROR("3003", "用户名或密码错误"),
|
||||
USER_CREDENTIALS_EXPIRED("3004", "密码过期"),
|
||||
USER_ACCOUNT_NOT_BIND_ENTERPRISE("3005", "当前账号未绑定企业"),
|
||||
USER_ACCOUNT_LOCKED("3006", "账号被锁定"),
|
||||
USER_ACCOUNT_NOT_EXIST("3007", "账号不存在"),
|
||||
USER_ACCOUNT_ALREADY_EXIST("3008", "账号已存在"),
|
||||
USER_ACCOUNT_USE_BY_OTHERS("3009", "账号下线"),
|
||||
USER_NO_PERMISSION("3010", "当前账号没有此权限"),
|
||||
USERNAME_NOT_BLANK("3011", "用户不能为空"),
|
||||
USER_LOGIN_ERROR("3012", "用户登录失败"),
|
||||
USER_LOGOUT_ERROR("3013", "用户退出失败"),
|
||||
USER_ACCOUNT_USE_BY_OTHERS_ERROR("3014", "账号下线异常"),
|
||||
USER_ACCESS_DENIED("3015", "权限认证失败"),
|
||||
USERNAME_EXIST_ERROR("3016", "用户名重名"),
|
||||
|
||||
ROLE_NAME_ALREADY_EXIST("3101", "角色已存在"),
|
||||
|
||||
/** ********** 4xxx业务错误 *********************** */
|
||||
ENTERPRISE_NOT_EXIST("4001", "当前企业不存在"),
|
||||
APP_KEY_EXIST("4002", "应用key已存在"),
|
||||
APP_NOT_EXIST("4003", "应用不存在"),
|
||||
APP_PAGE_NAME_EXIST("4004", "当前页面名称已存在"),
|
||||
APP_PAGE_KEY_EXIST("4005", "当前页面key已存在"),
|
||||
APP_PAGE_NOT_EXIST("4006", "当前页面不存在,或已删除"),
|
||||
APP_PAGE_TYPE_ERROR("4007", "页面类型有误"),
|
||||
APP_PAGE_HOME_IS_NOT_EXIST("4008", "请设置首页"),
|
||||
CAN_NOT_DELETE_HOME_PAGE("4009", "请勿删除首页"),
|
||||
DELETE_PAGE_ERROR("4010", "删除页面失败"),
|
||||
CONFIG_CUSTOM_ERROR("4011", "配置自定义页面失败"),
|
||||
APP_PAGE_PARENT_NOT_EXIST("4012", "当前页面的父级页面不存在,或已删除"),
|
||||
DATASOURCE_NAME_EXIST("4013", "当前数据源名称已经存在,请修改后重试"),
|
||||
DATASOURCE_NOT_EXIST("4014", "当前数据源不存在"),
|
||||
DATASOURCE_HAS_DELETED("4015", "当前数据源已删除"),
|
||||
MODEL_NOT_EXIST("4016", "当前模型不存在"),
|
||||
MODEL_HAS_DELETED("4017", "当前模型已删除"),
|
||||
MODEL_NAME_HAS_EXIST("4018", "当前模型名称已存在"),
|
||||
DATASOURCE_NOT_CONFIG("4019", "数据源配置为空,请联系管理员"),
|
||||
DATASOURCE_NOT_CONFIG_DIALECT("4020", "未配置数据源的类型"),
|
||||
DATASOURCE_NOT_CONFIG_DRIVER_CLASS_NAME("4021", "未配置数据源的驱动"),
|
||||
DEPT_USER_EXIST("4022", "部门下存在用户"),
|
||||
NOT_CONFIG_PAGE_BUTTON_TYPE("4023", "未配置按钮雷星"),
|
||||
MODEL_PAGE_RELATION_MODEL("4024", "已关联当前模型页面"),
|
||||
MODEL_PAGE_NOT_EXIST("4025", "模型页面不存在或已被删除"),
|
||||
MODEL_HAS_RELATION_MODEL_PAGE("4026", "当前模型已关联模型页面,不允许删除"),
|
||||
FORM_NOT_EXIST("4027", "模型表单不存在"),
|
||||
READ_FILE_ERROR("4028", "读取模型页面的模板文件失败"),
|
||||
MODEL_PAGE_CONTENT_NULL("4029", "未配置模型页面的模板文件"),
|
||||
NOT_CONFIG_QUERY_SQL("4030", "未配置查询语句"),
|
||||
APP_PAGE_BUTTON_OPTION_VALUE_ERROR("4031", "未配置接口"),
|
||||
DELETE_COLUMN_ERROR("4032", "删除当前失败"),
|
||||
INSERT_DATA_ERROR("4033", "新建数据失败"),
|
||||
EDIT_DATA_ERROR("4034", "编辑数据失败"),
|
||||
DATASOURCE_HAS_MODELS("4035", "当前数据源存在模型,不允许删除"),
|
||||
NOT_CONFIG_FORM_API("4036", "未配置模型表单页的接口信息"),
|
||||
PLEASE_WRITE_AT_LEAST_DATA("4037", "请至少填写一行数据"),
|
||||
AMIS_PAGE_ERROR("4038", "分页参数异常"),
|
||||
QUERY_APP_PAGE_QUERY_FIELD_ERROR("4039", "查询搜素参数异常"),
|
||||
REQUEST_PARAM_NOT_IN_APP_PAGE_QUERY_FIELD("4040", "请求参数不在查询数据表中"),
|
||||
STYLE_LANGUAGE_ON_CSS("4041", "自定义css中的样式语言不能为空"),
|
||||
APP_CONFIG_TYPE_NOT_EXIST("4042", "不支持当前应用设置的类型"),
|
||||
APP_CONFIG_NOT_EXIST_OR_DELETED("4043", "当前设置不存在或已被删除"),
|
||||
APP_HAS_CONFIG_ON_THIS_TYPE("4044", "当前应用设置的类型已存在,请更新"),
|
||||
NOT_SUPPORT_COMPONENT_FRAME("4045", "不支持当前组件框架"),
|
||||
NOT_SUPPORT_COMPONENT_TYPE("4046", "不支持当前组件类型"),
|
||||
CURRENT_APP_KEY_EXIST("4047", "当前应用的组件key已存在"),
|
||||
CREATE_CUSTOM_COMPONENT_ERROR("4048", "新增自定义组件失败"),
|
||||
APP_CUSTOM_COMPONENT_NOT_EXIST("4049", "当前组件不存在或已被删除"),
|
||||
UPDATE_CUSTOM_COMPONENT_ERROR("4050", "更新自定义组件失败"),
|
||||
DELETED_CUSTOM_COMPONENT_ERROR("4051", "删除自定义组件失败"),
|
||||
INSERT_COMPONENT_DEPENDENCE_ERROR("4052", "新增自定义组件依赖项失败"),
|
||||
DELETE_COMPONENT_DEPENDENCE_ERROR("4053", "删除自定义组件依赖项失败"),
|
||||
CURRENT_COMPONENT_DEPENDENCE_NOT_EXIST("4054", "当前自定义组件依赖项不存在或已被删除"),
|
||||
CURRENT_APP_NAME_EXIST("4055", "当前应用的组件名称已存在"),
|
||||
NOT_SUPPORT_DATASOURCE_FROM("4056", "不支持当前的数据库来源"),
|
||||
JDBC_CONFIG_ERROR("4057", "平台内置的数据源配置有误"),
|
||||
NOT_SUPPORT_MODEL_TYPE("4058", "不支持当前的页面模板"),
|
||||
NOT_SUPPORT_CUSTOM_PAGE("4059", "暂不支持自定义页面"),
|
||||
FORM_PAGE_ON_DEVELOPING("4060", "自定义页面的该功能正在开发中..."),
|
||||
APP_PAGE_QUERY_FIELD_NOT_EXIST("4061", "当前查询条件不存在,或已被删除"),
|
||||
APP_PAGE_BUTTON_NOT_EXIST("4062", "当前页面按钮不存在,或已被删除"),
|
||||
TABLE_KEY_MORE_THEN_ONE("4063", "主键超过一个"),
|
||||
TABLE_KEY_LESS_THEN_ONE("4064", "主键必须存在"),
|
||||
TABLE_KEY_MUST_BE_INT("4065", "主键必须为整数类型"),
|
||||
TABLE_FIELD_MUST_EXIST("4066", "必须存在表字段"),
|
||||
CURRENT_MODEL_PAGE_HAS_CONVERSION_CUSTOM_PAGE("4067", "当前模型页面已转成自定义页面"),
|
||||
NOT_SUPPORT_RELEASE_STATUS("4068", "发布版本状态有误"),
|
||||
APP_FORM_BUTTON_NOT_EXIST("4067", "当前表单按钮不存在,或已被删除"),
|
||||
DATASOURCE_KEY_EXIST_ERROR("4068","数据源key已存在")
|
||||
;
|
||||
|
||||
CodeMessageEnum(String code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
/** 返回到前端的code值 */
|
||||
private String code;
|
||||
|
||||
/** 返回到前端的code对应的message值 */
|
||||
private String message;
|
||||
|
||||
@Override
|
||||
public String getCode() {
|
||||
return this.code;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return this.message;
|
||||
}
|
||||
|
||||
// public static CodeVo getJsonObjectByCode(String code) {
|
||||
// CodeVo codeVo = new CodeVo();
|
||||
// if (Tools.isEmpty(code)) {
|
||||
// return codeVo;
|
||||
// }
|
||||
// for (CodeMessageEnum enumObj : CodeMessageEnum.values()) {
|
||||
// if (enumObj.getCode().equals(code)) {
|
||||
// return new CodeVo(code, enumObj.message);
|
||||
// }
|
||||
// }
|
||||
// return codeVo;
|
||||
// }
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package com.zcloud.util.examUntil;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* @Description: 异常拦截接口
|
||||
* @Author: dearLin
|
||||
* @Date: 2023/3/8
|
||||
*/
|
||||
@Target(ElementType.TYPE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
public @interface ErrorOperation {
|
||||
}
|
|
@ -0,0 +1,94 @@
|
|||
package com.zcloud.util.examUntil;
|
||||
|
||||
/**
|
||||
* 说明:TODO
|
||||
* 作者:wangxuan
|
||||
* 官网:www.zcloudchina.com
|
||||
*/
|
||||
|
||||
|
||||
import com.zcloud.util.ReturnMap;
|
||||
import org.mybatis.spring.MyBatisSystemException;
|
||||
import org.springframework.web.HttpRequestMethodNotSupportedException;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import static com.zcloud.util.examUntil.CodeMessageEnum.SERVER_BUSY;
|
||||
|
||||
|
||||
/**
|
||||
* 全局异常
|
||||
*/
|
||||
@RestControllerAdvice(annotations = {ErrorOperation.class})
|
||||
//@Slf4j
|
||||
public class GlobalExceptionHandler {
|
||||
|
||||
/**
|
||||
* 业务异常类
|
||||
*
|
||||
*/
|
||||
@ExceptionHandler(value = BizException.class)
|
||||
@ResponseBody
|
||||
public ReturnMap bizExceptionHandler(HttpServletRequest req, BizException e) {
|
||||
e.printStackTrace();
|
||||
// log.error("发生业务异常: {}, 请求接口: {}", e.getMessage(), req.getRequestURI());
|
||||
return ReturnMap.error("2001" ,e.getMessage(), req.getRequestURI());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 空指针异常
|
||||
*
|
||||
* @param e 异常信息
|
||||
* @param req 请求
|
||||
*/
|
||||
@ExceptionHandler(value = NullPointerException.class)
|
||||
@ResponseBody
|
||||
public ReturnMap exceptionHandler(HttpServletRequest req, NullPointerException e) {
|
||||
e.printStackTrace();
|
||||
// log.error("空指针异常信息: {}, 请求接口: {}", e, req.getRequestURI());
|
||||
return ReturnMap.error(SERVER_BUSY, req.getRequestURI());
|
||||
}
|
||||
|
||||
/**
|
||||
* 接口请求方法异常
|
||||
*
|
||||
*/
|
||||
@ExceptionHandler(value = HttpRequestMethodNotSupportedException.class)
|
||||
@ResponseBody
|
||||
public ReturnMap methodNotSupportedExceptionHandler(HttpServletRequest req, Exception e) {
|
||||
e.printStackTrace();
|
||||
// log.error("请求方法异常信息: {},请求接口: {}", e, req.getRequestURI());
|
||||
return ReturnMap.error(SERVER_BUSY, req.getRequestURI());
|
||||
}
|
||||
|
||||
/**
|
||||
* SQL 语法错误异常
|
||||
*/
|
||||
@ExceptionHandler(value = MyBatisSystemException.class)
|
||||
@ResponseBody
|
||||
public ReturnMap sqlSyntaxErrorExceptionHandler(HttpServletRequest req, Exception e) {
|
||||
e.printStackTrace();
|
||||
// log.error("MyBatis系统异常信息: {},请求接口: {}", e, req.getRequestURI());
|
||||
return ReturnMap.error(SERVER_BUSY, req.getRequestURI());
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 其他异常信息
|
||||
*
|
||||
* @param req
|
||||
* @param e
|
||||
*/
|
||||
@ExceptionHandler(value = Exception.class)
|
||||
@ResponseBody
|
||||
public ReturnMap exceptionHandler(HttpServletRequest req, Exception e) {
|
||||
e.printStackTrace();
|
||||
// log.error("未知异常: {}, 请求接口: {}", e, req.getRequestURI());
|
||||
return ReturnMap.error(SERVER_BUSY, req.getRequestURI());
|
||||
}
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
package com.zcloud.util.examUntil;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.web.context.request.RequestAttributes;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 说明:获取请求参数工具类
|
||||
* 作者:wangxuan
|
||||
* 官网:www.zcloudchina.com
|
||||
*/
|
||||
public class HttpContextUtils {
|
||||
public static HttpServletRequest getHttpServletRequest() {
|
||||
RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
|
||||
if(requestAttributes == null){
|
||||
return null;
|
||||
}
|
||||
|
||||
return ((ServletRequestAttributes) requestAttributes).getRequest();
|
||||
}
|
||||
|
||||
public static Map<String, String> getParameterMap(HttpServletRequest request) {
|
||||
Enumeration<String> parameters = request.getParameterNames();
|
||||
|
||||
Map<String, String> params = new HashMap<>();
|
||||
while (parameters.hasMoreElements()) {
|
||||
String parameter = parameters.nextElement();
|
||||
String value = request.getParameter(parameter);
|
||||
if (StringUtils.isNotBlank(value)) {
|
||||
params.put(parameter, value);
|
||||
}
|
||||
}
|
||||
|
||||
return params;
|
||||
}
|
||||
|
||||
public static String getDomain(){
|
||||
HttpServletRequest request = getHttpServletRequest();
|
||||
StringBuffer url = request.getRequestURL();
|
||||
return url.delete(url.length() - request.getRequestURI().length(), url.length()).toString();
|
||||
}
|
||||
|
||||
public static String getOrigin(){
|
||||
HttpServletRequest request = getHttpServletRequest();
|
||||
return request.getHeader(HttpHeaders.ORIGIN);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package com.zcloud.util.examUntil;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.web.client.RestTemplateBuilder;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
@Configuration
|
||||
public class RestTemplateConfig {
|
||||
//启动时需要实例化该类的一个实例
|
||||
@Autowired
|
||||
private RestTemplateBuilder builder;
|
||||
//使用RestTemplateBuilder来实例化RestTemplate对象,Spring已经默认注入了RestTemplateBuilder实例
|
||||
@Bean
|
||||
public RestTemplate restTemplate(){
|
||||
return builder.build();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,99 @@
|
|||
package com.zcloud.util.examUntil;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.zcloud.entity.PageData;
|
||||
import com.zcloud.util.DateUtil;
|
||||
import com.zcloud.util.Jurisdiction;
|
||||
import com.zcloud.util.UuidUtil;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: TODO
|
||||
* @Author: dearLin
|
||||
* @Date: 2023/8/17/017 15:10
|
||||
* @Param:
|
||||
* @Return:
|
||||
*/
|
||||
public class UserChangeRecordConfig {
|
||||
|
||||
public static final String PC = "pc端";
|
||||
public static final String APP = "app端";
|
||||
public static final String APP_EDIT_BASE_INFO = "app端修改用户基础信息";
|
||||
public static final String APP_EDIT_CORP_BASE_INFO = "app端修改用户就职信息";
|
||||
public static final String PC_EDIT_BASE_INFO = "pc端修改用户基础信息";
|
||||
public static final String PC_IMPROT_USER_BASE_INFO = "pc端导入用户信息";
|
||||
public static final String PC_EDIT_CORP_BASE_INFO = "pc端修改用户就职信息";
|
||||
public static final String PC_DEL_CORP_BASE_INFO = "pc端解除用户服务信息";
|
||||
|
||||
|
||||
public static final String PC_IMPROT_USER_BASE_img = "img端导入用户信息";
|
||||
/**
|
||||
* @Description: 修改信息
|
||||
* @Author: dearLin
|
||||
* @Date: 2023/8/17/017 15:47
|
||||
* @Param: [java.util.List<com.zcloud.entity.PageData>, com.zcloud.entity.PageData] [logUserList, user]
|
||||
* @Return: java.util.List<com.zcloud.entity.PageData>
|
||||
*/
|
||||
public static List<PageData> editUserLogPc(List<PageData> logUserList, PageData user) {
|
||||
user.put("CREATTIME", DateUtil.date2Str(new Date()));
|
||||
user.put("CHANGE_RECORD_ID", UuidUtil.get32UUID());
|
||||
user.put("CHANGE_DATA", JSON.toJSONString(user));
|
||||
user.put("CREATOR", Jurisdiction.getUSER_ID());
|
||||
user.put("CREATOR_NAME", Jurisdiction.getUsername());
|
||||
logUserList.add(user);
|
||||
return logUserList;
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description: 导入用户信息
|
||||
* @Author: dearLin
|
||||
* @Date: 2023/8/17/017 15:47
|
||||
* @Param: [java.util.List<com.zcloud.entity.PageData>, com.zcloud.entity.PageData] [logUserList, user]
|
||||
* @Return: java.util.List<com.zcloud.entity.PageData>
|
||||
*/
|
||||
public static void importUserLogPc(PageData user) {
|
||||
user.put("CREATTIME", DateUtil.date2Str(new Date()));
|
||||
user.put("CHANGE_RECORD_ID", UuidUtil.get32UUID());
|
||||
user.put("CHANGE_DATA", JSON.toJSONString(user));
|
||||
user.put("CREATOR", Jurisdiction.getUSER_ID());
|
||||
user.put("CREATOR_NAME", Jurisdiction.getUsername());
|
||||
user.put("REAMKE", "人员被" + Jurisdiction.getUsername() + "导入,就职于:" + user.getString("CORPINFO_NAME") + "。部门:" + user.getString("DEPARTMENT_NAME"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description: 导入修改用户信息
|
||||
* @Author: dearLin
|
||||
* @Date: 2023/8/17/017 15:47
|
||||
* @Param: [java.util.List<com.zcloud.entity.PageData>, com.zcloud.entity.PageData] [logUserList, user]
|
||||
* @Return: java.util.List<com.zcloud.entity.PageData>
|
||||
*/
|
||||
public static void importEditUserLogPc(PageData user) {
|
||||
user.put("CREATTIME", DateUtil.date2Str(new Date()));
|
||||
user.put("CHANGE_RECORD_ID", UuidUtil.get32UUID());
|
||||
user.put("CHANGE_DATA", JSON.toJSONString(user));
|
||||
user.put("CREATOR", Jurisdiction.getUSER_ID());
|
||||
user.put("CREATOR_NAME", Jurisdiction.getUsername());
|
||||
user.put("REAMKE", "人员被" + Jurisdiction.getUsername() + "导入更新,就职于:" + user.getString("CORPINFO_NAME") + "。部门:" + user.getString("DEPARTMENT_NAME"));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @Description: 解除服务关系
|
||||
* @Author: dearLin
|
||||
* @Date: 2023/8/17/017 15:47
|
||||
* @Param: [java.util.List<com.zcloud.entity.PageData>, com.zcloud.entity.PageData] [logUserList, user]
|
||||
* @Return: java.util.List<com.zcloud.entity.PageData>
|
||||
*/
|
||||
public static List<PageData> clearRelation(List<PageData> logUserList, PageData user) {
|
||||
user.put("CREATTIME", DateUtil.date2Str(new Date()));
|
||||
user.put("CHANGE_RECORD_ID", UuidUtil.get32UUID());
|
||||
user.put("CHANGE_DATA", JSON.toJSONString(user));
|
||||
user.put("CREATOR", Jurisdiction.getUSER_ID());
|
||||
user.put("CREATOR_NAME", Jurisdiction.getUsername());
|
||||
user.put("REAMKE", "人员被" + Jurisdiction.getUsername() + "解除服务关系,曾就职于:" + user.getString("CORPINFO_NAME") + "。部门:" + user.getString("DEPARTMENT_NAME"));
|
||||
logUserList.add(user);
|
||||
return logUserList;
|
||||
}
|
||||
}
|
|
@ -2,19 +2,22 @@
|
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zcloud.mapper.datasource.risk.IdentificationPartsMapper">
|
||||
|
||||
<!--表名 -->
|
||||
<sql id="tableName">
|
||||
BUS_IDENTIFICATIONPARTS
|
||||
</sql>
|
||||
<!--表名 -->
|
||||
<sql id="tableName">
|
||||
BUS_IDENTIFICATIONPARTS
|
||||
</sql>
|
||||
|
||||
<!--数据字典表名 -->
|
||||
<sql id="dicTableName">
|
||||
SYS_DICTIONARIES
|
||||
</sql>
|
||||
<!--数据字典表名 -->
|
||||
<sql id="dicTableName">
|
||||
SYS_DICTIONARIES
|
||||
</sql>
|
||||
|
||||
<!-- 字段 -->
|
||||
<sql id="Field">
|
||||
f.PARTSNAME,
|
||||
<!-- 字段 -->
|
||||
<sql id="Field">
|
||||
f
|
||||
.
|
||||
PARTSNAME
|
||||
,
|
||||
f.CORPINFO_ID,
|
||||
f.CREATOR,
|
||||
f.CREATTIME,
|
||||
|
@ -23,14 +26,17 @@
|
|||
f.ISDELETE,
|
||||
f.LONGITUDE,
|
||||
f.LATITUDE,
|
||||
f.ELECTRONIC_FENCE_ID,
|
||||
f.ELECTRONIC_FENCE,
|
||||
f.IDENTIFICATIONPARTS_ID,
|
||||
f.RISK_UNIT_ID,
|
||||
f.ISMATCHING
|
||||
</sql>
|
||||
</sql>
|
||||
|
||||
<!-- 字段用于新增 -->
|
||||
<sql id="Field2">
|
||||
PARTSNAME,
|
||||
<!-- 字段用于新增 -->
|
||||
<sql id="Field2">
|
||||
PARTSNAME
|
||||
,
|
||||
CORPINFO_ID,
|
||||
CREATOR,
|
||||
CREATTIME,
|
||||
|
@ -39,419 +45,434 @@
|
|||
ISDELETE,
|
||||
LONGITUDE,
|
||||
LATITUDE,
|
||||
ELECTRONIC_FENCE_ID,
|
||||
ELECTRONIC_FENCE,
|
||||
IDENTIFICATIONPARTS_ID,
|
||||
RISK_UNIT_ID,
|
||||
ISMATCHING
|
||||
</sql>
|
||||
</sql>
|
||||
|
||||
<!-- 字段值 -->
|
||||
<sql id="FieldValue">
|
||||
#{PARTSNAME},
|
||||
#{CORPINFO_ID},
|
||||
#{CREATOR},
|
||||
#{CREATTIME},
|
||||
#{OPERATOR},
|
||||
#{OPERATTIME},
|
||||
#{ISDELETE},
|
||||
#{LONGITUDE},
|
||||
#{LATITUDE},
|
||||
#{IDENTIFICATIONPARTS_ID},
|
||||
#{RISK_UNIT_ID},
|
||||
#{ISMATCHING}
|
||||
</sql>
|
||||
<!-- 字段值 -->
|
||||
<sql id="FieldValue">
|
||||
#{PARTSNAME},
|
||||
#{CORPINFO_ID},
|
||||
#{CREATOR},
|
||||
#{CREATTIME},
|
||||
#{OPERATOR},
|
||||
#{OPERATTIME},
|
||||
#{ISDELETE},
|
||||
#{LONGITUDE},
|
||||
#{LATITUDE},
|
||||
#{ELECTRONIC_FENCE_ID},
|
||||
#{ELECTRONIC_FENCE},
|
||||
#{IDENTIFICATIONPARTS_ID},
|
||||
#{RISK_UNIT_ID},
|
||||
#{ISMATCHING}
|
||||
</sql>
|
||||
|
||||
<!-- 新增-->
|
||||
<insert id="save" parameterType="pd">
|
||||
insert into
|
||||
<include refid="tableName"></include>
|
||||
(
|
||||
<include refid="Field2"></include>
|
||||
) values (
|
||||
<include refid="FieldValue"></include>
|
||||
)
|
||||
</insert>
|
||||
<!-- 新增-->
|
||||
<insert id="save" parameterType="pd">
|
||||
insert into
|
||||
<include refid="tableName"></include>
|
||||
(
|
||||
<include refid="Field2"></include>
|
||||
) values (
|
||||
<include refid="FieldValue"></include>
|
||||
)
|
||||
</insert>
|
||||
|
||||
<!-- 删除-->
|
||||
<delete id="delete" parameterType="pd">
|
||||
update
|
||||
<include refid="tableName"></include>
|
||||
set
|
||||
ISDELETE = '1',
|
||||
OPERATOR = #{OPERATOR},
|
||||
OPERATTIME = #{OPERATTIME}
|
||||
where
|
||||
IDENTIFICATIONPARTS_ID = #{IDENTIFICATIONPARTS_ID}
|
||||
</delete>
|
||||
<!-- 删除-->
|
||||
<delete id="delete" parameterType="pd">
|
||||
update
|
||||
<include refid="tableName"></include>
|
||||
set
|
||||
ISDELETE = '1',
|
||||
OPERATOR = #{OPERATOR},
|
||||
OPERATTIME = #{OPERATTIME}
|
||||
where
|
||||
IDENTIFICATIONPARTS_ID = #{IDENTIFICATIONPARTS_ID}
|
||||
</delete>
|
||||
|
||||
<!-- 修改 -->
|
||||
<update id="edit" parameterType="pd">
|
||||
update
|
||||
<include refid="tableName"></include>
|
||||
set
|
||||
PARTSNAME = #{PARTSNAME},
|
||||
OPERATOR = #{OPERATOR},
|
||||
OPERATTIME = #{OPERATTIME},
|
||||
LONGITUDE = #{LONGITUDE},
|
||||
LATITUDE = #{LATITUDE},
|
||||
RISK_UNIT_ID=#{RISK_UNIT_ID},
|
||||
IDENTIFICATIONPARTS_ID = IDENTIFICATIONPARTS_ID
|
||||
where
|
||||
IDENTIFICATIONPARTS_ID = #{IDENTIFICATIONPARTS_ID}
|
||||
</update>
|
||||
<!-- 修改匹配资源库状态 -->
|
||||
<update id="editMatching" parameterType="pd">
|
||||
update
|
||||
<include refid="tableName"></include>
|
||||
set
|
||||
ISMATCHING = #{ISMATCHING}
|
||||
where
|
||||
IDENTIFICATIONPARTS_ID = #{IDENTIFICATIONPARTS_ID}
|
||||
</update>
|
||||
<!-- 修改 -->
|
||||
<update id="edit" parameterType="pd">
|
||||
update
|
||||
<include refid="tableName"></include>
|
||||
set
|
||||
PARTSNAME = #{PARTSNAME},
|
||||
OPERATOR = #{OPERATOR},
|
||||
OPERATTIME = #{OPERATTIME},
|
||||
LONGITUDE = #{LONGITUDE},
|
||||
LATITUDE = #{LATITUDE},
|
||||
ELECTRONIC_FENCE_ID = #{ELECTRONIC_FENCE_ID},
|
||||
ELECTRONIC_FENCE = #{ELECTRONIC_FENCE},
|
||||
RISK_UNIT_ID=#{RISK_UNIT_ID},
|
||||
IDENTIFICATIONPARTS_ID = IDENTIFICATIONPARTS_ID
|
||||
where
|
||||
IDENTIFICATIONPARTS_ID = #{IDENTIFICATIONPARTS_ID}
|
||||
</update>
|
||||
<!-- 修改匹配资源库状态 -->
|
||||
<update id="editMatching" parameterType="pd">
|
||||
update
|
||||
<include refid="tableName"></include>
|
||||
set
|
||||
ISMATCHING = #{ISMATCHING}
|
||||
where
|
||||
IDENTIFICATIONPARTS_ID = #{IDENTIFICATIONPARTS_ID}
|
||||
</update>
|
||||
|
||||
<!-- 通过ID获取数据 -->
|
||||
<select id="findById" parameterType="pd" resultType="pd">
|
||||
select
|
||||
<include refid="Field"></include>,
|
||||
un.RISKUNITNAME,
|
||||
d.NAME DEPTNAME,
|
||||
d.DEPARTMENT_ID
|
||||
from
|
||||
<include refid="tableName"></include> f
|
||||
left join bus_riskunit un on un.RISKUNIT_ID = f.RISK_UNIT_ID
|
||||
left join oa_department d on d.DEPARTMENT_ID = un.DEPARTMENT_ID
|
||||
where
|
||||
f.IDENTIFICATIONPARTS_ID = #{IDENTIFICATIONPARTS_ID}
|
||||
</select>
|
||||
<!-- 通过ID获取数据 -->
|
||||
<select id="findByName" parameterType="pd" resultType="pd">
|
||||
select
|
||||
<include refid="Field"></include>
|
||||
from
|
||||
<include refid="tableName"></include> f
|
||||
where 1=1 and f.ISDELETE = '0'
|
||||
<!-- 通过ID获取数据 -->
|
||||
<select id="findById" parameterType="pd" resultType="pd">
|
||||
select
|
||||
<include refid="Field"></include>,
|
||||
un.RISKUNITNAME,
|
||||
d.NAME DEPTNAME,
|
||||
d.DEPARTMENT_ID
|
||||
from
|
||||
<include refid="tableName"></include>
|
||||
f
|
||||
left join bus_riskunit un on un.RISKUNIT_ID = f.RISK_UNIT_ID
|
||||
left join oa_department d on d.DEPARTMENT_ID = un.DEPARTMENT_ID
|
||||
where
|
||||
f.IDENTIFICATIONPARTS_ID = #{IDENTIFICATIONPARTS_ID}
|
||||
</select>
|
||||
<!-- 通过ID获取数据 -->
|
||||
<select id="findByName" parameterType="pd" resultType="pd">
|
||||
select
|
||||
<include refid="Field"></include>
|
||||
from
|
||||
<include refid="tableName"></include>
|
||||
f
|
||||
where 1=1 and f.ISDELETE = '0'
|
||||
|
||||
<if test="CORPINFO_ID != null and CORPINFO_ID != ''"><!-- 关键词检索 -->
|
||||
and f.CORPINFO_ID = #{CORPINFO_ID}
|
||||
</if>
|
||||
<if test="PARTSNAME != null and PARTSNAME != ''"><!-- 重名验证专用 -->
|
||||
AND
|
||||
f.PARTSNAME = #{PARTSNAME}
|
||||
</if>
|
||||
<if test="RISK_UNIT_ID != null and RISK_UNIT_ID != ''"><!-- 重名验证专用 -->
|
||||
AND
|
||||
f.RISK_UNIT_ID = #{RISK_UNIT_ID}
|
||||
</if>
|
||||
</select>
|
||||
<if test="CORPINFO_ID != null and CORPINFO_ID != ''"><!-- 关键词检索 -->
|
||||
and f.CORPINFO_ID = #{CORPINFO_ID}
|
||||
</if>
|
||||
<if test="PARTSNAME != null and PARTSNAME != ''"><!-- 重名验证专用 -->
|
||||
AND
|
||||
f.PARTSNAME = #{PARTSNAME}
|
||||
</if>
|
||||
<if test="RISK_UNIT_ID != null and RISK_UNIT_ID != ''"><!-- 重名验证专用 -->
|
||||
AND
|
||||
f.RISK_UNIT_ID = #{RISK_UNIT_ID}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 列表 -->
|
||||
<select id="datalistPage" parameterType="page" resultType="pd">
|
||||
select
|
||||
<include refid="Field"></include>,
|
||||
un.RISKUNITNAME,
|
||||
de.NAME as DEPT_NAME,
|
||||
min(r.LEVELID) LEVELID
|
||||
from
|
||||
<include refid="tableName"></include> f
|
||||
left join BUS_CORP_INFO c on c.CORPINFO_ID = f.CORPINFO_ID
|
||||
left join bus_riskunit un on un.RISKUNIT_ID = f.RISK_UNIT_ID
|
||||
left join OA_DEPARTMENT de on de.DEPARTMENT_ID = un.DEPARTMENT_ID
|
||||
LEFT JOIN bus_riskpoint r ON r.IDENTIFICATION_ID = f.IDENTIFICATIONPARTS_ID
|
||||
where f.ISDELETE = '0'
|
||||
<if test="pd.CORPINFO_ID != null and pd.CORPINFO_ID != ''"><!-- 关键词检索 -->
|
||||
and f.CORPINFO_ID = #{pd.CORPINFO_ID}
|
||||
</if>
|
||||
<if test="pd.RISK_UNIT_ID != null and pd.RISK_UNIT_ID != ''"><!-- 关键词检索 -->
|
||||
and f.RISK_UNIT_ID = #{pd.RISK_UNIT_ID}
|
||||
</if>
|
||||
<!-- <if test="pd.DEPARTMENT_ID != null and pd.DEPARTMENT_ID != ''"><!– 部门 –>-->
|
||||
<!-- and de.DEPARTMENT_ID = #{pd.DEPARTMENT_ID}-->
|
||||
<!-- </if>-->
|
||||
<choose>
|
||||
<when test='pd.ISMAIN != null and pd.ISMAIN != "" and pd.ISMAIN == "1"'>
|
||||
<if test="pd.DEPT_IDS != null and pd.DEPT_IDS != ''">
|
||||
and
|
||||
un.DEPARTMENT_ID in
|
||||
<foreach item="item" index="index"
|
||||
collection="pd.DEPT_IDS" open="(" separator="," close=")">
|
||||
'${item}'
|
||||
</foreach>
|
||||
</if>
|
||||
</when>
|
||||
<otherwise>
|
||||
<choose>
|
||||
<when test='pd.ISSUPERVISE != null and pd.ISSUPERVISE != "" and pd.ISSUPERVISE == "1"'>
|
||||
<choose>
|
||||
<when test='pd.ISLEADER != null and pd.ISLEADER != "" and pd.ISLEADER == "1"'><!-- 监管部门的部门领导需要查看下级部门和监管部门的 -->
|
||||
<choose>
|
||||
<when test="pd.DEPT_IDS != null and pd.DEPT_IDS != ''">
|
||||
and
|
||||
un.DEPARTMENT_ID in
|
||||
<foreach item="item" index="index"
|
||||
collection="pd.DEPT_IDS" open="(" separator="," close=")">
|
||||
'${item}'
|
||||
</foreach>
|
||||
</when>
|
||||
<otherwise>
|
||||
and
|
||||
((un.DEPARTMENT_ID in (
|
||||
select
|
||||
SUB_DEPARTMENT_ID
|
||||
from
|
||||
oa_supervision_department osd
|
||||
where
|
||||
osd.SUP_DEPARTMENT_ID = #{pd.DEPARTMENT_ID}
|
||||
and osd.ISDELETE = '0'
|
||||
and osd.CORPINFO_ID = #{pd.CORPINFO_ID}
|
||||
)) or (
|
||||
un.DEPARTMENT_ID in
|
||||
<foreach item="item" index="index"
|
||||
collection="pd.DEPARTMENT_IDS" open="(" separator="," close=")">
|
||||
'${item}'
|
||||
</foreach>
|
||||
))
|
||||
</otherwise>
|
||||
</choose>
|
||||
</when>
|
||||
<when test="pd.DEPT_IDS != null and pd.DEPT_IDS != ''">
|
||||
and
|
||||
un.DEPARTMENT_ID in
|
||||
<foreach item="item" index="index"
|
||||
collection="pd.DEPT_IDS" open="(" separator="," close=")">
|
||||
'${item}'
|
||||
</foreach>
|
||||
</when>
|
||||
<otherwise>
|
||||
and
|
||||
(un.DEPARTMENT_ID in (
|
||||
select
|
||||
SUB_DEPARTMENT_ID
|
||||
from
|
||||
oa_supervision_department osd
|
||||
where
|
||||
osd.SUP_DEPARTMENT_ID = #{pd.DEPARTMENT_ID}
|
||||
and osd.ISDELETE = '0'
|
||||
and osd.CORPINFO_ID = #{pd.CORPINFO_ID})
|
||||
or un.DEPARTMENT_ID = #{pd.DEPARTMENT_ID})<!-- 监管部门的普通用户需要查看自己部门的 -->
|
||||
</otherwise>
|
||||
</choose>
|
||||
</when>
|
||||
<!-- 列表 -->
|
||||
<select id="datalistPage" parameterType="page" resultType="pd">
|
||||
select
|
||||
<include refid="Field"></include>,
|
||||
un.RISKUNITNAME,
|
||||
de.NAME as DEPT_NAME,
|
||||
min(r.LEVELID) LEVELID
|
||||
from
|
||||
<include refid="tableName"></include>
|
||||
f
|
||||
left join BUS_CORP_INFO c on c.CORPINFO_ID = f.CORPINFO_ID
|
||||
left join bus_riskunit un on un.RISKUNIT_ID = f.RISK_UNIT_ID
|
||||
left join OA_DEPARTMENT de on de.DEPARTMENT_ID = un.DEPARTMENT_ID
|
||||
LEFT JOIN bus_riskpoint r ON r.IDENTIFICATION_ID = f.IDENTIFICATIONPARTS_ID
|
||||
where f.ISDELETE = '0'
|
||||
<if test="pd.CORPINFO_ID != null and pd.CORPINFO_ID != ''"><!-- 关键词检索 -->
|
||||
and f.CORPINFO_ID = #{pd.CORPINFO_ID}
|
||||
</if>
|
||||
<if test="pd.RISK_UNIT_ID != null and pd.RISK_UNIT_ID != ''"><!-- 关键词检索 -->
|
||||
and f.RISK_UNIT_ID = #{pd.RISK_UNIT_ID}
|
||||
</if>
|
||||
<!-- <if test="pd.DEPARTMENT_ID != null and pd.DEPARTMENT_ID != ''"><!– 部门 –>-->
|
||||
<!-- and de.DEPARTMENT_ID = #{pd.DEPARTMENT_ID}-->
|
||||
<!-- </if>-->
|
||||
<choose>
|
||||
<when test='pd.ISMAIN != null and pd.ISMAIN != "" and pd.ISMAIN == "1"'>
|
||||
<if test="pd.DEPT_IDS != null and pd.DEPT_IDS != ''">
|
||||
and
|
||||
un.DEPARTMENT_ID in
|
||||
<foreach item="item" index="index"
|
||||
collection="pd.DEPT_IDS" open="(" separator="," close=")">
|
||||
'${item}'
|
||||
</foreach>
|
||||
</if>
|
||||
</when>
|
||||
<otherwise>
|
||||
<choose>
|
||||
<when test='pd.ISSUPERVISE != null and pd.ISSUPERVISE != "" and pd.ISSUPERVISE == "1"'>
|
||||
<choose>
|
||||
<when test='pd.ISLEADER != null and pd.ISLEADER != "" and pd.ISLEADER == "1"'><!-- 监管部门的部门领导需要查看下级部门和监管部门的 -->
|
||||
<choose>
|
||||
<when test="pd.DEPT_IDS != null and pd.DEPT_IDS != ''">
|
||||
and
|
||||
un.DEPARTMENT_ID in
|
||||
<foreach item="item" index="index"
|
||||
collection="pd.DEPT_IDS" open="(" separator="," close=")">
|
||||
'${item}'
|
||||
</foreach>
|
||||
</when>
|
||||
<otherwise>
|
||||
and
|
||||
((un.DEPARTMENT_ID in (
|
||||
select
|
||||
SUB_DEPARTMENT_ID
|
||||
from
|
||||
oa_supervision_department osd
|
||||
where
|
||||
osd.SUP_DEPARTMENT_ID = #{pd.DEPARTMENT_ID}
|
||||
and osd.ISDELETE = '0'
|
||||
and osd.CORPINFO_ID = #{pd.CORPINFO_ID}
|
||||
)) or (
|
||||
un.DEPARTMENT_ID in
|
||||
<foreach item="item" index="index"
|
||||
collection="pd.DEPARTMENT_IDS" open="(" separator="," close=")">
|
||||
'${item}'
|
||||
</foreach>
|
||||
))
|
||||
</otherwise>
|
||||
</choose>
|
||||
</when>
|
||||
<when test="pd.DEPT_IDS != null and pd.DEPT_IDS != ''">
|
||||
and
|
||||
un.DEPARTMENT_ID in
|
||||
<foreach item="item" index="index"
|
||||
collection="pd.DEPT_IDS" open="(" separator="," close=")">
|
||||
'${item}'
|
||||
</foreach>
|
||||
</when>
|
||||
<otherwise>
|
||||
and
|
||||
(un.DEPARTMENT_ID in (
|
||||
select
|
||||
SUB_DEPARTMENT_ID
|
||||
from
|
||||
oa_supervision_department osd
|
||||
where
|
||||
osd.SUP_DEPARTMENT_ID = #{pd.DEPARTMENT_ID}
|
||||
and osd.ISDELETE = '0'
|
||||
and osd.CORPINFO_ID = #{pd.CORPINFO_ID})
|
||||
or un.DEPARTMENT_ID = #{pd.DEPARTMENT_ID})<!-- 监管部门的普通用户需要查看自己部门的 -->
|
||||
</otherwise>
|
||||
</choose>
|
||||
</when>
|
||||
|
||||
<when test='pd.ISLEADER != null and pd.ISLEADER != "" and pd.ISLEADER == "1"'>
|
||||
<choose>
|
||||
<when test="pd.DEPT_IDS != null and pd.DEPT_IDS != ''">
|
||||
and
|
||||
un.DEPARTMENT_ID in
|
||||
<foreach item="item" index="index"
|
||||
collection="pd.DEPT_IDS" open="(" separator="," close=")">
|
||||
'${item}'
|
||||
</foreach>
|
||||
</when>
|
||||
<otherwise>
|
||||
and
|
||||
un.DEPARTMENT_ID in
|
||||
<foreach item="item" index="index"
|
||||
collection="pd.DEPARTMENT_IDS" open="(" separator="," close=")">
|
||||
'${item}'
|
||||
</foreach>
|
||||
</otherwise>
|
||||
</choose>
|
||||
</when>
|
||||
<when test="pd.DEPARTMENT_ID != null and pd.DEPARTMENT_ID != ''">
|
||||
and un.DEPARTMENT_ID=#{pd.DEPARTMENT_ID}
|
||||
</when>
|
||||
<otherwise>
|
||||
</otherwise>
|
||||
</choose>
|
||||
</otherwise>
|
||||
</choose>
|
||||
<if test="pd.LEVELID != null and pd.LEVELID != ''"><!-- 部门 -->
|
||||
and r.LEVELID = #{pd.LEVELID}
|
||||
</if>
|
||||
<if test="pd.KEYWORDS != null and pd.KEYWORDS != ''"><!-- 关键词检索 -->
|
||||
and
|
||||
(
|
||||
f.PARTSNAME LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
|
||||
or
|
||||
f.RISK_UNIT_ID in ( select RISKUNIT_ID from BUS_RISKUNIT where RISKUNITNAME LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%') )
|
||||
)
|
||||
</if>
|
||||
<if test="pd.IS_APP != null and pd.IS_APP != ''"><!-- app独占 -->
|
||||
and r.LEVELID IS NOT NULL
|
||||
</if>
|
||||
GROUP BY f.IDENTIFICATIONPARTS_ID
|
||||
order by f.OPERATTIME desc
|
||||
</select>
|
||||
<when test='pd.ISLEADER != null and pd.ISLEADER != "" and pd.ISLEADER == "1"'>
|
||||
<choose>
|
||||
<when test="pd.DEPT_IDS != null and pd.DEPT_IDS != ''">
|
||||
and
|
||||
un.DEPARTMENT_ID in
|
||||
<foreach item="item" index="index"
|
||||
collection="pd.DEPT_IDS" open="(" separator="," close=")">
|
||||
'${item}'
|
||||
</foreach>
|
||||
</when>
|
||||
<otherwise>
|
||||
and
|
||||
un.DEPARTMENT_ID in
|
||||
<foreach item="item" index="index"
|
||||
collection="pd.DEPARTMENT_IDS" open="(" separator="," close=")">
|
||||
'${item}'
|
||||
</foreach>
|
||||
</otherwise>
|
||||
</choose>
|
||||
</when>
|
||||
<when test="pd.DEPARTMENT_ID != null and pd.DEPARTMENT_ID != ''">
|
||||
and un.DEPARTMENT_ID=#{pd.DEPARTMENT_ID}
|
||||
</when>
|
||||
<otherwise>
|
||||
</otherwise>
|
||||
</choose>
|
||||
</otherwise>
|
||||
</choose>
|
||||
<if test="pd.LEVELID != null and pd.LEVELID != ''"><!-- 部门 -->
|
||||
and r.LEVELID = #{pd.LEVELID}
|
||||
</if>
|
||||
<if test="pd.KEYWORDS != null and pd.KEYWORDS != ''"><!-- 关键词检索 -->
|
||||
and
|
||||
(
|
||||
f.PARTSNAME LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
|
||||
or
|
||||
f.RISK_UNIT_ID in ( select RISKUNIT_ID from BUS_RISKUNIT where RISKUNITNAME LIKE CONCAT(CONCAT('%',
|
||||
#{pd.KEYWORDS}),'%') )
|
||||
)
|
||||
</if>
|
||||
<if test="pd.IS_APP != null and pd.IS_APP != ''"><!-- app独占 -->
|
||||
and r.LEVELID IS NOT NULL
|
||||
</if>
|
||||
GROUP BY f.IDENTIFICATIONPARTS_ID
|
||||
order by f.OPERATTIME desc
|
||||
</select>
|
||||
|
||||
<!-- 列表(全部) -->
|
||||
<select id="listAll" parameterType="pd" resultType="pd">
|
||||
select
|
||||
<include refid="Field"></include>,
|
||||
c.CORP_NAME,
|
||||
un.RISKUNITNAME
|
||||
from
|
||||
<include refid="tableName"></include> f
|
||||
left join BUS_CORP_INFO c on c.CORPINFO_ID = f.CORPINFO_ID
|
||||
left join bus_riskunit un on un.RISKUNIT_ID = f.RISK_UNIT_ID
|
||||
where f.ISDELETE = '0'
|
||||
<if test="CORPINFO_ID != null and CORPINFO_ID != ''"><!-- 关键词检索 -->
|
||||
and f.CORPINFO_ID = #{CORPINFO_ID}
|
||||
</if>
|
||||
<if test="RISK_UNIT_ID != null and RISK_UNIT_ID != ''"><!-- 关键词检索 -->
|
||||
and f.RISK_UNIT_ID = #{RISK_UNIT_ID}
|
||||
</if>
|
||||
<if test="RISKUNIT_ID != null and RISKUNIT_ID != ''"><!-- 关键词检索 -->
|
||||
and f.RISK_UNIT_ID = #{RISKUNIT_ID}
|
||||
</if>
|
||||
<if test="CHECK_NAME != null and CHECK_NAME != ''"><!-- 关键词检索 -->
|
||||
and f.PARTSNAME = #{CHECK_NAME}
|
||||
</if>
|
||||
<if test="unRISKUNITNAME !=null and unRISKUNITNAME !=''">
|
||||
and un.RISKUNITNAME = #{unRISKUNITNAME}
|
||||
</if>
|
||||
order by f.OPERATTIME desc
|
||||
</select>
|
||||
<select id="listOut" parameterType="pd" resultType="pd">
|
||||
select
|
||||
<include refid="Field"></include>,
|
||||
c.CORP_NAME,
|
||||
un.RISKUNITNAME
|
||||
from
|
||||
<include refid="tableName"></include> f
|
||||
left join BUS_CORP_INFO c on c.CORPINFO_ID = f.CORPINFO_ID
|
||||
left join bus_riskunit un on un.RISKUNIT_ID = f.RISK_UNIT_ID
|
||||
where f.ISDELETE = '0' and f.IDENTIFICATIONPARTS_ID in
|
||||
<foreach item="item" index="index" open="(" separator="," close=")" collection="ArrayDATA_IDS">
|
||||
#{item}
|
||||
</foreach>
|
||||
<if test="CORPINFO_ID != null and CORPINFO_ID != ''"><!-- 关键词检索 -->
|
||||
and f.CORPINFO_ID = #{CORPINFO_ID}
|
||||
</if>
|
||||
<if test="RISK_UNIT_ID != null and RISK_UNIT_ID != ''"><!-- 关键词检索 -->
|
||||
and f.RISK_UNIT_ID = #{RISK_UNIT_ID}
|
||||
</if>
|
||||
<if test="RISKUNIT_ID != null and RISKUNIT_ID != ''"><!-- 关键词检索 -->
|
||||
and f.RISK_UNIT_ID = #{RISKUNIT_ID}
|
||||
</if>
|
||||
<if test="CHECK_NAME != null and CHECK_NAME != ''"><!-- 关键词检索 -->
|
||||
and f.PARTSNAME = #{CHECK_NAME}
|
||||
</if>
|
||||
<if test="unRISKUNITNAME !=null and unRISKUNITNAME !=''">
|
||||
and un.RISKUNITNAME = #{unRISKUNITNAME}
|
||||
</if>
|
||||
order by f.OPERATTIME desc
|
||||
<!-- 列表(全部) -->
|
||||
<select id="listAll" parameterType="pd" resultType="pd">
|
||||
select
|
||||
<include refid="Field"></include>,
|
||||
c.CORP_NAME,
|
||||
un.RISKUNITNAME
|
||||
from
|
||||
<include refid="tableName"></include>
|
||||
f
|
||||
left join BUS_CORP_INFO c on c.CORPINFO_ID = f.CORPINFO_ID
|
||||
left join bus_riskunit un on un.RISKUNIT_ID = f.RISK_UNIT_ID
|
||||
where f.ISDELETE = '0'
|
||||
<if test="CORPINFO_ID != null and CORPINFO_ID != ''"><!-- 关键词检索 -->
|
||||
and f.CORPINFO_ID = #{CORPINFO_ID}
|
||||
</if>
|
||||
<if test="RISK_UNIT_ID != null and RISK_UNIT_ID != ''"><!-- 关键词检索 -->
|
||||
and f.RISK_UNIT_ID = #{RISK_UNIT_ID}
|
||||
</if>
|
||||
<if test="RISKUNIT_ID != null and RISKUNIT_ID != ''"><!-- 关键词检索 -->
|
||||
and f.RISK_UNIT_ID = #{RISKUNIT_ID}
|
||||
</if>
|
||||
<if test="CHECK_NAME != null and CHECK_NAME != ''"><!-- 关键词检索 -->
|
||||
and f.PARTSNAME = #{CHECK_NAME}
|
||||
</if>
|
||||
<if test="unRISKUNITNAME !=null and unRISKUNITNAME !=''">
|
||||
and un.RISKUNITNAME = #{unRISKUNITNAME}
|
||||
</if>
|
||||
order by f.OPERATTIME desc
|
||||
</select>
|
||||
<select id="listOut" parameterType="pd" resultType="pd">
|
||||
select
|
||||
<include refid="Field"></include>,
|
||||
c.CORP_NAME,
|
||||
un.RISKUNITNAME
|
||||
from
|
||||
<include refid="tableName"></include>
|
||||
f
|
||||
left join BUS_CORP_INFO c on c.CORPINFO_ID = f.CORPINFO_ID
|
||||
left join bus_riskunit un on un.RISKUNIT_ID = f.RISK_UNIT_ID
|
||||
where f.ISDELETE = '0' and f.IDENTIFICATIONPARTS_ID in
|
||||
<foreach item="item" index="index" open="(" separator="," close=")" collection="ArrayDATA_IDS">
|
||||
#{item}
|
||||
</foreach>
|
||||
<if test="CORPINFO_ID != null and CORPINFO_ID != ''"><!-- 关键词检索 -->
|
||||
and f.CORPINFO_ID = #{CORPINFO_ID}
|
||||
</if>
|
||||
<if test="RISK_UNIT_ID != null and RISK_UNIT_ID != ''"><!-- 关键词检索 -->
|
||||
and f.RISK_UNIT_ID = #{RISK_UNIT_ID}
|
||||
</if>
|
||||
<if test="RISKUNIT_ID != null and RISKUNIT_ID != ''"><!-- 关键词检索 -->
|
||||
and f.RISK_UNIT_ID = #{RISKUNIT_ID}
|
||||
</if>
|
||||
<if test="CHECK_NAME != null and CHECK_NAME != ''"><!-- 关键词检索 -->
|
||||
and f.PARTSNAME = #{CHECK_NAME}
|
||||
</if>
|
||||
<if test="unRISKUNITNAME !=null and unRISKUNITNAME !=''">
|
||||
and un.RISKUNITNAME = #{unRISKUNITNAME}
|
||||
</if>
|
||||
order by f.OPERATTIME desc
|
||||
|
||||
</select>
|
||||
</select>
|
||||
|
||||
<!-- 列表(全部) -->
|
||||
<select id="listAllByIdens" parameterType="pd" resultType="pd">
|
||||
select
|
||||
<include refid="Field"></include>,
|
||||
c.CORP_NAME,
|
||||
un.RISKUNITNAME
|
||||
from
|
||||
<include refid="tableName"></include> f
|
||||
left join BUS_CORP_INFO c on c.CORPINFO_ID = f.CORPINFO_ID
|
||||
left join bus_riskunit un on un.RISKUNIT_ID = f.RISK_UNIT_ID
|
||||
where f.ISDELETE = '0'
|
||||
<if test="CORPINFO_ID != null and CORPINFO_ID != ''"><!-- 关键词检索 -->
|
||||
and f.CORPINFO_ID = #{CORPINFO_ID}
|
||||
</if>
|
||||
<if test="RISK_UNIT_ID != null and RISK_UNIT_ID != ''"><!-- 关键词检索 -->
|
||||
and f.RISK_UNIT_ID = #{RISK_UNIT_ID}
|
||||
</if>
|
||||
<if test="RISKUNIT_ID != null and RISKUNIT_ID != ''"><!-- 关键词检索 -->
|
||||
and f.RISK_UNIT_ID = #{RISKUNIT_ID}
|
||||
</if>
|
||||
<if test="CHECK_NAME != null and CHECK_NAME != ''"><!-- 关键词检索 -->
|
||||
and f.PARTSNAME = #{CHECK_NAME}
|
||||
</if>
|
||||
<if test="ArrayDATA_IDS != null and ArrayDATA_IDS != ''"><!-- 关键词检索 -->
|
||||
and
|
||||
(
|
||||
f.IDENTIFICATIONPARTS_ID in
|
||||
<foreach item="item" index="index" collection="ArrayDATA_IDS" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
order by f.OPERATTIME desc
|
||||
</select>
|
||||
<!-- 列表(全部) -->
|
||||
<select id="listAllByIdens" parameterType="pd" resultType="pd">
|
||||
select
|
||||
<include refid="Field"></include>,
|
||||
c.CORP_NAME,
|
||||
un.RISKUNITNAME
|
||||
from
|
||||
<include refid="tableName"></include>
|
||||
f
|
||||
left join BUS_CORP_INFO c on c.CORPINFO_ID = f.CORPINFO_ID
|
||||
left join bus_riskunit un on un.RISKUNIT_ID = f.RISK_UNIT_ID
|
||||
where f.ISDELETE = '0'
|
||||
<if test="CORPINFO_ID != null and CORPINFO_ID != ''"><!-- 关键词检索 -->
|
||||
and f.CORPINFO_ID = #{CORPINFO_ID}
|
||||
</if>
|
||||
<if test="RISK_UNIT_ID != null and RISK_UNIT_ID != ''"><!-- 关键词检索 -->
|
||||
and f.RISK_UNIT_ID = #{RISK_UNIT_ID}
|
||||
</if>
|
||||
<if test="RISKUNIT_ID != null and RISKUNIT_ID != ''"><!-- 关键词检索 -->
|
||||
and f.RISK_UNIT_ID = #{RISKUNIT_ID}
|
||||
</if>
|
||||
<if test="CHECK_NAME != null and CHECK_NAME != ''"><!-- 关键词检索 -->
|
||||
and f.PARTSNAME = #{CHECK_NAME}
|
||||
</if>
|
||||
<if test="ArrayDATA_IDS != null and ArrayDATA_IDS != ''"><!-- 关键词检索 -->
|
||||
and
|
||||
(
|
||||
f.IDENTIFICATIONPARTS_ID in
|
||||
<foreach item="item" index="index" collection="ArrayDATA_IDS" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
order by f.OPERATTIME desc
|
||||
</select>
|
||||
|
||||
<!-- 列表(全部) -->
|
||||
<select id="listIndexAll" parameterType="pd" resultType="pd">
|
||||
select
|
||||
<include refid="Field"></include>,
|
||||
c.CORP_NAME,
|
||||
un.RISKUNITNAME
|
||||
from
|
||||
<include refid="tableName"></include> f
|
||||
left join BUS_CORP_INFO c on c.CORPINFO_ID = f.CORPINFO_ID
|
||||
left join bus_riskunit un on un.RISKUNIT_ID = f.RISK_UNIT_ID
|
||||
where f.ISDELETE = '0'
|
||||
<if test="CORPINFO_ID != null and CORPINFO_ID != ''"><!-- 关键词检索 -->
|
||||
and f.CORPINFO_ID = #{CORPINFO_ID}
|
||||
</if>
|
||||
<!-- group by un.RISKUNITNAME,f.PARTSNAME -->
|
||||
order by f.OPERATTIME desc
|
||||
</select>
|
||||
<!-- 列表(全部) -->
|
||||
<select id="listIndexAll" parameterType="pd" resultType="pd">
|
||||
select
|
||||
<include refid="Field"></include>,
|
||||
c.CORP_NAME,
|
||||
un.RISKUNITNAME
|
||||
from
|
||||
<include refid="tableName"></include>
|
||||
f
|
||||
left join BUS_CORP_INFO c on c.CORPINFO_ID = f.CORPINFO_ID
|
||||
left join bus_riskunit un on un.RISKUNIT_ID = f.RISK_UNIT_ID
|
||||
where f.ISDELETE = '0'
|
||||
<if test="CORPINFO_ID != null and CORPINFO_ID != ''"><!-- 关键词检索 -->
|
||||
and f.CORPINFO_ID = #{CORPINFO_ID}
|
||||
</if>
|
||||
<!-- group by un.RISKUNITNAME,f.PARTSNAME -->
|
||||
order by f.OPERATTIME desc
|
||||
</select>
|
||||
|
||||
<!-- 批量删除 -->
|
||||
<delete id="deleteAll" parameterType="String">
|
||||
update
|
||||
<include refid="tableName"></include>
|
||||
set
|
||||
ISDELETE = '1'
|
||||
where
|
||||
IDENTIFICATIONPARTS_ID in
|
||||
<foreach item="item" index="index" collection="ArrayDATA_IDS" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</delete>
|
||||
<!-- 批量删除 -->
|
||||
<delete id="deleteAll" parameterType="String">
|
||||
update
|
||||
<include refid="tableName"></include>
|
||||
set
|
||||
ISDELETE = '1'
|
||||
where
|
||||
IDENTIFICATIONPARTS_ID in
|
||||
<foreach item="item" index="index" collection="ArrayDATA_IDS" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<!-- 清单所有部位(全部) -->
|
||||
<select id="listAllByList" parameterType="pd" resultType="pd">
|
||||
select
|
||||
<include refid="Field"></include>,
|
||||
un.RISKUNITNAME
|
||||
from
|
||||
<include refid="tableName"></include> f
|
||||
left join bus_riskunit un on un.RISKUNIT_ID = f.RISK_UNIT_ID
|
||||
left join bus_riskpoint r on r.IDENTIFICATION_ID = f.IDENTIFICATIONPARTS_ID
|
||||
left join bus_list_checkitem lck on lck.RISKPOINT_ID = r.RISKPOINT_ID
|
||||
where f.ISDELETE = '0'
|
||||
<if test="CORPINFO_ID != null and CORPINFO_ID != ''"><!-- 关键词检索 -->
|
||||
and f.CORPINFO_ID = #{CORPINFO_ID}
|
||||
</if>
|
||||
<if test="LISTMANAGER_ID != null and LISTMANAGER_ID != ''"><!-- 关键词检索 -->
|
||||
and lck.LISTMANAGER_ID = #{LISTMANAGER_ID}
|
||||
</if>
|
||||
AND lck.ISDELETE = '0'
|
||||
GROUP BY f.IDENTIFICATIONPARTS_ID
|
||||
order by (select o.ORDERBY from BUS_CHECKROUTE o where o.LISTMANAGER_ID = lck.LISTMANAGER_ID and o.IDENTIFICATIONPARTS_ID = f.IDENTIFICATIONPARTS_ID)
|
||||
</select>
|
||||
<!-- 清单所有部位(全部) -->
|
||||
<select id="listAllByList" parameterType="pd" resultType="pd">
|
||||
select
|
||||
<include refid="Field"></include>,
|
||||
un.RISKUNITNAME
|
||||
from
|
||||
<include refid="tableName"></include>
|
||||
f
|
||||
left join bus_riskunit un on un.RISKUNIT_ID = f.RISK_UNIT_ID
|
||||
left join bus_riskpoint r on r.IDENTIFICATION_ID = f.IDENTIFICATIONPARTS_ID
|
||||
left join bus_list_checkitem lck on lck.RISKPOINT_ID = r.RISKPOINT_ID
|
||||
where f.ISDELETE = '0'
|
||||
<if test="CORPINFO_ID != null and CORPINFO_ID != ''"><!-- 关键词检索 -->
|
||||
and f.CORPINFO_ID = #{CORPINFO_ID}
|
||||
</if>
|
||||
<if test="LISTMANAGER_ID != null and LISTMANAGER_ID != ''"><!-- 关键词检索 -->
|
||||
and lck.LISTMANAGER_ID = #{LISTMANAGER_ID}
|
||||
</if>
|
||||
AND lck.ISDELETE = '0'
|
||||
GROUP BY f.IDENTIFICATIONPARTS_ID
|
||||
order by (select o.ORDERBY from BUS_CHECKROUTE o where o.LISTMANAGER_ID = lck.LISTMANAGER_ID and
|
||||
o.IDENTIFICATIONPARTS_ID = f.IDENTIFICATIONPARTS_ID)
|
||||
</select>
|
||||
|
||||
<select id="getBiCount" parameterType="pd" resultType="pd">
|
||||
SELECT
|
||||
l.LEVELID,
|
||||
count( l.LEVELID ) COUNT
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
min( r.LEVELID ) LEVELID
|
||||
FROM
|
||||
bus_identificationparts f
|
||||
LEFT JOIN bus_riskpoint r ON f.IDENTIFICATIONPARTS_ID = r.IDENTIFICATION_ID
|
||||
WHERE
|
||||
f.ISDELETE = '0'
|
||||
AND r.ISDELETE = '0'
|
||||
AND f.CORPINFO_ID = #{CORPINFO_ID}
|
||||
GROUP BY
|
||||
f.IDENTIFICATIONPARTS_ID
|
||||
) l
|
||||
GROUP BY
|
||||
l.LEVELID
|
||||
ORDER BY
|
||||
l.LEVELID
|
||||
</select>
|
||||
<select id="getBiCount" parameterType="pd" resultType="pd">
|
||||
SELECT l.LEVELID,
|
||||
count(l.LEVELID) COUNT
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
min ( r.LEVELID ) LEVELID
|
||||
FROM
|
||||
bus_identificationparts f
|
||||
LEFT JOIN bus_riskpoint r ON f.IDENTIFICATIONPARTS_ID = r.IDENTIFICATION_ID
|
||||
WHERE
|
||||
f.ISDELETE = '0'
|
||||
AND r.ISDELETE = '0'
|
||||
AND f.CORPINFO_ID = #{CORPINFO_ID}
|
||||
GROUP BY
|
||||
f.IDENTIFICATIONPARTS_ID
|
||||
) l
|
||||
GROUP BY
|
||||
l.LEVELID
|
||||
ORDER BY
|
||||
l.LEVELID
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
@ -60,6 +60,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
BZ,
|
||||
SKIN,
|
||||
EMAIL,
|
||||
SEX,
|
||||
NUMBER,
|
||||
PHONE,
|
||||
ROLE_IDS,
|
||||
|
@ -84,6 +85,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
IS_SAFETY,
|
||||
ISDELETE,
|
||||
ISHEAD,
|
||||
CARDNO,
|
||||
PLS_ID,
|
||||
ISLEADER
|
||||
</sql>
|
||||
|
||||
|
@ -103,6 +106,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
#{SKIN},
|
||||
#{EMAIL},
|
||||
#{NUMBER},
|
||||
#{SEX},
|
||||
#{PHONE},
|
||||
#{ROLE_IDS},
|
||||
#{DEPARTMENT_ID},
|
||||
|
@ -124,6 +128,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
#{IS_SAFETY},
|
||||
0,
|
||||
#{ISHEAD},
|
||||
#{CARDNO},
|
||||
#{PLS_ID},
|
||||
#{ISLEADER}
|
||||
</sql>
|
||||
|
||||
|
@ -141,6 +147,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
f.SKIN,
|
||||
f.EMAIL,
|
||||
f.NUMBER,
|
||||
f.SEX,
|
||||
f.PHONE,
|
||||
f.ROLE_IDS,
|
||||
f.DEPARTMENT_ID,
|
||||
|
@ -160,6 +167,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
f.IS_SAFETY,
|
||||
f.CORPINFO_ID,
|
||||
f.ISHEAD,
|
||||
f.CARDNO,
|
||||
f.PLS_ID,
|
||||
f.ISLEADER
|
||||
</sql>
|
||||
|
||||
|
@ -266,9 +275,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
ROLE_ID = #{ROLE_ID},
|
||||
ROLE_IDS = #{ROLE_IDS},
|
||||
BZ = #{BZ},
|
||||
SEX = #{SEX},
|
||||
EMAIL = #{EMAIL},
|
||||
NUMBER = #{NUMBER},
|
||||
SORT = #{SORT},
|
||||
CARDNO = #{CARDNO},
|
||||
PHONE = #{PHONE}
|
||||
<if test="LEARNERCATEGORY != null and LEARNERCATEGORY != ''">
|
||||
,LEARNERCATEGORY = #{LEARNERCATEGORY}
|
||||
|
@ -913,7 +924,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</update>
|
||||
<!-- 列出某角色下的所有用户 -->
|
||||
<select id="findUserNameAll" parameterType="pd" resultType="pd" >
|
||||
select USERNAME
|
||||
select *
|
||||
from
|
||||
<include refid="tableName"></include>
|
||||
where ISDELETE = 0
|
||||
|
@ -1367,5 +1378,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
where
|
||||
f.USER_ID = #{USER_ID}
|
||||
</select>
|
||||
<select id="findByCardNo" resultType="com.zcloud.entity.PageData">
|
||||
select
|
||||
*
|
||||
from
|
||||
<include refid="tableName"></include>
|
||||
where
|
||||
CARDNO = #{CARDNO} and CORPINFO_ID = #{CORPINFO_ID} and ISDELETE = 0
|
||||
</select>
|
||||
<select id="getUserCardNoAll" resultType="com.zcloud.entity.PageData">
|
||||
select
|
||||
USERNAME,
|
||||
CARDNO
|
||||
from
|
||||
<include refid="tableName"></include>
|
||||
where CORPINFO_ID = #{CORPINFO_ID} and ISDELETE = 0
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
Loading…
Reference in New Issue