Browse Source

扫码后台0215完成

maoyunfeng 5 years ago
parent
commit
8be6ff1529

+ 9 - 0
whepi-web/src/main/java/com/bofeng/entity/SysUptownHouse.java

@@ -1,5 +1,6 @@
 package com.bofeng.entity;
 
+import com.alibaba.excel.annotation.ExcelProperty;
 import com.baomidou.mybatisplus.annotations.TableField;
 import com.baomidou.mybatisplus.annotations.TableId;
 import com.baomidou.mybatisplus.annotations.TableName;
@@ -20,9 +21,11 @@ public class SysUptownHouse implements Serializable {
     private Long unitId;
 
     @TableField(exist = false)
+    @ExcelProperty(value = {"楼栋"}, index = 1)
     private String ridgepole;
 
     @TableField(exist = false)
+    @ExcelProperty(value = {"单元"}, index = 2)
     private String unit;
 
     @TableField(exist = false)
@@ -35,6 +38,7 @@ public class SysUptownHouse implements Serializable {
     private String time;
 
     @TableField("doorplate")
+    @ExcelProperty(value = {"房间号"}, index = 3)
     private String doorplate;
 
     @TableField("status")
@@ -50,18 +54,23 @@ public class SysUptownHouse implements Serializable {
     private DateTime timeUpdate;
 
     @TableField(exist = false)
+    @ExcelProperty(value = {"小区名称"}, index = 0)
     private String uptownName;
 
     @TableField(exist = false)
+    @ExcelProperty(value = {"小区大门"}, index = 5)
     private String doorName;
 
     @TableField(exist = false)
+    @ExcelProperty(value = {"进入时间"}, index = 6)
     private String intoDate;
 
     @TableField(exist = false)
+    @ExcelProperty(value = {"外出时间"}, index = 7)
     private String outDate;
 
     @TableField(exist = false)
+    @ExcelProperty(value = {"用户名"}, index = 4)
     private String nickName;
 
     @TableField(exist = false)

+ 0 - 10
whepi-web/src/main/java/com/bofeng/service/SweepCodeService.java

@@ -20,16 +20,6 @@ public class SweepCodeService {
 
     public List<SysUptownHouse> selectCode(Map<String, Object> queryParam) {
         List<SysUptownHouse> sysUptownHouses = sweepCodeMapper.selectCode(queryParam);
-        if(sysUptownHouses.size()>0){
-            for (int i = 0; i < sysUptownHouses.size(); i++) {
-                if(sysUptownHouses.get(i).getIntoDate()== "0000-01-01 00:00:00"){
-                    sysUptownHouses.get(i).setJcStatus("外出");
-                }
-                if(sysUptownHouses.get(i).getOutDate()== "0000-01-01 00:00:00"){
-                    sysUptownHouses.get(i).setJcStatus("进入");
-                }
-            }
-        }
 
         return sysUptownHouses;
     }

+ 34 - 0
whepi-web/src/main/java/com/bofeng/wx/controller/ScanAdminController.java

@@ -1,9 +1,43 @@
 package com.bofeng.wx.controller;
 
+import com.bofeng.entity.SysUptownHouse;
+import com.bofeng.excel.ExcelUtils;
+import com.bofeng.service.SweepCodeService;
+import com.yvan.Model;
+import com.yvan.springmvc.HttpParameterParser;
 import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.SneakyThrows;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
 @Api("进出扫码后台信息")
 @RestController
 public class ScanAdminController {
+
+
+    @Autowired
+    private SweepCodeService sweepCodeService;
+
+    @ApiOperation("出入查询")
+    @GetMapping("/whepi/sweepCode/selectCode")
+    public Model<List<SysUptownHouse>> selectCode(HttpParameterParser parser) {
+//        HttpServletResponse response,HttpServletRequest request
+        List<SysUptownHouse> sysUptownHouses = sweepCodeService.selectCode(parser.getMap());
+        return Model.newSuccess(sysUptownHouses);
+    }
+
+    @ApiOperation("导出")
+    @GetMapping("/whepi/sweepCode/export")
+    @SneakyThrows
+    public void export(HttpParameterParser parser,HttpServletResponse resp) {
+        List<SysUptownHouse> sysUptownHouses = sweepCodeService.selectCode(parser.getMap());
+        ExcelUtils.writeSheet(SysUptownHouse.class, sysUptownHouses).export(resp,"扫码导出");
+    }
+
+
 }

+ 20 - 2
whepi-web/src/main/resources/mapper/SweepCodeMapper.xml

@@ -9,15 +9,33 @@
         e.doorplate,
         b.door_name,
         c.into_date,
-        c.out_date,
+        h.out_date,
         g.nick_name
         from sys_uptown a
         inner join sys_uptown_door b on a.uptown_id = b.uptown_id
-        inner join out_scan c on c.door_id = b.door_id
+        inner join out_scan c on c.into_door_id = b.door_id
+        inner join out_scan h on h.out_door_id = b.door_id
         inner join sys_uptown_unit d on d.uptown_id = a.uptown_id
         inner join sys_uptown_house e on e.unit_id = d.unit_id
         inner join sys_user_role j on j.property_id = e.house_id and j.role_id = 1
         inner join sys_user_open g on g.user_id = j.user_id
+        <where>
+         <if test="uptownName != null and uptownName != ''">
+          a.uptown_name like concat('%',#{uptownName},'%')
+         </if>
+         <if test="intoDate != null and intoDate !=''">
+          and c.into_date >= #{intoDate}
+         </if>
+         <if test="intoDate != null and intoDate !=''">
+          and c.into_date &lt; #{intoDate}
+         </if>
+         <if test="outDate != null and outDate !=''">
+          and h.out_date &lt; #{outDate}
+         </if>
+         <if test="outDate != null and outDate !=''">
+          and h.out_date >= #{outDate}
+         </if>
+        </where>
     </select>