stjdydayou 4 лет назад
Родитель
Сommit
662518df4d

+ 2 - 0
src/main/java/com/zhiqiyun/open/Application.java

@@ -4,12 +4,14 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.context.annotation.Configuration;
+import org.springframework.scheduling.annotation.EnableScheduling;
 
 /**
  * @author stjdydayou
  */
 @Slf4j
 @Configuration
+@EnableScheduling
 @SpringBootApplication
 public class Application {
 

+ 44 - 0
src/main/java/com/zhiqiyun/open/core/enmus/PassengerEquipmentActionType.java

@@ -0,0 +1,44 @@
+package com.zhiqiyun.open.core.enmus;
+
+
+/**
+ * @author jtoms
+ */
+
+public enum PassengerEquipmentActionType implements IBaseEnum {
+    /**
+     *
+     */
+    IN(1, "进入"), OUT(2, "离开");
+
+    private final int value;
+    private final String text;
+
+    PassengerEquipmentActionType(int value, String text) {
+        this.value = value;
+        this.text = text;
+    }
+
+    public static PassengerEquipmentActionType valueOf(int code) {
+        PassengerEquipmentActionType[] values = PassengerEquipmentActionType.values();
+        for (PassengerEquipmentActionType type : values) {
+            if (type.value == code) {
+                return type;
+            }
+        }
+        return null;
+    }
+
+    public String getText() {
+        return text;
+    }
+
+    public Integer getValue() {
+        return value;
+    }
+
+    @Override
+    public String getName() {
+        return this.name();
+    }
+}

+ 9 - 0
src/main/java/com/zhiqiyun/open/core/mapper/bz/PassengerEquipmentPeopleMapper.java

@@ -0,0 +1,9 @@
+package com.zhiqiyun.open.core.mapper.bz;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.zhiqiyun.open.core.models.bz.PassengerEquipmentPeople;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface PassengerEquipmentPeopleMapper extends BaseMapper<PassengerEquipmentPeople> {
+}

+ 5 - 0
src/main/java/com/zhiqiyun/open/core/models/bz/PassengerEquipment.java

@@ -5,6 +5,7 @@ import com.zhiqiyun.open.core.enmus.BzDataType;
 import com.zhiqiyun.open.core.typeHandler.FastjsonTypeHandler;
 import lombok.Data;
 import org.apache.commons.lang3.StringUtils;
+import org.springframework.scheduling.annotation.Scheduled;
 
 import java.util.Date;
 import java.util.List;
@@ -30,6 +31,10 @@ public class PassengerEquipment {
 
     @TableField(exist = false)
     private String litpic;
+    @TableField(exist = false)
+    private Integer inPeopleCount;
+    @TableField(exist = false)
+    private Integer outPeopleCount;
 
     public String getLitpic() {
         if (StringUtils.isBlank(this.litpic) && this.litpics != null && this.litpics.size() > 0) {

+ 18 - 0
src/main/java/com/zhiqiyun/open/core/models/bz/PassengerEquipmentPeople.java

@@ -0,0 +1,18 @@
+package com.zhiqiyun.open.core.models.bz;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.zhiqiyun.open.core.enmus.PassengerEquipmentActionType;
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+@TableName("passenger_equipment_people")
+public class PassengerEquipmentPeople {
+    private String id;
+    private Long equipment_id;
+    private String faceId;
+    private PassengerEquipmentActionType actionType;
+    private Date createdTime;
+    private Long retentionTime;
+}

+ 27 - 0
src/main/java/com/zhiqiyun/open/core/schedule/EquipmentPeople.java

@@ -0,0 +1,27 @@
+package com.zhiqiyun.open.core.schedule;
+
+import com.zhiqiyun.open.core.models.bz.PassengerEquipmentPeople;
+import com.zhiqiyun.open.core.service.PassengerEquipmentPeopleService;
+import com.zhiqiyun.open.utils.DateUtil;
+import com.zhiqiyun.open.utils.RandomUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+@Slf4j
+@Component
+public class EquipmentPeople {
+    @Autowired
+    private PassengerEquipmentPeopleService passengerEquipmentPeopleService;
+
+    @Scheduled(cron = "0/1 * * * * ?")
+    public void createPeople() {
+        PassengerEquipmentPeople people = new PassengerEquipmentPeople();
+        people.setId(RandomUtil.getuuid());
+        people.setInTime(DateUtil.current());
+        people.setOutTime(DateUtil.current());
+        people.setRetentionTime(1000L);
+        log.info(DateUtil.current().toString());
+    }
+}

+ 7 - 0
src/main/java/com/zhiqiyun/open/core/service/PassengerEquipmentPeopleService.java

@@ -0,0 +1,7 @@
+package com.zhiqiyun.open.core.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.zhiqiyun.open.core.models.bz.PassengerEquipmentPeople;
+
+public interface PassengerEquipmentPeopleService extends IService<PassengerEquipmentPeople> {
+}

+ 11 - 0
src/main/java/com/zhiqiyun/open/core/service/impl/PassengerEquipmentPeopleServiceImpl.java

@@ -0,0 +1,11 @@
+package com.zhiqiyun.open.core.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.zhiqiyun.open.core.mapper.bz.PassengerEquipmentPeopleMapper;
+import com.zhiqiyun.open.core.models.bz.PassengerEquipmentPeople;
+import com.zhiqiyun.open.core.service.PassengerEquipmentPeopleService;
+import org.springframework.stereotype.Service;
+
+@Service
+public class PassengerEquipmentPeopleServiceImpl extends ServiceImpl<PassengerEquipmentPeopleMapper, PassengerEquipmentPeople> implements PassengerEquipmentPeopleService {
+}

+ 0 - 27
src/main/java/com/zhiqiyun/open/core/service/impl/captcha/background/BackgroundFactory.java

@@ -1,27 +0,0 @@
-/*
- * Copyright (c) 2009 Piotr Piastucki
- *
- * This file is part of Patchca CAPTCHA library.
- *
- *  Patchca is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU Lesser General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  Patchca is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU Lesser General Public License for more details.
- *
- *  You should have received a copy of the GNU Lesser General Public License
- *  along with Patchca. If not, see <http://www.gnu.org/licenses/>.
- */
-
-package com.zhiqiyun.open.core.service.impl.captcha.background;
-
-import java.awt.image.BufferedImage;
-
-public interface BackgroundFactory {
-
-	void fillBackground(BufferedImage dest);
-}

+ 0 - 52
src/main/java/com/zhiqiyun/open/core/service/impl/captcha/background/SingleColorBackgroundFactory.java

@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2009 Piotr Piastucki
- *
- * This file is part of Patchca CAPTCHA library.
- *
- *  Patchca is free software: you can redistribute it and/or modify
- *  it under the terms of the GNU Lesser General Public License as published by
- *  the Free Software Foundation, either version 3 of the License, or
- *  (at your option) any later version.
- *
- *  Patchca is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU Lesser General Public License for more details.
- *
- *  You should have received a copy of the GNU Lesser General Public License
- *  along with Patchca. If not, see <http://www.gnu.org/licenses/>.
- */
-package com.zhiqiyun.open.core.service.impl.captcha.background;
-
-
-import com.zhiqiyun.open.core.service.impl.captcha.color.ColorFactory;
-import com.zhiqiyun.open.core.service.impl.captcha.color.SingleColorFactory;
-
-import java.awt.*;
-import java.awt.image.BufferedImage;
-
-
-public class SingleColorBackgroundFactory implements BackgroundFactory {
-
-	private ColorFactory colorFactory;
-
-	public SingleColorBackgroundFactory() {
-		colorFactory = new SingleColorFactory(Color.WHITE);
-	}
-
-	public SingleColorBackgroundFactory(Color color) {
-		colorFactory = new SingleColorFactory(color);
-	}
-
-	public void setColorFactory(ColorFactory colorFactory) {
-		this.colorFactory = colorFactory;
-	}
-
-	@Override
-	public void fillBackground(BufferedImage dest) {
-		Graphics g = dest.getGraphics();
-		g.setColor(colorFactory.getColor(0));
-		g.fillRect(0, 0, dest.getWidth(), dest.getHeight());
-	}
-
-}

+ 7 - 2
src/main/java/com/zhiqiyun/open/mvc/controller/PassengerEquipmentController.java

@@ -10,9 +10,7 @@ import com.zhiqiyun.open.core.service.OauthService;
 import com.zhiqiyun.open.core.service.PassengerEquipmentService;
 import com.zhiqiyun.open.core.service.SequenceService;
 import com.zhiqiyun.open.mvc.Result;
-import com.zhiqiyun.open.mvc.params.bz.QueryHotelInfoParams;
 import com.zhiqiyun.open.mvc.params.bz.QueryPassengerEquipmentParams;
-import com.zhiqiyun.open.mvc.params.bz.SaveHotelInfoParams;
 import com.zhiqiyun.open.mvc.params.bz.SavePassengerEquipmentParams;
 import com.zhiqiyun.open.utils.DateUtil;
 import com.zhiqiyun.open.utils.ServletContext;
@@ -45,6 +43,13 @@ public class PassengerEquipmentController {
 
         QueryWrapper<PassengerEquipment> queryWrapper = new QueryWrapper<>();
 
+        if (params.getDataType() != null) {
+            queryWrapper.eq("data_type", params.getDataType());
+        }
+        if (params.getBzId() != null) {
+            queryWrapper.eq("bz_id", params.getBzId());
+        }
+
         Page<PassengerEquipment> page = params.getPage();
         page.addOrder(OrderItem.desc("id"));
 

+ 3 - 1
src/main/java/com/zhiqiyun/open/mvc/params/bz/QueryPassengerEquipmentParams.java

@@ -1,5 +1,6 @@
 package com.zhiqiyun.open.mvc.params.bz;
 
+import com.zhiqiyun.open.core.enmus.BzDataType;
 import com.zhiqiyun.open.mvc.params.QueryPageParams;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
@@ -7,5 +8,6 @@ import lombok.EqualsAndHashCode;
 @EqualsAndHashCode(callSuper = true)
 @Data
 public class QueryPassengerEquipmentParams extends QueryPageParams {
-
+    private Long bzId;
+    private BzDataType dataType;
 }

+ 13 - 1
src/main/resources/db/migration/V1.0.4__passenger_equipment.sql

@@ -4,7 +4,7 @@ CREATE TABLE `passenger_equipment`
     `id`           BIGINT(20) NOT NULL COMMENT 'ID',
     `data_type`    INT(11) NULL DEFAULT NULL COMMENT '点位类型',
     `bz_id`        BIGINT(20) NULL DEFAULT NULL COMMENT '点位分布',
-    `brief`        INT(11) NULL DEFAULT NULL COMMENT '说明',
+    `brief`        VARCHAR(500) NULL DEFAULT NULL COMMENT '说明',
     `litpics`      VARCHAR(500) NULL DEFAULT NULL COMMENT '图片',
     `created_time` DATETIME NULL DEFAULT NULL COMMENT '创建时间',
     `created_by`   BIGINT(20) NULL DEFAULT NULL COMMENT '创建人',
@@ -13,6 +13,18 @@ CREATE TABLE `passenger_equipment`
     PRIMARY KEY (`id`)
 ) COMMENT ='文旅场所基础信息' ENGINE = InnoDB;
 
+DROP TABLE IF EXISTS `passenger_equipment_people`;
+CREATE TABLE `passenger_equipment_people`
+(
+    `id`             VARCHAR(32) NOT NULL COMMENT 'ID',
+    `equipment_id`   BIGINT(20) NULL DEFAULT NULL COMMENT '设备ID',
+    `in_time`        DATETIME NULL DEFAULT NULL COMMENT '进入时间',
+    `out_time`       DATETIME NULL DEFAULT NULL COMMENT '离开时间',
+    `retention_time` BIGINT(20) NULL DEFAULT NULL COMMENT '停留时间',
+    PRIMARY KEY (`id`)
+) COMMENT ='文旅场所基础信息' ENGINE = InnoDB;
+
+
 REPLACE
 INTO `authority_info` (`id`, `parent_id`, `name`, `remark`)
 VALUES (2000, 0, 'bz.passenger.equipment.tourist', '客户监控设备管理'),