Commit 305523a3 by chentian

布控追踪功能新增增加总数限制

parent 69a2b703
...@@ -50,4 +50,7 @@ public class Bkxx { ...@@ -50,4 +50,7 @@ public class Bkxx {
private String xxly; //信息来源,如果是民警手动录入的,则默认给录入人姓名,如果是系统自动加入布控,则给布控任务的布控对象号码 private String xxly; //信息来源,如果是民警手动录入的,则默认给录入人姓名,如果是系统自动加入布控,则给布控任务的布控对象号码
private String xxlytype;//信息来源type,01,表示民警录入,02,表示系统关联自动加入 private String xxlytype;//信息来源type,01,表示民警录入,02,表示系统关联自动加入
private String sqr_gajgjgdm;
private String sqr_gajgjgmc;
} }
...@@ -15,6 +15,7 @@ import com.founder.interservice.model.Track; ...@@ -15,6 +15,7 @@ import com.founder.interservice.model.Track;
import com.founder.interservice.util.DateUtil; import com.founder.interservice.util.DateUtil;
import com.founder.interservice.util.KeyUtil; import com.founder.interservice.util.KeyUtil;
import com.founder.interservice.util.ResultVOUtil; import com.founder.interservice.util.ResultVOUtil;
import com.founder.interservice.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -72,7 +73,20 @@ public class BkServiceImpl implements BkService{ ...@@ -72,7 +73,20 @@ public class BkServiceImpl implements BkService{
}else{ }else{
//新增 //新增
int bkxxs = bkxxMapper.selectBkxxCount(bkxx); int bkxxs = bkxxMapper.selectBkxxCount(bkxx);
if(bkxxs<1){ if(bkxxs<1) {
//获取机构总布控数,布控不能超过50,追踪不能超过10
String dwdm = "";
if (!StringUtil.ckeckEmpty(bkxx.getSqr_gajgjgdm())) {
dwdm = bkxx.getSqr_gajgjgdm().substring(0, 6);
}
int count = this.getBkxxCount(dwdm, bkxx.getType());
int maxCount=0;
if("01".equals(bkxx.getType())){//布控
maxCount=50;
}else if("02".equals(bkxx.getType())){//追踪
maxCount=10;
}
if (count < maxCount) {//可以新增
String id = KeyUtil.getUniqueKey("BK"); String id = KeyUtil.getUniqueKey("BK");
bkxx.setXxzjbh(id); bkxx.setXxzjbh(id);
bkxx.setDjsj(new Date()); bkxx.setDjsj(new Date());
...@@ -95,84 +109,91 @@ public class BkServiceImpl implements BkService{ ...@@ -95,84 +109,91 @@ public class BkServiceImpl implements BkService{
* 001:手机号布控,002:QQ号码布控,003:微信id,004:身份证号,005:车牌号,006:IMSI,007:IMEI,008:护照,009:微信号码 * 001:手机号布控,002:QQ号码布控,003:微信id,004:身份证号,005:车牌号,006:IMSI,007:IMEI,008:护照,009:微信号码
*/ */
if ("002".equals(bkxx.getBkdxlx())||"003".equals(bkxx.getBkdxlx())||"007".equals(bkxx.getBkdxlx())){ if ("002".equals(bkxx.getBkdxlx()) || "003".equals(bkxx.getBkdxlx()) || "007".equals(bkxx.getBkdxlx())) {
//QQ号码/微信id/IMEI //QQ号码/微信id/IMEI
List<String> imsis= bkServiceCommon.queryTargetBshByBsh(bkxx.getBkdxhm(),"IMSI"); List<String> imsis = bkServiceCommon.queryTargetBshByBsh(bkxx.getBkdxhm(), "IMSI");
List<String> oldImsis = new ArrayList<>(); List<String> oldImsis = new ArrayList<>();
if(imsis != null && !imsis.isEmpty()) { if (imsis != null && !imsis.isEmpty()) {
for (String imsi : imsis) { for (String imsi : imsis) {
List<BkTaskResult> bkTaskResults = bkTaskResultRepository.findBkResultsByBkXxzjbh(bkxx.getXxzjbh()); List<BkTaskResult> bkTaskResults = bkTaskResultRepository.findBkResultsByBkXxzjbh(bkxx.getXxzjbh());
if(bkTaskResults!=null&&bkTaskResults.size()>0){ if (bkTaskResults != null && bkTaskResults.size() > 0) {
for (BkTaskResult oldResult:bkTaskResults){ for (BkTaskResult oldResult : bkTaskResults) {
oldImsis.add(oldResult.getImsi()); oldImsis.add(oldResult.getImsi());
} }
if (!oldImsis.contains(imsi)){ if (!oldImsis.contains(imsi)) {
//在库中不存在 //在库中不存在
BkTaskResult bkTaskResult = bkServiceCommon.setBkResult( null, bkxx, imsi, ""); BkTaskResult bkTaskResult = bkServiceCommon.setBkResult(null, bkxx, imsi, "");
bkTaskResultRepository.save(bkTaskResult); bkTaskResultRepository.save(bkTaskResult);
} }
}else{ } else {
//关于此数据,库中没有结果 //关于此数据,库中没有结果
BkTaskResult bkTaskResult = bkServiceCommon.setBkResult( null, bkxx, imsi, ""); BkTaskResult bkTaskResult = bkServiceCommon.setBkResult(null, bkxx, imsi, "");
bkTaskResultRepository.save(bkTaskResult); bkTaskResultRepository.save(bkTaskResult);
} }
} }
} }
}else if("006".equals(bkxx.getBkdxlx())){ } else if ("006".equals(bkxx.getBkdxlx())) {
//通过IMSI查询IMEI //通过IMSI查询IMEI
List<String> imeis= bkServiceCommon.queryTargetBshByBsh(bkxx.getBkdxhm(),"IMSI"); List<String> imeis = bkServiceCommon.queryTargetBshByBsh(bkxx.getBkdxhm(), "IMSI");
List<String> oldImeis = new ArrayList<>(); List<String> oldImeis = new ArrayList<>();
if(imeis != null && !imeis.isEmpty()) { if (imeis != null && !imeis.isEmpty()) {
for (String imei : imeis) { for (String imei : imeis) {
List<BkTaskResult> bkTaskResults = bkTaskResultRepository.findBkResultsByBkXxzjbh(bkxx.getXxzjbh()); List<BkTaskResult> bkTaskResults = bkTaskResultRepository.findBkResultsByBkXxzjbh(bkxx.getXxzjbh());
if(bkTaskResults!=null&&bkTaskResults.size()>0){ if (bkTaskResults != null && bkTaskResults.size() > 0) {
for (BkTaskResult oldResult:bkTaskResults){ for (BkTaskResult oldResult : bkTaskResults) {
oldImeis.add(oldResult.getImei()); oldImeis.add(oldResult.getImei());
} }
if (oldImeis.contains(imei)){ if (oldImeis.contains(imei)) {
//在库中不存在 //在库中不存在
BkTaskResult bkTaskResult = bkServiceCommon.setBkResult( null, bkxx, "", imei); BkTaskResult bkTaskResult = bkServiceCommon.setBkResult(null, bkxx, "", imei);
bkTaskResultRepository.save(bkTaskResult); bkTaskResultRepository.save(bkTaskResult);
} }
}else { } else {
//关于此数据,库中没有结果 //关于此数据,库中没有结果
BkTaskResult bkTaskResult = bkServiceCommon.setBkResult( null, bkxx, "", imei); BkTaskResult bkTaskResult = bkServiceCommon.setBkResult(null, bkxx, "", imei);
bkTaskResultRepository.save(bkTaskResult); bkTaskResultRepository.save(bkTaskResult);
} }
} }
} }
}else if("005".equals(bkxx.getBkdxlx())){ } else if ("005".equals(bkxx.getBkdxlx())) {
//005:车牌号 //005:车牌号
List<String> oldCphm = new ArrayList<>(); List<String> oldCphm = new ArrayList<>();
String kssj = DateUtil.getDate().getTime()+""; String kssj = DateUtil.getDate().getTime() + "";
String jssj = DateUtil.convertStringToDate(DateUtil.beforeDate(-1).substring(0,10)).getTime()+""; String jssj = DateUtil.convertStringToDate(DateUtil.beforeDate(-1).substring(0, 10)).getTime() + "";
/* System.out.println("=============================进来了========================="); /* System.out.println("=============================进来了=========================");
System.out.println("=============================进来了=============信息主键============"+bkxx.getXxzjbh());*/ System.out.println("=============================进来了=============信息主键============"+bkxx.getXxzjbh());*/
List<BkTaskResult> bkTaskResults = bkTaskResultRepository.findBkResultsByBkXxzjbh(bkxx.getXxzjbh()); List<BkTaskResult> bkTaskResults = bkTaskResultRepository.findBkResultsByBkXxzjbh(bkxx.getXxzjbh());
/* System.out.println("=============================进来了=============判重成功了============"+bkTaskResults.size());*/ /* System.out.println("=============================进来了=============判重成功了============"+bkTaskResults.size());*/
if(bkTaskResults!=null&&bkTaskResults.size()>0){ if (bkTaskResults != null && bkTaskResults.size() > 0) {
for (BkTaskResult oldResult:bkTaskResults){ for (BkTaskResult oldResult : bkTaskResults) {
oldCphm.add(oldResult.getBkbsh()); oldCphm.add(oldResult.getBkbsh());
} }
if (!oldCphm.contains(bkxx.getBkdxhm())){ if (!oldCphm.contains(bkxx.getBkdxhm())) {
//在库中不存在 //在库中不存在
//直接获取轨迹信息 //直接获取轨迹信息
Track newLocation = bkServiceCommon.getNewLocation(bkxx.getBkdxhm(),kssj,jssj); Track newLocation = bkServiceCommon.getNewLocation(bkxx.getBkdxhm(), kssj, jssj);
/* System.out.print("获取的轨迹信息:"+newLocation.getAddress()+";==经纬度="+newLocation.getJ()+"===纬度"+newLocation.getW());*/ /* System.out.print("获取的轨迹信息:"+newLocation.getAddress()+";==经纬度="+newLocation.getJ()+"===纬度"+newLocation.getW());*/
BkTaskResult bkTaskResult = bkServiceCommon.setBkResult( newLocation, bkxx, "", ""); BkTaskResult bkTaskResult = bkServiceCommon.setBkResult(newLocation, bkxx, "", "");
bkTaskResultRepository.save(bkTaskResult); bkTaskResultRepository.save(bkTaskResult);
} }
}else { } else {
//关于此数据,库中没有结果 //关于此数据,库中没有结果
//直接获取轨迹信息 //直接获取轨迹信息
Track newLocation = bkServiceCommon.getNewLocation(bkxx.getBkdxhm(),kssj,jssj); Track newLocation = bkServiceCommon.getNewLocation(bkxx.getBkdxhm(), kssj, jssj);
/* System.out.println("=============================进来了==查询了轨迹============"+newLocation.getAddress());*/ /* System.out.println("=============================进来了==查询了轨迹============"+newLocation.getAddress());*/
BkTaskResult bkTaskResult = bkServiceCommon.setBkResult( newLocation, bkxx, "", ""); BkTaskResult bkTaskResult = bkServiceCommon.setBkResult(newLocation, bkxx, "", "");
bkTaskResultRepository.save(bkTaskResult); bkTaskResultRepository.save(bkTaskResult);
} }
} }
} else { } else {
//提示,超过布控或追踪总数
result.put("id", null);
result.put("maxCount", maxCount);
result.put("status", ResultEnum.PARAM_ERROR.getCode());
result.put("message", "超过最大布控/追踪数");
}
} else {
result.put("id", null); result.put("id", null);
result.put("status", ResultEnum.PARAM_ERROR.getCode()); result.put("status", ResultEnum.PARAM_ERROR.getCode());
result.put("message", "数据已存在,不可重复!"); result.put("message", "数据已存在,不可重复!");
......
...@@ -123,7 +123,12 @@ ...@@ -123,7 +123,12 @@
if(data.data.id=="0"){ if(data.data.id=="0"){
$.messager.alert({title:'提示',msg:'保存失败'}); $.messager.alert({title:'提示',msg:'保存失败'});
}else if(data.data.id==null){ }else if(data.data.id==null){
$.messager.alert({title:'提示',msg:'数据已存在,不可重复提交'}); if(data.data.maxCount!=null){
$.messager.alert({title:'提示',msg:'已超过最大布控/追踪数'});
}else{
$.messager.alert({title:'提示',msg:'数据已存在,不可重复提交'});
}
}else{ }else{
$.messager.alert({title:'提示',msg:'保存成功'}); $.messager.alert({title:'提示',msg:'保存成功'});
} }
......
...@@ -197,7 +197,8 @@ ...@@ -197,7 +197,8 @@
<input type="hidden" id="xxly" name="xxly" value="${bkxx.xxly}"/> <input type="hidden" id="xxly" name="xxly" value="${bkxx.xxly}"/>
<input type="hidden" id="xxlytype" name="xxlytype" value="${bkxx.xxlytype}"/> <input type="hidden" id="xxlytype" name="xxlytype" value="${bkxx.xxlytype}"/>
<input type="hidden" id="djsj" name="djsj" value="${djsjStr}"/> <input type="hidden" id="djsj" name="djsj" value="${djsjStr}"/>
<input type="hidden" id="sqr_gajgjgdm" name="sqr_gajgjgdm" value="${bkxx.sqr_gajgjgdm}"/>
<input type="hidden" id="sqr_gajgjgmc" name="sqr_gajgjgmc" value="${bkxx.sqr_gajgjgmc}"/>
</td> </td>
</tr> </tr>
</tbody> </tbody>
......
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