|
@@ -1,12 +1,12 @@
|
|
|
package com.xiaoan.web.backend;
|
|
|
|
|
|
-import cn.hutool.core.util.StrUtil;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
import com.xiaoan.common.constant.MsgCode;
|
|
|
import com.xiaoan.common.model.PageDto;
|
|
|
import com.xiaoan.common.util.ResultJson;
|
|
|
import com.xiaoan.domain.backend.CameraDetailEntity;
|
|
|
import com.xiaoan.domain.backend.CameraEntity;
|
|
|
+import com.xiaoan.domain.backend.DepartmentEntity;
|
|
|
import com.xiaoan.domain.backend.SceneProEntity;
|
|
|
import com.xiaoan.domain.dto.request.CameraRequest;
|
|
|
import com.xiaoan.domain.dto.request.SceneProRequest;
|
|
@@ -24,6 +24,7 @@ import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
+import tk.mybatis.mapper.entity.Condition;
|
|
|
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
@@ -140,19 +141,38 @@ public class PersonalCenterController extends BaseController {
|
|
|
public ResultJson save(@RequestBody CameraRequest param){
|
|
|
|
|
|
String wifiName = param.getWifiName();
|
|
|
+ wifiName = StringUtils.upperCase(wifiName);
|
|
|
|
|
|
+ // 校验wifiName
|
|
|
if (StringUtils.isBlank(wifiName)) {
|
|
|
log.error("相机sn码不能为空");
|
|
|
return new ResultJson(MsgCode.e_COMMON_3001, "相机sn码不能为空");
|
|
|
}
|
|
|
|
|
|
- if (!wifiName.contains("_")) {
|
|
|
+ if (!wifiName.contains("4DKKPRO_")) {
|
|
|
log.error("相机sn码有误");
|
|
|
return new ResultJson(MsgCode.e_COMMON_3001, "相机sn码有误");
|
|
|
}
|
|
|
|
|
|
String snCode = StringUtils.substringAfter(wifiName, "_");
|
|
|
|
|
|
+ if (snCode.length() != 9) {
|
|
|
+ log.error("相机sn码有误");
|
|
|
+ return new ResultJson(MsgCode.e_COMMON_3001, "相机sn码有误");
|
|
|
+ }
|
|
|
+
|
|
|
+ // wifiName查重
|
|
|
+ Condition condition = new Condition(CameraEntity.class);
|
|
|
+ condition.and().andEqualTo("wifiName", wifiName);
|
|
|
+ List<CameraEntity> cameraList = cameraService.findAll(condition);
|
|
|
+
|
|
|
+ if (cameraList.size() > 0) {
|
|
|
+ log.error("相机sn码已注册");
|
|
|
+ return new ResultJson(MsgCode.e_COMMON_3001, "相机sn码已注册");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
CameraEntity cameraEntity = null;
|
|
|
if (param.getId() == null) {
|
|
|
|
|
@@ -196,9 +216,14 @@ public class PersonalCenterController extends BaseController {
|
|
|
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
- String a = "dkkkk?123456";
|
|
|
+ String a = "dkkkk_1aa4567891";
|
|
|
System.out.println(StringUtils.substringAfter(a, "_"));
|
|
|
- System.out.println(a.contains("_"));
|
|
|
+
|
|
|
+ String s = StringUtils.substringAfter(a, "_");
|
|
|
+ if (s.length() != 9) {
|
|
|
+ System.out.println("不等于9");
|
|
|
+ }
|
|
|
+ System.out.println(StringUtils.upperCase(a));
|
|
|
}
|
|
|
|
|
|
}
|