Browse Source

1.预警人员 和 预警记录 的完善

wxg 3 years ago
parent
commit
3a82ee7021
21 changed files with 457 additions and 28 deletions
  1. 0 10
      .idea/runConfigurations.xml
  2. 93 3
      src/main/java/com/yx/face/controller/admin/UserControlEarlyWarningListController.java
  3. 6 1
      src/main/java/com/yx/face/dao/UserControlEarlyWarningListDao.java
  4. 3 0
      src/main/java/com/yx/face/model/dto/AdminDTO.java
  5. 43 0
      src/main/java/com/yx/face/model/dto/UserControlEarlyWarningDTO.java
  6. 6 0
      src/main/java/com/yx/face/model/entity/Admin.java
  7. 3 2
      src/main/java/com/yx/face/model/entity/UserControlEarlyWarningList.java
  8. 3 2
      src/main/java/com/yx/face/model/entity/UserControlEarlyWarningListLog.java
  9. 3 0
      src/main/java/com/yx/face/model/excel/AdminInfoExcel.java
  10. 32 0
      src/main/java/com/yx/face/model/excel/UserControlEarlyWarningExcel.java
  11. 5 5
      src/main/java/com/yx/face/model/query/UserEarlyWarningLogQu.java
  12. 34 0
      src/main/java/com/yx/face/model/search/UserControlEarlyWarningSearch.java
  13. 2 0
      src/main/java/com/yx/face/model/vo/AdminVO.java
  14. 45 0
      src/main/java/com/yx/face/model/vo/UserControlEarlyWarningVO.java
  15. 19 0
      src/main/java/com/yx/face/service/UserControlEarlyWarningListService.java
  16. 6 2
      src/main/java/com/yx/face/service/impl/AdminServiceImpl.java
  17. 95 0
      src/main/java/com/yx/face/service/impl/UserControlEarlyWarningListServiceImpl.java
  18. 56 0
      src/main/resources/mapper/UserControlEarlyWarningListDao.xml
  19. 3 3
      src/main/resources/mapper/UserControlEarlyWarningListLogDao.xml
  20. BIN
      src/main/webapp/excel/adminInfoExcel.xlsx
  21. BIN
      src/main/webapp/excel/airportWarning.xlsx

+ 0 - 10
.idea/runConfigurations.xml

@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project version="4">
-  <component name="RunConfigurationProducerService">
-    <option name="ignoredProducers">
-      <set>
-        <option value="com.android.tools.idea.compose.preview.runconfiguration.ComposePreviewRunConfigurationProducer" />
-      </set>
-    </option>
-  </component>
-</project>

+ 93 - 3
src/main/java/com/yx/face/controller/admin/UserControlEarlyWarningListController.java

@@ -1,8 +1,36 @@
 package com.yx.face.controller.admin;
 
 
+import com.alibaba.excel.EasyExcel;
+import com.github.pagehelper.PageInfo;
+import com.yx.face.boot.restful.RestDTO;
+import com.yx.face.boot.restful.RestResponse;
+import com.yx.face.boot.restful.RestResult;
+import com.yx.face.boot.restful.ServiceException;
+import com.yx.face.boot.uitls.ExcelListenerUtils;
+import com.yx.face.model.dto.UserControlEarlyWarningDTO;
+import com.yx.face.model.dto.UserWhitelistDTO;
+import com.yx.face.model.excel.UserControlEarlyWarningExcel;
+import com.yx.face.model.excel.UserWhitelistExcel;
+import com.yx.face.model.search.UserControlEarlyWarningSearch;
+import com.yx.face.model.search.UserWhitelistSearch;
+import com.yx.face.model.vo.AdminVO;
+import com.yx.face.model.vo.UserControlEarlyWarningVO;
+import com.yx.face.model.vo.UserWhitelistVO;
+import com.yx.face.service.AdminService;
+import com.yx.face.service.UserControlEarlyWarningListService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.validation.Valid;
+import java.io.IOException;
+import java.util.List;
 
 /**
  * <p>
@@ -12,8 +40,70 @@ import org.springframework.web.bind.annotation.RequestMapping;
  * @author wxg
  * @since 2022-01-24
  */
-@Controller
-@RequestMapping("/userControlEarlyWarningList")
+@Slf4j
+@RequiredArgsConstructor(onConstructor = @__(@Autowired))
+@Api(tags = "B 预警人员 API")
+@RestController
+@RequestMapping("admin/userControlEarlyWarningList")
 public class UserControlEarlyWarningListController {
 
+    private final UserControlEarlyWarningListService userControlEarlyWarningListService;
+    private final AdminService adminService;
+
+
+    @ApiOperation("新增或修改预警人员")
+    @PostMapping("addOrUpdate")
+    public RestResult<Boolean> addOrUpdate(@RequestBody @Valid UserControlEarlyWarningDTO userControlEarlyWarningDTO) {
+        if(userControlEarlyWarningDTO.getAdminId() == null) throw new ServiceException("账户id不能为空");
+
+        AdminVO info = adminService.getInfo(userControlEarlyWarningDTO.getAdminId());
+        if(info == null)throw new ServiceException("没有查询到账号信息");
+        if(info.getType() != 5)throw new ServiceException("预警人员只能添加到区级账号下");
+        Integer insert = userControlEarlyWarningListService.addOrUpdate(userControlEarlyWarningDTO);
+        if (insert == 1) return RestResponse.ok(true);
+        else return RestResponse.error("操作失败");
+    }
+
+    @ApiOperation("预警人员的批量导入")
+    @PostMapping("userControlEarlyWarningListExcel")
+    public RestResult<List<String>> userControlEarlyWarningListExcel(@RequestParam("file") MultipartFile excelFile , @RequestParam("adminId")Integer adminId ) {
+        AdminVO info = adminService.getInfo(adminId);
+        if(info == null)throw new ServiceException("没有查询到账号信息");
+        if(info.getType() != 5)throw new ServiceException("预警人员只能添加到区级账号下");
+
+        ExcelListenerUtils listener = new ExcelListenerUtils();  //ExcelListener
+        try {
+            EasyExcel.read(excelFile.getInputStream(), UserControlEarlyWarningExcel.class, listener).sheet(0).doReadSync();  //ExcelModel 上面创建的实体类
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        List<Object> datas = listener.getDatas(); //把拿到的数据处理到集合里去(根据所需自行修改)
+        return userControlEarlyWarningListService.userControlEarlyWarningListExcel(datas,adminId);
+    }
+
+    @ApiOperation("删除预警人员")
+    @GetMapping("delete")
+    public RestResult<Boolean> delete(@RequestParam("controlEarlyWarningId") Integer controlEarlyWarningId) {
+        Integer insert = userControlEarlyWarningListService.delete(controlEarlyWarningId);
+        if (insert == 1) return RestResponse.ok(true);
+        else return RestResponse.error("删除失败");
+    }
+
+    @ApiOperation("预警人员列表分页")
+    @PostMapping("/getPageList")
+    public RestResult<PageInfo<UserControlEarlyWarningVO>> getPageList(@RequestBody RestDTO<UserControlEarlyWarningSearch> dto) {
+        reBuildQuery(dto);
+        PageInfo<UserControlEarlyWarningVO> pageList = userControlEarlyWarningListService.getPageList(dto);
+        if (pageList != null) {
+            return RestResponse.ok(pageList);
+        }
+        return RestResponse.error("获取常客列表分页失败");
+    }
+    private void reBuildQuery(@RequestBody RestDTO<UserControlEarlyWarningSearch> dto) {
+        UserControlEarlyWarningSearch object = dto.getData();
+        if (object == null) {
+            object = new UserControlEarlyWarningSearch();
+        }
+        dto.setData(object);
+    }
 }

+ 6 - 1
src/main/java/com/yx/face/dao/UserControlEarlyWarningListDao.java

@@ -2,6 +2,10 @@ package com.yx.face.dao;
 
 import com.yx.face.boot.component.tk.TKMapper;
 import com.yx.face.model.entity.UserControlEarlyWarningList;
+import com.yx.face.model.vo.UserControlEarlyWarningVO;
+
+import java.util.List;
+import java.util.Map;
 
 /**
  * <p>
@@ -12,5 +16,6 @@ import com.yx.face.model.entity.UserControlEarlyWarningList;
  * @since 2022-01-24
  */
 public interface UserControlEarlyWarningListDao extends TKMapper<UserControlEarlyWarningList> {
-
+    /*分页查询预警人员列表*/
+    List<UserControlEarlyWarningVO> getPageList(Map<String, Object> map);
 }

+ 3 - 0
src/main/java/com/yx/face/model/dto/AdminDTO.java

@@ -74,5 +74,8 @@ public class AdminDTO {
 
     @ApiModelProperty(value = "是否脱敏重要信息 1.脱敏 2.不脱敏")
     private Integer isHideImportant;
+
+    @ApiModelProperty(value = "是否开启布控 1.开启  2.不开启 默认2")
+    private Integer isControlEarlyWarning;
 }
 

+ 43 - 0
src/main/java/com/yx/face/model/dto/UserControlEarlyWarningDTO.java

@@ -0,0 +1,43 @@
+package com.yx.face.model.dto;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+
+/**
+ * @description:
+ * @ClassName UserControlEarlyWarningDTO
+ * @Author WXG
+ * @Date 2022/1/24 15:48
+ */
+@ApiModel("预警人员DTO model")
+@Data
+public class UserControlEarlyWarningDTO {
+
+    @ApiModelProperty(value = "预警人员id 无代表新增 ,有代表修改")
+    private Long id;
+
+    @ApiModelProperty(value = "预警人员姓名")
+    private String earlyWarningName;
+
+    @ApiModelProperty(value = "预警人员身份证号")
+    private String earlyWarningIdNumber;
+
+    @ApiModelProperty(value = "布控人姓名")
+    private String controlName;
+
+    @ApiModelProperty(value = "布控人电话")
+    private String controlPhone;
+
+    @ApiModelProperty(value = "布控人单位")
+    private String controlUnit;
+
+    @ApiModelProperty(value = "管理员id")
+    private Integer adminId;
+
+
+}

+ 6 - 0
src/main/java/com/yx/face/model/entity/Admin.java

@@ -173,5 +173,11 @@ public class Admin {
     * */
     @Column(name = "is_hide_important")
     private Integer isHideImportant;
+
+    /*
+     * 是否开启布控 1.开启  2.不开启 默认2
+     * */
+    @Column(name = "is_control_early_warning")
+    private Integer isControlEarlyWarning;
 }
 

+ 3 - 2
src/main/java/com/yx/face/model/entity/UserControlEarlyWarningList.java

@@ -7,6 +7,7 @@ import lombok.experimental.Accessors;
 import javax.persistence.*;
 import java.io.Serializable;
 import java.time.LocalDateTime;
+import java.util.Date;
 
 /**
  * <p>
@@ -36,13 +37,13 @@ public class UserControlEarlyWarningList{
      * 更新时间
      */
     @Column(name = "update_time")
-    private LocalDateTime updateTime;
+    private Date updateTime;
 
     /**
      * 创建时间
      */
     @Column(name = "create_time")
-    private LocalDateTime createTime;
+    private Date createTime;
 
     /**
      * 管理员id

+ 3 - 2
src/main/java/com/yx/face/model/entity/UserControlEarlyWarningListLog.java

@@ -7,6 +7,7 @@ import lombok.experimental.Accessors;
 import javax.persistence.*;
 import java.io.Serializable;
 import java.time.LocalDateTime;
+import java.util.Date;
 
 /**
  * <p>
@@ -30,13 +31,13 @@ public class UserControlEarlyWarningListLog{
      * 更新时间
      */
     @Column(name = "update_time")
-    private LocalDateTime updateTime;
+    private Date updateTime;
 
     /**
      * 创建时间
      */
     @Column(name = "create_time")
-    private LocalDateTime createTime;
+    private Date createTime;
 
     /**
      * 管理员id

+ 3 - 0
src/main/java/com/yx/face/model/excel/AdminInfoExcel.java

@@ -61,5 +61,8 @@ public class AdminInfoExcel {
 
     @ExcelProperty(value = "是否脱敏",index = 14)
     private String isHideImportant;
+
+    @ExcelProperty(value = "是否开启布控",index = 15)
+    private String isControlEarlyWarning;
 }
 

+ 32 - 0
src/main/java/com/yx/face/model/excel/UserControlEarlyWarningExcel.java

@@ -0,0 +1,32 @@
+package com.yx.face.model.excel;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * @description:
+ * @ClassName UserControlEarlyWarningExcel
+ * @Author WXG
+ * @Date 2022/1/24 15:19
+ */
+@Data
+public class UserControlEarlyWarningExcel {
+
+    @ExcelProperty(value = "预警人员姓名",index = 0)
+    private String earlyWarningName;
+
+    @ExcelProperty(value = "预警人员身份证号",index = 1)
+    private String earlyWarningIdNumber;
+
+    @ExcelProperty(value = "布控人姓名",index = 2)
+    private String controlName;
+
+    @ExcelProperty(value = "布控人电话",index = 3)
+    private String controlPhone;
+
+    @ExcelProperty(value = "布控人单位",index = 4)
+    private String controlUnit;
+
+
+}

+ 5 - 5
src/main/java/com/yx/face/model/query/UserEarlyWarningLogQu.java

@@ -26,23 +26,23 @@ public class UserEarlyWarningLogQu {
     @ApiModelProperty(value = "结束时间")
     private String endTime;
 
-    @ApiModelProperty(value = "预警人姓名")
+    @ApiModelProperty(value = "预警人姓名 模糊查")
     private String name;
 
-    @ApiModelProperty(value = "预警人身份证号")
+    @ApiModelProperty(value = "预警人身份证号 全输查")
     private String idNumber;
 
     @ApiModelProperty(value = "预警是否确认1否2是")
     private Integer status;
 
 
-    @ApiModelProperty(value = "布控人单位")
+    @ApiModelProperty(value = "布控人单位 模糊查")
     private String controlUnit;
 
-    @ApiModelProperty(value = "布控人手机号")
+    @ApiModelProperty(value = "布控人手机号 全输查")
     private String controlPhone;
 
-    @ApiModelProperty(value = "布控人姓名")
+    @ApiModelProperty(value = "布控人姓名 模糊查")
     private String controlName;
 
     @ApiModelProperty(value = "adminId", hidden = true)

+ 34 - 0
src/main/java/com/yx/face/model/search/UserControlEarlyWarningSearch.java

@@ -0,0 +1,34 @@
+package com.yx.face.model.search;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * @description:
+ * @ClassName UserControlEarlyWarningDTO
+ * @Author WXG
+ * @Date 2022/1/24 15:48
+ */
+@ApiModel("预警人员Search model")
+@Data
+public class UserControlEarlyWarningSearch {
+
+    @ApiModelProperty(value = "预警人员姓名 模糊查询")
+    private String earlyWarningName;
+
+    @ApiModelProperty(value = "预警人员身份证号 全输查询")
+    private String earlyWarningIdNumber;
+
+    @ApiModelProperty(value = "布控人姓名 模糊查询")
+    private String controlName;
+
+    @ApiModelProperty(value = "布控人电话 全输查询")
+    private String controlPhone;
+
+    @ApiModelProperty(value = "布控人单位 模糊查询")
+    private String controlUnit;
+
+    @ApiModelProperty(value = "账户名称 全输查询")
+    private String username;
+}

+ 2 - 0
src/main/java/com/yx/face/model/vo/AdminVO.java

@@ -100,6 +100,8 @@ public class AdminVO {
     @ApiModelProperty(value = "是否脱敏重要信息 1.脱敏 2.不脱敏")
     private Integer isHideImportant;
 
+    @ApiModelProperty(value = "是否开启布控 1.开启  2.不开启 默认2")
+    private Integer isControlEarlyWarning;
 
 //    @ApiModelProperty("脱敏数据查询是否配置 0-未配置 1 -配置")
 //    private Integer sysQueryConfiguration;

+ 45 - 0
src/main/java/com/yx/face/model/vo/UserControlEarlyWarningVO.java

@@ -0,0 +1,45 @@
+package com.yx.face.model.vo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * @description:
+ * @ClassName UserControlEarlyWarningVO
+ * @Author WXG
+ * @Date 2022/1/24 15:48
+ */
+@ApiModel("预警人员VO model")
+@Data
+public class UserControlEarlyWarningVO {
+
+    @ApiModelProperty(value = "预警人员id")
+    private Long id;
+
+    @ApiModelProperty(value = "预警人员姓名")
+    private String earlyWarningName;
+
+    @ApiModelProperty(value = "预警人员身份证号")
+    private String earlyWarningIdNumber;
+
+    @ApiModelProperty(value = "布控人姓名")
+    private String controlName;
+
+    @ApiModelProperty(value = "布控人电话")
+    private String controlPhone;
+
+    @ApiModelProperty(value = "布控人单位")
+    private String controlUnit;
+
+    @ApiModelProperty(value = "账户名称")
+    private String username;
+
+    @ApiModelProperty(value = "创建时间")
+    private Date createTime;
+
+    @ApiModelProperty(value = "账户Id")
+    private String adminId;
+}

+ 19 - 0
src/main/java/com/yx/face/service/UserControlEarlyWarningListService.java

@@ -1,6 +1,14 @@
 package com.yx.face.service;
 
+import com.github.pagehelper.PageInfo;
+import com.yx.face.boot.restful.RestDTO;
+import com.yx.face.boot.restful.RestResult;
+import com.yx.face.model.dto.UserControlEarlyWarningDTO;
 import com.yx.face.model.entity.UserControlEarlyWarningList;
+import com.yx.face.model.search.UserControlEarlyWarningSearch;
+import com.yx.face.model.vo.UserControlEarlyWarningVO;
+
+import java.util.List;
 
 /**
  * <p>
@@ -12,4 +20,15 @@ import com.yx.face.model.entity.UserControlEarlyWarningList;
  */
 public interface UserControlEarlyWarningListService{
 
+    /*新增或修改预警人员(根据是否有id判断)*/
+    Integer addOrUpdate(UserControlEarlyWarningDTO userControlEarlyWarningDTO);
+
+    /*批量导入预警人员*/
+    RestResult<List<String>> userControlEarlyWarningListExcel(List<Object> datas ,Integer adminId);
+
+    /*删除预警人员*/
+    Integer delete(Integer controlEarlyWarningId);
+
+    /*预警人员分页显示*/
+    PageInfo<UserControlEarlyWarningVO> getPageList(RestDTO<UserControlEarlyWarningSearch> dto);
 }

+ 6 - 2
src/main/java/com/yx/face/service/impl/AdminServiceImpl.java

@@ -118,6 +118,7 @@ public class AdminServiceImpl implements AdminService {
         adminLoginVO.setPoliceStationCode(adminInfo.getPoliceStationCode());
         adminLoginVO.setPoliceStationName(adminInfo.getPoliceStationName());
         adminLoginVO.setTagId(adminInfo.getTagId());
+        adminLoginVO.setIsControlEarlyWarning(adminInfo.getIsControlEarlyWarning());
         if (adminInfo.getTagId() != null) {
             adminLoginVO.setTagName(adminTagDao.selectByPrimaryKey(adminInfo.getTagId()).getName());
         }
@@ -171,6 +172,7 @@ public class AdminServiceImpl implements AdminService {
         adminLoginVO.setAddress(adminInfo.getAddress());
         adminLoginVO.setPoliceStationCode(adminInfo.getPoliceStationCode());
         adminLoginVO.setPoliceStationName(adminInfo.getPoliceStationName());
+        adminLoginVO.setIsControlEarlyWarning(adminInfo.getIsControlEarlyWarning());
         /*wxg 2021-11-4 增加省市区详细地址 结束*/
 //        SystemConfigVO vo = systemConfigDao.sysConfiguration(adminLoginVO.getAdminId());
 //        if (vo != null) {
@@ -210,6 +212,7 @@ public class AdminServiceImpl implements AdminService {
         adminInfo.setStreetId(dto.getStreetId() == null ? null : dto.getStreetId());
         adminInfo.setStreetName(dto.getStreetId() == null ? null : areaCodeService.getById(dto.getStreetId()).getName());
         adminInfo.setAddress(dto.getAddress());
+        adminInfo.setIsControlEarlyWarning(dto.getIsControlEarlyWarning());
 //        if(dto.getPoliceStationCode()==null||dto.getPoliceStationCode().equals("")){
 //            throw new ServiceException("派出所编码不能为空");
 //        }
@@ -349,8 +352,8 @@ public class AdminServiceImpl implements AdminService {
                 if (adminInfoExcel.getPassword() == null) throw new ServiceException("第" + (i + 2) + "行,密码不能为空");
                 if (adminInfoExcel.getTag() == null) throw new ServiceException("第" + (i + 2) + "行,所属部门不能为空");
                 if (adminInfoExcel.getIsOut() == null) throw new ServiceException("第" + (i + 2) + "行,是否可以导出不能为空");
-                if (adminInfoExcel.getIsHideImportant() == null)
-                    throw new ServiceException("第" + (i + 2) + "行,是否脱敏不能为空");
+                if (adminInfoExcel.getIsHideImportant() == null) throw new ServiceException("第" + (i + 2) + "行,是否脱敏不能为空");
+                if (adminInfoExcel.getIsControlEarlyWarning() == null) throw new ServiceException("第" + (i + 2) + "行,是否开启布控不能为空");
 
                 AdminDTO adminDTO = new AdminDTO();
                 if (adminInfoExcel.getType().equals("市级")) adminDTO.setType((byte) 4);
@@ -394,6 +397,7 @@ public class AdminServiceImpl implements AdminService {
                 adminDTO.setTagId(at.getId());
                 adminDTO.setIsOut(adminInfoExcel.getIsOut().equals("可以") ? 1 : 2);
                 adminDTO.setIsHideImportant(adminInfoExcel.getIsHideImportant().equals("脱敏") ? 1 : 2);
+                adminDTO.setIsControlEarlyWarning(adminInfoExcel.getIsControlEarlyWarning().equals("开启") ? 1 : 2);
                 adminDTO.setPoliceStationCode(adminInfoExcel.getPoliceStationCode());
 
                 try {

+ 95 - 0
src/main/java/com/yx/face/service/impl/UserControlEarlyWarningListServiceImpl.java

@@ -1,10 +1,31 @@
 package com.yx.face.service.impl;
 
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.yx.face.boot.restful.RestDTO;
+import com.yx.face.boot.restful.RestResponse;
+import com.yx.face.boot.restful.RestResult;
+import com.yx.face.boot.restful.ServiceException;
+import com.yx.face.boot.uitls.SMSOrIdCardUtils;
 import com.yx.face.dao.UserControlEarlyWarningListDao;
+import com.yx.face.model.dto.UserControlEarlyWarningDTO;
+import com.yx.face.model.dto.UserWhitelistDTO;
 import com.yx.face.model.entity.UserControlEarlyWarningList;
+import com.yx.face.model.excel.UserControlEarlyWarningExcel;
+import com.yx.face.model.excel.UserWhitelistExcel;
+import com.yx.face.model.search.UserControlEarlyWarningSearch;
+import com.yx.face.model.vo.AdminVO;
+import com.yx.face.model.vo.FaceLogVO;
+import com.yx.face.model.vo.UserControlEarlyWarningVO;
+import com.yx.face.service.AdminService;
 import com.yx.face.service.UserControlEarlyWarningListService;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import javax.annotation.Resource;
+import java.util.*;
+
 /**
  * <p>
  * 预警人员 服务实现类
@@ -16,4 +37,78 @@ import org.springframework.stereotype.Service;
 @Service
 public class UserControlEarlyWarningListServiceImpl implements UserControlEarlyWarningListService {
 
+    @Resource
+    private UserControlEarlyWarningListDao userControlEarlyWarningListDao;
+
+    @Autowired
+    private AdminService adminService;
+
+    @Override
+    public Integer addOrUpdate(UserControlEarlyWarningDTO userControlEarlyWarningDTO) {
+        if(!SMSOrIdCardUtils.isIdCard(userControlEarlyWarningDTO.getEarlyWarningIdNumber()))
+        throw new ServiceException("请输入正确的预警人员身份证号");
+
+        Date date = new Date();
+        UserControlEarlyWarningList ucewl = new UserControlEarlyWarningList();
+        BeanUtils.copyProperties(userControlEarlyWarningDTO,ucewl);
+        ucewl.setUpdateTime(date);
+        if(userControlEarlyWarningDTO.getId() == null){
+            UserControlEarlyWarningList u = new UserControlEarlyWarningList();
+            u.setEarlyWarningIdNumber(userControlEarlyWarningDTO.getEarlyWarningIdNumber());
+            u.setAdminId(userControlEarlyWarningDTO.getAdminId());
+            UserControlEarlyWarningList userControlEarlyWarningList = userControlEarlyWarningListDao.selectOne(u);
+            if(userControlEarlyWarningList != null)throw new ServiceException("该预警人员已经添加到该账号下了");
+
+            ucewl.setCreateTime(date);
+            return userControlEarlyWarningListDao.insertSelective(ucewl);
+        }else {
+            UserControlEarlyWarningList userControlEarlyWarningList = userControlEarlyWarningListDao.selectByPrimaryKey(userControlEarlyWarningDTO.getId());
+            if(!userControlEarlyWarningList.getEarlyWarningIdNumber().equals(userControlEarlyWarningDTO.getEarlyWarningIdNumber()))
+                throw new ServiceException("预警人员身份照号不可修改");
+            ucewl.setId(userControlEarlyWarningDTO.getId());
+            return userControlEarlyWarningListDao.updateByPrimaryKeySelective(ucewl);
+        }
+    }
+
+    @Override
+    public RestResult<List<String>> userControlEarlyWarningListExcel(List<Object> datas,Integer adminId) {
+        List<String> list = new ArrayList<>();
+        for (int i = 0; i < datas.size(); i++) {
+            try {
+                UserControlEarlyWarningExcel ucewe = (UserControlEarlyWarningExcel) datas.get(i);
+                if (ucewe.getEarlyWarningIdNumber() == null) throw new ServiceException("第" + (i + 2) + "行,预警人员身份证号不能为空");
+
+                UserControlEarlyWarningDTO userControlEarlyWarningDTO = new UserControlEarlyWarningDTO();
+                BeanUtils.copyProperties(ucewe,userControlEarlyWarningDTO);
+                userControlEarlyWarningDTO.setAdminId(adminId);
+                try {
+                    this.addOrUpdate(userControlEarlyWarningDTO);
+                } catch (Exception e) {
+                    throw new ServiceException("第" + (i + 2) + "行," + e.getMessage());
+                }
+            } catch (ServiceException e) {
+                list.add(e.getMessage());
+                continue;
+            }
+        }
+        datas.clear();//结束后销毁不用的资源
+        return RestResponse.ok(list);
+    }
+
+    @Override
+    public Integer delete(Integer controlEarlyWarningId) {
+        return userControlEarlyWarningListDao.deleteByPrimaryKey(controlEarlyWarningId);
+    }
+
+    @Override
+    public PageInfo<UserControlEarlyWarningVO> getPageList(RestDTO<UserControlEarlyWarningSearch> dto) {
+        AdminVO info = adminService.getInfo();
+        Map<String, Object> map = new HashMap<>();
+        map.put("adminVO", info);
+        map.put("query", dto.getData());
+
+        PageHelper.startPage(dto.getPageNum(), dto.getPageSize());
+        List<UserControlEarlyWarningVO> list = userControlEarlyWarningListDao.getPageList(map);
+        return new PageInfo<>(list);
+    }
 }

+ 56 - 0
src/main/resources/mapper/UserControlEarlyWarningListDao.xml

@@ -18,5 +18,61 @@
     <sql id="Base_Column_List">
         id, early_warning_name, update_time, create_time, admin_id, early_warning_id_number, control_name, control_phone, control_unit
     </sql>
+    <select id="getPageList" resultType="com.yx.face.model.vo.UserControlEarlyWarningVO">
+        select
+            u.id,
+            u.early_warning_name,
+            u.early_warning_id_number,
+            u.control_name,
+            u.control_phone,
+            u.control_unit,
+            u.create_time,
+            a.username,
+            a.id as adminId
+        from user_control_early_warning_list u
+        Left join admin a on a.id = u.admin_id
+        <where>
+            <if test="adminVO.type == 2">
+                and a.province_id = #{adminVo.provinceId}
+                and a.type in (3 ,4 ,5)
+            </if>
+            <if test="adminVO.type == 3">
+                and a.province_id = #{adminVo.provinceId}
+                and a.type in (4 , 5)
+                and a.tag_id = #{adminVo.tagId}
+            </if>
+            <if test="adminVO.type == 4">
+                and a.city_id = #{adminVo.cityId}
+                and a.type = 5
+                and a.tag_id = #{adminVo.tagId}
+            </if>
+            <if test="adminVO.type == 5">
+                and a.id =#{adminVo.adminId}
+            </if>
+
+
+            <if test="query.earlyWarningName != null and query.earlyWarningName !=''">
+                AND u.early_warning_name LIKE CONCAT('%',#{query.earlyWarningName},'%')
+            </if>
+            <if test="query.earlyWarningIdNumber != null and query.earlyWarningIdNumber !=''">
+                AND u.early_warning_id_number = #{query.earlyWarningIdNumber}
+            </if>
+            <if test="query.controlName != null and query.controlName !=''">
+                AND u.control_name LIKE CONCAT('%',#{query.controlName},'%')
+            </if>
+            <if test="query.controlPhone != null and query.controlPhone !=''">
+                AND u.control_phone = #{query.controlPhone}
+            </if>
+            <if test="query.controlUnit != null and query.controlUnit !=''">
+                AND u.control_unit LIKE CONCAT('%',#{query.controlUnit},'%')
+            </if>
+
+            <if test="query.username != null and query.username !=''">
+                AND a.username = #{query.username}
+            </if>
+        </where>
+
+
+    </select>
 
 </mapper>

+ 3 - 3
src/main/resources/mapper/UserControlEarlyWarningListLogDao.xml

@@ -101,10 +101,10 @@
                 and a.status =#{qu.status}
             </if>
             <if test="qu.name != '' and qu.name != null ">
-                and d.early_warning_name =#{qu.name}
+                and b.name  like concat('%',#{qu.name},'%')
             </if>
             <if test="qu.idNumber != '' and qu.idNumber != null ">
-                and d.early_warning_id_number =#{qu.idNumber}
+                and b.cardid =#{qu.idNumber}
             </if>
 
             <if test="qu.controlUnit != null and qu.controlUnit != '' ">
@@ -114,7 +114,7 @@
                 and d.control_phone =#{qu.controlPhone}
             </if>
             <if test="qu.controlName != null and qu.controlName != '' ">
-                and d.control_name =#{qu.controlName}
+                and d.control_name  like concat('%',#{qu.controlName},'%')
             </if>
             <if test="qu.startTime != null and qu.startTime != '' and qu.endTime != null and qu.endTime != '' ">
                 AND  <![CDATA[ b.face_time >= #{qu.startTime}]]>

BIN
src/main/webapp/excel/adminInfoExcel.xlsx


BIN
src/main/webapp/excel/airportWarning.xlsx