Pārlūkot izejas kodu

综合警情-周边资源相关接口开发

jichaobo 2 gadi atpakaļ
vecāks
revīzija
c6631e4d24

+ 1 - 1
service-fire/service-fire-biz/src/main/java/com/usky/fire/controller/MybatisGeneratorUtils.java

@@ -71,7 +71,7 @@ public class MybatisGeneratorUtils {
         // strategy.setTablePrefix("t_"); // 表名前缀
         strategy.setEntityLombokModel(true); //使用lombok
         //修改自己想要生成的表
-        strategy.setInclude("dem_fire_inspect_person");  // 逆向工程使用的表   如果要生成多个,这里可以传入String[]
+        strategy.setInclude("dem_on_duty");  // 逆向工程使用的表   如果要生成多个,这里可以传入String[]
         mpg.setStrategy(strategy);
 
         // 关闭默认 xml 生成,调整生成 至 根目录

+ 21 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/controller/web/DemOnDutyController.java

@@ -0,0 +1,21 @@
+package com.usky.fire.controller.web;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.stereotype.Controller;
+
+/**
+ * <p>
+ * 值班表 前端控制器
+ * </p>
+ *
+ * @author JCB
+ * @since 2022-11-28
+ */
+@Controller
+@RequestMapping("/demOnDuty")
+public class DemOnDutyController {
+
+}
+

+ 79 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/controller/web/UnitBeOnDutyController.java

@@ -0,0 +1,79 @@
+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.DemMicroStation;
+import com.usky.fire.domain.DemVehicle;
+import com.usky.fire.service.DemMicroStationService;
+import com.usky.fire.service.DemOnDutyService;
+import com.usky.fire.service.DemVehicleService;
+import com.usky.fire.service.po.UnitBeOnDutyPO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 值班表 前端控制器
+ * </p>
+ *
+ * @author JCB
+ * @since 2022-11-28
+ */
+@RestController
+@RequestMapping("/unitBeOnDuty")
+public class UnitBeOnDutyController {
+
+    @Autowired
+    private DemOnDutyService demOnDutyService;
+
+    @Autowired
+    private DemMicroStationService demMicroStationService;
+
+    @Autowired
+    private DemVehicleService demVehicleService;
+
+    /**
+     * 消防救援站点-支队值班情况
+     *
+     * @param startTime 开始时间
+     * @param endTime   结束时间
+     * @return
+     */
+    @GetMapping("/list")
+    public ApiResult<List<List<UnitBeOnDutyPO>>> list(@RequestParam(value = "startTime", required = false) String startTime,
+                                                      @RequestParam(value = "endTime", required = false) String endTime) {
+        return ApiResult.success(demOnDutyService.list(startTime, endTime));
+    }
+
+    /**
+     * 消防救援站点-各站点执勤实力
+     *
+     * @param current 当前页
+     * @param size    每页条数
+     * @return
+     */
+    @GetMapping("/page")
+    public ApiResult<CommonPage<DemMicroStation>> page(@RequestParam(value = "current", required = false, defaultValue = "1") Integer current,
+                                                       @RequestParam(value = "size", required = false, defaultValue = "10") Integer size) {
+        return ApiResult.success(demMicroStationService.page(current, size));
+    }
+
+    /**
+     * 消防救援站点-各站点执勤实力
+     *
+     * @param zdCode 所属消防机构
+     * @return
+     */
+    @GetMapping("vehiclelist")
+    public ApiResult<List<DemVehicle>> vehiclelist(@RequestParam String zdCode) {
+        return ApiResult.success(demVehicleService.list(zdCode));
+    }
+
+}
+

+ 166 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/domain/DemOnDuty.java

@@ -0,0 +1,166 @@
+package com.usky.fire.domain;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import java.time.LocalDateTime;
+import java.io.Serializable;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 值班表
+ * </p>
+ *
+ * @author JCB
+ * @since 2022-11-28
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+public class DemOnDuty implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键ID
+     */
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * ID;
+     */
+    private String dutyId;
+
+    /**
+     * 值班日期;
+     */
+    private LocalDateTime dutyTime;
+
+    /**
+     * 所属单位ID;
+     */
+    private String companyId;
+
+    /**
+     * 值班人员ID;
+     */
+    private String personId;
+
+    /**
+     * 值班人员姓名;
+     */
+    private String personName;
+
+    /**
+     * 值班类型ID;
+     */
+    private String dutyTypeId;
+
+    /**
+     * 时间戳;
+     */
+    private String timeStamp;
+
+    /**
+     * 机构名称;
+     */
+    private String organizateName;
+
+    /**
+     * 机构简称;
+     */
+    private String organizateAbbreviate;
+
+    /**
+     * 机构地址;
+     */
+    private String organizateAddress;
+
+    /**
+     * 机构联系电话;
+     */
+    private String linkPhone;
+
+    /**
+     * 机构排序;
+     */
+    private String organizateRank;
+
+    /**
+     * 值班岗位名称;
+     */
+    private String positionName;
+
+    /**
+     * 值班岗位排序;
+     */
+    private String positionRank;
+
+    /**
+     * XM姓名;
+     */
+    private String fullName;
+
+    /**
+     * RYID;
+     */
+    private String ryId;
+
+    /**
+     * RYXH;
+     */
+    private String ryXh;
+
+    /**
+     * YHZH;
+     */
+    private String yhzh;
+
+    /**
+     * ZHID;
+     */
+    private String zhId;
+
+    /**
+     * SJSZJG;
+     */
+    private String sjszjg;
+
+    /**
+     * JLZT;
+     */
+    private String jlzt;
+
+    /**
+     * YDDH;
+     */
+    private String yddh;
+
+    /**
+     * JGJC;
+     */
+    private String jgjc;
+
+    /**
+     * JGTREE;
+     */
+    private String jgtree;
+
+    /**
+     * 身份证号;
+     */
+    private String idNumber;
+
+    /**
+     * 值班人员排序;
+     */
+    private String personRank;
+
+    /**
+     * unionKey;
+     */
+    private String unionKey;
+
+
+}

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

@@ -0,0 +1,16 @@
+package com.usky.fire.mapper;
+
+import com.usky.fire.domain.DemOnDuty;
+import com.usky.common.mybatis.core.CrudMapper;
+
+/**
+ * <p>
+ * 值班表 Mapper 接口
+ * </p>
+ *
+ * @author JCB
+ * @since 2022-11-28
+ */
+public interface DemOnDutyMapper extends CrudMapper<DemOnDuty> {
+
+}

+ 2 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/DemMicroStationService.java

@@ -55,4 +55,6 @@ public interface DemMicroStationService extends CrudService<DemMicroStation> {
     List<Object> microStationScatterer(String streetTown);
 
     List<Object> synthesizePoliceSituationScatterer(String streetTown, String scattererType);
+
+    CommonPage<DemMicroStation> page(Integer current, Integer size);
 }

+ 20 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/DemOnDutyService.java

@@ -0,0 +1,20 @@
+package com.usky.fire.service;
+
+import com.usky.fire.domain.DemOnDuty;
+import com.usky.common.mybatis.core.CrudService;
+import com.usky.fire.service.po.UnitBeOnDutyPO;
+
+import java.util.List;
+
+/**
+ * <p>
+ * 值班表 服务类
+ * </p>
+ *
+ * @author JCB
+ * @since 2022-11-28
+ */
+public interface DemOnDutyService extends CrudService<DemOnDuty> {
+
+    List<List<UnitBeOnDutyPO>> list(String startTime, String endTime);
+}

+ 2 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/DemVehicleService.java

@@ -43,4 +43,6 @@ public interface DemVehicleService extends CrudService<DemVehicle> {
     void delVehicle(Integer id);
 
     List<DemVehicle> vehicleList(List<String> vehicleIdList);
+
+    List<DemVehicle> list(String zdCode);
 }

+ 10 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/DemMicroStationServiceImpl.java

@@ -159,4 +159,14 @@ public class DemMicroStationServiceImpl extends AbstractCrudService<DemMicroStat
         return list;
     }
 
+    @Override
+    public CommonPage<DemMicroStation> page(Integer current, Integer size) {
+        IPage<DemMicroStation> page = new Page<>(current, size);
+        LambdaQueryWrapper<DemMicroStation> queryWrapper = Wrappers.lambdaQuery();
+        queryWrapper.eq(DemMicroStation::getDeleteFlag,0)
+                .orderByDesc(DemMicroStation::getId);
+        page = this.page(page, queryWrapper);
+        return new CommonPage<>(page.getRecords(), page.getTotal(), size, current);
+    }
+
 }

+ 57 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/DemOnDutyServiceImpl.java

@@ -0,0 +1,57 @@
+package com.usky.fire.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.usky.common.mybatis.core.AbstractCrudService;
+import com.usky.fire.domain.DemOnDuty;
+import com.usky.fire.mapper.DemOnDutyMapper;
+import com.usky.fire.service.DemOnDutyService;
+import com.usky.fire.service.po.UnitBeOnDutyPO;
+import org.springframework.stereotype.Service;
+
+import java.time.format.DateTimeFormatter;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.TreeMap;
+import java.util.stream.Collectors;
+
+/**
+ * <p>
+ * 值班表 服务实现类
+ * </p>
+ *
+ * @author JCB
+ * @since 2022-11-28
+ */
+@Service
+public class DemOnDutyServiceImpl extends AbstractCrudService<DemOnDutyMapper, DemOnDuty> implements DemOnDutyService {
+
+    @Override
+    public List<List<UnitBeOnDutyPO>> list(String startTime, String endTime) {
+        List<List<UnitBeOnDutyPO>> lists = new ArrayList<>();
+        List<UnitBeOnDutyPO> list = new ArrayList<>();
+        LambdaQueryWrapper<DemOnDuty> queryWrapper = Wrappers.lambdaQuery();
+        queryWrapper.between(StringUtils.isNotBlank(startTime) && StringUtils.isNotBlank(endTime), DemOnDuty::getDutyTime, startTime, endTime);
+        List<DemOnDuty> unitBeOnDutyLists = this.list(queryWrapper);
+        unitBeOnDutyLists.forEach(stringStringMap -> list.add(enhanceUnitBeOnDutyPo(stringStringMap)));
+        TreeMap<String, List<UnitBeOnDutyPO>> collect = list.stream().collect(Collectors.groupingBy(UnitBeOnDutyPO::getTime, TreeMap::new, Collectors.toList()));
+        for (String s : collect.keySet()) {
+            lists.add(collect.get(s));
+        }
+        return lists;
+    }
+
+    public UnitBeOnDutyPO enhanceUnitBeOnDutyPo(DemOnDuty unitBeOnDutyMap) {
+        DateTimeFormatter fmt = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+        UnitBeOnDutyPO unitBeOnDutyPo = new UnitBeOnDutyPO();
+        unitBeOnDutyPo.setName(unitBeOnDutyMap.getPersonName());
+        unitBeOnDutyPo.setPostName(unitBeOnDutyMap.getPositionName());
+        unitBeOnDutyPo.setOrganizationName(unitBeOnDutyMap.getOrganizateName());
+        unitBeOnDutyPo.setOrganizationShort(unitBeOnDutyMap.getOrganizateAbbreviate());
+        unitBeOnDutyPo.setOrganizationAddress(unitBeOnDutyMap.getOrganizateAddress());
+        unitBeOnDutyPo.setTime(unitBeOnDutyMap.getDutyTime().format(fmt));
+        return unitBeOnDutyPo;
+    }
+
+}

+ 7 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/DemVehicleServiceImpl.java

@@ -94,4 +94,11 @@ public class DemVehicleServiceImpl extends AbstractCrudService<DemVehicleMapper,
         return list;
     }
 
+    @Override
+    public List<DemVehicle> list(String zdCode) {
+        LambdaQueryWrapper<DemVehicle> queryWrapper = Wrappers.lambdaQuery();
+        queryWrapper.eq(DemVehicle::getFireOrga, zdCode);
+        return this.list(queryWrapper);
+    }
+
 }

+ 46 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/po/UnitBeOnDutyPO.java

@@ -0,0 +1,46 @@
+package com.usky.fire.service.po;
+
+import lombok.Data;
+
+import java.time.LocalDateTime;
+
+/**
+ * @author yq
+ * @date 2021/5/27 15:19
+ * 值班表
+ */
+@Data
+public class UnitBeOnDutyPO {
+
+    /**
+     * 名称
+     */
+    private String name;
+
+
+    /**
+     * 岗位名称
+     */
+    private String postName;
+
+
+    /**
+     * 机构名称
+     */
+    private String organizationName;
+
+    /**
+     * 机构简称
+     */
+    private String organizationShort;
+    /**
+     * 机构地址
+      */
+    private String organizationAddress;
+
+    /**
+     * 值班日期
+     */
+    private String time;
+
+}

+ 37 - 0
service-fire/service-fire-biz/src/main/resources/mapper/fire/DemOnDutyMapper.xml

@@ -0,0 +1,37 @@
+<?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.DemOnDutyMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="BaseResultMap" type="com.usky.fire.domain.DemOnDuty">
+        <id column="id" property="id" />
+        <result column="duty_id" property="dutyId" />
+        <result column="duty_time" property="dutyTime" />
+        <result column="company_id" property="companyId" />
+        <result column="person_id" property="personId" />
+        <result column="person_name" property="personName" />
+        <result column="duty_type_id" property="dutyTypeId" />
+        <result column="time_stamp" property="timeStamp" />
+        <result column="organizate_name" property="organizateName" />
+        <result column="organizate_abbreviate" property="organizateAbbreviate" />
+        <result column="organizate_address" property="organizateAddress" />
+        <result column="link_phone" property="linkPhone" />
+        <result column="organizate_rank" property="organizateRank" />
+        <result column="position_name" property="positionName" />
+        <result column="position_rank" property="positionRank" />
+        <result column="full_name" property="fullName" />
+        <result column="ry_id" property="ryId" />
+        <result column="ry_xh" property="ryXh" />
+        <result column="yhzh" property="yhzh" />
+        <result column="zh_id" property="zhId" />
+        <result column="sjszjg" property="sjszjg" />
+        <result column="jlzt" property="jlzt" />
+        <result column="yddh" property="yddh" />
+        <result column="jgjc" property="jgjc" />
+        <result column="jgtree" property="jgtree" />
+        <result column="id_number" property="idNumber" />
+        <result column="person_rank" property="personRank" />
+        <result column="union_key" property="unionKey" />
+    </resultMap>
+
+</mapper>