Commit dddc94dd by dupengfei

新增人脸布控信息下发 侦查指令

parent f93252b1
package com.founder.model;
/*
* @Description TODO
* @Author du_pengfei
* @Date 2021/11/17
* @Version 1.0
*/
public class AppNotificationFaceVO {
// 消息id
private String notificationId;
// 设备id
private String deviceId;
// 证件照片
private String storagePath;
// 采集时间
private String shotTime;
// 姓名
private String name;
// 抓拍时间
private String faceAppearTime;
// 相识度
private String similarity;
//抓拍照片
private String txmc1;
// 年龄下限
private String ageLowerLimit;
// 年龄上线
private String ageUpLimit;
// 是否刑事犯罪
private String isCriminalInvolved;
// 是否在押人员
private String isDetainees;
// 是否司机
private String isDriver;
// 是否外国人
private String isForeigner;
// 是否疑似恐怖分子
private String isSuspectedTerrorist;
// 是否可疑人员
private String isSuspiciousPerson;
// 数据来源
private String tabId;
// 布控原因
private String caseDetil;
// 证件号码
private String idCard;
// 电话号码
private String casePhone;
public String getNotificationId() {
return notificationId;
}
public void setNotificationId(String notificationId) {
this.notificationId = notificationId;
}
public String getDeviceId() {
return deviceId;
}
public void setDeviceId(String deviceId) {
this.deviceId = deviceId;
}
public String getStoragePath() {
return storagePath;
}
public void setStoragePath(String storagePath) {
this.storagePath = storagePath;
}
public String getShotTime() {
return shotTime;
}
public void setShotTime(String shotTime) {
this.shotTime = shotTime;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getFaceAppearTime() {
return faceAppearTime;
}
public void setFaceAppearTime(String faceAppearTime) {
this.faceAppearTime = faceAppearTime;
}
public String getSimilarity() {
return similarity;
}
public void setSimilarity(String similarity) {
this.similarity = similarity;
}
public String getTxmc1() {
return txmc1;
}
public void setTxmc1(String txmc1) {
this.txmc1 = txmc1;
}
public String getAgeLowerLimit() {
return ageLowerLimit;
}
public void setAgeLowerLimit(String ageLowerLimit) {
this.ageLowerLimit = ageLowerLimit;
}
public String getAgeUpLimit() {
return ageUpLimit;
}
public void setAgeUpLimit(String ageUpLimit) {
this.ageUpLimit = ageUpLimit;
}
public String getIsCriminalInvolved() {
return isCriminalInvolved;
}
public void setIsCriminalInvolved(String isCriminalInvolved) {
this.isCriminalInvolved = isCriminalInvolved;
}
public String getIsDetainees() {
return isDetainees;
}
public void setIsDetainees(String isDetainees) {
this.isDetainees = isDetainees;
}
public String getIsDriver() {
return isDriver;
}
public void setIsDriver(String isDriver) {
this.isDriver = isDriver;
}
public String getIsForeigner() {
return isForeigner;
}
public void setIsForeigner(String isForeigner) {
this.isForeigner = isForeigner;
}
public String getIsSuspectedTerrorist() {
return isSuspectedTerrorist;
}
public void setIsSuspectedTerrorist(String isSuspectedTerrorist) {
this.isSuspectedTerrorist = isSuspectedTerrorist;
}
public String getIsSuspiciousPerson() {
return isSuspiciousPerson;
}
public void setIsSuspiciousPerson(String isSuspiciousPerson) {
this.isSuspiciousPerson = isSuspiciousPerson;
}
public String getTabId() {
return tabId;
}
public void setTabId(String tabId) {
this.tabId = tabId;
}
public String getCaseDetil() {
return caseDetil;
}
public void setCaseDetil(String caseDetil) {
this.caseDetil = caseDetil;
}
public String getIdCard() {
return idCard;
}
public void setIdCard(String idCard) {
this.idCard = idCard;
}
public String getCasePhone() {
return casePhone;
}
public void setCasePhone(String casePhone) {
this.casePhone = casePhone;
}
}
...@@ -304,15 +304,28 @@ public class ZczlController { ...@@ -304,15 +304,28 @@ public class ZczlController {
@RequestMapping(value = "/receivedNewData", method = {RequestMethod.POST,RequestMethod.GET}) @RequestMapping(value = "/receivedNewData", method = {RequestMethod.POST,RequestMethod.GET})
@ResponseBody @ResponseBody
public Map<String, Object> receivedNewData(@RequestParam("id") String id) throws IOException { public Map<String, Object> receivedNewDataCar(@RequestParam("id") String id, @RequestParam("type") String type) throws IOException {
if ("1".equals(type)){
return carAlarm(id);
}else if ("2".equals(type)){
return faceAlarm(id);
} else {
HashMap<String, Object> resultMap = new HashMap<>();
resultMap.put("code", 201);
resultMap.put("message", "type类型错误,1-车辆告警,2-人脸告警");
return resultMap;
}
}
public Map<String, Object> carAlarm(String id) throws IOException{
TbYwZczl tbYwZczl = new TbYwZczl(); TbYwZczl tbYwZczl = new TbYwZczl();
//用刘罗成 发送指令 //用刘罗成 发送指令
User user = loginService.getUserByUsername("180349"); User user = loginService.getUserByUsername("180349");
tbYwZczl.setZlfqrxm(user.getTrueName()); tbYwZczl.setZlfqrxm(user.getTrueName());
tbYwZczl.setZlfqrlxdh(user.getTelephone()); tbYwZczl.setZlfqrlxdh(user.getTelephone());
tbYwZczl.setZlfqrgmsfhm(user.getIdentitycard()); tbYwZczl.setZlfqrgmsfhm(user.getIdentitycard());
...@@ -336,6 +349,12 @@ public class ZczlController { ...@@ -336,6 +349,12 @@ public class ZczlController {
String[] strings = id.split(","); String[] strings = id.split(",");
for (String str : strings) { for (String str : strings) {
// 先判断是否 车辆的消息 2 不是
String isCar = carOrFace(str);
if ("2".equals(isCar)){
continue;
}
AppNotificationVO notification = zczlService.queryNotification(str); AppNotificationVO notification = zczlService.queryNotification(str);
//每条指令 一个xxzjbh //每条指令 一个xxzjbh
String zczlbh = anjianSeqService.importZlbhFnVal("TB_YW_ZCZL", user.getUnitcode()); String zczlbh = anjianSeqService.importZlbhFnVal("TB_YW_ZCZL", user.getUnitcode());
...@@ -473,9 +492,150 @@ public class ZczlController { ...@@ -473,9 +492,150 @@ public class ZczlController {
return resultMap; return resultMap;
} }
public Map<String, Object> faceAlarm(String id) throws IOException {
TbYwZczl tbYwZczl = new TbYwZczl();
//用刘罗成 发送指令 180349
User user = loginService.getUserByUsername("admin");
tbYwZczl.setZlfqrxm(user.getTrueName());
tbYwZczl.setZlfqrlxdh(user.getTelephone());
tbYwZczl.setZlfqrgmsfhm(user.getIdentitycard());
tbYwZczl.setZlfqrgajgdm(user.getUnitcode());
tbYwZczl.setZlfqrdwmc(user.getUnitname());
tbYwZczl.setXxscpdbz("0");
tbYwZczl.setFqrjh(user.getPolicemanid());
tbYwZczl.setSpsftg("2");
tbYwZczl.setYwmc("人脸布控侦查指令");
tbYwZczl.setHbqx(feedbackTime(1));
tbYwZczl.setYwlx("1");
tbYwZczl.setZllx("9900");
tbYwZczl.setZlsy("人脸布控侦查反馈");
tbYwZczl.setGzyq("各单位指令负责人,请接到指令后立即组织工作专班,围绕布控人脸文件(见附件)中提供的线索进一步进行侦查、排查工作。相关工作情况请在回报期限内上报公安厅!");
//1 遍历最新的 id
String[] strings = id.split(",");
for (String str : strings) {
// 先判断是否 车辆的消息 2 不是
String isCar = carOrFace(str);
if ("1".equals(isCar)) {
continue;
}
AppNotificationFaceVO notification = zczlService.queryFaceNotification(str);
//每条指令 一个xxzjbh
String zczlbh = anjianSeqService.importZlbhFnVal("TB_YW_ZCZL", user.getUnitcode());
tbYwZczl.setZczlbh(zczlbh);
if (notification != null) {
//2 生成 docx 文档
Map<String, Object> map = new HashMap<>();
String l = Long.toString(System.currentTimeMillis());
// 文件真实名称
String temFileName = "布控人脸详情" + l + ".docx";
map.put("notificationId", notification.getNotificationId());
map.put("shotTime", notification.getShotTime());
map.put("storagePath", new ImageEntity(WordUtil.image2byte(notification.getStoragePath()), 200, 100));
map.put("name", notification.getName());
map.put("faceAppearTime", notification.getFaceAppearTime());
map.put("similarity", notification.getSimilarity());
map.put("txmc1", new ImageEntity(WordUtil.image2byte(notification.getTxmc1()), 200, 100));
map.put("ageLowerLimit", notification.getAgeLowerLimit());
map.put("ageUpLimit", notification.getAgeUpLimit());
map.put("isCriminalInvolved", notification.getIsCriminalInvolved());
map.put("isDetainees", notification.getIsDetainees());
map.put("isDriver", notification.getIsDriver());
map.put("isForeigner", notification.getIsForeigner());
map.put("isSuspectedTerrorist", notification.getIsSuspectedTerrorist());
map.put("isSuspiciousPerson", notification.getIsSuspiciousPerson());
map.put("tabId", notification.getTabId());
map.put("caseDetil", notification.getCaseDetil());
map.put("idCard", notification.getIdCard());
map.put("casePhone", notification.getCasePhone());
//根据设备id 确定要将指令发送单位
//String subCode = notification.getDeviceId().substring(0, 4);
//String unitCode = zczlService.queryUnitCode(subCode);
//tbYwZczl.setZljsdwdm(unitCode);
// 文件模版路径
String templatePath = getRootPath() + "WEB-INF/classes/static/word/exportFace.docx";
// 文件临时路径
String temDir = getRootPath() + "WEB-INF/classes/static/temp/";
// 文件生产后,导出到临时文件目录
WordUtil.exportWord(templatePath, temDir, temFileName, map);
//线下测试用固定的单位代码
tbYwZczl.setZljsdwdm("150100050600");
try {
//3 插入数据到 tb_yw_zczl
//新增侦查指令信息
zczlService.importZczl(tbYwZczl);
//新增侦查指令附件信息
// 临时文件
File temFile = new File(temDir + temFileName);
// 实际文件存放位置 在项目根路径下
String unloadDir = getRootPath() + "zczl/" + zczlbh + "/";
File dir = new File(unloadDir);
//如果不存在创建
if (!dir.exists()) {
dir.mkdirs();
}
//为避免文件重名,加上日期的前缀
String fileName = StringUtil.getUUID();
//将文件存入数据库中
TbYwZczlFj fjxx = new TbYwZczlFj();
String xxzjbh = zczlService.getXxzjbhFnVal(user.getUnitcode());
fjxx.setZczlbh(zczlbh);
fjxx.setXxzjbh(xxzjbh);
//电子文件名称
fjxx.setDzwjmc(temFileName);
//电子文件内容
fjxx.setDzwjnr(fileConvertToByteArray(temFile));
//电子文件位置
fjxx.setDzwjwz("/zczl/" + zczlbh + "/" + fileName);
// 保存到 附件表中
zczlService.saveImportZczlfj(fjxx);
//将文件内容写入服务器生成的文件中
copyFile(temDir + temFileName, unloadDir, fileName);
} catch (Exception e) {
throw new BaseException("新增侦查指令信息出错!", e);
}
//4 删除 临时文件
WordUtil.delAllFiles(temDir + temFileName);
//5 修改标识 表示已经发送了侦查指令
int flag = zczlService.updateNotification(str);
}
}
HashMap<String, Object> resultMap = new HashMap<>();
resultMap.put("code", 200);
resultMap.put("success", "true");
return resultMap;
}
//@ResponseBody //@ResponseBody
//@RequestMapping("/test") //@RequestMapping("/test")
@Scheduled(initialDelay = 200000L, fixedDelay = 43200000L) //@Scheduled(initialDelay = 200000L, fixedDelay = 43200000L)
//@Scheduled(initialDelay = 10000L, fixedDelay = 60000L) //@Scheduled(initialDelay = 10000L, fixedDelay = 60000L)
public void dayTask() throws IOException { public void dayTask() throws IOException {
...@@ -484,7 +644,7 @@ public class ZczlController { ...@@ -484,7 +644,7 @@ public class ZczlController {
String s = String.join(",", ids); String s = String.join(",", ids);
if (! "".equals(s)){ if (! "".equals(s)){
Map<String, Object> map = receivedNewData(s); Map<String, Object> map = receivedNewDataCar(s, "1");
logger.info("消息ID:{}",s); logger.info("消息ID:{}",s);
logger.info("定时任务,发送侦查指令:{}", map.get("code")); logger.info("定时任务,发送侦查指令:{}", map.get("code"));
} else { } else {
...@@ -492,6 +652,24 @@ public class ZczlController { ...@@ -492,6 +652,24 @@ public class ZczlController {
} }
} }
// 判断这条消息是否是车辆布控消息 是返回 1 不是(人脸)返回 2
private String carOrFace(String notificationId){
AppNotificationVO carNotification = zczlService.queryIsOrNotCarNotification(notificationId);
if (carNotification == null){
return "2";
} else {
return "1";
}
}
public Map<String, Object> receivedNewDataFace(){
HashMap<String, Object> map = new HashMap<>();
return map;
}
/** /**
* 跳转侦查指令统计 * 跳转侦查指令统计
......
...@@ -171,4 +171,8 @@ public interface ZczlDao { ...@@ -171,4 +171,8 @@ public interface ZczlDao {
List<String> queryNotSeedNotification(); List<String> queryNotSeedNotification();
String queryUnitCode(@Param("subCode") String subCode); String queryUnitCode(@Param("subCode") String subCode);
AppNotificationVO queryIsOrNotCarNotification(@Param("id") String notificationId);
AppNotificationFaceVO queryFaceAlarm(@Param("id") String str);
} }
...@@ -164,4 +164,8 @@ public interface IZczlService { ...@@ -164,4 +164,8 @@ public interface IZczlService {
List<String> queryNotSeedNotification(); List<String> queryNotSeedNotification();
String queryUnitCode(String subCode); String queryUnitCode(String subCode);
AppNotificationVO queryIsOrNotCarNotification(String notificationId);
AppNotificationFaceVO queryFaceNotification(String str);
} }
...@@ -1966,5 +1966,13 @@ public class ZczlService implements IZczlService { ...@@ -1966,5 +1966,13 @@ public class ZczlService implements IZczlService {
return zczlDao.queryUnitCode(subCode); return zczlDao.queryUnitCode(subCode);
} }
@Override
public AppNotificationVO queryIsOrNotCarNotification(String notificationId) {
return zczlDao.queryIsOrNotCarNotification(notificationId);
}
@Override
public AppNotificationFaceVO queryFaceNotification(String str) {
return zczlDao.queryFaceAlarm(str);
}
} }
#��������ʹ��dev����ʽ����ʹ��prod #��������ʹ��dev����ʽ����ʹ��prod
spring.profiles.active=pro spring.profiles.active=dev
server.port=9046 server.port=9046
# ҳ��Ĭ��ǰ׺Ŀ¼ # ҳ��Ĭ��ǰ׺Ŀ¼
spring.mvc.view.prefix=/WEB-INF/jsp/ spring.mvc.view.prefix=/WEB-INF/jsp/
......
...@@ -1897,6 +1897,14 @@ ...@@ -1897,6 +1897,14 @@
</select> </select>
<select id="queryIsOrNotCarNotification" resultType="com.founder.model.AppNotificationVO">
select
n.NOTIFICATIONID notificationId
from TB_APP_NOTIFICATION n right join TB_APP_MOTORVEHICLEOBJECT m on n.NOTIFICATIONID = m.NOTIFICATIONID
where 1=1
and n.NOTIFICATIONID = #{id, jdbcType=VARCHAR}
</select>
<select id="queryImageInfo" resultType="com.founder.model.TbAppSubimageinfoobject"> <select id="queryImageInfo" resultType="com.founder.model.TbAppSubimageinfoobject">
select HEIGHT height, select HEIGHT height,
WIDTH width, WIDTH width,
...@@ -1921,6 +1929,34 @@ ...@@ -1921,6 +1929,34 @@
</select> </select>
<select id="queryFaceAlarm" resultType="com.founder.model.AppNotificationFaceVO">
select n.NOTIFICATIONID notificationId,
f.DEVICEID deviceId,
f.STORAGEPATH storagePath,
f.SHOTTIME shotTime,
f.NAME name,
f.FACEAPPEARTIME faceAppearTime,
f.SIMILARITY similarity,
f.TXMC1 txmc1,
f.AGELOWERLIMIT ageLowerLimit,
f.AGEUPLIMIT ageUpLimit,
case when f.ISCRIMINALINVOLVED = '1' then '是' when f.ISCRIMINALINVOLVED = '2' then '否' end isCriminalInvolved,
case when f.ISDETAINEES = '1' then '是' when f.ISDETAINEES = '2' then '否' end isDetainees,
case when f.ISDRIVER = '1' then '是' when f.ISDRIVER = '2' then '否' end isDriver,
case when f.ISFOREIGNER = '1' then '是' when f.ISFOREIGNER = '2' then '否' end isForeigner,
case when f.ISSUSPECTEDTERRORIST = '1' then '是' when f.ISSUSPECTEDTERRORIST = '2' then '否' end isSuspectedTerrorist,
case when f.ISSUSPICIOUSPERSON = '1' then '是' when f.ISSUSPICIOUSPERSON = '2' then '否' end isSuspiciousPerson,
case when f.TABID = '2012' then '兵团重点人员库' when f.TABID = '2004' then '全国在逃库' end tabId,
d.CASEDETIL caseDetil,
d.IDCARD idCard,
d.CASEPHONE casePhone
from TB_APP_NOTIFICATION n
inner join TB_APP_FACEOBJECT f on n.NOTIFICATIONID = f.NOTIFICATIONID
inner join TB_APP_FACEALARMDETAIL d on f.NOTIFICATIONID = d.NOTIFICATIONID
where 1=1 and n.send_zczl_flag = 0
and n.NOTIFICATIONID = #{id, jdbcType=VARCHAR}
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -4,8 +4,10 @@ import cn.afterturn.easypoi.entity.ImageEntity; ...@@ -4,8 +4,10 @@ import cn.afterturn.easypoi.entity.ImageEntity;
import com.founder.model.AppNotificationVO; import com.founder.model.AppNotificationVO;
import com.founder.util.WordUtil; import com.founder.util.WordUtil;
import com.founder.zczl.controller.ZczlController; import com.founder.zczl.controller.ZczlController;
import com.founder.zczl.dao.ZczlDao;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.context.junit4.SpringRunner;
...@@ -14,6 +16,7 @@ import java.time.LocalDateTime; ...@@ -14,6 +16,7 @@ import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map;
//@RunWith(SpringRunner.class) //@RunWith(SpringRunner.class)
//@SpringBootTest //@SpringBootTest
...@@ -41,12 +44,38 @@ public class ZczlServiceApplicationTests { ...@@ -41,12 +44,38 @@ public class ZczlServiceApplicationTests {
map.put("pictures", imageEntities); map.put("pictures", imageEntities);
WordUtil.exportWord("src/main/resources/word/export.docx", "src/main/resources/temp/", "aab.docx", map); WordUtil.exportWord("src/main/resources/static/word/export.docx", "src/main/resources/static/temp/", "aab.docx", map);
}
@Test
public void exportFaceAlarm() throws IOException {
//ImageEntity wordImageEntity = new ImageEntity(WordUtil.image2byte("https://t7.baidu.com/it/u=2168645659,3174029352&fm=193&f=GIF"),200, 200);
//https://t7.baidu.com/it/u=2531125946,3055766435&fm=193&f=GIF
HashMap<String, Object> map = new HashMap<>();
map.put("name", "du");
//map.put("brandreliability", "100");
map.put("storagePath", new ImageEntity(WordUtil.image2byte("https://t7.baidu.com/it/u=2168645659,3174029352&fm=193&f=GIF"), 200, 100));
map.put("similarity", "98.9");
//ArrayList<ImageEntity> imageEntities1 = new ArrayList<>();
//imageEntities1.add(new ImageEntity(WordUtil.image2byte("https://t7.baidu.com/it/u=2168645659,3174029352&fm=193&f=GIF"), 200, 100));
//map.put("ni", "2021-03-01");
//map.put("ma", "2021-03-01");
//map.put("cao", "1213123131");
//map.put("bi", "1213123131");
WordUtil.exportWord("src/main/resources/static/word/exportkt.docx", "src/main/resources/static/temp/", "aab.docx", map);
} }
@Test @Test
public void delTest(){ public void delTest(){
WordUtil.delAllFiles("src/main/resources/temp/aaa.docx"); WordUtil.delAllFiles("src/main/resources/temp/aaa.docx");
...@@ -73,4 +102,39 @@ public class ZczlServiceApplicationTests { ...@@ -73,4 +102,39 @@ public class ZczlServiceApplicationTests {
System.out.println(s); System.out.println(s);
} }
@Autowired
ZczlDao dao;
@Test
public void isOrNotTest(){
AppNotificationVO notification = dao.queryIsOrNotCarNotification("13132131231323");
String type = "";
if (notification == null){
type = "2";
}else {
type = "1";
}
String[] numbers = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10" };
for (String s: numbers) {
if (s.equals(type)) {
continue;
}
System.out.println("Count is: " + s);
}
}
@Autowired
ZczlController controller;
@Test
public void faceAlarm() throws IOException {
Map<String, Object> map = controller.faceAlarm("31231234ui4u4u0sfjks");
System.out.println(map.toString());
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment