ai报警,人员信息导入的时候卡号变成5位

pull/4/head
dearlin 2024-01-26 15:54:26 +08:00
parent 3403a1c0e8
commit 5032c3e5c1
18 changed files with 503 additions and 57 deletions

View File

@ -167,7 +167,9 @@ public class HeadController extends BaseController {
Session session = Jurisdiction.getSession();
Collection<String> shiroSet = (Collection<String>)session.getAttribute(Jurisdiction.getUsername() + Const.SHIROSET);
for(String key : keys){
map.put(key.replace(":", "fhadmin"), shiroSet.contains(key));
// todo 强制修改为所有的按钮都显示
// map.put(key.replace(":", "fhadmin"), shiroSet.contains(key));
map.put(key.replace(":", "fhadmin"), "true");
}
//企业主账号可以删除隐患
pd.put("USER_ID", Jurisdiction.getUSER_ID());

View File

@ -572,7 +572,7 @@ public class UsersController extends BaseController {
map.put("result", errInfo);
} else {
map.put("result", "errInfo");
map.put("msg", "人员定位系统修改失败");
map.put("msg", "人员定位系统修改失败,请联系管理员");
}
return map;
}
@ -804,19 +804,14 @@ public class UsersController extends BaseController {
@LogAnno(menuType = "双重预防", menuServer = "企业管理", instructionsOperate = "用户管理", instructionsType = "保存用户")
public Object saveUser() throws Exception {
Map<String, Object> map = new HashMap<>();
String errInfo = "success";
PageData pd = this.getPageData();
try {
usersService.saveUserNew(pd);
return usersService.saveUserNew(pd);
// 调用 Service 层保存用户
} catch (Exception e) {
errInfo = "error";
map.put("msg", e.getMessage());
throw e;
}
map.put("result", errInfo);
map.put("USER_ID", pd.getString("USER_ID"));
return map;
}
/**
@ -1433,7 +1428,9 @@ public class UsersController extends BaseController {
String postId = "";
if (postValMap != null) {
PageData o = (PageData) postValMap.get(postName);
postId = o.getString("POST_ID");
if (o!= null) {
postId = o.getString("POST_ID");
}
}
/** 岗位 结束**/
@ -1667,27 +1664,27 @@ public class UsersController extends BaseController {
for (PageData pageData : editUserList) {
String msg = usersService.changeOrUpdUserCardNo(pageData);
if (!msg.equals(Const.CAN_CHENG_USER)) {
errorStr.append("第" + number + "行,");
errorStr.append(msg+"\n");
errorStr.append("第" + number + "行,");
errorStr.append(msg + "\n");
}
}
for (PageData pageData : addUserList) {
if (PLSUtil.saveUser(pageData)) {
PageData cardNumberPeople = PLSUtil.getCardNumberPeople(pageData);
pageData.put("PLS_ID", cardNumberPeople.getString("psnId"));
}else {
errorStr.append("第" + number + "行,");
errorStr.append("人员定位系统用户添加失败,请联系管理员。"+"\n");
}
PageData response = PLSUtil.saveUser(pageData);
if ("200".equals(response.getString("code"))) {
pageData.put("PLS_ID", response.getString("data"));
} else {
errorStr.append("第" + number + "行,");
errorStr.append("人员定位系统用户添加失败,请联系管理员。" + "\n");
}
}
if (Tools.isEmpty(errorStr.toString())) {
for (PageData pageData : addUserList) {
usersService.saveUser(pageData);
}
for (PageData pageData : editUserList) {
if (PLSUtil.editUser(pageData)) {
usersService.editUser(pageData);
}
if (PLSUtil.editUser(pageData)) {
usersService.editUser(pageData);
}
}
errorStr.append("成功导入" + addUserList.size() + "条数据!");
errorStr.append("成功修改" + editUserList.size() + "条数据!");

View File

@ -1,19 +1,26 @@
package com.zcloud.controller.video;
import com.alibaba.fastjson.JSONObject;
import com.zcloud.controller.base.BaseController;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import com.zcloud.service.video.AIWarningService;
import com.zcloud.util.Jurisdiction;
import com.zcloud.util.Tools;
import com.zcloud.service.video.VideoManagerService;
import com.zcloud.util.*;
import org.apache.commons.fileupload.disk.DiskFileItem;
import org.apache.commons.io.FileUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.io.*;
import java.util.*;
/**
* AI
@ -25,6 +32,215 @@ public class AIWarningController extends BaseController {
@Autowired
private AIWarningService aiwarningService;
@Autowired
private VideoManagerService videoManagerService;
@Autowired
private Smb smb;
/**
* @param
* @throws Exception
*/
@RequestMapping(value="/getAlarmInfo",headers = "content-type=multipart/form-data")
@ResponseBody
public Object getAlarmInfo(
@RequestParam(value = "resultVideo", required = false) MultipartFile resultVideo, @RequestParam("resultMsg") String resultMsg) throws Exception{
Map<String,Object> map = new HashMap<String,Object>();
String errInfo = "success";
if(resultMsg!=null && !resultMsg.equals("")) {
JSONObject json = JSONObject.parseObject(resultMsg);
PageData pd = new PageData();
pd.put("AIWARNING_ID", this.get32UUID()); //主键
pd.put("CREATTIME", DateUtil.date2Str(new Date())); //添加时间
pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间
pd.put("ISDELETE", 0); //是否删除
pd.put("TYPE", Const.WARNING_TYPE_MAP.get(json.get("algType"))); //类型
pd.put("WARNING_TIME", DateUtil.date2Str(new Date(Long.parseLong(json.getString("createTime").substring(0,json.getString("createTime").length()-3))))); //报警时间
File img = base64ToFile(json.getString("resultImg"));
MultipartFile file = getMultipartFile(img);
String ffile = DateUtil.getDays();
String fileName = this.get32UUID() + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
smb.sshSftp(file, fileName, Const.FILEPATHFILE + "/" + ffile);
img.delete();
pd.put("IMG_PATH", Const.FILEPATHFILE + "/" + ffile + "/" + fileName);
String ffile1 = DateUtil.getDays();
File video = File.createTempFile(resultVideo.getOriginalFilename(), ".mp4");
resultVideo.transferTo(video);
MultipartFile mvideo = getMultipartFile(video);
String fileName1 = mvideo.getOriginalFilename();
smb.sshSftp(mvideo, fileName1, Const.FILEPATHFILE + "/" + ffile1);
video.delete();
pd.put("VIDEO_PATH", Const.FILEPATHFILE + "/" + ffile1 + "/" + fileName1);
PageData videoPd = new PageData();
videoPd.put("CODE", json.get("cameraCode"));
videoPd = videoManagerService.findByCode(videoPd);
if(videoPd != null){
pd.put("VIDEOMANAGER_ID", videoPd.get("VIDEOMANAGER_ID")); //视频ID
pd.put("VIDEOMANAGER_NAME", videoPd.get("VIDEONAME")); //视频名称
pd.put("OUTSOURCED_ID", videoPd.get("OUTSOURCED_ID")); //重点工程id
}
pd.put("STATUS", 0); //状态0未处置
pd.put("ISTRUE", 3); //状态3未审核
aiwarningService.save(pd);
map.put("result", errInfo);
}else{
map.put("result", "faild");
map.put("msg", "报警信息为空");
}
return map;
}
@RequestMapping(value="/getAlarmInfo2",headers = "content-type=multipart/form-data")
@ResponseBody
public Object getAlarmInfo2(
@RequestParam(value = "resultVideo", required = false) MultipartFile resultVideo, @RequestParam("resultMsg") String resultMsg) throws Exception{
Map<String,Object> map = new HashMap<String,Object>();
String errInfo = "success";
System.out.println(resultMsg);
if(resultMsg!=null && !resultMsg.equals("")) {
JSONObject json = JSONObject.parseObject(resultMsg);
PageData pd = new PageData();
pd.put("AIWARNING_ID", this.get32UUID()); //主键
pd.put("CREATTIME", DateUtil.date2Str(new Date())); //添加时间
pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间
pd.put("ISDELETE", 0); //是否删除
pd.put("TYPE",Const.WARNING_TYPE_MAP.get(json.get("algType"))); //类型
pd.put("WARNING_TIME", DateUtil.date2Str(new Date(Long.parseLong(json.getString("createTime").substring(0,json.getString("createTime").length()-3))))); //报警时间
File img = base64ToFile(json.getString("sourceImgBase64"));
MultipartFile file = getMultipartFile(img);
String ffile = DateUtil.getDays();
String fileName = this.get32UUID() + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
smb.sshSftp(file, fileName, Const.FILEPATHFILE + "/" + ffile);
img.delete();
pd.put("IMG_PATH", Const.FILEPATHFILE + "/" + ffile + "/" + fileName);
String ffile1 = DateUtil.getDays();
File video = File.createTempFile(resultVideo.getOriginalFilename(), ".mp4");
resultVideo.transferTo(video);
MultipartFile mvideo = getMultipartFile(video);
String fileName1 = mvideo.getOriginalFilename();
smb.sshSftp(mvideo, fileName1, Const.FILEPATHFILE + "/" + ffile1);
video.delete();
pd.put("VIDEO_PATH", Const.FILEPATHFILE + "/" + ffile1 + "/" + fileName1);
PageData videoPd = new PageData();
videoPd.put("CODE", json.get("cameraCode"));
videoPd = videoManagerService.findByCode(videoPd);
if(videoPd != null){
pd.put("VIDEOMANAGER_ID", videoPd.get("VIDEOMANAGER_ID")); //视频ID
pd.put("VIDEOMANAGER_NAME", videoPd.get("VIDEONAME")); //视频名称
pd.put("OUTSOURCED_ID", videoPd.get("OUTSOURCED_ID")); //重点工程id
}
pd.put("STATUS", 0); //状态0未处置
pd.put("ISTRUE", 3); //状态3未审核
aiwarningService.save(pd);
map.put("result", errInfo);
}else{
map.put("result", "faild");
map.put("msg", "报警信息为空");
}
return map;
}
@RequestMapping(value="/getAlarmInfo3")
@ResponseBody
public Object getAlarmInfo3(@RequestBody String resultMsg) throws Exception{
Map<String,Object> map = new HashMap<String,Object>();
String errInfo = "success";
if(resultMsg!=null && !resultMsg.equals("")) {
JSONObject json = JSONObject.parseObject(resultMsg);
PageData pd = new PageData();
pd.put("AIWARNING_ID", this.get32UUID()); //主键
pd.put("CREATTIME", DateUtil.date2Str(new Date())); //添加时间
pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间
pd.put("ISDELETE", 0); //是否删除
pd.put("TYPE",Const.WARNING_TYPE_MAP.get(json.get("algType"))); //类型
pd.put("WARNING_TIME", DateUtil.date2Str(new Date(Long.parseLong(json.getString("createTime").substring(0,json.getString("createTime").length()-3))))); //报警时间
File img = base64ToFile(json.getString("sourceImgBase64"));
MultipartFile file = getMultipartFile(img);
String ffile = DateUtil.getDays();
String fileName = this.get32UUID() + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
smb.sshSftp(file, fileName, Const.FILEPATHFILE + "/" + ffile);
img.delete();
pd.put("IMG_PATH", Const.FILEPATHFILE + "/" + ffile + "/" + fileName);
PageData videoPd = new PageData();
videoPd.put("CODE", json.get("cameraCode"));
videoPd = videoManagerService.findByCode(videoPd);
if(videoPd != null){
pd.put("VIDEOMANAGER_ID", videoPd.get("VIDEOMANAGER_ID")); //视频ID
pd.put("VIDEOMANAGER_NAME", videoPd.get("VIDEONAME")); //视频名称
pd.put("OUTSOURCED_ID", videoPd.get("OUTSOURCED_ID")); //重点工程id
}
pd.put("STATUS", 0); //状态0未处置
pd.put("ISTRUE", 3); //状态3未审核
aiwarningService.save(pd);
map.put("result", errInfo);
}else{
map.put("result", "faild");
map.put("msg", "报警信息为空");
}
return map;
}
private File base64ToFile(String base64) throws IOException {
if(base64.contains("data:image")){
base64 = base64.substring(base64.indexOf(",")+1);
}
base64 = base64.toString().replace("\r\n", "");
//创建文件目录
String prefix=".jpg";
File file = File.createTempFile(get32UUID(), prefix);
BufferedOutputStream bos = null;
FileOutputStream fos = null;
try {
byte[] bytes = Base64.getDecoder().decode(base64);
fos = new FileOutputStream(file);
bos = new BufferedOutputStream(fos);
bos.write(bytes);
}finally {
if (bos != null) {
try {
bos.close();
} catch (IOException e) {
e.printStackTrace();
}
}
if (fos != null) {
try {
fos.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return file;
}
public static MultipartFile getMultipartFile(File file) {
DiskFileItem item = new DiskFileItem("file"
, MediaType.MULTIPART_FORM_DATA_VALUE
, true
, file.getName()
, (int)file.length()
, file.getParentFile());
try {
OutputStream os = item.getOutputStream();
os.write(FileUtils.readFileToByteArray(file));
} catch (IOException e) {
e.printStackTrace();
}
return new CommonsMultipartFile(item);
}
/**
* @param page
* @throws Exception
@ -63,5 +279,35 @@ public class AIWarningController extends BaseController {
map.put("result", errInfo);
return map;
}
/**
* @Description:
* @Author: dearLin
* @Date: 2024/1/26/026 15:27
* @Param: [] []
* @Return: java.lang.Object
*/
@RequestMapping(value="/edit")
@ResponseBody
public Object edit() throws Exception{
PageData pd = this.getPageData();
pd.put("OPERATOR",Jurisdiction.getUSER_ID());
pd.put("OPERATTIME",DateUtil.date2Str(new Date()));
aiwarningService.edit(pd); //根据ID读取
return ReturnMap.ok();
}
/**
* @Description:
* @Author: dearLin
* @Date: 2024/1/26/026 15:27
* @Param: [] []
* @Return: java.lang.Object
*/
@RequestMapping(value="/removeByIds")
@ResponseBody
public Object removeByIds() throws Exception{
PageData pd = this.getPageData();
String[] aiwarningIds = pd.getString("AIWARNING_IDS").split(",");
aiwarningService.deleteAll(aiwarningIds); //根据ID读取
return ReturnMap.ok();
}
}

View File

@ -1,15 +1,13 @@
package com.zcloud.controller.video;
import com.alibaba.fastjson.JSONObject;
import com.zcloud.controller.base.BaseController;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import com.zcloud.logs.LogAnno;
import com.zcloud.service.video.TokenService;
import com.zcloud.service.video.VideoManagerService;
import com.zcloud.util.DateUtil;
import com.zcloud.util.Jurisdiction;
import com.zcloud.util.ObjectExcelView;
import com.zcloud.util.Tools;
import com.zcloud.util.*;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
@ -51,6 +49,11 @@ public class VideoManagerController extends BaseController {
pd.put("OPDATE", DateUtil.date2Str(new Date())); //操作日期
pd.put("OPUSER", Jurisdiction.getUsername()); //操作人
pd.put("ISDELETE", "0"); //是否删除
JSONObject jsonObject = PLSUtil.saveCamera(Jurisdiction.getCORPINFO_ID(), pd);
if (!"200".equals(jsonObject.getString("code"))) {
return ReturnMap.error("三方系统摄像头对接失败");
}
pd.put("PLS_ID", jsonObject.get("data"));
videomanagerService.save(pd);
map.put("result", errInfo);
return map;
@ -69,6 +72,10 @@ public class VideoManagerController extends BaseController {
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
JSONObject jsonObject = PLSUtil.removeCamera(Jurisdiction.getCORPINFO_ID(), pd);
if (!"200".equals(jsonObject.getString("code"))) {
return ReturnMap.error("三方系统摄像头对接失败");
}
videomanagerService.delete(pd);
map.put("result", errInfo); //返回结果
return map;
@ -116,6 +123,10 @@ public class VideoManagerController extends BaseController {
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
JSONObject jsonObject = PLSUtil.editCamera(Jurisdiction.getCORPINFO_ID(), pd);
if (!"200".equals(jsonObject.getString("code"))) {
return ReturnMap.error("三方系统摄像头对接失败,禁止修改");
}
videomanagerService.edit(pd);
map.put("result", errInfo);
return map;

View File

@ -33,5 +33,10 @@ public interface AIWarningMapper {
*/
PageData findById(PageData pd);
void save(PageData pd);
void edit(PageData pd);
void deleteAll(String[] aiwarningIds);
}

View File

@ -65,5 +65,6 @@ public interface VideoManagerMapper {
*/
void deleteAll(String[] ArrayDATA_IDS);
PageData findByCode(PageData videoPd);
}

View File

@ -3,6 +3,7 @@ package com.zcloud.service.system;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import com.zcloud.entity.system.User;
import com.zcloud.util.ReturnMap;
import java.io.IOException;
import java.util.List;
@ -266,7 +267,7 @@ public interface UsersService {
void editUserState(PageData pageData)throws Exception;
void saveUserNew(PageData pd) throws Exception;
ReturnMap saveUserNew(PageData pd) throws Exception;
/**USERID
* @param pd

View File

@ -250,23 +250,24 @@ public class UsersServiceImpl implements UsersService {
@Override
public String changeOrUpdUserCardNo(PageData nowuser) throws Exception {
PageData oldUser = usersMapper.findById(nowuser);
// 此人原来无卡号
// 先判断人员新的定位卡号是否有变化,没变化直接可以修改
if (oldUser.getString("CARDNO") == null || oldUser.getOrDefault("CARDNO","").equals(nowuser.getString("CARDNO"))) {
if (oldUser.getString("CARDNO") != null && oldUser.getOrDefault("CARDNO", "").equals(nowuser.getString("CARDNO"))) {
return Const.CAN_CHENG_USER;
}
// 有变化看库里是否有人在用这个新卡号
PageData getCordNo = new PageData();
getCordNo.putAll(nowuser);
getCordNo.put("CORPINFO_ID",Jurisdiction.getCORPINFO_ID());
getCordNo.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID());
PageData usedCardNo = usersMapper.findByCardNo(getCordNo);
// 卡号被本系统中他人使用了
if (usedCardNo != null) {
return Const.CARD_ALREADY_BEEN_USED+usedCardNo.getString("NAME");
return Const.CARD_ALREADY_BEEN_USED + usedCardNo.getString("NAME");
}
PageData cardNumberPeople = PLSUtil.getCardNumberPeople(nowuser);
// 这个新卡号其他系统中绑定人了
if (cardNumberPeople != null) {
return "人员定位系统中"+Const.CARD_ALREADY_BEEN_USED+cardNumberPeople.getString("name");
return "人员定位系统中" + Const.CARD_ALREADY_BEEN_USED + cardNumberPeople.getString("name");
}
return Const.CAN_CHENG_USER;
}
@ -277,14 +278,14 @@ public class UsersServiceImpl implements UsersService {
}
@Override
public void saveUserNew(PageData pd) throws Exception {
public ReturnMap saveUserNew(PageData pd) throws Exception {
pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID());
pd.put("WORKSTATUS", "1");
pd.put("WORKPERIOD", "1");
pd.put("RIGHTS", "788664966448");
// 先判断这个人定位卡号与姓名是否对的上
if (!PLSUtil.hasCardNumber(pd)) {
throw new Exception(pd.getString("CARDNO") + "定位卡已经存在");
return ReturnMap.error(pd.getString("CARDNO") + "定位卡已经存在");
}
if (pd.get("USERAVATARURL") != null && !pd.getString("USERAVATARURL").equals("")) {
@ -310,7 +311,7 @@ public class UsersServiceImpl implements UsersService {
pd.put("SKIN", "pcoded-navbar navbar-image-3, navbar pcoded-header navbar-expand-lg navbar-light header-dark");
pd.put("PASSWORD", new SimpleHash("SHA-1", pd.getString("USERNAME"), "666666").toString());
if (usersMapper.findByUsername(pd) == null && PLSUtil.saveUser(pd)) {
if (usersMapper.findByUsername(pd) == null) {
if ("true".equals(pd.getString("ISSTUDENT"))) {
if ("select".equals(pd.getString("letDutiesType"))) {
pd.put("DUTIES", pd.getString("DUTIES"));
@ -344,13 +345,19 @@ public class UsersServiceImpl implements UsersService {
}
userInfoService.save(pd);
}
PageData cardNumberPeople = PLSUtil.getCardNumberPeople(pd);
pd.put("PLS_ID", cardNumberPeople.getString("psnId"));
usersMapper.saveUser(pd);
FHLOG.save(Jurisdiction.getUsername(), "新增用户:" + pd.getString("USERNAME"));
} else {
throw new Exception("请检查定位卡号与用户名是否重复");
PageData response = PLSUtil.saveUser(pd);
if ("200".equals(response.getString("code"))) {
pd.put("PLS_ID", response.getString("data"));
usersMapper.saveUser(pd);
FHLOG.save(Jurisdiction.getUsername(), "新增用户:" + pd.getString("USERNAME"));
return ReturnMap.ok();
}
return ReturnMap.error(response.getString("msg"));
}
return ReturnMap.error("保存失败");
// PageData cardNumberPeople = PLSUtil.getCardNumberPeople(pd);
// pd.put("PLS_ID", cardNumberPeople.getString("psnId"));
// usersMapper.saveUser(pd);
}

View File

@ -32,5 +32,10 @@ public interface AIWarningService {
*/
public PageData findById(PageData pd)throws Exception;
void save(PageData pd);
void edit(PageData pd);
void deleteAll(String[] aiwarningIds);
}

View File

@ -65,5 +65,6 @@ public interface VideoManagerService {
*/
public void deleteAll(String[] ArrayDATA_IDS)throws Exception;
PageData findByCode(PageData videoPd);
}

View File

@ -47,5 +47,20 @@ public class AIWarningServiceImpl implements AIWarningService {
public PageData findById(PageData pd)throws Exception{
return aiwarningMapper.findById(pd);
}
@Override
public void save(PageData pd) {
aiwarningMapper.save(pd);
}
@Override
public void edit(PageData pd) {
aiwarningMapper.edit(pd);
}
@Override
public void deleteAll(String[] aiwarningIds) {
aiwarningMapper.deleteAll(aiwarningIds);
}
}

View File

@ -94,5 +94,10 @@ public class VideoManagerServiceImpl implements VideoManagerService {
videomanagerMapper.deleteAll(ArrayDATA_IDS);
}
@Override
public PageData findByCode(PageData videoPd) {
return videomanagerMapper.findByCode(videoPd);
}
}

View File

@ -1,5 +1,8 @@
package com.zcloud.util;
import java.util.HashMap;
import java.util.Map;
/**
*
* luoxiaobao
@ -73,4 +76,35 @@ public class Const {
// 修改用户相关
public static final String CAN_CHENG_USER="SUCCEEDS";
public static final String CARD_ALREADY_BEEN_USED="当前卡号已经被使用。使用人:";
public static final Map<String,String> WARNING_TYPE_MAP = new HashMap() {{
put("blockingmonitoring", "占道");
put("chefhatmonitoring", "厨师帽检测");
put("chefuniformmonitoring", "厨师服检测");
put("elevatorebikemonitoring", "电摩入梯");
put("empty", "空算法");
put("example", "示例算法");
put("facemaskmonitoring", "口罩检测");
put("faceset", "人脸识别(人脸库)");
put("fireextinguisherdetection", "灭火器");
put("gluedtophonemonitoring", "玩手机检测");
put("helmetwearingmonitoring", "安全帽");
put("intrusionmonitoring", "入侵检测(越界)");
put("intrusionmonitoringplus", "陌生人入侵");
put("mnpmonitoring", "机非人");
put("mousedetection", "老鼠检测");
put("nlprdetection", "车牌检测(车牌库)");
put("ondutymonitoring", "离岗检测");
put("peoplecountingcrossing", "过线人数统计");
put("peoplecrossingmonitoring", "过线检测");
put("peopledensitydetection", "人员密度检测");
put("peoplefalldetection", "人员跌倒检测");
put("peoplequeuemonitoring", "排队长度检测(排队统计)");
put("safetyvestmonitoring", "反光衣检测");
put("sleepingondutymonitoring", "睡岗");
put("smokefiremonitoring", "烟火检测");
put("smokingcallmonitoring", "抽烟打电话");
put("uniformnn", "工服(工服库)");
put("wastebinmonitoring", "垃圾桶检测");
}};
}

View File

@ -1,10 +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;
import com.zcloud.entity.EmployeeData;
import com.zcloud.entity.PageData;
import com.zcloud.service.corp.CorpPlsInfoService;
import com.zcloud.service.system.UsersService;
@ -12,17 +8,17 @@ 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.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
import javax.annotation.PostConstruct;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.*;
@Component
@ -42,6 +38,77 @@ public class PLSUtil {
restTemplate = restTemplatebean;
}
/**
* @Description:
* @Author: dearLin
* @Date: 2024/1/25/025 14:37
* @Param: [java.lang.String, java.lang.Integer, java.lang.Integer] [keywords, currentPage, showCount]
* @Return: com.alibaba.fastjson.JSONObject
*/
public static JSONObject saveCamera(String CORPINFO_ID, PageData camera) throws Exception {
HttpHeaders headers = new HttpHeaders();
headers.set("Authorization", getToken(CORPINFO_ID));
headers.setContentType(org.springframework.http.MediaType.valueOf("application/json"));
JSONObject uriVariables = new JSONObject();
uriVariables.put("camNo",camera.getString("CODE"));
uriVariables.put("camName",camera.getString("VIDEONAME"));
uriVariables.put("camIp","127.0.0.1");
uriVariables.put("type","0");
uriVariables.put("port","");
uriVariables.put("camUserName","1");
uriVariables.put("camPassword","1");
uriVariables.put("lon","");
uriVariables.put("lat","");
uriVariables.put("alt","");
HttpEntity<JSONObject> httpEntity = new HttpEntity<>(uriVariables,headers);
// HttpEntity<JSONObject> httpEntity = new HttpEntity<>(uriVariables,headers);
// ResponseEntity<JSONObject> jsonObjectResponseEntity = restTemplate.postForEntity(PLSUtil.BAKEADDR.get(CORPINFO_ID) + "/device/camera",
// httpEntity, JSONObject.class);
ResponseEntity<JSONObject> exchange = restTemplate.exchange(PLSUtil.BAKEADDR.get(CORPINFO_ID) + "/device/camera",
HttpMethod.POST,
httpEntity,
JSONObject.class);
return exchange.getBody();
}
/**
* @Description:
* @Author: dearLin
* @Date: 2024/1/25/025 14:37
* @Param: [java.lang.String, java.lang.Integer, java.lang.Integer] [keywords, currentPage, showCount]
* @Return: com.alibaba.fastjson.JSONObject
*/
public static JSONObject editCamera(String CORPINFO_ID, PageData camera) throws Exception {
HttpHeaders headers = new HttpHeaders();
headers.set("Authorization", getToken(CORPINFO_ID));
headers.setContentType(org.springframework.http.MediaType.valueOf("application/json"));
JSONObject uriVariables = new JSONObject();
uriVariables.put("camNo",camera.getString("CODE"));
uriVariables.put("camName",camera.getString("VIDEONAME"));
uriVariables.put("camId",camera.getString("PLS_ID"));
HttpEntity<JSONObject> httpEntity = new HttpEntity<>(uriVariables,headers);
ResponseEntity<JSONObject> exchange = restTemplate.exchange(PLSUtil.BAKEADDR.get(CORPINFO_ID) + "/device/camera",
HttpMethod.PUT, httpEntity,
JSONObject.class,uriVariables);
return exchange.getBody();
}
/**
* @Description:
* @Author: dearLin
* @Date: 2024/1/25/025 14:37
* @Param: [java.lang.String, java.lang.Integer, java.lang.Integer] [keywords, currentPage, showCount]
* @Return: com.alibaba.fastjson.JSONObject
*/
public static JSONObject removeCamera(String CORPINFO_ID, PageData camera) throws Exception {
HttpHeaders headers = new HttpHeaders();
headers.set("Authorization", getToken(CORPINFO_ID));
HttpEntity<JSONObject> httpEntity = new HttpEntity<>(headers);
ResponseEntity<JSONObject> exchange = restTemplate.exchange(PLSUtil.BAKEADDR.get(CORPINFO_ID) + "/device/camera/"+Integer.parseInt(camera.getString("PLS_ID")), HttpMethod.DELETE, httpEntity, JSONObject.class);
return exchange.getBody();
}
/**
* @Description:
* @Author: dearLin
@ -175,7 +242,7 @@ public class PLSUtil {
* @Param: [com.zcloud.entity.PageData] [user]
* @Return: void
*/
public static boolean saveUser(PageData user) throws Exception {
public static PageData 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"));
@ -197,8 +264,8 @@ public class PLSUtil {
loginPayload.put("deptName", "");
loginPayload.put("deptId", "");
loginPayload.put("avatar", "");
PageData response = sendPostHttpRequest(url, loginPayload.toJSONString(), getToken(Jurisdiction.getCORPINFO_ID()));
return "200".equals(response.getString("code"));
return sendPostHttpRequest(url, loginPayload.toJSONString(), getToken(Jurisdiction.getCORPINFO_ID()));
}
/**
@ -209,6 +276,15 @@ public class PLSUtil {
* @Return: void
*/
public static boolean editUser(PageData user) throws Exception {
// 这个人没有卡号与人id的话
if (!Tools.notEmpty(user.getString("PLS_ID"))) {
PageData response = saveUser(user);
if ("200".equals(response.getString("code"))) {
user.put("PLS_ID", response.getString("data"));
return true;
}
return false;
}
String url = BAKEADDR.get(Jurisdiction.getCORPINFO_ID()) + "/deploy/psnmgt/updPsnInfoById";
JSONObject loginPayload = new JSONObject();
loginPayload.put("name", user.getString("NAME"));

View File

@ -23,7 +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}$";
public static final String VERIFY_CARDNO_REGEX = "^[0-9]{5}$";
/**
* , 1518
*/

View File

@ -213,7 +213,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join OA_DEPARTMENT d on d.DEPARTMENT_ID=f.DEPARTMENT_ID
left join SYS_POST p on p.POST_ID=f.POST_ID
where
USER_ID = #{USER_ID}
USER_ID = #{USER_ID} and f.ISDELETE = 0
</select>
<!-- 通过邮箱获取数据 -->

View File

@ -65,13 +65,44 @@
#{HASHIDDEN},
#{AIWARNING_ID}
</sql>
<insert id="save" parameterType="pd">
insert into
<include refid="tableName"></include>
(
<include refid="Field2"></include>
) values (
<include refid="FieldValue"></include>
)
</insert>
<update id="edit">
update
<include refid="tableName"></include>
set
OPERATOR = #{OPERATOR},
OPERATTIME = #{OPERATTIME},
STATUS = #{STATUS},
ISTRUE = #{ISTRUE},
HASHIDDEN = #{HASHIDDEN}
where
AIWARNING_ID = #{AIWARNING_ID}
</update>
<update id="deleteAll">
update
<include refid="tableName"></include>
set ISDELETE = '1'
where
AIWARNING_ID in
<foreach collection="array" item="str" open="(" separator="," close=")">
#{str}
</foreach>
</update>
<!-- 通过ID获取数据 -->
<select id="findById" parameterType="pd" resultType="pd">
select
<include refid="Field"></include>,
v.VIDEONAME,
v.CODE,
c.CORP_NAME
from
BUS_AIWARNING f
@ -86,6 +117,7 @@
select
f.*,
v.VIDEONAME,
v.CODE,
c.CORP_NAME
from
BUS_AIWARNING f

View File

@ -181,6 +181,14 @@
and f.ISSHOW=#{ISSHOW}
</if>
</select>
<select id="findByCode" parameterType="pd" resultType="pd">
select
<include refid="Field"></include>
from
<include refid="tableName"></include> f
where
f.CODE=#{CODE}
</select>
<!-- 批量删除 -->
<delete id="deleteAll" parameterType="String">