Browse Source

巡检签到、签退以及操作类型

fuyuhchuan 1 year ago
parent
commit
254e65a3e8

+ 47 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/controller/web/PatrolInspectionAttendanceController.java

@@ -0,0 +1,47 @@
+package com.usky.fire.controller.web;
+
+
+import com.usky.common.core.bean.ApiResult;
+import com.usky.common.core.bean.CommonPage;
+import com.usky.fire.domain.PatrolInspectionAttendance;
+import com.usky.fire.service.PatrolInspectionAttendanceService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+
+/**
+ * <p>
+ * 签到、签退信息记录表 前端控制器
+ * </p>
+ *
+ * @author fu
+ * @since 2024-02-05
+ */
+@RestController
+@RequestMapping("/patrolInspectionAttendance")
+public class PatrolInspectionAttendanceController {
+    @Autowired
+    private PatrolInspectionAttendanceService patrolInspectionAttendanceService;
+    /**
+     * 分页查询签到记录
+     * @param
+     * @param
+     * @return
+     */
+    @GetMapping("/pageQuery")
+    public ApiResult<CommonPage<PatrolInspectionAttendance>> pageQuery(@RequestBody String requestBody) {
+        return ApiResult.success(patrolInspectionAttendanceService.pageList(requestBody));
+    }
+
+    /**
+     * 新增
+     * @param patrolInspectionAttendance
+     * @return
+     */
+    @PostMapping("/add")
+    public ApiResult<Void> add(@RequestBody PatrolInspectionAttendance patrolInspectionAttendance){
+        patrolInspectionAttendanceService.add(patrolInspectionAttendance);
+        return ApiResult.success();
+    }
+}
+

+ 59 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/controller/web/PatrolInspectionTypeController.java

@@ -0,0 +1,59 @@
+package com.usky.fire.controller.web;
+
+
+import com.usky.common.core.bean.ApiResult;
+import com.usky.common.core.bean.CommonPage;
+import com.usky.fire.domain.PatrolInspectionType;
+import com.usky.fire.service.PatrolInspectionTypeService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * <p>
+ * 类型表 前端控制器
+ * </p>
+ *
+ * @author fu
+ * @since 2024-02-05
+ */
+@RestController
+@RequestMapping("/patrolInspectionType")
+public class PatrolInspectionTypeController {
+    @Autowired
+    private PatrolInspectionTypeService patrolInspectionTypeService;
+    /**
+     * 操作类型分页查询
+     * @param pageNum
+     * @param pageSize
+     * @return
+     */
+    @GetMapping("/pageQuery")
+    public ApiResult<CommonPage<PatrolInspectionType>> pageQuery(
+            @RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum,
+            @RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize) {
+        return ApiResult.success(patrolInspectionTypeService.pageList( pageNum, pageSize));
+    }
+
+    /**
+     * 新增
+     * @param patrolInspectionType
+     * @return
+     */
+    @PostMapping("/add")
+    public ApiResult<Void> add(@RequestBody PatrolInspectionType patrolInspectionType){
+        patrolInspectionTypeService.add(patrolInspectionType);
+        return ApiResult.success();
+    }
+
+    /**
+     * 删除
+     * @param deleteType
+     * @return
+     */
+    @GetMapping("/delete")
+    public ApiResult<Void> delete(@RequestBody PatrolInspectionType deleteType){
+        patrolInspectionTypeService.softDelete(deleteType);
+        return ApiResult.success();
+    }
+}
+

+ 99 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/domain/PatrolInspectionAttendance.java

@@ -0,0 +1,99 @@
+package com.usky.fire.domain;
+
+import java.math.BigDecimal;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import java.time.LocalDateTime;
+import java.io.Serializable;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 签到、签退信息记录表
+ * </p>
+ *
+ * @author fu
+ * @since 2024-02-05
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+public class PatrolInspectionAttendance implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 签到、签退信息记录表主键ID
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 组织机构ID
+     */
+    private Integer deptId;
+
+    /**
+     * 租户ID
+     */
+    private Integer tenantId;
+
+    /**
+     * 签到人
+     */
+    private String operator;
+
+    /**
+     * 签到人id
+     */
+    private Integer operatorId;
+
+    /**
+     * 操作时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private LocalDateTime operateDate;
+
+    /**
+     * 签到类型(0 签到,1 签退)
+     */
+    private Integer operateType;
+
+    /**
+     * 类型表主键id
+     */
+    private Integer typeId;
+
+    /**
+     * 设备编号
+     */
+    private String deviceCode;
+
+    /**
+     * 图片路径
+     */
+    private String imagePath;
+
+    /**
+     * 经度
+     */
+    private BigDecimal longitude;
+
+    /**
+     * 维度
+     */
+    private BigDecimal latitude;
+
+    /**
+     * 备注
+     */
+    private String remarks;
+
+    /**
+     * 身份编号
+     */
+    private String identificationNumber;
+
+}

+ 60 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/domain/PatrolInspectionType.java

@@ -0,0 +1,60 @@
+package com.usky.fire.domain;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 类型表
+ * </p>
+ *
+ * @author fu
+ * @since 2024-02-05
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+public class PatrolInspectionType implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 类型表主键id
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 类型编号
+     */
+    private String typeCode;
+
+    /**
+     * 类型名称
+     */
+    private String typeName;
+
+    /**
+     * 租户ID
+     */
+    private Integer tenantId;
+
+    /**
+     * 组织机构ID
+     */
+    private Integer deptId;
+
+    /**
+     * 备注
+     */
+    private String remarks;
+
+    /**
+     * 删除标识
+     */
+    private Integer deleteFlag;
+
+
+}

+ 16 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/mapper/PatrolInspectionAttendanceMapper.java

@@ -0,0 +1,16 @@
+package com.usky.fire.mapper;
+
+import com.usky.fire.domain.PatrolInspectionAttendance;
+import com.usky.common.mybatis.core.CrudMapper;
+
+/**
+ * <p>
+ * 签到、签退信息记录表 Mapper 接口
+ * </p>
+ *
+ * @author fu
+ * @since 2024-02-05
+ */
+public interface PatrolInspectionAttendanceMapper extends CrudMapper<PatrolInspectionAttendance> {
+
+}

+ 16 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/mapper/PatrolInspectionTypeMapper.java

@@ -0,0 +1,16 @@
+package com.usky.fire.mapper;
+
+import com.usky.fire.domain.PatrolInspectionType;
+import com.usky.common.mybatis.core.CrudMapper;
+
+/**
+ * <p>
+ * 类型表 Mapper 接口
+ * </p>
+ *
+ * @author fu
+ * @since 2024-02-05
+ */
+public interface PatrolInspectionTypeMapper extends CrudMapper<PatrolInspectionType> {
+
+}

+ 22 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/PatrolInspectionAttendanceService.java

@@ -0,0 +1,22 @@
+package com.usky.fire.service;
+
+import com.usky.common.core.bean.CommonPage;
+import com.usky.fire.domain.PatrolInspectionAttendance;
+import com.usky.common.mybatis.core.CrudService;
+
+import java.time.LocalDateTime;
+
+/**
+ * <p>
+ * 签到、签退信息记录表 服务类
+ * </p>
+ *
+ * @author fu
+ * @since 2024-02-05
+ */
+public interface PatrolInspectionAttendanceService extends CrudService<PatrolInspectionAttendance> {
+
+    CommonPage<PatrolInspectionAttendance> pageList(String requestBody);
+
+    void add(PatrolInspectionAttendance patrolInspectionAttendance);
+}

+ 22 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/PatrolInspectionTypeService.java

@@ -0,0 +1,22 @@
+package com.usky.fire.service;
+
+import com.usky.common.core.bean.CommonPage;
+import com.usky.fire.domain.PatrolInspectionType;
+import com.usky.common.mybatis.core.CrudService;
+
+/**
+ * <p>
+ * 类型表 服务类
+ * </p>
+ *
+ * @author fu
+ * @since 2024-02-05
+ */
+public interface PatrolInspectionTypeService extends CrudService<PatrolInspectionType> {
+
+    CommonPage<PatrolInspectionType> pageList(Integer pageNum, Integer pageSize);
+
+    void add(PatrolInspectionType patrolInspectionType);
+
+    void softDelete(PatrolInspectionType deleteType);
+}

+ 74 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PatrolInspectionAttendanceServiceImpl.java

@@ -0,0 +1,74 @@
+package com.usky.fire.service.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.usky.common.core.bean.CommonPage;
+import com.usky.common.core.util.StringUtils;
+import com.usky.common.security.utils.SecurityUtils;
+import com.usky.fire.domain.PatrolInspectionAttendance;
+import com.usky.fire.mapper.PatrolInspectionAttendanceMapper;
+import com.usky.fire.service.PatrolInspectionAttendanceService;
+import com.usky.common.mybatis.core.AbstractCrudService;
+import org.springframework.stereotype.Service;
+
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+
+
+/**
+ * <p>
+ * 签到、签退信息记录表 服务实现类
+ * </p>
+ *
+ * @author fu
+ * @since 2024-02-05
+ */
+@Service
+public class PatrolInspectionAttendanceServiceImpl extends AbstractCrudService<PatrolInspectionAttendanceMapper, PatrolInspectionAttendance> implements PatrolInspectionAttendanceService {
+    @Override
+    public CommonPage<PatrolInspectionAttendance> pageList(String requestBody) {
+        JSONObject request = JSONObject.parseObject(requestBody);
+        Integer pageNum = (Integer) request.getOrDefault("pageNum",1);
+        Integer pageSize = (Integer) request.getOrDefault("pageSize",10);
+        Integer typeId = (Integer) request.get("typeId");
+        String operator = (String) request.get("operator");
+        String startTimeStr = request.getString("startTime");
+        LocalDateTime startTime = StringUtils.isNotBlank(startTimeStr) ? LocalDateTime.parse(startTimeStr, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) : null;
+        String endTimeStr = request.getString("endTime");
+        LocalDateTime endTime = StringUtils.isNotBlank(endTimeStr) ? LocalDateTime.parse(endTimeStr, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")) : LocalDateTime.now();
+        //LocalDateTime startTime = (LocalDateTime) requestVO.getOrDefault("startTime",null);
+        //LocalDateTime endTime = (LocalDateTime) requestVO.getOrDefault("endTime",LocalDateTime.now());
+        IPage<PatrolInspectionAttendance> page = new Page<>(pageNum,pageSize);
+        LambdaQueryWrapper<PatrolInspectionAttendance> queryWrapper = Wrappers.lambdaQuery();
+        queryWrapper.eq(PatrolInspectionAttendance::getTenantId,SecurityUtils.getTenantId());
+
+        if (typeId!=null){
+            queryWrapper.eq(PatrolInspectionAttendance::getTypeId,typeId);
+        }
+
+        if (StringUtils.isNotBlank(operator)) {
+            queryWrapper.eq(PatrolInspectionAttendance::getOperator, operator);
+        }
+
+        if (startTime != null && endTime != null) {
+            queryWrapper.between(PatrolInspectionAttendance::getOperateDate, startTime, endTime);
+        } else if(startTime == null && endTime !=null){
+            queryWrapper.le(PatrolInspectionAttendance::getOperateDate, endTime);
+        }
+
+        queryWrapper.orderByDesc(PatrolInspectionAttendance::getId);
+        page = this.page(page,queryWrapper);
+        return new CommonPage<>(page.getRecords(),page.getTotal(),pageNum,pageSize);
+    }
+
+
+    @Override
+    public void add(PatrolInspectionAttendance patrolInspectionAttendance) {
+        baseMapper.insert(patrolInspectionAttendance);
+    }
+
+
+}

+ 52 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PatrolInspectionTypeServiceImpl.java

@@ -0,0 +1,52 @@
+package com.usky.fire.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.usky.common.core.bean.CommonPage;
+
+import com.usky.common.security.utils.SecurityUtils;
+import com.usky.fire.domain.PatrolInspectionType;
+import com.usky.fire.mapper.PatrolInspectionTypeMapper;
+import com.usky.fire.service.PatrolInspectionTypeService;
+import com.usky.common.mybatis.core.AbstractCrudService;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 类型表 服务实现类
+ * </p>
+ *
+ * @author fu
+ * @since 2024-02-05
+ */
+@Service
+public class PatrolInspectionTypeServiceImpl extends AbstractCrudService<PatrolInspectionTypeMapper, PatrolInspectionType> implements PatrolInspectionTypeService {
+
+    @Override
+    public CommonPage<PatrolInspectionType> pageList(Integer pageNum, Integer pageSize) {
+        IPage<PatrolInspectionType> page = new Page<>(pageNum,pageSize);
+        LambdaQueryWrapper<PatrolInspectionType> queryWrapper = Wrappers.lambdaQuery();
+        queryWrapper
+                .eq(PatrolInspectionType::getTenantId,SecurityUtils.getTenantId())
+                .eq(PatrolInspectionType::getDeleteFlag,0)
+                .orderByDesc(PatrolInspectionType::getId);
+        page = this.page(page,queryWrapper);
+        return new CommonPage<>(page.getRecords(),page.getTotal(),pageNum,pageSize);    }
+
+    @Override
+    public void add(PatrolInspectionType patrolInspectionType) {
+        baseMapper.insert(patrolInspectionType);
+    }
+
+    /**
+     * 软删除
+     * @param deleteType
+     */
+    @Override
+    public void softDelete(PatrolInspectionType deleteType) {
+        deleteType.setDeleteFlag(1);
+        baseMapper.updateById(deleteType);
+    }
+}

+ 23 - 0
service-fire/service-fire-biz/src/main/resources/mapper/fire/PatrolInspectionAttendanceMapper.xml

@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.usky.fire.mapper.PatrolInspectionAttendanceMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.usky.fire.domain.PatrolInspectionAttendance">
+        <id column="id" property="id" />
+        <result column="dept_id" property="deptId" />
+        <result column="tenant_id" property="tenantId" />
+        <result column="operator" property="operator" />
+        <result column="operator_id" property="operatorId" />
+        <result column="operate_date" property="operateDate" />
+        <result column="operate_type" property="operateType" />
+        <result column="type_id" property="typeId" />
+        <result column="device_code" property="deviceCode" />
+        <result column="image_path" property="imagePath" />
+        <result column="longitude" property="longitude" />
+        <result column="latitude" property="latitude" />
+        <result column="remarks" property="remarks" />
+        <result column="identification_number" property="identificationNumber" />
+    </resultMap>
+
+</mapper>

+ 16 - 0
service-fire/service-fire-biz/src/main/resources/mapper/fire/PatrolInspectionTypeMapper.xml

@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.usky.fire.mapper.PatrolInspectionTypeMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.usky.fire.domain.PatrolInspectionType">
+        <id column="id" property="id" />
+        <result column="type_code" property="typeCode" />
+        <result column="type_name" property="typeName" />
+        <result column="tenant_id" property="tenantId" />
+        <result column="dept_id" property="deptId" />
+        <result column="remarks" property="remarks" />
+        <result column="delete_flag" property="deleteFlag" />
+    </resultMap>
+
+</mapper>