Procházet zdrojové kódy

提供给第三方接口

459242451@qq.com před 4 roky
rodič
revize
e7efcd7777

+ 35 - 0
king-boot-module-ad/src/main/java/org/king/modules/ad/controller/ThirdInterfaceController.java

@@ -0,0 +1,35 @@
+package org.king.modules.ad.controller;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.king.common.api.vo.Result;
+import org.king.common.aspect.annotation.AutoLog;
+import org.king.modules.ad.service.IThirdService;
+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.RestController;
+
+/**
+ * @Description: TODO
+ * @Author: huangcheng
+ * @Date: 2021/6/15
+ * @Version V1.0
+ */
+@Slf4j
+@Api(tags = "第三方提供接口")
+@RestController
+@RequestMapping("/ad/third")
+public class ThirdInterfaceController {
+
+    @Autowired
+    private IThirdService thirdService;
+
+    @AutoLog(value = "第三方查询岸电设备信息")
+    @ApiOperation(value = "第三方查询岸电设备信息", notes = "第三方查询岸电设备信息")
+    @GetMapping(value = "/queryDeviceInfo")
+    public Result<?> queryDeviceInfo() {
+        return Result.ok(thirdService.queryDeviceInfo());
+    }
+}

+ 124 - 0
king-boot-module-ad/src/main/java/org/king/modules/ad/entity/AdDeviceForThird.java

@@ -0,0 +1,124 @@
+package org.king.modules.ad.entity;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @Description: 岸电设备
+ * @Author: king-boot
+ * @Date:   2021-06-09
+ * @Version: V1.0
+ */
+@Data
+public class AdDeviceForThird implements Serializable {
+    private static final long serialVersionUID = 1L;
+    
+    /**设备ID*/
+    @ApiModelProperty(value = "设备ID")
+    private String id;
+
+    /**码头编号 关联base.sys_office 的id*/
+    @ApiModelProperty(value = "码头编号 关联base.sys_office 的id")
+    private String sysOfficeId;
+
+    /**泊位编号 关联base.geom_un_all 的id*/
+    @ApiModelProperty(value = "泊位编号 关联base.geom_un_all 的id")
+    private Integer berthId;
+
+    /**通俗分类:100000-智能设备;200000-半智能设备;300000-非智能设备*/
+    @ApiModelProperty(value = "通俗分类:100000-智能设备;200000-半智能设备;300000-非智能设备")
+    private String type;
+
+    /**电压*/
+    @ApiModelProperty(value = "电压")
+    private String voltage;
+
+    /**额定电流*/
+    @ApiModelProperty(value = "额定电流")
+    private java.math.BigDecimal ratedCurrent;
+
+    /**最大电流*/
+    @ApiModelProperty(value = "最大电流")
+    private java.math.BigDecimal maximumCurrent;
+
+    /**频率*/
+    @ApiModelProperty(value = "频率")
+    private java.math.BigDecimal frequency;
+
+    /**功率*/
+    @ApiModelProperty(value = "功率")
+    private String capy;
+
+    /**插孔数量*/
+    @ApiModelProperty(value = "插孔数量")
+    private Integer number;
+
+    /**空闲数量*/
+    @ApiModelProperty(value = "空闲数量")
+    private Integer freeNum;
+
+    /**管理公司ID*/
+    @ApiModelProperty(value = "管理公司ID")
+    private String companyId;
+
+    /**设备名称*/
+    @ApiModelProperty(value = "设备名称")
+    private String serviceName;
+
+    /**设备生产厂商名称*/
+    @ApiModelProperty(value = "设备生产厂商名称")
+    private String firmName;
+
+    /**具体码头位置描述*/
+    @ApiModelProperty(value = "具体码头位置描述")
+    private String position;
+
+    /**0 收费 1免费 2 未知*/
+    @ApiModelProperty(value = "0 收费 1免费 2 未知")
+    private String isFree;
+
+    /**设备状态 0正常 2故障 3在建*/
+    @ApiModelProperty(value = "设备状态 0正常 2故障 3在建")
+    private String status;
+
+    /**单价*/
+    @ApiModelProperty(value = "单价")
+    private Integer price;
+
+    /**省*/
+    @ApiModelProperty(value = "省")
+    private String province;
+
+    /**市*/
+    @ApiModelProperty(value = "市")
+    private String city;
+
+    /**区*/
+    @ApiModelProperty(value = "区")
+    private String area;
+
+    /**经度*/
+    @ApiModelProperty(value = "经度")
+    private String longitude;
+
+    /**纬度*/
+    @ApiModelProperty(value = "纬度")
+    private String latitude;
+
+    /**安装单位(码头)名称*/
+    @ApiModelProperty(value = "安装单位(码头)名称")
+    private String companyName;
+
+    /**泊位名称*/
+    @ApiModelProperty(value = "泊位名称")
+    private String areaName;
+
+    /**设备当前电量,并非实时电量,更新于每次充电时*/
+    @ApiModelProperty(value = "设备当前电量,并非实时电量,更新于每次充电时")
+    private java.math.BigDecimal currentConsumption;
+
+    private Integer count;
+
+}

+ 16 - 0
king-boot-module-ad/src/main/java/org/king/modules/ad/mapper/ThirdMapper.java

@@ -0,0 +1,16 @@
+package org.king.modules.ad.mapper;
+
+import org.king.modules.ad.entity.AdDeviceForThird;
+
+import java.util.List;
+
+/**
+ * @Description: 岸电设备
+ * @Author: king-boot
+ * @Date: 2021-06-09
+ * @Version: V1.0
+ */
+public interface ThirdMapper {
+
+     List<AdDeviceForThird> queryDeviceInfo();
+}

+ 41 - 0
king-boot-module-ad/src/main/java/org/king/modules/ad/mapper/xml/ThirdMapper.xml

@@ -0,0 +1,41 @@
+<?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="org.king.modules.ad.mapper.ThirdMapper">
+
+    <select id="queryDeviceInfo" resultType="org.king.modules.ad.entity.AdDeviceForThird">
+        select id,
+               sys_office_id,
+               berth_id,
+               type,
+               voltage,
+               rated_current,
+               maximum_current,
+               frequency,
+               capy,
+               number,
+               free_num,
+               company_id,
+               service_name,
+               firm_name,
+               position,
+               is_free,
+               status,
+               price,
+               province,
+               city,
+               area,
+               longitude,
+               latitude,
+               company_name,
+               area_name,
+               current_consumption,
+               ifnull(t2.count, 0) count
+        from ad_device t1
+            left join (
+            select ad_device_id, count(1) as count
+            from ad_charging_record
+            where real_start_time is not null
+            group by ad_device_id) t2 on t1.id = t2.ad_device_id
+        where t1.is_del = 0
+    </select>
+</mapper>

+ 16 - 0
king-boot-module-ad/src/main/java/org/king/modules/ad/service/IThirdService.java

@@ -0,0 +1,16 @@
+package org.king.modules.ad.service;
+
+import org.king.modules.ad.entity.AdDeviceForThird;
+
+import java.util.List;
+
+/**
+ * @Description: 岸电设备
+ * @Author: king-boot
+ * @Date: 2021-06-09
+ * @Version: V1.0
+ */
+public interface IThirdService {
+
+    List<AdDeviceForThird> queryDeviceInfo();
+}

+ 29 - 0
king-boot-module-ad/src/main/java/org/king/modules/ad/service/impl/ThirdServiceImpl.java

@@ -0,0 +1,29 @@
+package org.king.modules.ad.service.impl;
+
+import com.baomidou.dynamic.datasource.annotation.DS;
+import org.king.modules.ad.entity.AdDeviceForThird;
+import org.king.modules.ad.mapper.ThirdMapper;
+import org.king.modules.ad.service.IThirdService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.List;
+
+/**
+ * @Description: TODO
+ * @Author: huangcheng
+ * @Date: 2021/6/15
+ * @Version V1.0
+ */
+@Service
+@DS("multi-datasource1")
+public class ThirdServiceImpl implements IThirdService {
+
+    @Resource
+    private ThirdMapper thirdMapper;
+
+    @Override
+    public List<AdDeviceForThird> queryDeviceInfo() {
+        return thirdMapper.queryDeviceInfo();
+    }
+}

+ 1 - 0
king-boot-module-system/src/main/java/org/king/config/ShiroConfig.java

@@ -98,6 +98,7 @@ public class ShiroConfig {
 		filterChainDefinitionMap.put("/**/*.ico", "anon");
 
 		filterChainDefinitionMap.put("/**/staticalCount/**", "anon"); //登录验证码接口排除
+		filterChainDefinitionMap.put("/ad/third/**", "anon");
 
 		// update-begin--Author:sunjianlei Date:20190813 for:排除字体格式的后缀
 		filterChainDefinitionMap.put("/**/*.ttf", "anon");